Network Services API
2.75.00.17
|
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... | |
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_t * | SlNetIf_getIfByID (uint16_t ifID) |
Get interface configuration from interface ID. More... | |
SlNetIf_t * | SlNetIf_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/unload/replace a secure object into a network interface/stack. More... | |
Controls standard stack/interface options and capabilities.
#define SLNETIF_ID_1 (1 << 0) |
Interface ID 1
#define SLNETIF_ID_2 (1 << 1) |
Interface ID 2
#define SLNETIF_ID_3 (1 << 2) |
Interface ID 3
#define SLNETIF_ID_4 (1 << 3) |
Interface ID 4
#define SLNETIF_ID_5 (1 << 4) |
Interface ID 5
#define SLNETIF_ID_6 (1 << 5) |
Interface ID 6
#define SLNETIF_ID_7 (1 << 6) |
Interface ID 7
#define SLNETIF_ID_8 (1 << 7) |
Interface ID 8
#define SLNETIF_ID_9 (1 << 8) |
Interface ID 9
#define SLNETIF_ID_10 (1 << 9) |
Interface ID 10
#define SLNETIF_ID_11 (1 << 10) |
Interface ID 11
#define SLNETIF_ID_12 (1 << 11) |
Interface ID 12
#define SLNETIF_ID_13 (1 << 12) |
Interface ID 13
#define SLNETIF_ID_14 (1 << 13) |
Interface ID 14
#define SLNETIF_ID_15 (1 << 14) |
Interface ID 15
#define SLNETIF_ID_16 (1 << 15) |
Interface ID 16
#define SLNETIF_MAX_IF (16) |
Maximum interface
#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) |
Check if interface state is enabled.
#define SLNETIF_QUERY_IF_CONNECTION_STATUS_BIT (1 << 1) |
Check if interface connection status is connected.
#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.
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:
The SlNetIf_t structure holds the configuration of the interface Its ID, name, flags and the configuration list - SlNetIf_Config_t.
enum SlNetIfState_e |
enum SlNetIfAddressType_e |
int32_t SlNetIf_init | ( | int32_t | flags | ) |
Initialize the SlNetIf module.
[in] | flags | For future usage, The value 0 may be used in order to run the default flags |
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.
[in] | ifID | Specifies 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] | ifName | Specifies the name of the interface, Note: Can be set to NULL, but when set to NULL cannot be used with SlNetIf_getIDByName() |
[in] | ifConf | Specifies the function list for the interface |
[in] | priority | Specifies the priority of the interface (In ascending order). Note: maximum priority is 15 |
SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.SlNetIf_t* SlNetIf_getIfByID | ( | uint16_t | ifID | ) |
Get interface configuration from interface ID.
The SlNetIf_getIfByID function retrieves the configuration of the requested interface.
[in] | ifID | Specifies 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 |
SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.SlNetIf_t* SlNetIf_queryIf | ( | uint32_t | ifBitmap, |
uint32_t | queryBitmap | ||
) |
Query for the highest priority interface, given a list of interfaces and properties.
[in] | ifBitmap | The bit-wise OR of interfaces to be searched. Note: Zero is currently not valid. |
[in] | queryBitmap | The bit-wise OR of additional query criteria. |
queryBitmap
can be set to :
SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.const char* SlNetIf_getNameByID | ( | uint16_t | ifID | ) |
Get interface Name from interface ID.
The SlNetIf_getNameByID function retrieves the name of the requested interface.
[in] | ifID | Specifies 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 |
SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.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.
[in] | ifName | Specifies the interface which its interface identifier needs to be retrieved. |
SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.int32_t SlNetIf_getPriority | ( | uint16_t | ifID | ) |
Get interface priority.
The SlNetIf_getPriority function retrieves the priority of the interface.
[in] | ifID | Specifies 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 |
SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.int32_t SlNetIf_setPriority | ( | uint16_t | ifID, |
uint8_t | priority | ||
) |
Set interface priority.
The SlNetIf_setPriority function sets new priority to the requested interface.
[in] | ifID | Specifies 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] | priority | Specifies the priority needs to be set. (In ascending order) Note: maximum priority is 15 |
SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.int32_t SlNetIf_setState | ( | uint16_t | ifID, |
SlNetIfState_e | ifState | ||
) |
Set interface state.
Enable or disable the interface.
[in] | ifID | Specifies 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] | ifState | Specifies the interface state. The values of the interface state are defined with the prefix SLNETIF_INTERFACE_ which defined in slnetif.h |
SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.int32_t SlNetIf_getState | ( | uint16_t | ifID | ) |
Get interface state.
Obtain the current state of the interface.
[in] | ifID | Specifies 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 |
SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.int32_t SlNetIf_getConnectionStatus | ( | uint16_t | ifID | ) |
Get the connection status of an interface.
[in] | ifID | Interface ID |
SLNETIF_STATUS_
value on success, or negative error code on failureifID
should be a value with the SLNETIF_ID_
prefixSlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.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.
[in] | ifID | Specifies 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] | addrType | Address type: |
[out] | addrConfig | Address config: |
[out] | ipAddr | IP Address according to the Address Type |
SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.int32_t SlNetIf_loadSecObj | ( | uint16_t | objType, |
char * | objName, | ||
int16_t | objNameLen, | ||
uint8_t * | objBuff, | ||
int16_t | objBuffLen, | ||
uint32_t | ifBitmap | ||
) |
Load/unload/replace a secure object into a network interface/stack.
SlNetIf_loadSecObj() loads a named secure object into specific network stack for future use by secure sockets. To unload the named secure object, pass a NULL object buffer with the appropriate name.
[in] | objType | The secure object type: |
[in] | objName | The secure object name |
[in] | objNameLen | The secure object name length |
[in] | objBuff | The secure object buffer to be loaded, or NULL if the named object is to be unloaded |
[in] | objBuffLen | The secure object buffer length |
[in] | ifBitmap | The interfaces which the secure objects should be loaded to |
ifBitmap
typically have the prefix SLNETIF_ID_
.objName
, objNameLen
, and objType
arguments, so the underlying interface/stack functions do not need to check them again.objName
will be the file name used on the file system.objBuff
after returning from SlNetIf_loadSecObj() varies by stack/interface, often depending on how the underlying stack implements it's TLS support.objBuff
is no longer needed, and can be considered "owned" by the application.objBuff
is made within the SlNetIf_loadSecObj() call, and the buffer must persist as long as the secure object remains loaded. Ownership of the buffer returns to the user only after unloading the secure object (or resetting the device).objName
. Resources associated with the previously loaded secure object will be released and replaced by the new secure object.objBuffLen
is ignored.SlNetIf_*
functions are not thread safe! Users are responsible for serializing all calls into the SlNetIf module.