aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-03-15 11:55:29 +0100
committerKevin Wolf <kwolf@redhat.com>2013-03-22 17:51:31 +0100
commitf17c90bed11a6e277614b5a5d16434004f24d572 (patch)
tree5994d06681764c31bf5c679163ae1a3c9d1229df /include
parente62be8888a83aa0ab7f50eeb954deb2ec4e7201d (diff)
nbd: Keep hostname and port separate
The NBD block supports an URL syntax, for which a URL parser returns separate hostname and port fields. It also supports the traditional qemu syntax encoded in a filename. Until now, after parsing the URL to get each piece of information, a new string is built to be fed to socket functions. Instead of building a string in the URL case that is immediately parsed again, parse the string in both cases and use the QemuOpts interface to qemu-sockets.c. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/nbd.h2
-rw-r--r--include/qemu/sockets.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/include/block/nbd.h b/include/block/nbd.h
index 344f05b794..9b52d50fb1 100644
--- a/include/block/nbd.h
+++ b/include/block/nbd.h
@@ -22,6 +22,7 @@
#include <sys/types.h>
#include "qemu-common.h"
+#include "qemu/option.h"
struct nbd_request {
uint32_t magic;
@@ -64,6 +65,7 @@ int tcp_socket_outgoing(const char *address, uint16_t port);
int tcp_socket_incoming(const char *address, uint16_t port);
int tcp_socket_outgoing_spec(const char *address_and_port);
int tcp_socket_incoming_spec(const char *address_and_port);
+int tcp_socket_outgoing_opts(QemuOpts *opts);
int unix_socket_outgoing(const char *path);
int unix_socket_incoming(const char *path);
diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
index 21846f9886..d225f6dd74 100644
--- a/include/qemu/sockets.h
+++ b/include/qemu/sockets.h
@@ -47,6 +47,7 @@ int recv_all(int fd, void *buf, int len1, bool single_read);
*/
typedef void NonBlockingConnectHandler(int fd, void *opaque);
+InetSocketAddress *inet_parse(const char *str, Error **errp);
int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp);
int inet_listen(const char *str, char *ostr, int olen,
int socktype, int port_offset, Error **errp);