Network Services API  2.50.00.07
Data Structures | Macros | Typedefs | Enumerations | Functions
SlNetIf group

Controls standard stack/interface options and capabilities. More...

Data Structures

struct  SlNetIf_Config_t
 SlNetIf_Config_t structure contains all the function callbacks that are expected to be filled by the relevant network stack interface
Each interface has different capabilities, so not all the API's must be supported therefore an API's can be defined as: More...
 
struct  SlNetIf_t
 The SlNetIf_t structure holds the configuration of the interface Its ID, name, flags and the configuration list - SlNetIf_Config_t. More...
 

Macros

#define SLNETIF_ID_1   (1 << 0)
 
#define SLNETIF_ID_2   (1 << 1)
 
#define SLNETIF_ID_3   (1 << 2)
 
#define SLNETIF_ID_4   (1 << 3)
 
#define SLNETIF_ID_5   (1 << 4)
 
#define SLNETIF_ID_6   (1 << 5)
 
#define SLNETIF_ID_7   (1 << 6)
 
#define SLNETIF_ID_8   (1 << 7)
 
#define SLNETIF_ID_9   (1 << 8)
 
#define SLNETIF_ID_10   (1 << 9)
 
#define SLNETIF_ID_11   (1 << 10)
 
#define SLNETIF_ID_12   (1 << 11)
 
#define SLNETIF_ID_13   (1 << 12)
 
#define SLNETIF_ID_14   (1 << 13)
 
#define SLNETIF_ID_15   (1 << 14)
 
#define SLNETIF_ID_16   (1 << 15)
 
#define SLNETIF_MAX_IF   (16)
 
#define ONLY_ONE_BIT_IS_SET(x)   (((x > 0) && ((x & (x - 1)) == 0))?true:false)
 
#define SLNETIF_STATUS_DISCONNECTED   (0)
 
#define SLNETIF_STATUS_CONNECTED   (1)
 
#define SLNETIF_ADDR_CFG_UNKNOWN   (0)
 
#define SLNETIF_ADDR_CFG_DHCP   (1)
 
#define SLNETIF_ADDR_CFG_DHCP_LLA   (2)
 
#define SLNETIF_ADDR_CFG_STATIC   (4)
 
#define SLNETIF_ADDR_CFG_STATELESS   (5)
 
#define SLNETIF_ADDR_CFG_STATEFUL   (6)
 
#define SLNETIF_SEC_OBJ_TYPE_RSA_PRIVATE_KEY   (1)
 
#define SLNETIF_SEC_OBJ_TYPE_CERTIFICATE   (2)
 
#define SLNETIF_SEC_OBJ_TYPE_DH_KEY   (3)
 
#define SLNETIF_QUERY_IF_STATE_BIT   (1 << 0)
 
#define SLNETIF_QUERY_IF_CONNECTION_STATUS_BIT   (1 << 1)
 
#define SLNETIF_QUERY_IF_ALLOW_PARTIAL_MATCH_BIT   (1 << 2)
 

Typedefs

typedef struct SlNetIf_Config_t SlNetIf_Config_t
 SlNetIf_Config_t structure contains all the function callbacks that are expected to be filled by the relevant network stack interface
Each interface has different capabilities, so not all the API's must be supported therefore an API's can be defined as: More...
 
typedef struct SlNetIf_t SlNetIf_t
 The SlNetIf_t structure holds the configuration of the interface Its ID, name, flags and the configuration list - SlNetIf_Config_t. More...
 

Enumerations

enum  SlNetIfState_e {
  SLNETIF_STATE_DISABLE = 0,
  SLNETIF_STATE_ENABLE = 1
}
 Interface state bit pool to be used in set interface state function. More...
 
enum  SlNetIfAddressType_e {
  SLNETIF_IPV4_ADDR = 0,
  SLNETIF_IPV6_ADDR_LOCAL = 1,
  SLNETIF_IPV6_ADDR_GLOBAL = 2
}
 Address type enum to be used in get ip address function. More...
 

Functions

