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