|
| int | spdk_net_get_interface_name (const char *ip, char *ifc, size_t len) |
| | Gets the name of the network interface for the given IP address.
|
| |
| int | spdk_net_get_address_string (struct sockaddr *sa, char *addr, size_t len) |
| | Gets the address string for a given struct sockaddr.
|
| |
| bool | spdk_net_is_loopback (int fd) |
| | Checks if the given fd is a loopback interface or not.
|
| |
|
int | spdk_net_getaddr (int fd, char *laddr, int llen, uint16_t *lport, char *paddr, int plen, uint16_t *pport) |
| |
| int | spdk_net_compare_address (int adrfam, const char *addr1, const char *addr2, int *cmp) |
| | Compare two IP addresses to check if they are equal, and store the comparison result in *cmp.
|
| |
Network related helper functions.
| int spdk_net_compare_address |
( |
int | adrfam, |
|
|
const char * | addr1, |
|
|
const char * | addr2, |
|
|
int * | cmp ) |
Compare two IP addresses to check if they are equal, and store the comparison result in *cmp.
The comparison result follows the same rule as strcmp, i.e. 0 if addr1 == addr2, less than 0 if addr1 < addr2, and greater than 0 if addr1 > addr2.
Note that the result is only valid when this function returns 0. Otherwise, the content of *cmp will not be touched.
- Parameters
-
| adrfam | Address family of the IP addresses, can be AF_INET or AF_INET6. |
| addr1 | First IP address. |
| addr2 | Second IP address. |
| cmp | A pointer to the variable to store the result of the comparison. |
- Returns
- 0 on success, and *cmp contains the comparison result, -EAFNOSUPPORT if adrfam is not supported, or -EINVAL if the addresses are invalid.