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