github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/pnat/pnat.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/pnat.api.json 6 7 // Package pnat contains generated bindings for API file pnat.api. 8 // 9 // Contents: 10 // - 2 enums 11 // - 2 structs 12 // - 16 messages 13 package pnat 14 15 import ( 16 "strconv" 17 18 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 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 = "pnat" 32 APIVersion = "0.1.1" 33 VersionCrc = 0x7296c7ab 34 ) 35 36 // PnatAttachmentPoint defines enum 'pnat_attachment_point'. 37 type PnatAttachmentPoint uint32 38 39 const ( 40 PNAT_IP4_INPUT PnatAttachmentPoint = 0 41 PNAT_IP4_OUTPUT PnatAttachmentPoint = 1 42 PNAT_ATTACHMENT_POINT_MAX PnatAttachmentPoint = 2 43 ) 44 45 var ( 46 PnatAttachmentPoint_name = map[uint32]string{ 47 0: "PNAT_IP4_INPUT", 48 1: "PNAT_IP4_OUTPUT", 49 2: "PNAT_ATTACHMENT_POINT_MAX", 50 } 51 PnatAttachmentPoint_value = map[string]uint32{ 52 "PNAT_IP4_INPUT": 0, 53 "PNAT_IP4_OUTPUT": 1, 54 "PNAT_ATTACHMENT_POINT_MAX": 2, 55 } 56 ) 57 58 func (x PnatAttachmentPoint) String() string { 59 s, ok := PnatAttachmentPoint_name[uint32(x)] 60 if ok { 61 return s 62 } 63 return "PnatAttachmentPoint(" + strconv.Itoa(int(x)) + ")" 64 } 65 66 // PnatMask defines enum 'pnat_mask'. 67 type PnatMask uint32 68 69 const ( 70 PNAT_SA PnatMask = 1 71 PNAT_DA PnatMask = 2 72 PNAT_SPORT PnatMask = 4 73 PNAT_DPORT PnatMask = 8 74 PNAT_COPY_BYTE PnatMask = 16 75 PNAT_CLEAR_BYTE PnatMask = 32 76 PNAT_PROTO PnatMask = 64 77 ) 78 79 var ( 80 PnatMask_name = map[uint32]string{ 81 1: "PNAT_SA", 82 2: "PNAT_DA", 83 4: "PNAT_SPORT", 84 8: "PNAT_DPORT", 85 16: "PNAT_COPY_BYTE", 86 32: "PNAT_CLEAR_BYTE", 87 64: "PNAT_PROTO", 88 } 89 PnatMask_value = map[string]uint32{ 90 "PNAT_SA": 1, 91 "PNAT_DA": 2, 92 "PNAT_SPORT": 4, 93 "PNAT_DPORT": 8, 94 "PNAT_COPY_BYTE": 16, 95 "PNAT_CLEAR_BYTE": 32, 96 "PNAT_PROTO": 64, 97 } 98 ) 99 100 func (x PnatMask) String() string { 101 s, ok := PnatMask_name[uint32(x)] 102 if ok { 103 return s 104 } 105 return "PnatMask(" + strconv.Itoa(int(x)) + ")" 106 } 107 108 // PnatMatchTuple defines type 'pnat_match_tuple'. 109 type PnatMatchTuple struct { 110 Src ip_types.IP4Address `binapi:"ip4_address,name=src" json:"src,omitempty"` 111 Dst ip_types.IP4Address `binapi:"ip4_address,name=dst" json:"dst,omitempty"` 112 Proto ip_types.IPProto `binapi:"ip_proto,name=proto" json:"proto,omitempty"` 113 Sport uint16 `binapi:"u16,name=sport" json:"sport,omitempty"` 114 Dport uint16 `binapi:"u16,name=dport" json:"dport,omitempty"` 115 Mask PnatMask `binapi:"pnat_mask,name=mask" json:"mask,omitempty"` 116 } 117 118 // PnatRewriteTuple defines type 'pnat_rewrite_tuple'. 119 type PnatRewriteTuple struct { 120 Src ip_types.IP4Address `binapi:"ip4_address,name=src" json:"src,omitempty"` 121 Dst ip_types.IP4Address `binapi:"ip4_address,name=dst" json:"dst,omitempty"` 122 Sport uint16 `binapi:"u16,name=sport" json:"sport,omitempty"` 123 Dport uint16 `binapi:"u16,name=dport" json:"dport,omitempty"` 124 Mask PnatMask `binapi:"pnat_mask,name=mask" json:"mask,omitempty"` 125 FromOffset uint8 `binapi:"u8,name=from_offset" json:"from_offset,omitempty"` 126 ToOffset uint8 `binapi:"u8,name=to_offset" json:"to_offset,omitempty"` 127 ClearOffset uint8 `binapi:"u8,name=clear_offset" json:"clear_offset,omitempty"` 128 } 129 130 // /* 131 // - Copyright (c) 2021 Cisco and/or its affiliates. 132 // - Licensed under the Apache License, Version 2.0 (the "License"); 133 // - you may not use this file except in compliance with the License. 134 // - You may obtain a copy of the License at: 135 // * 136 // - http://www.apache.org/licenses/LICENSE-2.0 137 // * 138 // - Unless required by applicable law or agreed to in writing, software 139 // - distributed under the License is distributed on an "AS IS" BASIS, 140 // - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 141 // - See the License for the specific language governing permissions and 142 // - limitations under the License. 143 // 144 // PnatBindingAdd defines message 'pnat_binding_add'. 145 type PnatBindingAdd struct { 146 Match PnatMatchTuple `binapi:"pnat_match_tuple,name=match" json:"match,omitempty"` 147 Rewrite PnatRewriteTuple `binapi:"pnat_rewrite_tuple,name=rewrite" json:"rewrite,omitempty"` 148 } 149 150 func (m *PnatBindingAdd) Reset() { *m = PnatBindingAdd{} } 151 func (*PnatBindingAdd) GetMessageName() string { return "pnat_binding_add" } 152 func (*PnatBindingAdd) GetCrcString() string { return "946ee0b7" } 153 func (*PnatBindingAdd) GetMessageType() api.MessageType { 154 return api.RequestMessage 155 } 156 157 func (m *PnatBindingAdd) Size() (size int) { 158 if m == nil { 159 return 0 160 } 161 size += 1 * 4 // m.Match.Src 162 size += 1 * 4 // m.Match.Dst 163 size += 1 // m.Match.Proto 164 size += 2 // m.Match.Sport 165 size += 2 // m.Match.Dport 166 size += 4 // m.Match.Mask 167 size += 1 * 4 // m.Rewrite.Src 168 size += 1 * 4 // m.Rewrite.Dst 169 size += 2 // m.Rewrite.Sport 170 size += 2 // m.Rewrite.Dport 171 size += 4 // m.Rewrite.Mask 172 size += 1 // m.Rewrite.FromOffset 173 size += 1 // m.Rewrite.ToOffset 174 size += 1 // m.Rewrite.ClearOffset 175 return size 176 } 177 func (m *PnatBindingAdd) Marshal(b []byte) ([]byte, error) { 178 if b == nil { 179 b = make([]byte, m.Size()) 180 } 181 buf := codec.NewBuffer(b) 182 buf.EncodeBytes(m.Match.Src[:], 4) 183 buf.EncodeBytes(m.Match.Dst[:], 4) 184 buf.EncodeUint8(uint8(m.Match.Proto)) 185 buf.EncodeUint16(m.Match.Sport) 186 buf.EncodeUint16(m.Match.Dport) 187 buf.EncodeUint32(uint32(m.Match.Mask)) 188 buf.EncodeBytes(m.Rewrite.Src[:], 4) 189 buf.EncodeBytes(m.Rewrite.Dst[:], 4) 190 buf.EncodeUint16(m.Rewrite.Sport) 191 buf.EncodeUint16(m.Rewrite.Dport) 192 buf.EncodeUint32(uint32(m.Rewrite.Mask)) 193 buf.EncodeUint8(m.Rewrite.FromOffset) 194 buf.EncodeUint8(m.Rewrite.ToOffset) 195 buf.EncodeUint8(m.Rewrite.ClearOffset) 196 return buf.Bytes(), nil 197 } 198 func (m *PnatBindingAdd) Unmarshal(b []byte) error { 199 buf := codec.NewBuffer(b) 200 copy(m.Match.Src[:], buf.DecodeBytes(4)) 201 copy(m.Match.Dst[:], buf.DecodeBytes(4)) 202 m.Match.Proto = ip_types.IPProto(buf.DecodeUint8()) 203 m.Match.Sport = buf.DecodeUint16() 204 m.Match.Dport = buf.DecodeUint16() 205 m.Match.Mask = PnatMask(buf.DecodeUint32()) 206 copy(m.Rewrite.Src[:], buf.DecodeBytes(4)) 207 copy(m.Rewrite.Dst[:], buf.DecodeBytes(4)) 208 m.Rewrite.Sport = buf.DecodeUint16() 209 m.Rewrite.Dport = buf.DecodeUint16() 210 m.Rewrite.Mask = PnatMask(buf.DecodeUint32()) 211 m.Rewrite.FromOffset = buf.DecodeUint8() 212 m.Rewrite.ToOffset = buf.DecodeUint8() 213 m.Rewrite.ClearOffset = buf.DecodeUint8() 214 return nil 215 } 216 217 // PnatBindingAddReply defines message 'pnat_binding_add_reply'. 218 type PnatBindingAddReply struct { 219 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 220 BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"` 221 } 222 223 func (m *PnatBindingAddReply) Reset() { *m = PnatBindingAddReply{} } 224 func (*PnatBindingAddReply) GetMessageName() string { return "pnat_binding_add_reply" } 225 func (*PnatBindingAddReply) GetCrcString() string { return "4cd980a7" } 226 func (*PnatBindingAddReply) GetMessageType() api.MessageType { 227 return api.ReplyMessage 228 } 229 230 func (m *PnatBindingAddReply) Size() (size int) { 231 if m == nil { 232 return 0 233 } 234 size += 4 // m.Retval 235 size += 4 // m.BindingIndex 236 return size 237 } 238 func (m *PnatBindingAddReply) Marshal(b []byte) ([]byte, error) { 239 if b == nil { 240 b = make([]byte, m.Size()) 241 } 242 buf := codec.NewBuffer(b) 243 buf.EncodeInt32(m.Retval) 244 buf.EncodeUint32(m.BindingIndex) 245 return buf.Bytes(), nil 246 } 247 func (m *PnatBindingAddReply) Unmarshal(b []byte) error { 248 buf := codec.NewBuffer(b) 249 m.Retval = buf.DecodeInt32() 250 m.BindingIndex = buf.DecodeUint32() 251 return nil 252 } 253 254 // PnatBindingAddV2 defines message 'pnat_binding_add_v2'. 255 type PnatBindingAddV2 struct { 256 Match PnatMatchTuple `binapi:"pnat_match_tuple,name=match" json:"match,omitempty"` 257 Rewrite PnatRewriteTuple `binapi:"pnat_rewrite_tuple,name=rewrite" json:"rewrite,omitempty"` 258 } 259 260 func (m *PnatBindingAddV2) Reset() { *m = PnatBindingAddV2{} } 261 func (*PnatBindingAddV2) GetMessageName() string { return "pnat_binding_add_v2" } 262 func (*PnatBindingAddV2) GetCrcString() string { return "946ee0b7" } 263 func (*PnatBindingAddV2) GetMessageType() api.MessageType { 264 return api.RequestMessage 265 } 266 267 func (m *PnatBindingAddV2) Size() (size int) { 268 if m == nil { 269 return 0 270 } 271 size += 1 * 4 // m.Match.Src 272 size += 1 * 4 // m.Match.Dst 273 size += 1 // m.Match.Proto 274 size += 2 // m.Match.Sport 275 size += 2 // m.Match.Dport 276 size += 4 // m.Match.Mask 277 size += 1 * 4 // m.Rewrite.Src 278 size += 1 * 4 // m.Rewrite.Dst 279 size += 2 // m.Rewrite.Sport 280 size += 2 // m.Rewrite.Dport 281 size += 4 // m.Rewrite.Mask 282 size += 1 // m.Rewrite.FromOffset 283 size += 1 // m.Rewrite.ToOffset 284 size += 1 // m.Rewrite.ClearOffset 285 return size 286 } 287 func (m *PnatBindingAddV2) Marshal(b []byte) ([]byte, error) { 288 if b == nil { 289 b = make([]byte, m.Size()) 290 } 291 buf := codec.NewBuffer(b) 292 buf.EncodeBytes(m.Match.Src[:], 4) 293 buf.EncodeBytes(m.Match.Dst[:], 4) 294 buf.EncodeUint8(uint8(m.Match.Proto)) 295 buf.EncodeUint16(m.Match.Sport) 296 buf.EncodeUint16(m.Match.Dport) 297 buf.EncodeUint32(uint32(m.Match.Mask)) 298 buf.EncodeBytes(m.Rewrite.Src[:], 4) 299 buf.EncodeBytes(m.Rewrite.Dst[:], 4) 300 buf.EncodeUint16(m.Rewrite.Sport) 301 buf.EncodeUint16(m.Rewrite.Dport) 302 buf.EncodeUint32(uint32(m.Rewrite.Mask)) 303 buf.EncodeUint8(m.Rewrite.FromOffset) 304 buf.EncodeUint8(m.Rewrite.ToOffset) 305 buf.EncodeUint8(m.Rewrite.ClearOffset) 306 return buf.Bytes(), nil 307 } 308 func (m *PnatBindingAddV2) Unmarshal(b []byte) error { 309 buf := codec.NewBuffer(b) 310 copy(m.Match.Src[:], buf.DecodeBytes(4)) 311 copy(m.Match.Dst[:], buf.DecodeBytes(4)) 312 m.Match.Proto = ip_types.IPProto(buf.DecodeUint8()) 313 m.Match.Sport = buf.DecodeUint16() 314 m.Match.Dport = buf.DecodeUint16() 315 m.Match.Mask = PnatMask(buf.DecodeUint32()) 316 copy(m.Rewrite.Src[:], buf.DecodeBytes(4)) 317 copy(m.Rewrite.Dst[:], buf.DecodeBytes(4)) 318 m.Rewrite.Sport = buf.DecodeUint16() 319 m.Rewrite.Dport = buf.DecodeUint16() 320 m.Rewrite.Mask = PnatMask(buf.DecodeUint32()) 321 m.Rewrite.FromOffset = buf.DecodeUint8() 322 m.Rewrite.ToOffset = buf.DecodeUint8() 323 m.Rewrite.ClearOffset = buf.DecodeUint8() 324 return nil 325 } 326 327 // PnatBindingAddV2Reply defines message 'pnat_binding_add_v2_reply'. 328 type PnatBindingAddV2Reply struct { 329 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 330 BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"` 331 } 332 333 func (m *PnatBindingAddV2Reply) Reset() { *m = PnatBindingAddV2Reply{} } 334 func (*PnatBindingAddV2Reply) GetMessageName() string { return "pnat_binding_add_v2_reply" } 335 func (*PnatBindingAddV2Reply) GetCrcString() string { return "4cd980a7" } 336 func (*PnatBindingAddV2Reply) GetMessageType() api.MessageType { 337 return api.ReplyMessage 338 } 339 340 func (m *PnatBindingAddV2Reply) Size() (size int) { 341 if m == nil { 342 return 0 343 } 344 size += 4 // m.Retval 345 size += 4 // m.BindingIndex 346 return size 347 } 348 func (m *PnatBindingAddV2Reply) Marshal(b []byte) ([]byte, error) { 349 if b == nil { 350 b = make([]byte, m.Size()) 351 } 352 buf := codec.NewBuffer(b) 353 buf.EncodeInt32(m.Retval) 354 buf.EncodeUint32(m.BindingIndex) 355 return buf.Bytes(), nil 356 } 357 func (m *PnatBindingAddV2Reply) Unmarshal(b []byte) error { 358 buf := codec.NewBuffer(b) 359 m.Retval = buf.DecodeInt32() 360 m.BindingIndex = buf.DecodeUint32() 361 return nil 362 } 363 364 // PnatBindingAttach defines message 'pnat_binding_attach'. 365 type PnatBindingAttach struct { 366 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 367 Attachment PnatAttachmentPoint `binapi:"pnat_attachment_point,name=attachment" json:"attachment,omitempty"` 368 BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"` 369 } 370 371 func (m *PnatBindingAttach) Reset() { *m = PnatBindingAttach{} } 372 func (*PnatBindingAttach) GetMessageName() string { return "pnat_binding_attach" } 373 func (*PnatBindingAttach) GetCrcString() string { return "6e074232" } 374 func (*PnatBindingAttach) GetMessageType() api.MessageType { 375 return api.RequestMessage 376 } 377 378 func (m *PnatBindingAttach) Size() (size int) { 379 if m == nil { 380 return 0 381 } 382 size += 4 // m.SwIfIndex 383 size += 4 // m.Attachment 384 size += 4 // m.BindingIndex 385 return size 386 } 387 func (m *PnatBindingAttach) Marshal(b []byte) ([]byte, error) { 388 if b == nil { 389 b = make([]byte, m.Size()) 390 } 391 buf := codec.NewBuffer(b) 392 buf.EncodeUint32(uint32(m.SwIfIndex)) 393 buf.EncodeUint32(uint32(m.Attachment)) 394 buf.EncodeUint32(m.BindingIndex) 395 return buf.Bytes(), nil 396 } 397 func (m *PnatBindingAttach) Unmarshal(b []byte) error { 398 buf := codec.NewBuffer(b) 399 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 400 m.Attachment = PnatAttachmentPoint(buf.DecodeUint32()) 401 m.BindingIndex = buf.DecodeUint32() 402 return nil 403 } 404 405 // PnatBindingAttachReply defines message 'pnat_binding_attach_reply'. 406 type PnatBindingAttachReply struct { 407 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 408 } 409 410 func (m *PnatBindingAttachReply) Reset() { *m = PnatBindingAttachReply{} } 411 func (*PnatBindingAttachReply) GetMessageName() string { return "pnat_binding_attach_reply" } 412 func (*PnatBindingAttachReply) GetCrcString() string { return "e8d4e804" } 413 func (*PnatBindingAttachReply) GetMessageType() api.MessageType { 414 return api.ReplyMessage 415 } 416 417 func (m *PnatBindingAttachReply) Size() (size int) { 418 if m == nil { 419 return 0 420 } 421 size += 4 // m.Retval 422 return size 423 } 424 func (m *PnatBindingAttachReply) Marshal(b []byte) ([]byte, error) { 425 if b == nil { 426 b = make([]byte, m.Size()) 427 } 428 buf := codec.NewBuffer(b) 429 buf.EncodeInt32(m.Retval) 430 return buf.Bytes(), nil 431 } 432 func (m *PnatBindingAttachReply) Unmarshal(b []byte) error { 433 buf := codec.NewBuffer(b) 434 m.Retval = buf.DecodeInt32() 435 return nil 436 } 437 438 // PnatBindingDel defines message 'pnat_binding_del'. 439 type PnatBindingDel struct { 440 BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"` 441 } 442 443 func (m *PnatBindingDel) Reset() { *m = PnatBindingDel{} } 444 func (*PnatBindingDel) GetMessageName() string { return "pnat_binding_del" } 445 func (*PnatBindingDel) GetCrcString() string { return "9259df7b" } 446 func (*PnatBindingDel) GetMessageType() api.MessageType { 447 return api.RequestMessage 448 } 449 450 func (m *PnatBindingDel) Size() (size int) { 451 if m == nil { 452 return 0 453 } 454 size += 4 // m.BindingIndex 455 return size 456 } 457 func (m *PnatBindingDel) Marshal(b []byte) ([]byte, error) { 458 if b == nil { 459 b = make([]byte, m.Size()) 460 } 461 buf := codec.NewBuffer(b) 462 buf.EncodeUint32(m.BindingIndex) 463 return buf.Bytes(), nil 464 } 465 func (m *PnatBindingDel) Unmarshal(b []byte) error { 466 buf := codec.NewBuffer(b) 467 m.BindingIndex = buf.DecodeUint32() 468 return nil 469 } 470 471 // PnatBindingDelReply defines message 'pnat_binding_del_reply'. 472 type PnatBindingDelReply struct { 473 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 474 } 475 476 func (m *PnatBindingDelReply) Reset() { *m = PnatBindingDelReply{} } 477 func (*PnatBindingDelReply) GetMessageName() string { return "pnat_binding_del_reply" } 478 func (*PnatBindingDelReply) GetCrcString() string { return "e8d4e804" } 479 func (*PnatBindingDelReply) GetMessageType() api.MessageType { 480 return api.ReplyMessage 481 } 482 483 func (m *PnatBindingDelReply) Size() (size int) { 484 if m == nil { 485 return 0 486 } 487 size += 4 // m.Retval 488 return size 489 } 490 func (m *PnatBindingDelReply) Marshal(b []byte) ([]byte, error) { 491 if b == nil { 492 b = make([]byte, m.Size()) 493 } 494 buf := codec.NewBuffer(b) 495 buf.EncodeInt32(m.Retval) 496 return buf.Bytes(), nil 497 } 498 func (m *PnatBindingDelReply) Unmarshal(b []byte) error { 499 buf := codec.NewBuffer(b) 500 m.Retval = buf.DecodeInt32() 501 return nil 502 } 503 504 // PnatBindingDetach defines message 'pnat_binding_detach'. 505 type PnatBindingDetach struct { 506 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 507 Attachment PnatAttachmentPoint `binapi:"pnat_attachment_point,name=attachment" json:"attachment,omitempty"` 508 BindingIndex uint32 `binapi:"u32,name=binding_index" json:"binding_index,omitempty"` 509 } 510 511 func (m *PnatBindingDetach) Reset() { *m = PnatBindingDetach{} } 512 func (*PnatBindingDetach) GetMessageName() string { return "pnat_binding_detach" } 513 func (*PnatBindingDetach) GetCrcString() string { return "6e074232" } 514 func (*PnatBindingDetach) GetMessageType() api.MessageType { 515 return api.RequestMessage 516 } 517 518 func (m *PnatBindingDetach) Size() (size int) { 519 if m == nil { 520 return 0 521 } 522 size += 4 // m.SwIfIndex 523 size += 4 // m.Attachment 524 size += 4 // m.BindingIndex 525 return size 526 } 527 func (m *PnatBindingDetach) Marshal(b []byte) ([]byte, error) { 528 if b == nil { 529 b = make([]byte, m.Size()) 530 } 531 buf := codec.NewBuffer(b) 532 buf.EncodeUint32(uint32(m.SwIfIndex)) 533 buf.EncodeUint32(uint32(m.Attachment)) 534 buf.EncodeUint32(m.BindingIndex) 535 return buf.Bytes(), nil 536 } 537 func (m *PnatBindingDetach) Unmarshal(b []byte) error { 538 buf := codec.NewBuffer(b) 539 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 540 m.Attachment = PnatAttachmentPoint(buf.DecodeUint32()) 541 m.BindingIndex = buf.DecodeUint32() 542 return nil 543 } 544 545 // PnatBindingDetachReply defines message 'pnat_binding_detach_reply'. 546 type PnatBindingDetachReply struct { 547 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 548 } 549 550 func (m *PnatBindingDetachReply) Reset() { *m = PnatBindingDetachReply{} } 551 func (*PnatBindingDetachReply) GetMessageName() string { return "pnat_binding_detach_reply" } 552 func (*PnatBindingDetachReply) GetCrcString() string { return "e8d4e804" } 553 func (*PnatBindingDetachReply) GetMessageType() api.MessageType { 554 return api.ReplyMessage 555 } 556 557 func (m *PnatBindingDetachReply) Size() (size int) { 558 if m == nil { 559 return 0 560 } 561 size += 4 // m.Retval 562 return size 563 } 564 func (m *PnatBindingDetachReply) Marshal(b []byte) ([]byte, error) { 565 if b == nil { 566 b = make([]byte, m.Size()) 567 } 568 buf := codec.NewBuffer(b) 569 buf.EncodeInt32(m.Retval) 570 return buf.Bytes(), nil 571 } 572 func (m *PnatBindingDetachReply) Unmarshal(b []byte) error { 573 buf := codec.NewBuffer(b) 574 m.Retval = buf.DecodeInt32() 575 return nil 576 } 577 578 // PnatBindingsDetails defines message 'pnat_bindings_details'. 579 type PnatBindingsDetails struct { 580 Match PnatMatchTuple `binapi:"pnat_match_tuple,name=match" json:"match,omitempty"` 581 Rewrite PnatRewriteTuple `binapi:"pnat_rewrite_tuple,name=rewrite" json:"rewrite,omitempty"` 582 } 583 584 func (m *PnatBindingsDetails) Reset() { *m = PnatBindingsDetails{} } 585 func (*PnatBindingsDetails) GetMessageName() string { return "pnat_bindings_details" } 586 func (*PnatBindingsDetails) GetCrcString() string { return "08fb2815" } 587 func (*PnatBindingsDetails) GetMessageType() api.MessageType { 588 return api.ReplyMessage 589 } 590 591 func (m *PnatBindingsDetails) Size() (size int) { 592 if m == nil { 593 return 0 594 } 595 size += 1 * 4 // m.Match.Src 596 size += 1 * 4 // m.Match.Dst 597 size += 1 // m.Match.Proto 598 size += 2 // m.Match.Sport 599 size += 2 // m.Match.Dport 600 size += 4 // m.Match.Mask 601 size += 1 * 4 // m.Rewrite.Src 602 size += 1 * 4 // m.Rewrite.Dst 603 size += 2 // m.Rewrite.Sport 604 size += 2 // m.Rewrite.Dport 605 size += 4 // m.Rewrite.Mask 606 size += 1 // m.Rewrite.FromOffset 607 size += 1 // m.Rewrite.ToOffset 608 size += 1 // m.Rewrite.ClearOffset 609 return size 610 } 611 func (m *PnatBindingsDetails) Marshal(b []byte) ([]byte, error) { 612 if b == nil { 613 b = make([]byte, m.Size()) 614 } 615 buf := codec.NewBuffer(b) 616 buf.EncodeBytes(m.Match.Src[:], 4) 617 buf.EncodeBytes(m.Match.Dst[:], 4) 618 buf.EncodeUint8(uint8(m.Match.Proto)) 619 buf.EncodeUint16(m.Match.Sport) 620 buf.EncodeUint16(m.Match.Dport) 621 buf.EncodeUint32(uint32(m.Match.Mask)) 622 buf.EncodeBytes(m.Rewrite.Src[:], 4) 623 buf.EncodeBytes(m.Rewrite.Dst[:], 4) 624 buf.EncodeUint16(m.Rewrite.Sport) 625 buf.EncodeUint16(m.Rewrite.Dport) 626 buf.EncodeUint32(uint32(m.Rewrite.Mask)) 627 buf.EncodeUint8(m.Rewrite.FromOffset) 628 buf.EncodeUint8(m.Rewrite.ToOffset) 629 buf.EncodeUint8(m.Rewrite.ClearOffset) 630 return buf.Bytes(), nil 631 } 632 func (m *PnatBindingsDetails) Unmarshal(b []byte) error { 633 buf := codec.NewBuffer(b) 634 copy(m.Match.Src[:], buf.DecodeBytes(4)) 635 copy(m.Match.Dst[:], buf.DecodeBytes(4)) 636 m.Match.Proto = ip_types.IPProto(buf.DecodeUint8()) 637 m.Match.Sport = buf.DecodeUint16() 638 m.Match.Dport = buf.DecodeUint16() 639 m.Match.Mask = PnatMask(buf.DecodeUint32()) 640 copy(m.Rewrite.Src[:], buf.DecodeBytes(4)) 641 copy(m.Rewrite.Dst[:], buf.DecodeBytes(4)) 642 m.Rewrite.Sport = buf.DecodeUint16() 643 m.Rewrite.Dport = buf.DecodeUint16() 644 m.Rewrite.Mask = PnatMask(buf.DecodeUint32()) 645 m.Rewrite.FromOffset = buf.DecodeUint8() 646 m.Rewrite.ToOffset = buf.DecodeUint8() 647 m.Rewrite.ClearOffset = buf.DecodeUint8() 648 return nil 649 } 650 651 // PnatBindingsGet defines message 'pnat_bindings_get'. 652 type PnatBindingsGet struct { 653 Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` 654 } 655 656 func (m *PnatBindingsGet) Reset() { *m = PnatBindingsGet{} } 657 func (*PnatBindingsGet) GetMessageName() string { return "pnat_bindings_get" } 658 func (*PnatBindingsGet) GetCrcString() string { return "f75ba505" } 659 func (*PnatBindingsGet) GetMessageType() api.MessageType { 660 return api.RequestMessage 661 } 662 663 func (m *PnatBindingsGet) Size() (size int) { 664 if m == nil { 665 return 0 666 } 667 size += 4 // m.Cursor 668 return size 669 } 670 func (m *PnatBindingsGet) Marshal(b []byte) ([]byte, error) { 671 if b == nil { 672 b = make([]byte, m.Size()) 673 } 674 buf := codec.NewBuffer(b) 675 buf.EncodeUint32(m.Cursor) 676 return buf.Bytes(), nil 677 } 678 func (m *PnatBindingsGet) Unmarshal(b []byte) error { 679 buf := codec.NewBuffer(b) 680 m.Cursor = buf.DecodeUint32() 681 return nil 682 } 683 684 // PnatBindingsGetReply defines message 'pnat_bindings_get_reply'. 685 type PnatBindingsGetReply struct { 686 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 687 Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` 688 } 689 690 func (m *PnatBindingsGetReply) Reset() { *m = PnatBindingsGetReply{} } 691 func (*PnatBindingsGetReply) GetMessageName() string { return "pnat_bindings_get_reply" } 692 func (*PnatBindingsGetReply) GetCrcString() string { return "53b48f5d" } 693 func (*PnatBindingsGetReply) GetMessageType() api.MessageType { 694 return api.ReplyMessage 695 } 696 697 func (m *PnatBindingsGetReply) Size() (size int) { 698 if m == nil { 699 return 0 700 } 701 size += 4 // m.Retval 702 size += 4 // m.Cursor 703 return size 704 } 705 func (m *PnatBindingsGetReply) Marshal(b []byte) ([]byte, error) { 706 if b == nil { 707 b = make([]byte, m.Size()) 708 } 709 buf := codec.NewBuffer(b) 710 buf.EncodeInt32(m.Retval) 711 buf.EncodeUint32(m.Cursor) 712 return buf.Bytes(), nil 713 } 714 func (m *PnatBindingsGetReply) Unmarshal(b []byte) error { 715 buf := codec.NewBuffer(b) 716 m.Retval = buf.DecodeInt32() 717 m.Cursor = buf.DecodeUint32() 718 return nil 719 } 720 721 // PnatInterfacesDetails defines message 'pnat_interfaces_details'. 722 type PnatInterfacesDetails struct { 723 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 724 Enabled []bool `binapi:"bool[2],name=enabled" json:"enabled,omitempty"` 725 LookupMask [2]PnatMask `binapi:"pnat_mask[2],name=lookup_mask" json:"lookup_mask,omitempty"` 726 } 727 728 func (m *PnatInterfacesDetails) Reset() { *m = PnatInterfacesDetails{} } 729 func (*PnatInterfacesDetails) GetMessageName() string { return "pnat_interfaces_details" } 730 func (*PnatInterfacesDetails) GetCrcString() string { return "4cb09493" } 731 func (*PnatInterfacesDetails) GetMessageType() api.MessageType { 732 return api.ReplyMessage 733 } 734 735 func (m *PnatInterfacesDetails) Size() (size int) { 736 if m == nil { 737 return 0 738 } 739 size += 4 // m.SwIfIndex 740 size += 1 * 2 // m.Enabled 741 for j1 := 0; j1 < 2; j1++ { 742 size += 4 // m.LookupMask[j1] 743 } 744 return size 745 } 746 func (m *PnatInterfacesDetails) Marshal(b []byte) ([]byte, error) { 747 if b == nil { 748 b = make([]byte, m.Size()) 749 } 750 buf := codec.NewBuffer(b) 751 buf.EncodeUint32(uint32(m.SwIfIndex)) 752 for i := 0; i < 2; i++ { 753 var x bool 754 if i < len(m.Enabled) { 755 x = bool(m.Enabled[i]) 756 } 757 buf.EncodeBool(x) 758 } 759 for j0 := 0; j0 < 2; j0++ { 760 buf.EncodeUint32(uint32(m.LookupMask[j0])) 761 } 762 return buf.Bytes(), nil 763 } 764 func (m *PnatInterfacesDetails) Unmarshal(b []byte) error { 765 buf := codec.NewBuffer(b) 766 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 767 m.Enabled = make([]bool, 2) 768 for i := 0; i < len(m.Enabled); i++ { 769 m.Enabled[i] = buf.DecodeBool() 770 } 771 for j0 := 0; j0 < 2; j0++ { 772 m.LookupMask[j0] = PnatMask(buf.DecodeUint32()) 773 } 774 return nil 775 } 776 777 // PnatInterfacesGet defines message 'pnat_interfaces_get'. 778 type PnatInterfacesGet struct { 779 Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` 780 } 781 782 func (m *PnatInterfacesGet) Reset() { *m = PnatInterfacesGet{} } 783 func (*PnatInterfacesGet) GetMessageName() string { return "pnat_interfaces_get" } 784 func (*PnatInterfacesGet) GetCrcString() string { return "f75ba505" } 785 func (*PnatInterfacesGet) GetMessageType() api.MessageType { 786 return api.RequestMessage 787 } 788 789 func (m *PnatInterfacesGet) Size() (size int) { 790 if m == nil { 791 return 0 792 } 793 size += 4 // m.Cursor 794 return size 795 } 796 func (m *PnatInterfacesGet) Marshal(b []byte) ([]byte, error) { 797 if b == nil { 798 b = make([]byte, m.Size()) 799 } 800 buf := codec.NewBuffer(b) 801 buf.EncodeUint32(m.Cursor) 802 return buf.Bytes(), nil 803 } 804 func (m *PnatInterfacesGet) Unmarshal(b []byte) error { 805 buf := codec.NewBuffer(b) 806 m.Cursor = buf.DecodeUint32() 807 return nil 808 } 809 810 // PnatInterfacesGetReply defines message 'pnat_interfaces_get_reply'. 811 type PnatInterfacesGetReply struct { 812 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 813 Cursor uint32 `binapi:"u32,name=cursor" json:"cursor,omitempty"` 814 } 815 816 func (m *PnatInterfacesGetReply) Reset() { *m = PnatInterfacesGetReply{} } 817 func (*PnatInterfacesGetReply) GetMessageName() string { return "pnat_interfaces_get_reply" } 818 func (*PnatInterfacesGetReply) GetCrcString() string { return "53b48f5d" } 819 func (*PnatInterfacesGetReply) GetMessageType() api.MessageType { 820 return api.ReplyMessage 821 } 822 823 func (m *PnatInterfacesGetReply) Size() (size int) { 824 if m == nil { 825 return 0 826 } 827 size += 4 // m.Retval 828 size += 4 // m.Cursor 829 return size 830 } 831 func (m *PnatInterfacesGetReply) Marshal(b []byte) ([]byte, error) { 832 if b == nil { 833 b = make([]byte, m.Size()) 834 } 835 buf := codec.NewBuffer(b) 836 buf.EncodeInt32(m.Retval) 837 buf.EncodeUint32(m.Cursor) 838 return buf.Bytes(), nil 839 } 840 func (m *PnatInterfacesGetReply) Unmarshal(b []byte) error { 841 buf := codec.NewBuffer(b) 842 m.Retval = buf.DecodeInt32() 843 m.Cursor = buf.DecodeUint32() 844 return nil 845 } 846 847 func init() { file_pnat_binapi_init() } 848 func file_pnat_binapi_init() { 849 api.RegisterMessage((*PnatBindingAdd)(nil), "pnat_binding_add_946ee0b7") 850 api.RegisterMessage((*PnatBindingAddReply)(nil), "pnat_binding_add_reply_4cd980a7") 851 api.RegisterMessage((*PnatBindingAddV2)(nil), "pnat_binding_add_v2_946ee0b7") 852 api.RegisterMessage((*PnatBindingAddV2Reply)(nil), "pnat_binding_add_v2_reply_4cd980a7") 853 api.RegisterMessage((*PnatBindingAttach)(nil), "pnat_binding_attach_6e074232") 854 api.RegisterMessage((*PnatBindingAttachReply)(nil), "pnat_binding_attach_reply_e8d4e804") 855 api.RegisterMessage((*PnatBindingDel)(nil), "pnat_binding_del_9259df7b") 856 api.RegisterMessage((*PnatBindingDelReply)(nil), "pnat_binding_del_reply_e8d4e804") 857 api.RegisterMessage((*PnatBindingDetach)(nil), "pnat_binding_detach_6e074232") 858 api.RegisterMessage((*PnatBindingDetachReply)(nil), "pnat_binding_detach_reply_e8d4e804") 859 api.RegisterMessage((*PnatBindingsDetails)(nil), "pnat_bindings_details_08fb2815") 860 api.RegisterMessage((*PnatBindingsGet)(nil), "pnat_bindings_get_f75ba505") 861 api.RegisterMessage((*PnatBindingsGetReply)(nil), "pnat_bindings_get_reply_53b48f5d") 862 api.RegisterMessage((*PnatInterfacesDetails)(nil), "pnat_interfaces_details_4cb09493") 863 api.RegisterMessage((*PnatInterfacesGet)(nil), "pnat_interfaces_get_f75ba505") 864 api.RegisterMessage((*PnatInterfacesGetReply)(nil), "pnat_interfaces_get_reply_53b48f5d") 865 } 866 867 // Messages returns list of all messages in this module. 868 func AllMessages() []api.Message { 869 return []api.Message{ 870 (*PnatBindingAdd)(nil), 871 (*PnatBindingAddReply)(nil), 872 (*PnatBindingAddV2)(nil), 873 (*PnatBindingAddV2Reply)(nil), 874 (*PnatBindingAttach)(nil), 875 (*PnatBindingAttachReply)(nil), 876 (*PnatBindingDel)(nil), 877 (*PnatBindingDelReply)(nil), 878 (*PnatBindingDetach)(nil), 879 (*PnatBindingDetachReply)(nil), 880 (*PnatBindingsDetails)(nil), 881 (*PnatBindingsGet)(nil), 882 (*PnatBindingsGetReply)(nil), 883 (*PnatInterfacesDetails)(nil), 884 (*PnatInterfacesGet)(nil), 885 (*PnatInterfacesGetReply)(nil), 886 } 887 }