sockets header

The documentation of QEMU’s qemu/sockets.h header.

SocketAddress * socket_sockaddr_to_address(struct sockaddr_storage * sa, socklen_t salen, Error ** errp)

Parameters

struct sockaddr_storage * sa
socket address struct
socklen_t salen
size of sa struct
Error ** errp
pointer to uninitialized error object

Description

Get the string representation of the socket address. A pointer to the allocated address information struct will be returned, which the caller is required to release with a call qapi_free_SocketAddress() when no longer required.

Return

the socket address struct, or NULL on error

SocketAddress * socket_local_address(int fd, Error ** errp)

Parameters

int fd
the socket file handle
Error ** errp
pointer to uninitialized error object

Description

Get the string representation of the local socket address. A pointer to the allocated address information struct will be returned, which the caller is required to release with a call qapi_free_SocketAddress() when no longer required.

Return

the socket address struct, or NULL on error

SocketAddress * socket_remote_address(int fd, Error ** errp)

Parameters

int fd
the socket file handle
Error ** errp
pointer to uninitialized error object

Description

Get the string representation of the remote socket address. A pointer to the allocated address information struct will be returned, which the caller is required to release with a call qapi_free_SocketAddress() when no longer required.

Return

the socket address struct, or NULL on error

SocketAddress * socket_address_flatten(SocketAddressLegacy * addr)

Parameters

SocketAddressLegacy * addr
the socket address to flatten

Description

Convert SocketAddressLegacy to SocketAddress. Caller is responsible for freeing with qapi_free_SocketAddress().

Return

the argument converted to SocketAddress.