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,223 //--------------------------------------------------------------------------------------------------227 //--------------------------------------------------------------------------------------------------230 //--------------------------------------------------------------------------------------------------233 * Connect the current client thread to the service providing this API. Block until the service is236 * For each thread that wants to use this API, either ConnectService or TryConnectService must be237 * called before any other functions in this API. Normally, ConnectService is automatically called242 //--------------------------------------------------------------------------------------------------248 //--------------------------------------------------------------------------------------------------251 * Try to connect the current client thread to the service providing this API. Return with an error254 * For each thread that wants to use this API, either ConnectService or TryConnectService must be255 * called before any other functions in this API. Normally, ConnectService is automatically called264 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).267 //--------------------------------------------------------------------------------------------------273 //--------------------------------------------------------------------------------------------------277 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants280 //--------------------------------------------------------------------------------------------------287 //--------------------------------------------------------------------------------------------------293 * longer a connection to the service, and the functions in this API can't be used. For details, see298 //--------------------------------------------------------------------------------------------------305 //--------------------------------------------------------------------------------------------------309 //--------------------------------------------------------------------------------------------------312 //--------------------------------------------------------------------------------------------------316 //--------------------------------------------------------------------------------------------------319 //--------------------------------------------------------------------------------------------------321 * Add or remove a route on the given channel according to the input flag in the last argument for324 * The channel reference in the first input argument identifies the network interface which a route325 * is to be added onto or removed from. Whether the operation is an add or a remove depends on the333 * @note The prefixLength parameter used to take a subnet mask (255.255.255.0) for IPv4 and prefix341 //--------------------------------------------------------------------------------------------------354 //--------------------------------------------------------------------------------------------------361 //--------------------------------------------------------------------------------------------------369 //--------------------------------------------------------------------------------------------------380 //--------------------------------------------------------------------------------------------------389 //--------------------------------------------------------------------------------------------------391 * Backup the current default GW configs of the system, including both IPv4 and IPv6 as applicable.392 * For each client application using this API to back up this system setting, only one backup copy393 * is kept. When a client application makes a second call to this API, its first backup copy will398 * reverse order of their calling le_net_BackupDefaultGW() such that config backups and restorations401 //--------------------------------------------------------------------------------------------------407 //--------------------------------------------------------------------------------------------------409 * Restore the default GW configs of the system to the last backed up ones, including IPv4 and/or418 * reverse order of their calling le_net_BackupDefaultGW() such that config backups and restorations424 //--------------------------------------------------------------------------------------------------430 //--------------------------------------------------------------------------------------------------437 //--------------------------------------------------------------------------------------------------445 //--------------------------------------------------------------------------------------------------458 //--------------------------------------------------------------------------------------------------467 //--------------------------------------------------------------------------------------------------471 //--------------------------------------------------------------------------------------------------void le_net_RestoreDNS(void)le_result_t le_net_TryConnectService(void)void le_net_BackupDefaultGW(void)le_result_t le_net_SetDNS(le_dcs_ChannelRef_t channelRef)LE_FULL_API void le_net_SetServerDisconnectHandler(le_net_DisconnectHandler_t disconnectHandler, void *contextPtr)le_result_t le_net_GetDNS(le_dcs_ChannelRef_t channelRef, le_net_DnsServerAddresses_t *addrPtr)void le_net_ConnectService(void)le_result_t le_net_RestoreDefaultGW(void)le_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)void le_net_DisconnectService(void)void(* le_net_DisconnectHandler_t)(void *)Definition: le_net_interface.h:228le_result_t le_net_GetDefaultGW(le_dcs_ChannelRef_t channelRef, le_net_DefaultGatewayAddresses_t *addrPtr)