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