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