github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/tapv2/tapv2.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/tapv2.api.json 6 7 // Package tapv2 contains generated bindings for API file tapv2.api. 8 // 9 // Contents: 10 // - 1 enum 11 // - 8 messages 12 package tapv2 13 14 import ( 15 "strconv" 16 17 ethernet_types "github.com/networkservicemesh/govpp/binapi/ethernet_types" 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 = "tapv2" 32 APIVersion = "4.0.0" 33 VersionCrc = 0xc2f80dc7 34 ) 35 36 // TapFlags defines enum 'tap_flags'. 37 type TapFlags uint32 38 39 const ( 40 TAP_API_FLAG_GSO TapFlags = 1 41 TAP_API_FLAG_CSUM_OFFLOAD TapFlags = 2 42 TAP_API_FLAG_PERSIST TapFlags = 4 43 TAP_API_FLAG_ATTACH TapFlags = 8 44 TAP_API_FLAG_TUN TapFlags = 16 45 TAP_API_FLAG_GRO_COALESCE TapFlags = 32 46 TAP_API_FLAG_PACKED TapFlags = 64 47 TAP_API_FLAG_IN_ORDER TapFlags = 128 48 ) 49 50 var ( 51 TapFlags_name = map[uint32]string{ 52 1: "TAP_API_FLAG_GSO", 53 2: "TAP_API_FLAG_CSUM_OFFLOAD", 54 4: "TAP_API_FLAG_PERSIST", 55 8: "TAP_API_FLAG_ATTACH", 56 16: "TAP_API_FLAG_TUN", 57 32: "TAP_API_FLAG_GRO_COALESCE", 58 64: "TAP_API_FLAG_PACKED", 59 128: "TAP_API_FLAG_IN_ORDER", 60 } 61 TapFlags_value = map[string]uint32{ 62 "TAP_API_FLAG_GSO": 1, 63 "TAP_API_FLAG_CSUM_OFFLOAD": 2, 64 "TAP_API_FLAG_PERSIST": 4, 65 "TAP_API_FLAG_ATTACH": 8, 66 "TAP_API_FLAG_TUN": 16, 67 "TAP_API_FLAG_GRO_COALESCE": 32, 68 "TAP_API_FLAG_PACKED": 64, 69 "TAP_API_FLAG_IN_ORDER": 128, 70 } 71 ) 72 73 func (x TapFlags) String() string { 74 s, ok := TapFlags_name[uint32(x)] 75 if ok { 76 return s 77 } 78 str := func(n uint32) string { 79 s, ok := TapFlags_name[uint32(n)] 80 if ok { 81 return s 82 } 83 return "TapFlags(" + strconv.Itoa(int(n)) + ")" 84 } 85 for i := uint32(0); i <= 32; i++ { 86 val := uint32(x) 87 if val&(1<<i) != 0 { 88 if s != "" { 89 s += "|" 90 } 91 s += str(1 << i) 92 } 93 } 94 if s == "" { 95 return str(uint32(x)) 96 } 97 return s 98 } 99 100 // Reply for tap dump request 101 // - sw_if_index - software index of tap interface 102 // - id - interface id 103 // - tx_ring_sz - the number of entries of TX ring 104 // - rx_ring_sz - the number of entries of RX ring 105 // - host_mtu_size - host mtu size 106 // - host_mac_addr - mac address assigned to the host side of the interface 107 // - host_ip4_prefix - host IPv4 ip address 108 // - host_ip6_prefix - host IPv6 ip address 109 // - tap_flags - flags for the TAP interface creation 110 // - dev_name - Linux tap device name 111 // - host_if_name - host side interface name 112 // - host_namespace - host namespace the interface is attached into 113 // - host_bridge - host bridge the interface is attached into 114 // 115 // SwInterfaceTapV2Details defines message 'sw_interface_tap_v2_details'. 116 type SwInterfaceTapV2Details struct { 117 SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` 118 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` 119 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"` 120 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"` 121 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"` 122 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"` 123 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"` 124 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"` 125 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"` 126 DevName string `binapi:"string[64],name=dev_name" json:"dev_name,omitempty"` 127 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` 128 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"` 129 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"` 130 } 131 132 func (m *SwInterfaceTapV2Details) Reset() { *m = SwInterfaceTapV2Details{} } 133 func (*SwInterfaceTapV2Details) GetMessageName() string { return "sw_interface_tap_v2_details" } 134 func (*SwInterfaceTapV2Details) GetCrcString() string { return "1e2b2a47" } 135 func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType { 136 return api.ReplyMessage 137 } 138 139 func (m *SwInterfaceTapV2Details) Size() (size int) { 140 if m == nil { 141 return 0 142 } 143 size += 4 // m.SwIfIndex 144 size += 4 // m.ID 145 size += 2 // m.TxRingSz 146 size += 2 // m.RxRingSz 147 size += 4 // m.HostMtuSize 148 size += 1 * 6 // m.HostMacAddr 149 size += 1 * 4 // m.HostIP4Prefix.Address 150 size += 1 // m.HostIP4Prefix.Len 151 size += 1 * 16 // m.HostIP6Prefix.Address 152 size += 1 // m.HostIP6Prefix.Len 153 size += 4 // m.TapFlags 154 size += 64 // m.DevName 155 size += 64 // m.HostIfName 156 size += 64 // m.HostNamespace 157 size += 64 // m.HostBridge 158 return size 159 } 160 func (m *SwInterfaceTapV2Details) Marshal(b []byte) ([]byte, error) { 161 if b == nil { 162 b = make([]byte, m.Size()) 163 } 164 buf := codec.NewBuffer(b) 165 buf.EncodeUint32(m.SwIfIndex) 166 buf.EncodeUint32(m.ID) 167 buf.EncodeUint16(m.TxRingSz) 168 buf.EncodeUint16(m.RxRingSz) 169 buf.EncodeUint32(m.HostMtuSize) 170 buf.EncodeBytes(m.HostMacAddr[:], 6) 171 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4) 172 buf.EncodeUint8(m.HostIP4Prefix.Len) 173 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16) 174 buf.EncodeUint8(m.HostIP6Prefix.Len) 175 buf.EncodeUint32(uint32(m.TapFlags)) 176 buf.EncodeString(m.DevName, 64) 177 buf.EncodeString(m.HostIfName, 64) 178 buf.EncodeString(m.HostNamespace, 64) 179 buf.EncodeString(m.HostBridge, 64) 180 return buf.Bytes(), nil 181 } 182 func (m *SwInterfaceTapV2Details) Unmarshal(b []byte) error { 183 buf := codec.NewBuffer(b) 184 m.SwIfIndex = buf.DecodeUint32() 185 m.ID = buf.DecodeUint32() 186 m.TxRingSz = buf.DecodeUint16() 187 m.RxRingSz = buf.DecodeUint16() 188 m.HostMtuSize = buf.DecodeUint32() 189 copy(m.HostMacAddr[:], buf.DecodeBytes(6)) 190 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4)) 191 m.HostIP4Prefix.Len = buf.DecodeUint8() 192 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16)) 193 m.HostIP6Prefix.Len = buf.DecodeUint8() 194 m.TapFlags = TapFlags(buf.DecodeUint32()) 195 m.DevName = buf.DecodeString(64) 196 m.HostIfName = buf.DecodeString(64) 197 m.HostNamespace = buf.DecodeString(64) 198 m.HostBridge = buf.DecodeString(64) 199 return nil 200 } 201 202 // Dump tap interfaces request 203 // - sw_if_index - filter by sw_if_index 204 // 205 // SwInterfaceTapV2Dump defines message 'sw_interface_tap_v2_dump'. 206 type SwInterfaceTapV2Dump struct { 207 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` 208 } 209 210 func (m *SwInterfaceTapV2Dump) Reset() { *m = SwInterfaceTapV2Dump{} } 211 func (*SwInterfaceTapV2Dump) GetMessageName() string { return "sw_interface_tap_v2_dump" } 212 func (*SwInterfaceTapV2Dump) GetCrcString() string { return "f9e6675e" } 213 func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType { 214 return api.RequestMessage 215 } 216 217 func (m *SwInterfaceTapV2Dump) Size() (size int) { 218 if m == nil { 219 return 0 220 } 221 size += 4 // m.SwIfIndex 222 return size 223 } 224 func (m *SwInterfaceTapV2Dump) Marshal(b []byte) ([]byte, error) { 225 if b == nil { 226 b = make([]byte, m.Size()) 227 } 228 buf := codec.NewBuffer(b) 229 buf.EncodeUint32(uint32(m.SwIfIndex)) 230 return buf.Bytes(), nil 231 } 232 func (m *SwInterfaceTapV2Dump) Unmarshal(b []byte) error { 233 buf := codec.NewBuffer(b) 234 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 235 return nil 236 } 237 238 // Initialize a new tap interface with the given parameters 239 // - id - interface id, 0xffffffff means auto 240 // - use_random_mac - let the system generate a unique mac address 241 // - mac_address - mac addr to assign to the interface if use_random not set 242 // - num_rx_queues - number of rx queues 243 // - tx_ring_sz - the number of entries of TX ring, optional, default is 256 entries, must be power of 2 244 // - rx_ring_sz - the number of entries of RX ring, optional, default is 256 entries, must be power of 2 245 // - host_mtu_set - host MTU should be set 246 // - host_mtu_size - host MTU size 247 // - host_mac_addr_set - host side interface mac address should be set 248 // - host_mac_addr - host side interface mac address 249 // - host_ip4_prefix_set - host IPv4 ip address should be set 250 // - host_ip4_prefix - host IPv4 ip address 251 // - host_ip6_prefix_set - host IPv6 ip address should be set 252 // - host_ip6_prefix - host IPv6 ip address 253 // - host_ip4_gw_set - host IPv4 default gateway should be set 254 // - host_ip4_gw - host IPv4 default gateway 255 // - host_ip6_gw_set - host IPv6 default gateway should be set 256 // - host_ip6_gw - host IPv6 default gateway 257 // - tap_flags - flags for the TAP interface creation 258 // - host_if_name_set - host side interface name should be set 259 // - host_if_name - host side interface name 260 // - host_namespace_set - host namespace should be set 261 // - host_namespace - host namespace to attach interface to 262 // - host_bridge_set - host bridge should be set 263 // - host_bridge - host bridge to attach interface to 264 // - tag - tag 265 // 266 // TapCreateV2 defines message 'tap_create_v2'. 267 // Deprecated: the message will be removed in the future versions 268 type TapCreateV2 struct { 269 ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"` 270 UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"` 271 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` 272 NumRxQueues uint8 `binapi:"u8,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"` 273 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=256" json:"tx_ring_sz,omitempty"` 274 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=256" json:"rx_ring_sz,omitempty"` 275 HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"` 276 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"` 277 HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"` 278 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"` 279 HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"` 280 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"` 281 HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"` 282 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"` 283 HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"` 284 HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"` 285 HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"` 286 HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"` 287 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"` 288 HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"` 289 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"` 290 HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"` 291 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` 292 HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"` 293 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"` 294 Tag string `binapi:"string[],name=tag" json:"tag,omitempty"` 295 } 296 297 func (m *TapCreateV2) Reset() { *m = TapCreateV2{} } 298 func (*TapCreateV2) GetMessageName() string { return "tap_create_v2" } 299 func (*TapCreateV2) GetCrcString() string { return "2d0d6570" } 300 func (*TapCreateV2) GetMessageType() api.MessageType { 301 return api.RequestMessage 302 } 303 304 func (m *TapCreateV2) Size() (size int) { 305 if m == nil { 306 return 0 307 } 308 size += 4 // m.ID 309 size += 1 // m.UseRandomMac 310 size += 1 * 6 // m.MacAddress 311 size += 1 // m.NumRxQueues 312 size += 2 // m.TxRingSz 313 size += 2 // m.RxRingSz 314 size += 1 // m.HostMtuSet 315 size += 4 // m.HostMtuSize 316 size += 1 // m.HostMacAddrSet 317 size += 1 * 6 // m.HostMacAddr 318 size += 1 // m.HostIP4PrefixSet 319 size += 1 * 4 // m.HostIP4Prefix.Address 320 size += 1 // m.HostIP4Prefix.Len 321 size += 1 // m.HostIP6PrefixSet 322 size += 1 * 16 // m.HostIP6Prefix.Address 323 size += 1 // m.HostIP6Prefix.Len 324 size += 1 // m.HostIP4GwSet 325 size += 1 * 4 // m.HostIP4Gw 326 size += 1 // m.HostIP6GwSet 327 size += 1 * 16 // m.HostIP6Gw 328 size += 4 // m.TapFlags 329 size += 1 // m.HostNamespaceSet 330 size += 64 // m.HostNamespace 331 size += 1 // m.HostIfNameSet 332 size += 64 // m.HostIfName 333 size += 1 // m.HostBridgeSet 334 size += 64 // m.HostBridge 335 size += 4 + len(m.Tag) // m.Tag 336 return size 337 } 338 func (m *TapCreateV2) Marshal(b []byte) ([]byte, error) { 339 if b == nil { 340 b = make([]byte, m.Size()) 341 } 342 buf := codec.NewBuffer(b) 343 buf.EncodeUint32(m.ID) 344 buf.EncodeBool(m.UseRandomMac) 345 buf.EncodeBytes(m.MacAddress[:], 6) 346 buf.EncodeUint8(m.NumRxQueues) 347 buf.EncodeUint16(m.TxRingSz) 348 buf.EncodeUint16(m.RxRingSz) 349 buf.EncodeBool(m.HostMtuSet) 350 buf.EncodeUint32(m.HostMtuSize) 351 buf.EncodeBool(m.HostMacAddrSet) 352 buf.EncodeBytes(m.HostMacAddr[:], 6) 353 buf.EncodeBool(m.HostIP4PrefixSet) 354 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4) 355 buf.EncodeUint8(m.HostIP4Prefix.Len) 356 buf.EncodeBool(m.HostIP6PrefixSet) 357 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16) 358 buf.EncodeUint8(m.HostIP6Prefix.Len) 359 buf.EncodeBool(m.HostIP4GwSet) 360 buf.EncodeBytes(m.HostIP4Gw[:], 4) 361 buf.EncodeBool(m.HostIP6GwSet) 362 buf.EncodeBytes(m.HostIP6Gw[:], 16) 363 buf.EncodeUint32(uint32(m.TapFlags)) 364 buf.EncodeBool(m.HostNamespaceSet) 365 buf.EncodeString(m.HostNamespace, 64) 366 buf.EncodeBool(m.HostIfNameSet) 367 buf.EncodeString(m.HostIfName, 64) 368 buf.EncodeBool(m.HostBridgeSet) 369 buf.EncodeString(m.HostBridge, 64) 370 buf.EncodeString(m.Tag, 0) 371 return buf.Bytes(), nil 372 } 373 func (m *TapCreateV2) Unmarshal(b []byte) error { 374 buf := codec.NewBuffer(b) 375 m.ID = buf.DecodeUint32() 376 m.UseRandomMac = buf.DecodeBool() 377 copy(m.MacAddress[:], buf.DecodeBytes(6)) 378 m.NumRxQueues = buf.DecodeUint8() 379 m.TxRingSz = buf.DecodeUint16() 380 m.RxRingSz = buf.DecodeUint16() 381 m.HostMtuSet = buf.DecodeBool() 382 m.HostMtuSize = buf.DecodeUint32() 383 m.HostMacAddrSet = buf.DecodeBool() 384 copy(m.HostMacAddr[:], buf.DecodeBytes(6)) 385 m.HostIP4PrefixSet = buf.DecodeBool() 386 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4)) 387 m.HostIP4Prefix.Len = buf.DecodeUint8() 388 m.HostIP6PrefixSet = buf.DecodeBool() 389 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16)) 390 m.HostIP6Prefix.Len = buf.DecodeUint8() 391 m.HostIP4GwSet = buf.DecodeBool() 392 copy(m.HostIP4Gw[:], buf.DecodeBytes(4)) 393 m.HostIP6GwSet = buf.DecodeBool() 394 copy(m.HostIP6Gw[:], buf.DecodeBytes(16)) 395 m.TapFlags = TapFlags(buf.DecodeUint32()) 396 m.HostNamespaceSet = buf.DecodeBool() 397 m.HostNamespace = buf.DecodeString(64) 398 m.HostIfNameSet = buf.DecodeBool() 399 m.HostIfName = buf.DecodeString(64) 400 m.HostBridgeSet = buf.DecodeBool() 401 m.HostBridge = buf.DecodeString(64) 402 m.Tag = buf.DecodeString(0) 403 return nil 404 } 405 406 // Reply for tap create reply 407 // - retval - return code 408 // - sw_if_index - software index allocated for the new tap interface 409 // 410 // TapCreateV2Reply defines message 'tap_create_v2_reply'. 411 // Deprecated: the message will be removed in the future versions 412 type TapCreateV2Reply struct { 413 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 414 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 415 } 416 417 func (m *TapCreateV2Reply) Reset() { *m = TapCreateV2Reply{} } 418 func (*TapCreateV2Reply) GetMessageName() string { return "tap_create_v2_reply" } 419 func (*TapCreateV2Reply) GetCrcString() string { return "5383d31f" } 420 func (*TapCreateV2Reply) GetMessageType() api.MessageType { 421 return api.ReplyMessage 422 } 423 424 func (m *TapCreateV2Reply) Size() (size int) { 425 if m == nil { 426 return 0 427 } 428 size += 4 // m.Retval 429 size += 4 // m.SwIfIndex 430 return size 431 } 432 func (m *TapCreateV2Reply) Marshal(b []byte) ([]byte, error) { 433 if b == nil { 434 b = make([]byte, m.Size()) 435 } 436 buf := codec.NewBuffer(b) 437 buf.EncodeInt32(m.Retval) 438 buf.EncodeUint32(uint32(m.SwIfIndex)) 439 return buf.Bytes(), nil 440 } 441 func (m *TapCreateV2Reply) Unmarshal(b []byte) error { 442 buf := codec.NewBuffer(b) 443 m.Retval = buf.DecodeInt32() 444 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 445 return nil 446 } 447 448 // Initialize a new tap interface with the given parameters 449 // - id - interface id, 0xffffffff means auto 450 // - use_random_mac - let the system generate a unique mac address 451 // - mac_address - mac addr to assign to the interface if use_random not set 452 // - num_rx_queues - number of rx queues 453 // - num_tx_queues - number of tx queues 454 // - tx_ring_sz - the number of entries of TX ring, optional, default is 256 entries, must be power of 2 455 // - rx_ring_sz - the number of entries of RX ring, optional, default is 256 entries, must be power of 2 456 // - host_mtu_set - host MTU should be set 457 // - host_mtu_size - host MTU size 458 // - host_mac_addr_set - host side interface mac address should be set 459 // - host_mac_addr - host side interface mac address 460 // - host_ip4_prefix_set - host IPv4 ip address should be set 461 // - host_ip4_prefix - host IPv4 ip address 462 // - host_ip6_prefix_set - host IPv6 ip address should be set 463 // - host_ip6_prefix - host IPv6 ip address 464 // - host_ip4_gw_set - host IPv4 default gateway should be set 465 // - host_ip4_gw - host IPv4 default gateway 466 // - host_ip6_gw_set - host IPv6 default gateway should be set 467 // - host_ip6_gw - host IPv6 default gateway 468 // - tap_flags - flags for the TAP interface creation 469 // - host_if_name_set - host side interface name should be set 470 // - host_if_name - host side interface name 471 // - host_namespace_set - host namespace should be set 472 // - host_namespace - host namespace to attach interface to 473 // - host_bridge_set - host bridge should be set 474 // - host_bridge - host bridge to attach interface to 475 // - tag - tag 476 // 477 // TapCreateV3 defines message 'tap_create_v3'. 478 type TapCreateV3 struct { 479 ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"` 480 UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"` 481 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` 482 NumRxQueues uint16 `binapi:"u16,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"` 483 NumTxQueues uint16 `binapi:"u16,name=num_tx_queues,default=1" json:"num_tx_queues,omitempty"` 484 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=256" json:"tx_ring_sz,omitempty"` 485 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=256" json:"rx_ring_sz,omitempty"` 486 HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"` 487 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"` 488 HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"` 489 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"` 490 HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"` 491 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"` 492 HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"` 493 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"` 494 HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"` 495 HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"` 496 HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"` 497 HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"` 498 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"` 499 HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"` 500 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"` 501 HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"` 502 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` 503 HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"` 504 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"` 505 Tag string `binapi:"string[],name=tag" json:"tag,omitempty"` 506 } 507 508 func (m *TapCreateV3) Reset() { *m = TapCreateV3{} } 509 func (*TapCreateV3) GetMessageName() string { return "tap_create_v3" } 510 func (*TapCreateV3) GetCrcString() string { return "3f3fd1df" } 511 func (*TapCreateV3) GetMessageType() api.MessageType { 512 return api.RequestMessage 513 } 514 515 func (m *TapCreateV3) Size() (size int) { 516 if m == nil { 517 return 0 518 } 519 size += 4 // m.ID 520 size += 1 // m.UseRandomMac 521 size += 1 * 6 // m.MacAddress 522 size += 2 // m.NumRxQueues 523 size += 2 // m.NumTxQueues 524 size += 2 // m.TxRingSz 525 size += 2 // m.RxRingSz 526 size += 1 // m.HostMtuSet 527 size += 4 // m.HostMtuSize 528 size += 1 // m.HostMacAddrSet 529 size += 1 * 6 // m.HostMacAddr 530 size += 1 // m.HostIP4PrefixSet 531 size += 1 * 4 // m.HostIP4Prefix.Address 532 size += 1 // m.HostIP4Prefix.Len 533 size += 1 // m.HostIP6PrefixSet 534 size += 1 * 16 // m.HostIP6Prefix.Address 535 size += 1 // m.HostIP6Prefix.Len 536 size += 1 // m.HostIP4GwSet 537 size += 1 * 4 // m.HostIP4Gw 538 size += 1 // m.HostIP6GwSet 539 size += 1 * 16 // m.HostIP6Gw 540 size += 4 // m.TapFlags 541 size += 1 // m.HostNamespaceSet 542 size += 64 // m.HostNamespace 543 size += 1 // m.HostIfNameSet 544 size += 64 // m.HostIfName 545 size += 1 // m.HostBridgeSet 546 size += 64 // m.HostBridge 547 size += 4 + len(m.Tag) // m.Tag 548 return size 549 } 550 func (m *TapCreateV3) Marshal(b []byte) ([]byte, error) { 551 if b == nil { 552 b = make([]byte, m.Size()) 553 } 554 buf := codec.NewBuffer(b) 555 buf.EncodeUint32(m.ID) 556 buf.EncodeBool(m.UseRandomMac) 557 buf.EncodeBytes(m.MacAddress[:], 6) 558 buf.EncodeUint16(m.NumRxQueues) 559 buf.EncodeUint16(m.NumTxQueues) 560 buf.EncodeUint16(m.TxRingSz) 561 buf.EncodeUint16(m.RxRingSz) 562 buf.EncodeBool(m.HostMtuSet) 563 buf.EncodeUint32(m.HostMtuSize) 564 buf.EncodeBool(m.HostMacAddrSet) 565 buf.EncodeBytes(m.HostMacAddr[:], 6) 566 buf.EncodeBool(m.HostIP4PrefixSet) 567 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4) 568 buf.EncodeUint8(m.HostIP4Prefix.Len) 569 buf.EncodeBool(m.HostIP6PrefixSet) 570 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16) 571 buf.EncodeUint8(m.HostIP6Prefix.Len) 572 buf.EncodeBool(m.HostIP4GwSet) 573 buf.EncodeBytes(m.HostIP4Gw[:], 4) 574 buf.EncodeBool(m.HostIP6GwSet) 575 buf.EncodeBytes(m.HostIP6Gw[:], 16) 576 buf.EncodeUint32(uint32(m.TapFlags)) 577 buf.EncodeBool(m.HostNamespaceSet) 578 buf.EncodeString(m.HostNamespace, 64) 579 buf.EncodeBool(m.HostIfNameSet) 580 buf.EncodeString(m.HostIfName, 64) 581 buf.EncodeBool(m.HostBridgeSet) 582 buf.EncodeString(m.HostBridge, 64) 583 buf.EncodeString(m.Tag, 0) 584 return buf.Bytes(), nil 585 } 586 func (m *TapCreateV3) Unmarshal(b []byte) error { 587 buf := codec.NewBuffer(b) 588 m.ID = buf.DecodeUint32() 589 m.UseRandomMac = buf.DecodeBool() 590 copy(m.MacAddress[:], buf.DecodeBytes(6)) 591 m.NumRxQueues = buf.DecodeUint16() 592 m.NumTxQueues = buf.DecodeUint16() 593 m.TxRingSz = buf.DecodeUint16() 594 m.RxRingSz = buf.DecodeUint16() 595 m.HostMtuSet = buf.DecodeBool() 596 m.HostMtuSize = buf.DecodeUint32() 597 m.HostMacAddrSet = buf.DecodeBool() 598 copy(m.HostMacAddr[:], buf.DecodeBytes(6)) 599 m.HostIP4PrefixSet = buf.DecodeBool() 600 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4)) 601 m.HostIP4Prefix.Len = buf.DecodeUint8() 602 m.HostIP6PrefixSet = buf.DecodeBool() 603 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16)) 604 m.HostIP6Prefix.Len = buf.DecodeUint8() 605 m.HostIP4GwSet = buf.DecodeBool() 606 copy(m.HostIP4Gw[:], buf.DecodeBytes(4)) 607 m.HostIP6GwSet = buf.DecodeBool() 608 copy(m.HostIP6Gw[:], buf.DecodeBytes(16)) 609 m.TapFlags = TapFlags(buf.DecodeUint32()) 610 m.HostNamespaceSet = buf.DecodeBool() 611 m.HostNamespace = buf.DecodeString(64) 612 m.HostIfNameSet = buf.DecodeBool() 613 m.HostIfName = buf.DecodeString(64) 614 m.HostBridgeSet = buf.DecodeBool() 615 m.HostBridge = buf.DecodeString(64) 616 m.Tag = buf.DecodeString(0) 617 return nil 618 } 619 620 // Reply for tap create reply 621 // - retval - return code 622 // - sw_if_index - software index allocated for the new tap interface 623 // 624 // TapCreateV3Reply defines message 'tap_create_v3_reply'. 625 type TapCreateV3Reply struct { 626 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 627 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 628 } 629 630 func (m *TapCreateV3Reply) Reset() { *m = TapCreateV3Reply{} } 631 func (*TapCreateV3Reply) GetMessageName() string { return "tap_create_v3_reply" } 632 func (*TapCreateV3Reply) GetCrcString() string { return "5383d31f" } 633 func (*TapCreateV3Reply) GetMessageType() api.MessageType { 634 return api.ReplyMessage 635 } 636 637 func (m *TapCreateV3Reply) Size() (size int) { 638 if m == nil { 639 return 0 640 } 641 size += 4 // m.Retval 642 size += 4 // m.SwIfIndex 643 return size 644 } 645 func (m *TapCreateV3Reply) Marshal(b []byte) ([]byte, error) { 646 if b == nil { 647 b = make([]byte, m.Size()) 648 } 649 buf := codec.NewBuffer(b) 650 buf.EncodeInt32(m.Retval) 651 buf.EncodeUint32(uint32(m.SwIfIndex)) 652 return buf.Bytes(), nil 653 } 654 func (m *TapCreateV3Reply) Unmarshal(b []byte) error { 655 buf := codec.NewBuffer(b) 656 m.Retval = buf.DecodeInt32() 657 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 658 return nil 659 } 660 661 // Delete tap interface 662 // - sw_if_index - interface index of existing tap interface 663 // 664 // TapDeleteV2 defines message 'tap_delete_v2'. 665 type TapDeleteV2 struct { 666 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 667 } 668 669 func (m *TapDeleteV2) Reset() { *m = TapDeleteV2{} } 670 func (*TapDeleteV2) GetMessageName() string { return "tap_delete_v2" } 671 func (*TapDeleteV2) GetCrcString() string { return "f9e6675e" } 672 func (*TapDeleteV2) GetMessageType() api.MessageType { 673 return api.RequestMessage 674 } 675 676 func (m *TapDeleteV2) Size() (size int) { 677 if m == nil { 678 return 0 679 } 680 size += 4 // m.SwIfIndex 681 return size 682 } 683 func (m *TapDeleteV2) Marshal(b []byte) ([]byte, error) { 684 if b == nil { 685 b = make([]byte, m.Size()) 686 } 687 buf := codec.NewBuffer(b) 688 buf.EncodeUint32(uint32(m.SwIfIndex)) 689 return buf.Bytes(), nil 690 } 691 func (m *TapDeleteV2) Unmarshal(b []byte) error { 692 buf := codec.NewBuffer(b) 693 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 694 return nil 695 } 696 697 // TapDeleteV2Reply defines message 'tap_delete_v2_reply'. 698 type TapDeleteV2Reply struct { 699 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 700 } 701 702 func (m *TapDeleteV2Reply) Reset() { *m = TapDeleteV2Reply{} } 703 func (*TapDeleteV2Reply) GetMessageName() string { return "tap_delete_v2_reply" } 704 func (*TapDeleteV2Reply) GetCrcString() string { return "e8d4e804" } 705 func (*TapDeleteV2Reply) GetMessageType() api.MessageType { 706 return api.ReplyMessage 707 } 708 709 func (m *TapDeleteV2Reply) Size() (size int) { 710 if m == nil { 711 return 0 712 } 713 size += 4 // m.Retval 714 return size 715 } 716 func (m *TapDeleteV2Reply) Marshal(b []byte) ([]byte, error) { 717 if b == nil { 718 b = make([]byte, m.Size()) 719 } 720 buf := codec.NewBuffer(b) 721 buf.EncodeInt32(m.Retval) 722 return buf.Bytes(), nil 723 } 724 func (m *TapDeleteV2Reply) Unmarshal(b []byte) error { 725 buf := codec.NewBuffer(b) 726 m.Retval = buf.DecodeInt32() 727 return nil 728 } 729 730 func init() { file_tapv2_binapi_init() } 731 func file_tapv2_binapi_init() { 732 api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_1e2b2a47") 733 api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "sw_interface_tap_v2_dump_f9e6675e") 734 api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_2d0d6570") 735 api.RegisterMessage((*TapCreateV2Reply)(nil), "tap_create_v2_reply_5383d31f") 736 api.RegisterMessage((*TapCreateV3)(nil), "tap_create_v3_3f3fd1df") 737 api.RegisterMessage((*TapCreateV3Reply)(nil), "tap_create_v3_reply_5383d31f") 738 api.RegisterMessage((*TapDeleteV2)(nil), "tap_delete_v2_f9e6675e") 739 api.RegisterMessage((*TapDeleteV2Reply)(nil), "tap_delete_v2_reply_e8d4e804") 740 } 741 742 // Messages returns list of all messages in this module. 743 func AllMessages() []api.Message { 744 return []api.Message{ 745 (*SwInterfaceTapV2Details)(nil), 746 (*SwInterfaceTapV2Dump)(nil), 747 (*TapCreateV2)(nil), 748 (*TapCreateV2Reply)(nil), 749 (*TapCreateV3)(nil), 750 (*TapCreateV3Reply)(nil), 751 (*TapDeleteV2)(nil), 752 (*TapDeleteV2Reply)(nil), 753 } 754 }