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).
28 api "git.fd.io/govpp.git/api"
29 codec "git.fd.io/govpp.git/codec"
30 struc "github.com/lunixbochs/struc"
32 interface_types "git.fd.io/govpp.git/examples/binapi/interface_types"
35 // This is a compile-time assertion to ensure that this generated file
36 // is compatible with the GoVPP api package it is being compiled against.
37 // A compilation error at this line likely means your copy of the
38 // GoVPP api package needs to be updated.
39 const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package
42 // ModuleName is the name of this module.
44 // APIVersion is the API version of this module.
46 // VersionCrc is the CRC of this module.
47 VersionCrc = 0x1a1c95b8
50 // MemifMode represents VPP binary API enum 'memif_mode'.
54 MEMIF_MODE_API_ETHERNET MemifMode = 0
55 MEMIF_MODE_API_IP MemifMode = 1
56 MEMIF_MODE_API_PUNT_INJECT MemifMode = 2
60 MemifMode_name = map[uint32]string{
61 0: "MEMIF_MODE_API_ETHERNET",
62 1: "MEMIF_MODE_API_IP",
63 2: "MEMIF_MODE_API_PUNT_INJECT",
65 MemifMode_value = map[string]uint32{
66 "MEMIF_MODE_API_ETHERNET": 0,
67 "MEMIF_MODE_API_IP": 1,
68 "MEMIF_MODE_API_PUNT_INJECT": 2,
72 func (x MemifMode) String() string {
73 s, ok := MemifMode_name[uint32(x)]
77 return "MemifMode(" + strconv.Itoa(int(x)) + ")"
80 // MemifRole represents VPP binary API enum 'memif_role'.
84 MEMIF_ROLE_API_MASTER MemifRole = 0
85 MEMIF_ROLE_API_SLAVE MemifRole = 1
89 MemifRole_name = map[uint32]string{
90 0: "MEMIF_ROLE_API_MASTER",
91 1: "MEMIF_ROLE_API_SLAVE",
93 MemifRole_value = map[string]uint32{
94 "MEMIF_ROLE_API_MASTER": 0,
95 "MEMIF_ROLE_API_SLAVE": 1,
99 func (x MemifRole) String() string {
100 s, ok := MemifRole_name[uint32(x)]
104 return "MemifRole(" + strconv.Itoa(int(x)) + ")"
107 // MacAddress represents VPP binary API alias 'mac_address'.
108 type MacAddress [6]uint8
110 func ParseMAC(mac string) (parsed MacAddress, err error) {
111 var hw net.HardwareAddr
112 if hw, err = net.ParseMAC(mac); err != nil {
115 copy(parsed[:], hw[:])
119 func (m *MacAddress) ToString() string {
120 return net.HardwareAddr(m[:]).String()
123 // MemifCreate represents VPP binary API message 'memif_create'.
124 type MemifCreate struct {
125 Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"`
126 Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"`
127 RxQueues uint8 `binapi:"u8,name=rx_queues" json:"rx_queues,omitempty"`
128 TxQueues uint8 `binapi:"u8,name=tx_queues" json:"tx_queues,omitempty"`
129 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
130 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
131 RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"`
132 BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"`
133 NoZeroCopy bool `binapi:"bool,name=no_zero_copy" json:"no_zero_copy,omitempty"`
134 HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
135 Secret string `binapi:"string[24],name=secret" json:"secret,omitempty" struc:"[24]byte"`
138 func (m *MemifCreate) Reset() { *m = MemifCreate{} }
139 func (*MemifCreate) GetMessageName() string { return "memif_create" }
140 func (*MemifCreate) GetCrcString() string { return "b1b25061" }
141 func (*MemifCreate) GetMessageType() api.MessageType { return api.RequestMessage }
143 func (m *MemifCreate) Size() int {
152 // field[1] m.RxQueues
154 // field[1] m.TxQueues
158 // field[1] m.SocketID
160 // field[1] m.RingSize
162 // field[1] m.BufferSize
164 // field[1] m.NoZeroCopy
172 func (m *MemifCreate) Marshal(b []byte) ([]byte, error) {
173 o := binary.BigEndian
179 buf = make([]byte, m.Size())
184 o.PutUint32(buf[pos:pos+4], uint32(m.Role))
187 o.PutUint32(buf[pos:pos+4], uint32(m.Mode))
189 // field[1] m.RxQueues
190 buf[pos] = uint8(m.RxQueues)
192 // field[1] m.TxQueues
193 buf[pos] = uint8(m.TxQueues)
196 o.PutUint32(buf[pos:pos+4], uint32(m.ID))
198 // field[1] m.SocketID
199 o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
201 // field[1] m.RingSize
202 o.PutUint32(buf[pos:pos+4], uint32(m.RingSize))
204 // field[1] m.BufferSize
205 o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize))
207 // field[1] m.NoZeroCopy
213 for i := 0; i < 6; i++ {
215 if i < len(m.HwAddr) {
216 x = uint8(m.HwAddr[i])
222 copy(buf[pos:pos+24], m.Secret)
226 func (m *MemifCreate) Unmarshal(tmp []byte) error {
227 o := binary.BigEndian
232 m.Role = MemifRole(o.Uint32(tmp[pos : pos+4]))
235 m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4]))
237 // field[1] m.RxQueues
238 m.RxQueues = uint8(tmp[pos])
240 // field[1] m.TxQueues
241 m.TxQueues = uint8(tmp[pos])
244 m.ID = uint32(o.Uint32(tmp[pos : pos+4]))
246 // field[1] m.SocketID
247 m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
249 // field[1] m.RingSize
250 m.RingSize = uint32(o.Uint32(tmp[pos : pos+4]))
252 // field[1] m.BufferSize
253 m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2]))
255 // field[1] m.NoZeroCopy
256 m.NoZeroCopy = tmp[pos] != 0
259 for i := 0; i < len(m.HwAddr); i++ {
260 m.HwAddr[i] = uint8(tmp[pos])
265 nul := bytes.Index(tmp[pos:pos+24], []byte{0x00})
266 m.Secret = codec.DecodeString(tmp[pos : pos+nul])
272 // MemifCreateReply represents VPP binary API message 'memif_create_reply'.
273 type MemifCreateReply struct {
274 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
275 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
278 func (m *MemifCreateReply) Reset() { *m = MemifCreateReply{} }
279 func (*MemifCreateReply) GetMessageName() string { return "memif_create_reply" }
280 func (*MemifCreateReply) GetCrcString() string { return "5383d31f" }
281 func (*MemifCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage }
283 func (m *MemifCreateReply) Size() int {
290 // field[1] m.SwIfIndex
294 func (m *MemifCreateReply) Marshal(b []byte) ([]byte, error) {
295 o := binary.BigEndian
301 buf = make([]byte, m.Size())
306 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
308 // field[1] m.SwIfIndex
309 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
313 func (m *MemifCreateReply) Unmarshal(tmp []byte) error {
314 o := binary.BigEndian
319 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
321 // field[1] m.SwIfIndex
322 m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
327 // MemifDelete represents VPP binary API message 'memif_delete'.
328 type MemifDelete struct {
329 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
332 func (m *MemifDelete) Reset() { *m = MemifDelete{} }
333 func (*MemifDelete) GetMessageName() string { return "memif_delete" }
334 func (*MemifDelete) GetCrcString() string { return "f9e6675e" }
335 func (*MemifDelete) GetMessageType() api.MessageType { return api.RequestMessage }
337 func (m *MemifDelete) Size() int {
342 // field[1] m.SwIfIndex
346 func (m *MemifDelete) Marshal(b []byte) ([]byte, error) {
347 o := binary.BigEndian
353 buf = make([]byte, m.Size())
357 // field[1] m.SwIfIndex
358 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
362 func (m *MemifDelete) Unmarshal(tmp []byte) error {
363 o := binary.BigEndian
367 // field[1] m.SwIfIndex
368 m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
373 // MemifDeleteReply represents VPP binary API message 'memif_delete_reply'.
374 type MemifDeleteReply struct {
375 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
378 func (m *MemifDeleteReply) Reset() { *m = MemifDeleteReply{} }
379 func (*MemifDeleteReply) GetMessageName() string { return "memif_delete_reply" }
380 func (*MemifDeleteReply) GetCrcString() string { return "e8d4e804" }
381 func (*MemifDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage }
383 func (m *MemifDeleteReply) Size() int {
392 func (m *MemifDeleteReply) Marshal(b []byte) ([]byte, error) {
393 o := binary.BigEndian
399 buf = make([]byte, m.Size())
404 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
408 func (m *MemifDeleteReply) Unmarshal(tmp []byte) error {
409 o := binary.BigEndian
414 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
419 // MemifDetails represents VPP binary API message 'memif_details'.
420 type MemifDetails struct {
421 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
422 HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
423 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
424 Role MemifRole `binapi:"memif_role,name=role" json:"role,omitempty"`
425 Mode MemifMode `binapi:"memif_mode,name=mode" json:"mode,omitempty"`
426 ZeroCopy bool `binapi:"bool,name=zero_copy" json:"zero_copy,omitempty"`
427 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
428 RingSize uint32 `binapi:"u32,name=ring_size" json:"ring_size,omitempty"`
429 BufferSize uint16 `binapi:"u16,name=buffer_size" json:"buffer_size,omitempty"`
430 Flags interface_types.IfStatusFlags `binapi:"if_status_flags,name=flags" json:"flags,omitempty"`
431 IfName string `binapi:"string[64],name=if_name" json:"if_name,omitempty" struc:"[64]byte"`
434 func (m *MemifDetails) Reset() { *m = MemifDetails{} }
435 func (*MemifDetails) GetMessageName() string { return "memif_details" }
436 func (*MemifDetails) GetCrcString() string { return "d0382c4c" }
437 func (*MemifDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
439 func (m *MemifDetails) Size() int {
444 // field[1] m.SwIfIndex
454 // field[1] m.ZeroCopy
456 // field[1] m.SocketID
458 // field[1] m.RingSize
460 // field[1] m.BufferSize
468 func (m *MemifDetails) Marshal(b []byte) ([]byte, error) {
469 o := binary.BigEndian
475 buf = make([]byte, m.Size())
479 // field[1] m.SwIfIndex
480 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
483 for i := 0; i < 6; i++ {
485 if i < len(m.HwAddr) {
486 x = uint8(m.HwAddr[i])
492 o.PutUint32(buf[pos:pos+4], uint32(m.ID))
495 o.PutUint32(buf[pos:pos+4], uint32(m.Role))
498 o.PutUint32(buf[pos:pos+4], uint32(m.Mode))
500 // field[1] m.ZeroCopy
505 // field[1] m.SocketID
506 o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
508 // field[1] m.RingSize
509 o.PutUint32(buf[pos:pos+4], uint32(m.RingSize))
511 // field[1] m.BufferSize
512 o.PutUint16(buf[pos:pos+2], uint16(m.BufferSize))
515 o.PutUint32(buf[pos:pos+4], uint32(m.Flags))
518 copy(buf[pos:pos+64], m.IfName)
522 func (m *MemifDetails) Unmarshal(tmp []byte) error {
523 o := binary.BigEndian
527 // field[1] m.SwIfIndex
528 m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
531 for i := 0; i < len(m.HwAddr); i++ {
532 m.HwAddr[i] = uint8(tmp[pos])
536 m.ID = uint32(o.Uint32(tmp[pos : pos+4]))
539 m.Role = MemifRole(o.Uint32(tmp[pos : pos+4]))
542 m.Mode = MemifMode(o.Uint32(tmp[pos : pos+4]))
544 // field[1] m.ZeroCopy
545 m.ZeroCopy = tmp[pos] != 0
547 // field[1] m.SocketID
548 m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
550 // field[1] m.RingSize
551 m.RingSize = uint32(o.Uint32(tmp[pos : pos+4]))
553 // field[1] m.BufferSize
554 m.BufferSize = uint16(o.Uint16(tmp[pos : pos+2]))
557 m.Flags = interface_types.IfStatusFlags(o.Uint32(tmp[pos : pos+4]))
561 nul := bytes.Index(tmp[pos:pos+64], []byte{0x00})
562 m.IfName = codec.DecodeString(tmp[pos : pos+nul])
568 // MemifDump represents VPP binary API message 'memif_dump'.
569 type MemifDump struct{}
571 func (m *MemifDump) Reset() { *m = MemifDump{} }
572 func (*MemifDump) GetMessageName() string { return "memif_dump" }
573 func (*MemifDump) GetCrcString() string { return "51077d14" }
574 func (*MemifDump) GetMessageType() api.MessageType { return api.RequestMessage }
576 func (m *MemifDump) Size() int {
583 func (m *MemifDump) Marshal(b []byte) ([]byte, error) {
584 o := binary.BigEndian
590 buf = make([]byte, m.Size())
596 func (m *MemifDump) Unmarshal(tmp []byte) error {
597 o := binary.BigEndian
604 // MemifSocketFilenameAddDel represents VPP binary API message 'memif_socket_filename_add_del'.
605 type MemifSocketFilenameAddDel struct {
606 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
607 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
608 SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"`
611 func (m *MemifSocketFilenameAddDel) Reset() { *m = MemifSocketFilenameAddDel{} }
612 func (*MemifSocketFilenameAddDel) GetMessageName() string { return "memif_socket_filename_add_del" }
613 func (*MemifSocketFilenameAddDel) GetCrcString() string { return "a2ce1a10" }
614 func (*MemifSocketFilenameAddDel) GetMessageType() api.MessageType { return api.RequestMessage }
616 func (m *MemifSocketFilenameAddDel) Size() int {
623 // field[1] m.SocketID
625 // field[1] m.SocketFilename
629 func (m *MemifSocketFilenameAddDel) Marshal(b []byte) ([]byte, error) {
630 o := binary.BigEndian
636 buf = make([]byte, m.Size())
645 // field[1] m.SocketID
646 o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
648 // field[1] m.SocketFilename
649 copy(buf[pos:pos+108], m.SocketFilename)
653 func (m *MemifSocketFilenameAddDel) Unmarshal(tmp []byte) error {
654 o := binary.BigEndian
659 m.IsAdd = tmp[pos] != 0
661 // field[1] m.SocketID
662 m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
664 // field[1] m.SocketFilename
666 nul := bytes.Index(tmp[pos:pos+108], []byte{0x00})
667 m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul])
673 // MemifSocketFilenameAddDelReply represents VPP binary API message 'memif_socket_filename_add_del_reply'.
674 type MemifSocketFilenameAddDelReply struct {
675 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
678 func (m *MemifSocketFilenameAddDelReply) Reset() { *m = MemifSocketFilenameAddDelReply{} }
679 func (*MemifSocketFilenameAddDelReply) GetMessageName() string {
680 return "memif_socket_filename_add_del_reply"
682 func (*MemifSocketFilenameAddDelReply) GetCrcString() string { return "e8d4e804" }
683 func (*MemifSocketFilenameAddDelReply) GetMessageType() api.MessageType { return api.ReplyMessage }
685 func (m *MemifSocketFilenameAddDelReply) Size() int {
694 func (m *MemifSocketFilenameAddDelReply) Marshal(b []byte) ([]byte, error) {
695 o := binary.BigEndian
701 buf = make([]byte, m.Size())
706 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
710 func (m *MemifSocketFilenameAddDelReply) Unmarshal(tmp []byte) error {
711 o := binary.BigEndian
716 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
721 // MemifSocketFilenameDetails represents VPP binary API message 'memif_socket_filename_details'.
722 type MemifSocketFilenameDetails struct {
723 SocketID uint32 `binapi:"u32,name=socket_id" json:"socket_id,omitempty"`
724 SocketFilename string `binapi:"string[108],name=socket_filename" json:"socket_filename,omitempty" struc:"[108]byte"`
727 func (m *MemifSocketFilenameDetails) Reset() { *m = MemifSocketFilenameDetails{} }
728 func (*MemifSocketFilenameDetails) GetMessageName() string { return "memif_socket_filename_details" }
729 func (*MemifSocketFilenameDetails) GetCrcString() string { return "7ff326f7" }
730 func (*MemifSocketFilenameDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
732 func (m *MemifSocketFilenameDetails) Size() int {
737 // field[1] m.SocketID
739 // field[1] m.SocketFilename
743 func (m *MemifSocketFilenameDetails) Marshal(b []byte) ([]byte, error) {
744 o := binary.BigEndian
750 buf = make([]byte, m.Size())
754 // field[1] m.SocketID
755 o.PutUint32(buf[pos:pos+4], uint32(m.SocketID))
757 // field[1] m.SocketFilename
758 copy(buf[pos:pos+108], m.SocketFilename)
762 func (m *MemifSocketFilenameDetails) Unmarshal(tmp []byte) error {
763 o := binary.BigEndian
767 // field[1] m.SocketID
768 m.SocketID = uint32(o.Uint32(tmp[pos : pos+4]))
770 // field[1] m.SocketFilename
772 nul := bytes.Index(tmp[pos:pos+108], []byte{0x00})
773 m.SocketFilename = codec.DecodeString(tmp[pos : pos+nul])
779 // MemifSocketFilenameDump represents VPP binary API message 'memif_socket_filename_dump'.
780 type MemifSocketFilenameDump struct{}
782 func (m *MemifSocketFilenameDump) Reset() { *m = MemifSocketFilenameDump{} }
783 func (*MemifSocketFilenameDump) GetMessageName() string { return "memif_socket_filename_dump" }
784 func (*MemifSocketFilenameDump) GetCrcString() string { return "51077d14" }
785 func (*MemifSocketFilenameDump) GetMessageType() api.MessageType { return api.RequestMessage }
787 func (m *MemifSocketFilenameDump) Size() int {
794 func (m *MemifSocketFilenameDump) Marshal(b []byte) ([]byte, error) {
795 o := binary.BigEndian
801 buf = make([]byte, m.Size())
807 func (m *MemifSocketFilenameDump) Unmarshal(tmp []byte) error {
808 o := binary.BigEndian
815 func init() { file_memif_binapi_init() }
816 func file_memif_binapi_init() {
817 api.RegisterMessage((*MemifCreate)(nil), "memif.MemifCreate")
818 api.RegisterMessage((*MemifCreateReply)(nil), "memif.MemifCreateReply")
819 api.RegisterMessage((*MemifDelete)(nil), "memif.MemifDelete")
820 api.RegisterMessage((*MemifDeleteReply)(nil), "memif.MemifDeleteReply")
821 api.RegisterMessage((*MemifDetails)(nil), "memif.MemifDetails")
822 api.RegisterMessage((*MemifDump)(nil), "memif.MemifDump")
823 api.RegisterMessage((*MemifSocketFilenameAddDel)(nil), "memif.MemifSocketFilenameAddDel")
824 api.RegisterMessage((*MemifSocketFilenameAddDelReply)(nil), "memif.MemifSocketFilenameAddDelReply")
825 api.RegisterMessage((*MemifSocketFilenameDetails)(nil), "memif.MemifSocketFilenameDetails")
826 api.RegisterMessage((*MemifSocketFilenameDump)(nil), "memif.MemifSocketFilenameDump")
829 // Messages returns list of all messages in this module.
830 func AllMessages() []api.Message {
831 return []api.Message{
833 (*MemifCreateReply)(nil),
835 (*MemifDeleteReply)(nil),
836 (*MemifDetails)(nil),
838 (*MemifSocketFilenameAddDel)(nil),
839 (*MemifSocketFilenameAddDelReply)(nil),
840 (*MemifSocketFilenameDetails)(nil),
841 (*MemifSocketFilenameDump)(nil),
845 // Reference imports to suppress errors if they are not otherwise used.
846 var _ = api.RegisterMessage
847 var _ = codec.DecodeString
848 var _ = bytes.NewBuffer
849 var _ = context.Background
852 var _ = strings.Contains
854 var _ = binary.BigEndian
855 var _ = math.Float32bits