Refactored binapi generator with message encoding
[govpp.git] / examples / binapi / memif / memif.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.4.0-alpha-1-g435c3f4-dirty
4 //  VPP:              20.01-45~g7a071e370~b63
5 // source: /usr/share/vpp/api/plugins/memif.api.json
6
7 /*
8 Package memif contains generated code for VPP binary API defined by memif.api (version 3.0.0).
9
10 It consists of:
11           2 aliases
12           8 enums
13          10 messages
14 */
15 package memif
16
17 import (
18         "bytes"
19         "context"
20         "encoding/binary"
21         "io"
22         "math"
23         "strconv"
24
25         api "git.fd.io/govpp.git/api"
26         codec "git.fd.io/govpp.git/codec"
27         struc "github.com/lunixbochs/struc"
28 )
29
30 // This is a compile-time assertion to ensure that this generated file
31 // is compatible with the GoVPP api package it is being compiled against.
32 // A compilation error at this line likely means your copy of the
33 // GoVPP api package needs to be updated.
34 const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package
35
36 const (
37         // ModuleName is the name of this module.
38         ModuleName = "memif"
39         // APIVersion is the API version of this module.
40         APIVersion = "3.0.0"
41         // VersionCrc is the CRC of this module.
42         VersionCrc = 0x88dc56c9
43 )
44
45 // IfStatusFlags represents VPP binary API enum 'if_status_flags'.
46 type IfStatusFlags uint32
47
48 const (
49         IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
50         IF_STATUS_API_FLAG_LINK_UP  IfStatusFlags = 2
51 )
52
53 var (
54         IfStatusFlags_name = map[uint32]string{
55                 1: "IF_STATUS_API_FLAG_ADMIN_UP",
56                 2: "IF_STATUS_API_FLAG_LINK_UP",
57         }
58         IfStatusFlags_value = map[string]uint32{
59                 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
60                 "IF_STATUS_API_FLAG_LINK_UP":  2,
61         }
62 )
63
64 func (x IfStatusFlags) String() string {
65         s, ok := IfStatusFlags_name[uint32(x)]
66         if ok {
67                 return s
68         }
69         return "IfStatusFlags(" + strconv.Itoa(int(x)) + ")"
70 }
71
72 // IfType represents VPP binary API enum 'if_type'.
73 type IfType uint32
74
75 const (
76         IF_API_TYPE_HARDWARE IfType = 1
77         IF_API_TYPE_SUB      IfType = 2
78         IF_API_TYPE_P2P      IfType = 3
79         IF_API_TYPE_PIPE     IfType = 4
80 )
81
82 var (
83         IfType_name = map[uint32]string{
84                 1: "IF_API_TYPE_HARDWARE",
85                 2: "IF_API_TYPE_SUB",
86                 3: "IF_API_TYPE_P2P",
87                 4: "IF_API_TYPE_PIPE",
88         }
89         IfType_value = map[string]uint32{
90                 "IF_API_TYPE_HARDWARE": 1,
91                 "IF_API_TYPE_SUB":      2,
92                 "IF_API_TYPE_P2P":      3,
93                 "IF_API_TYPE_PIPE":     4,
94         }
95 )
96
97 func (x IfType) String() string {
98         s, ok := IfType_name[uint32(x)]
99         if ok {
100                 return s
101         }
102         return "IfType(" + strconv.Itoa(int(x)) + ")"
103 }
104
105 // LinkDuplex represents VPP binary API enum 'link_duplex'.
106 type LinkDuplex uint32
107
108 const (
109         LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
110         LINK_DUPLEX_API_HALF    LinkDuplex = 1
111         LINK_DUPLEX_API_FULL    LinkDuplex = 2
112 )
113
114 var (
115         LinkDuplex_name = map[uint32]string{
116                 0: "LINK_DUPLEX_API_UNKNOWN",
117                 1: "LINK_DUPLEX_API_HALF",
118                 2: "LINK_DUPLEX_API_FULL",
119         }
120         LinkDuplex_value = map[string]uint32{
121                 "LINK_DUPLEX_API_UNKNOWN": 0,
122                 "LINK_DUPLEX_API_HALF":    1,
123                 "LINK_DUPLEX_API_FULL":    2,
124         }
125 )
126
127 func (x LinkDuplex) String() string {
128         s, ok := LinkDuplex_name[uint32(x)]
129         if ok {
130                 return s
131         }
132         return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
133 }
134
135 // MemifMode represents VPP binary API enum 'memif_mode'.
136 type MemifMode uint32
137
138 const (
139         MEMIF_MODE_API_ETHERNET    MemifMode = 0
140         MEMIF_MODE_API_IP          MemifMode = 1
141         MEMIF_MODE_API_PUNT_INJECT MemifMode = 2
142 )
143
144 var (
145         MemifMode_name = map[uint32]string{
146                 0: "MEMIF_MODE_API_ETHERNET",
147                 1: "MEMIF_MODE_API_IP",
148                 2: "MEMIF_MODE_API_PUNT_INJECT",
149         }
150         MemifMode_value = map[string]uint32{
151                 "MEMIF_MODE_API_ETHERNET":    0,
152                 "MEMIF_MODE_API_IP":          1,
153                 "MEMIF_MODE_API_PUNT_INJECT": 2,
154         }
155 )
156
157 func (x MemifMode) String() string {
158         s, ok := MemifMode_name[uint32(x)]
159         if ok {
160                 return s
161         }
162         return "MemifMode(" + strconv.Itoa(int(x)) + ")"
163 }
164
165 // MemifRole represents VPP binary API enum 'memif_role'.
166 type MemifRole uint32
167
168 const (
169         MEMIF_ROLE_API_MASTER MemifRole = 0
170         MEMIF_ROLE_API_SLAVE  MemifRole = 1
171 )
172
173 var (
174         MemifRole_name = map[uint32]string{
175                 0: "MEMIF_ROLE_API_MASTER",
176                 1: "MEMIF_ROLE_API_SLAVE",
177         }
178         MemifRole_value = map[string]uint32{
179                 "MEMIF_ROLE_API_MASTER": 0,
180                 "MEMIF_ROLE_API_SLAVE":  1,
181         }
182 )
183
184 func (x MemifRole) String() string {
185         s, ok := MemifRole_name[uint32(x)]
186         if ok {
187                 return s
188         }
189         return "MemifRole(" + strconv.Itoa(int(x)) + ")"
190 }
191
192 // MtuProto represents VPP binary API enum 'mtu_proto'.
193 type MtuProto uint32
194
195 const (
196         MTU_PROTO_API_L3   MtuProto = 1
197         MTU_PROTO_API_IP4  MtuProto = 2
198         MTU_PROTO_API_IP6  MtuProto = 3
199         MTU_PROTO_API_MPLS MtuProto = 4
200         MTU_PROTO_API_N    MtuProto = 5
201 )
202
203 var (
204         MtuProto_name = map[uint32]string{
205                 1: "MTU_PROTO_API_L3",
206                 2: "MTU_PROTO_API_IP4",
207                 3: "MTU_PROTO_API_IP6",
208                 4: "MTU_PROTO_API_MPLS",
209                 5: "MTU_PROTO_API_N",
210         }
211         MtuProto_value = map[string]uint32{
212                 "MTU_PROTO_API_L3":   1,
213                 "MTU_PROTO_API_IP4":  2,
214                 "MTU_PROTO_API_IP6":  3,
215                 "MTU_PROTO_API_MPLS": 4,
216                 "MTU_PROTO_API_N":    5,
217         }
218 )
219
220 func (x MtuProto) String() string {
221         s, ok := MtuProto_name[uint32(x)]
222         if ok {
223                 return s
224         }
225         return "MtuProto(" + strconv.Itoa(int(x)) + ")"
226 }
227
228 // RxMode represents VPP binary API enum 'rx_mode'.
229 type RxMode uint32
230
231 const (
232         RX_MODE_API_UNKNOWN   RxMode = 0
233         RX_MODE_API_POLLING   RxMode = 1
234         RX_MODE_API_INTERRUPT RxMode = 2
235         RX_MODE_API_ADAPTIVE  RxMode = 3
236         RX_MODE_API_DEFAULT   RxMode = 4
237 )
238
239 var (
240         RxMode_name = map[uint32]string{
241                 0: "RX_MODE_API_UNKNOWN",
242                 1: "RX_MODE_API_POLLING",
243                 2: "RX_MODE_API_INTERRUPT",
244                 3: "RX_MODE_API_ADAPTIVE",
245                 4: "RX_MODE_API_DEFAULT",
246         }
247         RxMode_value = map[string]uint32{
248                 "RX_MODE_API_UNKNOWN":   0,
249                 "RX_MODE_API_POLLING":   1,
250                 "RX_MODE_API_INTERRUPT": 2,
251                 "RX_MODE_API_ADAPTIVE":  3,
252                 "RX_MODE_API_DEFAULT":   4,
253         }
254 )
255
256 func (x RxMode) String() string {
257         s, ok := RxMode_name[uint32(x)]
258         if ok {
259                 return s
260         }
261         return "RxMode(" + strconv.Itoa(int(x)) + ")"
262 }
263
264 // SubIfFlags represents VPP binary API enum 'sub_if_flags'.
265 type SubIfFlags uint32
266
267 const (
268         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
269         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
270         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
271         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
272         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
273         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
274         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
275         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
276         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
277         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
278 )
279
280 var (
281         SubIfFlags_name = map[uint32]string{
282                 1:   "SUB_IF_API_FLAG_NO_TAGS",
283                 2:   "SUB_IF_API_FLAG_ONE_TAG",
284                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
285                 8:   "SUB_IF_API_FLAG_DOT1AD",
286                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
287                 32:  "SUB_IF_API_FLAG_DEFAULT",
288                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
289                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
290                 254: "SUB_IF_API_FLAG_MASK_VNET",
291                 256: "SUB_IF_API_FLAG_DOT1AH",
292         }
293         SubIfFlags_value = map[string]uint32{
294                 "SUB_IF_API_FLAG_NO_TAGS":           1,
295                 "SUB_IF_API_FLAG_ONE_TAG":           2,
296                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
297                 "SUB_IF_API_FLAG_DOT1AD":            8,
298                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
299                 "SUB_IF_API_FLAG_DEFAULT":           32,
300                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
301                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
302                 "SUB_IF_API_FLAG_MASK_VNET":         254,
303                 "SUB_IF_API_FLAG_DOT1AH":            256,
304         }
305 )
306
307 func (x SubIfFlags) String() string {
308         s, ok := SubIfFlags_name[uint32(x)]
309         if ok {
310                 return s
311         }
312         return "SubIfFlags(" + strconv.Itoa(int(x)) + ")"
313 }
314
315 // InterfaceIndex represents VPP binary API alias 'interface_index'.
316 type InterfaceIndex uint32
317
318 // MacAddress represents VPP binary API alias 'mac_address'.
319 type MacAddress [6]uint8
320
321 // MemifCreate represents VPP binary API message 'memif_create'.
322 type MemifCreate struct {
323         Role       MemifRole  `binapi:"memif_role,name=role" json:"role,omitempty"`
324         Mode       MemifMode  `binapi:"memif_mode,name=mode" json:"mode,omitempty"`
325         RxQueues   uint8      `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"`
326         TxQueues   uint8      `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"`
327         ID         uint32     `binapi:"u32,name=id" json:"id,omitempty"`
328         SocketID   uint32     `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
329         RingSize   uint32     `binapi:"u32,name=ring_size" json:"ring_size,omitempty"`
330         BufferSize uint16     `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"`
331         NoZeroCopy bool       `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"`
332         HwAddr     MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
333         Secret     string     `binapi:"string[24],name=secret" json:"secret,omitempty" struc:"[24]byte"`
334 }
335
336 func (m *MemifCreate) Reset()                        { *m = MemifCreate{} }
337 func (*MemifCreate) GetMessageName() string          { return "memif_create" }
338 func (*MemifCreate) GetCrcString() string            { return "b1b25061" }
339 func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage }
340
341 func (m *MemifCreate) Size() int {
342         if m == nil {
343                 return 0
344         }
345         var size int
346         // field[1] m.Role
347         size += 4
348         // field[1] m.Mode
349         size += 4
350         // field[1] m.RxQueues
351         size += 1
352         // field[1] m.TxQueues
353         size += 1
354         // field[1] m.ID
355         size += 4
356         // field[1] m.SocketID
357         size += 4
358         // field[1] m.RingSize
359         size += 4
360         // field[1] m.BufferSize
361         size += 2
362         // field[1] m.NoZeroCopy
363         size += 1
364         // field[1] m.HwAddr
365         size += 6
366         // field[1] m.Secret
367         size += 24
368         return size
369 }
370 func (m *MemifCreate) Marshal(b []byte) ([]byte, error) {
371         o := binary.BigEndian
372         _ = o
373         pos := 0
374         _ = pos
375         var buf []byte
376         if b == nil {
377                 buf = make([]byte, m.Size())
378         } else {
379                 buf = b
380         }
381         // field[1] m.Role
382         o.PutUint32(buf[pos:pos+4], uint32(m.Role))
383         pos += 4
384         // field[1] m.Mode
385         o.PutUint32(buf[pos:pos+4], uint32(m.Mode))
386         pos += 4
387         // field[1] m.RxQueues
388         buf[pos] = uint8(m.RxQueues)
389         pos += 1
390         // field[1] m.TxQueues
391         buf[pos] = uint8(m.TxQueues)
392         pos += 1
393         // field[1] m.ID
394         o.PutUint32(buf[pos:pos+4], uint32(m.ID))
395         pos += 4
396         // field[1] m.SocketID
397         o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
398         pos += 4
399         // field[1] m.RingSize
400         o.PutUint32(buf[pos:pos+4], uint32(m.RingSize))
401         pos += 4
402         // field[1] m.BufferSize
403         o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize))
404         pos += 2
405         // field[1] m.NoZeroCopy
406         if m.NoZeroCopy {
407                 buf[pos] = 1
408         }
409         pos += 1
410         // field[1] m.HwAddr
411         for i := 0; i < 6; i++ {
412                 var x uint8
413                 if i < len(m.HwAddr) {
414                         x = uint8(m.HwAddr[i])
415                 }
416                 buf[pos] = uint8(x)
417                 pos += 1
418         }
419         // field[1] m.Secret
420         copy(buf[pos:pos+24], m.Secret)
421         pos += 24
422         return buf, nil
423 }
424 func (m *MemifCreate) Unmarshal(tmp []byte) error {
425         o := binary.BigEndian
426         _ = o
427         pos := 0
428         _ = pos
429         // field[1] m.Role
430         m.Role = MemifRole(o.Uint32(tmp[pos : pos+4]))
431         pos += 4
432         // field[1] m.Mode
433         m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4]))
434         pos += 4
435         // field[1] m.RxQueues
436         m.RxQueues = uint8(tmp[pos])
437         pos += 1
438         // field[1] m.TxQueues
439         m.TxQueues = uint8(tmp[pos])
440         pos += 1
441         // field[1] m.ID
442         m.ID = uint32(o.Uint32(tmp[pos : pos+4]))
443         pos += 4
444         // field[1] m.SocketID
445         m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
446         pos += 4
447         // field[1] m.RingSize
448         m.RingSize = uint32(o.Uint32(tmp[pos : pos+4]))
449         pos += 4
450         // field[1] m.BufferSize
451         m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2]))
452         pos += 2
453         // field[1] m.NoZeroCopy
454         m.NoZeroCopy = tmp[pos] != 0
455         pos += 1
456         // field[1] m.HwAddr
457         for i := 0; i < len(m.HwAddr); i++ {
458                 m.HwAddr[i] = uint8(tmp[pos])
459                 pos += 1
460         }
461         // field[1] m.Secret
462         {
463                 nul := bytes.Index(tmp[pos:pos+24], []byte{0x00})
464                 m.Secret = codec.DecodeString(tmp[pos : pos+nul])
465                 pos += 24
466         }
467         return nil
468 }
469
470 // MemifCreateReply represents VPP binary API message 'memif_create_reply'.
471 type MemifCreateReply struct {
472         Retval    int32          `binapi:"i32,name=retval" json:"retval,omitempty"`
473         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
474 }
475
476 func (m *MemifCreateReply) Reset()                        { *m = MemifCreateReply{} }
477 func (*MemifCreateReply) GetMessageName() string          { return "memif_create_reply" }
478 func (*MemifCreateReply) GetCrcString() string            { return "5383d31f" }
479 func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage }
480
481 func (m *MemifCreateReply) Size() int {
482         if m == nil {
483                 return 0
484         }
485         var size int
486         // field[1] m.Retval
487         size += 4
488         // field[1] m.SwIfIndex
489         size += 4
490         return size
491 }
492 func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) {
493         o := binary.BigEndian
494         _ = o
495         pos := 0
496         _ = pos
497         var buf []byte
498         if b == nil {
499                 buf = make([]byte, m.Size())
500         } else {
501                 buf = b
502         }
503         // field[1] m.Retval
504         o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
505         pos += 4
506         // field[1] m.SwIfIndex
507         o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
508         pos += 4
509         return buf, nil
510 }
511 func (m *MemifCreateReply) Unmarshal(tmp []byte) error {
512         o := binary.BigEndian
513         _ = o
514         pos := 0
515         _ = pos
516         // field[1] m.Retval
517         m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
518         pos += 4
519         // field[1] m.SwIfIndex
520         m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
521         pos += 4
522         return nil
523 }
524
525 // MemifDelete represents VPP binary API message 'memif_delete'.
526 type MemifDelete struct {
527         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
528 }
529
530 func (m *MemifDelete) Reset()                        { *m = MemifDelete{} }
531 func (*MemifDelete) GetMessageName() string          { return "memif_delete" }
532 func (*MemifDelete) GetCrcString() string            { return "f9e6675e" }
533 func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage }
534
535 func (m *MemifDelete) Size() int {
536         if m == nil {
537                 return 0
538         }
539         var size int
540         // field[1] m.SwIfIndex
541         size += 4
542         return size
543 }
544 func (m *MemifDelete) Marshal(b []byte) ([]byte, error) {
545         o := binary.BigEndian
546         _ = o
547         pos := 0
548         _ = pos
549         var buf []byte
550         if b == nil {
551                 buf = make([]byte, m.Size())
552         } else {
553                 buf = b
554         }
555         // field[1] m.SwIfIndex
556         o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
557         pos += 4
558         return buf, nil
559 }
560 func (m *MemifDelete) Unmarshal(tmp []byte) error {
561         o := binary.BigEndian
562         _ = o
563         pos := 0
564         _ = pos
565         // field[1] m.SwIfIndex
566         m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
567         pos += 4
568         return nil
569 }
570
571 // MemifDeleteReply represents VPP binary API message 'memif_delete_reply'.
572 type MemifDeleteReply struct {
573         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
574 }
575
576 func (m *MemifDeleteReply) Reset()                        { *m = MemifDeleteReply{} }
577 func (*MemifDeleteReply) GetMessageName() string          { return "memif_delete_reply" }
578 func (*MemifDeleteReply) GetCrcString() string            { return "e8d4e804" }
579 func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage }
580
581 func (m *MemifDeleteReply) Size() int {
582         if m == nil {
583                 return 0
584         }
585         var size int
586         // field[1] m.Retval
587         size += 4
588         return size
589 }
590 func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) {
591         o := binary.BigEndian
592         _ = o
593         pos := 0
594         _ = pos
595         var buf []byte
596         if b == nil {
597                 buf = make([]byte, m.Size())
598         } else {
599                 buf = b
600         }
601         // field[1] m.Retval
602         o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
603         pos += 4
604         return buf, nil
605 }
606 func (m *MemifDeleteReply) Unmarshal(tmp []byte) error {
607         o := binary.BigEndian
608         _ = o
609         pos := 0
610         _ = pos
611         // field[1] m.Retval
612         m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
613         pos += 4
614         return nil
615 }
616
617 // MemifDetails represents VPP binary API message 'memif_details'.
618 type MemifDetails struct {
619         SwIfIndex  InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
620         HwAddr     MacAddress     `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
621         ID         uint32         `binapi:"u32,name=id" json:"id,omitempty"`
622         Role       MemifRole      `binapi:"memif_role,name=role" json:"role,omitempty"`
623         Mode       MemifMode      `binapi:"memif_mode,name=mode" json:"mode,omitempty"`
624         ZeroCopy   bool           `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"`
625         SocketID   uint32         `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
626         RingSize   uint32         `binapi:"u32,name=ring_size" json:"ring_size,omitempty"`
627         BufferSize uint16         `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"`
628         Flags      IfStatusFlags  `binapi:"if_status_flags,name=flags" json:"flags,omitempty"`
629         IfName     string         `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"`
630 }
631
632 func (m *MemifDetails) Reset()                        { *m = MemifDetails{} }
633 func (*MemifDetails) GetMessageName() string          { return "memif_details" }
634 func (*MemifDetails) GetCrcString() string            { return "d0382c4c" }
635 func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
636
637 func (m *MemifDetails) Size() int {
638         if m == nil {
639                 return 0
640         }
641         var size int
642         // field[1] m.SwIfIndex
643         size += 4
644         // field[1] m.HwAddr
645         size += 6
646         // field[1] m.ID
647         size += 4
648         // field[1] m.Role
649         size += 4
650         // field[1] m.Mode
651         size += 4
652         // field[1] m.ZeroCopy
653         size += 1
654         // field[1] m.SocketID
655         size += 4
656         // field[1] m.RingSize
657         size += 4
658         // field[1] m.BufferSize
659         size += 2
660         // field[1] m.Flags
661         size += 4
662         // field[1] m.IfName
663         size += 64
664         return size
665 }
666 func (m *MemifDetails) Marshal(b []byte) ([]byte, error) {
667         o := binary.BigEndian
668         _ = o
669         pos := 0
670         _ = pos
671         var buf []byte
672         if b == nil {
673                 buf = make([]byte, m.Size())
674         } else {
675                 buf = b
676         }
677         // field[1] m.SwIfIndex
678         o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
679         pos += 4
680         // field[1] m.HwAddr
681         for i := 0; i < 6; i++ {
682                 var x uint8
683                 if i < len(m.HwAddr) {
684                         x = uint8(m.HwAddr[i])
685                 }
686                 buf[pos] = uint8(x)
687                 pos += 1
688         }
689         // field[1] m.ID
690         o.PutUint32(buf[pos:pos+4], uint32(m.ID))
691         pos += 4
692         // field[1] m.Role
693         o.PutUint32(buf[pos:pos+4], uint32(m.Role))
694         pos += 4
695         // field[1] m.Mode
696         o.PutUint32(buf[pos:pos+4], uint32(m.Mode))
697         pos += 4
698         // field[1] m.ZeroCopy
699         if m.ZeroCopy {
700                 buf[pos] = 1
701         }
702         pos += 1
703         // field[1] m.SocketID
704         o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
705         pos += 4
706         // field[1] m.RingSize
707         o.PutUint32(buf[pos:pos+4], uint32(m.RingSize))
708         pos += 4
709         // field[1] m.BufferSize
710         o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize))
711         pos += 2
712         // field[1] m.Flags
713         o.PutUint32(buf[pos:pos+4], uint32(m.Flags))
714         pos += 4
715         // field[1] m.IfName
716         copy(buf[pos:pos+64], m.IfName)
717         pos += 64
718         return buf, nil
719 }
720 func (m *MemifDetails) Unmarshal(tmp []byte) error {
721         o := binary.BigEndian
722         _ = o
723         pos := 0
724         _ = pos
725         // field[1] m.SwIfIndex
726         m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
727         pos += 4
728         // field[1] m.HwAddr
729         for i := 0; i < len(m.HwAddr); i++ {
730                 m.HwAddr[i] = uint8(tmp[pos])
731                 pos += 1
732         }
733         // field[1] m.ID
734         m.ID = uint32(o.Uint32(tmp[pos : pos+4]))
735         pos += 4
736         // field[1] m.Role
737         m.Role = MemifRole(o.Uint32(tmp[pos : pos+4]))
738         pos += 4
739         // field[1] m.Mode
740         m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4]))
741         pos += 4
742         // field[1] m.ZeroCopy
743         m.ZeroCopy = tmp[pos] != 0
744         pos += 1
745         // field[1] m.SocketID
746         m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
747         pos += 4
748         // field[1] m.RingSize
749         m.RingSize = uint32(o.Uint32(tmp[pos : pos+4]))
750         pos += 4
751         // field[1] m.BufferSize
752         m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2]))
753         pos += 2
754         // field[1] m.Flags
755         m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4]))
756         pos += 4
757         // field[1] m.IfName
758         {
759                 nul := bytes.Index(tmp[pos:pos+64], []byte{0x00})
760                 m.IfName = codec.DecodeString(tmp[pos : pos+nul])
761                 pos += 64
762         }
763         return nil
764 }
765
766 // MemifDump represents VPP binary API message 'memif_dump'.
767 type MemifDump struct{}
768
769 func (m *MemifDump) Reset()                        { *m = MemifDump{} }
770 func (*MemifDump) GetMessageName() string          { return "memif_dump" }
771 func (*MemifDump) GetCrcString() string            { return "51077d14" }
772 func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage }
773
774 func (m *MemifDump) Size() int {
775         if m == nil {
776                 return 0
777         }
778         var size int
779         return size
780 }
781 func (m *MemifDump) Marshal(b []byte) ([]byte, error) {
782         o := binary.BigEndian
783         _ = o
784         pos := 0
785         _ = pos
786         var buf []byte
787         if b == nil {
788                 buf = make([]byte, m.Size())
789         } else {
790                 buf = b
791         }
792         return buf, nil
793 }
794 func (m *MemifDump) Unmarshal(tmp []byte) error {
795         o := binary.BigEndian
796         _ = o
797         pos := 0
798         _ = pos
799         return nil
800 }
801
802 // MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'.
803 type MemifSocketFilenameAddDel struct {
804         IsAdd          bool   `binapi:"bool,name=is_add" json:"is_add,omitempty"`
805         SocketID       uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
806         SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"`
807 }
808
809 func (m *MemifSocketFilenameAddDel) Reset()                        { *m = MemifSocketFilenameAddDel{} }
810 func (*MemifSocketFilenameAddDel) GetMessageName() string          { return "memif_socket_filename_add_del" }
811 func (*MemifSocketFilenameAddDel) GetCrcString() string            { return "a2ce1a10" }
812 func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage }
813
814 func (m *MemifSocketFilenameAddDel) Size() int {
815         if m == nil {
816                 return 0
817         }
818         var size int
819         // field[1] m.IsAdd
820         size += 1
821         // field[1] m.SocketID
822         size += 4
823         // field[1] m.SocketFilename
824         size += 108
825         return size
826 }
827 func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) {
828         o := binary.BigEndian
829         _ = o
830         pos := 0
831         _ = pos
832         var buf []byte
833         if b == nil {
834                 buf = make([]byte, m.Size())
835         } else {
836                 buf = b
837         }
838         // field[1] m.IsAdd
839         if m.IsAdd {
840                 buf[pos] = 1
841         }
842         pos += 1
843         // field[1] m.SocketID
844         o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
845         pos += 4
846         // field[1] m.SocketFilename
847         copy(buf[pos:pos+108], m.SocketFilename)
848         pos += 108
849         return buf, nil
850 }
851 func (m *MemifSocketFilenameAddDel) Unmarshal(tmp []byte) error {
852         o := binary.BigEndian
853         _ = o
854         pos := 0
855         _ = pos
856         // field[1] m.IsAdd
857         m.IsAdd = tmp[pos] != 0
858         pos += 1
859         // field[1] m.SocketID
860         m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
861         pos += 4
862         // field[1] m.SocketFilename
863         {
864                 nul := bytes.Index(tmp[pos:pos+108], []byte{0x00})
865                 m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul])
866                 pos += 108
867         }
868         return nil
869 }
870
871 // MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'.
872 type MemifSocketFilenameAddDelReply struct {
873         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
874 }
875
876 func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} }
877 func (*MemifSocketFilenameAddDelReply) GetMessageName() string {
878         return "memif_socket_filename_add_del_reply"
879 }
880 func (*MemifSocketFilenameAddDelReply) GetCrcString() string            { return "e8d4e804" }
881 func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage }
882
883 func (m *MemifSocketFilenameAddDelReply) Size() int {
884         if m == nil {
885                 return 0
886         }
887         var size int
888         // field[1] m.Retval
889         size += 4
890         return size
891 }
892 func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) {
893         o := binary.BigEndian
894         _ = o
895         pos := 0
896         _ = pos
897         var buf []byte
898         if b == nil {
899                 buf = make([]byte, m.Size())
900         } else {
901                 buf = b
902         }
903         // field[1] m.Retval
904         o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
905         pos += 4
906         return buf, nil
907 }
908 func (m *MemifSocketFilenameAddDelReply) Unmarshal(tmp []byte) error {
909         o := binary.BigEndian
910         _ = o
911         pos := 0
912         _ = pos
913         // field[1] m.Retval
914         m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
915         pos += 4
916         return nil
917 }
918
919 // MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'.
920 type MemifSocketFilenameDetails struct {
921         SocketID       uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
922         SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"`
923 }
924
925 func (m *MemifSocketFilenameDetails) Reset()                        { *m = MemifSocketFilenameDetails{} }
926 func (*MemifSocketFilenameDetails) GetMessageName() string          { return "memif_socket_filename_details" }
927 func (*MemifSocketFilenameDetails) GetCrcString() string            { return "7ff326f7" }
928 func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
929
930 func (m *MemifSocketFilenameDetails) Size() int {
931         if m == nil {
932                 return 0
933         }
934         var size int
935         // field[1] m.SocketID
936         size += 4
937         // field[1] m.SocketFilename
938         size += 108
939         return size
940 }
941 func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) {
942         o := binary.BigEndian
943         _ = o
944         pos := 0
945         _ = pos
946         var buf []byte
947         if b == nil {
948                 buf = make([]byte, m.Size())
949         } else {
950                 buf = b
951         }
952         // field[1] m.SocketID
953         o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
954         pos += 4
955         // field[1] m.SocketFilename
956         copy(buf[pos:pos+108], m.SocketFilename)
957         pos += 108
958         return buf, nil
959 }
960 func (m *MemifSocketFilenameDetails) Unmarshal(tmp []byte) error {
961         o := binary.BigEndian
962         _ = o
963         pos := 0
964         _ = pos
965         // field[1] m.SocketID
966         m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
967         pos += 4
968         // field[1] m.SocketFilename
969         {
970                 nul := bytes.Index(tmp[pos:pos+108], []byte{0x00})
971                 m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul])
972                 pos += 108
973         }
974         return nil
975 }
976
977 // MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'.
978 type MemifSocketFilenameDump struct{}
979
980 func (m *MemifSocketFilenameDump) Reset()                        { *m = MemifSocketFilenameDump{} }
981 func (*MemifSocketFilenameDump) GetMessageName() string          { return "memif_socket_filename_dump" }
982 func (*MemifSocketFilenameDump) GetCrcString() string            { return "51077d14" }
983 func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { return api.RequestMessage }
984
985 func (m *MemifSocketFilenameDump) Size() int {
986         if m == nil {
987                 return 0
988         }
989         var size int
990         return size
991 }
992 func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) {
993         o := binary.BigEndian
994         _ = o
995         pos := 0
996         _ = pos
997         var buf []byte
998         if b == nil {
999                 buf = make([]byte, m.Size())
1000         } else {
1001                 buf = b
1002         }
1003         return buf, nil
1004 }
1005 func (m *MemifSocketFilenameDump) Unmarshal(tmp []byte) error {
1006         o := binary.BigEndian
1007         _ = o
1008         pos := 0
1009         _ = pos
1010         return nil
1011 }
1012
1013 func init() { file_memif_binapi_init() }
1014 func file_memif_binapi_init() {
1015         api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate")
1016         api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply")
1017         api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete")
1018         api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply")
1019         api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails")
1020         api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump")
1021         api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel")
1022         api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply")
1023         api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails")
1024         api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump")
1025 }
1026
1027 // Messages returns list of all messages in this module.
1028 func AllMessages() []api.Message {
1029         return []api.Message{
1030                 (*MemifCreate)(nil),
1031                 (*MemifCreateReply)(nil),
1032                 (*MemifDelete)(nil),
1033                 (*MemifDeleteReply)(nil),
1034                 (*MemifDetails)(nil),
1035                 (*MemifDump)(nil),
1036                 (*MemifSocketFilenameAddDel)(nil),
1037                 (*MemifSocketFilenameAddDelReply)(nil),
1038                 (*MemifSocketFilenameDetails)(nil),
1039                 (*MemifSocketFilenameDump)(nil),
1040         }
1041 }
1042
1043 // Reference imports to suppress errors if they are not otherwise used.
1044 var _ = api.RegisterMessage
1045 var _ = codec.DecodeString
1046 var _ = bytes.NewBuffer
1047 var _ = context.Background
1048 var _ = io.Copy
1049 var _ = strconv.Itoa
1050 var _ = struc.Pack
1051 var _ = binary.BigEndian
1052 var _ = math.Float32bits