github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/punt/punt.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/punt.api.json 6 7 // Package punt contains generated bindings for API file punt.api. 8 // 9 // Contents: 10 // - 1 enum 11 // - 5 structs 12 // - 1 union 13 // - 10 messages 14 package punt 15 16 import ( 17 "strconv" 18 19 ip_types "github.com/networkservicemesh/govpp/binapi/ip_types" 20 api "go.fd.io/govpp/api" 21 codec "go.fd.io/govpp/codec" 22 ) 23 24 // This is a compile-time assertion to ensure that this generated file 25 // is compatible with the GoVPP api package it is being compiled against. 26 // A compilation error at this line likely means your copy of the 27 // GoVPP api package needs to be updated. 28 const _ = api.GoVppAPIPackageIsVersion2 29 30 const ( 31 APIFile = "punt" 32 APIVersion = "2.2.1" 33 VersionCrc = 0x24d11934 34 ) 35 36 // PuntType defines enum 'punt_type'. 37 type PuntType uint32 38 39 const ( 40 PUNT_API_TYPE_L4 PuntType = 0 41 PUNT_API_TYPE_IP_PROTO PuntType = 1 42 PUNT_API_TYPE_EXCEPTION PuntType = 2 43 ) 44 45 var ( 46 PuntType_name = map[uint32]string{ 47 0: "PUNT_API_TYPE_L4", 48 1: "PUNT_API_TYPE_IP_PROTO", 49 2: "PUNT_API_TYPE_EXCEPTION", 50 } 51 PuntType_value = map[string]uint32{ 52 "PUNT_API_TYPE_L4": 0, 53 "PUNT_API_TYPE_IP_PROTO": 1, 54 "PUNT_API_TYPE_EXCEPTION": 2, 55 } 56 ) 57 58 func (x PuntType) String() string { 59 s, ok := PuntType_name[uint32(x)] 60 if ok { 61 return s 62 } 63 return "PuntType(" + strconv.Itoa(int(x)) + ")" 64 } 65 66 // Punt defines type 'punt'. 67 type Punt struct { 68 Type PuntType `binapi:"punt_type,name=type" json:"type,omitempty"` 69 Punt PuntUnion `binapi:"punt_union,name=punt" json:"punt,omitempty"` 70 } 71 72 // PuntException defines type 'punt_exception'. 73 type PuntException struct { 74 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` 75 } 76 77 // PuntIPProto defines type 'punt_ip_proto'. 78 type PuntIPProto struct { 79 Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` 80 Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"` 81 } 82 83 // PuntL4 defines type 'punt_l4'. 84 type PuntL4 struct { 85 Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"` 86 Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"` 87 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"` 88 } 89 90 // PuntReason defines type 'punt_reason'. 91 type PuntReason struct { 92 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` 93 Name string `binapi:"string[],name=name" json:"name,omitempty"` 94 } 95 96 // PuntUnion defines union 'punt_union'. 97 type PuntUnion struct { 98 // PuntUnion can be one of: 99 // - Exception *PuntException 100 // - L4 *PuntL4 101 // - IPProto *PuntIPProto 102 XXX_UnionData [4]byte 103 } 104 105 func PuntUnionException(a PuntException) (u PuntUnion) { 106 u.SetException(a) 107 return 108 } 109 func (u *PuntUnion) SetException(a PuntException) { 110 buf := codec.NewBuffer(u.XXX_UnionData[:]) 111 buf.EncodeUint32(a.ID) 112 } 113 func (u *PuntUnion) GetException() (a PuntException) { 114 buf := codec.NewBuffer(u.XXX_UnionData[:]) 115 a.ID = buf.DecodeUint32() 116 return 117 } 118 119 func PuntUnionL4(a PuntL4) (u PuntUnion) { 120 u.SetL4(a) 121 return 122 } 123 func (u *PuntUnion) SetL4(a PuntL4) { 124 buf := codec.NewBuffer(u.XXX_UnionData[:]) 125 buf.EncodeUint8(uint8(a.Af)) 126 buf.EncodeUint8(uint8(a.Protocol)) 127 buf.EncodeUint16(a.Port) 128 } 129 func (u *PuntUnion) GetL4() (a PuntL4) { 130 buf := codec.NewBuffer(u.XXX_UnionData[:]) 131 a.Af = ip_types.AddressFamily(buf.DecodeUint8()) 132 a.Protocol = ip_types.IPProto(buf.DecodeUint8()) 133 a.Port = buf.DecodeUint16() 134 return 135 } 136 137 func PuntUnionIPProto(a PuntIPProto) (u PuntUnion) { 138 u.SetIPProto(a) 139 return 140 } 141 func (u *PuntUnion) SetIPProto(a PuntIPProto) { 142 buf := codec.NewBuffer(u.XXX_UnionData[:]) 143 buf.EncodeUint8(uint8(a.Af)) 144 buf.EncodeUint8(uint8(a.Protocol)) 145 } 146 func (u *PuntUnion) GetIPProto() (a PuntIPProto) { 147 buf := codec.NewBuffer(u.XXX_UnionData[:]) 148 a.Af = ip_types.AddressFamily(buf.DecodeUint8()) 149 a.Protocol = ip_types.IPProto(buf.DecodeUint8()) 150 return 151 } 152 153 // PuntReasonDetails defines message 'punt_reason_details'. 154 type PuntReasonDetails struct { 155 Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"` 156 } 157 158 func (m *PuntReasonDetails) Reset() { *m = PuntReasonDetails{} } 159 func (*PuntReasonDetails) GetMessageName() string { return "punt_reason_details" } 160 func (*PuntReasonDetails) GetCrcString() string { return "2c9d4a40" } 161 func (*PuntReasonDetails) GetMessageType() api.MessageType { 162 return api.ReplyMessage 163 } 164 165 func (m *PuntReasonDetails) Size() (size int) { 166 if m == nil { 167 return 0 168 } 169 size += 4 // m.Reason.ID 170 size += 4 + len(m.Reason.Name) // m.Reason.Name 171 return size 172 } 173 func (m *PuntReasonDetails) Marshal(b []byte) ([]byte, error) { 174 if b == nil { 175 b = make([]byte, m.Size()) 176 } 177 buf := codec.NewBuffer(b) 178 buf.EncodeUint32(m.Reason.ID) 179 buf.EncodeString(m.Reason.Name, 0) 180 return buf.Bytes(), nil 181 } 182 func (m *PuntReasonDetails) Unmarshal(b []byte) error { 183 buf := codec.NewBuffer(b) 184 m.Reason.ID = buf.DecodeUint32() 185 m.Reason.Name = buf.DecodeString(0) 186 return nil 187 } 188 189 // Dump all or one of the exception punt reasons 190 // * - - If the string is not set punt dump all reasons 191 // * else dump only the one specified 192 // PuntReasonDump defines message 'punt_reason_dump'. 193 type PuntReasonDump struct { 194 Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"` 195 } 196 197 func (m *PuntReasonDump) Reset() { *m = PuntReasonDump{} } 198 func (*PuntReasonDump) GetMessageName() string { return "punt_reason_dump" } 199 func (*PuntReasonDump) GetCrcString() string { return "5c0dd4fe" } 200 func (*PuntReasonDump) GetMessageType() api.MessageType { 201 return api.RequestMessage 202 } 203 204 func (m *PuntReasonDump) Size() (size int) { 205 if m == nil { 206 return 0 207 } 208 size += 4 // m.Reason.ID 209 size += 4 + len(m.Reason.Name) // m.Reason.Name 210 return size 211 } 212 func (m *PuntReasonDump) Marshal(b []byte) ([]byte, error) { 213 if b == nil { 214 b = make([]byte, m.Size()) 215 } 216 buf := codec.NewBuffer(b) 217 buf.EncodeUint32(m.Reason.ID) 218 buf.EncodeString(m.Reason.Name, 0) 219 return buf.Bytes(), nil 220 } 221 func (m *PuntReasonDump) Unmarshal(b []byte) error { 222 buf := codec.NewBuffer(b) 223 m.Reason.ID = buf.DecodeUint32() 224 m.Reason.Name = buf.DecodeString(0) 225 return nil 226 } 227 228 // PuntSocketDeregister defines message 'punt_socket_deregister'. 229 type PuntSocketDeregister struct { 230 Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"` 231 } 232 233 func (m *PuntSocketDeregister) Reset() { *m = PuntSocketDeregister{} } 234 func (*PuntSocketDeregister) GetMessageName() string { return "punt_socket_deregister" } 235 func (*PuntSocketDeregister) GetCrcString() string { return "75afa766" } 236 func (*PuntSocketDeregister) GetMessageType() api.MessageType { 237 return api.RequestMessage 238 } 239 240 func (m *PuntSocketDeregister) Size() (size int) { 241 if m == nil { 242 return 0 243 } 244 size += 4 // m.Punt.Type 245 size += 1 * 4 // m.Punt.Punt 246 return size 247 } 248 func (m *PuntSocketDeregister) Marshal(b []byte) ([]byte, error) { 249 if b == nil { 250 b = make([]byte, m.Size()) 251 } 252 buf := codec.NewBuffer(b) 253 buf.EncodeUint32(uint32(m.Punt.Type)) 254 buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4) 255 return buf.Bytes(), nil 256 } 257 func (m *PuntSocketDeregister) Unmarshal(b []byte) error { 258 buf := codec.NewBuffer(b) 259 m.Punt.Type = PuntType(buf.DecodeUint32()) 260 copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4)) 261 return nil 262 } 263 264 // PuntSocketDeregisterReply defines message 'punt_socket_deregister_reply'. 265 type PuntSocketDeregisterReply struct { 266 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 267 } 268 269 func (m *PuntSocketDeregisterReply) Reset() { *m = PuntSocketDeregisterReply{} } 270 func (*PuntSocketDeregisterReply) GetMessageName() string { return "punt_socket_deregister_reply" } 271 func (*PuntSocketDeregisterReply) GetCrcString() string { return "e8d4e804" } 272 func (*PuntSocketDeregisterReply) GetMessageType() api.MessageType { 273 return api.ReplyMessage 274 } 275 276 func (m *PuntSocketDeregisterReply) Size() (size int) { 277 if m == nil { 278 return 0 279 } 280 size += 4 // m.Retval 281 return size 282 } 283 func (m *PuntSocketDeregisterReply) Marshal(b []byte) ([]byte, error) { 284 if b == nil { 285 b = make([]byte, m.Size()) 286 } 287 buf := codec.NewBuffer(b) 288 buf.EncodeInt32(m.Retval) 289 return buf.Bytes(), nil 290 } 291 func (m *PuntSocketDeregisterReply) Unmarshal(b []byte) error { 292 buf := codec.NewBuffer(b) 293 m.Retval = buf.DecodeInt32() 294 return nil 295 } 296 297 // PuntSocketDetails defines message 'punt_socket_details'. 298 type PuntSocketDetails struct { 299 Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"` 300 Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"` 301 } 302 303 func (m *PuntSocketDetails) Reset() { *m = PuntSocketDetails{} } 304 func (*PuntSocketDetails) GetMessageName() string { return "punt_socket_details" } 305 func (*PuntSocketDetails) GetCrcString() string { return "330466e4" } 306 func (*PuntSocketDetails) GetMessageType() api.MessageType { 307 return api.ReplyMessage 308 } 309 310 func (m *PuntSocketDetails) Size() (size int) { 311 if m == nil { 312 return 0 313 } 314 size += 4 // m.Punt.Type 315 size += 1 * 4 // m.Punt.Punt 316 size += 108 // m.Pathname 317 return size 318 } 319 func (m *PuntSocketDetails) Marshal(b []byte) ([]byte, error) { 320 if b == nil { 321 b = make([]byte, m.Size()) 322 } 323 buf := codec.NewBuffer(b) 324 buf.EncodeUint32(uint32(m.Punt.Type)) 325 buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4) 326 buf.EncodeString(m.Pathname, 108) 327 return buf.Bytes(), nil 328 } 329 func (m *PuntSocketDetails) Unmarshal(b []byte) error { 330 buf := codec.NewBuffer(b) 331 m.Punt.Type = PuntType(buf.DecodeUint32()) 332 copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4)) 333 m.Pathname = buf.DecodeString(108) 334 return nil 335 } 336 337 // PuntSocketDump defines message 'punt_socket_dump'. 338 type PuntSocketDump struct { 339 Type PuntType `binapi:"punt_type,name=type" json:"type,omitempty"` 340 } 341 342 func (m *PuntSocketDump) Reset() { *m = PuntSocketDump{} } 343 func (*PuntSocketDump) GetMessageName() string { return "punt_socket_dump" } 344 func (*PuntSocketDump) GetCrcString() string { return "916fb004" } 345 func (*PuntSocketDump) GetMessageType() api.MessageType { 346 return api.RequestMessage 347 } 348 349 func (m *PuntSocketDump) Size() (size int) { 350 if m == nil { 351 return 0 352 } 353 size += 4 // m.Type 354 return size 355 } 356 func (m *PuntSocketDump) Marshal(b []byte) ([]byte, error) { 357 if b == nil { 358 b = make([]byte, m.Size()) 359 } 360 buf := codec.NewBuffer(b) 361 buf.EncodeUint32(uint32(m.Type)) 362 return buf.Bytes(), nil 363 } 364 func (m *PuntSocketDump) Unmarshal(b []byte) error { 365 buf := codec.NewBuffer(b) 366 m.Type = PuntType(buf.DecodeUint32()) 367 return nil 368 } 369 370 // Punt traffic to the host via socket 371 // - header_version - expected meta data header version (currently 1) 372 // - punt - punt definition 373 // 374 // PuntSocketRegister defines message 'punt_socket_register'. 375 type PuntSocketRegister struct { 376 HeaderVersion uint32 `binapi:"u32,name=header_version" json:"header_version,omitempty"` 377 Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"` 378 Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"` 379 } 380 381 func (m *PuntSocketRegister) Reset() { *m = PuntSocketRegister{} } 382 func (*PuntSocketRegister) GetMessageName() string { return "punt_socket_register" } 383 func (*PuntSocketRegister) GetCrcString() string { return "7875badb" } 384 func (*PuntSocketRegister) GetMessageType() api.MessageType { 385 return api.RequestMessage 386 } 387 388 func (m *PuntSocketRegister) Size() (size int) { 389 if m == nil { 390 return 0 391 } 392 size += 4 // m.HeaderVersion 393 size += 4 // m.Punt.Type 394 size += 1 * 4 // m.Punt.Punt 395 size += 108 // m.Pathname 396 return size 397 } 398 func (m *PuntSocketRegister) Marshal(b []byte) ([]byte, error) { 399 if b == nil { 400 b = make([]byte, m.Size()) 401 } 402 buf := codec.NewBuffer(b) 403 buf.EncodeUint32(m.HeaderVersion) 404 buf.EncodeUint32(uint32(m.Punt.Type)) 405 buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4) 406 buf.EncodeString(m.Pathname, 108) 407 return buf.Bytes(), nil 408 } 409 func (m *PuntSocketRegister) Unmarshal(b []byte) error { 410 buf := codec.NewBuffer(b) 411 m.HeaderVersion = buf.DecodeUint32() 412 m.Punt.Type = PuntType(buf.DecodeUint32()) 413 copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4)) 414 m.Pathname = buf.DecodeString(108) 415 return nil 416 } 417 418 // PuntSocketRegisterReply defines message 'punt_socket_register_reply'. 419 type PuntSocketRegisterReply struct { 420 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 421 Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"` 422 } 423 424 func (m *PuntSocketRegisterReply) Reset() { *m = PuntSocketRegisterReply{} } 425 func (*PuntSocketRegisterReply) GetMessageName() string { return "punt_socket_register_reply" } 426 func (*PuntSocketRegisterReply) GetCrcString() string { return "bd30ae90" } 427 func (*PuntSocketRegisterReply) GetMessageType() api.MessageType { 428 return api.ReplyMessage 429 } 430 431 func (m *PuntSocketRegisterReply) Size() (size int) { 432 if m == nil { 433 return 0 434 } 435 size += 4 // m.Retval 436 size += 108 // m.Pathname 437 return size 438 } 439 func (m *PuntSocketRegisterReply) Marshal(b []byte) ([]byte, error) { 440 if b == nil { 441 b = make([]byte, m.Size()) 442 } 443 buf := codec.NewBuffer(b) 444 buf.EncodeInt32(m.Retval) 445 buf.EncodeString(m.Pathname, 108) 446 return buf.Bytes(), nil 447 } 448 func (m *PuntSocketRegisterReply) Unmarshal(b []byte) error { 449 buf := codec.NewBuffer(b) 450 m.Retval = buf.DecodeInt32() 451 m.Pathname = buf.DecodeString(108) 452 return nil 453 } 454 455 // Punt traffic to the host 456 // - is_add - add punt if non-zero, else delete 457 // - punt - punt definition, only UDP (0x11) is supported 458 // 459 // SetPunt defines message 'set_punt'. 460 type SetPunt struct { 461 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` 462 Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"` 463 } 464 465 func (m *SetPunt) Reset() { *m = SetPunt{} } 466 func (*SetPunt) GetMessageName() string { return "set_punt" } 467 func (*SetPunt) GetCrcString() string { return "47d0e347" } 468 func (*SetPunt) GetMessageType() api.MessageType { 469 return api.RequestMessage 470 } 471 472 func (m *SetPunt) Size() (size int) { 473 if m == nil { 474 return 0 475 } 476 size += 1 // m.IsAdd 477 size += 4 // m.Punt.Type 478 size += 1 * 4 // m.Punt.Punt 479 return size 480 } 481 func (m *SetPunt) Marshal(b []byte) ([]byte, error) { 482 if b == nil { 483 b = make([]byte, m.Size()) 484 } 485 buf := codec.NewBuffer(b) 486 buf.EncodeBool(m.IsAdd) 487 buf.EncodeUint32(uint32(m.Punt.Type)) 488 buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4) 489 return buf.Bytes(), nil 490 } 491 func (m *SetPunt) Unmarshal(b []byte) error { 492 buf := codec.NewBuffer(b) 493 m.IsAdd = buf.DecodeBool() 494 m.Punt.Type = PuntType(buf.DecodeUint32()) 495 copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4)) 496 return nil 497 } 498 499 // SetPuntReply defines message 'set_punt_reply'. 500 type SetPuntReply struct { 501 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 502 } 503 504 func (m *SetPuntReply) Reset() { *m = SetPuntReply{} } 505 func (*SetPuntReply) GetMessageName() string { return "set_punt_reply" } 506 func (*SetPuntReply) GetCrcString() string { return "e8d4e804" } 507 func (*SetPuntReply) GetMessageType() api.MessageType { 508 return api.ReplyMessage 509 } 510 511 func (m *SetPuntReply) Size() (size int) { 512 if m == nil { 513 return 0 514 } 515 size += 4 // m.Retval 516 return size 517 } 518 func (m *SetPuntReply) Marshal(b []byte) ([]byte, error) { 519 if b == nil { 520 b = make([]byte, m.Size()) 521 } 522 buf := codec.NewBuffer(b) 523 buf.EncodeInt32(m.Retval) 524 return buf.Bytes(), nil 525 } 526 func (m *SetPuntReply) Unmarshal(b []byte) error { 527 buf := codec.NewBuffer(b) 528 m.Retval = buf.DecodeInt32() 529 return nil 530 } 531 532 func init() { file_punt_binapi_init() } 533 func file_punt_binapi_init() { 534 api.RegisterMessage((*PuntReasonDetails)(nil), "punt_reason_details_2c9d4a40") 535 api.RegisterMessage((*PuntReasonDump)(nil), "punt_reason_dump_5c0dd4fe") 536 api.RegisterMessage((*PuntSocketDeregister)(nil), "punt_socket_deregister_75afa766") 537 api.RegisterMessage((*PuntSocketDeregisterReply)(nil), "punt_socket_deregister_reply_e8d4e804") 538 api.RegisterMessage((*PuntSocketDetails)(nil), "punt_socket_details_330466e4") 539 api.RegisterMessage((*PuntSocketDump)(nil), "punt_socket_dump_916fb004") 540 api.RegisterMessage((*PuntSocketRegister)(nil), "punt_socket_register_7875badb") 541 api.RegisterMessage((*PuntSocketRegisterReply)(nil), "punt_socket_register_reply_bd30ae90") 542 api.RegisterMessage((*SetPunt)(nil), "set_punt_47d0e347") 543 api.RegisterMessage((*SetPuntReply)(nil), "set_punt_reply_e8d4e804") 544 } 545 546 // Messages returns list of all messages in this module. 547 func AllMessages() []api.Message { 548 return []api.Message{ 549 (*PuntReasonDetails)(nil), 550 (*PuntReasonDump)(nil), 551 (*PuntSocketDeregister)(nil), 552 (*PuntSocketDeregisterReply)(nil), 553 (*PuntSocketDetails)(nil), 554 (*PuntSocketDump)(nil), 555 (*PuntSocketRegister)(nil), 556 (*PuntSocketRegisterReply)(nil), 557 (*SetPunt)(nil), 558 (*SetPuntReply)(nil), 559 } 560 }