cd5a64aecf5a03b76f071a4c3baf65fbf2ce9e2e
[govpp.git] / internal / testbinapi / binapi2001 / vhost_user / vhost_user.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.4.0-dev
4 //  VPP:              20.01
5 // source: .vppapi/core/vhost_user.api.json
6
7 // Package vhost_user contains generated bindings for API file vhost_user.api.
8 //
9 // Contents:
10 //   2 aliases
11 //   8 enums
12 //   8 messages
13 //
14 package vhost_user
15
16 import (
17         api "git.fd.io/govpp.git/api"
18         codec "git.fd.io/govpp.git/codec"
19         "net"
20         "strconv"
21 )
22
23 // This is a compile-time assertion to ensure that this generated file
24 // is compatible with the GoVPP api package it is being compiled against.
25 // A compilation error at this line likely means your copy of the
26 // GoVPP api package needs to be updated.
27 const _ = api.GoVppAPIPackageIsVersion2
28
29 const (
30         APIFile    = "vhost_user"
31         APIVersion = "4.0.0"
32         VersionCrc = 0xb547a33d
33 )
34
35 // IfStatusFlags defines enum 'if_status_flags'.
36 type IfStatusFlags uint32
37
38 const (
39         IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
40         IF_STATUS_API_FLAG_LINK_UP  IfStatusFlags = 2
41 )
42
43 var (
44         IfStatusFlags_name = map[uint32]string{
45                 1: "IF_STATUS_API_FLAG_ADMIN_UP",
46                 2: "IF_STATUS_API_FLAG_LINK_UP",
47         }
48         IfStatusFlags_value = map[string]uint32{
49                 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
50                 "IF_STATUS_API_FLAG_LINK_UP":  2,
51         }
52 )
53
54 func (x IfStatusFlags) String() string {
55         s, ok := IfStatusFlags_name[uint32(x)]
56         if ok {
57                 return s
58         }
59         str := func(n uint32) string {
60                 s, ok := IfStatusFlags_name[uint32(n)]
61                 if ok {
62                         return s
63                 }
64                 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
65         }
66         for i := uint32(0); i <= 32; i++ {
67                 val := uint32(x)
68                 if val&(1<<i) != 0 {
69                         if s != "" {
70                                 s += "|"
71                         }
72                         s += str(1 << i)
73                 }
74         }
75         if s == "" {
76                 return str(uint32(x))
77         }
78         return s
79 }
80
81 // IfType defines enum 'if_type'.
82 type IfType uint32
83
84 const (
85         IF_API_TYPE_HARDWARE IfType = 1
86         IF_API_TYPE_SUB      IfType = 2
87         IF_API_TYPE_P2P      IfType = 3
88         IF_API_TYPE_PIPE     IfType = 4
89 )
90
91 var (
92         IfType_name = map[uint32]string{
93                 1: "IF_API_TYPE_HARDWARE",
94                 2: "IF_API_TYPE_SUB",
95                 3: "IF_API_TYPE_P2P",
96                 4: "IF_API_TYPE_PIPE",
97         }
98         IfType_value = map[string]uint32{
99                 "IF_API_TYPE_HARDWARE": 1,
100                 "IF_API_TYPE_SUB":      2,
101                 "IF_API_TYPE_P2P":      3,
102                 "IF_API_TYPE_PIPE":     4,
103         }
104 )
105
106 func (x IfType) String() string {
107         s, ok := IfType_name[uint32(x)]
108         if ok {
109                 return s
110         }
111         return "IfType(" + strconv.Itoa(int(x)) + ")"
112 }
113
114 // LinkDuplex defines enum 'link_duplex'.
115 type LinkDuplex uint32
116
117 const (
118         LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
119         LINK_DUPLEX_API_HALF    LinkDuplex = 1
120         LINK_DUPLEX_API_FULL    LinkDuplex = 2
121 )
122
123 var (
124         LinkDuplex_name = map[uint32]string{
125                 0: "LINK_DUPLEX_API_UNKNOWN",
126                 1: "LINK_DUPLEX_API_HALF",
127                 2: "LINK_DUPLEX_API_FULL",
128         }
129         LinkDuplex_value = map[string]uint32{
130                 "LINK_DUPLEX_API_UNKNOWN": 0,
131                 "LINK_DUPLEX_API_HALF":    1,
132                 "LINK_DUPLEX_API_FULL":    2,
133         }
134 )
135
136 func (x LinkDuplex) String() string {
137         s, ok := LinkDuplex_name[uint32(x)]
138         if ok {
139                 return s
140         }
141         return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
142 }
143
144 // MtuProto defines enum 'mtu_proto'.
145 type MtuProto uint32
146
147 const (
148         MTU_PROTO_API_L3   MtuProto = 1
149         MTU_PROTO_API_IP4  MtuProto = 2
150         MTU_PROTO_API_IP6  MtuProto = 3
151         MTU_PROTO_API_MPLS MtuProto = 4
152         MTU_PROTO_API_N    MtuProto = 5
153 )
154
155 var (
156         MtuProto_name = map[uint32]string{
157                 1: "MTU_PROTO_API_L3",
158                 2: "MTU_PROTO_API_IP4",
159                 3: "MTU_PROTO_API_IP6",
160                 4: "MTU_PROTO_API_MPLS",
161                 5: "MTU_PROTO_API_N",
162         }
163         MtuProto_value = map[string]uint32{
164                 "MTU_PROTO_API_L3":   1,
165                 "MTU_PROTO_API_IP4":  2,
166                 "MTU_PROTO_API_IP6":  3,
167                 "MTU_PROTO_API_MPLS": 4,
168                 "MTU_PROTO_API_N":    5,
169         }
170 )
171
172 func (x MtuProto) String() string {
173         s, ok := MtuProto_name[uint32(x)]
174         if ok {
175                 return s
176         }
177         return "MtuProto(" + strconv.Itoa(int(x)) + ")"
178 }
179
180 // RxMode defines enum 'rx_mode'.
181 type RxMode uint32
182
183 const (
184         RX_MODE_API_UNKNOWN   RxMode = 0
185         RX_MODE_API_POLLING   RxMode = 1
186         RX_MODE_API_INTERRUPT RxMode = 2
187         RX_MODE_API_ADAPTIVE  RxMode = 3
188         RX_MODE_API_DEFAULT   RxMode = 4
189 )
190
191 var (
192         RxMode_name = map[uint32]string{
193                 0: "RX_MODE_API_UNKNOWN",
194                 1: "RX_MODE_API_POLLING",
195                 2: "RX_MODE_API_INTERRUPT",
196                 3: "RX_MODE_API_ADAPTIVE",
197                 4: "RX_MODE_API_DEFAULT",
198         }
199         RxMode_value = map[string]uint32{
200                 "RX_MODE_API_UNKNOWN":   0,
201                 "RX_MODE_API_POLLING":   1,
202                 "RX_MODE_API_INTERRUPT": 2,
203                 "RX_MODE_API_ADAPTIVE":  3,
204                 "RX_MODE_API_DEFAULT":   4,
205         }
206 )
207
208 func (x RxMode) String() string {
209         s, ok := RxMode_name[uint32(x)]
210         if ok {
211                 return s
212         }
213         return "RxMode(" + strconv.Itoa(int(x)) + ")"
214 }
215
216 // SubIfFlags defines enum 'sub_if_flags'.
217 type SubIfFlags uint32
218
219 const (
220         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
221         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
222         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
223         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
224         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
225         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
226         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
227         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
228         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
229         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
230 )
231
232 var (
233         SubIfFlags_name = map[uint32]string{
234                 1:   "SUB_IF_API_FLAG_NO_TAGS",
235                 2:   "SUB_IF_API_FLAG_ONE_TAG",
236                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
237                 8:   "SUB_IF_API_FLAG_DOT1AD",
238                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
239                 32:  "SUB_IF_API_FLAG_DEFAULT",
240                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
241                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
242                 254: "SUB_IF_API_FLAG_MASK_VNET",
243                 256: "SUB_IF_API_FLAG_DOT1AH",
244         }
245         SubIfFlags_value = map[string]uint32{
246                 "SUB_IF_API_FLAG_NO_TAGS":           1,
247                 "SUB_IF_API_FLAG_ONE_TAG":           2,
248                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
249                 "SUB_IF_API_FLAG_DOT1AD":            8,
250                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
251                 "SUB_IF_API_FLAG_DEFAULT":           32,
252                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
253                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
254                 "SUB_IF_API_FLAG_MASK_VNET":         254,
255                 "SUB_IF_API_FLAG_DOT1AH":            256,
256         }
257 )
258
259 func (x SubIfFlags) String() string {
260         s, ok := SubIfFlags_name[uint32(x)]
261         if ok {
262                 return s
263         }
264         str := func(n uint32) string {
265                 s, ok := SubIfFlags_name[uint32(n)]
266                 if ok {
267                         return s
268                 }
269                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
270         }
271         for i := uint32(0); i <= 32; i++ {
272                 val := uint32(x)
273                 if val&(1<<i) != 0 {
274                         if s != "" {
275                                 s += "|"
276                         }
277                         s += str(1 << i)
278                 }
279         }
280         if s == "" {
281                 return str(uint32(x))
282         }
283         return s
284 }
285
286 // VirtioNetFeaturesFirst32 defines enum 'virtio_net_features_first_32'.
287 type VirtioNetFeaturesFirst32 uint32
288
289 const (
290         VIRTIO_NET_F_API_CSUM              VirtioNetFeaturesFirst32 = 1
291         VIRTIO_NET_F_API_GUEST_CSUM        VirtioNetFeaturesFirst32 = 2
292         VIRTIO_NET_F_API_GUEST_TSO4        VirtioNetFeaturesFirst32 = 128
293         VIRTIO_NET_F_API_GUEST_TSO6        VirtioNetFeaturesFirst32 = 256
294         VIRTIO_NET_F_API_GUEST_UFO         VirtioNetFeaturesFirst32 = 1024
295         VIRTIO_NET_F_API_HOST_TSO4         VirtioNetFeaturesFirst32 = 2048
296         VIRTIO_NET_F_API_HOST_TSO6         VirtioNetFeaturesFirst32 = 4096
297         VIRTIO_NET_F_API_HOST_UFO          VirtioNetFeaturesFirst32 = 16384
298         VIRTIO_NET_F_API_MRG_RXBUF         VirtioNetFeaturesFirst32 = 32768
299         VIRTIO_NET_F_API_CTRL_VQ           VirtioNetFeaturesFirst32 = 131072
300         VIRTIO_NET_F_API_GUEST_ANNOUNCE    VirtioNetFeaturesFirst32 = 2097152
301         VIRTIO_NET_F_API_MQ                VirtioNetFeaturesFirst32 = 4194304
302         VHOST_F_API_LOG_ALL                VirtioNetFeaturesFirst32 = 67108864
303         VIRTIO_F_API_ANY_LAYOUT            VirtioNetFeaturesFirst32 = 134217728
304         VIRTIO_F_API_INDIRECT_DESC         VirtioNetFeaturesFirst32 = 268435456
305         VHOST_USER_F_API_PROTOCOL_FEATURES VirtioNetFeaturesFirst32 = 1073741824
306 )
307
308 var (
309         VirtioNetFeaturesFirst32_name = map[uint32]string{
310                 1:          "VIRTIO_NET_F_API_CSUM",
311                 2:          "VIRTIO_NET_F_API_GUEST_CSUM",
312                 128:        "VIRTIO_NET_F_API_GUEST_TSO4",
313                 256:        "VIRTIO_NET_F_API_GUEST_TSO6",
314                 1024:       "VIRTIO_NET_F_API_GUEST_UFO",
315                 2048:       "VIRTIO_NET_F_API_HOST_TSO4",
316                 4096:       "VIRTIO_NET_F_API_HOST_TSO6",
317                 16384:      "VIRTIO_NET_F_API_HOST_UFO",
318                 32768:      "VIRTIO_NET_F_API_MRG_RXBUF",
319                 131072:     "VIRTIO_NET_F_API_CTRL_VQ",
320                 2097152:    "VIRTIO_NET_F_API_GUEST_ANNOUNCE",
321                 4194304:    "VIRTIO_NET_F_API_MQ",
322                 67108864:   "VHOST_F_API_LOG_ALL",
323                 134217728:  "VIRTIO_F_API_ANY_LAYOUT",
324                 268435456:  "VIRTIO_F_API_INDIRECT_DESC",
325                 1073741824: "VHOST_USER_F_API_PROTOCOL_FEATURES",
326         }
327         VirtioNetFeaturesFirst32_value = map[string]uint32{
328                 "VIRTIO_NET_F_API_CSUM":              1,
329                 "VIRTIO_NET_F_API_GUEST_CSUM":        2,
330                 "VIRTIO_NET_F_API_GUEST_TSO4":        128,
331                 "VIRTIO_NET_F_API_GUEST_TSO6":        256,
332                 "VIRTIO_NET_F_API_GUEST_UFO":         1024,
333                 "VIRTIO_NET_F_API_HOST_TSO4":         2048,
334                 "VIRTIO_NET_F_API_HOST_TSO6":         4096,
335                 "VIRTIO_NET_F_API_HOST_UFO":          16384,
336                 "VIRTIO_NET_F_API_MRG_RXBUF":         32768,
337                 "VIRTIO_NET_F_API_CTRL_VQ":           131072,
338                 "VIRTIO_NET_F_API_GUEST_ANNOUNCE":    2097152,
339                 "VIRTIO_NET_F_API_MQ":                4194304,
340                 "VHOST_F_API_LOG_ALL":                67108864,
341                 "VIRTIO_F_API_ANY_LAYOUT":            134217728,
342                 "VIRTIO_F_API_INDIRECT_DESC":         268435456,
343                 "VHOST_USER_F_API_PROTOCOL_FEATURES": 1073741824,
344         }
345 )
346
347 func (x VirtioNetFeaturesFirst32) String() string {
348         s, ok := VirtioNetFeaturesFirst32_name[uint32(x)]
349         if ok {
350                 return s
351         }
352         return "VirtioNetFeaturesFirst32(" + strconv.Itoa(int(x)) + ")"
353 }
354
355 // VirtioNetFeaturesLast32 defines enum 'virtio_net_features_last_32'.
356 type VirtioNetFeaturesLast32 uint32
357
358 const (
359         VIRTIO_F_API_VERSION_1 VirtioNetFeaturesLast32 = 1
360 )
361
362 var (
363         VirtioNetFeaturesLast32_name = map[uint32]string{
364                 1: "VIRTIO_F_API_VERSION_1",
365         }
366         VirtioNetFeaturesLast32_value = map[string]uint32{
367                 "VIRTIO_F_API_VERSION_1": 1,
368         }
369 )
370
371 func (x VirtioNetFeaturesLast32) String() string {
372         s, ok := VirtioNetFeaturesLast32_name[uint32(x)]
373         if ok {
374                 return s
375         }
376         return "VirtioNetFeaturesLast32(" + strconv.Itoa(int(x)) + ")"
377 }
378
379 // InterfaceIndex defines alias 'interface_index'.
380 type InterfaceIndex uint32
381
382 // MacAddress defines alias 'mac_address'.
383 type MacAddress [6]uint8
384
385 func ParseMacAddress(s string) (MacAddress, error) {
386         var macaddr MacAddress
387         mac, err := net.ParseMAC(s)
388         if err != nil {
389                 return macaddr, err
390         }
391         copy(macaddr[:], mac[:])
392         return macaddr, nil
393 }
394 func (x MacAddress) ToMAC() net.HardwareAddr {
395         return net.HardwareAddr(x[:])
396 }
397 func (x MacAddress) String() string {
398         return x.ToMAC().String()
399 }
400 func (x *MacAddress) MarshalText() ([]byte, error) {
401         return []byte(x.String()), nil
402 }
403 func (x *MacAddress) UnmarshalText(text []byte) error {
404         mac, err := ParseMacAddress(string(text))
405         if err != nil {
406                 return err
407         }
408         *x = mac
409         return nil
410 }
411
412 // CreateVhostUserIf defines message 'create_vhost_user_if'.
413 type CreateVhostUserIf struct {
414         IsServer            bool       `binapi:"bool,name=is_server" json:"is_server,omitempty"`
415         SockFilename        string     `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"`
416         Renumber            bool       `binapi:"bool,name=renumber" json:"renumber,omitempty"`
417         DisableMrgRxbuf     bool       `binapi:"bool,name=disable_mrg_rxbuf" json:"disable_mrg_rxbuf,omitempty"`
418         DisableIndirectDesc bool       `binapi:"bool,name=disable_indirect_desc" json:"disable_indirect_desc,omitempty"`
419         EnableGso           bool       `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"`
420         CustomDevInstance   uint32     `binapi:"u32,name=custom_dev_instance" json:"custom_dev_instance,omitempty"`
421         UseCustomMac        bool       `binapi:"bool,name=use_custom_mac" json:"use_custom_mac,omitempty"`
422         MacAddress          MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
423         Tag                 string     `binapi:"string[64],name=tag" json:"tag,omitempty"`
424 }
425
426 func (m *CreateVhostUserIf) Reset()               { *m = CreateVhostUserIf{} }
427 func (*CreateVhostUserIf) GetMessageName() string { return "create_vhost_user_if" }
428 func (*CreateVhostUserIf) GetCrcString() string   { return "591ee951" }
429 func (*CreateVhostUserIf) GetMessageType() api.MessageType {
430         return api.RequestMessage
431 }
432
433 func (m *CreateVhostUserIf) Size() (size int) {
434         if m == nil {
435                 return 0
436         }
437         size += 1     // m.IsServer
438         size += 256   // m.SockFilename
439         size += 1     // m.Renumber
440         size += 1     // m.DisableMrgRxbuf
441         size += 1     // m.DisableIndirectDesc
442         size += 1     // m.EnableGso
443         size += 4     // m.CustomDevInstance
444         size += 1     // m.UseCustomMac
445         size += 1 * 6 // m.MacAddress
446         size += 64    // m.Tag
447         return size
448 }
449 func (m *CreateVhostUserIf) Marshal(b []byte) ([]byte, error) {
450         if b == nil {
451                 b = make([]byte, m.Size())
452         }
453         buf := codec.NewBuffer(b)
454         buf.EncodeBool(m.IsServer)
455         buf.EncodeString(m.SockFilename, 256)
456         buf.EncodeBool(m.Renumber)
457         buf.EncodeBool(m.DisableMrgRxbuf)
458         buf.EncodeBool(m.DisableIndirectDesc)
459         buf.EncodeBool(m.EnableGso)
460         buf.EncodeUint32(m.CustomDevInstance)
461         buf.EncodeBool(m.UseCustomMac)
462         buf.EncodeBytes(m.MacAddress[:], 6)
463         buf.EncodeString(m.Tag, 64)
464         return buf.Bytes(), nil
465 }
466 func (m *CreateVhostUserIf) Unmarshal(b []byte) error {
467         buf := codec.NewBuffer(b)
468         m.IsServer = buf.DecodeBool()
469         m.SockFilename = buf.DecodeString(256)
470         m.Renumber = buf.DecodeBool()
471         m.DisableMrgRxbuf = buf.DecodeBool()
472         m.DisableIndirectDesc = buf.DecodeBool()
473         m.EnableGso = buf.DecodeBool()
474         m.CustomDevInstance = buf.DecodeUint32()
475         m.UseCustomMac = buf.DecodeBool()
476         copy(m.MacAddress[:], buf.DecodeBytes(6))
477         m.Tag = buf.DecodeString(64)
478         return nil
479 }
480
481 // CreateVhostUserIfReply defines message 'create_vhost_user_if_reply'.
482 type CreateVhostUserIfReply struct {
483         Retval    int32          `binapi:"i32,name=retval" json:"retval,omitempty"`
484         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
485 }
486
487 func (m *CreateVhostUserIfReply) Reset()               { *m = CreateVhostUserIfReply{} }
488 func (*CreateVhostUserIfReply) GetMessageName() string { return "create_vhost_user_if_reply" }
489 func (*CreateVhostUserIfReply) GetCrcString() string   { return "5383d31f" }
490 func (*CreateVhostUserIfReply) GetMessageType() api.MessageType {
491         return api.ReplyMessage
492 }
493
494 func (m *CreateVhostUserIfReply) Size() (size int) {
495         if m == nil {
496                 return 0
497         }
498         size += 4 // m.Retval
499         size += 4 // m.SwIfIndex
500         return size
501 }
502 func (m *CreateVhostUserIfReply) Marshal(b []byte) ([]byte, error) {
503         if b == nil {
504                 b = make([]byte, m.Size())
505         }
506         buf := codec.NewBuffer(b)
507         buf.EncodeInt32(m.Retval)
508         buf.EncodeUint32(uint32(m.SwIfIndex))
509         return buf.Bytes(), nil
510 }
511 func (m *CreateVhostUserIfReply) Unmarshal(b []byte) error {
512         buf := codec.NewBuffer(b)
513         m.Retval = buf.DecodeInt32()
514         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
515         return nil
516 }
517
518 // DeleteVhostUserIf defines message 'delete_vhost_user_if'.
519 type DeleteVhostUserIf struct {
520         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
521 }
522
523 func (m *DeleteVhostUserIf) Reset()               { *m = DeleteVhostUserIf{} }
524 func (*DeleteVhostUserIf) GetMessageName() string { return "delete_vhost_user_if" }
525 func (*DeleteVhostUserIf) GetCrcString() string   { return "f9e6675e" }
526 func (*DeleteVhostUserIf) GetMessageType() api.MessageType {
527         return api.RequestMessage
528 }
529
530 func (m *DeleteVhostUserIf) Size() (size int) {
531         if m == nil {
532                 return 0
533         }
534         size += 4 // m.SwIfIndex
535         return size
536 }
537 func (m *DeleteVhostUserIf) Marshal(b []byte) ([]byte, error) {
538         if b == nil {
539                 b = make([]byte, m.Size())
540         }
541         buf := codec.NewBuffer(b)
542         buf.EncodeUint32(uint32(m.SwIfIndex))
543         return buf.Bytes(), nil
544 }
545 func (m *DeleteVhostUserIf) Unmarshal(b []byte) error {
546         buf := codec.NewBuffer(b)
547         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
548         return nil
549 }
550
551 // DeleteVhostUserIfReply defines message 'delete_vhost_user_if_reply'.
552 type DeleteVhostUserIfReply struct {
553         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
554 }
555
556 func (m *DeleteVhostUserIfReply) Reset()               { *m = DeleteVhostUserIfReply{} }
557 func (*DeleteVhostUserIfReply) GetMessageName() string { return "delete_vhost_user_if_reply" }
558 func (*DeleteVhostUserIfReply) GetCrcString() string   { return "e8d4e804" }
559 func (*DeleteVhostUserIfReply) GetMessageType() api.MessageType {
560         return api.ReplyMessage
561 }
562
563 func (m *DeleteVhostUserIfReply) Size() (size int) {
564         if m == nil {
565                 return 0
566         }
567         size += 4 // m.Retval
568         return size
569 }
570 func (m *DeleteVhostUserIfReply) Marshal(b []byte) ([]byte, error) {
571         if b == nil {
572                 b = make([]byte, m.Size())
573         }
574         buf := codec.NewBuffer(b)
575         buf.EncodeInt32(m.Retval)
576         return buf.Bytes(), nil
577 }
578 func (m *DeleteVhostUserIfReply) Unmarshal(b []byte) error {
579         buf := codec.NewBuffer(b)
580         m.Retval = buf.DecodeInt32()
581         return nil
582 }
583
584 // ModifyVhostUserIf defines message 'modify_vhost_user_if'.
585 type ModifyVhostUserIf struct {
586         SwIfIndex         InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
587         IsServer          bool           `binapi:"bool,name=is_server" json:"is_server,omitempty"`
588         SockFilename      string         `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"`
589         Renumber          bool           `binapi:"bool,name=renumber" json:"renumber,omitempty"`
590         EnableGso         bool           `binapi:"bool,name=enable_gso" json:"enable_gso,omitempty"`
591         CustomDevInstance uint32         `binapi:"u32,name=custom_dev_instance" json:"custom_dev_instance,omitempty"`
592 }
593
594 func (m *ModifyVhostUserIf) Reset()               { *m = ModifyVhostUserIf{} }
595 func (*ModifyVhostUserIf) GetMessageName() string { return "modify_vhost_user_if" }
596 func (*ModifyVhostUserIf) GetCrcString() string   { return "fcfeaf16" }
597 func (*ModifyVhostUserIf) GetMessageType() api.MessageType {
598         return api.RequestMessage
599 }
600
601 func (m *ModifyVhostUserIf) Size() (size int) {
602         if m == nil {
603                 return 0
604         }
605         size += 4   // m.SwIfIndex
606         size += 1   // m.IsServer
607         size += 256 // m.SockFilename
608         size += 1   // m.Renumber
609         size += 1   // m.EnableGso
610         size += 4   // m.CustomDevInstance
611         return size
612 }
613 func (m *ModifyVhostUserIf) Marshal(b []byte) ([]byte, error) {
614         if b == nil {
615                 b = make([]byte, m.Size())
616         }
617         buf := codec.NewBuffer(b)
618         buf.EncodeUint32(uint32(m.SwIfIndex))
619         buf.EncodeBool(m.IsServer)
620         buf.EncodeString(m.SockFilename, 256)
621         buf.EncodeBool(m.Renumber)
622         buf.EncodeBool(m.EnableGso)
623         buf.EncodeUint32(m.CustomDevInstance)
624         return buf.Bytes(), nil
625 }
626 func (m *ModifyVhostUserIf) Unmarshal(b []byte) error {
627         buf := codec.NewBuffer(b)
628         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
629         m.IsServer = buf.DecodeBool()
630         m.SockFilename = buf.DecodeString(256)
631         m.Renumber = buf.DecodeBool()
632         m.EnableGso = buf.DecodeBool()
633         m.CustomDevInstance = buf.DecodeUint32()
634         return nil
635 }
636
637 // ModifyVhostUserIfReply defines message 'modify_vhost_user_if_reply'.
638 type ModifyVhostUserIfReply struct {
639         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
640 }
641
642 func (m *ModifyVhostUserIfReply) Reset()               { *m = ModifyVhostUserIfReply{} }
643 func (*ModifyVhostUserIfReply) GetMessageName() string { return "modify_vhost_user_if_reply" }
644 func (*ModifyVhostUserIfReply) GetCrcString() string   { return "e8d4e804" }
645 func (*ModifyVhostUserIfReply) GetMessageType() api.MessageType {
646         return api.ReplyMessage
647 }
648
649 func (m *ModifyVhostUserIfReply) Size() (size int) {
650         if m == nil {
651                 return 0
652         }
653         size += 4 // m.Retval
654         return size
655 }
656 func (m *ModifyVhostUserIfReply) Marshal(b []byte) ([]byte, error) {
657         if b == nil {
658                 b = make([]byte, m.Size())
659         }
660         buf := codec.NewBuffer(b)
661         buf.EncodeInt32(m.Retval)
662         return buf.Bytes(), nil
663 }
664 func (m *ModifyVhostUserIfReply) Unmarshal(b []byte) error {
665         buf := codec.NewBuffer(b)
666         m.Retval = buf.DecodeInt32()
667         return nil
668 }
669
670 // SwInterfaceVhostUserDetails defines message 'sw_interface_vhost_user_details'.
671 type SwInterfaceVhostUserDetails struct {
672         SwIfIndex       InterfaceIndex           `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
673         InterfaceName   string                   `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"`
674         VirtioNetHdrSz  uint32                   `binapi:"u32,name=virtio_net_hdr_sz" json:"virtio_net_hdr_sz,omitempty"`
675         FeaturesFirst32 VirtioNetFeaturesFirst32 `binapi:"virtio_net_features_first_32,name=features_first_32" json:"features_first_32,omitempty"`
676         FeaturesLast32  VirtioNetFeaturesLast32  `binapi:"virtio_net_features_last_32,name=features_last_32" json:"features_last_32,omitempty"`
677         IsServer        bool                     `binapi:"bool,name=is_server" json:"is_server,omitempty"`
678         SockFilename    string                   `binapi:"string[256],name=sock_filename" json:"sock_filename,omitempty"`
679         NumRegions      uint32                   `binapi:"u32,name=num_regions" json:"num_regions,omitempty"`
680         SockErrno       int32                    `binapi:"i32,name=sock_errno" json:"sock_errno,omitempty"`
681 }
682
683 func (m *SwInterfaceVhostUserDetails) Reset()               { *m = SwInterfaceVhostUserDetails{} }
684 func (*SwInterfaceVhostUserDetails) GetMessageName() string { return "sw_interface_vhost_user_details" }
685 func (*SwInterfaceVhostUserDetails) GetCrcString() string   { return "98530df1" }
686 func (*SwInterfaceVhostUserDetails) GetMessageType() api.MessageType {
687         return api.ReplyMessage
688 }
689
690 func (m *SwInterfaceVhostUserDetails) Size() (size int) {
691         if m == nil {
692                 return 0
693         }
694         size += 4   // m.SwIfIndex
695         size += 64  // m.InterfaceName
696         size += 4   // m.VirtioNetHdrSz
697         size += 4   // m.FeaturesFirst32
698         size += 4   // m.FeaturesLast32
699         size += 1   // m.IsServer
700         size += 256 // m.SockFilename
701         size += 4   // m.NumRegions
702         size += 4   // m.SockErrno
703         return size
704 }
705 func (m *SwInterfaceVhostUserDetails) Marshal(b []byte) ([]byte, error) {
706         if b == nil {
707                 b = make([]byte, m.Size())
708         }
709         buf := codec.NewBuffer(b)
710         buf.EncodeUint32(uint32(m.SwIfIndex))
711         buf.EncodeString(m.InterfaceName, 64)
712         buf.EncodeUint32(m.VirtioNetHdrSz)
713         buf.EncodeUint32(uint32(m.FeaturesFirst32))
714         buf.EncodeUint32(uint32(m.FeaturesLast32))
715         buf.EncodeBool(m.IsServer)
716         buf.EncodeString(m.SockFilename, 256)
717         buf.EncodeUint32(m.NumRegions)
718         buf.EncodeInt32(m.SockErrno)
719         return buf.Bytes(), nil
720 }
721 func (m *SwInterfaceVhostUserDetails) Unmarshal(b []byte) error {
722         buf := codec.NewBuffer(b)
723         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
724         m.InterfaceName = buf.DecodeString(64)
725         m.VirtioNetHdrSz = buf.DecodeUint32()
726         m.FeaturesFirst32 = VirtioNetFeaturesFirst32(buf.DecodeUint32())
727         m.FeaturesLast32 = VirtioNetFeaturesLast32(buf.DecodeUint32())
728         m.IsServer = buf.DecodeBool()
729         m.SockFilename = buf.DecodeString(256)
730         m.NumRegions = buf.DecodeUint32()
731         m.SockErrno = buf.DecodeInt32()
732         return nil
733 }
734
735 // SwInterfaceVhostUserDump defines message 'sw_interface_vhost_user_dump'.
736 type SwInterfaceVhostUserDump struct {
737         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
738 }
739
740 func (m *SwInterfaceVhostUserDump) Reset()               { *m = SwInterfaceVhostUserDump{} }
741 func (*SwInterfaceVhostUserDump) GetMessageName() string { return "sw_interface_vhost_user_dump" }
742 func (*SwInterfaceVhostUserDump) GetCrcString() string   { return "f9e6675e" }
743 func (*SwInterfaceVhostUserDump) GetMessageType() api.MessageType {
744         return api.RequestMessage
745 }
746
747 func (m *SwInterfaceVhostUserDump) Size() (size int) {
748         if m == nil {
749                 return 0
750         }
751         size += 4 // m.SwIfIndex
752         return size
753 }
754 func (m *SwInterfaceVhostUserDump) Marshal(b []byte) ([]byte, error) {
755         if b == nil {
756                 b = make([]byte, m.Size())
757         }
758         buf := codec.NewBuffer(b)
759         buf.EncodeUint32(uint32(m.SwIfIndex))
760         return buf.Bytes(), nil
761 }
762 func (m *SwInterfaceVhostUserDump) Unmarshal(b []byte) error {
763         buf := codec.NewBuffer(b)
764         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
765         return nil
766 }
767
768 func init() { file_vhost_user_binapi_init() }
769 func file_vhost_user_binapi_init() {
770         api.RegisterMessage((*CreateVhostUserIf)(nil), "create_vhost_user_if_591ee951")
771         api.RegisterMessage((*CreateVhostUserIfReply)(nil), "create_vhost_user_if_reply_5383d31f")
772         api.RegisterMessage((*DeleteVhostUserIf)(nil), "delete_vhost_user_if_f9e6675e")
773         api.RegisterMessage((*DeleteVhostUserIfReply)(nil), "delete_vhost_user_if_reply_e8d4e804")
774         api.RegisterMessage((*ModifyVhostUserIf)(nil), "modify_vhost_user_if_fcfeaf16")
775         api.RegisterMessage((*ModifyVhostUserIfReply)(nil), "modify_vhost_user_if_reply_e8d4e804")
776         api.RegisterMessage((*SwInterfaceVhostUserDetails)(nil), "sw_interface_vhost_user_details_98530df1")
777         api.RegisterMessage((*SwInterfaceVhostUserDump)(nil), "sw_interface_vhost_user_dump_f9e6675e")
778 }
779
780 // Messages returns list of all messages in this module.
781 func AllMessages() []api.Message {
782         return []api.Message{
783                 (*CreateVhostUserIf)(nil),
784                 (*CreateVhostUserIfReply)(nil),
785                 (*DeleteVhostUserIf)(nil),
786                 (*DeleteVhostUserIfReply)(nil),
787                 (*ModifyVhostUserIf)(nil),
788                 (*ModifyVhostUserIfReply)(nil),
789                 (*SwInterfaceVhostUserDetails)(nil),
790                 (*SwInterfaceVhostUserDump)(nil),
791         }
792 }