xref: /qemu/qapi/sockets.json (revision d2623129)
1# -*- Mode: Python -*-
2
3##
4# = Socket data types
5##
6
7{ 'include': 'common.json' }
8
9##
10# @NetworkAddressFamily:
11#
12# The network address family
13#
14# @ipv4: IPV4 family
15#
16# @ipv6: IPV6 family
17#
18# @unix: unix socket
19#
20# @vsock: vsock family (since 2.8)
21#
22# @unknown: otherwise
23#
24# Since: 2.1
25##
26{ 'enum': 'NetworkAddressFamily',
27  'data': [ 'ipv4', 'ipv6', 'unix', 'vsock', 'unknown' ] }
28
29##
30# @InetSocketAddressBase:
31#
32# @host: host part of the address
33# @port: port part of the address
34##
35{ 'struct': 'InetSocketAddressBase',
36  'data': {
37    'host': 'str',
38    'port': 'str' } }
39
40##
41# @InetSocketAddress:
42#
43# Captures a socket address or address range in the Internet namespace.
44#
45# @numeric: true if the host/port are guaranteed to be numeric,
46#           false if name resolution should be attempted. Defaults to false.
47#           (Since 2.9)
48#
49# @to: If present, this is range of possible addresses, with port
50#      between @port and @to.
51#
52# @ipv4: whether to accept IPv4 addresses, default try both IPv4 and IPv6
53#
54# @ipv6: whether to accept IPv6 addresses, default try both IPv4 and IPv6
55#
56# @keep-alive: enable keep-alive when connecting to this socket. Not supported
57#              for passive sockets. (Since 4.2)
58#
59# Since: 1.3
60##
61{ 'struct': 'InetSocketAddress',
62  'base': 'InetSocketAddressBase',
63  'data': {
64    '*numeric':  'bool',
65    '*to': 'uint16',
66    '*ipv4': 'bool',
67    '*ipv6': 'bool',
68    '*keep-alive': 'bool' } }
69
70##
71# @UnixSocketAddress:
72#
73# Captures a socket address in the local ("Unix socket") namespace.
74#
75# @path: filesystem path to use
76#
77# Since: 1.3
78##
79{ 'struct': 'UnixSocketAddress',
80  'data': {
81    'path': 'str' } }
82
83##
84# @VsockSocketAddress:
85#
86# Captures a socket address in the vsock namespace.
87#
88# @cid: unique host identifier
89# @port: port
90#
91# Note: string types are used to allow for possible future hostname or
92#       service resolution support.
93#
94# Since: 2.8
95##
96{ 'struct': 'VsockSocketAddress',
97  'data': {
98    'cid': 'str',
99    'port': 'str' } }
100
101##
102# @SocketAddressLegacy:
103#
104# Captures the address of a socket, which could also be a named file descriptor
105#
106# Note: This type is deprecated in favor of SocketAddress.  The
107#       difference between SocketAddressLegacy and SocketAddress is that the
108#       latter is a flat union rather than a simple union. Flat is nicer
109#       because it avoids nesting on the wire, i.e. that form has fewer {}.
110
111#
112# Since: 1.3
113##
114{ 'union': 'SocketAddressLegacy',
115  'data': {
116    'inet': 'InetSocketAddress',
117    'unix': 'UnixSocketAddress',
118    'vsock': 'VsockSocketAddress',
119    'fd': 'String' } }
120
121##
122# @SocketAddressType:
123#
124# Available SocketAddress types
125#
126# @inet:  Internet address
127#
128# @unix:  Unix domain socket
129#
130# @vsock: VMCI address
131#
132# @fd: decimal is for file descriptor number, otherwise a file descriptor name.
133#      Named file descriptors are permitted in monitor commands, in combination
134#      with the 'getfd' command. Decimal file descriptors are permitted at
135#      startup or other contexts where no monitor context is active.
136#
137# Since: 2.9
138##
139{ 'enum': 'SocketAddressType',
140  'data': [ 'inet', 'unix', 'vsock', 'fd' ] }
141
142##
143# @SocketAddress:
144#
145# Captures the address of a socket, which could also be a named file
146# descriptor
147#
148# @type:       Transport type
149#
150# Since: 2.9
151##
152{ 'union': 'SocketAddress',
153  'base': { 'type': 'SocketAddressType' },
154  'discriminator': 'type',
155  'data': { 'inet': 'InetSocketAddress',
156            'unix': 'UnixSocketAddress',
157            'vsock': 'VsockSocketAddress',
158            'fd': 'String' } }
159