| 1 | # -*- Mode: Python -*- |
| 2 | # vim: filetype=python |
| 3 | |
| 4 | ## |
| 5 | # ***************** |
| 6 | # Socket data types |
| 7 | # ***************** |
| 8 | ## |
| 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 | # |
| 35 | # @port: port part of the address |
| 36 | ## |
| 37 | { 'struct': 'InetSocketAddressBase', |
| 38 | 'data': { |
| 39 | 'host': 'str', |
| 40 | 'port': 'str' } } |
| 41 | |
| 42 | ## |
| 43 | # @InetSocketAddress: |
| 44 | # |
| 45 | # Captures a socket address or address range in the Internet |
| 46 | # namespace. |
| 47 | # |
| 48 | # @numeric: true if the host/port are guaranteed to be numeric, false |
| 49 | # if name resolution should be attempted. Defaults to false. |
| 50 | # (Since 2.9) |
| 51 | # |
| 52 | # @to: If present, this is range of possible addresses, with port |
| 53 | # between @port and @to. |
| 54 | # |
| 55 | # @ipv4: whether to accept IPv4 addresses, default try both IPv4 and |
| 56 | # IPv6 |
| 57 | # |
| 58 | # @ipv6: whether to accept IPv6 addresses, default try both IPv4 and |
| 59 | # IPv6 |
| 60 | # |
| 61 | # @keep-alive: enable keep-alive when connecting to/listening on this |
| 62 | # socket. |
| 63 | # (Since 4.2, not supported for listening sockets until 10.1) |
| 64 | # |
| 65 | # @keep-alive-count: number of keep-alive packets sent before the |
| 66 | # connection is closed. Only supported for TCP sockets on systems |
| 67 | # where TCP_KEEPCNT socket option is defined (this includes Linux, |
| 68 | # Windows, macOS, FreeBSD, but not OpenBSD). When set to 0, |
| 69 | # system setting is used. (Since 10.1) |
| 70 | # |
| 71 | # @keep-alive-idle: time in seconds the connection needs to be idle |
| 72 | # before sending a keepalive packet. Only supported for TCP |
| 73 | # sockets on systems where TCP_KEEPIDLE socket option is defined |
| 74 | # (this includes Linux, Windows, macOS, FreeBSD, but not OpenBSD). |
| 75 | # When set to 0, system setting is used. (Since 10.1) |
| 76 | # |
| 77 | # @keep-alive-interval: time in seconds between keep-alive packets. |
| 78 | # Only supported for TCP sockets on systems where TCP_KEEPINTVL is |
| 79 | # defined (this includes Linux, Windows, macOS, FreeBSD, but not |
| 80 | # OpenBSD). When set to 0, system setting is used. (Since 10.1) |
| 81 | # |
| 82 | # @mptcp: enable multi-path TCP. (Since 6.1) |
| 83 | # |
| 84 | # Since: 1.3 |
| 85 | ## |
| 86 | { 'struct': 'InetSocketAddress', |
| 87 | 'base': 'InetSocketAddressBase', |
| 88 | 'data': { |
| 89 | '*numeric': 'bool', |
| 90 | '*to': 'uint16', |
| 91 | '*ipv4': 'bool', |
| 92 | '*ipv6': 'bool', |
| 93 | '*keep-alive': 'bool', |
| 94 | '*keep-alive-count': { 'type': 'uint32', 'if': 'HAVE_TCP_KEEPCNT' }, |
| 95 | '*keep-alive-idle': { 'type': 'uint32', 'if': 'HAVE_TCP_KEEPIDLE' }, |
| 96 | '*keep-alive-interval': { 'type': 'uint32', 'if': 'HAVE_TCP_KEEPINTVL' }, |
| 97 | '*mptcp': { 'type': 'bool', 'if': 'HAVE_IPPROTO_MPTCP' } } } |
| 98 | |
| 99 | ## |
| 100 | # @UnixSocketAddress: |
| 101 | # |
| 102 | # Captures a socket address in the local ("Unix socket") namespace. |
| 103 | # |
| 104 | # @path: filesystem path to use |
| 105 | # |
| 106 | # @abstract: if true, this is a Linux abstract socket address. @path |
| 107 | # will be prefixed by a null byte, and optionally padded with null |
| 108 | # bytes. Defaults to false. (Since 5.1) |
| 109 | # |
| 110 | # @tight: if false, pad an abstract socket address with enough null |
| 111 | # bytes to make it fill struct sockaddr_un member sun_path. |
| 112 | # Defaults to true. (Since 5.1) |
| 113 | # |
| 114 | # Since: 1.3 |
| 115 | ## |
| 116 | { 'struct': 'UnixSocketAddress', |
| 117 | 'data': { |
| 118 | 'path': 'str', |
| 119 | '*abstract': { 'type': 'bool', 'if': 'CONFIG_LINUX' }, |
| 120 | '*tight': { 'type': 'bool', 'if': 'CONFIG_LINUX' } } } |
| 121 | |
| 122 | ## |
| 123 | # @VsockSocketAddress: |
| 124 | # |
| 125 | # Captures a socket address in the vsock namespace. |
| 126 | # |
| 127 | # @cid: unique host identifier |
| 128 | # |
| 129 | # @port: port |
| 130 | # |
| 131 | # .. note:: String types are used to allow for possible future |
| 132 | # hostname or service resolution support. |
| 133 | # |
| 134 | # Since: 2.8 |
| 135 | ## |
| 136 | { 'struct': 'VsockSocketAddress', |
| 137 | 'data': { |
| 138 | 'cid': 'str', |
| 139 | 'port': 'str' } } |
| 140 | |
| 141 | ## |
| 142 | # @FdSocketAddress: |
| 143 | # |
| 144 | # A file descriptor name or number. |
| 145 | # |
| 146 | # @str: decimal is for file descriptor number, otherwise it's a file |
| 147 | # descriptor name. Named file descriptors are permitted in |
| 148 | # monitor commands, in combination with the `getfd` command. |
| 149 | # Decimal file descriptors are permitted at startup or other |
| 150 | # contexts where no monitor context is active. |
| 151 | # |
| 152 | # Since: 1.2 |
| 153 | ## |
| 154 | { 'struct': 'FdSocketAddress', |
| 155 | 'data': { |
| 156 | 'str': 'str' } } |
| 157 | |
| 158 | ## |
| 159 | # @InetSocketAddressWrapper: |
| 160 | # |
| 161 | # @data: internet domain socket address |
| 162 | # |
| 163 | # Since: 1.3 |
| 164 | ## |
| 165 | { 'struct': 'InetSocketAddressWrapper', |
| 166 | 'data': { 'data': 'InetSocketAddress' } } |
| 167 | |
| 168 | ## |
| 169 | # @UnixSocketAddressWrapper: |
| 170 | # |
| 171 | # @data: UNIX domain socket address |
| 172 | # |
| 173 | # Since: 1.3 |
| 174 | ## |
| 175 | { 'struct': 'UnixSocketAddressWrapper', |
| 176 | 'data': { 'data': 'UnixSocketAddress' } } |
| 177 | |
| 178 | ## |
| 179 | # @VsockSocketAddressWrapper: |
| 180 | # |
| 181 | # @data: VSOCK domain socket address |
| 182 | # |
| 183 | # Since: 2.8 |
| 184 | ## |
| 185 | { 'struct': 'VsockSocketAddressWrapper', |
| 186 | 'data': { 'data': 'VsockSocketAddress' } } |
| 187 | |
| 188 | ## |
| 189 | # @FdSocketAddressWrapper: |
| 190 | # |
| 191 | # @data: file descriptor name or number |
| 192 | # |
| 193 | # Since: 1.3 |
| 194 | ## |
| 195 | { 'struct': 'FdSocketAddressWrapper', |
| 196 | 'data': { 'data': 'FdSocketAddress' } } |
| 197 | |
| 198 | ## |
| 199 | # @SocketAddressLegacy: |
| 200 | # |
| 201 | # Captures the address of a socket, which could also be a named file |
| 202 | # descriptor |
| 203 | # |
| 204 | # @type: Transport type |
| 205 | # |
| 206 | # Since: 1.3 |
| 207 | ## |
| 208 | { 'union': 'SocketAddressLegacy', |
| 209 | 'base': { 'type': 'SocketAddressType' }, |
| 210 | 'discriminator': 'type', |
| 211 | 'data': { |
| 212 | 'inet': 'InetSocketAddressWrapper', |
| 213 | 'unix': 'UnixSocketAddressWrapper', |
| 214 | 'vsock': 'VsockSocketAddressWrapper', |
| 215 | 'fd': 'FdSocketAddressWrapper' } } |
| 216 | # Note: This type is deprecated in favor of `SocketAddress`. The |
| 217 | # difference between `SocketAddressLegacy` and `SocketAddress` is that the |
| 218 | # latter has fewer ``{}`` on the wire. |
| 219 | |
| 220 | ## |
| 221 | # @SocketAddressType: |
| 222 | # |
| 223 | # Available `SocketAddress` types |
| 224 | # |
| 225 | # @inet: Internet address |
| 226 | # |
| 227 | # @unix: Unix domain socket |
| 228 | # |
| 229 | # @vsock: VMCI address |
| 230 | # |
| 231 | # @fd: Socket file descriptor |
| 232 | # |
| 233 | # Since: 2.9 |
| 234 | ## |
| 235 | { 'enum': 'SocketAddressType', |
| 236 | 'data': [ 'inet', 'unix', 'vsock', 'fd' ] } |
| 237 | |
| 238 | ## |
| 239 | # @SocketAddress: |
| 240 | # |
| 241 | # Captures the address of a socket, which could also be a socket file |
| 242 | # descriptor |
| 243 | # |
| 244 | # @type: Transport type |
| 245 | # |
| 246 | # Since: 2.9 |
| 247 | ## |
| 248 | { 'union': 'SocketAddress', |
| 249 | 'base': { 'type': 'SocketAddressType' }, |
| 250 | 'discriminator': 'type', |
| 251 | 'data': { 'inet': 'InetSocketAddress', |
| 252 | 'unix': 'UnixSocketAddress', |
| 253 | 'vsock': 'VsockSocketAddress', |
| 254 | 'fd': 'FdSocketAddress' } } |