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 destSubnet, bool isAdd)
 
le_result_t le_net_SetDefaultGW (le_dcs_ChannelRef_t channelRef)
 
void le_net_BackupDefaultGW (void)
 
le_result_t le_net_RestoreDefaultGW (void)
 
le_result_t le_net_SetDNS (le_dcs_ChannelRef_t channelRef)
 
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  destSubnet,
bool  isAdd 
)

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, which is a subnet mask for IPv4 and subnet mask's prefix length for IPv6

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 -A inet add -net <ipAddr> netmask <ipSubnet> dev <netInterface>" for IPv4, and "route -A inet6 add -net <ipAddr/prefixLength> dev <netInterface>" for IPv6. If the route is a host route, the subnet input argument should be given as "" (i.e. a null string).

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]destSubnetDestination's subnet: IPv4 netmask or IPv6 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_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.