xref: /openbmc/qemu/qapi/sockets.json (revision 40f23e4e)
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 namespace.
45#
46# @numeric: true if the host/port are guaranteed to be numeric,
47#           false 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 IPv6
54#
55# @ipv6: whether to accept IPv6 addresses, default try both IPv4 and IPv6
56#
57# @keep-alive: enable keep-alive when connecting to this socket. Not supported
58#              for passive sockets. (Since 4.2)
59#
60# @mptcp: enable multi-path TCP. (Since 6.1)
61#
62# Since: 1.3
63##
64{ 'struct': 'InetSocketAddress',
65  'base': 'InetSocketAddressBase',
66  'data': {
67    '*numeric':  'bool',
68    '*to': 'uint16',
69    '*ipv4': 'bool',
70    '*ipv6': 'bool',
71    '*keep-alive': 'bool',
72    '*mptcp': { 'type': 'bool', 'if': 'defined(IPPROTO_MPTCP)' } } }
73
74##
75# @UnixSocketAddress:
76#
77# Captures a socket address in the local ("Unix socket") namespace.
78#
79# @path: filesystem path to use
80# @abstract: if true, this is a Linux abstract socket address.  @path
81#            will be prefixed by a null byte, and optionally padded
82#            with null bytes.  Defaults to false.  (Since 5.1)
83# @tight: if false, pad an abstract socket address with enough null
84#         bytes to make it fill struct sockaddr_un member sun_path.
85#         Defaults to true.  (Since 5.1)
86#
87# Since: 1.3
88##
89{ 'struct': 'UnixSocketAddress',
90  'data': {
91    'path': 'str',
92    '*abstract': { 'type': 'bool', 'if': 'defined(CONFIG_LINUX)' },
93    '*tight': { 'type': 'bool', 'if': 'defined(CONFIG_LINUX)' } } }
94
95##
96# @VsockSocketAddress:
97#
98# Captures a socket address in the vsock namespace.
99#
100# @cid: unique host identifier
101# @port: port
102#
103# Note: string types are used to allow for possible future hostname or
104#       service resolution support.
105#
106# Since: 2.8
107##
108{ 'struct': 'VsockSocketAddress',
109  'data': {
110    'cid': 'str',
111    'port': 'str' } }
112
113##
114# @SocketAddressLegacy:
115#
116# Captures the address of a socket, which could also be a named file descriptor
117#
118# Note: This type is deprecated in favor of SocketAddress.  The
119#       difference between SocketAddressLegacy and SocketAddress is that the
120#       latter is a flat union rather than a simple union. Flat is nicer
121#       because it avoids nesting on the wire, i.e. that form has fewer {}.
122
123#
124# Since: 1.3
125##
126{ 'union': 'SocketAddressLegacy',
127  'data': {
128    'inet': 'InetSocketAddress',
129    'unix': 'UnixSocketAddress',
130    'vsock': 'VsockSocketAddress',
131    'fd': 'String' } }
132
133##
134# @SocketAddressType:
135#
136# Available SocketAddress types
137#
138# @inet:  Internet address
139#
140# @unix:  Unix domain socket
141#
142# @vsock: VMCI address
143#
144# @fd: decimal is for file descriptor number, otherwise a file descriptor name.
145#      Named file descriptors are permitted in monitor commands, in combination
146#      with the 'getfd' command. Decimal file descriptors are permitted at
147#      startup or other contexts where no monitor context is active.
148#
149# Since: 2.9
150##
151{ 'enum': 'SocketAddressType',
152  'data': [ 'inet', 'unix', 'vsock', 'fd' ] }
153
154##
155# @SocketAddress:
156#
157# Captures the address of a socket, which could also be a named file
158# descriptor
159#
160# @type:       Transport type
161#
162# Since: 2.9
163##
164{ 'union': 'SocketAddress',
165  'base': { 'type': 'SocketAddressType' },
166  'discriminator': 'type',
167  'data': { 'inet': 'InetSocketAddress',
168            'unix': 'UnixSocketAddress',
169            'vsock': 'VsockSocketAddress',
170            'fd': 'String' } }
171