Patchwork [06/12] qapi: add socket address types

login
register
mail settings
Submitter Paolo Bonzini
Date Sept. 19, 2012, 2:31 p.m.
Message ID <1348065078-5139-7-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/185061/
State New
Headers show

Comments

Paolo Bonzini - Sept. 19, 2012, 2:31 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qapi-schema.json | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file modificato, 53 inserzioni(+)
Eric Blake - Sept. 19, 2012, 5:20 p.m.
On 09/19/2012 08:31 AM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  qapi-schema.json | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file modificato, 53 inserzioni(+)
> 

>  ##
> +# @IPSocketAddress
> +#
> +# Captures the destination address of an IP socket

Given the presence of @to, would this read better as:
IP socket or socket range

> +#
> +# @host: host part of the address
> +#
> +# @port: port part of the address, or lowest port if @to is present
> +#
> +# @to: highest port to try
> +#
> +# @ipv4: whether to accept IPv4 addresses, default try both IPv4 and IPv6
> +#        #optional

Isn't the #optional supposed to occur first after the colon, as in:

@ipv4: #optional whether to accept IPv4...

> +#
> +# @ipv6: whether to accept IPv6 addresses, default try both IPv4 and IPv6
> +#        #optional
> +#
> +# Since 1.3
> +##
> +{ 'type': 'IPSocketAddress',
> +  'data': {
> +    'host': 'str',
> +    'port': 'str',
> +    '*to': 'uint16',

Why is 'port' a string, but 'to' a uint16?  Shouldn't they both be uint16?
Paolo Bonzini - Sept. 20, 2012, 8:01 a.m.
Il 19/09/2012 19:20, Eric Blake ha scritto:
>> > +{ 'type': 'IPSocketAddress',
>> > +  'data': {
>> > +    'host': 'str',
>> > +    'port': 'str',
>> > +    '*to': 'uint16',
> Why is 'port' a string, but 'to' a uint16?  Shouldn't they both be uint16?

port can be a service name.

Paolo

Patch

diff --git a/qapi-schema.json b/qapi-schema.json
index a9f465a..1588372 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2278,6 +2278,59 @@ 
     'opts': 'NetClientOptions' } }
 
 ##
+# @IPSocketAddress
+#
+# Captures the destination address of an IP socket
+#
+# @host: host part of the address
+#
+# @port: port part of the address, or lowest port if @to is present
+#
+# @to: highest port to try
+#
+# @ipv4: whether to accept IPv4 addresses, default try both IPv4 and IPv6
+#        #optional
+#
+# @ipv6: whether to accept IPv6 addresses, default try both IPv4 and IPv6
+#        #optional
+#
+# Since 1.3
+##
+{ 'type': 'IPSocketAddress',
+  'data': {
+    'host': 'str',
+    'port': 'str',
+    '*to': 'uint16',
+    '*ipv4': 'bool',
+    '*ipv6': 'bool' } }
+
+##
+# @UnixSocketAddress
+#
+# Captures the destination address of a Unix socket
+#
+# @path: filesystem path to use
+#
+# Since 1.3
+##
+{ 'type': 'UnixSocketAddress',
+  'data': {
+    'path': 'str' } }
+
+##
+# @SocketAddress
+#
+# Captures the address of a socket, which could also be a named file descriptor
+#
+# Since 1.3
+##
+{ 'union': 'SocketAddress',
+  'data': {
+    'inet': 'IPSocketAddress',
+    'unix': 'UnixSocketAddress',
+    'fd': 'String' } }
+
+##
 # @getfd:
 #
 # Receive a file descriptor via SCM rights and assign it a name