1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
5 // source: /usr/share/vpp/api/core/af_packet.api.json
8 Package af_packet contains generated code for VPP API file af_packet.api (2.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.
40 ModuleName = "af_packet"
41 // APIVersion is the API version of this module.
43 // VersionCrc is the CRC of this module.
44 VersionCrc = 0xe0b6c022
47 type IfStatusFlags = interface_types.IfStatusFlags
49 type IfType = interface_types.IfType
51 type LinkDuplex = interface_types.LinkDuplex
53 type MtuProto = interface_types.MtuProto
55 type RxMode = interface_types.RxMode
57 type SubIfFlags = interface_types.SubIfFlags
59 type InterfaceIndex = interface_types.InterfaceIndex
61 // MacAddress represents VPP binary API alias 'mac_address'.
62 type MacAddress [6]uint8
64 // AfPacketCreate represents VPP binary API message 'af_packet_create'.
65 type AfPacketCreate struct {
66 HwAddr MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"`
67 UseRandomHwAddr bool `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"`
68 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"`
71 func (m *AfPacketCreate) Reset() { *m = AfPacketCreate{} }
72 func (*AfPacketCreate) GetMessageName() string { return "af_packet_create" }
73 func (*AfPacketCreate) GetCrcString() string { return "a190415f" }
74 func (*AfPacketCreate) GetMessageType() api.MessageType { return api.RequestMessage }
76 func (m *AfPacketCreate) Size() int {
83 // field[1] m.UseRandomHwAddr
85 // field[1] m.HostIfName
89 func (m *AfPacketCreate) Marshal(b []byte) ([]byte, error) {
96 buf = make([]byte, m.Size())
101 for i := 0; i < 6; i++ {
103 if i < len(m.HwAddr) {
104 x = uint8(m.HwAddr[i])
109 // field[1] m.UseRandomHwAddr
110 if m.UseRandomHwAddr {
114 // field[1] m.HostIfName
115 copy(buf[pos:pos+64], m.HostIfName)
119 func (m *AfPacketCreate) Unmarshal(tmp []byte) error {
120 o := binary.BigEndian
125 for i := 0; i < len(m.HwAddr); i++ {
126 m.HwAddr[i] = uint8(tmp[pos])
129 // field[1] m.UseRandomHwAddr
130 m.UseRandomHwAddr = tmp[pos] != 0
132 // field[1] m.HostIfName
134 nul := bytes.Index(tmp[pos:pos+64], []byte{0x00})
135 m.HostIfName = codec.DecodeString(tmp[pos : pos+nul])
141 // AfPacketCreateReply represents VPP binary API message 'af_packet_create_reply'.
142 type AfPacketCreateReply struct {
143 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
144 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
147 func (m *AfPacketCreateReply) Reset() { *m = AfPacketCreateReply{} }
148 func (*AfPacketCreateReply) GetMessageName() string { return "af_packet_create_reply" }
149 func (*AfPacketCreateReply) GetCrcString() string { return "5383d31f" }
150 func (*AfPacketCreateReply) GetMessageType() api.MessageType { return api.ReplyMessage }
152 func (m *AfPacketCreateReply) Size() int {
159 // field[1] m.SwIfIndex
163 func (m *AfPacketCreateReply) Marshal(b []byte) ([]byte, error) {
164 o := binary.BigEndian
170 buf = make([]byte, m.Size())
175 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
177 // field[1] m.SwIfIndex
178 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
182 func (m *AfPacketCreateReply) Unmarshal(tmp []byte) error {
183 o := binary.BigEndian
188 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
190 // field[1] m.SwIfIndex
191 m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
196 // AfPacketDelete represents VPP binary API message 'af_packet_delete'.
197 type AfPacketDelete struct {
198 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"`
201 func (m *AfPacketDelete) Reset() { *m = AfPacketDelete{} }
202 func (*AfPacketDelete) GetMessageName() string { return "af_packet_delete" }
203 func (*AfPacketDelete) GetCrcString() string { return "863fa648" }
204 func (*AfPacketDelete) GetMessageType() api.MessageType { return api.RequestMessage }
206 func (m *AfPacketDelete) Size() int {
211 // field[1] m.HostIfName
215 func (m *AfPacketDelete) Marshal(b []byte) ([]byte, error) {
216 o := binary.BigEndian
222 buf = make([]byte, m.Size())
226 // field[1] m.HostIfName
227 copy(buf[pos:pos+64], m.HostIfName)
231 func (m *AfPacketDelete) Unmarshal(tmp []byte) error {
232 o := binary.BigEndian
236 // field[1] m.HostIfName
238 nul := bytes.Index(tmp[pos:pos+64], []byte{0x00})
239 m.HostIfName = codec.DecodeString(tmp[pos : pos+nul])
245 // AfPacketDeleteReply represents VPP binary API message 'af_packet_delete_reply'.
246 type AfPacketDeleteReply struct {
247 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
250 func (m *AfPacketDeleteReply) Reset() { *m = AfPacketDeleteReply{} }
251 func (*AfPacketDeleteReply) GetMessageName() string { return "af_packet_delete_reply" }
252 func (*AfPacketDeleteReply) GetCrcString() string { return "e8d4e804" }
253 func (*AfPacketDeleteReply) GetMessageType() api.MessageType { return api.ReplyMessage }
255 func (m *AfPacketDeleteReply) Size() int {
264 func (m *AfPacketDeleteReply) Marshal(b []byte) ([]byte, error) {
265 o := binary.BigEndian
271 buf = make([]byte, m.Size())
276 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
280 func (m *AfPacketDeleteReply) Unmarshal(tmp []byte) error {
281 o := binary.BigEndian
286 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
291 // AfPacketDetails represents VPP binary API message 'af_packet_details'.
292 type AfPacketDetails struct {
293 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
294 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty" struc:"[64]byte"`
297 func (m *AfPacketDetails) Reset() { *m = AfPacketDetails{} }
298 func (*AfPacketDetails) GetMessageName() string { return "af_packet_details" }
299 func (*AfPacketDetails) GetCrcString() string { return "58c7c042" }
300 func (*AfPacketDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
302 func (m *AfPacketDetails) Size() int {
307 // field[1] m.SwIfIndex
309 // field[1] m.HostIfName
313 func (m *AfPacketDetails) Marshal(b []byte) ([]byte, error) {
314 o := binary.BigEndian
320 buf = make([]byte, m.Size())
324 // field[1] m.SwIfIndex
325 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
327 // field[1] m.HostIfName
328 copy(buf[pos:pos+64], m.HostIfName)
332 func (m *AfPacketDetails) Unmarshal(tmp []byte) error {
333 o := binary.BigEndian
337 // field[1] m.SwIfIndex
338 m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
340 // field[1] m.HostIfName
342 nul := bytes.Index(tmp[pos:pos+64], []byte{0x00})
343 m.HostIfName = codec.DecodeString(tmp[pos : pos+nul])
349 // AfPacketDump represents VPP binary API message 'af_packet_dump'.
350 type AfPacketDump struct{}
352 func (m *AfPacketDump) Reset() { *m = AfPacketDump{} }
353 func (*AfPacketDump) GetMessageName() string { return "af_packet_dump" }
354 func (*AfPacketDump) GetCrcString() string { return "51077d14" }
355 func (*AfPacketDump) GetMessageType() api.MessageType { return api.RequestMessage }
357 func (m *AfPacketDump) Size() int {
364 func (m *AfPacketDump) Marshal(b []byte) ([]byte, error) {
365 o := binary.BigEndian
371 buf = make([]byte, m.Size())
377 func (m *AfPacketDump) Unmarshal(tmp []byte) error {
378 o := binary.BigEndian
385 // AfPacketSetL4CksumOffload represents VPP binary API message 'af_packet_set_l4_cksum_offload'.
386 type AfPacketSetL4CksumOffload struct {
387 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
388 Set bool `binapi:"bool,name=set" json:"set,omitempty"`
391 func (m *AfPacketSetL4CksumOffload) Reset() { *m = AfPacketSetL4CksumOffload{} }
392 func (*AfPacketSetL4CksumOffload) GetMessageName() string { return "af_packet_set_l4_cksum_offload" }
393 func (*AfPacketSetL4CksumOffload) GetCrcString() string { return "319cd5c8" }
394 func (*AfPacketSetL4CksumOffload) GetMessageType() api.MessageType { return api.RequestMessage }
396 func (m *AfPacketSetL4CksumOffload) Size() int {
401 // field[1] m.SwIfIndex
407 func (m *AfPacketSetL4CksumOffload) Marshal(b []byte) ([]byte, error) {
408 o := binary.BigEndian
414 buf = make([]byte, m.Size())
418 // field[1] m.SwIfIndex
419 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
428 func (m *AfPacketSetL4CksumOffload) Unmarshal(tmp []byte) error {
429 o := binary.BigEndian
433 // field[1] m.SwIfIndex
434 m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
437 m.Set = tmp[pos] != 0
442 // AfPacketSetL4CksumOffloadReply represents VPP binary API message 'af_packet_set_l4_cksum_offload_reply'.
443 type AfPacketSetL4CksumOffloadReply struct {
444 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
447 func (m *AfPacketSetL4CksumOffloadReply) Reset() { *m = AfPacketSetL4CksumOffloadReply{} }
448 func (*AfPacketSetL4CksumOffloadReply) GetMessageName() string {
449 return "af_packet_set_l4_cksum_offload_reply"
451 func (*AfPacketSetL4CksumOffloadReply) GetCrcString() string { return "e8d4e804" }
452 func (*AfPacketSetL4CksumOffloadReply) GetMessageType() api.MessageType { return api.ReplyMessage }
454 func (m *AfPacketSetL4CksumOffloadReply) Size() int {
463 func (m *AfPacketSetL4CksumOffloadReply) Marshal(b []byte) ([]byte, error) {
464 o := binary.BigEndian
470 buf = make([]byte, m.Size())
475 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
479 func (m *AfPacketSetL4CksumOffloadReply) Unmarshal(tmp []byte) error {
480 o := binary.BigEndian
485 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
490 func init() { file_af_packet_binapi_init() }
491 func file_af_packet_binapi_init() {
492 api.RegisterMessage((*AfPacketCreate)(nil), "af_packet.AfPacketCreate")
493 api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet.AfPacketCreateReply")
494 api.RegisterMessage((*AfPacketDelete)(nil), "af_packet.AfPacketDelete")
495 api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet.AfPacketDeleteReply")
496 api.RegisterMessage((*AfPacketDetails)(nil), "af_packet.AfPacketDetails")
497 api.RegisterMessage((*AfPacketDump)(nil), "af_packet.AfPacketDump")
498 api.RegisterMessage((*AfPacketSetL4CksumOffload)(nil), "af_packet.AfPacketSetL4CksumOffload")
499 api.RegisterMessage((*AfPacketSetL4CksumOffloadReply)(nil), "af_packet.AfPacketSetL4CksumOffloadReply")
502 // Messages returns list of all messages in this module.
503 func AllMessages() []api.Message {
504 return []api.Message{
505 (*AfPacketCreate)(nil),
506 (*AfPacketCreateReply)(nil),
507 (*AfPacketDelete)(nil),
508 (*AfPacketDeleteReply)(nil),
509 (*AfPacketDetails)(nil),
510 (*AfPacketDump)(nil),
511 (*AfPacketSetL4CksumOffload)(nil),
512 (*AfPacketSetL4CksumOffloadReply)(nil),
516 // Reference imports to suppress errors if they are not otherwise used.
517 var _ = api.RegisterMessage
518 var _ = codec.DecodeString
519 var _ = bytes.NewBuffer
520 var _ = context.Background
524 var _ = binary.BigEndian
525 var _ = math.Float32bits