Loading...
Searching...
No Matches
net.h File Reference

Network related helper functions. More...

Functions

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 *saddr, int slen, uint16_t *sport, char *caddr, int clen, uint16_t *cport)
 

Detailed Description

Network related helper functions.

Function Documentation

◆ spdk_net_get_address_string()

int spdk_net_get_address_string ( struct sockaddr *  sa,
char *  addr,
size_t  len 
)

Gets the address string for a given struct sockaddr.

Parameters
sasockaddr to get the address string for
addrstring to put the address
lenlength of the the addr parameter
Returns
0 if successful, negative -errno otherwise

◆ spdk_net_get_interface_name()

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.

Parameters
ipIP address to find the interface name for
ifcstring output parameter for the interface name
lenlength of the ifc parameter in bytes
Returns
0 if successful, the interface name will be copied to the ifc parameter -ENODEV if an interface name could not be identified -ENOMEM the provided ifc string was too small

◆ spdk_net_is_loopback()

bool spdk_net_is_loopback ( int  fd)

Checks if the given fd is a loopback interface or not.

Parameters
fdfile descriptor to check
Returns
true if the fd is loopback, false if not