xref: /openbmc/qemu/qapi/sockets.json (revision 33a24910)
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# @port: port part of the address
33##
34{ 'struct': 'InetSocketAddressBase',
35  'data': {
36    'host': 'str',
37    'port': 'str' } }
38
39##
40# @InetSocketAddress:
41#
42# Captures a socket address or address range in the Internet
43# namespace.
44#
45# @numeric: true if the host/port are guaranteed to be numeric, false
46#     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
53#     IPv6
54#
55# @ipv6: whether to accept IPv6 addresses, default try both IPv4 and
56#     IPv6
57#
58# @keep-alive: enable keep-alive when connecting to this socket.  Not
59#     supported for passive sockets.  (Since 4.2)
60#
61# @mptcp: enable multi-path TCP. (Since 6.1)
62#
63# Since: 1.3
64##
65{ 'struct': 'InetSocketAddress',
66  'base': 'InetSocketAddressBase',
67  'data': {
68    '*numeric':  'bool',
69    '*to': 'uint16',
70    '*ipv4': 'bool',
71    '*ipv6': 'bool',
72    '*keep-alive': 'bool',
73    '*mptcp': { 'type': 'bool', 'if': 'HAVE_IPPROTO_MPTCP' } } }
74
75##
76# @UnixSocketAddress:
77#
78# Captures a socket address in the local ("Unix socket") namespace.
79#
80# @path: filesystem path to use
81#
82# @abstract: if true, this is a Linux abstract socket address.  @path
83#     will be prefixed by a null byte, and optionally padded with null
84#     bytes.  Defaults to false.  (Since 5.1)
85#
86# @tight: if false, pad an abstract socket address with enough null
87#     bytes to make it fill struct sockaddr_un member sun_path.
88#     Defaults to true.  (Since 5.1)
89#
90# Since: 1.3
91##
92{ 'struct': 'UnixSocketAddress',
93  'data': {
94    'path': 'str',
95    '*abstract': { 'type': 'bool', 'if': 'CONFIG_LINUX' },
96    '*tight': { 'type': 'bool', 'if': 'CONFIG_LINUX' } } }
97
98##
99# @VsockSocketAddress:
100#
101# Captures a socket address in the vsock namespace.
102#
103# @cid: unique host identifier
104#
105# @port: port
106#
107# Note: string types are used to allow for possible future hostname or
108#     service resolution support.
109#
110# Since: 2.8
111##
112{ 'struct': 'VsockSocketAddress',
113  'data': {
114    'cid': 'str',
115    'port': 'str' } }
116
117##
118# @FdSocketAddress:
119#
120# A file descriptor name or number.
121#
122# @str: decimal is for file descriptor number, otherwise it's a file
123#     descriptor name.  Named file descriptors are permitted in
124#     monitor commands, in combination with the 'getfd' command.
125#     Decimal file descriptors are permitted at startup or other
126#     contexts where no monitor context is active.
127#
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# Note: This type is deprecated in favor of SocketAddress.  The
184#     difference between SocketAddressLegacy and SocketAddress is that
185#     the latter has fewer {} on the wire.
186#
187# Since: 1.3
188##
189{ 'union': 'SocketAddressLegacy',
190  'base': { 'type': 'SocketAddressType' },
191  'discriminator': 'type',
192  'data': {
193    'inet': 'InetSocketAddressWrapper',
194    'unix': 'UnixSocketAddressWrapper',
195    'vsock': 'VsockSocketAddressWrapper',
196    'fd': 'FdSocketAddressWrapper' } }
197
198##
199# @SocketAddressType:
200#
201# Available SocketAddress types
202#
203# @inet: Internet address
204#
205# @unix: Unix domain socket
206#
207# @vsock: VMCI address
208#
209# @fd: Socket file descriptor
210#
211# Since: 2.9
212##
213{ 'enum': 'SocketAddressType',
214  'data': [ 'inet', 'unix', 'vsock', 'fd' ] }
215
216##
217# @SocketAddress:
218#
219# Captures the address of a socket, which could also be a socket file
220# descriptor
221#
222# @type: Transport type
223#
224# Since: 2.9
225##
226{ 'union': 'SocketAddress',
227  'base': { 'type': 'SocketAddressType' },
228  'discriminator': 'type',
229  'data': { 'inet': 'InetSocketAddress',
230            'unix': 'UnixSocketAddress',
231            'vsock': 'VsockSocketAddress',
232            'fd': 'FdSocketAddress' } }
233