# Network Service

- [API reference](https://docs.qualcomm.com/doc/80-41102-2/topic/_doxygen_rst_file__doxygen_sources_taf_net_interface_h.html#file-taf-net-interface-h)

The Network service APIs unified TelAF networking APIs for configuration.

Network service provides APIs for applications to manage route, gateway, DNS, NAT, GSB, VLAN, Socksv5, L2tp, filter, and firewall.

## IPC interfaces binding

All functions of this API are provided by the **tafNetSvc** application service.

The following example shows how to bind to the network service.

bindings:
    {
        clientExe.clientComponent.taf_net -> tafNetSvc.taf_net
    }
    Copy to clipboard

## Route management

Routes can be changed using taf\_net\_ChangeRoute with the interface name, destination address, prefix length, metric, and isAdd passed as parameters.

The following example shows how to change a route. This example adds a route with interface “eth0”, destination address “192.168.10.0”, subnet mask “255.255.255.0”, and metric 0.

result=taf_net_ChangeRoute("eth0","192.168.10.0",24,0,TAF_NET_ADD);
    Copy to clipboard

Before changing the route, an application can register a state handler using [taf\_net\_AddRouteChangeHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1afc107f6f432b18cf000c158daf3b459a.html#Documentationa00626_1afc107f6f432b18cf000c158daf3b459a). Once the route is changed, the handler will be called.

routeChangeHandlerRef = taf_net_AddRouteChangeHandler(
                            (taf_net_RouteChangeHandlerFunc_t)NetRouteChangeHandlerFunc, NULL);
    Copy to clipboard

To remove the handler, an application can use taf\_net\_RemoveRouteChangeHandler(routeChangeHandlerRef);

## Gateway management

Gateway management provides APIs to set, backup, restore system default gateway, and query interface gateway, including IPv4 and IPv6 addresses.

The default gateway can be set using taf\_net\_SetDefaultGW with the interface name passed as a parameter. The gateway addresses of the interface will be retrieved and set into the system.

The following example shows how to set the default gateway. This example sets the system default gateways with gateway addresses from interface “rmnet\_data1”, including IPv4 and IPv6 gateways.

result=taf_net_SetDefaultGW("rmnet_data1");
    Copy to clipboard

Before setting the default gateway, an application can register a state handler using [taf\_net\_AddGatewayChangeHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a5e4e02521c3e4ac878f32bc689575a22.html#Documentationa00626_1a5e4e02521c3e4ac878f32bc689575a22). Once the default gateway is set, the handler will be called.

gatewayChangeHandlerRef = taf_net_AddGatewayChangeHandler(
                            (taf_net_GatewayChangeHandlerFunc_t)NetGatewayChangeHandlerFunc, NULL);
    Copy to clipboard

To remove the handler, an application can use taf\_net\_RemoveGatewayChangeHandler(gatewayChangeHandlerRef);

The following APIs are supported for gateway management

- [taf\_net\_SetDefaultGW()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a288a25fd7750dd15bbc9bd8d785e2a51.html#Documentationa00626_1a288a25fd7750dd15bbc9bd8d785e2a51) — Sets the system’s default gateway.
- [taf\_net\_GetInterfaceGW()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a40d1525bcdaf0740e77c9ea9a4de5d6c.html#Documentationa00626_1a40d1525bcdaf0740e77c9ea9a4de5d6c) — Gets the interface gateway.
- [taf\_net\_BackupDefaultGW()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a5ef8556596c1c81d894c6284bf8c36fa.html#Documentationa00626_1a5ef8556596c1c81d894c6284bf8c36fa) — Backs up the system gateway.
- [taf\_net\_RestoreDefaultGW()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1aef0e7c04a5cc93b26c6b65e8250b112a.html#Documentationa00626_1aef0e7c04a5cc93b26c6b65e8250b112a) — Restores the system gateway.
- [taf\_net\_AddGatewayChangeHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a5e4e02521c3e4ac878f32bc689575a22.html#Documentationa00626_1a5e4e02521c3e4ac878f32bc689575a22) — Adds a handler for gateway changes.
- [taf\_net\_RemoveGatewayChangeHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a77e50700b947efd7bdf1a878a72ed353.html#Documentationa00626_1a77e50700b947efd7bdf1a878a72ed353) — Removes a handler for gateway changes.

## DNS management

DNS can be set using taf\_net\_SetDNS with the interface name passed as the parameter. The DNS addresses of the interface will be retrieved and set into the system including the primary IPv4 and IPv6 addresses and secondary IPv4 and IPv6 addresses.

The following example shows how to set DNS. This example sets the system DNS addresses with DNS addresses from interface “rmnet\_data1”, including IPv4 and IPv6 DNS addresses.

result=taf_net_SetDNS("rmnet_data1");
    Copy to clipboard

Before setting the DNS, an application can register a state handler using [taf\_net\_AddDNSChangeHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a5daecd13a044303176eb3eb21fd0403b.html#Documentationa00626_1a5daecd13a044303176eb3eb21fd0403b). Once the DNS is set, the handler will be called.

DNSChangeHandlerRef = taf_net_AddDNSChangeHandler(
                            (taf_net_DNSChangeHandlerFunc_t)NetDNSChangeHandlerFunc, NULL);
    Copy to clipboard

To remove the handler, an application can use taf\_net\_RemoveDNSChangeHandler(DNSChangeHandlerRef).

[taf\_net\_GetInterfaceDNS()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a30311517250923ea61f3584e439590f3.html#Documentationa00626_1a30311517250923ea61f3584e439590f3) can be used to query the interface DNS addresses, including the primary IPv4 and IPv6 addresses and secondary IPv4 and IPv6 addresses.

## Static destination NAT management

Static destination NAT can be added, removed, and retrieved for the default PDN and on-demand PDN.

Static destination NAT can be added using taf\_net\_AddDestNatEntryOnDefaultPdn with the private IP address, private port, global port, and IP protocol type passed as parameters. The destination NAT will be added into iptables if the default PDN is brought up.

The following example shows how to add a static destination NAT entry on the default PDN. This example adds a static destination NAT entry on the default PDN with private IP address “192.168.225.30”, private port 5000, global port 5000 and TCP protocol type.

result=taf_net_AddDestNatEntryOnDefaultPdn("192.168.225.30", 5000, 5000, TAF_NET_TCP);
    Copy to clipboard

The following APIs are supported for NAT management

- [taf\_net\_AddDestNatEntryOnDefaultPdn()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a13aa7f0acc875b960a8361747cff6c20.html#Documentationa00626_1a13aa7f0acc875b960a8361747cff6c20) — Adds destination NAT for default PDN.
- [taf\_net\_RemoveDestNatEntryOnDefaultPdn()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a6272b5572c2ae03848429fd232f1193e.html#Documentationa00626_1a6272b5572c2ae03848429fd232f1193e) — Removes destination NAT for default PDN.
- [taf\_net\_AddDestNatEntryOnDemandPdn()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a3cf61c965a9e36d8b1b900dc24c411ca.html#Documentationa00626_1a3cf61c965a9e36d8b1b900dc24c411ca) — Adds destination NAT for on-demand PDN.
- [taf\_net\_RemoveDestNatEntryOnDemandPdn()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ad252d239ed2a05745a4b45eaf0cb417d.html#Documentationa00626_1ad252d239ed2a05745a4b45eaf0cb417d) — Removes destination NAT for on-demand PDN.
- [taf\_net\_GetDestNatEntryListOnDefaultPdn()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ab96f7fdf41fe0cf8320412b7739d49d8.html#Documentationa00626_1ab96f7fdf41fe0cf8320412b7739d49d8) — Gets the reference of destination NAT entry list for the default PDN.
- [taf\_net\_GetDestNatEntryListOnDemandPdn()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a11b280bb5380938817e0239824ab9c15.html#Documentationa00626_1a11b280bb5380938817e0239824ab9c15) — Gets the reference of destination NAT entry list for an on-demand PDN.
- [taf\_net\_GetFirstDestNatEntry()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ae3fbf1cbbe1a5dfae402453c9c08ee81.html#Documentationa00626_1ae3fbf1cbbe1a5dfae402453c9c08ee81) — Gets the reference of the first destination NAT entry.
- [taf\_net\_GetNextDestNatEntry()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a6dcf9e82c52fab62875f5cb1f51dc5e1.html#Documentationa00626_1a6dcf9e82c52fab62875f5cb1f51dc5e1) — Gets the reference of the next destination NAT entry.
- [taf\_net\_GetDestNatEntryDetails()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a83f898b77c1d83be6104bcb23a5d78a5.html#Documentationa00626_1a83f898b77c1d83be6104bcb23a5d78a5) — Gets the details of destination NAT entry.
- [taf\_net\_DeleteDestNatEntryList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1abdb50059126728f3ef903856dca5f823.html#Documentationa00626_1abdb50059126728f3ef903856dca5f823) — Deletes the reference of destination NAT entry list.
- [taf\_net\_AddDestNatChangeHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a480c70e7bbdf932d2dfb47285267a341.html#Documentationa00626_1a480c70e7bbdf932d2dfb47285267a341) — Adds a handler for NAT changes.
- [taf\_net\_RemoveDestNatChangeHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a24e1f43e7ec5cd6b147327ed9c182de1.html#Documentationa00626_1a24e1f43e7ec5cd6b147327ed9c182de1) — Removes a handler for NAT changes.

**NOTE:** When adding a static destination NAT entry, and changing the default profile ID the static destination NAT entry will be changed accordingly.

**NOTE:** After binding VLAN with the profile ID, the corresponding destination NAT for on-demand PDN can be added into iptables.

## VLAN management

VLAN management provides APIs for VLAN creation, VLAN binding, and VLAN information querying.

VLAN can be created using taf\_net\_CreateVlan with VLAN ID and isAccelerated passed as parameters. After VLAN is created, the application can use taf\_net\_AddVlanInterface to add VLAN interface and then use taf\_net\_BindVlanWithProfile to bind VLAN with profile.

The following example shows how to create a VLAN. This example creates a VLAN with VLAN ID 5, and the VLAN will not be accelerated. The return value is the VLAN reference.

vlanReference = taf_net_CreateVlan(5, false);
    if (!vlanReference)
    {
       LE_INFO("isAccelerated conflicts with old value");
       return LE_FAULT;
    }
    Copy to clipboard

The following APIs are supported for VLAN

- [taf\_net\_CreateVlan()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a58b85391c0fe80131139ad18bafcbe89.html#Documentationa00626_1a58b85391c0fe80131139ad18bafcbe89) — Creates a VLAN.
- [taf\_net\_RemoveVlan()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a1dfe465b2b07bbcc7f500987ba3a5338.html#Documentationa00626_1a1dfe465b2b07bbcc7f500987ba3a5338) — Removes a VLAN.
- [taf\_net\_GetVlanById()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a4b097566786e833f205d36c572759b14.html#Documentationa00626_1a4b097566786e833f205d36c572759b14) — Gets a VLAN reference.

A VLAN interface can be added using taf\_net\_AddVlanInterface with VLAN reference and interface type passed as parameters.

The following example shows how to add a VLAN interface. This example adds a VLAN interface into VLAN with interface type TAF\_NET\_ETH.

result = taf_net_AddVlanInterface(vlanReference, TAF_NET_ETH);
    Copy to clipboard

The following APIs are supported for VLAN interface

- [taf\_net\_AddVlanInterface()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a482d01608e43b47b283eafd9b0b6e3d4.html#Documentationa00626_1a482d01608e43b47b283eafd9b0b6e3d4) — Adds a VLAN interface.
- [taf\_net\_RemoveVlanInterface()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a932233bd145a0f9038f0c00048ff92a1.html#Documentationa00626_1a932233bd145a0f9038f0c00048ff92a1) — Removes a VLAN interface.
- [taf\_net\_GetVlanInterfaceList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a86ce411c2317b798e431edacaa125f09.html#Documentationa00626_1a86ce411c2317b798e431edacaa125f09) — Gets the reference of the VLAN interface list.
- [taf\_net\_GetFirstVlanInterface()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ac03824dd9cad47fa23b77d05ff14ef16.html#Documentationa00626_1ac03824dd9cad47fa23b77d05ff14ef16) — Gets the reference of the first VLAN interface.
- [taf\_net\_GetNextVlanInterface()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a73570bb324e7dab46f1147403f4965ee.html#Documentationa00626_1a73570bb324e7dab46f1147403f4965ee) — Gets the reference of the next VLAN interface.
- [taf\_net\_DeleteVlanInterfaceList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a001b7594f89bbce188775f4119003878.html#Documentationa00626_1a001b7594f89bbce188775f4119003878) — Deletes the reference of the VLAN interface list.
- [taf\_net\_GetVlanInterfaceType()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a28c1e5bc3b1d6fc73803f35a571bb18a.html#Documentationa00626_1a28c1e5bc3b1d6fc73803f35a571bb18a) — Gets the VLAN interface type.

**NOTE:** When adding or deleting a VLAN interface for a VLAN with isAccelerated as true, if the interface is the first added or last deleted for the interface type in the system, the system will automatically reboot after 5 seconds.

The following APIs are supported for VLAN information retrieval.

- [taf\_net\_GetVlanEntryList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ab6830ff72bcc17cc0aed3708b3454132.html#Documentationa00626_1ab6830ff72bcc17cc0aed3708b3454132) — Gets the reference of the VLAN entry list.
- [taf\_net\_GetFirstVlanEntry()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a64764d27a447fc866b279dc066956f65.html#Documentationa00626_1a64764d27a447fc866b279dc066956f65) — Gets the reference of the first VLAN entry.
- [taf\_net\_GetNextVlanEntry()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a513ba018237b57914da81290e7af79cc.html#Documentationa00626_1a513ba018237b57914da81290e7af79cc) — Gets the reference of the next VLAN entry.
- [taf\_net\_DeleteVlanEntryList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ad93bed21446f630420441cd09d25b94b.html#Documentationa00626_1ad93bed21446f630420441cd09d25b94b) — Deletes the reference of the VLAN entry list.
- [taf\_net\_GetVlanId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1af1606d6f0af3bca8b4b52c615de3c7c6.html#Documentationa00626_1af1606d6f0af3bca8b4b52c615de3c7c6) — Gets the VLAN ID.
- [taf\_net\_IsVlanAccelerated()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a4a12d752108befe79ad0585f5db7936c.html#Documentationa00626_1a4a12d752108befe79ad0585f5db7936c) — Checks if the VLAN is accelerated.
- [taf\_net\_GetVlanBoundProfileId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a587600e413e3579650a96f2d577f20f0.html#Documentationa00626_1a587600e413e3579650a96f2d577f20f0) — Gets the profile ID bound with this VLAN.

VLAN can be bound with a profile using taf\_net\_BindVlanWithProfile with the VLAN reference and profile ID passed as parameters.

The following example shows how to bind VLAN with a profile. This example binds VLAN with profile ID 5.

result = taf_net_BindVlanWithProfile(vlanReference, 5);
    Copy to clipboard

The API taf\_net\_UnbindVlanFromProfile can be used to unbind VLAN from a profile.

**NOTE:** If binding VLAN with the default profile ID, the system will automatically reboot after 5 seconds.

**NOTE:** If unbinding VLAN from default profile id, the system will automatically reboot after 5 seconds.

## L2TP management

L2TP management provides APIs for enabling and disabling L2TP, creating and removing tunnels, adding and removing sessions, setting UDP ports, starting and stopping tunnels, and querying L2TP information.

Tunnels can be created using taf\_net\_CreateTunnel. After creating a tunnel, the application can use taf\_net\_SetTunnelUdpPort to set the UDP port for UDP encapsulation protocol, taf\_net\_AddSession to add a session to the tunnel, and then taf\_net\_StartTunnel to start the tunnel.

The following example shows how to create a tunnel. This example creates a tunnel with IP encapsulation protocol, local tunnel ID 1, peer tunnel ID 1, peer IP address fd53:7cb8:383:5::2, and interface name eth0.5. The return value is the tunnel reference.

tunnelReference = taf_net_CreateTunnel(TAF_NET_L2TP_IP, 1, 1, "fd53:7cb8:383:5::2", "eth0.5");
    if (!tunnelReference)
    {
       LE_INFO("Failed to create a tunnel");
       return LE_FAULT;
    }
    Copy to clipboard

An application can synchrounously start a tunnel using taf\_net\_StartTunnel with the tunnel reference passed as a parameter.

result = taf_net_StartTunnel(tunnelReference);
    if (result != LE_OK)
    {
       LE_INFO("Failed to start a tunnel");
       return LE_FAULT;
    }
    Copy to clipboard

An application can asynchrounously start a tunnel using taf\_net\_StartTunnelAsync with the tunnel reference and handler function passed as parameters.

taf_net_StartTunnelAsync(tunnelRef,StartTunnelAsyncHandlerFunc,NULL);
    Copy to clipboard

Before asynchrounously starting a tunnel, an application defines a handler function. Once the tunnel is started, the handler function will be called.

void StartTunnelAsyncHandlerFunc(taf_net_TunnelRef_t tunnelRef,
                                     le_result_t result,
                                     void* contextPtr)
    {
        LE_INFO("**** Handler for Start Tunnel Asynchronously (Begin)****");
        LE_INFO("tunnelRef= %p, result: %d", tunnelRef, result);
        LE_INFO("**** Handler for Start Tunnel Asynchronously (End)****");
    }
    Copy to clipboard

The following APIs are supported for tunnel configuration.

- [taf\_net\_CreateTunnel()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ab3b62c4ca94b194701556c9caeb80b16.html#Documentationa00626_1ab3b62c4ca94b194701556c9caeb80b16) — Creates a tunnel.
- [taf\_net\_RemoveTunnel()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1aa7e7f892154ec0e2df8dc2387f287ed5.html#Documentationa00626_1aa7e7f892154ec0e2df8dc2387f287ed5) — Removes a tunnel.
- [taf\_net\_SetTunnelUdpPort()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a3aabe1bc62b3212fb1a8c1a9579b2c0a.html#Documentationa00626_1a3aabe1bc62b3212fb1a8c1a9579b2c0a) — Sets UDP port for a tunnel.
- [taf\_net\_AddSession()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1aee47eda6e2dff26c6b1cb517288c4ccb.html#Documentationa00626_1aee47eda6e2dff26c6b1cb517288c4ccb) — Adds a session to a tunnel.
- [taf\_net\_RemoveSession()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a933ac85324a05391e915a0a9f108b277.html#Documentationa00626_1a933ac85324a05391e915a0a9f108b277) — Removes a session from a tunnel.
- [taf\_net\_StartTunnel()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ab4b39b26b815d882c2a58ef14aeddbf7.html#Documentationa00626_1ab4b39b26b815d882c2a58ef14aeddbf7) — Synchronously starts a tunnel.
- [taf\_net\_StartTunnelAsync()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ab21a9d88d9de88f2243ea14bc8c6e2ce.html#Documentationa00626_1ab21a9d88d9de88f2243ea14bc8c6e2ce) — Asynchronously starts a tunnel.
- [taf\_net\_StopTunnel()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a371717f71e7f67787b4fd79c5f556a8c.html#Documentationa00626_1a371717f71e7f67787b4fd79c5f556a8c) — Synchronously stops a tunnel.
- [taf\_net\_StopTunnelAsync()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a6a19487fc8a3e5f6596f15f1f19ce9b7.html#Documentationa00626_1a6a19487fc8a3e5f6596f15f1f19ce9b7) — Asynchronously stops a tunnel.
- [taf\_net\_GetTunnelRefById()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a60d3ed2811c34e785a5af43646dfc823.html#Documentationa00626_1a60d3ed2811c34e785a5af43646dfc823) — Gets a tunnel reference.

The following APIs are supported for tunnel information retrieval.

- [taf\_net\_GetTunnelEntryList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a4c4a8133f5d901038c8e115ac0e531f2.html#Documentationa00626_1a4c4a8133f5d901038c8e115ac0e531f2) — Gets the reference of the tunnel entry list.
- [taf\_net\_GetFirstTunnelEntry()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1af23c6e6f099c07f4b6139b7d6b99d5e2.html#Documentationa00626_1af23c6e6f099c07f4b6139b7d6b99d5e2) — Gets the reference of the first tunnel entry.
- [taf\_net\_GetNextTunnelEntry()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ac1c6d3f808f528301382d35348af36b8.html#Documentationa00626_1ac1c6d3f808f528301382d35348af36b8) — Gets the reference of the next tunnel entry.
- [taf\_net\_DeleteTunnelEntryList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a539335a914640ee17311ca88f816aa3e.html#Documentationa00626_1a539335a914640ee17311ca88f816aa3e) — Deletes the reference of the tunnel entry list.
- [taf\_net\_GetTunnelEncapProto()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1add3cd6ff70a1b0a9f4384ad770ad0941.html#Documentationa00626_1add3cd6ff70a1b0a9f4384ad770ad0941) — Gets the encapsulation protocol of a tunnel.
- [taf\_net\_GetTunnelLocalId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ac3b226ddbb648b5a578a919fd27e13c5.html#Documentationa00626_1ac3b226ddbb648b5a578a919fd27e13c5) — Gets the local ID of a tunnel.
- [taf\_net\_GetTunnelPeerId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ad1cd7116e56f077552fa93eb47a4a69e.html#Documentationa00626_1ad1cd7116e56f077552fa93eb47a4a69e) — Gets the peer ID of a tunnel.
- [taf\_net\_GetTunnelLocalUdpPort()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1af87c02cdebc7b999db0f989fa13c89fd.html#Documentationa00626_1af87c02cdebc7b999db0f989fa13c89fd) — Gets the local UDP port of a tunnel.
- [taf\_net\_GetTunnelPeerUdpPort()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ac94064af54bd0e937b1b946565927847.html#Documentationa00626_1ac94064af54bd0e937b1b946565927847) — Gets the peer UDP port of a tunnel.
- [taf\_net\_GetTunnelPeerIpv6Addr()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1aa608c83c4166197717d8f1a56a07c828.html#Documentationa00626_1aa608c83c4166197717d8f1a56a07c828) — Gets the peer IPv6 address of a tunnel.
- [taf\_net\_GetTunnelPeerIpv4Addr()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a661c9013fa21a7073e10cde525806b45.html#Documentationa00626_1a661c9013fa21a7073e10cde525806b45) — Gets the peer IPv4 address of a tunnel.
- [taf\_net\_GetTunnelInterfaceName()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a62f36a94babac3d99730ef0ac8b55393.html#Documentationa00626_1a62f36a94babac3d99730ef0ac8b55393) — Gets the interface name of a tunnel.
- [taf\_net\_GetTunnelIpType()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a6d73e75105c9a89dbd9542f5a5370a19.html#Documentationa00626_1a6d73e75105c9a89dbd9542f5a5370a19) — Gets the IP type of a tunnel.
- [taf\_net\_GetSessionConfig()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1abbe392bd1266ff5e0c6c59809d4bb26c.html#Documentationa00626_1abbe392bd1266ff5e0c6c59809d4bb26c) — Gets the session configuration of a tunnel.

## SOCKS management

Socket Secure (SOCKS) management provides APIs for enabling and disabling SOCKS, setting and getting SOCKS authentication method type, setting and getting LAN interface, and adding and removing SOCKS associations between usernames and profile IDs.

SOCKS can be enabled using taf\_net\_EnableSocks. After setting the authentication method type and LAN interface, and adding the association the application can enable SOCKS.

The following example shows how to enable SOCKS. This example starts a SOCKS application which listens on port 1080.

result = taf_net_EnableSocks();
    if (result != LE_OK)
    {
       LE_INFO("Failed to enable SOCKS");
       return LE_FAULT;
    }
    Copy to clipboard

An application can asynchrounously enable SOCKS using taf\_net\_EnableSocksAsync with a handler function passed as a parameter.

taf_net_EnableSocksAsync(StartSocksAsyncHandlerFunc,NULL);
    Copy to clipboard

Before asynchrounously enabling SOCKS, an application defines a handler function. Once SOCKS is enabled, the handler function will be called.

static void StartSocksAsyncHandlerFunc
    (
        le_result_t result, void* contextPtr
    )
    {
        LE_INFO("**** Handler for start socks Asynchronously (Begin)****");
        LE_INFO("result: %d", result);
        LE_INFO("**** Handler for start socks Asynchronously (End)****");
    }
    Copy to clipboard

The following APIs are supported for SOCKS management.

- [taf\_net\_SetSocksAuthMethod()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a417ce758999aa3364a591d04a0a6d513.html#Documentationa00626_1a417ce758999aa3364a591d04a0a6d513) — Sets SOCKS authentication method.
- [taf\_net\_GetSocksAuthMethod()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a18c066d7f033a2af2b895c0fc772c935.html#Documentationa00626_1a18c066d7f033a2af2b895c0fc772c935) — Gets SOCKS authentication method.
- [taf\_net\_SetSocksLanInterface()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1aa50ed02cc387b597462c4a7f11e1a73e.html#Documentationa00626_1aa50ed02cc387b597462c4a7f11e1a73e) — Sets SOCKS LAN interface.
- [taf\_net\_GetSocksLanInterface()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1aeee6407b32f1d85e7f454785ba34eae7.html#Documentationa00626_1aeee6407b32f1d85e7f454785ba34eae7) — Gets SOCKS LAN interface.
- [taf\_net\_AddSocksAssociation()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1af76ef35c80fe8ddd285202ef881a9736.html#Documentationa00626_1af76ef35c80fe8ddd285202ef881a9736) — Adds SOCKS association.
- [taf\_net\_RemoveSocksAssociation()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a609c5c9856b9819844f5ce108f54d9d9.html#Documentationa00626_1a609c5c9856b9819844f5ce108f54d9d9) — Deletes SOCKS association.
- [taf\_net\_EnableSocks()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1af7052aef2aa3b241c4c50dd674f6283a.html#Documentationa00626_1af7052aef2aa3b241c4c50dd674f6283a) — Synchronously enables SOCKS.
- [taf\_net\_DisableSocks()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a926b09312c2d31d74f8706285ddfc486.html#Documentationa00626_1a926b09312c2d31d74f8706285ddfc486) — Synchronously disables SOCKS.
- [taf\_net\_EnableSocksAsync()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1af13e18ab42dc67e6fb6e236b91e937fc.html#Documentationa00626_1af13e18ab42dc67e6fb6e236b91e937fc) — Asynchronously enables SOCKS.
- [taf\_net\_DisableSocksAsync()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a67d0fff99886eba1f6cf3da91ed66dcb.html#Documentationa00626_1a67d0fff99886eba1f6cf3da91ed66dcb) — Asynchronously disables SOCKS.

**NOTE:** If changing the SOCKS authentication method or association, the application needs to disable and enable SOCKS to use the new method or username.

## GSB management

Generic software bridge (GSB) management provides APIs for enabling and disabling GSB, adding and removing GSB, and querying GSB information. GSB enables hardware IP acceleration (IPA) for traffic on physical interfaces corresponding to the NON-QTI WLAN and ethernet chips.

**NOTE:** GSB APIs are not supported on SA515M. The following example shows how to add GSB. This example adds an interface named “wlan0”, of TAF\_NET\_GSB\_WLAN\_AP type, and with 800 Mbps bandwidth.

result = taf_net_AddGsb("wlan0", TAF_NET_GSB_WLAN_AP, 900);
    if (result != LE_OK)
    {
       LE_INFO("Failed to add GSB");
       return LE_FAULT;
    }
    Copy to clipboard

An application can enable GSB using taf\_net\_EnableGsb after adding GSB. The following example shows how to enable GSB.

result = taf_net_EnableGsb();
    if (result != LE_OK)
    {
       LE_INFO("Failed to enable GSB");
       return LE_FAULT;
    }
    Copy to clipboard

The following APIs are supported for GSB management.

- [taf\_net\_AddGsb()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a72f9baaad6d63c5621d7845c6e658ac9.html#Documentationa00626_1a72f9baaad6d63c5621d7845c6e658ac9) — Adds GSB.
- [taf\_net\_RemoveGsb()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a7d57514daa2b30c3568dab4d4b754944.html#Documentationa00626_1a7d57514daa2b30c3568dab4d4b754944) — Removes GSB.
- [taf\_net\_EnableGsb()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a5e165ec6b14e7186be34ed355fc0a722.html#Documentationa00626_1a5e165ec6b14e7186be34ed355fc0a722) — Enables GSB.
- [taf\_net\_DisableGsb()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a29e2a2689ce312aa0e753cacafcf13c0.html#Documentationa00626_1a29e2a2689ce312aa0e753cacafcf13c0) — Disables GSB.
- [taf\_net\_GetGsbList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1adf2bfba22a63b8078a4b98ce90db1ef1.html#Documentationa00626_1adf2bfba22a63b8078a4b98ce90db1ef1) — Gets the reference of the GSB list.
- [taf\_net\_GetFirstGsb()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1abcaa26974b5ed4890aa724d14d85798c.html#Documentationa00626_1abcaa26974b5ed4890aa724d14d85798c) — Gets the reference of the first GSB.
- [taf\_net\_GetNextGsb()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ac78e0f14f561d820fecd1b14a017b7eb.html#Documentationa00626_1ac78e0f14f561d820fecd1b14a017b7eb) — Gets the reference of the next GSB.
- [taf\_net\_DeleteGsbList()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ac9877d56a307fd76fd23689005372bd1.html#Documentationa00626_1ac9877d56a307fd76fd23689005372bd1) — Deletes the reference of the GSB list.
- [taf\_net\_GetGsbInterfaceName()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ac537132f5bbe268184f983bfe8fd193d.html#Documentationa00626_1ac537132f5bbe268184f983bfe8fd193d) — Gets the interface name of the GSB.
- [taf\_net\_GetGsbInterfaceType()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a6c90708a79c28a2aa76c85e8a5df3b13.html#Documentationa00626_1a6c90708a79c28a2aa76c85e8a5df3b13) — Gets the interface type of the GSB.
- [taf\_net\_GetGsbBandWidth()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ae15db0bfc6f6a5f420c5b9b3781d3d79.html#Documentationa00626_1ae15db0bfc6f6a5f420c5b9b3781d3d79) — Gets the bandwidth of the GSB.

## Phone ID support

Network service provides APIs with phone ID as one of the input parameters in the DSSA/DSDA mode. The application can call these APIs on the wanted phone ID

profileReference = BindVlanWithProfileEx(vlanReference, 2, 5);
    Copy to clipboard

The following APIs are added for supporting phone ID selection.

- [taf\_net\_BindVlanWithProfileEx()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a252158d94326ab63933ead699262fa6c.html#Documentationa00626_1a252158d94326ab63933ead699262fa6c) — Binds a VLAN with the specified phone ID and profile index.
- [taf\_net\_GetVlanBoundPhoneId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ad8cfbee0eb0f309a326cf13781e4f9e7.html#Documentationa00626_1ad8cfbee0eb0f309a326cf13781e4f9e7) — Gets the phone ID bound with this VLAN.

## VLAN priority

Network service provides APIs to support VLAN priority.

The following example shows how to create a VLAN and set the VLAN priority. This example creates a VLAN with VLAN ID 5 and priority 6.

vlanReference = taf_net_CreateVlan(5, false);
    if (!vlanReference)
    {
       LE_INFO("isAccelerated conflicts with old value");
       return LE_FAULT;
    }
    result = taf_net_SetVlanPriority(vlanReference, 6);
    Copy to clipboard

The following APIs are added for supporting VLAN priority.

- [taf\_net\_SetVlanPriority()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ae6558e466313a9c507a730ececb980a9.html#Documentationa00626_1ae6558e466313a9c507a730ececb980a9) — Sets VLAN priority.
- [taf\_net\_GetVlanPriority()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a1a26beaf8f0f1c4f2ca9ae06b13b6356.html#Documentationa00626_1a1a26beaf8f0f1c4f2ca9ae06b13b6356) — Gets VLAN priority.

The following APIs are supported for binding VLAN to a backhaul.

- [taf\_net\_SetVlanBackhaulType()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a216f2c42aa4be07841f03e409a2ba5ef.html#Documentationa00626_1a216f2c42aa4be07841f03e409a2ba5ef) — Sets backhaul type for the VLAN binding.
- [taf\_net\_SetVlanBackhaulVlanId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ac74f603e38fb6adb0bbee6600c7f05c9.html#Documentationa00626_1ac74f603e38fb6adb0bbee6600c7f05c9) — Sets backhaul’s VLAN ID for the VLAN binding.
- [taf\_net\_SetVlanBackhaulPhoneId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ab8e8a6722c61fcdb558065ca4f4814a6.html#Documentationa00626_1ab8e8a6722c61fcdb558065ca4f4814a6) — Sets backhaul’s phone ID for the VLAN binding.
- [taf\_net\_SetVlanBackhaulProfileId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a88c04743c618c77805b0b37418c828d8.html#Documentationa00626_1a88c04743c618c77805b0b37418c828d8) — Sets backhaul’s profile ID for the VLAN binding.
- [taf\_net\_BindVlanWithBackhaul()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1af24a20a238c4b3756c9b6e37d2d6208e.html#Documentationa00626_1af24a20a238c4b3756c9b6e37d2d6208e) — Binds to backhaul defined by above values.
- [taf\_net\_UnbindVlanFromBackhaul()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ad724d753a2f069d2f3c5f37d602eb5ef.html#Documentationa00626_1ad724d753a2f069d2f3c5f37d602eb5ef) — Unbinds VLAN from a backhaul.

The following APIs are supported to provision network type for a VLAN.

- [taf\_net\_SetVlanNetworkType()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ab4619c6dba1a63d43810d327eff607f6.html#Documentationa00626_1ab4619c6dba1a63d43810d327eff607f6) — Sets network type of the VLAN.
- [taf\_net\_GetVlanNetworkType()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a486208f7d80301c12c3aadcac99cde60.html#Documentationa00626_1a486208f7d80301c12c3aadcac99cde60) — Gets network type of the VLAN.

The following APIs are supported to set IP passthrough config to REMOTE system.

- [taf\_net\_GetInterface()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ad8106f11d81af62293b78a7274508075.html#Documentationa00626_1ad8106f11d81af62293b78a7274508075) — Gets the interface reference to set the config.
- [taf\_net\_SetIPPTOperation()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a3d7fd5b1c71eeef960aaedd8aaa51bac.html#Documentationa00626_1a3d7fd5b1c71eeef960aaedd8aaa51bac) — Sets the operation parameter to the IP PASS reference.
- [taf\_net\_SetIPPTDeviceMacAddress()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a70eb7a67646214e0dc448dba3bcf8030.html#Documentationa00626_1a70eb7a67646214e0dc448dba3bcf8030) — Sets the device config parameters to the IP PASS reference.
- [taf\_net\_SetIPPassThroughConfig()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a0b1201187fba0be02ff3301bfe56b0b8.html#Documentationa00626_1a0b1201187fba0be02ff3301bfe56b0b8) — Sets IP passthrough config of the WWAN backhaul.

The following APIs are supported to get IP passthrough config from REMOTE system.

- [taf\_net\_GetIPPassThroughConfig()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a85ed3f84827583b50ae0d972e557c247.html#Documentationa00626_1a85ed3f84827583b50ae0d972e557c247) — Gets IP passthrough config of the WWAN backhaul. Returns a reference to IP passthrough config.
- [taf\_net\_GetIPPTOperation()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a59a9cdcd94fc3e78208a3db67662054f.html#Documentationa00626_1a59a9cdcd94fc3e78208a3db67662054f) — Gets the operation parameter to the IP PASS reference.
- [taf\_net\_GetIPPTDeviceMacAddress()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a14c037fbc444c68a353f21c1c63296d6.html#Documentationa00626_1a14c037fbc444c68a353f21c1c63296d6) — Gets the device config parameters to the IP config reference.

The following APIs are supported to set IP config to LOCAL system.

- [taf\_net\_GetInterface()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ad8106f11d81af62293b78a7274508075.html#Documentationa00626_1ad8106f11d81af62293b78a7274508075) — Gets the interface Reference to set the config.
- [taf\_net\_SetIPConfigParams()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a85a2f6285c20647914a30150c19d277f.html#Documentationa00626_1a85a2f6285c20647914a30150c19d277f) — Sets the parameters to the IP config reference.
- [taf\_net\_SetIPConfigAddressParams()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1ab959e9ffe40ed252bbbcbb1ce7576b31.html#Documentationa00626_1ab959e9ffe40ed252bbbcbb1ce7576b31) — Sets the address information to the IP config reference.
- [taf\_net\_SetIPConfig()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a0d7a246252bfbac7c7b8aaaf9736adaf.html#Documentationa00626_1a0d7a246252bfbac7c7b8aaaf9736adaf) — Sets IP config to the LOCAL system.

The following APIs are supported to get IP config for the LOCAL system.

- [taf\_net\_GetIPConfig()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a94944e91e0a6c7798d9533b5328cd217.html#Documentationa00626_1a94944e91e0a6c7798d9533b5328cd217) — Gets IP config of the LOCAL system. Returns a reference to config.
- [taf\_net\_GetIPConfigParams()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a538b78522f37807ea2e0ac145cb89f6c.html#Documentationa00626_1a538b78522f37807ea2e0ac145cb89f6c) — Gets the parameters to the IP config reference.
- [taf\_net\_GetIPConfigAddressParams()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00626_1a38a03c4132de26fb74fb0f9acafb268f.html#Documentationa00626_1a38a03c4132de26fb74fb0f9acafb268f) — Gets the address information to the IP config reference.

Last Published: Jun 09, 2026

[Previous Topic
MRC Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafMRC.md) [Next Topic
Update services](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/update_services.md)