xref: /openbmc/qemu/qapi/net.json (revision 1c37425423f60c3e0deec6e942cfb17982fd8b6d)
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 or @map-path.
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.  @sock-fds and
576#     @map-path are mutually exclusive.  Requires @inhibit.
577#
578# @map-path: The path to a pinned xsk map to push file descriptors
579#     for bound AF_XDP sockets into.  @map-path and @sock-fds are
580#     mutually exclusive.  Requires @inhibit.  (Since 10.1)
581#
582# @map-start-index: Use @map-path to insert xsk sockets starting from
583#     this index number (default: 0).  Requires @map-path.  (Since 10.1)
584#
585# Since: 8.2
586##
587{ 'struct': 'NetdevAFXDPOptions',
588  'data': {
589    'ifname':           'str',
590    '*mode':            'AFXDPMode',
591    '*force-copy':      'bool',
592    '*queues':          'int',
593    '*start-queue':     'int',
594    '*inhibit':         'bool',
595    '*sock-fds':        'str',
596    '*map-path':        'str',
597    '*map-start-index': 'int32' },
598  'if': 'CONFIG_AF_XDP' }
599
600##
601# @NetdevVhostUserOptions:
602#
603# Vhost-user network backend
604#
605# @chardev: name of a unix socket chardev
606#
607# @vhostforce: vhost on for non-MSIX virtio guests (default: false).
608#
609# @queues: number of queues to be created for multiqueue vhost-user
610#     (default: 1) (Since 2.5)
611#
612# Since: 2.1
613##
614{ 'struct': 'NetdevVhostUserOptions',
615  'data': {
616    'chardev':        'str',
617    '*vhostforce':    'bool',
618    '*queues':        'int' } }
619
620##
621# @NetdevVhostVDPAOptions:
622#
623# Vhost-vdpa network backend
624#
625# vDPA device is a device that uses a datapath which complies with the
626# virtio specifications with a vendor specific control path.
627#
628# @vhostdev: path of vhost-vdpa device (default:'/dev/vhost-vdpa-0')
629#
630# @vhostfd: file descriptor of an already opened vhost vdpa device
631#
632# @queues: number of queues to be created for multiqueue vhost-vdpa
633#     (default: 1)
634#
635# @x-svq: Start device with (experimental) shadow virtqueue.
636#     (Since 7.1) (default: false)
637#
638# Features:
639#
640# @unstable: Member @x-svq is experimental.
641#
642# Since: 5.1
643##
644{ 'struct': 'NetdevVhostVDPAOptions',
645  'data': {
646    '*vhostdev':     'str',
647    '*vhostfd':      'str',
648    '*queues':       'int',
649    '*x-svq':        {'type': 'bool', 'features' : [ 'unstable'] } } }
650
651##
652# @NetdevVmnetHostOptions:
653#
654# vmnet (host mode) network backend.
655#
656# Allows the vmnet interface to communicate with other vmnet
657# interfaces that are in host mode and also with the host.
658#
659# @start-address: The starting IPv4 address to use for the interface.
660#     Must be in the private IP range (RFC 1918).  Must be specified
661#     along with @end-address and @subnet-mask.  This address is used
662#     as the gateway address.  The subsequent address up to and
663#     including end-address are placed in the DHCP pool.
664#
665# @end-address: The DHCP IPv4 range end address to use for the
666#     interface.  Must be in the private IP range (RFC 1918).  Must be
667#     specified along with @start-address and @subnet-mask.
668#
669# @subnet-mask: The IPv4 subnet mask to use on the interface.  Must be
670#     specified along with @start-address and @subnet-mask.
671#
672# @isolated: Enable isolation for this interface.  Interface isolation
673#     ensures that vmnet interface is not able to communicate with any
674#     other vmnet interfaces.  Only communication with host is
675#     allowed.  Requires at least macOS Big Sur 11.0.
676#
677# @net-uuid: The identifier (UUID) to uniquely identify the isolated
678#     network vmnet interface should be added to.  If set, no DHCP
679#     service is provided for this interface and network communication
680#     is allowed only with other interfaces added to this network
681#     identified by the UUID.  Requires at least macOS Big Sur 11.0.
682#
683# Since: 7.1
684##
685{ 'struct': 'NetdevVmnetHostOptions',
686  'data': {
687    '*start-address': 'str',
688    '*end-address':   'str',
689    '*subnet-mask':   'str',
690    '*isolated':      'bool',
691    '*net-uuid':      'str' },
692  'if': 'CONFIG_VMNET' }
693
694##
695# @NetdevVmnetSharedOptions:
696#
697# vmnet (shared mode) network backend.
698#
699# Allows traffic originating from the vmnet interface to reach the
700# Internet through a network address translator (NAT).  The vmnet
701# interface can communicate with the host and with other shared mode
702# interfaces on the same subnet.  If no DHCP settings, subnet mask and
703# IPv6 prefix specified, the interface can communicate with any of
704# other interfaces in shared mode.
705#
706# @start-address: The starting IPv4 address to use for the interface.
707#     Must be in the private IP range (RFC 1918).  Must be specified
708#     along with @end-address and @subnet-mask.  This address is used
709#     as the gateway address.  The subsequent address up to and
710#     including end-address are placed in the DHCP pool.
711#
712# @end-address: The DHCP IPv4 range end address to use for the
713#     interface.  Must be in the private IP range (RFC 1918).  Must be
714#     specified along with @start-address and @subnet-mask.
715#
716# @subnet-mask: The IPv4 subnet mask to use on the interface.  Must be
717#     specified along with @start-address and @subnet-mask.
718#
719# @isolated: Enable isolation for this interface.  Interface isolation
720#     ensures that vmnet interface is not able to communicate with any
721#     other vmnet interfaces.  Only communication with host is
722#     allowed.  Requires at least macOS Big Sur 11.0.
723#
724# @nat66-prefix: The IPv6 prefix to use into guest network.  Must be a
725#     unique local address i.e. start with fd00::/8 and have length of
726#     64.
727#
728# Since: 7.1
729##
730{ 'struct': 'NetdevVmnetSharedOptions',
731  'data': {
732    '*start-address': 'str',
733    '*end-address':   'str',
734    '*subnet-mask':   'str',
735    '*isolated':      'bool',
736    '*nat66-prefix':  'str' },
737  'if': 'CONFIG_VMNET' }
738
739##
740# @NetdevVmnetBridgedOptions:
741#
742# vmnet (bridged mode) network backend.
743#
744# Bridges the vmnet interface with a physical network interface.
745#
746# @ifname: The name of the physical interface to be bridged.
747#
748# @isolated: Enable isolation for this interface.  Interface isolation
749#     ensures that vmnet interface is not able to communicate with any
750#     other vmnet interfaces.  Only communication with host is
751#     allowed.  Requires at least macOS Big Sur 11.0.
752#
753# Since: 7.1
754##
755{ 'struct': 'NetdevVmnetBridgedOptions',
756  'data': {
757    'ifname':     'str',
758    '*isolated':  'bool' },
759  'if': 'CONFIG_VMNET' }
760
761##
762# @NetdevStreamOptions:
763#
764# Configuration info for stream socket netdev
765#
766# @addr: socket address to listen on (server=true) or connect to
767#     (server=false)
768#
769# @server: create server socket (default: false)
770#
771# @reconnect: For a client socket, if a socket is disconnected, then
772#     attempt a reconnect after the given number of seconds.  Setting
773#     this to zero disables this function.  (default: 0) (since 8.0)
774#
775# @reconnect-ms: For a client socket, if a socket is disconnected, then
776#     attempt a reconnect after the given number of milliseconds.  Setting
777#     this to zero disables this function.  This member is mutually
778#     exclusive with @reconnect.  (default: 0) (Since: 9.2)
779#
780# Only SocketAddress types 'unix', 'inet' and 'fd' are supported.
781#
782# Features:
783#
784# @deprecated: Member @reconnect is deprecated.  Use @reconnect-ms
785#     instead.
786#
787# Since: 7.2
788##
789{ 'struct': 'NetdevStreamOptions',
790  'data': {
791    'addr':   'SocketAddress',
792    '*server': 'bool',
793    '*reconnect': { 'type': 'int', 'features': [ 'deprecated' ] },
794    '*reconnect-ms': 'int' } }
795
796##
797# @NetdevDgramOptions:
798#
799# Configuration info for datagram socket netdev.
800#
801# @remote: remote address
802#
803# @local: local address
804#
805# Only SocketAddress types 'unix', 'inet' and 'fd' are supported.
806#
807# If remote address is present and it's a multicast address, local
808# address is optional.  Otherwise local address is required and remote
809# address is optional.
810#
811# .. table:: Valid parameters combination table
812#    :widths: auto
813#
814#    =============  ========  =====
815#    remote         local     okay?
816#    =============  ========  =====
817#    absent         absent    no
818#    absent         not fd    no
819#    absent         fd        yes
820#    multicast      absent    yes
821#    multicast      present   yes
822#    not multicast  absent    no
823#    not multicast  present   yes
824#    =============  ========  =====
825#
826# Since: 7.2
827##
828{ 'struct': 'NetdevDgramOptions',
829  'data': {
830    '*local':  'SocketAddress',
831    '*remote': 'SocketAddress' } }
832
833##
834# @NetClientDriver:
835#
836# Available netdev drivers.
837#
838# @l2tpv3: since 2.1
839#
840# @vhost-vdpa: since 5.1
841#
842# @vmnet-host: since 7.1
843#
844# @vmnet-shared: since 7.1
845#
846# @vmnet-bridged: since 7.1
847#
848# @stream: since 7.2
849#
850# @dgram: since 7.2
851#
852# @af-xdp: since 8.2
853#
854# @passt: since 10.1
855#
856# Since: 2.7
857##
858{ 'enum': 'NetClientDriver',
859  'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'stream',
860            'dgram', 'vde', 'bridge', 'hubport', 'netmap', 'vhost-user',
861            'vhost-vdpa',
862            { 'name': 'passt', 'if': 'CONFIG_PASST' },
863            { 'name': 'af-xdp', 'if': 'CONFIG_AF_XDP' },
864            { 'name': 'vmnet-host', 'if': 'CONFIG_VMNET' },
865            { 'name': 'vmnet-shared', 'if': 'CONFIG_VMNET' },
866            { 'name': 'vmnet-bridged', 'if': 'CONFIG_VMNET' }] }
867
868##
869# @Netdev:
870#
871# Captures the configuration of a network device.
872#
873# @id: identifier for monitor commands.
874#
875# @type: Specify the driver used for interpreting remaining arguments.
876#
877# Since: 1.2
878##
879{ 'union': 'Netdev',
880  'base': { 'id': 'str', 'type': 'NetClientDriver' },
881  'discriminator': 'type',
882  'data': {
883    'nic':      'NetLegacyNicOptions',
884    'passt':    { 'type': 'NetDevPasstOptions',
885                  'if': 'CONFIG_PASST' },
886    'user':     'NetdevUserOptions',
887    'tap':      'NetdevTapOptions',
888    'l2tpv3':   'NetdevL2TPv3Options',
889    'socket':   'NetdevSocketOptions',
890    'stream':   'NetdevStreamOptions',
891    'dgram':    'NetdevDgramOptions',
892    'vde':      'NetdevVdeOptions',
893    'bridge':   'NetdevBridgeOptions',
894    'hubport':  'NetdevHubPortOptions',
895    'netmap':   'NetdevNetmapOptions',
896    'af-xdp':   { 'type': 'NetdevAFXDPOptions',
897                  'if': 'CONFIG_AF_XDP' },
898    'vhost-user': 'NetdevVhostUserOptions',
899    'vhost-vdpa': 'NetdevVhostVDPAOptions',
900    'vmnet-host': { 'type': 'NetdevVmnetHostOptions',
901                    'if': 'CONFIG_VMNET' },
902    'vmnet-shared': { 'type': 'NetdevVmnetSharedOptions',
903                      'if': 'CONFIG_VMNET' },
904    'vmnet-bridged': { 'type': 'NetdevVmnetBridgedOptions',
905                       'if': 'CONFIG_VMNET' } } }
906
907##
908# @RxState:
909#
910# Packets receiving state
911#
912# @normal: filter assigned packets according to the mac-table
913#
914# @none: don't receive any assigned packet
915#
916# @all: receive all assigned packets
917#
918# Since: 1.6
919##
920{ 'enum': 'RxState', 'data': [ 'normal', 'none', 'all' ] }
921
922##
923# @RxFilterInfo:
924#
925# Rx-filter information for a NIC.
926#
927# @name: net client name
928#
929# @promiscuous: whether promiscuous mode is enabled
930#
931# @multicast: multicast receive state
932#
933# @unicast: unicast receive state
934#
935# @vlan: vlan receive state (Since 2.0)
936#
937# @broadcast-allowed: whether to receive broadcast
938#
939# @multicast-overflow: multicast table is overflowed or not
940#
941# @unicast-overflow: unicast table is overflowed or not
942#
943# @main-mac: the main macaddr string
944#
945# @vlan-table: a list of active vlan id
946#
947# @unicast-table: a list of unicast macaddr string
948#
949# @multicast-table: a list of multicast macaddr string
950#
951# Since: 1.6
952##
953{ 'struct': 'RxFilterInfo',
954  'data': {
955    'name':               'str',
956    'promiscuous':        'bool',
957    'multicast':          'RxState',
958    'unicast':            'RxState',
959    'vlan':               'RxState',
960    'broadcast-allowed':  'bool',
961    'multicast-overflow': 'bool',
962    'unicast-overflow':   'bool',
963    'main-mac':           'str',
964    'vlan-table':         ['int'],
965    'unicast-table':      ['str'],
966    'multicast-table':    ['str'] }}
967
968##
969# @query-rx-filter:
970#
971# Return rx-filter information for all NICs (or for the given NIC).
972#
973# @name: net client name
974#
975# Returns: list of @RxFilterInfo for all NICs (or for the given NIC).
976#
977# Errors:
978#     - if the given @name doesn't exist
979#     - if the given NIC doesn't support rx-filter querying
980#     - if the given net client isn't a NIC
981#
982# Since: 1.6
983#
984# .. qmp-example::
985#
986#     -> { "execute": "query-rx-filter", "arguments": { "name": "vnet0" } }
987#     <- { "return": [
988#             {
989#                 "promiscuous": true,
990#                 "name": "vnet0",
991#                 "main-mac": "52:54:00:12:34:56",
992#                 "unicast": "normal",
993#                 "vlan": "normal",
994#                 "vlan-table": [
995#                     4,
996#                     0
997#                 ],
998#                 "unicast-table": [
999#                 ],
1000#                 "multicast": "normal",
1001#                 "multicast-overflow": false,
1002#                 "unicast-overflow": false,
1003#                 "multicast-table": [
1004#                     "01:00:5e:00:00:01",
1005#                     "33:33:00:00:00:01",
1006#                     "33:33:ff:12:34:56"
1007#                 ],
1008#                 "broadcast-allowed": false
1009#             }
1010#           ]
1011#        }
1012##
1013{ 'command': 'query-rx-filter',
1014  'data': { '*name': 'str' },
1015  'returns': ['RxFilterInfo'] }
1016
1017##
1018# @NIC_RX_FILTER_CHANGED:
1019#
1020# Emitted once until the 'query-rx-filter' command is executed, the
1021# first event will always be emitted
1022#
1023# @name: net client name
1024#
1025# @path: device path
1026#
1027# Since: 1.6
1028#
1029# .. qmp-example::
1030#
1031#     <- { "event": "NIC_RX_FILTER_CHANGED",
1032#          "data": { "name": "vnet0",
1033#                    "path": "/machine/peripheral/vnet0/virtio-backend" },
1034#          "timestamp": { "seconds": 1368697518, "microseconds": 326866 } }
1035##
1036{ 'event': 'NIC_RX_FILTER_CHANGED',
1037  'data': { '*name': 'str', 'path': 'str' } }
1038
1039##
1040# @AnnounceParameters:
1041#
1042# Parameters for self-announce timers
1043#
1044# @initial: Initial delay (in ms) before sending the first GARP/RARP
1045#     announcement
1046#
1047# @max: Maximum delay (in ms) between GARP/RARP announcement packets
1048#
1049# @rounds: Number of self-announcement attempts
1050#
1051# @step: Delay increase (in ms) after each self-announcement attempt
1052#
1053# @interfaces: An optional list of interface names, which restricts
1054#     the announcement to the listed interfaces.  (Since 4.1)
1055#
1056# @id: A name to be used to identify an instance of announce-timers
1057#     and to allow it to modified later.  Not for use as part of the
1058#     migration parameters.  (Since 4.1)
1059#
1060# Since: 4.0
1061##
1062
1063{ 'struct': 'AnnounceParameters',
1064  'data': { 'initial': 'int',
1065            'max': 'int',
1066            'rounds': 'int',
1067            'step': 'int',
1068            '*interfaces': ['str'],
1069            '*id' : 'str' } }
1070
1071##
1072# @announce-self:
1073#
1074# Trigger generation of broadcast RARP frames to update network
1075# switches.  This can be useful when network bonds fail-over the
1076# active slave.
1077#
1078# TODO: This line is a hack to separate the example from the body
1079#
1080# .. qmp-example::
1081#
1082#     -> { "execute": "announce-self",
1083#          "arguments": {
1084#              "initial": 50, "max": 550, "rounds": 10, "step": 50,
1085#              "interfaces": ["vn2", "vn3"], "id": "bob" } }
1086#     <- { "return": {} }
1087#
1088# Since: 4.0
1089##
1090{ 'command': 'announce-self', 'boxed': true,
1091  'data' : 'AnnounceParameters'}
1092
1093##
1094# @FAILOVER_NEGOTIATED:
1095#
1096# Emitted when VIRTIO_NET_F_STANDBY was enabled during feature
1097# negotiation.  Failover primary devices which were hidden (not
1098# hotplugged when requested) before will now be hotplugged by the
1099# virtio-net standby device.
1100#
1101# @device-id: QEMU device id of the unplugged device
1102#
1103# Since: 4.2
1104#
1105# .. qmp-example::
1106#
1107#     <- { "event": "FAILOVER_NEGOTIATED",
1108#          "data": { "device-id": "net1" },
1109#          "timestamp": { "seconds": 1368697518, "microseconds": 326866 } }
1110##
1111{ 'event': 'FAILOVER_NEGOTIATED',
1112  'data': {'device-id': 'str'} }
1113
1114##
1115# @NETDEV_STREAM_CONNECTED:
1116#
1117# Emitted when the netdev stream backend is connected
1118#
1119# @netdev-id: QEMU netdev id that is connected
1120#
1121# @addr: The destination address
1122#
1123# Since: 7.2
1124#
1125# .. qmp-example::
1126#
1127#     <- { "event": "NETDEV_STREAM_CONNECTED",
1128#          "data": { "netdev-id": "netdev0",
1129#                    "addr": { "port": "47666", "ipv6": true,
1130#                              "host": "::1", "type": "inet" } },
1131#          "timestamp": { "seconds": 1666269863, "microseconds": 311222 } }
1132#
1133# .. qmp-example::
1134#
1135#     <- { "event": "NETDEV_STREAM_CONNECTED",
1136#          "data": { "netdev-id": "netdev0",
1137#                    "addr": { "path": "/tmp/qemu0", "type": "unix" } },
1138#          "timestamp": { "seconds": 1666269706, "microseconds": 413651 } }
1139##
1140{ 'event': 'NETDEV_STREAM_CONNECTED',
1141  'data': { 'netdev-id': 'str',
1142            'addr': 'SocketAddress' } }
1143
1144##
1145# @NETDEV_STREAM_DISCONNECTED:
1146#
1147# Emitted when the netdev stream backend is disconnected
1148#
1149# @netdev-id: QEMU netdev id that is disconnected
1150#
1151# Since: 7.2
1152#
1153# .. qmp-example::
1154#
1155#     <- { "event": "NETDEV_STREAM_DISCONNECTED",
1156#          "data": {"netdev-id": "netdev0"},
1157#          "timestamp": {"seconds": 1663330937, "microseconds": 526695} }
1158##
1159{ 'event': 'NETDEV_STREAM_DISCONNECTED',
1160  'data': { 'netdev-id': 'str' } }
1161
1162##
1163# @NETDEV_VHOST_USER_CONNECTED:
1164#
1165# Emitted when the vhost-user chardev is connected
1166#
1167# @netdev-id: QEMU netdev id that is connected
1168#
1169# @chardev-id: The character device id used by the QEMU netdev
1170#
1171# Since: 10.0
1172#
1173# .. qmp-example::
1174#
1175#     <- { "timestamp": {"seconds": 1739538638, "microseconds": 354181 },
1176#          "event": "NETDEV_VHOST_USER_CONNECTED",
1177#          "data": { "netdev-id": "netdev0", "chardev-id": "chr0" } }
1178#
1179##
1180{ 'event': 'NETDEV_VHOST_USER_CONNECTED',
1181  'data': { 'netdev-id': 'str', 'chardev-id': 'str' } }
1182
1183##
1184# @NETDEV_VHOST_USER_DISCONNECTED:
1185#
1186# Emitted when the vhost-user chardev is disconnected
1187#
1188# @netdev-id: QEMU netdev id that is disconnected
1189#
1190# Since: 10.0
1191#
1192# .. qmp-example::
1193#
1194#     <- { "timestamp": { "seconds": 1739538634, "microseconds": 920450 },
1195#          "event": "NETDEV_VHOST_USER_DISCONNECTED",
1196#          "data": { "netdev-id": "netdev0" } }
1197#
1198##
1199{ 'event': 'NETDEV_VHOST_USER_DISCONNECTED',
1200  'data': { 'netdev-id': 'str' } }
1201