]> git.proxmox.com Git - mirror_qemu.git/blobdiff - include/io/channel-socket.h
socket: Add num connections to qio_channel_socket_sync()
[mirror_qemu.git] / include / io / channel-socket.h
index c1aaa72a5dade239ca5a4f7d1b0835c0fe67d8be..ed88e5b8c19c04f253affa93eb13562d48147fab 100644 (file)
@@ -91,7 +91,7 @@ qio_channel_socket_new_fd(int fd,
  * an error occurs.
  */
 int qio_channel_socket_connect_sync(QIOChannelSocket *ioc,
-                                    SocketAddressLegacy *addr,
+                                    SocketAddress *addr,
                                     Error **errp);
 
 /**
@@ -101,6 +101,8 @@ int qio_channel_socket_connect_sync(QIOChannelSocket *ioc,
  * @callback: the function to invoke on completion
  * @opaque: user data to pass to @callback
  * @destroy: the function to free @opaque
+ * @context: the context to run the async task. If %NULL, the default
+ *           context will be used.
  *
  * Attempt to connect to the address @addr. This method
  * will run in the background so the caller will regain
@@ -110,16 +112,18 @@ int qio_channel_socket_connect_sync(QIOChannelSocket *ioc,
  * as this function returns without waiting for completion.
  */
 void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
-                                      SocketAddressLegacy *addr,
+                                      SocketAddress *addr,
                                       QIOTaskFunc callback,
                                       gpointer opaque,
-                                      GDestroyNotify destroy);
+                                      GDestroyNotify destroy,
+                                      GMainContext *context);
 
 
 /**
  * qio_channel_socket_listen_sync:
  * @ioc: the socket channel object
  * @addr: the address to listen to
+ * @num: the expected ammount of connections
  * @errp: pointer to a NULL-initialized error object
  *
  * Attempt to listen to the address @addr. This method
@@ -128,7 +132,8 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
  * an error occurs.
  */
 int qio_channel_socket_listen_sync(QIOChannelSocket *ioc,
-                                   SocketAddressLegacy *addr,
+                                   SocketAddress *addr,
+                                   int num,
                                    Error **errp);
 
 /**
@@ -138,6 +143,8 @@ int qio_channel_socket_listen_sync(QIOChannelSocket *ioc,
  * @callback: the function to invoke on completion
  * @opaque: user data to pass to @callback
  * @destroy: the function to free @opaque
+ * @context: the context to run the async task. If %NULL, the default
+ *           context will be used.
  *
  * Attempt to listen to the address @addr. This method
  * will run in the background so the caller will regain
@@ -147,10 +154,11 @@ int qio_channel_socket_listen_sync(QIOChannelSocket *ioc,
  * as this function returns without waiting for completion.
  */
 void qio_channel_socket_listen_async(QIOChannelSocket *ioc,
-                                     SocketAddressLegacy *addr,
+                                     SocketAddress *addr,
                                      QIOTaskFunc callback,
                                      gpointer opaque,
-                                     GDestroyNotify destroy);
+                                     GDestroyNotify destroy,
+                                     GMainContext *context);
 
 
 /**
@@ -167,8 +175,8 @@ void qio_channel_socket_listen_async(QIOChannelSocket *ioc,
  * is established or an error occurs.
  */
 int qio_channel_socket_dgram_sync(QIOChannelSocket *ioc,
-                                  SocketAddressLegacy *localAddr,
-                                  SocketAddressLegacy *remoteAddr,
+                                  SocketAddress *localAddr,
+                                  SocketAddress *remoteAddr,
                                   Error **errp);
 
 /**
@@ -179,6 +187,8 @@ int qio_channel_socket_dgram_sync(QIOChannelSocket *ioc,
  * @callback: the function to invoke on completion
  * @opaque: user data to pass to @callback
  * @destroy: the function to free @opaque
+ * @context: the context to run the async task. If %NULL, the default
+ *           context will be used.
  *
  * Attempt to initialize a datagram socket bound to
  * @localAddr and communicating with peer @remoteAddr.
@@ -190,11 +200,12 @@ int qio_channel_socket_dgram_sync(QIOChannelSocket *ioc,
  * waiting for completion.
  */
 void qio_channel_socket_dgram_async(QIOChannelSocket *ioc,
-                                    SocketAddressLegacy *localAddr,
-                                    SocketAddressLegacy *remoteAddr,
+                                    SocketAddress *localAddr,
+                                    SocketAddress *remoteAddr,
                                     QIOTaskFunc callback,
                                     gpointer opaque,
-                                    GDestroyNotify destroy);
+                                    GDestroyNotify destroy,
+                                    GMainContext *context);
 
 
 /**
@@ -205,12 +216,12 @@ void qio_channel_socket_dgram_async(QIOChannelSocket *ioc,
  * 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_SocketAddressLegacy() when no
+ * release with a call qapi_free_SocketAddress() when no
  * longer required.
  *
  * Returns: 0 on success, -1 on error
  */
-SocketAddressLegacy *
+SocketAddress *
 qio_channel_socket_get_local_address(QIOChannelSocket *ioc,
                                      Error **errp);
 
@@ -222,12 +233,12 @@ qio_channel_socket_get_local_address(QIOChannelSocket *ioc,
  * 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_SocketAddressLegacy() when no
+ * release with a call qapi_free_SocketAddress() when no
  * longer required.
  *
  * Returns: the socket address struct, or NULL on error
  */
-SocketAddressLegacy *
+SocketAddress *
 qio_channel_socket_get_remote_address(QIOChannelSocket *ioc,
                                       Error **errp);