xref: /openbmc/qemu/qapi/net.json (revision 0d70c5aa1bbfb0f5099d53d6e084337a8246cc0c)
1# -*- Mode: Python -*-
2# vim: filetype=python
3#
4
5##
6# ***********
7# Net devices
8# ***********
9##
10
11{ 'include': 'sockets.json' }
12
13##
14# @set_link:
15#
16# Sets the link status of a virtual network adapter.
17#
18# @name: the device name of the virtual network adapter
19#
20# @up: true to set the link status to be up
21#
22# Errors:
23#     - If @name is not a valid network device, DeviceNotFound
24#
25# Since: 0.14
26#
27# .. note:: Not all network adapters support setting link status.
28#    This command will succeed even if the network adapter does not
29#    support link status notification.
30#
31# .. qmp-example::
32#
33#     -> { "execute": "set_link",
34#          "arguments": { "name": "e1000.0", "up": false } }
35#     <- { "return": {} }
36##
37{ 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} }
38
39##
40# @netdev_add:
41#
42# Add a network backend.
43#
44# Additional arguments depend on the type.
45#
46# Since: 0.14
47#
48# Errors:
49#     - If @type is not a valid network backend, DeviceNotFound
50#
51# .. qmp-example::
52#
53#     -> { "execute": "netdev_add",
54#          "arguments": { "type": "user", "id": "netdev1",
55#                         "dnssearch": [ { "str": "example.org" } ] } }
56#     <- { "return": {} }
57##
58{ 'command': 'netdev_add', 'data': 'Netdev', 'boxed': true,
59  'allow-preconfig': true }
60
61##
62# @netdev_del:
63#
64# Remove a network backend.
65#
66# @id: the name of the network backend to remove
67#
68# Errors:
69#     - If @id is not a valid network backend, DeviceNotFound
70#
71# Since: 0.14
72#
73# .. qmp-example::
74#
75#     -> { "execute": "netdev_del", "arguments": { "id": "netdev1" } }
76#     <- { "return": {} }
77##
78{ 'command': 'netdev_del', 'data': {'id': 'str'},
79  'allow-preconfig': true }
80
81##
82# @NetLegacyNicOptions:
83#
84# Create a new Network Interface Card.
85#
86# @netdev: id of -netdev to connect to
87#
88# @macaddr: MAC address
89#
90# @model: device model (e1000, rtl8139, virtio etc.)
91#
92# @addr: PCI device address
93#
94# @vectors: number of MSI-x vectors, 0 to disable MSI-X
95#
96# Since: 1.2
97##
98{ 'struct': 'NetLegacyNicOptions',
99  'data': {
100    '*netdev':  'str',
101    '*macaddr': 'str',
102    '*model':   'str',
103    '*addr':    'str',
104    '*vectors': 'uint32' } }
105
106##
107# @String:
108#
109# A fat type wrapping 'str', to be embedded in lists.
110#
111# Since: 1.2
112##
113{ 'struct': 'String',
114  'data': {
115    'str': 'str' } }
116
117##
118# @NetDevPasstOptions:
119#
120# Unprivileged user-mode network connectivity using passt
121#
122# @path: Filename of the passt program to run (by default 'passt', and use PATH)
123#
124# @quiet: don't print informational messages (default, passed as '--quiet')
125#
126# @vhost-user: enable vhost-user
127#
128# @mtu: assign MTU via DHCP/NDP
129#
130# @address: IPv4 or IPv6 address
131#
132# @netmask: IPv4 mask
133#
134# @mac: source MAC address
135#
136# @gateway: IPv4 or IPv6 address as gateway
137#
138# @interface: interface for addresses and routes
139#
140# @outbound: bind to address as outbound source
141#
142# @outbound-if4: bind to outbound interface for IPv4
143#
144# @outbound-if6: bind to outbound interface for IPv6
145#
146# @dns: IPv4 or IPv6 address as DNS
147#
148# @search: search domains
149#
150# @fqdn: FQDN to configure client with
151#
152# @dhcp-dns: enable/disable DNS list in DHCP/DHCPv6/NDP
153#
154# @dhcp-search: enable/disable list in DHCP/DHCPv6/NDP
155#
156# @map-host-loopback: addresse to refer to host
157#
158# @map-guest-addr: addr to translate to guest's address
159#
160# @dns-forward: forward DNS queries sent to
161#
162# @dns-host: host nameserver to direct queries to
163#
164# @tcp: enable/disable TCP
165#
166# @udp: enable/disable UDP
167#
168# @icmp: enable/disable ICMP
169#
170# @dhcp: enable/disable DHCP
171#
172# @ndp: enable/disable NDP
173#
174# @dhcpv6: enable/disable DHCPv6
175#
176# @ra: enable/disable route advertisements
177#
178# @freebind: bind to any address for forwarding
179#
180# @ipv4: enable/disable IPv4
181#
182# @ipv6: enable/disable IPv6
183#
184# @tcp-ports: TCP ports to forward
185#
186# @udp-ports: UDP ports to forward
187#
188# @param: parameter to pass to passt command
189#
190# Since: 10.1
191##
192{ 'struct': 'NetDevPasstOptions',
193  'data': {
194    '*path':               'str',
195    '*quiet':              'bool',
196    '*vhost-user':         'bool',
197    '*mtu':                'int',
198    '*address':            'str',
199    '*netmask':            'str',
200    '*mac':                'str',
201    '*gateway':            'str',
202    '*interface':          'str',
203    '*outbound':           'str',
204    '*outbound-if4':       'str',
205    '*outbound-if6':       'str',
206    '*dns':                'str',
207    '*search':             ['String'],
208    '*fqdn':               'str',
209    '*dhcp-dns':           'bool',
210    '*dhcp-search':        'bool',
211    '*map-host-loopback':  'str',
212    '*map-guest-addr':     'str',
213    '*dns-forward':        'str',
214    '*dns-host':           'str',
215    '*tcp':                'bool',
216    '*udp':                'bool',
217    '*icmp':               'bool',
218    '*dhcp':               'bool',
219    '*ndp':                'bool',
220    '*dhcpv6':             'bool',
221    '*ra':                 'bool',
222    '*freebind':           'bool',
223    '*ipv4':               'bool',
224    '*ipv6':               'bool',
225    '*tcp-ports':          ['String'],
226    '*udp-ports':          ['String'],
227    '*param':             ['String'] },
228    'if': 'CONFIG_PASST' }
229
230##
231# @NetdevUserOptions:
232#
233# Use the user mode network stack which requires no administrator
234# privilege to run.
235#
236# @hostname: client hostname reported by the builtin DHCP server
237#
238# @restrict: isolate the guest from the host
239#
240# @ipv4: whether to support IPv4, default true for enabled (since 2.6)
241#
242# @ipv6: whether to support IPv6, default true for enabled (since 2.6)
243#
244# @ip: legacy parameter, use net= instead
245#
246# @net: IP network address that the guest will see, in the form
247#     addr[/netmask] The netmask is optional, and can be either in the
248#     form a.b.c.d or as a number of valid top-most bits.  Default is
249#     10.0.2.0/24.
250#
251# @host: guest-visible address of the host
252#
253# @tftp: root directory of the built-in TFTP server
254#
255# @bootfile: BOOTP filename, for use with tftp=
256#
257# @dhcpstart: the first of the 16 IPs the built-in DHCP server can
258#     assign
259#
260# @dns: guest-visible address of the virtual nameserver
261#
262# @dnssearch: list of DNS suffixes to search, passed as DHCP option to
263#     the guest
264#
265# @domainname: guest-visible domain name of the virtual nameserver
266#     (since 3.0)
267#
268# @ipv6-prefix: IPv6 network prefix (default is fec0::).  The network
269#     prefix is given in the usual hexadecimal IPv6 address notation.
270#     (since 2.6)
271#
272# @ipv6-prefixlen: IPv6 network prefix length (default is 64)
273#     (since 2.6)
274#
275# @ipv6-host: guest-visible IPv6 address of the host (since 2.6)
276#
277# @ipv6-dns: guest-visible IPv6 address of the virtual nameserver
278#     (since 2.6)
279#
280# @smb: root directory of the built-in SMB server
281#
282# @smbserver: IP address of the built-in SMB server
283#
284# @hostfwd: redirect incoming TCP or UDP host connections to guest
285#     endpoints
286#
287# @guestfwd: forward guest TCP connections
288#
289# @tftp-server-name: RFC2132 "TFTP server name" string (Since 3.1)
290#
291# Since: 1.2
292##
293{ 'struct': 'NetdevUserOptions',
294  'data': {
295    '*hostname':  'str',
296    '*restrict':  'bool',
297    '*ipv4':      'bool',
298    '*ipv6':      'bool',
299    '*ip':        'str',
300    '*net':       'str',
301    '*host':      'str',
302    '*tftp':      'str',
303    '*bootfile':  'str',
304    '*dhcpstart': 'str',
305    '*dns':       'str',
306    '*dnssearch': ['String'],
307    '*domainname': 'str',
308    '*ipv6-prefix':      'str',
309    '*ipv6-prefixlen':   'int',
310    '*ipv6-host':        'str',
311    '*ipv6-dns':         'str',
312    '*smb':       'str',
313    '*smbserver': 'str',
314    '*hostfwd':   ['String'],
315    '*guestfwd':  ['String'],
316    '*tftp-server-name': 'str' } }
317
318##
319# @NetdevTapOptions:
320#
321# Used to configure a host TAP network interface backend.
322#
323# @ifname: interface name
324#
325# @fd: file descriptor of an already opened tap
326#
327# @fds: multiple file descriptors of already opened multiqueue capable
328#     tap
329#
330# @script: script to initialize the interface
331#
332# @downscript: script to shut down the interface
333#
334# @br: bridge name (since 2.8)
335#
336# @helper: command to execute to configure bridge
337#
338# @sndbuf: send buffer limit.  Understands [TGMKkb] suffixes.
339#
340# @vnet_hdr: enable the IFF_VNET_HDR flag on the tap interface
341#
342# @vhost: enable vhost-net network accelerator
343#
344# @vhostfd: file descriptor of an already opened vhost net device
345#
346# @vhostfds: file descriptors of multiple already opened vhost net
347#     devices
348#
349# @vhostforce: vhost on for non-MSIX virtio guests
350#
351# @queues: number of queues to be created for multiqueue capable tap
352#
353# @poll-us: maximum number of microseconds that could be spent on busy
354#     polling for tap (since 2.7)
355#
356# Since: 1.2
357##
358{ 'struct': 'NetdevTapOptions',
359  'data': {
360    '*ifname':     'str',
361    '*fd':         'str',
362    '*fds':        'str',
363    '*script':     'str',
364    '*downscript': 'str',
365    '*br':         'str',
366    '*helper':     'str',
367    '*sndbuf':     'size',
368    '*vnet_hdr':   'bool',
369    '*vhost':      'bool',
370    '*vhostfd':    'str',
371    '*vhostfds':   'str',
372    '*vhostforce': 'bool',
373    '*queues':     'uint32',
374    '*poll-us':    'uint32'} }
375
376##
377# @NetdevSocketOptions:
378#
379# Socket netdevs are used to establish a network connection to another
380# QEMU virtual machine via a TCP socket.
381#
382# @fd: file descriptor of an already opened socket
383#
384# @listen: port number, and optional hostname, to listen on
385#
386# @connect: port number, and optional hostname, to connect to
387#
388# @mcast: UDP multicast address and port number
389#
390# @localaddr: source address and port for multicast and udp packets
391#
392# @udp: UDP unicast address and port number
393#
394# Since: 1.2
395##
396{ 'struct': 'NetdevSocketOptions',
397  'data': {
398    '*fd':        'str',
399    '*listen':    'str',
400    '*connect':   'str',
401    '*mcast':     'str',
402    '*localaddr': 'str',
403    '*udp':       'str' } }
404
405##
406# @NetdevL2TPv3Options:
407#
408# Configure an Ethernet over L2TPv3 tunnel.
409#
410# @src: source address
411#
412# @dst: destination address
413#
414# @srcport: source port - mandatory for udp, optional for ip
415#
416# @dstport: destination port - mandatory for udp, optional for ip
417#
418# @ipv6: force the use of ipv6
419#
420# @udp: use the udp version of l2tpv3 encapsulation
421#
422# @cookie64: use 64 bit cookies
423#
424# @counter: have sequence counter
425#
426# @pincounter: pin sequence counter to zero - workaround for buggy
427#     implementations or networks with packet reorder
428#
429# @txcookie: 32 or 64 bit transmit cookie
430#
431# @rxcookie: 32 or 64 bit receive cookie
432#
433# @txsession: 32 bit transmit session
434#
435# @rxsession: 32 bit receive session - if not specified set to the
436#     same value as transmit
437#
438# @offset: additional offset - allows the insertion of additional
439#     application-specific data before the packet payload
440#
441# Since: 2.1
442##
443{ 'struct': 'NetdevL2TPv3Options',
444  'data': {
445    'src':          'str',
446    'dst':          'str',
447    '*srcport':     'str',
448    '*dstport':     'str',
449    '*ipv6':        'bool',
450    '*udp':         'bool',
451    '*cookie64':    'bool',
452    '*counter':     'bool',
453    '*pincounter':  'bool',
454    '*txcookie':    'uint64',
455    '*rxcookie':    'uint64',
456    'txsession':    'uint32',
457    '*rxsession':   'uint32',
458    '*offset':      'uint32' } }
459
460##
461# @NetdevVdeOptions:
462#
463# Connect to a vde switch running on the host.
464#
465# @sock: socket path
466#
467# @port: port number
468#
469# @group: group owner of socket
470#
471# @mode: permissions for socket
472#
473# Since: 1.2
474##
475{ 'struct': 'NetdevVdeOptions',
476  'data': {
477    '*sock':  'str',
478    '*port':  'uint16',
479    '*group': 'str',
480    '*mode':  'uint16' } }
481
482##
483# @NetdevBridgeOptions:
484#
485# Connect a host TAP network interface to a host bridge device.
486#
487# @br: bridge name
488#
489# @helper: command to execute to configure bridge
490#
491# Since: 1.2
492##
493{ 'struct': 'NetdevBridgeOptions',
494  'data': {
495    '*br':     'str',
496    '*helper': 'str' } }
497
498##
499# @NetdevHubPortOptions:
500#
501# Connect two or more net clients through a software hub.
502#
503# @hubid: hub identifier number
504#
505# @netdev: used to connect hub to a netdev instead of a device
506#     (since 2.12)
507#
508# Since: 1.2
509##
510{ 'struct': 'NetdevHubPortOptions',
511  'data': {
512    'hubid':     'int32',
513    '*netdev':    'str' } }
514
515##
516# @NetdevNetmapOptions:
517#
518# Connect a client to a netmap-enabled NIC or to a VALE switch port
519#
520# @ifname: Either the name of an existing network interface supported
521#     by netmap, or the name of a VALE port (created on the fly).  A
522#     VALE port name is in the form 'valeXXX:YYY', where XXX and YYY
523#     are non-negative integers.  XXX identifies a switch and YYY
524#     identifies a port of the switch.  VALE ports having the same XXX
525#     are therefore connected to the same switch.
526#
527# @devname: path of the netmap device (default: '/dev/netmap').
528#
529# Since: 2.0
530##
531{ 'struct': 'NetdevNetmapOptions',
532  'data': {
533    'ifname':     'str',
534    '*devname':    'str' } }
535
536##
537# @AFXDPMode:
538#
539# Attach mode for a default XDP program
540#
541# @skb: generic mode, no driver support necessary
542#
543# @native: DRV mode, program is attached to a driver, packets are
544#     passed to the socket without allocation of skb.
545#
546# Since: 8.2
547##
548{ 'enum': 'AFXDPMode',
549  'data': [ 'native', 'skb' ],
550  'if': 'CONFIG_AF_XDP' }
551
552##
553# @NetdevAFXDPOptions:
554#
555# AF_XDP network backend
556#
557# @ifname: The name of an existing network interface.
558#
559# @mode: Attach mode for a default XDP program.  If not specified,
560#     then 'native' will be tried first, then 'skb'.
561#
562# @force-copy: Force XDP copy mode even if device supports zero-copy.
563#     (default: false)
564#
565# @queues: number of queues to be used for multiqueue interfaces
566#     (default: 1).
567#
568# @start-queue: Use @queues starting from this queue number
569#     (default: 0).
570#
571# @inhibit: Don't load a default XDP program, use one already loaded
572#     to the interface (default: false).  Requires @sock-fds or @map-path.
573#
574# @sock-fds: A colon (:) separated list of file descriptors for
575#     already open but not bound AF_XDP sockets in the queue order.
576#     One fd per queue.  These descriptors should already be added
577#     into XDP socket map for corresponding queues.  @sock-fds and
578#     @map-path are mutually exclusive.  Requires @inhibit.
579#
580# @map-path: The path to a pinned xsk map to push file descriptors
581#     for bound AF_XDP sockets into.  @map-path and @sock-fds are
582#     mutually exclusive.  Requires @inhibit.  (Since 10.1)
583#
584# @map-start-index: Use @map-path to insert xsk sockets starting from
585#     this index number (default: 0).  Requires @map-path.  (Since 10.1)
586#
587# Since: 8.2
588##
589{ 'struct': 'NetdevAFXDPOptions',
590  'data': {
591    'ifname':           'str',
592    '*mode':            'AFXDPMode',
593    '*force-copy':      'bool',
594    '*queues':          'int',
595    '*start-queue':     'int',
596    '*inhibit':         'bool',
597    '*sock-fds':        'str',
598    '*map-path':        'str',
599    '*map-start-index': 'int32' },
600  'if': 'CONFIG_AF_XDP' }
601
602##
603# @NetdevVhostUserOptions:
604#
605# Vhost-user network backend
606#
607# @chardev: name of a unix socket chardev
608#
609# @vhostforce: vhost on for non-MSIX virtio guests (default: false).
610#
611# @queues: number of queues to be created for multiqueue vhost-user
612#     (default: 1) (Since 2.5)
613#
614# Since: 2.1
615##
616{ 'struct': 'NetdevVhostUserOptions',
617  'data': {
618    'chardev':        'str',
619    '*vhostforce':    'bool',
620    '*queues':        'int' } }
621
622##
623# @NetdevVhostVDPAOptions:
624#
625# Vhost-vdpa network backend
626#
627# vDPA device is a device that uses a datapath which complies with the
628# virtio specifications with a vendor specific control path.
629#
630# @vhostdev: path of vhost-vdpa device (default:'/dev/vhost-vdpa-0')
631#
632# @vhostfd: file descriptor of an already opened vhost vdpa device
633#
634# @queues: number of queues to be created for multiqueue vhost-vdpa
635#     (default: 1)
636#
637# @x-svq: Start device with (experimental) shadow virtqueue.
638#     (Since 7.1) (default: false)
639#
640# Features:
641#
642# @unstable: Member @x-svq is experimental.
643#
644# Since: 5.1
645##
646{ 'struct': 'NetdevVhostVDPAOptions',
647  'data': {
648    '*vhostdev':     'str',
649    '*vhostfd':      'str',
650    '*queues':       'int',
651    '*x-svq':        {'type': 'bool', 'features' : [ 'unstable'] } } }
652
653##
654# @NetdevVmnetHostOptions:
655#
656# vmnet (host mode) network backend.
657#
658# Allows the vmnet interface to communicate with other vmnet
659# interfaces that are in host mode and also with the host.
660#
661# @start-address: The starting IPv4 address to use for the interface.
662#     Must be in the private IP range (RFC 1918).  Must be specified
663#     along with @end-address and @subnet-mask.  This address is used
664#     as the gateway address.  The subsequent address up to and
665#     including end-address are placed in the DHCP pool.
666#
667# @end-address: The DHCP IPv4 range end address to use for the
668#     interface.  Must be in the private IP range (RFC 1918).  Must be
669#     specified along with @start-address and @subnet-mask.
670#
671# @subnet-mask: The IPv4 subnet mask to use on the interface.  Must be
672#     specified along with @start-address and @subnet-mask.
673#
674# @isolated: Enable isolation for this interface.  Interface isolation
675#     ensures that vmnet interface is not able to communicate with any
676#     other vmnet interfaces.  Only communication with host is
677#     allowed.  Requires at least macOS Big Sur 11.0.
678#
679# @net-uuid: The identifier (UUID) to uniquely identify the isolated
680#     network vmnet interface should be added to.  If set, no DHCP
681#     service is provided for this interface and network communication
682#     is allowed only with other interfaces added to this network
683#     identified by the UUID.  Requires at least macOS Big Sur 11.0.
684#
685# Since: 7.1
686##
687{ 'struct': 'NetdevVmnetHostOptions',
688  'data': {
689    '*start-address': 'str',
690    '*end-address':   'str',
691    '*subnet-mask':   'str',
692    '*isolated':      'bool',
693    '*net-uuid':      'str' },
694  'if': 'CONFIG_VMNET' }
695
696##
697# @NetdevVmnetSharedOptions:
698#
699# vmnet (shared mode) network backend.
700#
701# Allows traffic originating from the vmnet interface to reach the
702# Internet through a network address translator (NAT).  The vmnet
703# interface can communicate with the host and with other shared mode
704# interfaces on the same subnet.  If no DHCP settings, subnet mask and
705# IPv6 prefix specified, the interface can communicate with any of
706# other interfaces in shared mode.
707#
708# @start-address: The starting IPv4 address to use for the interface.
709#     Must be in the private IP range (RFC 1918).  Must be specified
710#     along with @end-address and @subnet-mask.  This address is used
711#     as the gateway address.  The subsequent address up to and
712#     including end-address are placed in the DHCP pool.
713#
714# @end-address: The DHCP IPv4 range end address to use for the
715#     interface.  Must be in the private IP range (RFC 1918).  Must be
716#     specified along with @start-address and @subnet-mask.
717#
718# @subnet-mask: The IPv4 subnet mask to use on the interface.  Must be
719#     specified along with @start-address and @subnet-mask.
720#
721# @isolated: Enable isolation for this interface.  Interface isolation
722#     ensures that vmnet interface is not able to communicate with any
723#     other vmnet interfaces.  Only communication with host is
724#     allowed.  Requires at least macOS Big Sur 11.0.
725#
726# @nat66-prefix: The IPv6 prefix to use into guest network.  Must be a
727#     unique local address i.e. start with fd00::/8 and have length of
728#     64.
729#
730# Since: 7.1
731##
732{ 'struct': 'NetdevVmnetSharedOptions',
733  'data': {
734    '*start-address': 'str',
735    '*end-address':   'str',
736    '*subnet-mask':   'str',
737    '*isolated':      'bool',
738    '*nat66-prefix':  'str' },
739  'if': 'CONFIG_VMNET' }
740
741##
742# @NetdevVmnetBridgedOptions:
743#
744# vmnet (bridged mode) network backend.
745#
746# Bridges the vmnet interface with a physical network interface.
747#
748# @ifname: The name of the physical interface to be bridged.
749#
750# @isolated: Enable isolation for this interface.  Interface isolation
751#     ensures that vmnet interface is not able to communicate with any
752#     other vmnet interfaces.  Only communication with host is
753#     allowed.  Requires at least macOS Big Sur 11.0.
754#
755# Since: 7.1
756##
757{ 'struct': 'NetdevVmnetBridgedOptions',
758  'data': {
759    'ifname':     'str',
760    '*isolated':  'bool' },
761  'if': 'CONFIG_VMNET' }
762
763##
764# @NetdevStreamOptions:
765#
766# Configuration info for stream socket netdev
767#
768# @addr: socket address to listen on (server=true) or connect to
769#     (server=false)
770#
771# @server: create server socket (default: false)
772#
773# @reconnect: For a client socket, if a socket is disconnected, then
774#     attempt a reconnect after the given number of seconds.  Setting
775#     this to zero disables this function.  (default: 0) (since 8.0)
776#
777# @reconnect-ms: For a client socket, if a socket is disconnected, then
778#     attempt a reconnect after the given number of milliseconds.  Setting
779#     this to zero disables this function.  This member is mutually
780#     exclusive with @reconnect.  (default: 0) (Since: 9.2)
781#
782# Only `SocketAddress` types 'unix', 'inet' and 'fd' are supported.
783#
784# Features:
785#
786# @deprecated: Member @reconnect is deprecated.  Use @reconnect-ms
787#     instead.
788#
789# Since: 7.2
790##
791{ 'struct': 'NetdevStreamOptions',
792  'data': {
793    'addr':   'SocketAddress',
794    '*server': 'bool',
795    '*reconnect': { 'type': 'int', 'features': [ 'deprecated' ] },
796    '*reconnect-ms': 'int' } }
797
798##
799# @NetdevDgramOptions:
800#
801# Configuration info for datagram socket netdev.
802#
803# @remote: remote address
804#
805# @local: local address
806#
807# Only `SocketAddress` types 'unix', 'inet' and 'fd' are supported.
808#
809# If remote address is present and it's a multicast address, local
810# address is optional.  Otherwise local address is required and remote
811# address is optional.
812#
813# .. table:: Valid parameters combination table
814#    :widths: auto
815#
816#    =============  ========  =====
817#    remote         local     okay?
818#    =============  ========  =====
819#    absent         absent    no
820#    absent         not fd    no
821#    absent         fd        yes
822#    multicast      absent    yes
823#    multicast      present   yes
824#    not multicast  absent    no
825#    not multicast  present   yes
826#    =============  ========  =====
827#
828# Since: 7.2
829##
830{ 'struct': 'NetdevDgramOptions',
831  'data': {
832    '*local':  'SocketAddress',
833    '*remote': 'SocketAddress' } }
834
835##
836# @NetClientDriver:
837#
838# Available netdev drivers.
839#
840# @l2tpv3: since 2.1
841#
842# @vhost-vdpa: since 5.1
843#
844# @vmnet-host: since 7.1
845#
846# @vmnet-shared: since 7.1
847#
848# @vmnet-bridged: since 7.1
849#
850# @stream: since 7.2
851#
852# @dgram: since 7.2
853#
854# @af-xdp: since 8.2
855#
856# @passt: since 10.1
857#
858# Since: 2.7
859##
860{ 'enum': 'NetClientDriver',
861  'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'stream',
862            'dgram', 'vde', 'bridge', 'hubport', 'netmap', 'vhost-user',
863            'vhost-vdpa',
864            { 'name': 'passt', 'if': 'CONFIG_PASST' },
865            { 'name': 'af-xdp', 'if': 'CONFIG_AF_XDP' },
866            { 'name': 'vmnet-host', 'if': 'CONFIG_VMNET' },
867            { 'name': 'vmnet-shared', 'if': 'CONFIG_VMNET' },
868            { 'name': 'vmnet-bridged', 'if': 'CONFIG_VMNET' }] }
869
870##
871# @Netdev:
872#
873# Captures the configuration of a network device.
874#
875# @id: identifier for monitor commands.
876#
877# @type: Specify the driver used for interpreting remaining arguments.
878#
879# Since: 1.2
880##
881{ 'union': 'Netdev',
882  'base': { 'id': 'str', 'type': 'NetClientDriver' },
883  'discriminator': 'type',
884  'data': {
885    'nic':      'NetLegacyNicOptions',
886    'passt':    { 'type': 'NetDevPasstOptions',
887                  'if': 'CONFIG_PASST' },
888    'user':     'NetdevUserOptions',
889    'tap':      'NetdevTapOptions',
890    'l2tpv3':   'NetdevL2TPv3Options',
891    'socket':   'NetdevSocketOptions',
892    'stream':   'NetdevStreamOptions',
893    'dgram':    'NetdevDgramOptions',
894    'vde':      'NetdevVdeOptions',
895    'bridge':   'NetdevBridgeOptions',
896    'hubport':  'NetdevHubPortOptions',
897    'netmap':   'NetdevNetmapOptions',
898    'af-xdp':   { 'type': 'NetdevAFXDPOptions',
899                  'if': 'CONFIG_AF_XDP' },
900    'vhost-user': 'NetdevVhostUserOptions',
901    'vhost-vdpa': 'NetdevVhostVDPAOptions',
902    'vmnet-host': { 'type': 'NetdevVmnetHostOptions',
903                    'if': 'CONFIG_VMNET' },
904    'vmnet-shared': { 'type': 'NetdevVmnetSharedOptions',
905                      'if': 'CONFIG_VMNET' },
906    'vmnet-bridged': { 'type': 'NetdevVmnetBridgedOptions',
907                       'if': 'CONFIG_VMNET' } } }
908
909##
910# @RxState:
911#
912# Packets receiving state
913#
914# @normal: filter assigned packets according to the mac-table
915#
916# @none: don't receive any assigned packet
917#
918# @all: receive all assigned packets
919#
920# Since: 1.6
921##
922{ 'enum': 'RxState', 'data': [ 'normal', 'none', 'all' ] }
923
924##
925# @RxFilterInfo:
926#
927# Rx-filter information for a NIC.
928#
929# @name: net client name
930#
931# @promiscuous: whether promiscuous mode is enabled
932#
933# @multicast: multicast receive state
934#
935# @unicast: unicast receive state
936#
937# @vlan: vlan receive state (Since 2.0)
938#
939# @broadcast-allowed: whether to receive broadcast
940#
941# @multicast-overflow: multicast table is overflowed or not
942#
943# @unicast-overflow: unicast table is overflowed or not
944#
945# @main-mac: the main macaddr string
946#
947# @vlan-table: a list of active vlan id
948#
949# @unicast-table: a list of unicast macaddr string
950#
951# @multicast-table: a list of multicast macaddr string
952#
953# Since: 1.6
954##
955{ 'struct': 'RxFilterInfo',
956  'data': {
957    'name':               'str',
958    'promiscuous':        'bool',
959    'multicast':          'RxState',
960    'unicast':            'RxState',
961    'vlan':               'RxState',
962    'broadcast-allowed':  'bool',
963    'multicast-overflow': 'bool',
964    'unicast-overflow':   'bool',
965    'main-mac':           'str',
966    'vlan-table':         ['int'],
967    'unicast-table':      ['str'],
968    'multicast-table':    ['str'] }}
969
970##
971# @query-rx-filter:
972#
973# Return rx-filter information for all NICs (or for the given NIC).
974#
975# @name: net client name
976#
977# Returns: list of info for all NICs (or for the given NIC).
978#
979# Errors:
980#     - if the given @name doesn't exist
981#     - if the given NIC doesn't support rx-filter querying
982#     - if the given net client isn't a NIC
983#
984# Since: 1.6
985#
986# .. qmp-example::
987#
988#     -> { "execute": "query-rx-filter", "arguments": { "name": "vnet0" } }
989#     <- { "return": [
990#             {
991#                 "promiscuous": true,
992#                 "name": "vnet0",
993#                 "main-mac": "52:54:00:12:34:56",
994#                 "unicast": "normal",
995#                 "vlan": "normal",
996#                 "vlan-table": [
997#                     4,
998#                     0
999#                 ],
1000#                 "unicast-table": [
1001#                 ],
1002#                 "multicast": "normal",
1003#                 "multicast-overflow": false,
1004#                 "unicast-overflow": false,
1005#                 "multicast-table": [
1006#                     "01:00:5e:00:00:01",
1007#                     "33:33:00:00:00:01",
1008#                     "33:33:ff:12:34:56"
1009#                 ],
1010#                 "broadcast-allowed": false
1011#             }
1012#           ]
1013#        }
1014##
1015{ 'command': 'query-rx-filter',
1016  'data': { '*name': 'str' },
1017  'returns': ['RxFilterInfo'] }
1018
1019##
1020# @NIC_RX_FILTER_CHANGED:
1021#
1022# Emitted once until the `query-rx-filter` command is executed, the
1023# first event will always be emitted
1024#
1025# @name: net client name
1026#
1027# @path: device path
1028#
1029# Since: 1.6
1030#
1031# .. qmp-example::
1032#
1033#     <- { "event": "NIC_RX_FILTER_CHANGED",
1034#          "data": { "name": "vnet0",
1035#                    "path": "/machine/peripheral/vnet0/virtio-backend" },
1036#          "timestamp": { "seconds": 1368697518, "microseconds": 326866 } }
1037##
1038{ 'event': 'NIC_RX_FILTER_CHANGED',
1039  'data': { '*name': 'str', 'path': 'str' } }
1040
1041##
1042# @AnnounceParameters:
1043#
1044# Parameters for self-announce timers
1045#
1046# @initial: Initial delay (in ms) before sending the first GARP/RARP
1047#     announcement
1048#
1049# @max: Maximum delay (in ms) between GARP/RARP announcement packets
1050#
1051# @rounds: Number of self-announcement attempts
1052#
1053# @step: Delay increase (in ms) after each self-announcement attempt
1054#
1055# @interfaces: An optional list of interface names, which restricts
1056#     the announcement to the listed interfaces.  (Since 4.1)
1057#
1058# @id: A name to be used to identify an instance of announce-timers
1059#     and to allow it to modified later.  Not for use as part of the
1060#     migration parameters.  (Since 4.1)
1061#
1062# Since: 4.0
1063##
1064
1065{ 'struct': 'AnnounceParameters',
1066  'data': { 'initial': 'int',
1067            'max': 'int',
1068            'rounds': 'int',
1069            'step': 'int',
1070            '*interfaces': ['str'],
1071            '*id' : 'str' } }
1072
1073##
1074# @announce-self:
1075#
1076# Trigger generation of broadcast RARP frames to update network
1077# switches.  This can be useful when network bonds fail-over the
1078# active slave.
1079#
1080# TODO: This line is a hack to separate the example from the body
1081#
1082# .. qmp-example::
1083#
1084#     -> { "execute": "announce-self",
1085#          "arguments": {
1086#              "initial": 50, "max": 550, "rounds": 10, "step": 50,
1087#              "interfaces": ["vn2", "vn3"], "id": "bob" } }
1088#     <- { "return": {} }
1089#
1090# Since: 4.0
1091##
1092{ 'command': 'announce-self', 'boxed': true,
1093  'data' : 'AnnounceParameters'}
1094
1095##
1096# @FAILOVER_NEGOTIATED:
1097#
1098# Emitted when VIRTIO_NET_F_STANDBY was enabled during feature
1099# negotiation.  Failover primary devices which were hidden (not
1100# hotplugged when requested) before will now be hotplugged by the
1101# virtio-net standby device.
1102#
1103# @device-id: QEMU device id of the unplugged device
1104#
1105# Since: 4.2
1106#
1107# .. qmp-example::
1108#
1109#     <- { "event": "FAILOVER_NEGOTIATED",
1110#          "data": { "device-id": "net1" },
1111#          "timestamp": { "seconds": 1368697518, "microseconds": 326866 } }
1112##
1113{ 'event': 'FAILOVER_NEGOTIATED',
1114  'data': {'device-id': 'str'} }
1115
1116##
1117# @NETDEV_STREAM_CONNECTED:
1118#
1119# Emitted when the netdev stream backend is connected
1120#
1121# @netdev-id: QEMU netdev id that is connected
1122#
1123# @addr: The destination address
1124#
1125# Since: 7.2
1126#
1127# .. qmp-example::
1128#
1129#     <- { "event": "NETDEV_STREAM_CONNECTED",
1130#          "data": { "netdev-id": "netdev0",
1131#                    "addr": { "port": "47666", "ipv6": true,
1132#                              "host": "::1", "type": "inet" } },
1133#          "timestamp": { "seconds": 1666269863, "microseconds": 311222 } }
1134#
1135# .. qmp-example::
1136#
1137#     <- { "event": "NETDEV_STREAM_CONNECTED",
1138#          "data": { "netdev-id": "netdev0",
1139#                    "addr": { "path": "/tmp/qemu0", "type": "unix" } },
1140#          "timestamp": { "seconds": 1666269706, "microseconds": 413651 } }
1141##
1142{ 'event': 'NETDEV_STREAM_CONNECTED',
1143  'data': { 'netdev-id': 'str',
1144            'addr': 'SocketAddress' } }
1145
1146##
1147# @NETDEV_STREAM_DISCONNECTED:
1148#
1149# Emitted when the netdev stream backend is disconnected
1150#
1151# @netdev-id: QEMU netdev id that is disconnected
1152#
1153# Since: 7.2
1154#
1155# .. qmp-example::
1156#
1157#     <- { "event": "NETDEV_STREAM_DISCONNECTED",
1158#          "data": {"netdev-id": "netdev0"},
1159#          "timestamp": {"seconds": 1663330937, "microseconds": 526695} }
1160##
1161{ 'event': 'NETDEV_STREAM_DISCONNECTED',
1162  'data': { 'netdev-id': 'str' } }
1163
1164##
1165# @NETDEV_VHOST_USER_CONNECTED:
1166#
1167# Emitted when the vhost-user chardev is connected
1168#
1169# @netdev-id: QEMU netdev id that is connected
1170#
1171# @chardev-id: The character device id used by the QEMU netdev
1172#
1173# Since: 10.0
1174#
1175# .. qmp-example::
1176#
1177#     <- { "timestamp": {"seconds": 1739538638, "microseconds": 354181 },
1178#          "event": "NETDEV_VHOST_USER_CONNECTED",
1179#          "data": { "netdev-id": "netdev0", "chardev-id": "chr0" } }
1180#
1181##
1182{ 'event': 'NETDEV_VHOST_USER_CONNECTED',
1183  'data': { 'netdev-id': 'str', 'chardev-id': 'str' } }
1184
1185##
1186# @NETDEV_VHOST_USER_DISCONNECTED:
1187#
1188# Emitted when the vhost-user chardev is disconnected
1189#
1190# @netdev-id: QEMU netdev id that is disconnected
1191#
1192# Since: 10.0
1193#
1194# .. qmp-example::
1195#
1196#     <- { "timestamp": { "seconds": 1739538634, "microseconds": 920450 },
1197#          "event": "NETDEV_VHOST_USER_DISCONNECTED",
1198#          "data": { "netdev-id": "netdev0" } }
1199#
1200##
1201{ 'event': 'NETDEV_VHOST_USER_DISCONNECTED',
1202  'data': { 'netdev-id': 'str' } }
1203