github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/udp_ping/udp_ping.ba.go (about) 1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT. 2 // versions: 3 // binapi-generator: v0.4.0-dev 4 // VPP: 23.02-rc0~189-g57127b32a 5 // source: /usr/share/vpp/api/plugins/udp_ping.api.json 6 7 // Package udp_ping contains generated bindings for API file udp_ping.api. 8 // 9 // Contents: 10 // 4 messages 11 // 12 package udp_ping 13 14 import ( 15 api "git.fd.io/govpp.git/api" 16 codec "git.fd.io/govpp.git/codec" 17 ip_types "github.com/edwarnicke/govpp/binapi/ip_types" 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 = "udp_ping" 28 APIVersion = "3.0.0" 29 VersionCrc = 0x16d961db 30 ) 31 32 // UDPPingAddDel defines message 'udp_ping_add_del'. 33 type UDPPingAddDel struct { 34 SrcIPAddress ip_types.Address `binapi:"address,name=src_ip_address" json:"src_ip_address,omitempty"` 35 DstIPAddress ip_types.Address `binapi:"address,name=dst_ip_address" json:"dst_ip_address,omitempty"` 36 StartSrcPort uint16 `binapi:"u16,name=start_src_port" json:"start_src_port,omitempty"` 37 EndSrcPort uint16 `binapi:"u16,name=end_src_port" json:"end_src_port,omitempty"` 38 StartDstPort uint16 `binapi:"u16,name=start_dst_port" json:"start_dst_port,omitempty"` 39 EndDstPort uint16 `binapi:"u16,name=end_dst_port" json:"end_dst_port,omitempty"` 40 Interval uint16 `binapi:"u16,name=interval" json:"interval,omitempty"` 41 Dis uint8 `binapi:"u8,name=dis" json:"dis,omitempty"` 42 FaultDet uint8 `binapi:"u8,name=fault_det" json:"fault_det,omitempty"` 43 Reserve []byte `binapi:"u8[3],name=reserve" json:"reserve,omitempty"` 44 } 45 46 func (m *UDPPingAddDel) Reset() { *m = UDPPingAddDel{} } 47 func (*UDPPingAddDel) GetMessageName() string { return "udp_ping_add_del" } 48 func (*UDPPingAddDel) GetCrcString() string { return "fa2628fc" } 49 func (*UDPPingAddDel) GetMessageType() api.MessageType { 50 return api.RequestMessage 51 } 52 53 func (m *UDPPingAddDel) Size() (size int) { 54 if m == nil { 55 return 0 56 } 57 size += 1 // m.SrcIPAddress.Af 58 size += 1 * 16 // m.SrcIPAddress.Un 59 size += 1 // m.DstIPAddress.Af 60 size += 1 * 16 // m.DstIPAddress.Un 61 size += 2 // m.StartSrcPort 62 size += 2 // m.EndSrcPort 63 size += 2 // m.StartDstPort 64 size += 2 // m.EndDstPort 65 size += 2 // m.Interval 66 size += 1 // m.Dis 67 size += 1 // m.FaultDet 68 size += 1 * 3 // m.Reserve 69 return size 70 } 71 func (m *UDPPingAddDel) Marshal(b []byte) ([]byte, error) { 72 if b == nil { 73 b = make([]byte, m.Size()) 74 } 75 buf := codec.NewBuffer(b) 76 buf.EncodeUint8(uint8(m.SrcIPAddress.Af)) 77 buf.EncodeBytes(m.SrcIPAddress.Un.XXX_UnionData[:], 16) 78 buf.EncodeUint8(uint8(m.DstIPAddress.Af)) 79 buf.EncodeBytes(m.DstIPAddress.Un.XXX_UnionData[:], 16) 80 buf.EncodeUint16(m.StartSrcPort) 81 buf.EncodeUint16(m.EndSrcPort) 82 buf.EncodeUint16(m.StartDstPort) 83 buf.EncodeUint16(m.EndDstPort) 84 buf.EncodeUint16(m.Interval) 85 buf.EncodeUint8(m.Dis) 86 buf.EncodeUint8(m.FaultDet) 87 buf.EncodeBytes(m.Reserve, 3) 88 return buf.Bytes(), nil 89 } 90 func (m *UDPPingAddDel) Unmarshal(b []byte) error { 91 buf := codec.NewBuffer(b) 92 m.SrcIPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) 93 copy(m.SrcIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 94 m.DstIPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8()) 95 copy(m.DstIPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 96 m.StartSrcPort = buf.DecodeUint16() 97 m.EndSrcPort = buf.DecodeUint16() 98 m.StartDstPort = buf.DecodeUint16() 99 m.EndDstPort = buf.DecodeUint16() 100 m.Interval = buf.DecodeUint16() 101 m.Dis = buf.DecodeUint8() 102 m.FaultDet = buf.DecodeUint8() 103 m.Reserve = make([]byte, 3) 104 copy(m.Reserve, buf.DecodeBytes(len(m.Reserve))) 105 return nil 106 } 107 108 // UDPPingAddDelReply defines message 'udp_ping_add_del_reply'. 109 type UDPPingAddDelReply struct { 110 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 111 } 112 113 func (m *UDPPingAddDelReply) Reset() { *m = UDPPingAddDelReply{} } 114 func (*UDPPingAddDelReply) GetMessageName() string { return "udp_ping_add_del_reply" } 115 func (*UDPPingAddDelReply) GetCrcString() string { return "e8d4e804" } 116 func (*UDPPingAddDelReply) GetMessageType() api.MessageType { 117 return api.ReplyMessage 118 } 119 120 func (m *UDPPingAddDelReply) Size() (size int) { 121 if m == nil { 122 return 0 123 } 124 size += 4 // m.Retval 125 return size 126 } 127 func (m *UDPPingAddDelReply) Marshal(b []byte) ([]byte, error) { 128 if b == nil { 129 b = make([]byte, m.Size()) 130 } 131 buf := codec.NewBuffer(b) 132 buf.EncodeInt32(m.Retval) 133 return buf.Bytes(), nil 134 } 135 func (m *UDPPingAddDelReply) Unmarshal(b []byte) error { 136 buf := codec.NewBuffer(b) 137 m.Retval = buf.DecodeInt32() 138 return nil 139 } 140 141 // UDPPingExport defines message 'udp_ping_export'. 142 type UDPPingExport struct { 143 Enable bool `binapi:"bool,name=enable" json:"enable,omitempty"` 144 } 145 146 func (m *UDPPingExport) Reset() { *m = UDPPingExport{} } 147 func (*UDPPingExport) GetMessageName() string { return "udp_ping_export" } 148 func (*UDPPingExport) GetCrcString() string { return "b3e225d2" } 149 func (*UDPPingExport) GetMessageType() api.MessageType { 150 return api.RequestMessage 151 } 152 153 func (m *UDPPingExport) Size() (size int) { 154 if m == nil { 155 return 0 156 } 157 size += 1 // m.Enable 158 return size 159 } 160 func (m *UDPPingExport) Marshal(b []byte) ([]byte, error) { 161 if b == nil { 162 b = make([]byte, m.Size()) 163 } 164 buf := codec.NewBuffer(b) 165 buf.EncodeBool(m.Enable) 166 return buf.Bytes(), nil 167 } 168 func (m *UDPPingExport) Unmarshal(b []byte) error { 169 buf := codec.NewBuffer(b) 170 m.Enable = buf.DecodeBool() 171 return nil 172 } 173 174 // UDPPingExportReply defines message 'udp_ping_export_reply'. 175 type UDPPingExportReply struct { 176 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 177 } 178 179 func (m *UDPPingExportReply) Reset() { *m = UDPPingExportReply{} } 180 func (*UDPPingExportReply) GetMessageName() string { return "udp_ping_export_reply" } 181 func (*UDPPingExportReply) GetCrcString() string { return "e8d4e804" } 182 func (*UDPPingExportReply) GetMessageType() api.MessageType { 183 return api.ReplyMessage 184 } 185 186 func (m *UDPPingExportReply) Size() (size int) { 187 if m == nil { 188 return 0 189 } 190 size += 4 // m.Retval 191 return size 192 } 193 func (m *UDPPingExportReply) Marshal(b []byte) ([]byte, error) { 194 if b == nil { 195 b = make([]byte, m.Size()) 196 } 197 buf := codec.NewBuffer(b) 198 buf.EncodeInt32(m.Retval) 199 return buf.Bytes(), nil 200 } 201 func (m *UDPPingExportReply) Unmarshal(b []byte) error { 202 buf := codec.NewBuffer(b) 203 m.Retval = buf.DecodeInt32() 204 return nil 205 } 206 207 func init() { file_udp_ping_binapi_init() } 208 func file_udp_ping_binapi_init() { 209 api.RegisterMessage((*UDPPingAddDel)(nil), "udp_ping_add_del_fa2628fc") 210 api.RegisterMessage((*UDPPingAddDelReply)(nil), "udp_ping_add_del_reply_e8d4e804") 211 api.RegisterMessage((*UDPPingExport)(nil), "udp_ping_export_b3e225d2") 212 api.RegisterMessage((*UDPPingExportReply)(nil), "udp_ping_export_reply_e8d4e804") 213 } 214 215 // Messages returns list of all messages in this module. 216 func AllMessages() []api.Message { 217 return []api.Message{ 218 (*UDPPingAddDel)(nil), 219 (*UDPPingAddDelReply)(nil), 220 (*UDPPingExport)(nil), 221 (*UDPPingExportReply)(nil), 222 } 223 }