Network Manager service

Updated: October 26, 2022

This example covers the use case where the client retrieves the current default interface.

qwf_net_IfName_t ifName;            // holds the IfName string
qwf_net_InterfaceData_t ifaceData;  // holds the interface data

// API calls assume QWF NET initialized and QWF Context in variable pCtx.
// Query NET MGR to get the current default interface
qwf_net_Results_e rc = qwf_net_GetDefaultInterface(pCtx, &ifName);

// Output the interface name
if (NET_OK == rc) {
   printf("Default network interface: %s\n", ifName);
else {
   printf("Error getting default interface! Error: %d\n", rc);
// Query to get information for the default interface
rc = qwf_net_GetInterfaceData(pCtx, &ifName, &ifaceData);

// Output some of the relevent interface information
if (NET_OK == rc) {
   printf("Interface=%s, connType=%d, connected=%s, hasIP=%s, ",
, ifaceData.ifType,
          (ifaceData.connected ? "true" : "false"),
          (ifaceData.hasIpAddr ? "true" : "false"));
   printf("hasIP4=%s, IP4addr=%s, IP4mask=%s, gateway=%s,",
          (ifaceData.ip4 ? "true" : "false"), ifaceData.ip4Address,
          ifaceData.ip4Netmask, ifaceData.ip4Gateway);
   printf("hasIP6=%s, IP6addr=%s, IP6prefix_len=%s, gateway=%s,",
          (ifaceData.ip6 ? "true" : "false"), ifaceData.ip6Address,
          ifaceData.ip6NetPrefixLen, ifaceData.ip6Gateway);
   printf("broadcast=%s, search_domain=%s, ip4_dns_1=%s, ip4_dns_2=%s,\
ip6_dns_2=%s, ip6_dns_2=%s", 
          ifaceData.broadcast, ifaceData.searchDomain,
          ifaceData.ip4NameServers[0], ifaceData.ip4NameServers[1],
          ifaceData.ip6NameServers[0], ifaceData.ip6NameServers[1]);
else {
    printf("Error getting interface data! Error: %d\n", rc);