summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAshijeet Acharya <ashijeetacharya@gmail.com>2016-06-18 13:24:02 +0530
committerJason Wang <jasowang@redhat.com>2016-06-28 10:13:57 +0800
commit7e8449594c92992342512061160bc846c922016d (patch)
tree1688bb59986af9fb10cf0153a3bbf586b327c578 /include
parentd88d3a093898bd1dc0898c7c87b0d3f555a24a6e (diff)
downloadqemu-7e8449594c92992342512061160bc846c922016d.tar.gz
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 <ashijeetacharya@gmail.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/sockets.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
index 1bd92180f3..3a1a8873af 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