int32_t SlNetIf_init (int32_t flags)
 Initialize the SlNetIf module. More...
 
int32_t SlNetIf_add (uint16_t ifID, char *ifName, const SlNetIf_Config_t *ifConf, uint8_t priority)
 Add a new SlNetIf-compatible interface to the system. More...
 
SlNetIf_tSlNetIf_getIfByID (uint16_t ifID)
 Get interface configuration from interface ID. More...
 
SlNetIf_tSlNetIf_queryIf (uint32_t ifBitmap, uint32_t queryBitmap)
 Query for the highest priority interface, given a list of interfaces and properties. More...
 
const char * SlNetIf_getNameByID (uint16_t ifID)
 Get interface Name from interface ID. More...
 
int32_t SlNetIf_getIDByName (char *ifName)
 Get interface ID from interface name. More...
 
int32_t SlNetIf_getPriority (uint16_t ifID)
 Get interface priority. More...
 
int32_t SlNetIf_setPriority (uint16_t ifID, uint8_t priority)
 Set interface priority. More...
 
int32_t SlNetIf_setState (uint16_t ifID, SlNetIfState_e ifState)
 Set interface state. More...
 
int32_t SlNetIf_getState (uint16_t ifID)
 Get interface state. More...
 
int32_t SlNetIf_getConnectionStatus (uint16_t ifID)
 Get the connection status of an interface. More...
 
int32_t SlNetIf_getIPAddr (uint16_t ifID, SlNetIfAddressType_e addrType, uint16_t *addrConfig, uint32_t *ipAddr)
 Get IP Address of specific interface. More...
 
int32_t SlNetIf_loadSecObj (uint16_t objType, char *objName, int16_t objNameLen, uint8_t *objBuff, int16_t objBuffLen, uint32_t ifBitmap)
 Load secured buffer to the network stack. More...
 

Detailed Description

Controls standard stack/interface options and capabilities.

Macro Definition Documentation

§ SLNETIF_ID_1

#define SLNETIF_ID_1   (1 << 0)

Interface ID 1

§ SLNETIF_ID_2

#define SLNETIF_ID_2   (1 << 1)

Interface ID 2

§ SLNETIF_ID_3

#define SLNETIF_ID_3   (1 << 2)

Interface ID 3

§ SLNETIF_ID_4

#define SLNETIF_ID_4   (1 << 3)

Interface ID 4

§ SLNETIF_ID_5

#define SLNETIF_ID_5   (1 << 4)

Interface ID 5

§ SLNETIF_ID_6

#define SLNETIF_ID_6   (1 << 5)

Interface ID 6

§ SLNETIF_ID_7

#define SLNETIF_ID_7   (1 << 6)

Interface ID 7

§ SLNETIF_ID_8

#define SLNETIF_ID_8   (1 << 7)

Interface ID 8

§ SLNETIF_ID_9

#define SLNETIF_ID_9   (1 << 8)

Interface ID 9

§ SLNETIF_ID_10

#define SLNETIF_ID_10   (1 << 9)

Interface ID 10

§ SLNETIF_ID_11

#define SLNETIF_ID_11   (1 << 10)

Interface ID 11

§ SLNETIF_ID_12

#define SLNETIF_ID_12   (1 << 11)

Interface ID 12

§ SLNETIF_ID_13

#define SLNETIF_ID_13   (1 << 12)

Interface ID 13

§ SLNETIF_ID_14

#define SLNETIF_ID_14   (1 << 13)

Interface ID 14

§ SLNETIF_ID_15

#define SLNETIF_ID_15   (1 << 14)

Interface ID 15

§ SLNETIF_ID_16

#define SLNETIF_ID_16   (1 << 15)

Interface ID 16

§ SLNETIF_MAX_IF

#define SLNETIF_MAX_IF   (16)

Maximum interface

§ ONLY_ONE_BIT_IS_SET

#define ONLY_ONE_BIT_IS_SET (   x)    (((x > 0) && ((x & (x - 1)) == 0))?true:false)

§ SLNETIF_STATUS_DISCONNECTED

#define SLNETIF_STATUS_DISCONNECTED   (0)

