Go to the source code of this file.
Typedefs | |
typedef void(* | le_net_DisconnectHandler_t) (void *) |
Functions | |
void | le_net_ConnectService (void) |
le_result_t | le_net_TryConnectService (void) |
LE_FULL_API void | le_net_SetServerDisconnectHandler (le_net_DisconnectHandler_t disconnectHandler, void *contextPtr) |
void | le_net_DisconnectService (void) |
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_SetDefaultGW (le_dcs_ChannelRef_t channelRef) |
le_result_t | le_net_GetDefaultGW (le_dcs_ChannelRef_t channelRef, le_net_DefaultGatewayAddresses_t *addrPtr) |
void | le_net_BackupDefaultGW (void) |
le_result_t | le_net_RestoreDefaultGW (void) |
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) |
void | le_net_RestoreDNS (void) |
Detailed Description
Legato le_net Interface include file.
Copyright (C) Sierra Wireless Inc.
Typedef Documentation
◆ le_net_DisconnectHandler_t
typedef void(* le_net_DisconnectHandler_t) (void *) |
Type for handler called when a server disconnects.
Function Documentation
◆ le_net_BackupDefaultGW()
void le_net_BackupDefaultGW | ( | void | ) |
Backup the current default GW configs of the system, including both IPv4 and IPv6 as applicable. For each client application using this API to back up this system setting, only one backup copy is kept. When a client application makes a second call to this API, its first backup copy will be overwritten by the newer. Thus, le_net keeps one single backup copy per client application, and, thus, multiple backup copies altogether. They are kept in their LIFO (last-in-first-out) chronological order that the sequence for client applications to call le_net_RestoreDefaltGW() should be in the exact reverse order of their calling le_net_BackupDefaultGW() such that config backups and restorations happen in the correct LIFO manner.
◆ le_net_ChangeRoute()
le_result_t le_net_ChangeRoute | ( | le_dcs_ChannelRef_t | channelRef, |
const char *LE_NONNULL | destAddr, | ||
const char *LE_NONNULL | prefixLength, | ||
bool | isAdd | ||
) |
Structure used to communitcate a channel's DNS Server address Structure used to communitcate a channel's Default Gateway Add or remove a route on the given channel according to the input flag in the last argument for the given destination address its given subnet's mask prefix length.
The channel reference in the first input argument identifies the network interface which a route is to be added onto or removed from. Whether the operation is an add or a remove depends on the isAdd boolean value of the last API input argument.
The IP address and subnet input arguments specify the destination address and subnet for the route. If it is a network route, the formats used for them are the same as used in the Linux command "route add -net <ipAddr>/<prefixLength> dev <netInterface>". If the route is a host route, the prefixLength input argument should be given as "" (i.e. a null string).
- Note
- The prefixLength parameter used to take a subnet mask (255.255.255.0) for IPv4 and prefix length for IPv6. Now it only takes prefix length, although compatibility code is present to make it compatible with previous API declaration. Providing a subnet mask is however deprecated and the compatibility code will be removed in a latter version.
- Returns
- LE_OK upon success, otherwise another le_result_t failure code
- Parameters
-
[in] channelRef the channel onto which the route change is made [in] destAddr Destination IP address for the route [in] prefixLength Destination's subnet prefix length [in] isAdd the change is to add (true) or delete (false)
◆ le_net_ConnectService()
void le_net_ConnectService | ( | void | ) |
Connect the current client thread to the service providing this API. Block until the service is available.
For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.
This function is created automatically.
◆ le_net_DisconnectService()
void le_net_DisconnectService | ( | void | ) |
Disconnect the current client thread from the service providing this API.
Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see Client-specific Functions.
This function is created automatically.
◆ le_net_GetDefaultGW()
le_result_t le_net_GetDefaultGW | ( | le_dcs_ChannelRef_t | channelRef, |
le_net_DefaultGatewayAddresses_t * | addrPtr | ||
) |
Get the default GW address for the given data channel.
- Note
- Accomodates dual-stack IPv4/IPv6 addresses. If the default GW address only is only IPv4 or IPv6, but not both, the unused field of "addr" will be nulled.
- Returns
- LE_OK upon success, otherwise LE_FAULT
- Parameters
-
[in] channelRef Channel to retrieve GW addresses [out] addrPtr Channel's Default GW addresses
◆ le_net_GetDNS()
le_result_t le_net_GetDNS | ( | le_dcs_ChannelRef_t | channelRef, |
le_net_DnsServerAddresses_t * | addrPtr | ||
) |
Get the DNS server addresses for the given data channel retrieved from its technology
- Note
- Can accomodate up to two dual-stack DNS server addresses. In the case that there are more than two server addresses, the first two addresses of each IP version will be returned. If there are fewer than two dual-stack addresses, or contain only one type of IPv4 or IPv6 addresses, the unused portions of the passed structure will be nulled and returned.
- Returns
- LE_OK upon success, otherwise LE_FAULT
- Parameters
-
[in] channelRef Channel to retrieve DNS server addresses [out] addrPtr DNS server addresses
◆ le_net_RestoreDefaultGW()
le_result_t le_net_RestoreDefaultGW | ( | void | ) |
Restore the default GW configs of the system to the last backed up ones, including IPv4 and/or IPv6 depending on whether this same client application has called le_net_SetDefaultGW() to change the system's IPv4 and/or IPv6 configs or not. The le_net interface remembers it and perform config restoration only as necessary when le_net_RestoreDefaultGW() is called. When le_net_BackupDefaultGW() is called, both IPv4 and IPv6 default GW configs are archived when present. As le_net keeps one single backup copy per client application, and, thus, multiple backup copies altogether, they are kept in their LIFO (last-in-first-out) chronological order that the sequence for client applications to call le_net_RestoreDefaltGW() should be in the exact reverse order of their calling le_net_BackupDefaultGW() such that config backups and restorations happen in the correct LIFO manner. If these applications do not follow this order, the le_net interface will first generate a warning in the system log and then still go ahead to restore the configs as directed. These applications hold the responsibility for the resulting routing configs on the device.
◆ le_net_RestoreDNS()
void le_net_RestoreDNS | ( | void | ) |
Remove the last added DNS addresses via the le_dcs_SetDNS API
◆ le_net_SetDefaultGW()
le_result_t le_net_SetDefaultGW | ( | le_dcs_ChannelRef_t | channelRef | ) |
Set the default GW addr for the given data channel retrieved from its technology
- Returns
- LE_OK upon success, otherwise LE_FAULT
- Parameters
-
[in] channelRef the channel on which interface its default GW addr is to be set
◆ le_net_SetDNS()
le_result_t le_net_SetDNS | ( | le_dcs_ChannelRef_t | channelRef | ) |
Set the DNS addresses for the given data channel retrieved from its technology
- Returns
- LE_OK upon success, otherwise LE_FAULT
- Parameters
-
[in] channelRef the channel from which the DNS addresses retrieved will be set into the system config
◆ le_net_SetServerDisconnectHandler()
LE_FULL_API void le_net_SetServerDisconnectHandler | ( | le_net_DisconnectHandler_t | disconnectHandler, |
void * | contextPtr | ||
) |
Set handler called when server disconnection is detected.
When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants to continue without exiting, it should call longjmp() from inside the handler.
◆ le_net_TryConnectService()
le_result_t le_net_TryConnectService | ( | void | ) |
Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.
For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.
This function is created automatically.
- Returns
- LE_OK if the client connected successfully to the service.
- LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
- LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
- LE_COMM_ERROR if the Service Directory cannot be reached.