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