§ SLNETIF_STATUS_CONNECTED

#define SLNETIF_STATUS_CONNECTED   (1)

§ SLNETIF_ADDR_CFG_UNKNOWN

#define SLNETIF_ADDR_CFG_UNKNOWN   (0)

§ SLNETIF_ADDR_CFG_DHCP

#define SLNETIF_ADDR_CFG_DHCP   (1)

§ SLNETIF_ADDR_CFG_DHCP_LLA

#define SLNETIF_ADDR_CFG_DHCP_LLA   (2)

§ SLNETIF_ADDR_CFG_STATIC

#define SLNETIF_ADDR_CFG_STATIC   (4)

§ SLNETIF_ADDR_CFG_STATELESS

#define SLNETIF_ADDR_CFG_STATELESS   (5)

§ SLNETIF_ADDR_CFG_STATEFUL

#define SLNETIF_ADDR_CFG_STATEFUL   (6)

§ SLNETIF_SEC_OBJ_TYPE_RSA_PRIVATE_KEY

#define SLNETIF_SEC_OBJ_TYPE_RSA_PRIVATE_KEY   (1)

§ SLNETIF_SEC_OBJ_TYPE_CERTIFICATE

#define SLNETIF_SEC_OBJ_TYPE_CERTIFICATE   (2)

§ SLNETIF_SEC_OBJ_TYPE_DH_KEY

#define SLNETIF_SEC_OBJ_TYPE_DH_KEY   (3)

§ SLNETIF_QUERY_IF_STATE_BIT

#define SLNETIF_QUERY_IF_STATE_BIT   (1 << 0)

Check if interface state is enabled.

See also
SlNetIf_queryIf()

§ SLNETIF_QUERY_IF_CONNECTION_STATUS_BIT

#define SLNETIF_QUERY_IF_CONNECTION_STATUS_BIT   (1 << 1)

Check if interface connection status is connected.

See also
SlNetIf_queryIf()

§ SLNETIF_QUERY_IF_ALLOW_PARTIAL_MATCH_BIT

#define SLNETIF_QUERY_IF_ALLOW_PARTIAL_MATCH_BIT   (1 << 2)

Enable last partial match in an interface search, if no existing interface matches the query completely.

See also
SlNetIf_queryIf()

Typedef Documentation

§ SlNetIf_Config_t

SlNetIf_Config_t structure contains all the function callbacks that are expected to be filled by the relevant network stack interface
Each interface has different capabilities, so not all the API's must be supported therefore an API's can be defined as:

  • Mandatory API's - must be supported by the interface in order to be part of SlNetSock layer
  • Non-Mandatory API's - can be supported, but not mandatory for basic SlNetSock proper operation
Note
Interface that is not supporting a non-mandatory API should set it to NULL in its function list
See also
SlNetIf_Config_t

§ SlNetIf_t

typedef struct SlNetIf_t SlNetIf_t

The SlNetIf_t structure holds the configuration of the interface Its ID, name, flags and the configuration list - SlNetIf_Config_t.

Enumeration Type Documentation

§ SlNetIfState_e

Interface state bit pool to be used in set interface state function.

Enumerator
SLNETIF_STATE_DISABLE 
SLNETIF_STATE_ENABLE 

§ SlNetIfAddressType_e

Address type enum to be used in get ip address function.

Enumerator
SLNETIF_IPV4_ADDR 
SLNETIF_IPV6_ADDR_LOCAL 
SLNETIF_IPV6_ADDR_GLOBAL 

Function Documentation

§ SlNetIf_init()

int32_t SlNetIf_init ( int32_t  flags)

Initialize the SlNetIf module.

Parameters
[in]flagsFor future usage, The value 0 may be used in order to run the default flags
Returns
Zero on success, or negative error code on failure
Examples
int32_t retval;
retval = SlNetIf_init(0);

§ SlNetIf_add()

int32_t SlNetIf_add ( uint16_t  ifID,
char *  ifName,
const SlNetIf_Config_t ifConf,
uint8_t  priority 
)

