github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/nsh/nsh.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/nsh.api.json 6 7 // Package nsh contains generated bindings for API file nsh.api. 8 // 9 // Contents: 10 // - 8 messages 11 package nsh 12 13 import ( 14 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 15 api "go.fd.io/govpp/api" 16 codec "go.fd.io/govpp/codec" 17 ) 18 19 // This is a compile-time assertion to ensure that this generated file 20 // is compatible with the GoVPP api package it is being compiled against. 21 // A compilation error at this line likely means your copy of the 22 // GoVPP api package needs to be updated. 23 const _ = api.GoVppAPIPackageIsVersion2 24 25 const ( 26 APIFile = "nsh" 27 APIVersion = "1.0.0" 28 VersionCrc = 0xc2f3127d 29 ) 30 31 // /** Set or delete an NSH header entry keyed by NSP/NSI 32 // - is_add - add address if non-zero, else delete 33 // - nsp_nsi - Key for nsh_header_t entry to map to. : 24bit NSP 8bit NSI 34 // - md_type - metadata type [1|2] - only MDType1 supported today 35 // - ver_o_c - version, O-bit and C-bit (see nsh_packet.h) 36 // - ttl - indicates the maximum SFF hops for an SFP 37 // - length - header length in n x 32bits, should be 6 for MDtype1 38 // - next_protocol - next protocol encapsulated behind NSH header: 1=Ethernet, 2=IP4, 3=IP6 39 // - c1 - 32bit Metadata type1 field (context1) 40 // - c2 - 32bit Metadata type1 field (context2) 41 // - c3 - 32bit Metadata type1 field (context3) 42 // - c4 - 32bit Metadata type1 field (context4) 43 // - tlvs - Metadata Type 2 only, Type Length Value metadata. 44 // 45 // NshAddDelEntry defines message 'nsh_add_del_entry'. 46 type NshAddDelEntry struct { 47 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` 48 NspNsi uint32 `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"` 49 MdType uint8 `binapi:"u8,name=md_type" json:"md_type,omitempty"` 50 VerOC uint8 `binapi:"u8,name=ver_o_c" json:"ver_o_c,omitempty"` 51 TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` 52 Length uint8 `binapi:"u8,name=length" json:"length,omitempty"` 53 NextProtocol uint8 `binapi:"u8,name=next_protocol" json:"next_protocol,omitempty"` 54 C1 uint32 `binapi:"u32,name=c1" json:"c1,omitempty"` 55 C2 uint32 `binapi:"u32,name=c2" json:"c2,omitempty"` 56 C3 uint32 `binapi:"u32,name=c3" json:"c3,omitempty"` 57 C4 uint32 `binapi:"u32,name=c4" json:"c4,omitempty"` 58 TlvLength uint8 `binapi:"u8,name=tlv_length" json:"tlv_length,omitempty"` 59 Tlv []byte `binapi:"u8[248],name=tlv" json:"tlv,omitempty"` 60 } 61 62 func (m *NshAddDelEntry) Reset() { *m = NshAddDelEntry{} } 63 func (*NshAddDelEntry) GetMessageName() string { return "nsh_add_del_entry" } 64 func (*NshAddDelEntry) GetCrcString() string { return "7dea480b" } 65 func (*NshAddDelEntry) GetMessageType() api.MessageType { 66 return api.RequestMessage 67 } 68 69 func (m *NshAddDelEntry) Size() (size int) { 70 if m == nil { 71 return 0 72 } 73 size += 1 // m.IsAdd 74 size += 4 // m.NspNsi 75 size += 1 // m.MdType 76 size += 1 // m.VerOC 77 size += 1 // m.TTL 78 size += 1 // m.Length 79 size += 1 // m.NextProtocol 80 size += 4 // m.C1 81 size += 4 // m.C2 82 size += 4 // m.C3 83 size += 4 // m.C4 84 size += 1 // m.TlvLength 85 size += 1 * 248 // m.Tlv 86 return size 87 } 88 func (m *NshAddDelEntry) Marshal(b []byte) ([]byte, error) { 89 if b == nil { 90 b = make([]byte, m.Size()) 91 } 92 buf := codec.NewBuffer(b) 93 buf.EncodeBool(m.IsAdd) 94 buf.EncodeUint32(m.NspNsi) 95 buf.EncodeUint8(m.MdType) 96 buf.EncodeUint8(m.VerOC) 97 buf.EncodeUint8(m.TTL) 98 buf.EncodeUint8(m.Length) 99 buf.EncodeUint8(m.NextProtocol) 100 buf.EncodeUint32(m.C1) 101 buf.EncodeUint32(m.C2) 102 buf.EncodeUint32(m.C3) 103 buf.EncodeUint32(m.C4) 104 buf.EncodeUint8(m.TlvLength) 105 buf.EncodeBytes(m.Tlv, 248) 106 return buf.Bytes(), nil 107 } 108 func (m *NshAddDelEntry) Unmarshal(b []byte) error { 109 buf := codec.NewBuffer(b) 110 m.IsAdd = buf.DecodeBool() 111 m.NspNsi = buf.DecodeUint32() 112 m.MdType = buf.DecodeUint8() 113 m.VerOC = buf.DecodeUint8() 114 m.TTL = buf.DecodeUint8() 115 m.Length = buf.DecodeUint8() 116 m.NextProtocol = buf.DecodeUint8() 117 m.C1 = buf.DecodeUint32() 118 m.C2 = buf.DecodeUint32() 119 m.C3 = buf.DecodeUint32() 120 m.C4 = buf.DecodeUint32() 121 m.TlvLength = buf.DecodeUint8() 122 m.Tlv = make([]byte, 248) 123 copy(m.Tlv, buf.DecodeBytes(len(m.Tlv))) 124 return nil 125 } 126 127 // Reply from adding NSH entry (nsh_add_del_entry) 128 // - retval - 0 means all ok 129 // 130 // NshAddDelEntryReply defines message 'nsh_add_del_entry_reply'. 131 type NshAddDelEntryReply struct { 132 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 133 EntryIndex uint32 `binapi:"u32,name=entry_index" json:"entry_index,omitempty"` 134 } 135 136 func (m *NshAddDelEntryReply) Reset() { *m = NshAddDelEntryReply{} } 137 func (*NshAddDelEntryReply) GetMessageName() string { return "nsh_add_del_entry_reply" } 138 func (*NshAddDelEntryReply) GetCrcString() string { return "6296a9eb" } 139 func (*NshAddDelEntryReply) GetMessageType() api.MessageType { 140 return api.ReplyMessage 141 } 142 143 func (m *NshAddDelEntryReply) Size() (size int) { 144 if m == nil { 145 return 0 146 } 147 size += 4 // m.Retval 148 size += 4 // m.EntryIndex 149 return size 150 } 151 func (m *NshAddDelEntryReply) Marshal(b []byte) ([]byte, error) { 152 if b == nil { 153 b = make([]byte, m.Size()) 154 } 155 buf := codec.NewBuffer(b) 156 buf.EncodeInt32(m.Retval) 157 buf.EncodeUint32(m.EntryIndex) 158 return buf.Bytes(), nil 159 } 160 func (m *NshAddDelEntryReply) Unmarshal(b []byte) error { 161 buf := codec.NewBuffer(b) 162 m.Retval = buf.DecodeInt32() 163 m.EntryIndex = buf.DecodeUint32() 164 return nil 165 } 166 167 // Set or delete a mapping from one NSH header to another and its egress (decap to inner packet, encap NSH with outer header) 168 // - is_add - add address if non-zero, else delete 169 // - nsh_nsi - Key for nsh_header_t entry to map to. : 24bit NSP 8bit NSI 170 // - mapped_nsp_nsi - Key for nsh_header_t entry to map to. : 24bit NSP 8bit NSI this may be ~0 171 // if next action is to decap to NSH next protocol 172 // Note the following heuristic: 173 // - if nsp_nsi == mapped_nsp_nsi then use-case is like SFC SFF 174 // - if nsp_nsi != mapped_nsp_nsi then use-case is like SFC SF 175 // Note: these are heuristics. Rules about NSI decrement are out of scope 176 // - sw_if_index - index number of outer encap for NSH egress 177 // - next_node - explicitly which node to send to 178 // Note the above parameters are instantiated by "encap-gre-intf <x>" means sw_if_index x, next_node gre-input 179 // 180 // NshAddDelMap defines message 'nsh_add_del_map'. 181 type NshAddDelMap struct { 182 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` 183 NspNsi uint32 `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"` 184 MappedNspNsi uint32 `binapi:"u32,name=mapped_nsp_nsi" json:"mapped_nsp_nsi,omitempty"` 185 NshAction uint32 `binapi:"u32,name=nsh_action" json:"nsh_action,omitempty"` 186 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 187 RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` 188 NextNode uint32 `binapi:"u32,name=next_node" json:"next_node,omitempty"` 189 } 190 191 func (m *NshAddDelMap) Reset() { *m = NshAddDelMap{} } 192 func (*NshAddDelMap) GetMessageName() string { return "nsh_add_del_map" } 193 func (*NshAddDelMap) GetCrcString() string { return "0a0f42b0" } 194 func (*NshAddDelMap) GetMessageType() api.MessageType { 195 return api.RequestMessage 196 } 197 198 func (m *NshAddDelMap) Size() (size int) { 199 if m == nil { 200 return 0 201 } 202 size += 1 // m.IsAdd 203 size += 4 // m.NspNsi 204 size += 4 // m.MappedNspNsi 205 size += 4 // m.NshAction 206 size += 4 // m.SwIfIndex 207 size += 4 // m.RxSwIfIndex 208 size += 4 // m.NextNode 209 return size 210 } 211 func (m *NshAddDelMap) Marshal(b []byte) ([]byte, error) { 212 if b == nil { 213 b = make([]byte, m.Size()) 214 } 215 buf := codec.NewBuffer(b) 216 buf.EncodeBool(m.IsAdd) 217 buf.EncodeUint32(m.NspNsi) 218 buf.EncodeUint32(m.MappedNspNsi) 219 buf.EncodeUint32(m.NshAction) 220 buf.EncodeUint32(uint32(m.SwIfIndex)) 221 buf.EncodeUint32(uint32(m.RxSwIfIndex)) 222 buf.EncodeUint32(m.NextNode) 223 return buf.Bytes(), nil 224 } 225 func (m *NshAddDelMap) Unmarshal(b []byte) error { 226 buf := codec.NewBuffer(b) 227 m.IsAdd = buf.DecodeBool() 228 m.NspNsi = buf.DecodeUint32() 229 m.MappedNspNsi = buf.DecodeUint32() 230 m.NshAction = buf.DecodeUint32() 231 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 232 m.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 233 m.NextNode = buf.DecodeUint32() 234 return nil 235 } 236 237 // Reply from adding NSH map (nsh_add_del_map) 238 // - retval - 0 means all ok 239 // 240 // NshAddDelMapReply defines message 'nsh_add_del_map_reply'. 241 type NshAddDelMapReply struct { 242 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 243 MapIndex uint32 `binapi:"u32,name=map_index" json:"map_index,omitempty"` 244 } 245 246 func (m *NshAddDelMapReply) Reset() { *m = NshAddDelMapReply{} } 247 func (*NshAddDelMapReply) GetMessageName() string { return "nsh_add_del_map_reply" } 248 func (*NshAddDelMapReply) GetCrcString() string { return "b2b127ef" } 249 func (*NshAddDelMapReply) GetMessageType() api.MessageType { 250 return api.ReplyMessage 251 } 252 253 func (m *NshAddDelMapReply) Size() (size int) { 254 if m == nil { 255 return 0 256 } 257 size += 4 // m.Retval 258 size += 4 // m.MapIndex 259 return size 260 } 261 func (m *NshAddDelMapReply) Marshal(b []byte) ([]byte, error) { 262 if b == nil { 263 b = make([]byte, m.Size()) 264 } 265 buf := codec.NewBuffer(b) 266 buf.EncodeInt32(m.Retval) 267 buf.EncodeUint32(m.MapIndex) 268 return buf.Bytes(), nil 269 } 270 func (m *NshAddDelMapReply) Unmarshal(b []byte) error { 271 buf := codec.NewBuffer(b) 272 m.Retval = buf.DecodeInt32() 273 m.MapIndex = buf.DecodeUint32() 274 return nil 275 } 276 277 // NshEntryDetails defines message 'nsh_entry_details'. 278 type NshEntryDetails struct { 279 EntryIndex uint32 `binapi:"u32,name=entry_index" json:"entry_index,omitempty"` 280 NspNsi uint32 `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"` 281 MdType uint8 `binapi:"u8,name=md_type" json:"md_type,omitempty"` 282 VerOC uint8 `binapi:"u8,name=ver_o_c" json:"ver_o_c,omitempty"` 283 TTL uint8 `binapi:"u8,name=ttl" json:"ttl,omitempty"` 284 Length uint8 `binapi:"u8,name=length" json:"length,omitempty"` 285 NextProtocol uint8 `binapi:"u8,name=next_protocol" json:"next_protocol,omitempty"` 286 C1 uint32 `binapi:"u32,name=c1" json:"c1,omitempty"` 287 C2 uint32 `binapi:"u32,name=c2" json:"c2,omitempty"` 288 C3 uint32 `binapi:"u32,name=c3" json:"c3,omitempty"` 289 C4 uint32 `binapi:"u32,name=c4" json:"c4,omitempty"` 290 TlvLength uint8 `binapi:"u8,name=tlv_length" json:"tlv_length,omitempty"` 291 Tlv []byte `binapi:"u8[248],name=tlv" json:"tlv,omitempty"` 292 } 293 294 func (m *NshEntryDetails) Reset() { *m = NshEntryDetails{} } 295 func (*NshEntryDetails) GetMessageName() string { return "nsh_entry_details" } 296 func (*NshEntryDetails) GetCrcString() string { return "046fb556" } 297 func (*NshEntryDetails) GetMessageType() api.MessageType { 298 return api.ReplyMessage 299 } 300 301 func (m *NshEntryDetails) Size() (size int) { 302 if m == nil { 303 return 0 304 } 305 size += 4 // m.EntryIndex 306 size += 4 // m.NspNsi 307 size += 1 // m.MdType 308 size += 1 // m.VerOC 309 size += 1 // m.TTL 310 size += 1 // m.Length 311 size += 1 // m.NextProtocol 312 size += 4 // m.C1 313 size += 4 // m.C2 314 size += 4 // m.C3 315 size += 4 // m.C4 316 size += 1 // m.TlvLength 317 size += 1 * 248 // m.Tlv 318 return size 319 } 320 func (m *NshEntryDetails) Marshal(b []byte) ([]byte, error) { 321 if b == nil { 322 b = make([]byte, m.Size()) 323 } 324 buf := codec.NewBuffer(b) 325 buf.EncodeUint32(m.EntryIndex) 326 buf.EncodeUint32(m.NspNsi) 327 buf.EncodeUint8(m.MdType) 328 buf.EncodeUint8(m.VerOC) 329 buf.EncodeUint8(m.TTL) 330 buf.EncodeUint8(m.Length) 331 buf.EncodeUint8(m.NextProtocol) 332 buf.EncodeUint32(m.C1) 333 buf.EncodeUint32(m.C2) 334 buf.EncodeUint32(m.C3) 335 buf.EncodeUint32(m.C4) 336 buf.EncodeUint8(m.TlvLength) 337 buf.EncodeBytes(m.Tlv, 248) 338 return buf.Bytes(), nil 339 } 340 func (m *NshEntryDetails) Unmarshal(b []byte) error { 341 buf := codec.NewBuffer(b) 342 m.EntryIndex = buf.DecodeUint32() 343 m.NspNsi = buf.DecodeUint32() 344 m.MdType = buf.DecodeUint8() 345 m.VerOC = buf.DecodeUint8() 346 m.TTL = buf.DecodeUint8() 347 m.Length = buf.DecodeUint8() 348 m.NextProtocol = buf.DecodeUint8() 349 m.C1 = buf.DecodeUint32() 350 m.C2 = buf.DecodeUint32() 351 m.C3 = buf.DecodeUint32() 352 m.C4 = buf.DecodeUint32() 353 m.TlvLength = buf.DecodeUint8() 354 m.Tlv = make([]byte, 248) 355 copy(m.Tlv, buf.DecodeBytes(len(m.Tlv))) 356 return nil 357 } 358 359 // NshEntryDump defines message 'nsh_entry_dump'. 360 type NshEntryDump struct { 361 EntryIndex uint32 `binapi:"u32,name=entry_index" json:"entry_index,omitempty"` 362 } 363 364 func (m *NshEntryDump) Reset() { *m = NshEntryDump{} } 365 func (*NshEntryDump) GetMessageName() string { return "nsh_entry_dump" } 366 func (*NshEntryDump) GetCrcString() string { return "cdaf8ccb" } 367 func (*NshEntryDump) GetMessageType() api.MessageType { 368 return api.RequestMessage 369 } 370 371 func (m *NshEntryDump) Size() (size int) { 372 if m == nil { 373 return 0 374 } 375 size += 4 // m.EntryIndex 376 return size 377 } 378 func (m *NshEntryDump) Marshal(b []byte) ([]byte, error) { 379 if b == nil { 380 b = make([]byte, m.Size()) 381 } 382 buf := codec.NewBuffer(b) 383 buf.EncodeUint32(m.EntryIndex) 384 return buf.Bytes(), nil 385 } 386 func (m *NshEntryDump) Unmarshal(b []byte) error { 387 buf := codec.NewBuffer(b) 388 m.EntryIndex = buf.DecodeUint32() 389 return nil 390 } 391 392 // NshMapDetails defines message 'nsh_map_details'. 393 type NshMapDetails struct { 394 MapIndex uint32 `binapi:"u32,name=map_index" json:"map_index,omitempty"` 395 NspNsi uint32 `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"` 396 MappedNspNsi uint32 `binapi:"u32,name=mapped_nsp_nsi" json:"mapped_nsp_nsi,omitempty"` 397 NshAction uint32 `binapi:"u32,name=nsh_action" json:"nsh_action,omitempty"` 398 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 399 RxSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"` 400 NextNode uint32 `binapi:"u32,name=next_node" json:"next_node,omitempty"` 401 } 402 403 func (m *NshMapDetails) Reset() { *m = NshMapDetails{} } 404 func (*NshMapDetails) GetMessageName() string { return "nsh_map_details" } 405 func (*NshMapDetails) GetCrcString() string { return "2fefcf49" } 406 func (*NshMapDetails) GetMessageType() api.MessageType { 407 return api.ReplyMessage 408 } 409 410 func (m *NshMapDetails) Size() (size int) { 411 if m == nil { 412 return 0 413 } 414 size += 4 // m.MapIndex 415 size += 4 // m.NspNsi 416 size += 4 // m.MappedNspNsi 417 size += 4 // m.NshAction 418 size += 4 // m.SwIfIndex 419 size += 4 // m.RxSwIfIndex 420 size += 4 // m.NextNode 421 return size 422 } 423 func (m *NshMapDetails) Marshal(b []byte) ([]byte, error) { 424 if b == nil { 425 b = make([]byte, m.Size()) 426 } 427 buf := codec.NewBuffer(b) 428 buf.EncodeUint32(m.MapIndex) 429 buf.EncodeUint32(m.NspNsi) 430 buf.EncodeUint32(m.MappedNspNsi) 431 buf.EncodeUint32(m.NshAction) 432 buf.EncodeUint32(uint32(m.SwIfIndex)) 433 buf.EncodeUint32(uint32(m.RxSwIfIndex)) 434 buf.EncodeUint32(m.NextNode) 435 return buf.Bytes(), nil 436 } 437 func (m *NshMapDetails) Unmarshal(b []byte) error { 438 buf := codec.NewBuffer(b) 439 m.MapIndex = buf.DecodeUint32() 440 m.NspNsi = buf.DecodeUint32() 441 m.MappedNspNsi = buf.DecodeUint32() 442 m.NshAction = buf.DecodeUint32() 443 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 444 m.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 445 m.NextNode = buf.DecodeUint32() 446 return nil 447 } 448 449 // NshMapDump defines message 'nsh_map_dump'. 450 type NshMapDump struct { 451 MapIndex uint32 `binapi:"u32,name=map_index" json:"map_index,omitempty"` 452 } 453 454 func (m *NshMapDump) Reset() { *m = NshMapDump{} } 455 func (*NshMapDump) GetMessageName() string { return "nsh_map_dump" } 456 func (*NshMapDump) GetCrcString() string { return "8fc06b82" } 457 func (*NshMapDump) GetMessageType() api.MessageType { 458 return api.RequestMessage 459 } 460 461 func (m *NshMapDump) Size() (size int) { 462 if m == nil { 463 return 0 464 } 465 size += 4 // m.MapIndex 466 return size 467 } 468 func (m *NshMapDump) Marshal(b []byte) ([]byte, error) { 469 if b == nil { 470 b = make([]byte, m.Size()) 471 } 472 buf := codec.NewBuffer(b) 473 buf.EncodeUint32(m.MapIndex) 474 return buf.Bytes(), nil 475 } 476 func (m *NshMapDump) Unmarshal(b []byte) error { 477 buf := codec.NewBuffer(b) 478 m.MapIndex = buf.DecodeUint32() 479 return nil 480 } 481 482 func init() { file_nsh_binapi_init() } 483 func file_nsh_binapi_init() { 484 api.RegisterMessage((*NshAddDelEntry)(nil), "nsh_add_del_entry_7dea480b") 485 api.RegisterMessage((*NshAddDelEntryReply)(nil), "nsh_add_del_entry_reply_6296a9eb") 486 api.RegisterMessage((*NshAddDelMap)(nil), "nsh_add_del_map_0a0f42b0") 487 api.RegisterMessage((*NshAddDelMapReply)(nil), "nsh_add_del_map_reply_b2b127ef") 488 api.RegisterMessage((*NshEntryDetails)(nil), "nsh_entry_details_046fb556") 489 api.RegisterMessage((*NshEntryDump)(nil), "nsh_entry_dump_cdaf8ccb") 490 api.RegisterMessage((*NshMapDetails)(nil), "nsh_map_details_2fefcf49") 491 api.RegisterMessage((*NshMapDump)(nil), "nsh_map_dump_8fc06b82") 492 } 493 494 // Messages returns list of all messages in this module. 495 func AllMessages() []api.Message { 496 return []api.Message{ 497 (*NshAddDelEntry)(nil), 498 (*NshAddDelEntryReply)(nil), 499 (*NshAddDelMap)(nil), 500 (*NshAddDelMapReply)(nil), 501 (*NshEntryDetails)(nil), 502 (*NshEntryDump)(nil), 503 (*NshMapDetails)(nil), 504 (*NshMapDump)(nil), 505 } 506 }