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