Network Services API
2.00.00.16
|
Sockets related commands and configuration. More...
Macros | |
#define | SLNETUTIL_IPV4_VAL(add_3, add_2, add_1, add_0) ((((uint32_t)add_3 << 24) & 0xFF000000) | (((uint32_t)add_2 << 16) & 0xFF0000) | (((uint32_t)add_1 << 8) & 0xFF00) | ((uint32_t)add_0 & 0xFF) ) |
Functions | |
int32_t | SlNetutil_init (int32_t flags) |
Initialize the slnetutil module. More... | |
int32_t | SlNetUtil_getHostByName (uint32_t ifBitmap, char *name, const uint16_t nameLen, uint32_t **ipAddr, uint16_t *ipAddrLen, const uint8_t family) |
Get host IP by name Obtain the IP Address of machine on network, by machine name. More... | |
uint32_t | SlNetUtil_htonl (uint32_t val) |
Reorder the bytes of a 32-bit unsigned value. More... | |
uint32_t | SlNetUtil_ntohl (uint32_t val) |
Reorder the bytes of a 32-bit unsigned value. More... | |
uint16_t | SlNetUtil_htons (uint16_t val) |
Reorder the bytes of a 16-bit unsigned value. More... | |
uint16_t | SlNetUtil_ntohs (uint16_t val) |
Reorder the bytes of a 16-bit unsigned value. More... | |
const char * | SlNetUtil_inetNtop (int16_t addrFamily, const void *binaryAddr, char *strAddr, SlNetSocklen_t strAddrLen) |
Converts IP address in binary representation to string representation. More... | |
int32_t | SlNetUtil_inetPton (int16_t addrFamily, const char *strAddr, void *binaryAddr) |
Converts IP address in string representation to binary representation. More... | |
Sockets related commands and configuration.
#define SLNETUTIL_IPV4_VAL | ( | add_3, | |
add_2, | |||
add_1, | |||
add_0 | |||
) | ((((uint32_t)add_3 << 24) & 0xFF000000) | (((uint32_t)add_2 << 16) & 0xFF0000) | (((uint32_t)add_1 << 8) & 0xFF00) | ((uint32_t)add_0 & 0xFF) ) |
int32_t SlNetutil_init | ( | int32_t | flags | ) |
Initialize the slnetutil module.
The SlNetutil_init function Initialize the slnetutil module.
[in] | flags | For future usage, The value 0 may be used in order to run the default flags |
int32_t SlNetUtil_getHostByName | ( | uint32_t | ifBitmap, |
char * | name, | ||
const uint16_t | nameLen, | ||
uint32_t ** | ipAddr, | ||
uint16_t * | ipAddrLen, | ||
const uint8_t | family | ||
) |
Get host IP by name
Obtain the IP Address of machine on network, by machine name.
[in] | ifBitmap | Specifies the interfaces which the the host ip needs to be retrieved from according tothe priority until one of them will return an answer. Value 0 is used in order to choose automatic interfaces selection according to the priority interface list. Value can be combination of interfaces by OR'ing multiple interfaces bit identifiers (SLNETIFC_IDENT_ defined in slnetif.h) Note: interface identifier bit must be configured prior to this socket creation using SlNetIf_add function. |
[in] | name | Host name |
[in] | nameLen | Name length |
[out] | ipAddr | This parameter is filled in with an array of host IP addresses. In case that host name is not resolved, out_ip_addr is zero. |
[in,out] | ipAddrLen | Holds the size of the ipAddr array, when function successful, the ipAddrLen parameter will be updated with the number of the IP addresses found. |
[in] | family | Protocol family |
uint32_t SlNetUtil_htonl | ( | uint32_t | val | ) |
Reorder the bytes of a 32-bit unsigned value.
This function is used to reorder the bytes of a 32-bit unsigned value from host order to network order.
[in] | val | Variable in host order |
uint32_t SlNetUtil_ntohl | ( | uint32_t | val | ) |
Reorder the bytes of a 32-bit unsigned value.
This function is used to reorder the bytes of a 32-bit unsigned value from network order to host order.
[in] | val | Variable in network order |
uint16_t SlNetUtil_htons | ( | uint16_t | val | ) |
Reorder the bytes of a 16-bit unsigned value.
This functions is used to reorder the bytes of a 16-bit unsigned value from host order to network order.
[in] | val | Variable in host order |
uint16_t SlNetUtil_ntohs | ( | uint16_t | val | ) |
Reorder the bytes of a 16-bit unsigned value.
This functions is used to reorder the bytes of a 16-bit unsigned value from network order to host order.
[in] | val | Variable in network order |
const char* SlNetUtil_inetNtop | ( | int16_t | addrFamily, |
const void * | binaryAddr, | ||
char * | strAddr, | ||
SlNetSocklen_t | strAddrLen | ||
) |
Converts IP address in binary representation to string representation.
This functions is used to converts IP address in binary representation to IP address in string representation.
[in] | addrFamily | Specifies the address family of the created socket For example:
|
[in] | binaryAddr | Pointer to an IP address structure indicating the address in binary representation |
[out] | strAddr | Pointer to the address string representation for IPv4 or IPv6 according to the address family |
[in] | strAddrLen | Specifies the length of the StrAddress_dst, the maximum length of the address in string representation for IPv4 or IPv6 according to the address family |
int32_t SlNetUtil_inetPton | ( | int16_t | addrFamily, |
const char * | strAddr, | ||
void * | binaryAddr | ||
) |
Converts IP address in string representation to binary representation.
This functions is used to converts IP address in string representation to IP address in binary representation.
[in] | addrFamily | Specifies the address family of the created socket For example:
|
[out] | strAddr | Specifies the IP address in string representation for IPv4 or IPv6 according to the address family |
[in] | binaryAddr | Pointer to an address structure that will be filled by the IP address in Binary representation |