le_net_interface.h
Go to the documentation of this file.
17 * When applications need to exchange data with other devices on the packet switched data network,24 * interface provides APIs for starting (associating with), stopping (disassociating from) selected27 * @warning Since these @c le_net APIs generate network and route changes that affect all services39 * The @c le_net interface provides. More details for these APIs can be found in later subsections.45 * | -------------------------------| ---------------------------------------------------------------------------------------------------|46 * | le_net_ChangeRoute() | Add or remove host or network route onto the network interface of a given data channel |47 * | le_net_SetDefaultGW() | Set a device's default gateway addresses to those assigned for a given channel use |48 * | le_net_GetDefaultGW() | Get the default gateway address(es) for the channel provided (retrieved from DHCP lease file) |50 * | le_net_RestoreDefaultGW() | Restore the default gateway addresses of a device previously backed up by le_net_BackupDefaultGW() |52 * | le_net_GetDNS() | Get the DNS server addresses for the channel provided (retrieved from DHCP lease file) |53 * | le_net_RestoreDNS() | Remove the DNS server addresses previously added to the device's name server address table |58 * An application can use the le_net_ChangeRoute() function to add or remove a host or network route59 * onto the network interface of a given channel. The channel reference as an API input identifies63 * The IP address and mask input arguments specify the destination address and mask for the route.111 * used. This will save both the default gateway address and the network interface on which it is116 * with the channel reference of the channel provided, which assigned default gateway address will118 * configuration. To query the channel's default GW address prior to installing it on the device,222 //--------------------------------------------------------------------------------------------------226 //--------------------------------------------------------------------------------------------------229 //--------------------------------------------------------------------------------------------------232 * Connect the current client thread to the service providing this API. Block until the service is235 * For each thread that wants to use this API, either ConnectService or TryConnectService must be236 * called before any other functions in this API. Normally, ConnectService is automatically called241 //--------------------------------------------------------------------------------------------------247 //--------------------------------------------------------------------------------------------------250 * Try to connect the current client thread to the service providing this API. Return with an error253 * For each thread that wants to use this API, either ConnectService or TryConnectService must be254 * called before any other functions in this API. Normally, ConnectService is automatically called263 * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).266 //--------------------------------------------------------------------------------------------------272 //--------------------------------------------------------------------------------------------------276 * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants279 //--------------------------------------------------------------------------------------------------286 //--------------------------------------------------------------------------------------------------292 * longer a connection to the service, and the functions in this API can't be used. For details, see297 //--------------------------------------------------------------------------------------------------304 //--------------------------------------------------------------------------------------------------308 //--------------------------------------------------------------------------------------------------311 //--------------------------------------------------------------------------------------------------315 //--------------------------------------------------------------------------------------------------318 //--------------------------------------------------------------------------------------------------320 * Add or remove a route on the given channel according to the input flag in the last argument for323 * The channel reference in the first input argument identifies the network interface which a route324 * is to be added onto or removed from. Whether the operation is an add or a remove depends on the332 * @note The prefixLength parameter used to take a subnet mask (255.255.255.0) for IPv4 and prefix340 //--------------------------------------------------------------------------------------------------353 //--------------------------------------------------------------------------------------------------360 //--------------------------------------------------------------------------------------------------368 //--------------------------------------------------------------------------------------------------379 //--------------------------------------------------------------------------------------------------388 //--------------------------------------------------------------------------------------------------390 * Backup the current default GW configs of the system, including both IPv4 and IPv6 as applicable.391 * For each client application using this API to back up this system setting, only one backup copy392 * is kept. When a client application makes a second call to this API, its first backup copy will397 * reverse order of their calling le_net_BackupDefaultGW() such that config backups and restorations400 //--------------------------------------------------------------------------------------------------406 //--------------------------------------------------------------------------------------------------408 * Restore the default GW configs of the system to the last backed up ones, including IPv4 and/or417 * reverse order of their calling le_net_BackupDefaultGW() such that config backups and restorations423 //--------------------------------------------------------------------------------------------------429 //--------------------------------------------------------------------------------------------------436 //--------------------------------------------------------------------------------------------------444 //--------------------------------------------------------------------------------------------------457 //--------------------------------------------------------------------------------------------------466 //--------------------------------------------------------------------------------------------------470 //--------------------------------------------------------------------------------------------------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:227le_result_t le_net_GetDefaultGW(le_dcs_ChannelRef_t channelRef, le_net_DefaultGatewayAddresses_t *addrPtr)