# Adding a software bridge and enable its management

This sample application demonstrates how to add a software bridge and enable its management.

1. Implement initialization callback Get the DataFactory instances

Optionally initialization callback can be provided with get manager instance.
Data factory will call callback when manager initialization is complete.

auto initCb = [&](telux::common::ServiceStatus status) {
       std::lock_guard<std::mutex> lock(mtx);
       status_ = status;
       initCv.notify_all();
    };
    
    auto &dataFactory = telux::data::DataFactory::getInstance();
    Copy to clipboard

2. Get the BridgeManager instances

std::unique_lock<std::mutex> lck(mtx);
    auto dataBridgeMgr  = dataFactory.getBridgeManager(initCb);
    Copy to clipboard

3. Wait for BridgeManager initialization to be complete

initCv.wait(lck);
    Copy to clipboard

3.1 Check BridgeManager initialization state

BridgeManager needs to be ready to remove a software bridge and disable the software bridge
management in the system. If BridgeManager initialization failed, new initialization attempt can
be accomplished by calling step 2. If BridgeManager initialization succeed, proceed to step 4.

if (status_ == telux::common::ServiceStatus::SERVICE_AVAILABLE) {
       // Go to step 4
    }
    else {
       //Go to step 2 for another initialization attempt
    }
    Copy to clipboard

4. Implement callbacks for adding a software bridge enabling its management

auto respCbAdd = [](telux::common::ErrorCode error) {
        std::cout << "CALLBACK: "
                  << "Add software bridge request"
                  << (error == telux::common::ErrorCode::SUCCESS ? " is successful" : " failed")
                  << ". ErrorCode: " << static_cast<int>(error)
                  << ", description: " << Utils::getErrorCodeAsString(error) << std::endl;
    };
    
    auto respCbEnable = [](telux::common::ErrorCode error) {
        std::cout << "CALLBACK: "
                  << "Enable software bridge management request is"
                  << (error == telux::common::ErrorCode::SUCCESS ? " successful" : " failed")
                  << ". ErrorCode: " << static_cast<int>(error)
                  << ", description: " << Utils::getErrorCodeAsString(error) << std::endl;
    };
    Copy to clipboard

5. Add software bridge based on the interface name, interface type and bandwidth required

telux::data::net::BridgeInfo config;
    config.ifaceName = infName;
    config.ifaceType = infType;
    config.bandwidth = bridgeBw;
    dataBridgeMgr->addBridge(config, respCbAdd);
    Copy to clipboard

Now, response callback will be invoked with the addBridge response.

6. Enable the software bridge management if not enabled already

bool enable = true;
    dataBridgeMgr->enableBridge(enable, respCbEnable);
    Copy to clipboard

Now, response callback will be invoked with the enableBridge response.

Last Published: Apr 14, 2026

[Previous Topic
Add Firewall Entry](https://docs.qualcomm.com/bundle/publicresource/80-PF458-1/topics/add_firewall_entry.md) [Next Topic
Remove a software bridge and its management](https://docs.qualcomm.com/bundle/publicresource/80-PF458-1/topics/remove_disable_software_bridge.md)