le_net_interface.h File Reference

#include "legato.h"
#include "le_dcs_interface.h"
#include "le_net_common.h"

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.

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 default GW config of the system

◆ 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]channelRefthe channel onto which the route change is made
[in]destAddrDestination IP address for the route
[in]prefixLengthDestination's subnet prefix length
[in]isAddthe 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]channelRefChannel to retrieve GW addresses
[out]addrPtrChannel'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]channelRefChannel to retrieve DNS server addresses
[out]addrPtrDNS server addresses

◆ le_net_RestoreDefaultGW()

le_result_t le_net_RestoreDefaultGW ( void  )

Backup default GW config of the system

◆ 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]channelRefthe 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]channelRefthe 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.