Data Structures | Macros | Functions
socket_addr.h File Reference

Socket address. More...

Data Structures

struct  vtm_socket_addr


#define VTM_SOCK_ADDR_LOCALHOST   "localhost"
#define VTM_SOCK_ADDR_IPV4_ANY   ""
#define VTM_SOCK_ADDR_IPV6_ANY   "::"
#define VTM_SOCK_ADDR_BUF_LEN   46


VTM_API int vtm_socket_os_addr_build (struct vtm_socket_saddr *saddr, struct vtm_socket_addr *from)
VTM_API int vtm_socket_os_addr_convert (struct vtm_socket_saddr *saddr, enum vtm_socket_family *fam, char *host_buf, size_t len, unsigned int *port)

Macro Definition Documentation

#define VTM_SOCK_ADDR_LOCALHOST   "localhost"

Localhost constant


IPv4 loopback address

#define VTM_SOCK_ADDR_IPV4_ANY   ""

IPv4 any address placeholder


IPv6 loopback address

#define VTM_SOCK_ADDR_IPV6_ANY   "::"

IPv6 any address placeholder

#define VTM_SOCK_ADDR_BUF_LEN   46

Minimum buffer size to hold string representation of an IP address

Function Documentation

VTM_API int vtm_socket_os_addr_build ( struct vtm_socket_saddr saddr,
struct vtm_socket_addr from 

Converts a readable address in a platform/os specific representation.

[out]saddrthe converted address
fromthe address that should be converted
VTM_OK if the conversion was successful
VTM_ERROR if an error occured
VTM_API int vtm_socket_os_addr_convert ( struct vtm_socket_saddr saddr,
enum vtm_socket_family fam,
char *  host_buf,
size_t  len,
unsigned int *  port 

Convertes a platform specific address representation back to a readable format.

saddrthe address that should converted
[out]famthe socket family
[out]host_bufthe buffer where the ip address is stored
lenthe length in bytes of the host buffer
[out]portthe port of the address
VTM_OK if the conversion was successful
VTM_ERROR if an error occured