1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
5 // source: /usr/share/vpp/api/plugins/memif.api.json
8 Package memif contains generated code for VPP API file memif.api (3.0.0).
25 api "git.fd.io/govpp.git/api"
26 codec "git.fd.io/govpp.git/codec"
27 struc "github.com/lunixbochs/struc"
29 interface_types "git.fd.io/govpp.git/examples/binapi/interface_types"
32 // This is a compile-time assertion to ensure that this generated file
33 // is compatible with the GoVPP api package it is being compiled against.
34 // A compilation error at this line likely means your copy of the
35 // GoVPP api package needs to be updated.
36 const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package
39 // ModuleName is the name of this module.
41 // APIVersion is the API version of this module.
43 // VersionCrc is the CRC of this module.
44 VersionCrc = 0x1a1c95b8
47 type IfStatusFlags = interface_types.IfStatusFlags
49 type IfType = interface_types.IfType
51 type LinkDuplex = interface_types.LinkDuplex
53 // MemifMode represents VPP binary API enum 'memif_mode'.
57 MEMIF_MODE_API_ETHERNET MemifMode = 0
58 MEMIF_MODE_API_IP MemifMode = 1
59 MEMIF_MODE_API_PUNT_INJECT MemifMode = 2
63 MemifMode_name = map[uint32]string{
64 0: "MEMIF_MODE_API_ETHERNET",
65 1: "MEMIF_MODE_API_IP",
66 2: "MEMIF_MODE_API_PUNT_INJECT",
68 MemifMode_value = map[string]uint32{
69 "MEMIF_MODE_API_ETHERNET": 0,
70 "MEMIF_MODE_API_IP": 1,
71 "MEMIF_MODE_API_PUNT_INJECT": 2,
75 func (x MemifMode) String() string {
76 s, ok := MemifMode_name[uint32(x)]
80 return "MemifMode(" + strconv.Itoa(int(x)) + ")"
83 // MemifRole represents VPP binary API enum 'memif_role'.
87 MEMIF_ROLE_API_MASTER MemifRole = 0
88 MEMIF_ROLE_API_SLAVE MemifRole = 1
92 MemifRole_name = map[uint32]string{
93 0: "MEMIF_ROLE_API_MASTER",
94 1: "MEMIF_ROLE_API_SLAVE",
96 MemifRole_value = map[string]uint32{
97 "MEMIF_ROLE_API_MASTER": 0,
98 "MEMIF_ROLE_API_SLAVE": 1,
102 func (x MemifRole) String() string {
103 s, ok := MemifRole_name[uint32(x)]
107 return "MemifRole(" + strconv.Itoa(int(x)) + ")"
110 type MtuProto = interface_types.MtuProto
112 type RxMode = interface_types.RxMode
114 type SubIfFlags = interface_types.SubIfFlags
116 type InterfaceIndex = interface_types.InterfaceIndex
118 // MacAddress represents VPP binary API alias 'mac_address'.
119 type MacAddress [6]uint8
121 // MemifCreate represents VPP binary API message 'memif_create'.
122 type MemifCreate struct {
123 Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"`
124 Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"`
125 RxQueues uint8 `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"`
126 TxQueues uint8 `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"`
127 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
128 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
129 RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"`
130 BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"`
131 NoZeroCopy bool `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"`
132 HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
133 Secret string `binapi:"string[24],name=secret" json:"secret,omitempty" struc:"[24]byte"`
136 func (m *MemifCreate) Reset() { *m = MemifCreate{} }
137 func (*MemifCreate) GetMessageName() string { return "memif_create" }
138 func (*MemifCreate) GetCrcString() string { return "b1b25061" }
139 func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage }
141 func (m *MemifCreate) Size() int {
150 // field[1] m.RxQueues
152 // field[1] m.TxQueues
156 // field[1] m.SocketID
158 // field[1] m.RingSize
160 // field[1] m.BufferSize
162 // field[1] m.NoZeroCopy
170 func (m *MemifCreate) Marshal(b []byte) ([]byte, error) {
171 o := binary.BigEndian
177 buf = make([]byte, m.Size())
182 o.PutUint32(buf[pos:pos+4], uint32(m.Role))
185 o.PutUint32(buf[pos:pos+4], uint32(m.Mode))
187 // field[1] m.RxQueues
188 buf[pos] = uint8(m.RxQueues)
190 // field[1] m.TxQueues
191 buf[pos] = uint8(m.TxQueues)
194 o.PutUint32(buf[pos:pos+4], uint32(m.ID))
196 // field[1] m.SocketID
197 o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
199 // field[1] m.RingSize
200 o.PutUint32(buf[pos:pos+4], uint32(m.RingSize))
202 // field[1] m.BufferSize
203 o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize))
205 // field[1] m.NoZeroCopy
211 for i := 0; i < 6; i++ {
213 if i < len(m.HwAddr) {
214 x = uint8(m.HwAddr[i])
220 copy(buf[pos:pos+24], m.Secret)
224 func (m *MemifCreate) Unmarshal(tmp []byte) error {
225 o := binary.BigEndian
230 m.Role = MemifRole(o.Uint32(tmp[pos : pos+4]))
233 m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4]))
235 // field[1] m.RxQueues
236 m.RxQueues = uint8(tmp[pos])
238 // field[1] m.TxQueues
239 m.TxQueues = uint8(tmp[pos])
242 m.ID = uint32(o.Uint32(tmp[pos : pos+4]))
244 // field[1] m.SocketID
245 m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
247 // field[1] m.RingSize
248 m.RingSize = uint32(o.Uint32(tmp[pos : pos+4]))
250 // field[1] m.BufferSize
251 m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2]))
253 // field[1] m.NoZeroCopy
254 m.NoZeroCopy = tmp[pos] != 0
257 for i := 0; i < len(m.HwAddr); i++ {
258 m.HwAddr[i] = uint8(tmp[pos])
263 nul := bytes.Index(tmp[pos:pos+24], []byte{0x00})
264 m.Secret = codec.DecodeString(tmp[pos : pos+nul])
270 // MemifCreateReply represents VPP binary API message 'memif_create_reply'.
271 type MemifCreateReply struct {
272 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
273 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
276 func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} }
277 func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" }
278 func (*MemifCreateReply) GetCrcString() string { return "5383d31f" }
279 func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage }
281 func (m *MemifCreateReply) Size() int {
288 // field[1] m.SwIfIndex
292 func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) {
293 o := binary.BigEndian
299 buf = make([]byte, m.Size())
304 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
306 // field[1] m.SwIfIndex
307 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
311 func (m *MemifCreateReply) Unmarshal(tmp []byte) error {
312 o := binary.BigEndian
317 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
319 // field[1] m.SwIfIndex
320 m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
325 // MemifDelete represents VPP binary API message 'memif_delete'.
326 type MemifDelete struct {
327 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
330 func (m *MemifDelete) Reset() { *m = MemifDelete{} }
331 func (*MemifDelete) GetMessageName() string { return "memif_delete" }
332 func (*MemifDelete) GetCrcString() string { return "f9e6675e" }
333 func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage }
335 func (m *MemifDelete) Size() int {
340 // field[1] m.SwIfIndex
344 func (m *MemifDelete) Marshal(b []byte) ([]byte, error) {
345 o := binary.BigEndian
351 buf = make([]byte, m.Size())
355 // field[1] m.SwIfIndex
356 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
360 func (m *MemifDelete) Unmarshal(tmp []byte) error {
361 o := binary.BigEndian
365 // field[1] m.SwIfIndex
366 m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
371 // MemifDeleteReply represents VPP binary API message 'memif_delete_reply'.
372 type MemifDeleteReply struct {
373 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
376 func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} }
377 func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" }
378 func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" }
379 func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage }
381 func (m *MemifDeleteReply) Size() int {
390 func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) {
391 o := binary.BigEndian
397 buf = make([]byte, m.Size())
402 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
406 func (m *MemifDeleteReply) Unmarshal(tmp []byte) error {
407 o := binary.BigEndian
412 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
417 // MemifDetails represents VPP binary API message 'memif_details'.
418 type MemifDetails struct {
419 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
420 HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
421 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
422 Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"`
423 Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"`
424 ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"`
425 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
426 RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"`
427 BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"`
428 Flags IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"`
429 IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"`
432 func (m *MemifDetails) Reset() { *m = MemifDetails{} }
433 func (*MemifDetails) GetMessageName() string { return "memif_details" }
434 func (*MemifDetails) GetCrcString() string { return "d0382c4c" }
435 func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
437 func (m *MemifDetails) Size() int {
442 // field[1] m.SwIfIndex
452 // field[1] m.ZeroCopy
454 // field[1] m.SocketID
456 // field[1] m.RingSize
458 // field[1] m.BufferSize
466 func (m *MemifDetails) Marshal(b []byte) ([]byte, error) {
467 o := binary.BigEndian
473 buf = make([]byte, m.Size())
477 // field[1] m.SwIfIndex
478 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
481 for i := 0; i < 6; i++ {
483 if i < len(m.HwAddr) {
484 x = uint8(m.HwAddr[i])
490 o.PutUint32(buf[pos:pos+4], uint32(m.ID))
493 o.PutUint32(buf[pos:pos+4], uint32(m.Role))
496 o.PutUint32(buf[pos:pos+4], uint32(m.Mode))
498 // field[1] m.ZeroCopy
503 // field[1] m.SocketID
504 o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
506 // field[1] m.RingSize
507 o.PutUint32(buf[pos:pos+4], uint32(m.RingSize))
509 // field[1] m.BufferSize
510 o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize))
513 o.PutUint32(buf[pos:pos+4], uint32(m.Flags))
516 copy(buf[pos:pos+64], m.IfName)
520 func (m *MemifDetails) Unmarshal(tmp []byte) error {
521 o := binary.BigEndian
525 // field[1] m.SwIfIndex
526 m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
529 for i := 0; i < len(m.HwAddr); i++ {
530 m.HwAddr[i] = uint8(tmp[pos])
534 m.ID = uint32(o.Uint32(tmp[pos : pos+4]))
537 m.Role = MemifRole(o.Uint32(tmp[pos : pos+4]))
540 m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4]))
542 // field[1] m.ZeroCopy
543 m.ZeroCopy = tmp[pos] != 0
545 // field[1] m.SocketID
546 m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
548 // field[1] m.RingSize
549 m.RingSize = uint32(o.Uint32(tmp[pos : pos+4]))
551 // field[1] m.BufferSize
552 m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2]))
555 m.Flags = IfStatusFlags(o.Uint32(tmp[pos : pos+4]))
559 nul := bytes.Index(tmp[pos:pos+64], []byte{0x00})
560 m.IfName = codec.DecodeString(tmp[pos : pos+nul])
566 // MemifDump represents VPP binary API message 'memif_dump'.
567 type MemifDump struct{}
569 func (m *MemifDump) Reset() { *m = MemifDump{} }
570 func (*MemifDump) GetMessageName() string { return "memif_dump" }
571 func (*MemifDump) GetCrcString() string { return "51077d14" }
572 func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage }
574 func (m *MemifDump) Size() int {
581 func (m *MemifDump) Marshal(b []byte) ([]byte, error) {
582 o := binary.BigEndian
588 buf = make([]byte, m.Size())
594 func (m *MemifDump) Unmarshal(tmp []byte) error {
595 o := binary.BigEndian
602 // MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'.
603 type MemifSocketFilenameAddDel struct {
604 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
605 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
606 SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"`
609 func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} }
610 func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" }
611 func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" }
612 func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage }
614 func (m *MemifSocketFilenameAddDel) Size() int {
621 // field[1] m.SocketID
623 // field[1] m.SocketFilename
627 func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) {
628 o := binary.BigEndian
634 buf = make([]byte, m.Size())
643 // field[1] m.SocketID
644 o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
646 // field[1] m.SocketFilename
647 copy(buf[pos:pos+108], m.SocketFilename)
651 func (m *MemifSocketFilenameAddDel) Unmarshal(tmp []byte) error {
652 o := binary.BigEndian
657 m.IsAdd = tmp[pos] != 0
659 // field[1] m.SocketID
660 m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
662 // field[1] m.SocketFilename
664 nul := bytes.Index(tmp[pos:pos+108], []byte{0x00})
665 m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul])
671 // MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'.
672 type MemifSocketFilenameAddDelReply struct {
673 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
676 func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} }
677 func (*MemifSocketFilenameAddDelReply) GetMessageName() string {
678 return "memif_socket_filename_add_del_reply"
680 func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" }
681 func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage }
683 func (m *MemifSocketFilenameAddDelReply) Size() int {
692 func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) {
693 o := binary.BigEndian
699 buf = make([]byte, m.Size())
704 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
708 func (m *MemifSocketFilenameAddDelReply) Unmarshal(tmp []byte) error {
709 o := binary.BigEndian
714 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
719 // MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'.
720 type MemifSocketFilenameDetails struct {
721 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
722 SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"`
725 func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} }
726 func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" }
727 func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" }
728 func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
730 func (m *MemifSocketFilenameDetails) Size() int {
735 // field[1] m.SocketID
737 // field[1] m.SocketFilename
741 func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) {
742 o := binary.BigEndian
748 buf = make([]byte, m.Size())
752 // field[1] m.SocketID
753 o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
755 // field[1] m.SocketFilename
756 copy(buf[pos:pos+108], m.SocketFilename)
760 func (m *MemifSocketFilenameDetails) Unmarshal(tmp []byte) error {
761 o := binary.BigEndian
765 // field[1] m.SocketID
766 m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
768 // field[1] m.SocketFilename
770 nul := bytes.Index(tmp[pos:pos+108], []byte{0x00})
771 m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul])
777 // MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'.
778 type MemifSocketFilenameDump struct{}
780 func (m *MemifSocketFilenameDump) Reset() { *m = MemifSocketFilenameDump{} }
781 func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" }
782 func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" }
783 func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { return api.RequestMessage }
785 func (m *MemifSocketFilenameDump) Size() int {
792 func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) {
793 o := binary.BigEndian
799 buf = make([]byte, m.Size())
805 func (m *MemifSocketFilenameDump) Unmarshal(tmp []byte) error {
806 o := binary.BigEndian
813 func init() { file_memif_binapi_init() }
814 func file_memif_binapi_init() {
815 api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate")
816 api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply")
817 api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete")
818 api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply")
819 api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails")
820 api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump")
821 api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel")
822 api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply")
823 api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails")
824 api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump")
827 // Messages returns list of all messages in this module.
828 func AllMessages() []api.Message {
829 return []api.Message{
831 (*MemifCreateReply)(nil),
833 (*MemifDeleteReply)(nil),
834 (*MemifDetails)(nil),
836 (*MemifSocketFilenameAddDel)(nil),
837 (*MemifSocketFilenameAddDelReply)(nil),
838 (*MemifSocketFilenameDetails)(nil),
839 (*MemifSocketFilenameDump)(nil),
843 // Reference imports to suppress errors if they are not otherwise used.
844 var _ = api.RegisterMessage
845 var _ = codec.DecodeString
846 var _ = bytes.NewBuffer
847 var _ = context.Background
851 var _ = binary.BigEndian
852 var _ = math.Float32bits