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