37 #ifndef __SL_NET_IF_H__ 38 #define __SL_NET_IF_H__ 68 #define SLNETIF_ID_1 (1 << 0) //can be used for wifi interface 69 #define SLNETIF_ID_2 (1 << 1) //can be used for eth interface 70 #define SLNETIF_ID_3 (1 << 2) 71 #define SLNETIF_ID_4 (1 << 3) 72 #define SLNETIF_ID_5 (1 << 4) 73 #define SLNETIF_ID_6 (1 << 5) 74 #define SLNETIF_ID_7 (1 << 6) 75 #define SLNETIF_ID_8 (1 << 7) 76 #define SLNETIF_ID_9 (1 << 8) 77 #define SLNETIF_ID_10 (1 << 9) 78 #define SLNETIF_ID_11 (1 << 10) 79 #define SLNETIF_ID_12 (1 << 11) 80 #define SLNETIF_ID_13 (1 << 12) 81 #define SLNETIF_ID_14 (1 << 13) 82 #define SLNETIF_ID_15 (1 << 14) 83 #define SLNETIF_ID_16 (1 << 15) 86 #define SLNETIF_MAX_IF (16) 89 #define ONLY_ONE_BIT_IS_SET(x) (((x > 0) && ((x & (x - 1)) == 0))?true:false) 94 #define SLNETIF_STATUS_DISCONNECTED (0) 95 #define SLNETIF_STATUS_CONNECTED (1) 117 #define SLNETIF_ADDR_CFG_UNKNOWN (0) 118 #define SLNETIF_ADDR_CFG_DHCP (1) 119 #define SLNETIF_ADDR_CFG_DHCP_LLA (2) 120 #define SLNETIF_ADDR_CFG_STATIC (4) 121 #define SLNETIF_ADDR_CFG_STATELESS (5) 122 #define SLNETIF_ADDR_CFG_STATEFUL (6) 125 #define SLNETIF_SEC_OBJ_TYPE_RSA_PRIVATE_KEY (1) 126 #define SLNETIF_SEC_OBJ_TYPE_CERTIFICATE (2) 127 #define SLNETIF_SEC_OBJ_TYPE_DH_KEY (3) 136 #define SLNETIF_QUERY_IF_STATE_BIT (1 << 0) 137 #define SLNETIF_QUERY_IF_CONNECTION_STATUS_BIT (1 << 1) 138 #define SLNETIF_QUERY_IF_ALLOW_PARTIAL_MATCH_BIT (1 << 2) 154 int16_t (*
sockCreate) (
void *ifContext, int16_t domain, int16_t type, int16_t protocol,
void **sdContext);
159 int32_t (*
sockListen) (int16_t sd,
void *sdContext, int16_t backlog);
166 int32_t (*
sockRecv) (int16_t sd,
void *sdContext,
void *buf, uint32_t len, uint32_t flags);
168 int32_t (*
sockSend) (int16_t sd,
void *sdContext,
const void *buf, uint32_t len, uint32_t flags);
173 int32_t (*
utilGetHostByName) (
void *ifContext,
char *name,
const uint16_t nameLen, uint32_t **ipAddr, uint16_t *ipAddrLen,
const uint8_t family);
178 int32_t (*
ifLoadSecObj) (
void *ifContext, uint16_t objType,
char *objName, int16_t objNameLen, uint8_t *objBuff, int16_t objBuffLen);
661 int32_t
SlNetIf_loadSecObj(uint16_t objType,
char *objName, int16_t objNameLen, uint8_t *objBuff, int16_t objBuffLen, uint32_t ifBitmap);
int32_t(* sockGetOpt)(int16_t sd, void *sdContext, int16_t level, int16_t optname, void *optval, SlNetSocklen_t *optlen)
Definition: slnetif.h:165
int32_t(* sockstartSec)(int16_t sd, void *sdContext, SlNetSockSecAttrib_t *secAttrib, uint8_t flags)
Definition: slnetif.h:170
void * ifContext
Definition: slnetif.h:194
const char * SlNetIf_getNameByID(uint16_t ifID)
Get interface Name from interface ID.
SlNetIf_Config_t * ifConf
Definition: slnetif.h:193
int32_t SlNetIf_setPriority(uint16_t ifID, uint8_t priority)
Set interface priority.
char * ifName
Definition: slnetif.h:191
struct _SlNetIf_Config_t SlNetIf_Config_t
SlNetIf_Config_t structure contains all the function callbacks that are expected to be filled by the ...
uint32_t ifID
Definition: slnetif.h:190
int32_t(* sockRecv)(int16_t sd, void *sdContext, void *buf, uint32_t len, uint32_t flags)
Definition: slnetif.h:166
int32_t(* sockGetPeerName)(int16_t sd, void *sdContext, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen)
Definition: slnetif.h:161
Definition: slnetif.h:102
Definition: slnetif.h:103
SlNetIfAddressType_e
Address type enum to be used in get ip address function.
Definition: slnetif.h:109
uint16_t SlNetSocklen_t
The SlNetSocklen_t is used for declaring the socket length parameter.
Definition: slnetsock.h:545
int32_t(* ifGetIPAddr)(void *ifContext, SlNetIfAddressType_e addrType, uint16_t *addrConfig, uint32_t *ipAddr)
Definition: slnetif.h:176
int32_t SlNetIf_init(int32_t flags)
Initialize the SlNetIf module.
SlNetIf_t * SlNetIf_queryIf(uint32_t ifBitmap, uint32_t queryBitmap)
Get highest priority interface configuration using interface bitmap.
struct _SlNetIf_t SlNetIf_t
The SlNetIf_t structure holds the configuration of the interface Its ID, name, flags and the configur...
int32_t SlNetIf_getIPAddr(uint16_t ifID, SlNetIfAddressType_e addrType, uint16_t *addrConfig, uint32_t *ipAddr)
Get IP Address of specific interface.
The SlNetIf_t structure holds the configuration of the interface Its ID, name, flags and the configur...
Definition: slnetif.h:188
int32_t(* ifLoadSecObj)(void *ifContext, uint16_t objType, char *objName, int16_t objNameLen, uint8_t *objBuff, int16_t objBuffLen)
Definition: slnetif.h:178
int32_t(* sockBind)(int16_t sd, void *sdContext, const SlNetSock_Addr_t *addr, int16_t addrlen)
Definition: slnetif.h:158
Secure socket attribute context.
Definition: slnetsock.h:460
int16_t(* sockAccept)(int16_t sd, void *sdContext, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen, uint8_t flags, void **acceptedSdContext)
Definition: slnetif.h:157
IpV4 socket address.
Definition: slnetsock.h:550
int32_t(* utilGetHostByName)(void *ifContext, char *name, const uint16_t nameLen, uint32_t **ipAddr, uint16_t *ipAddrLen, const uint8_t family)
Definition: slnetif.h:173
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:163
int32_t(* ifGetConnectionStatus)(void *ifContext)
Definition: slnetif.h:177
Definition: slnetif.h:113
int32_t(* sockShutdown)(int16_t sd, void *sdContext, int how)
Definition: slnetif.h:156
SlNetIfState_e
Interface state bit pool to be used in set interface state function.
Definition: slnetif.h:100
int32_t(* ifCreateContext)(uint16_t ifID, const char *ifName, void **ifContext)
Definition: slnetif.h:179
int32_t SlNetIf_getPriority(uint16_t ifID)
Get interface priority.
int32_t SlNetIf_getConnectionStatus(uint16_t ifID)
Get interface connection status.
int32_t(* sockClose)(int16_t sd, void *sdContext)
Definition: slnetif.h:155
Definition: slnetif.h:111
The SlNetSock_Timeval_t structure is used in SLNETSOCK_OPSOCK_RCV_TIMEO socket level option...
Definition: slnetsock.h:536
int32_t SlNetIf_add(uint16_t ifID, char *ifName, const SlNetIf_Config_t *ifConf, uint8_t priority)
Adding new interface.
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:169
int32_t(* sockListen)(int16_t sd, void *sdContext, int16_t backlog)
Definition: slnetif.h:159
SlNetIf_Config_t structure contains all the function callbacks that are expected to be filled by the ...
Definition: slnetif.h:151
SlNetIf_t * SlNetIf_getIfByID(uint16_t ifID)
Get interface configuration from interface ID.
int32_t SlNetIf_getState(uint16_t ifID)
Get interface state.
int32_t SlNetIf_getIDByName(char *ifName)
Get interface ID from interface name.
int32_t(* sockSetOpt)(int16_t sd, void *sdContext, int16_t level, int16_t optname, void *optval, SlNetSocklen_t optlen)
Definition: slnetif.h:164
Definition: slnetif.h:112
int16_t(* sockCreate)(void *ifContext, int16_t domain, int16_t type, int16_t protocol, void **sdContext)
Definition: slnetif.h:154
int32_t flags
Definition: slnetif.h:192
The SlNetSock_SdSet_t structure holds the sd array for SlNetSock_select function. ...
Definition: slnetsock.h:582
int32_t(* sockSend)(int16_t sd, void *sdContext, const void *buf, uint32_t len, uint32_t flags)
Definition: slnetif.h:168
int32_t(* sockGetLocalName)(int16_t sd, void *sdContext, SlNetSock_Addr_t *addr, SlNetSocklen_t *addrlen)
Definition: slnetif.h:162
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.
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:167
int32_t SlNetIf_setState(uint16_t ifID, SlNetIfState_e ifState)
Set interface state.
int32_t(* sockConnect)(int16_t sd, void *sdContext, const SlNetSock_Addr_t *addr, SlNetSocklen_t addrlen, uint8_t flags)
Definition: slnetif.h:160