* Zhang Chen (chen.zh...@intel.com) wrote: > Add IP_PROTOCOL as enum include TCP,UDP, ICMP... for other QMP commands. > > Signed-off-by: Zhang Chen <chen.zh...@intel.com> > --- > qapi/net.json | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/qapi/net.json b/qapi/net.json > index 87361ebd9a..498ea7aa72 100644 > --- a/qapi/net.json > +++ b/qapi/net.json > @@ -794,3 +794,34 @@ > # > ## > { 'command': 'query-netdev', 'returns': ['NetdevInfo'] } > + > +## > +# @IP_PROTOCOL: > +# > +# Transport layer protocol. > +# > +# Just for IPv4. > +# > +# @tcp: Transmission Control Protocol. > +# > +# @udp: User Datagram Protocol. > +# > +# @dccp: Datagram Congestion Control Protocol. > +# > +# @sctp: Stream Control Transmission Protocol. > +# > +# @udplite: Lightweight User Datagram Protocol. > +# > +# @icmp: Internet Control Message Protocol. > +# > +# @igmp: Internet Group Management Protocol. > +# > +# @ipv6: IPv6 Encapsulation. > +# > +# TODO: Need to add more transport layer protocol. > +# > +# Since: 6.1 > +## > +{ 'enum': 'IP_PROTOCOL', 'data': [ 'tcp', 'udp', 'dccp', 'sctp', 'udplite', > + 'icmp', 'igmp', 'ipv6' ] }
Isn't the right thing to do here to use a string for protocol and then pass it to getprotobyname; that way your list is never out of date, and you never have to translate between the order of this enum and the integer assignment set in stone. Dave > + > -- > 2.25.1 > -- Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK