le_net_interface.h
Go to the documentation of this file.
18 * When applications need to exchange data with other devices on the packet switched data network,25 * interface provides APIs for starting (associating with), stopping (disassociating from) selected28 * @warning Since these @c le_net APIs generate network and route changes that affect all services40 * The @c le_net interface provides. More details for these APIs can be found in later subsections.46 * | -------------------------------| ---------------------------------------------------------------------------------------------------|47 * | le_net_ChangeRoute() | Add or remove host or network route onto the network interface of a given data channel |48 * | le_net_SetDefaultGW() | Set a device's default gateway addresses to those assigned for a given channel use |49 * | le_net_GetDefaultGW() | Get the default gateway address(es) for the channel provided (retrieved from DHCP lease file) |51 * | le_net_RestoreDefaultGW() | Restore the default gateway addresses of a device previously backed up by le_net_BackupDefaultGW() |53 * | le_net_GetDNS() | Get the DNS server addresses for the channel provided (retrieved from DHCP lease file) |54 * | le_net_RestoreDNS() | Remove the DNS server addresses previously added to the device's name server address table |59 * An application can use the le_net_ChangeRoute() function to add or remove a host or network route60 * onto the network interface of a given channel. The channel reference as an API input identifies64 * The IP address and mask input arguments specify the destination address and mask for the route.112 * used. This will save both the default gateway address and the network interface on which it is117 * with the channel reference of the channel provided, which assigned default gateway address will119 * configuration. To query the channel's default GW address prior to installing it on the device,227 //--------------------------------------------------------------------------------------------------231 //--------------------------------------------------------------------------------------------------234 //--------------------------------------------------------------------------------------------------237 * Connect the current client thread to the service providing this API. Block until the service is240 * For each thread that wants to use this API, either ConnectService or TryConnectService must be241 * called before any other functions in this API. Normally, ConnectService is automatically called246 //--------------------------------------------------------------------------------------------------252 //--------------------------------------------------------------------------------------------------255 * Try to connect the current client thread to the service providing this API. Return with an error258 * For each thread that wants to use this API, either ConnectService or TryConnectService must be259 * called before any other functions in this API. Normally, ConnectService is automatically called268 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).271 //--------------------------------------------------------------------------------------------------277 //--------------------------------------------------------------------------------------------------281 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants284 //--------------------------------------------------------------------------------------------------291 //--------------------------------------------------------------------------------------------------297 * longer a connection to the service, and the functions in this API can't be used. For details, see302 //--------------------------------------------------------------------------------------------------309 //--------------------------------------------------------------------------------------------------313 //--------------------------------------------------------------------------------------------------316 //--------------------------------------------------------------------------------------------------320 //--------------------------------------------------------------------------------------------------323 //--------------------------------------------------------------------------------------------------325 * Add or remove a route on the given channel according to the input flag in the last argument for328 * The channel reference in the first input argument identifies the network interface which a route329 * is to be added onto or removed from. Whether the operation is an add or a remove depends on the337 * @note The prefixLength parameter used to take a subnet mask (255.255.255.0) for IPv4 and prefix345 //--------------------------------------------------------------------------------------------------358 //--------------------------------------------------------------------------------------------------365 //--------------------------------------------------------------------------------------------------373 //--------------------------------------------------------------------------------------------------384 //--------------------------------------------------------------------------------------------------393 //--------------------------------------------------------------------------------------------------395 * Backup the current default GW configs of the system, including both IPv4 and IPv6 as applicable.396 * For each client application using this API to back up this system setting, only one backup copy397 * is kept. When a client application makes a second call to this API, its first backup copy will402 * reverse order of their calling le_net_BackupDefaultGW() such that config backups and restorations405 //--------------------------------------------------------------------------------------------------411 //--------------------------------------------------------------------------------------------------413 * Restore the default GW configs of the system to the last backed up ones, including IPv4 and/or422 * reverse order of their calling le_net_BackupDefaultGW() such that config backups and restorations428 //--------------------------------------------------------------------------------------------------434 //--------------------------------------------------------------------------------------------------441 //--------------------------------------------------------------------------------------------------449 //--------------------------------------------------------------------------------------------------462 //--------------------------------------------------------------------------------------------------471 //--------------------------------------------------------------------------------------------------475 //--------------------------------------------------------------------------------------------------void(* le_net_DisconnectHandler_t)(void *)Definition: le_net_interface.h:232void le_net_DisconnectService(void)void le_net_ConnectService(void)void le_net_RestoreDNS(void)LE_FULL_API void le_net_SetServerDisconnectHandler(le_net_DisconnectHandler_t disconnectHandler, void *contextPtr)le_result_t le_net_SetDNS(le_dcs_ChannelRef_t channelRef)le_result_t le_net_GetDNS(le_dcs_ChannelRef_t channelRef, le_net_DnsServerAddresses_t *addrPtr)le_result_t le_net_RestoreDefaultGW(void)Definition: le_net_common.h:64le_result_t le_net_SetDefaultGW(le_dcs_ChannelRef_t channelRef)le_result_t le_net_ChangeRoute(le_dcs_ChannelRef_t channelRef, const char *LE_NONNULL destAddr, const char *LE_NONNULL prefixLength, bool isAdd)le_result_t le_net_GetDefaultGW(le_dcs_ChannelRef_t channelRef, le_net_DefaultGatewayAddresses_t *addrPtr)void le_net_BackupDefaultGW(void)Definition: le_net_common.h:79le_result_t le_net_TryConnectService(void)