37 #ifndef __SL_NET_IF_H__ 38 #define __SL_NET_IF_H__ 65 #define SLNETIF_ID_1 (1 << 0) 66 #define SLNETIF_ID_2 (1 << 1) 67 #define SLNETIF_ID_3 (1 << 2) 68 #define SLNETIF_ID_4 (1 << 3) 69 #define SLNETIF_ID_5 (1 << 4) 70 #define SLNETIF_ID_6 (1 << 5) 71 #define SLNETIF_ID_7 (1 << 6) 72 #define SLNETIF_ID_8 (1 << 7) 73 #define SLNETIF_ID_9 (1 << 8) 74 #define SLNETIF_ID_10 (1 << 9) 75 #define SLNETIF_ID_11 (1 << 10) 76 #define SLNETIF_ID_12 (1 << 11) 77 #define SLNETIF_ID_13 (1 << 12) 78 #define SLNETIF_ID_14 (1 << 13) 79 #define SLNETIF_ID_15 (1 << 14) 80 #define SLNETIF_ID_16 (1 << 15) 82 #define SLNETIF_MAX_IF (16) 85 #define ONLY_ONE_BIT_IS_SET(x) (((x > 0) && ((x & (x - 1)) == 0))?true:false) 90 #define SLNETIF_STATUS_DISCONNECTED (0) 91 #define SLNETIF_STATUS_CONNECTED (1) 113 #define SLNETIF_ADDR_CFG_UNKNOWN (0) 114 #define SLNETIF_ADDR_CFG_DHCP (1) 115 #define SLNETIF_ADDR_CFG_DHCP_LLA (2) 116 #define SLNETIF_ADDR_CFG_STATIC (4) 117 #define SLNETIF_ADDR_CFG_STATELESS (5) 118 #define SLNETIF_ADDR_CFG_STATEFUL (6) 121 #define SLNETIF_SEC_OBJ_TYPE_RSA_PRIVATE_KEY (1) 122 #define SLNETIF_SEC_OBJ_TYPE_CERTIFICATE (2) 123 #define SLNETIF_SEC_OBJ_TYPE_DH_KEY (3) 131 #define SLNETIF_QUERY_IF_STATE_BIT (1 << 0) 137 #define SLNETIF_QUERY_IF_CONNECTION_STATUS_BIT (1 << 1) 144 #define SLNETIF_QUERY_IF_ALLOW_PARTIAL_MATCH_BIT (1 << 2) 163 int16_t (*
sockCreate) (
void *ifContext, int16_t domain, int16_t type, int16_t protocol,
void **sdContext);
168 int32_t (*
sockListen) (int16_t sd,
void *sdContext, int16_t backlog);
175 int32_t (*
sockRecv) (int16_t sd,
void *sdContext,
void *buf, uint32_t len, uint32_t flags);
177 int32_t (*
sockSend) (int16_t sd,
void *sdContext,
const void *buf, uint32_t len, uint32_t flags);
182 int32_t (*
utilGetHostByName) (
void *ifContext,
char *name,
const uint16_t nameLen, uint32_t *ipAddr, uint16_t *ipAddrLen,
const uint8_t family);
187 int32_t (*
ifLoadSecObj) (
void *ifContext, uint16_t objType,
char *objName, int16_t objNameLen, uint8_t *objBuff, int16_t objBuffLen);
617 int32_t
SlNetIf_loadSecObj(uint16_t objType,
char *objName, int16_t objNameLen, uint8_t *objBuff, int16_t objBuffLen, uint32_t ifBitmap);
int32_t(* sockSend)(int16_t sd, void *sdContext, const void *buf, uint32_t len, uint32_t flags)
Definition: slnetif.h:177
int32_t(* sockShutdown)(int16_t sd, void *sdContext, int16_t how)
Definition: slnetif.h:165
const char * SlNetIf_getNameByID(uint16_t ifID)
Get interface Name from interface ID.
int16_t(* sockAccept)(int16_t sd, void *sdContext, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen, uint8_t flags, void **acceptedSdContext)
Definition: slnetif.h:166
int32_t(* sockGetOpt)(int16_t sd, void *sdContext, int16_t level, int16_t optname, void *optval, SlNetSocklen_t *optlen)
Definition: slnetif.h:174
int32_t(* sockSetOpt)(int16_t sd, void *sdContext, int16_t level, int16_t optname, void *optval, SlNetSocklen_t optlen)
Definition: slnetif.h:173
int32_t SlNetIf_setPriority(uint16_t ifID, uint8_t priority)
Set interface priority.
SlNetIf_Config_t structure contains all the function callbacks that are expected to be filled by the ...
Definition: slnetif.h:160
int32_t(* ifGetIPAddr)(void *ifContext, SlNetIfAddressType_e addrType, uint16_t *addrConfig, uint32_t *ipAddr)
Definition: slnetif.h:185
int32_t(* sockConnect)(int16_t sd, void *sdContext, const SlNetSock_Addr_t *addr, SlNetSocklen_t addrlen, uint8_t flags)
Definition: slnetif.h:169
The SlNetIf_t structure holds the configuration of the interface Its ID, name, flags and the configur...
Definition: slnetif.h:197
SlNetIfAddressType_e
Address type enum to be used in get ip address function.
Definition: slnetif.h:105
uint16_t SlNetSocklen_t
The SlNetSocklen_t is used for declaring the socket length parameter.
Definition: slnetsock.h:647
int32_t SlNetIf_init(int32_t flags)
Initialize the SlNetIf module.
int32_t(* sockGetLocalName)(int16_t sd, void *sdContext, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen)
Definition: slnetif.h:171
SlNetIf_t * SlNetIf_queryIf(uint32_t ifBitmap, uint32_t queryBitmap)
Query for the highest priority interface, given a list of interfaces and properties.
int32_t SlNetIf_getIPAddr(uint16_t ifID, SlNetIfAddressType_e addrType, uint16_t *addrConfig, uint32_t *ipAddr)
Get IP Address of specific interface.
int32_t flags
Definition: slnetif.h:201
IpV4 socket address.
Definition: slnetsock.h:652
struct SlNetIf_Config_t SlNetIf_Config_t
SlNetIf_Config_t structure contains all the function callbacks that are expected to be filled by the ...
int32_t(* sockBind)(int16_t sd, void *sdContext, const SlNetSock_Addr_t *addr, int16_t addrlen)
Definition: slnetif.h:167
int32_t(* ifLoadSecObj)(void *ifContext, uint16_t objType, char *objName, int16_t objNameLen, uint8_t *objBuff, int16_t objBuffLen)
Definition: slnetif.h:187
The SlNetSock_SdSet_t structure holds the sd array for SlNetSock_select function. ...
Definition: slnetsock.h:696
int32_t(* utilGetHostByName)(void *ifContext, char *name, const uint16_t nameLen, uint32_t *ipAddr, uint16_t *ipAddrLen, const uint8_t family)
Definition: slnetif.h:182
int32_t(* sockClose)(int16_t sd, void *sdContext)
Definition: slnetif.h:164
int32_t(* sockstartSec)(int16_t sd, void *sdContext, SlNetSockSecAttrib_t *secAttrib, uint8_t flags)
Definition: slnetif.h:179
int32_t(* ifGetConnectionStatus)(void *ifContext)
Definition: slnetif.h:186
Definition: slnetif.h:109
SlNetIfState_e
Interface state bit pool to be used in set interface state function.
Definition: slnetif.h:96
Secure socket attribute context.
Definition: slnetsock.h:569
int32_t SlNetIf_getPriority(uint16_t ifID)
Get interface priority.
int32_t SlNetIf_getConnectionStatus(uint16_t ifID)
Get the connection status of an interface.
struct SlNetIf_t SlNetIf_t
The SlNetIf_t structure holds the configuration of the interface Its ID, name, flags and the configur...
int16_t(* sockCreate)(void *ifContext, int16_t domain, int16_t type, int16_t protocol, void **sdContext)
Definition: slnetif.h:163
int32_t(* ifCreateContext)(uint16_t ifID, const char *ifName, void **ifContext)
Definition: slnetif.h:188
void * ifContext
Definition: slnetif.h:203
int32_t(* sockGetPeerName)(int16_t sd, void *sdContext, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen)
Definition: slnetif.h:170
int32_t(* sockSelect)(void *ifContext, int16_t nsds, SlNetSock_SdSet_t *readsds, SlNetSock_SdSet_t *writesds, SlNetSock_SdSet_t *exceptsds, SlNetSock_Timeval_t *timeout)
Definition: slnetif.h:172
Definition: slnetif.h:107
int32_t(* sockSendTo)(int16_t sd, void *sdContext, const void *buf, uint32_t len, uint32_t flags, const SlNetSock_Addr_t *to, SlNetSocklen_t tolen)
Definition: slnetif.h:178
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.
int32_t(* sockRecv)(int16_t sd, void *sdContext, void *buf, uint32_t len, uint32_t flags)
Definition: slnetif.h:175
SlNetIf_t * SlNetIf_getIfByID(uint16_t ifID)
Get interface configuration from interface ID.
int32_t(* sockRecvFrom)(int16_t sd, void *sdContext, void *buf, uint32_t len, uint32_t flags, SlNetSock_Addr_t *from, SlNetSocklen_t *fromlen)
Definition: slnetif.h:176
int32_t SlNetIf_getState(uint16_t ifID)
Get interface state.
char * ifName
Definition: slnetif.h:200
SlNetIf_Config_t * ifConf
Definition: slnetif.h:202
int32_t SlNetIf_getIDByName(char *ifName)
Get interface ID from interface name.
uint32_t ifID
Definition: slnetif.h:199
Definition: slnetif.h:108
struct timeval SlNetSock_Timeval_t
The SlNetSock_Timeval_t structure is used in the SLNETSOCK_OPSOCK_RCV_TIMEO and SLNETSOCK_OPSOCK_SND_...
Definition: slnetsock.h:642
int32_t(* sockListen)(int16_t sd, void *sdContext, int16_t backlog)
Definition: slnetif.h:168
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.
int32_t SlNetIf_setState(uint16_t ifID, SlNetIfState_e ifState)
Set interface state.