From 559607ea173a0003efda7f884bec73b242f923fb Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 27 Feb 2015 16:19:33 +0000 Subject: io: add QIOChannelSocket class Implement a QIOChannel subclass that supports sockets I/O. The implementation is able to manage a single socket file descriptor, whether a TCP/UNIX listener, TCP/UNIX connection, or a UDP datagram. It provides APIs which can listen and connect either asynchronously or synchronously. Since there is no asynchronous DNS lookup API available, it uses the QIOTask helper for spawning a background thread to ensure non-blocking operation. Signed-off-by: Daniel P. Berrange --- include/qemu/sockets.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/qemu/sockets.h') diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 5a183c570d..74c692d432 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -88,6 +88,25 @@ int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp); int parse_host_port(struct sockaddr_in *saddr, const char *str); int socket_init(void); +/** + * socket_sockaddr_to_address: + * @sa: socket address struct + * @salen: size of @sa struct + * @errp: pointer to uninitialized error object + * + * 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. + * + * Returns: the socket address struct, or NULL on error + */ +SocketAddress * +socket_sockaddr_to_address(struct sockaddr_storage *sa, + socklen_t salen, + Error **errp); + /** * socket_local_address: * @fd: the socket file handle -- cgit 1.4.1