github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/udp/udp.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: core/udp.api.json 6 7 // Package udp contains generated bindings for API file udp.api. 8 // 9 // Contents: 10 // - 1 enum 11 // - 2 structs 12 // - 8 messages 13 package udp 14 15 import ( 16 "strconv" 17 18 ip_types "github.com/networkservicemesh/govpp/binapi/ip_types" 19 api "go.fd.io/govpp/api" 20 codec "go.fd.io/govpp/codec" 21 ) 22 23 // This is a compile-time assertion to ensure that this generated file 24 // is compatible with the GoVPP api package it is being compiled against. 25 // A compilation error at this line likely means your copy of the 26 // GoVPP api package needs to be updated. 27 const _ = api.GoVppAPIPackageIsVersion2 28 29 const ( 30 APIFile = "udp" 31 APIVersion = "1.1.0" 32 VersionCrc = 0x6804c5af 33 ) 34 35 // UDPDecapNextProto defines enum 'udp_decap_next_proto'. 36 type UDPDecapNextProto uint32 37 38 const ( 39 UDP_API_DECAP_PROTO_IP4 UDPDecapNextProto = 0 40 UDP_API_DECAP_PROTO_IP6 UDPDecapNextProto = 1 41 UDP_API_DECAP_PROTO_MPLS UDPDecapNextProto = 2 42 ) 43 44 var ( 45 UDPDecapNextProto_name = map[uint32]string{ 46 0: "UDP_API_DECAP_PROTO_IP4", 47 1: "UDP_API_DECAP_PROTO_IP6", 48 2: "UDP_API_DECAP_PROTO_MPLS", 49 } 50 UDPDecapNextProto_value = map[string]uint32{ 51 "UDP_API_DECAP_PROTO_IP4": 0, 52 "UDP_API_DECAP_PROTO_IP6": 1, 53 "UDP_API_DECAP_PROTO_MPLS": 2, 54 } 55 ) 56 57 func (x UDPDecapNextProto) String() string { 58 s, ok := UDPDecapNextProto_name[uint32(x)] 59 if ok { 60 return s 61 } 62 return "UDPDecapNextProto(" + strconv.Itoa(int(x)) + ")" 63 } 64 65 // UDPDecap defines type 'udp_decap'. 66 type UDPDecap struct { 67 IsIP4 uint8 `binapi:"u8,name=is_ip4" json:"is_ip4,omitempty"` 68 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` 69 NextProto UDPDecapNextProto `binapi:"udp_decap_next_proto,name=next_proto" json:"next_proto,omitempty"` 70 } 71 72 // UDPEncap defines type 'udp_encap'. 73 type UDPEncap struct { 74 TableID uint32 `binapi:"u32,name=table_id" json:"table_id,omitempty"` 75 SrcPort uint16 `binapi:"u16,name=src_port" json:"src_port,omitempty"` 76 DstPort uint16 `binapi:"u16,name=dst_port" json:"dst_port,omitempty"` 77 SrcIP ip_types.Address `binapi:"address,name=src_ip" json:"src_ip,omitempty"` 78 DstIP ip_types.Address `binapi:"address,name=dst_ip" json:"dst_ip,omitempty"` 79 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` 80 } 81 82 // * @brief Add/Del UDP decap 83 // - - is_add - add decap if non-zero, else delete 84 // - - udp_decap - UDP decap description 85 // 86 // UDPDecapAddDel defines message 'udp_decap_add_del'. 87 type UDPDecapAddDel struct { 88 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` 89 UDPDecap UDPDecap `binapi:"udp_decap,name=udp_decap" json:"udp_decap,omitempty"` 90 } 91 92 func (m *UDPDecapAddDel) Reset() { *m = UDPDecapAddDel{} } 93 func (*UDPDecapAddDel) GetMessageName() string { return "udp_decap_add_del" } 94 func (*UDPDecapAddDel) GetCrcString() string { return "d14a4f47" } 95 func (*UDPDecapAddDel) GetMessageType() api.MessageType { 96 return api.RequestMessage 97 } 98 99 func (m *UDPDecapAddDel) Size() (size int) { 100 if m == nil { 101 return 0 102 } 103 size += 1 // m.IsAdd 104 size += 1 // m.UDPDecap.IsIP4 105 size += 2 // m.UDPDecap.Port 106 size += 4 // m.UDPDecap.NextProto 107 return size 108 } 109 func (m *UDPDecapAddDel) Marshal(b []byte) ([]byte, error) { 110 if b == nil { 111 b = make([]byte, m.Size()) 112 } 113 buf := codec.NewBuffer(b) 114 buf.EncodeBool(m.IsAdd) 115 buf.EncodeUint8(m.UDPDecap.IsIP4) 116 buf.EncodeUint16(m.UDPDecap.Port) 117 buf.EncodeUint32(uint32(m.UDPDecap.NextProto)) 118 return buf.Bytes(), nil 119 } 120 func (m *UDPDecapAddDel) Unmarshal(b []byte) error { 121 buf := codec.NewBuffer(b) 122 m.IsAdd = buf.DecodeBool() 123 m.UDPDecap.IsIP4 = buf.DecodeUint8() 124 m.UDPDecap.Port = buf.DecodeUint16() 125 m.UDPDecap.NextProto = UDPDecapNextProto(buf.DecodeUint32()) 126 return nil 127 } 128 129 // UDPDecapAddDelReply defines message 'udp_decap_add_del_reply'. 130 type UDPDecapAddDelReply struct { 131 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 132 } 133 134 func (m *UDPDecapAddDelReply) Reset() { *m = UDPDecapAddDelReply{} } 135 func (*UDPDecapAddDelReply) GetMessageName() string { return "udp_decap_add_del_reply" } 136 func (*UDPDecapAddDelReply) GetCrcString() string { return "e8d4e804" } 137 func (*UDPDecapAddDelReply) GetMessageType() api.MessageType { 138 return api.ReplyMessage 139 } 140 141 func (m *UDPDecapAddDelReply) Size() (size int) { 142 if m == nil { 143 return 0 144 } 145 size += 4 // m.Retval 146 return size 147 } 148 func (m *UDPDecapAddDelReply) Marshal(b []byte) ([]byte, error) { 149 if b == nil { 150 b = make([]byte, m.Size()) 151 } 152 buf := codec.NewBuffer(b) 153 buf.EncodeInt32(m.Retval) 154 return buf.Bytes(), nil 155 } 156 func (m *UDPDecapAddDelReply) Unmarshal(b []byte) error { 157 buf := codec.NewBuffer(b) 158 m.Retval = buf.DecodeInt32() 159 return nil 160 } 161 162 // * @brief Add UDP encap 163 // - - udp_encap - UDP encap description 164 // 165 // UDPEncapAdd defines message 'udp_encap_add'. 166 type UDPEncapAdd struct { 167 UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"` 168 } 169 170 func (m *UDPEncapAdd) Reset() { *m = UDPEncapAdd{} } 171 func (*UDPEncapAdd) GetMessageName() string { return "udp_encap_add" } 172 func (*UDPEncapAdd) GetCrcString() string { return "f74a60b1" } 173 func (*UDPEncapAdd) GetMessageType() api.MessageType { 174 return api.RequestMessage 175 } 176 177 func (m *UDPEncapAdd) Size() (size int) { 178 if m == nil { 179 return 0 180 } 181 size += 4 // m.UDPEncap.TableID 182 size += 2 // m.UDPEncap.SrcPort 183 size += 2 // m.UDPEncap.DstPort 184 size += 1 // m.UDPEncap.SrcIP.Af 185 size += 1 * 16 // m.UDPEncap.SrcIP.Un 186 size += 1 // m.UDPEncap.DstIP.Af 187 size += 1 * 16 // m.UDPEncap.DstIP.Un 188 size += 4 // m.UDPEncap.ID 189 return size 190 } 191 func (m *UDPEncapAdd) Marshal(b []byte) ([]byte, error) { 192 if b == nil { 193 b = make([]byte, m.Size()) 194 } 195 buf := codec.NewBuffer(b) 196 buf.EncodeUint32(m.UDPEncap.TableID) 197 buf.EncodeUint16(m.UDPEncap.SrcPort) 198 buf.EncodeUint16(m.UDPEncap.DstPort) 199 buf.EncodeUint8(uint8(m.UDPEncap.SrcIP.Af)) 200 buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 16) 201 buf.EncodeUint8(uint8(m.UDPEncap.DstIP.Af)) 202 buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 16) 203 buf.EncodeUint32(m.UDPEncap.ID) 204 return buf.Bytes(), nil 205 } 206 func (m *UDPEncapAdd) Unmarshal(b []byte) error { 207 buf := codec.NewBuffer(b) 208 m.UDPEncap.TableID = buf.DecodeUint32() 209 m.UDPEncap.SrcPort = buf.DecodeUint16() 210 m.UDPEncap.DstPort = buf.DecodeUint16() 211 m.UDPEncap.SrcIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) 212 copy(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 213 m.UDPEncap.DstIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) 214 copy(m.UDPEncap.DstIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 215 m.UDPEncap.ID = buf.DecodeUint32() 216 return nil 217 } 218 219 // * @brief Add UDP encap reply 220 // - - retval - success/failure return value 221 // - - id - The ID of the encap object that should be used on delete 222 // - and when reading stats from the stats segment. 223 // 224 // UDPEncapAddReply defines message 'udp_encap_add_reply'. 225 type UDPEncapAddReply struct { 226 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 227 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` 228 } 229 230 func (m *UDPEncapAddReply) Reset() { *m = UDPEncapAddReply{} } 231 func (*UDPEncapAddReply) GetMessageName() string { return "udp_encap_add_reply" } 232 func (*UDPEncapAddReply) GetCrcString() string { return "e2fc8294" } 233 func (*UDPEncapAddReply) GetMessageType() api.MessageType { 234 return api.ReplyMessage 235 } 236 237 func (m *UDPEncapAddReply) Size() (size int) { 238 if m == nil { 239 return 0 240 } 241 size += 4 // m.Retval 242 size += 4 // m.ID 243 return size 244 } 245 func (m *UDPEncapAddReply) Marshal(b []byte) ([]byte, error) { 246 if b == nil { 247 b = make([]byte, m.Size()) 248 } 249 buf := codec.NewBuffer(b) 250 buf.EncodeInt32(m.Retval) 251 buf.EncodeUint32(m.ID) 252 return buf.Bytes(), nil 253 } 254 func (m *UDPEncapAddReply) Unmarshal(b []byte) error { 255 buf := codec.NewBuffer(b) 256 m.Retval = buf.DecodeInt32() 257 m.ID = buf.DecodeUint32() 258 return nil 259 } 260 261 // * @brief Del UDP encap 262 // - - id - ID of the encap object the client chose during the add 263 // 264 // UDPEncapDel defines message 'udp_encap_del'. 265 type UDPEncapDel struct { 266 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` 267 } 268 269 func (m *UDPEncapDel) Reset() { *m = UDPEncapDel{} } 270 func (*UDPEncapDel) GetMessageName() string { return "udp_encap_del" } 271 func (*UDPEncapDel) GetCrcString() string { return "3a91bde5" } 272 func (*UDPEncapDel) GetMessageType() api.MessageType { 273 return api.RequestMessage 274 } 275 276 func (m *UDPEncapDel) Size() (size int) { 277 if m == nil { 278 return 0 279 } 280 size += 4 // m.ID 281 return size 282 } 283 func (m *UDPEncapDel) Marshal(b []byte) ([]byte, error) { 284 if b == nil { 285 b = make([]byte, m.Size()) 286 } 287 buf := codec.NewBuffer(b) 288 buf.EncodeUint32(m.ID) 289 return buf.Bytes(), nil 290 } 291 func (m *UDPEncapDel) Unmarshal(b []byte) error { 292 buf := codec.NewBuffer(b) 293 m.ID = buf.DecodeUint32() 294 return nil 295 } 296 297 // UDPEncapDelReply defines message 'udp_encap_del_reply'. 298 type UDPEncapDelReply struct { 299 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 300 } 301 302 func (m *UDPEncapDelReply) Reset() { *m = UDPEncapDelReply{} } 303 func (*UDPEncapDelReply) GetMessageName() string { return "udp_encap_del_reply" } 304 func (*UDPEncapDelReply) GetCrcString() string { return "e8d4e804" } 305 func (*UDPEncapDelReply) GetMessageType() api.MessageType { 306 return api.ReplyMessage 307 } 308 309 func (m *UDPEncapDelReply) Size() (size int) { 310 if m == nil { 311 return 0 312 } 313 size += 4 // m.Retval 314 return size 315 } 316 func (m *UDPEncapDelReply) Marshal(b []byte) ([]byte, error) { 317 if b == nil { 318 b = make([]byte, m.Size()) 319 } 320 buf := codec.NewBuffer(b) 321 buf.EncodeInt32(m.Retval) 322 return buf.Bytes(), nil 323 } 324 func (m *UDPEncapDelReply) Unmarshal(b []byte) error { 325 buf := codec.NewBuffer(b) 326 m.Retval = buf.DecodeInt32() 327 return nil 328 } 329 330 // * @brief UDP encap details during dump 331 // UDPEncapDetails defines message 'udp_encap_details'. 332 type UDPEncapDetails struct { 333 UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"` 334 } 335 336 func (m *UDPEncapDetails) Reset() { *m = UDPEncapDetails{} } 337 func (*UDPEncapDetails) GetMessageName() string { return "udp_encap_details" } 338 func (*UDPEncapDetails) GetCrcString() string { return "8cfb9c76" } 339 func (*UDPEncapDetails) GetMessageType() api.MessageType { 340 return api.ReplyMessage 341 } 342 343 func (m *UDPEncapDetails) Size() (size int) { 344 if m == nil { 345 return 0 346 } 347 size += 4 // m.UDPEncap.TableID 348 size += 2 // m.UDPEncap.SrcPort 349 size += 2 // m.UDPEncap.DstPort 350 size += 1 // m.UDPEncap.SrcIP.Af 351 size += 1 * 16 // m.UDPEncap.SrcIP.Un 352 size += 1 // m.UDPEncap.DstIP.Af 353 size += 1 * 16 // m.UDPEncap.DstIP.Un 354 size += 4 // m.UDPEncap.ID 355 return size 356 } 357 func (m *UDPEncapDetails) Marshal(b []byte) ([]byte, error) { 358 if b == nil { 359 b = make([]byte, m.Size()) 360 } 361 buf := codec.NewBuffer(b) 362 buf.EncodeUint32(m.UDPEncap.TableID) 363 buf.EncodeUint16(m.UDPEncap.SrcPort) 364 buf.EncodeUint16(m.UDPEncap.DstPort) 365 buf.EncodeUint8(uint8(m.UDPEncap.SrcIP.Af)) 366 buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 16) 367 buf.EncodeUint8(uint8(m.UDPEncap.DstIP.Af)) 368 buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 16) 369 buf.EncodeUint32(m.UDPEncap.ID) 370 return buf.Bytes(), nil 371 } 372 func (m *UDPEncapDetails) Unmarshal(b []byte) error { 373 buf := codec.NewBuffer(b) 374 m.UDPEncap.TableID = buf.DecodeUint32() 375 m.UDPEncap.SrcPort = buf.DecodeUint16() 376 m.UDPEncap.DstPort = buf.DecodeUint16() 377 m.UDPEncap.SrcIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) 378 copy(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 379 m.UDPEncap.DstIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) 380 copy(m.UDPEncap.DstIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) 381 m.UDPEncap.ID = buf.DecodeUint32() 382 return nil 383 } 384 385 // * @brief dump UDP encaps 386 // UDPEncapDump defines message 'udp_encap_dump'. 387 type UDPEncapDump struct{} 388 389 func (m *UDPEncapDump) Reset() { *m = UDPEncapDump{} } 390 func (*UDPEncapDump) GetMessageName() string { return "udp_encap_dump" } 391 func (*UDPEncapDump) GetCrcString() string { return "51077d14" } 392 func (*UDPEncapDump) GetMessageType() api.MessageType { 393 return api.RequestMessage 394 } 395 396 func (m *UDPEncapDump) Size() (size int) { 397 if m == nil { 398 return 0 399 } 400 return size 401 } 402 func (m *UDPEncapDump) Marshal(b []byte) ([]byte, error) { 403 if b == nil { 404 b = make([]byte, m.Size()) 405 } 406 buf := codec.NewBuffer(b) 407 return buf.Bytes(), nil 408 } 409 func (m *UDPEncapDump) Unmarshal(b []byte) error { 410 return nil 411 } 412 413 func init() { file_udp_binapi_init() } 414 func file_udp_binapi_init() { 415 api.RegisterMessage((*UDPDecapAddDel)(nil), "udp_decap_add_del_d14a4f47") 416 api.RegisterMessage((*UDPDecapAddDelReply)(nil), "udp_decap_add_del_reply_e8d4e804") 417 api.RegisterMessage((*UDPEncapAdd)(nil), "udp_encap_add_f74a60b1") 418 api.RegisterMessage((*UDPEncapAddReply)(nil), "udp_encap_add_reply_e2fc8294") 419 api.RegisterMessage((*UDPEncapDel)(nil), "udp_encap_del_3a91bde5") 420 api.RegisterMessage((*UDPEncapDelReply)(nil), "udp_encap_del_reply_e8d4e804") 421 api.RegisterMessage((*UDPEncapDetails)(nil), "udp_encap_details_8cfb9c76") 422 api.RegisterMessage((*UDPEncapDump)(nil), "udp_encap_dump_51077d14") 423 } 424 425 // Messages returns list of all messages in this module. 426 func AllMessages() []api.Message { 427 return []api.Message{ 428 (*UDPDecapAddDel)(nil), 429 (*UDPDecapAddDelReply)(nil), 430 (*UDPEncapAdd)(nil), 431 (*UDPEncapAddReply)(nil), 432 (*UDPEncapDel)(nil), 433 (*UDPEncapDelReply)(nil), 434 (*UDPEncapDetails)(nil), 435 (*UDPEncapDump)(nil), 436 } 437 }