Add a new SlNetIf-compatible interface to the system.

The SlNetIf_add function allows the application to add specific interfaces with their priorities and function list.
This function gives full control to the application on the interfaces.

Parameters
[in]ifIDSpecifies the interface which needs to be added.
The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
[in]ifNameSpecifies the name of the interface, Note: Can be set to NULL, but when set to NULL cannot be used with SlNetIf_getIDByName
[in]ifConfSpecifies the function list for the interface
[in]prioritySpecifies the priority needs to be set (In ascending order). Note: maximum priority is 15
Returns
Zero on success, or negative error code on failure
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples
/* Add CC32XX interface */
int32_t retval;
uint8_t priority = 10;
retval = SlNetIf_add(SLNETIF_ID_1, "CC32XX", &SlNetIfConfigWifi, priority);
/* Add NDK interface (without TLS) */
int32_t retval;
uint8_t priority = 9;
retval = SlNetIf_add(SLNETIF_ID_2, "eth0", &SlNetIfConfigNDK, priority);
/* Add NDK interface (with TLS) */
int32_t retval;
uint8_t priority = 8;
retval = SlNetIf_add(SLNETIF_ID_3, "eth0", &SlNetIfConfigNDKSec, priority);

§ SlNetIf_getIfByID()

SlNetIf_t* SlNetIf_getIfByID ( uint16_t  ifID)

Get interface configuration from interface ID.

The SlNetIf_getIfByID function retrieves the configuration of the requested interface.

Parameters
[in]ifIDSpecifies the interface which its configuration needs to be retrieved.
The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
Returns
A pointer to the configuration of the interface on success, or NULL on failure
See also
SlNetIf_add()
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples

§ SlNetIf_queryIf()

SlNetIf_t* SlNetIf_queryIf ( uint32_t  ifBitmap,
uint32_t  queryBitmap 
)

Query for the highest priority interface, given a list of interfaces and properties.

Parameters
[in]ifBitmapThe bit-wise OR of interfaces to be searched.
Note: Zero is currently not valid.
[in]queryBitmapThe bit-wise OR of additional query criteria.
Remarks
queryBitmap can be set to :
Returns
A pointer to the configuration of a found interface on success, or NULL on failure
See also
SlNetIf_add()
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples

§ SlNetIf_getNameByID()

const char* SlNetIf_getNameByID ( uint16_t  ifID)

Get interface Name from interface ID.

The SlNetIf_getNameByID function retrieves the name of the requested interface.

Parameters
[in]ifIDSpecifies the interface which its name needs to be retrieved.
The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
Returns
A pointer to the name of the interface on success, or NULL on failure
See also
SlNetIf_add()
SlNetIf_getIDByName()
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples
const char *pName = NULL;

§ SlNetIf_getIDByName()

int32_t SlNetIf_getIDByName ( char *  ifName)

Get interface ID from interface name.

The SlNetIf_getIDByName function retrieves the interface identifier of the requested interface name.

Parameters
[in]ifNameSpecifies the interface which its interface identifier needs to be retrieved.
Returns
The interface identifier value of the interface on success, or negative error code on failure The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
See also
SlNetIf_add()
SlNetIf_getNameByID()
SlNetSock_getIfID()
Note
- Input NULL as ifName will return error code.
  • When using more than one interface with the same name, the ID of the highest priority interface will be returned
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples
int32_t retval;
retval = SlNetIf_getIDByName("CC32XX");

§ SlNetIf_getPriority()

int32_t SlNetIf_getPriority ( uint16_t  ifID)

Get interface priority.

The SlNetIf_getPriority function retrieves the priority of the interface.

Parameters
[in]ifIDSpecifies the interface which its priority needs to be retrieved.
The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
Returns
The priority value of the interface on success, or negative error code on failure
See also
SlNetIf_add()
SlNetIf_setPriority()
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples
int16_t pri;

§ SlNetIf_setPriority()

int32_t SlNetIf_setPriority ( uint16_t  ifID,
uint8_t  priority 
)

Set interface priority.

