From 7e8449594c92992342512061160bc846c922016d Mon Sep 17 00:00:00 2001 From: Ashijeet Acharya Date: Sat, 18 Jun 2016 13:24:02 +0530 Subject: Change net/socket.c to use socket_*() functions Use socket_*() functions from include/qemu/sockets.h instead of listen()/bind()/connect()/parse_host_port(). socket_*() fucntions are QAPI based and this patch performs this api conversion since everything will be using QAPI based sockets in the future. Also add a helper function socket_address_to_string() in util/qemu-sockets.c which returns the string representation of socket address. Thetask was listed on http://wiki.qemu.org/BiteSizedTasks page. Signed-off-by: Ashijeet Acharya Reviewed-by: Paolo Bonzini Signed-off-by: Jason Wang --- include/qemu/sockets.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 1bd9218..3a1a887 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -110,4 +110,18 @@ SocketAddress *socket_remote_address(int fd, Error **errp); void qapi_copy_SocketAddress(SocketAddress **p_dest, SocketAddress *src); -#endif /* QEMU_SOCKET_H */ +/** + * socket_address_to_string: + * @addr: the socket address struct + * @errp: pointer to uninitialized error object + * + * Get the string representation of the socket + * address. A pointer to the char array containing + * string format will be returned, the caller is + * required to release the returned value when no + * longer required with g_free. + * + * Returns: the socket address in string format, or NULL on error + */ +char *socket_address_to_string(struct SocketAddress *addr, Error **errp); +#endif /* QEMU_SOCKET_H */ \ No newline at end of file -- cgit v1.1