Merge tag 'pull-loongarch-20240912' of https://gitlab.com/gaosong/qemu into staging
[qemu/kevin.git] / qapi / sockets.json
blob6a950233158605853dabf7f7f9138c34ca1f2bf0
1 # -*- Mode: Python -*-
2 # vim: filetype=python
4 ##
5 # = Socket data types
6 ##
8 ##
9 # @NetworkAddressFamily:
11 # The network address family
13 # @ipv4: IPV4 family
15 # @ipv6: IPV6 family
17 # @unix: unix socket
19 # @vsock: vsock family (since 2.8)
21 # @unknown: otherwise
23 # Since: 2.1
25 { 'enum': 'NetworkAddressFamily',
26   'data': [ 'ipv4', 'ipv6', 'unix', 'vsock', 'unknown' ] }
29 # @InetSocketAddressBase:
31 # @host: host part of the address
33 # @port: port part of the address
35 { 'struct': 'InetSocketAddressBase',
36   'data': {
37     'host': 'str',
38     'port': 'str' } }
41 # @InetSocketAddress:
43 # Captures a socket address or address range in the Internet
44 # namespace.
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)
50 # @to: If present, this is range of possible addresses, with port
51 #     between @port and @to.
53 # @ipv4: whether to accept IPv4 addresses, default try both IPv4 and
54 #     IPv6
56 # @ipv6: whether to accept IPv6 addresses, default try both IPv4 and
57 #     IPv6
59 # @keep-alive: enable keep-alive when connecting to this socket.  Not
60 #     supported for passive sockets.  (Since 4.2)
62 # @mptcp: enable multi-path TCP.  (Since 6.1)
64 # Since: 1.3
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' } } }
77 # @UnixSocketAddress:
79 # Captures a socket address in the local ("Unix socket") namespace.
81 # @path: filesystem path to use
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)
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)
91 # Since: 1.3
93 { 'struct': 'UnixSocketAddress',
94   'data': {
95     'path': 'str',
96     '*abstract': { 'type': 'bool', 'if': 'CONFIG_LINUX' },
97     '*tight': { 'type': 'bool', 'if': 'CONFIG_LINUX' } } }
100 # @VsockSocketAddress:
102 # Captures a socket address in the vsock namespace.
104 # @cid: unique host identifier
106 # @port: port
108 # .. note:: String types are used to allow for possible future
109 #    hostname or service resolution support.
111 # Since: 2.8
113 { 'struct': 'VsockSocketAddress',
114   'data': {
115     'cid': 'str',
116     'port': 'str' } }
119 # @FdSocketAddress:
121 # A file descriptor name or number.
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.
129 # Since: 1.2
131 { 'struct': 'FdSocketAddress',
132   'data': {
133     'str': 'str' } }
136 # @InetSocketAddressWrapper:
138 # @data: internet domain socket address
140 # Since: 1.3
142 { 'struct': 'InetSocketAddressWrapper',
143   'data': { 'data': 'InetSocketAddress' } }
146 # @UnixSocketAddressWrapper:
148 # @data: UNIX domain socket address
150 # Since: 1.3
152 { 'struct': 'UnixSocketAddressWrapper',
153   'data': { 'data': 'UnixSocketAddress' } }
156 # @VsockSocketAddressWrapper:
158 # @data: VSOCK domain socket address
160 # Since: 2.8
162 { 'struct': 'VsockSocketAddressWrapper',
163   'data': { 'data': 'VsockSocketAddress' } }
166 # @FdSocketAddressWrapper:
168 # @data: file descriptor name or number
170 # Since: 1.3
172 { 'struct': 'FdSocketAddressWrapper',
173   'data': { 'data': 'FdSocketAddress' } }
176 # @SocketAddressLegacy:
178 # Captures the address of a socket, which could also be a named file
179 # descriptor
181 # @type: Transport type
183 # Since: 1.3
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.
198 # @SocketAddressType:
200 # Available SocketAddress types
202 # @inet: Internet address
204 # @unix: Unix domain socket
206 # @vsock: VMCI address
208 # @fd: Socket file descriptor
210 # Since: 2.9
212 { 'enum': 'SocketAddressType',
213   'data': [ 'inet', 'unix', 'vsock', 'fd' ] }
216 # @SocketAddress:
218 # Captures the address of a socket, which could also be a socket file
219 # descriptor
221 # @type: Transport type
223 # Since: 2.9
225 { 'union': 'SocketAddress',
226   'base': { 'type': 'SocketAddressType' },
227   'discriminator': 'type',
228   'data': { 'inet': 'InetSocketAddress',
229             'unix': 'UnixSocketAddress',
230             'vsock': 'VsockSocketAddress',
231             'fd': 'FdSocketAddress' } }