The SlNetIf_setPriority function sets new priority to the requested interface.

Parameters
[in]ifIDSpecifies the interface which its priority needs to be changed.
The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
[in]prioritySpecifies the priority needs to be set. (In ascending order) Note: maximum priority is 15
Returns
Zero on success, or negative error code on failure
See also
SlNetIf_add()
SlNetIf_getPriority()
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples
int32_t retval;

§ SlNetIf_setState()

int32_t SlNetIf_setState ( uint16_t  ifID,
SlNetIfState_e  ifState 
)

Set interface state.

Enable or disable the interface.

Parameters
[in]ifIDSpecifies the interface which its state needs to be changed.
The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
[in]ifStateSpecifies the interface state.
The values of the interface state are defined with the prefix SLNETIF_INTERFACE_ which defined in slnetif.h
Returns
Zero on success, or negative error code on failure
See also
SlNetIf_add()
SlNetIf_getState()
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples

§ SlNetIf_getState()

int32_t SlNetIf_getState ( uint16_t  ifID)

Get interface state.

Obtain the current state of the interface.

Parameters
[in]ifIDSpecifies the interface which its state needs to be retrieved.
The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
Returns
State of the interface on success, or negative error code on failure
See also
SlNetIf_add()
SlNetIf_setState()
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples
int32_t state;

§ SlNetIf_getConnectionStatus()

int32_t SlNetIf_getConnectionStatus ( uint16_t  ifID)

Get the connection status of an interface.

Parameters
[in]ifIDInterface ID
Returns
SLNETIF_STATUS_ value on success, or negative error code on failure
Remarks
ifID should be a value with the SLNETIF_ID_ prefix
See also
SlNetIf_add()
SLNETIF_STATUS_CONNECTED
SLNETIF_STATUS_DISCONNECTED
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples
int32_t status;

§ SlNetIf_getIPAddr()

int32_t SlNetIf_getIPAddr ( uint16_t  ifID,
SlNetIfAddressType_e  addrType,
uint16_t *  addrConfig,
uint32_t *  ipAddr 
)

Get IP Address of specific interface.

The SlNetIf_getIPAddr function retrieve the IP address of a specific interface according to the Address Type, IPv4, IPv6 LOCAL or IPv6 GLOBAL.

Parameters
[in]ifIDSpecifies the interface which its connection state needs to be retrieved.
The values of the interface identifier is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
[in]addrTypeAddress type:
[out]addrConfigAddress config:
[out]ipAddrIP Address according to the Address Type
Returns
Zero on success, or negative error code on failure
See also
SlNetIfAddressType_e
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
Examples
int32_t retval;
uint16_t addrConfig;
(uint32_t *)&addr);

§ SlNetIf_loadSecObj()

int32_t SlNetIf_loadSecObj ( uint16_t  objType,
char *  objName,
int16_t  objNameLen,
uint8_t *  objBuff,
int16_t  objBuffLen,
uint32_t  ifBitmap 
)

Load secured buffer to the network stack.

The SlNetSock_secLoadObj function loads buffer/files into the inputted network stack for future usage of the socket SSL/TLS connection. This option is relevant for network stacks with file system and also for network stacks that lack file system that can store the secured files.

Parameters
[in]objTypeSpecifies the security object type which could be one of the following:
[in]objNameSpecifies the name/input identifier of the secured buffer loaded for file systems - this can be the file name for plain text buffer loading this can be the name of the object
[in]objNameLenSpecifies the buffer name length to be loaded.
[in]objBuffSpecifies the pointer to the secured buffer to be loaded.
[in]objBuffLenSpecifies the buffer length to be loaded.
[in]ifBitmapSpecifies the interfaces which the security objects needs to be added to.
The values of the interface identifiers is defined with the prefix SLNETIF_ID_ which defined in slnetif.h
Returns
On success, buffer type handler index to be used when attaching the secured buffer to a socket.
A successful return code should be a positive number (int16)
On error, a negative value will be returned specifying the error code.
See also
SlNetSock_setOpt()
Note
SlNetIf_* functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale