github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/arping/arping.ba.go (about) 1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT. 2 // versions: 3 // binapi-generator: v0.10.0-dev 4 // VPP: 23.10-rc0~170-g6f1548434 5 // source: plugins/arping.api.json 6 7 // Package arping contains generated bindings for API file arping.api. 8 // 9 // Contents: 10 // - 2 messages 11 package arping 12 13 import ( 14 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 15 ip_types "github.com/networkservicemesh/govpp/binapi/ip_types" 16 api "go.fd.io/govpp/api" 17 codec "go.fd.io/govpp/codec" 18 ) 19 20 // This is a compile-time assertion to ensure that this generated file 21 // is compatible with the GoVPP api package it is being compiled against. 22 // A compilation error at this line likely means your copy of the 23 // GoVPP api package needs to be updated. 24 const _ = api.GoVppAPIPackageIsVersion2 25 26 const ( 27 APIFile = "arping" 28 APIVersion = "1.0.0" 29 VersionCrc = 0x666f91cc 30 ) 31 32 // - client_index - opaque cookie to identify the sender 33 // - address - address to send arp request or gratuitous arp. 34 // - sw_if_index - interface to send 35 // - repeat - number of packets to send 36 // - interval - if more than 1 packet is sent, the delay between send 37 // - is_garp - is garp or arp request 38 // 39 // Arping defines message 'arping'. 40 type Arping struct { 41 Address ip_types.Address `binapi:"address,name=address" json:"address,omitempty"` 42 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 43 IsGarp bool `binapi:"bool,name=is_garp" json:"is_garp,omitempty"` 44 Repeat uint32 `binapi:"u32,name=repeat,default=1" json:"repeat,omitempty"` 45 Interval float64 `binapi:"f64,name=interval,default=1" json:"interval,omitempty"` 46 } 47 48 func (m *Arping) Reset() { *m = Arping{} } 49 func (*Arping) GetMessageName() string { return "arping" } 50 func (*Arping) GetCrcString() string { return "48817482" } 51 func (*Arping) GetMessageType() api.MessageType { 52 return api.RequestMessage 53 } 54 55 func (m *Arping) Size() (size int) { 56 if m == nil { 57 return 0 58 } 59 size += 1 // m.Address.Af 60 size += 1 * 16 // m.Address.Un 61 size += 4 // m.SwIfIndex 62 size += 1 // m.IsGarp 63 size += 4 // m.Repeat 64 size += 8 // m.Interval 65 return size 66 } 67 func (m *Arping) Marshal(b []byte) ([]byte, error) { 68 if b == nil { 69 b = make([]byte, m.Size()) 70 } 71 buf := codec.NewBuffer(b) 72 buf.EncodeUint8(uint8(m.Address.Af)) 73 buf.EncodeBytes(m.Address.Un.XXX_UnionData[:], 16) 74 buf.EncodeUint32(uint32(m.SwIfIndex)) 75 buf.EncodeBool(m.IsGarp) 76 buf.EncodeUint32(m.Repeat) 77 buf.EncodeFloat64(m.Interval) 78 return buf.Bytes(), nil 79 } 80 func (m *Arping) Unmarshal(b []byte) error { 81 buf := codec.NewBuffer(b) 82 m.Address.Af = ip_types.AddressFamily(buf.DecodeUint8()) 83 copy(m.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 84 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 85 m.IsGarp = buf.DecodeBool() 86 m.Repeat = buf.DecodeUint32() 87 m.Interval = buf.DecodeFloat64() 88 return nil 89 } 90 91 // - context - sender context, to match reply w/ request 92 // - retval - return value for request 93 // @reply_count - return value for reply count 94 // 95 // ArpingReply defines message 'arping_reply'. 96 type ArpingReply struct { 97 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 98 ReplyCount uint32 `binapi:"u32,name=reply_count" json:"reply_count,omitempty"` 99 } 100 101 func (m *ArpingReply) Reset() { *m = ArpingReply{} } 102 func (*ArpingReply) GetMessageName() string { return "arping_reply" } 103 func (*ArpingReply) GetCrcString() string { return "bb9d1cbd" } 104 func (*ArpingReply) GetMessageType() api.MessageType { 105 return api.ReplyMessage 106 } 107 108 func (m *ArpingReply) Size() (size int) { 109 if m == nil { 110 return 0 111 } 112 size += 4 // m.Retval 113 size += 4 // m.ReplyCount 114 return size 115 } 116 func (m *ArpingReply) Marshal(b []byte) ([]byte, error) { 117 if b == nil { 118 b = make([]byte, m.Size()) 119 } 120 buf := codec.NewBuffer(b) 121 buf.EncodeInt32(m.Retval) 122 buf.EncodeUint32(m.ReplyCount) 123 return buf.Bytes(), nil 124 } 125 func (m *ArpingReply) Unmarshal(b []byte) error { 126 buf := codec.NewBuffer(b) 127 m.Retval = buf.DecodeInt32() 128 m.ReplyCount = buf.DecodeUint32() 129 return nil 130 } 131 132 func init() { file_arping_binapi_init() } 133 func file_arping_binapi_init() { 134 api.RegisterMessage((*Arping)(nil), "arping_48817482") 135 api.RegisterMessage((*ArpingReply)(nil), "arping_reply_bb9d1cbd") 136 } 137 138 // Messages returns list of all messages in this module. 139 func AllMessages() []api.Message { 140 return []api.Message{ 141 (*Arping)(nil), 142 (*ArpingReply)(nil), 143 } 144 }