xref: /qemu/qapi/sockets.json (revision b4be15a9)
1# -*- Mode: Python -*-
2# vim: filetype=python
3
4##
5# = Socket data types
6##
7
8##
9# @NetworkAddressFamily:
10#
11# The network address family
12#
13# @ipv4: IPV4 family
14#
15# @ipv6: IPV6 family
16#
17# @unix: unix socket
18#
19# @vsock: vsock family (since 2.8)
20#
21# @unknown: otherwise
22#
23# Since: 2.1
24##
25{ 'enum': 'NetworkAddressFamily',
26  'data': [ 'ipv4', 'ipv6', 'unix', 'vsock', 'unknown' ] }
27
28##
29# @InetSocketAddressBase:
30#
31# @host: host part of the address
32#
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
44# namespace.
45#
46# @numeric: true if the host/port are guaranteed to be numeric, false
47#     if name resolution should be attempted.  Defaults to false.
48#     (Since 2.9)
49#
50# @to: If present, this is range of possible addresses, with port
51#     between @port and @to.
52#
53# @ipv4: whether to accept IPv4 addresses, default try both IPv4 and
54#     IPv6
55#
56# @ipv6: whether to accept IPv6 addresses, default try both IPv4 and
57#     IPv6
58#
59# @keep-alive: enable keep-alive when connecting to this socket.  Not
60#     supported for passive sockets.  (Since 4.2)
61#
62# @mptcp: enable multi-path TCP.  (Since 6.1)
63#
64# Since: 1.3
65##
66{ 'struct': 'InetSocketAddress',
67  'base': 'InetSocketAddressBase',
68  'data': {
69    '*numeric':  'bool',
70    '*to': 'uint16',
71    '*ipv4': 'bool',
72    '*ipv6': 'bool',
73    '*keep-alive': 'bool',
74    '*mptcp': { 'type': 'bool', 'if': 'HAVE_IPPROTO_MPTCP' } } }
75
76##
77# @UnixSocketAddress:
78#
79# Captures a socket address in the local ("Unix socket") namespace.
80#
81# @path: filesystem path to use
82#
83# @abstract: if true, this is a Linux abstract socket address.  @path
84#     will be prefixed by a null byte, and optionally padded with null
85#     bytes.  Defaults to false.  (Since 5.1)
86#
87# @tight: if false, pad an abstract socket address with enough null
88#     bytes to make it fill struct sockaddr_un member sun_path.
89#     Defaults to true.  (Since 5.1)
90#
91# Since: 1.3
92##
93{ 'struct': 'UnixSocketAddress',
94  'data': {
95    'path': 'str',
96    '*abstract': { 'type': 'bool', 'if': 'CONFIG_LINUX' },
97    '*tight': { 'type': 'bool', 'if': 'CONFIG_LINUX' } } }
98
99##
100# @VsockSocketAddress:
101#
102# Captures a socket address in the vsock namespace.
103#
104# @cid: unique host identifier
105#
106# @port: port
107#
108# .. note:: String types are used to allow for possible future
109#    hostname or service resolution support.
110#
111# Since: 2.8
112##
113{ 'struct': 'VsockSocketAddress',
114  'data': {
115    'cid': 'str',
116    'port': 'str' } }
117
118##
119# @FdSocketAddress:
120#
121# A file descriptor name or number.
122#
123# @str: decimal is for file descriptor number, otherwise it's a file
124#     descriptor name.  Named file descriptors are permitted in
125#     monitor commands, in combination with the 'getfd' command.
126#     Decimal file descriptors are permitted at startup or other
127#     contexts where no monitor context is active.
128#
129# Since: 1.2
130##
131{ 'struct': 'FdSocketAddress',
132  'data': {
133    'str': 'str' } }
134
135##
136# @InetSocketAddressWrapper:
137#
138# @data: internet domain socket address
139#
140# Since: 1.3
141##
142{ 'struct': 'InetSocketAddressWrapper',
143  'data': { 'data': 'InetSocketAddress' } }
144
145##
146# @UnixSocketAddressWrapper:
147#
148# @data: UNIX domain socket address
149#
150# Since: 1.3
151##
152{ 'struct': 'UnixSocketAddressWrapper',
153  'data': { 'data': 'UnixSocketAddress' } }
154
155##
156# @VsockSocketAddressWrapper:
157#
158# @data: VSOCK domain socket address
159#
160# Since: 2.8
161##
162{ 'struct': 'VsockSocketAddressWrapper',
163  'data': { 'data': 'VsockSocketAddress' } }
164
165##
166# @FdSocketAddressWrapper:
167#
168# @data: file descriptor name or number
169#
170# Since: 1.3
171##
172{ 'struct': 'FdSocketAddressWrapper',
173  'data': { 'data': 'FdSocketAddress' } }
174
175##
176# @SocketAddressLegacy:
177#
178# Captures the address of a socket, which could also be a named file
179# descriptor
180#
181# @type: Transport type
182#
183# Since: 1.3
184##
185{ 'union': 'SocketAddressLegacy',
186  'base': { 'type': 'SocketAddressType' },
187  'discriminator': 'type',
188  'data': {
189    'inet': 'InetSocketAddressWrapper',
190    'unix': 'UnixSocketAddressWrapper',
191    'vsock': 'VsockSocketAddressWrapper',
192    'fd': 'FdSocketAddressWrapper' } }
193# Note: This type is deprecated in favor of SocketAddress.  The
194# difference between SocketAddressLegacy and SocketAddress is that the
195# latter has fewer ``{}`` on the wire.
196
197##
198# @SocketAddressType:
199#
200# Available SocketAddress types
201#
202# @inet: Internet address
203#
204# @unix: Unix domain socket
205#
206# @vsock: VMCI address
207#
208# @fd: Socket file descriptor
209#
210# Since: 2.9
211##
212{ 'enum': 'SocketAddressType',
213  'data': [ 'inet', 'unix', 'vsock', 'fd' ] }
214
215##
216# @SocketAddress:
217#
218# Captures the address of a socket, which could also be a socket file
219# descriptor
220#
221# @type: Transport type
222#
223# Since: 2.9
224##
225{ 'union': 'SocketAddress',
226  'base': { 'type': 'SocketAddressType' },
227  'discriminator': 'type',
228  'data': { 'inet': 'InetSocketAddress',
229            'unix': 'UnixSocketAddress',
230            'vsock': 'VsockSocketAddress',
231            'fd': 'FdSocketAddress' } }
232