# Create static NAT entry This sample application demonstrates how to create static NAT entry. 1. Implement initialization callback and get the DataFactory instance 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 lock(mtx); status_ = status; initCv.notify_all(); }; auto &dataFactory = telux::data::DataFactory::getInstance(); Copy to clipboard 2. Get the NatManager instances std::unique_lock lck(mtx); auto dataSnatMgr = dataFactory.getNatManager(opType); Copy to clipboard 3. Wait for NatManager initialization to be complete initCv.wait(lck); Copy to clipboard 3.1 Check NatManager initialization state If NatManager initialization failed, new initialization attempt can be accomplished by calling step 2. If NatManager 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 callback for create SNAT entry auto respCb = [](telux::common::ErrorCode error) { std::cout << std::endl << std::endl; std::cout << "CALLBACK: " << "addStaticNatEntry" << (error == telux::common::ErrorCode::SUCCESS ? " is successful" : " failed"); }; Copy to clipboard 5. Create Snat entry based on profile id, local ip, local port, global port, and protocol natConfig.addr = ipAddr; natConfig.port = (uint16_t)localIpPort; natConfig.globalPort = (uint16_t)globalIpPort; natConfig.proto = (uint8_t)proto; dataSnatMgr->addStaticNatEntry(profileId, natConfig, respCb); Copy to clipboard Now, response callback will be called for the addStaticNatEntry response. Last Published: Aug 05, 2026 [Previous Topic Create VLAN And bind it to a PDN](https://docs.qualcomm.com/bundle/publicresource/80-PF458-9/topics/create_and_bind_vlan.md) [Next Topic Enable L2TP and add a tunnel](https://docs.qualcomm.com/bundle/publicresource/80-PF458-9/topics/enable_and_add_tunnel_l2tp.md)