github.com/edwarnicke/govpp@v0.0.0-20230130211138-14ef5d20b1d0/binapi/tapv2/tapv2.ba.go (about) 1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT. 2 // versions: 3 // binapi-generator: v0.4.0-dev 4 // VPP: 23.02-rc0~189-g57127b32a 5 // source: /usr/share/vpp/api/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 // 13 package tapv2 14 15 import ( 16 "strconv" 17 18 api "git.fd.io/govpp.git/api" 19 codec "git.fd.io/govpp.git/codec" 20 ethernet_types "github.com/edwarnicke/govpp/binapi/ethernet_types" 21 interface_types "github.com/edwarnicke/govpp/binapi/interface_types" 22 ip_types "github.com/edwarnicke/govpp/binapi/ip_types" 23 ) 24 25 // This is a compile-time assertion to ensure that this generated file 26 // is compatible with the GoVPP api package it is being compiled against. 27 // A compilation error at this line likely means your copy of the 28 // GoVPP api package needs to be updated. 29 const _ = api.GoVppAPIPackageIsVersion2 30 31 const ( 32 APIFile = "tapv2" 33 APIVersion = "4.0.0" 34 VersionCrc = 0xc2f80dc7 35 ) 36 37 // TapFlags defines enum 'tap_flags'. 38 type TapFlags uint32 39 40 const ( 41 TAP_API_FLAG_GSO TapFlags = 1 42 TAP_API_FLAG_CSUM_OFFLOAD TapFlags = 2 43 TAP_API_FLAG_PERSIST TapFlags = 4 44 TAP_API_FLAG_ATTACH TapFlags = 8 45 TAP_API_FLAG_TUN TapFlags = 16 46 TAP_API_FLAG_GRO_COALESCE TapFlags = 32 47 TAP_API_FLAG_PACKED TapFlags = 64 48 TAP_API_FLAG_IN_ORDER TapFlags = 128 49 ) 50 51 var ( 52 TapFlags_name = map[uint32]string{ 53 1: "TAP_API_FLAG_GSO", 54 2: "TAP_API_FLAG_CSUM_OFFLOAD", 55 4: "TAP_API_FLAG_PERSIST", 56 8: "TAP_API_FLAG_ATTACH", 57 16: "TAP_API_FLAG_TUN", 58 32: "TAP_API_FLAG_GRO_COALESCE", 59 64: "TAP_API_FLAG_PACKED", 60 128: "TAP_API_FLAG_IN_ORDER", 61 } 62 TapFlags_value = map[string]uint32{ 63 "TAP_API_FLAG_GSO": 1, 64 "TAP_API_FLAG_CSUM_OFFLOAD": 2, 65 "TAP_API_FLAG_PERSIST": 4, 66 "TAP_API_FLAG_ATTACH": 8, 67 "TAP_API_FLAG_TUN": 16, 68 "TAP_API_FLAG_GRO_COALESCE": 32, 69 "TAP_API_FLAG_PACKED": 64, 70 "TAP_API_FLAG_IN_ORDER": 128, 71 } 72 ) 73 74 func (x TapFlags) String() string { 75 s, ok := TapFlags_name[uint32(x)] 76 if ok { 77 return s 78 } 79 str := func(n uint32) string { 80 s, ok := TapFlags_name[uint32(n)] 81 if ok { 82 return s 83 } 84 return "TapFlags(" + strconv.Itoa(int(n)) + ")" 85 } 86 for i := uint32(0); i <= 32; i++ { 87 val := uint32(x) 88 if val&(1<<i) != 0 { 89 if s != "" { 90 s += "|" 91 } 92 s += str(1 << i) 93 } 94 } 95 if s == "" { 96 return str(uint32(x)) 97 } 98 return s 99 } 100 101 // SwInterfaceTapV2Details defines message 'sw_interface_tap_v2_details'. 102 type SwInterfaceTapV2Details struct { 103 SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"` 104 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"` 105 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"` 106 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"` 107 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"` 108 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"` 109 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"` 110 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"` 111 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"` 112 DevName string `binapi:"string[64],name=dev_name" json:"dev_name,omitempty"` 113 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` 114 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"` 115 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"` 116 } 117 118 func (m *SwInterfaceTapV2Details) Reset() { *m = SwInterfaceTapV2Details{} } 119 func (*SwInterfaceTapV2Details) GetMessageName() string { return "sw_interface_tap_v2_details" } 120 func (*SwInterfaceTapV2Details) GetCrcString() string { return "1e2b2a47" } 121 func (*SwInterfaceTapV2Details) GetMessageType() api.MessageType { 122 return api.ReplyMessage 123 } 124 125 func (m *SwInterfaceTapV2Details) Size() (size int) { 126 if m == nil { 127 return 0 128 } 129 size += 4 // m.SwIfIndex 130 size += 4 // m.ID 131 size += 2 // m.TxRingSz 132 size += 2 // m.RxRingSz 133 size += 4 // m.HostMtuSize 134 size += 1 * 6 // m.HostMacAddr 135 size += 1 * 4 // m.HostIP4Prefix.Address 136 size += 1 // m.HostIP4Prefix.Len 137 size += 1 * 16 // m.HostIP6Prefix.Address 138 size += 1 // m.HostIP6Prefix.Len 139 size += 4 // m.TapFlags 140 size += 64 // m.DevName 141 size += 64 // m.HostIfName 142 size += 64 // m.HostNamespace 143 size += 64 // m.HostBridge 144 return size 145 } 146 func (m *SwInterfaceTapV2Details) Marshal(b []byte) ([]byte, error) { 147 if b == nil { 148 b = make([]byte, m.Size()) 149 } 150 buf := codec.NewBuffer(b) 151 buf.EncodeUint32(m.SwIfIndex) 152 buf.EncodeUint32(m.ID) 153 buf.EncodeUint16(m.TxRingSz) 154 buf.EncodeUint16(m.RxRingSz) 155 buf.EncodeUint32(m.HostMtuSize) 156 buf.EncodeBytes(m.HostMacAddr[:], 6) 157 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4) 158 buf.EncodeUint8(m.HostIP4Prefix.Len) 159 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16) 160 buf.EncodeUint8(m.HostIP6Prefix.Len) 161 buf.EncodeUint32(uint32(m.TapFlags)) 162 buf.EncodeString(m.DevName, 64) 163 buf.EncodeString(m.HostIfName, 64) 164 buf.EncodeString(m.HostNamespace, 64) 165 buf.EncodeString(m.HostBridge, 64) 166 return buf.Bytes(), nil 167 } 168 func (m *SwInterfaceTapV2Details) Unmarshal(b []byte) error { 169 buf := codec.NewBuffer(b) 170 m.SwIfIndex = buf.DecodeUint32() 171 m.ID = buf.DecodeUint32() 172 m.TxRingSz = buf.DecodeUint16() 173 m.RxRingSz = buf.DecodeUint16() 174 m.HostMtuSize = buf.DecodeUint32() 175 copy(m.HostMacAddr[:], buf.DecodeBytes(6)) 176 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4)) 177 m.HostIP4Prefix.Len = buf.DecodeUint8() 178 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16)) 179 m.HostIP6Prefix.Len = buf.DecodeUint8() 180 m.TapFlags = TapFlags(buf.DecodeUint32()) 181 m.DevName = buf.DecodeString(64) 182 m.HostIfName = buf.DecodeString(64) 183 m.HostNamespace = buf.DecodeString(64) 184 m.HostBridge = buf.DecodeString(64) 185 return nil 186 } 187 188 // SwInterfaceTapV2Dump defines message 'sw_interface_tap_v2_dump'. 189 type SwInterfaceTapV2Dump struct { 190 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"` 191 } 192 193 func (m *SwInterfaceTapV2Dump) Reset() { *m = SwInterfaceTapV2Dump{} } 194 func (*SwInterfaceTapV2Dump) GetMessageName() string { return "sw_interface_tap_v2_dump" } 195 func (*SwInterfaceTapV2Dump) GetCrcString() string { return "f9e6675e" } 196 func (*SwInterfaceTapV2Dump) GetMessageType() api.MessageType { 197 return api.RequestMessage 198 } 199 200 func (m *SwInterfaceTapV2Dump) Size() (size int) { 201 if m == nil { 202 return 0 203 } 204 size += 4 // m.SwIfIndex 205 return size 206 } 207 func (m *SwInterfaceTapV2Dump) Marshal(b []byte) ([]byte, error) { 208 if b == nil { 209 b = make([]byte, m.Size()) 210 } 211 buf := codec.NewBuffer(b) 212 buf.EncodeUint32(uint32(m.SwIfIndex)) 213 return buf.Bytes(), nil 214 } 215 func (m *SwInterfaceTapV2Dump) Unmarshal(b []byte) error { 216 buf := codec.NewBuffer(b) 217 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 218 return nil 219 } 220 221 // TapCreateV2 defines message 'tap_create_v2'. 222 type TapCreateV2 struct { 223 ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"` 224 UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"` 225 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` 226 NumRxQueues uint8 `binapi:"u8,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"` 227 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=256" json:"tx_ring_sz,omitempty"` 228 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=256" json:"rx_ring_sz,omitempty"` 229 HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"` 230 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"` 231 HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"` 232 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"` 233 HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"` 234 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"` 235 HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"` 236 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"` 237 HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"` 238 HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"` 239 HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"` 240 HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"` 241 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"` 242 HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"` 243 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"` 244 HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"` 245 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` 246 HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"` 247 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"` 248 Tag string `binapi:"string[],name=tag" json:"tag,omitempty"` 249 } 250 251 func (m *TapCreateV2) Reset() { *m = TapCreateV2{} } 252 func (*TapCreateV2) GetMessageName() string { return "tap_create_v2" } 253 func (*TapCreateV2) GetCrcString() string { return "2d0d6570" } 254 func (*TapCreateV2) GetMessageType() api.MessageType { 255 return api.RequestMessage 256 } 257 258 func (m *TapCreateV2) Size() (size int) { 259 if m == nil { 260 return 0 261 } 262 size += 4 // m.ID 263 size += 1 // m.UseRandomMac 264 size += 1 * 6 // m.MacAddress 265 size += 1 // m.NumRxQueues 266 size += 2 // m.TxRingSz 267 size += 2 // m.RxRingSz 268 size += 1 // m.HostMtuSet 269 size += 4 // m.HostMtuSize 270 size += 1 // m.HostMacAddrSet 271 size += 1 * 6 // m.HostMacAddr 272 size += 1 // m.HostIP4PrefixSet 273 size += 1 * 4 // m.HostIP4Prefix.Address 274 size += 1 // m.HostIP4Prefix.Len 275 size += 1 // m.HostIP6PrefixSet 276 size += 1 * 16 // m.HostIP6Prefix.Address 277 size += 1 // m.HostIP6Prefix.Len 278 size += 1 // m.HostIP4GwSet 279 size += 1 * 4 // m.HostIP4Gw 280 size += 1 // m.HostIP6GwSet 281 size += 1 * 16 // m.HostIP6Gw 282 size += 4 // m.TapFlags 283 size += 1 // m.HostNamespaceSet 284 size += 64 // m.HostNamespace 285 size += 1 // m.HostIfNameSet 286 size += 64 // m.HostIfName 287 size += 1 // m.HostBridgeSet 288 size += 64 // m.HostBridge 289 size += 4 + len(m.Tag) // m.Tag 290 return size 291 } 292 func (m *TapCreateV2) Marshal(b []byte) ([]byte, error) { 293 if b == nil { 294 b = make([]byte, m.Size()) 295 } 296 buf := codec.NewBuffer(b) 297 buf.EncodeUint32(m.ID) 298 buf.EncodeBool(m.UseRandomMac) 299 buf.EncodeBytes(m.MacAddress[:], 6) 300 buf.EncodeUint8(m.NumRxQueues) 301 buf.EncodeUint16(m.TxRingSz) 302 buf.EncodeUint16(m.RxRingSz) 303 buf.EncodeBool(m.HostMtuSet) 304 buf.EncodeUint32(m.HostMtuSize) 305 buf.EncodeBool(m.HostMacAddrSet) 306 buf.EncodeBytes(m.HostMacAddr[:], 6) 307 buf.EncodeBool(m.HostIP4PrefixSet) 308 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4) 309 buf.EncodeUint8(m.HostIP4Prefix.Len) 310 buf.EncodeBool(m.HostIP6PrefixSet) 311 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16) 312 buf.EncodeUint8(m.HostIP6Prefix.Len) 313 buf.EncodeBool(m.HostIP4GwSet) 314 buf.EncodeBytes(m.HostIP4Gw[:], 4) 315 buf.EncodeBool(m.HostIP6GwSet) 316 buf.EncodeBytes(m.HostIP6Gw[:], 16) 317 buf.EncodeUint32(uint32(m.TapFlags)) 318 buf.EncodeBool(m.HostNamespaceSet) 319 buf.EncodeString(m.HostNamespace, 64) 320 buf.EncodeBool(m.HostIfNameSet) 321 buf.EncodeString(m.HostIfName, 64) 322 buf.EncodeBool(m.HostBridgeSet) 323 buf.EncodeString(m.HostBridge, 64) 324 buf.EncodeString(m.Tag, 0) 325 return buf.Bytes(), nil 326 } 327 func (m *TapCreateV2) Unmarshal(b []byte) error { 328 buf := codec.NewBuffer(b) 329 m.ID = buf.DecodeUint32() 330 m.UseRandomMac = buf.DecodeBool() 331 copy(m.MacAddress[:], buf.DecodeBytes(6)) 332 m.NumRxQueues = buf.DecodeUint8() 333 m.TxRingSz = buf.DecodeUint16() 334 m.RxRingSz = buf.DecodeUint16() 335 m.HostMtuSet = buf.DecodeBool() 336 m.HostMtuSize = buf.DecodeUint32() 337 m.HostMacAddrSet = buf.DecodeBool() 338 copy(m.HostMacAddr[:], buf.DecodeBytes(6)) 339 m.HostIP4PrefixSet = buf.DecodeBool() 340 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4)) 341 m.HostIP4Prefix.Len = buf.DecodeUint8() 342 m.HostIP6PrefixSet = buf.DecodeBool() 343 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16)) 344 m.HostIP6Prefix.Len = buf.DecodeUint8() 345 m.HostIP4GwSet = buf.DecodeBool() 346 copy(m.HostIP4Gw[:], buf.DecodeBytes(4)) 347 m.HostIP6GwSet = buf.DecodeBool() 348 copy(m.HostIP6Gw[:], buf.DecodeBytes(16)) 349 m.TapFlags = TapFlags(buf.DecodeUint32()) 350 m.HostNamespaceSet = buf.DecodeBool() 351 m.HostNamespace = buf.DecodeString(64) 352 m.HostIfNameSet = buf.DecodeBool() 353 m.HostIfName = buf.DecodeString(64) 354 m.HostBridgeSet = buf.DecodeBool() 355 m.HostBridge = buf.DecodeString(64) 356 m.Tag = buf.DecodeString(0) 357 return nil 358 } 359 360 // TapCreateV2Reply defines message 'tap_create_v2_reply'. 361 type TapCreateV2Reply struct { 362 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 363 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 364 } 365 366 func (m *TapCreateV2Reply) Reset() { *m = TapCreateV2Reply{} } 367 func (*TapCreateV2Reply) GetMessageName() string { return "tap_create_v2_reply" } 368 func (*TapCreateV2Reply) GetCrcString() string { return "5383d31f" } 369 func (*TapCreateV2Reply) GetMessageType() api.MessageType { 370 return api.ReplyMessage 371 } 372 373 func (m *TapCreateV2Reply) Size() (size int) { 374 if m == nil { 375 return 0 376 } 377 size += 4 // m.Retval 378 size += 4 // m.SwIfIndex 379 return size 380 } 381 func (m *TapCreateV2Reply) Marshal(b []byte) ([]byte, error) { 382 if b == nil { 383 b = make([]byte, m.Size()) 384 } 385 buf := codec.NewBuffer(b) 386 buf.EncodeInt32(m.Retval) 387 buf.EncodeUint32(uint32(m.SwIfIndex)) 388 return buf.Bytes(), nil 389 } 390 func (m *TapCreateV2Reply) Unmarshal(b []byte) error { 391 buf := codec.NewBuffer(b) 392 m.Retval = buf.DecodeInt32() 393 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 394 return nil 395 } 396 397 // TapCreateV3 defines message 'tap_create_v3'. 398 type TapCreateV3 struct { 399 ID uint32 `binapi:"u32,name=id,default=4294967295" json:"id,omitempty"` 400 UseRandomMac bool `binapi:"bool,name=use_random_mac,default=true" json:"use_random_mac,omitempty"` 401 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` 402 NumRxQueues uint16 `binapi:"u16,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"` 403 NumTxQueues uint16 `binapi:"u16,name=num_tx_queues,default=1" json:"num_tx_queues,omitempty"` 404 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz,default=256" json:"tx_ring_sz,omitempty"` 405 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz,default=256" json:"rx_ring_sz,omitempty"` 406 HostMtuSet bool `binapi:"bool,name=host_mtu_set" json:"host_mtu_set,omitempty"` 407 HostMtuSize uint32 `binapi:"u32,name=host_mtu_size" json:"host_mtu_size,omitempty"` 408 HostMacAddrSet bool `binapi:"bool,name=host_mac_addr_set" json:"host_mac_addr_set,omitempty"` 409 HostMacAddr ethernet_types.MacAddress `binapi:"mac_address,name=host_mac_addr" json:"host_mac_addr,omitempty"` 410 HostIP4PrefixSet bool `binapi:"bool,name=host_ip4_prefix_set" json:"host_ip4_prefix_set,omitempty"` 411 HostIP4Prefix ip_types.IP4AddressWithPrefix `binapi:"ip4_address_with_prefix,name=host_ip4_prefix" json:"host_ip4_prefix,omitempty"` 412 HostIP6PrefixSet bool `binapi:"bool,name=host_ip6_prefix_set" json:"host_ip6_prefix_set,omitempty"` 413 HostIP6Prefix ip_types.IP6AddressWithPrefix `binapi:"ip6_address_with_prefix,name=host_ip6_prefix" json:"host_ip6_prefix,omitempty"` 414 HostIP4GwSet bool `binapi:"bool,name=host_ip4_gw_set" json:"host_ip4_gw_set,omitempty"` 415 HostIP4Gw ip_types.IP4Address `binapi:"ip4_address,name=host_ip4_gw" json:"host_ip4_gw,omitempty"` 416 HostIP6GwSet bool `binapi:"bool,name=host_ip6_gw_set" json:"host_ip6_gw_set,omitempty"` 417 HostIP6Gw ip_types.IP6Address `binapi:"ip6_address,name=host_ip6_gw" json:"host_ip6_gw,omitempty"` 418 TapFlags TapFlags `binapi:"tap_flags,name=tap_flags" json:"tap_flags,omitempty"` 419 HostNamespaceSet bool `binapi:"bool,name=host_namespace_set" json:"host_namespace_set,omitempty"` 420 HostNamespace string `binapi:"string[64],name=host_namespace" json:"host_namespace,omitempty"` 421 HostIfNameSet bool `binapi:"bool,name=host_if_name_set" json:"host_if_name_set,omitempty"` 422 HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` 423 HostBridgeSet bool `binapi:"bool,name=host_bridge_set" json:"host_bridge_set,omitempty"` 424 HostBridge string `binapi:"string[64],name=host_bridge" json:"host_bridge,omitempty"` 425 Tag string `binapi:"string[],name=tag" json:"tag,omitempty"` 426 } 427 428 func (m *TapCreateV3) Reset() { *m = TapCreateV3{} } 429 func (*TapCreateV3) GetMessageName() string { return "tap_create_v3" } 430 func (*TapCreateV3) GetCrcString() string { return "3f3fd1df" } 431 func (*TapCreateV3) GetMessageType() api.MessageType { 432 return api.RequestMessage 433 } 434 435 func (m *TapCreateV3) Size() (size int) { 436 if m == nil { 437 return 0 438 } 439 size += 4 // m.ID 440 size += 1 // m.UseRandomMac 441 size += 1 * 6 // m.MacAddress 442 size += 2 // m.NumRxQueues 443 size += 2 // m.NumTxQueues 444 size += 2 // m.TxRingSz 445 size += 2 // m.RxRingSz 446 size += 1 // m.HostMtuSet 447 size += 4 // m.HostMtuSize 448 size += 1 // m.HostMacAddrSet 449 size += 1 * 6 // m.HostMacAddr 450 size += 1 // m.HostIP4PrefixSet 451 size += 1 * 4 // m.HostIP4Prefix.Address 452 size += 1 // m.HostIP4Prefix.Len 453 size += 1 // m.HostIP6PrefixSet 454 size += 1 * 16 // m.HostIP6Prefix.Address 455 size += 1 // m.HostIP6Prefix.Len 456 size += 1 // m.HostIP4GwSet 457 size += 1 * 4 // m.HostIP4Gw 458 size += 1 // m.HostIP6GwSet 459 size += 1 * 16 // m.HostIP6Gw 460 size += 4 // m.TapFlags 461 size += 1 // m.HostNamespaceSet 462 size += 64 // m.HostNamespace 463 size += 1 // m.HostIfNameSet 464 size += 64 // m.HostIfName 465 size += 1 // m.HostBridgeSet 466 size += 64 // m.HostBridge 467 size += 4 + len(m.Tag) // m.Tag 468 return size 469 } 470 func (m *TapCreateV3) Marshal(b []byte) ([]byte, error) { 471 if b == nil { 472 b = make([]byte, m.Size()) 473 } 474 buf := codec.NewBuffer(b) 475 buf.EncodeUint32(m.ID) 476 buf.EncodeBool(m.UseRandomMac) 477 buf.EncodeBytes(m.MacAddress[:], 6) 478 buf.EncodeUint16(m.NumRxQueues) 479 buf.EncodeUint16(m.NumTxQueues) 480 buf.EncodeUint16(m.TxRingSz) 481 buf.EncodeUint16(m.RxRingSz) 482 buf.EncodeBool(m.HostMtuSet) 483 buf.EncodeUint32(m.HostMtuSize) 484 buf.EncodeBool(m.HostMacAddrSet) 485 buf.EncodeBytes(m.HostMacAddr[:], 6) 486 buf.EncodeBool(m.HostIP4PrefixSet) 487 buf.EncodeBytes(m.HostIP4Prefix.Address[:], 4) 488 buf.EncodeUint8(m.HostIP4Prefix.Len) 489 buf.EncodeBool(m.HostIP6PrefixSet) 490 buf.EncodeBytes(m.HostIP6Prefix.Address[:], 16) 491 buf.EncodeUint8(m.HostIP6Prefix.Len) 492 buf.EncodeBool(m.HostIP4GwSet) 493 buf.EncodeBytes(m.HostIP4Gw[:], 4) 494 buf.EncodeBool(m.HostIP6GwSet) 495 buf.EncodeBytes(m.HostIP6Gw[:], 16) 496 buf.EncodeUint32(uint32(m.TapFlags)) 497 buf.EncodeBool(m.HostNamespaceSet) 498 buf.EncodeString(m.HostNamespace, 64) 499 buf.EncodeBool(m.HostIfNameSet) 500 buf.EncodeString(m.HostIfName, 64) 501 buf.EncodeBool(m.HostBridgeSet) 502 buf.EncodeString(m.HostBridge, 64) 503 buf.EncodeString(m.Tag, 0) 504 return buf.Bytes(), nil 505 } 506 func (m *TapCreateV3) Unmarshal(b []byte) error { 507 buf := codec.NewBuffer(b) 508 m.ID = buf.DecodeUint32() 509 m.UseRandomMac = buf.DecodeBool() 510 copy(m.MacAddress[:], buf.DecodeBytes(6)) 511 m.NumRxQueues = buf.DecodeUint16() 512 m.NumTxQueues = buf.DecodeUint16() 513 m.TxRingSz = buf.DecodeUint16() 514 m.RxRingSz = buf.DecodeUint16() 515 m.HostMtuSet = buf.DecodeBool() 516 m.HostMtuSize = buf.DecodeUint32() 517 m.HostMacAddrSet = buf.DecodeBool() 518 copy(m.HostMacAddr[:], buf.DecodeBytes(6)) 519 m.HostIP4PrefixSet = buf.DecodeBool() 520 copy(m.HostIP4Prefix.Address[:], buf.DecodeBytes(4)) 521 m.HostIP4Prefix.Len = buf.DecodeUint8() 522 m.HostIP6PrefixSet = buf.DecodeBool() 523 copy(m.HostIP6Prefix.Address[:], buf.DecodeBytes(16)) 524 m.HostIP6Prefix.Len = buf.DecodeUint8() 525 m.HostIP4GwSet = buf.DecodeBool() 526 copy(m.HostIP4Gw[:], buf.DecodeBytes(4)) 527 m.HostIP6GwSet = buf.DecodeBool() 528 copy(m.HostIP6Gw[:], buf.DecodeBytes(16)) 529 m.TapFlags = TapFlags(buf.DecodeUint32()) 530 m.HostNamespaceSet = buf.DecodeBool() 531 m.HostNamespace = buf.DecodeString(64) 532 m.HostIfNameSet = buf.DecodeBool() 533 m.HostIfName = buf.DecodeString(64) 534 m.HostBridgeSet = buf.DecodeBool() 535 m.HostBridge = buf.DecodeString(64) 536 m.Tag = buf.DecodeString(0) 537 return nil 538 } 539 540 // TapCreateV3Reply defines message 'tap_create_v3_reply'. 541 type TapCreateV3Reply struct { 542 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 543 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 544 } 545 546 func (m *TapCreateV3Reply) Reset() { *m = TapCreateV3Reply{} } 547 func (*TapCreateV3Reply) GetMessageName() string { return "tap_create_v3_reply" } 548 func (*TapCreateV3Reply) GetCrcString() string { return "5383d31f" } 549 func (*TapCreateV3Reply) GetMessageType() api.MessageType { 550 return api.ReplyMessage 551 } 552 553 func (m *TapCreateV3Reply) Size() (size int) { 554 if m == nil { 555 return 0 556 } 557 size += 4 // m.Retval 558 size += 4 // m.SwIfIndex 559 return size 560 } 561 func (m *TapCreateV3Reply) Marshal(b []byte) ([]byte, error) { 562 if b == nil { 563 b = make([]byte, m.Size()) 564 } 565 buf := codec.NewBuffer(b) 566 buf.EncodeInt32(m.Retval) 567 buf.EncodeUint32(uint32(m.SwIfIndex)) 568 return buf.Bytes(), nil 569 } 570 func (m *TapCreateV3Reply) Unmarshal(b []byte) error { 571 buf := codec.NewBuffer(b) 572 m.Retval = buf.DecodeInt32() 573 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 574 return nil 575 } 576 577 // TapDeleteV2 defines message 'tap_delete_v2'. 578 type TapDeleteV2 struct { 579 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 580 } 581 582 func (m *TapDeleteV2) Reset() { *m = TapDeleteV2{} } 583 func (*TapDeleteV2) GetMessageName() string { return "tap_delete_v2" } 584 func (*TapDeleteV2) GetCrcString() string { return "f9e6675e" } 585 func (*TapDeleteV2) GetMessageType() api.MessageType { 586 return api.RequestMessage 587 } 588 589 func (m *TapDeleteV2) Size() (size int) { 590 if m == nil { 591 return 0 592 } 593 size += 4 // m.SwIfIndex 594 return size 595 } 596 func (m *TapDeleteV2) Marshal(b []byte) ([]byte, error) { 597 if b == nil { 598 b = make([]byte, m.Size()) 599 } 600 buf := codec.NewBuffer(b) 601 buf.EncodeUint32(uint32(m.SwIfIndex)) 602 return buf.Bytes(), nil 603 } 604 func (m *TapDeleteV2) Unmarshal(b []byte) error { 605 buf := codec.NewBuffer(b) 606 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 607 return nil 608 } 609 610 // TapDeleteV2Reply defines message 'tap_delete_v2_reply'. 611 type TapDeleteV2Reply struct { 612 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 613 } 614 615 func (m *TapDeleteV2Reply) Reset() { *m = TapDeleteV2Reply{} } 616 func (*TapDeleteV2Reply) GetMessageName() string { return "tap_delete_v2_reply" } 617 func (*TapDeleteV2Reply) GetCrcString() string { return "e8d4e804" } 618 func (*TapDeleteV2Reply) GetMessageType() api.MessageType { 619 return api.ReplyMessage 620 } 621 622 func (m *TapDeleteV2Reply) Size() (size int) { 623 if m == nil { 624 return 0 625 } 626 size += 4 // m.Retval 627 return size 628 } 629 func (m *TapDeleteV2Reply) Marshal(b []byte) ([]byte, error) { 630 if b == nil { 631 b = make([]byte, m.Size()) 632 } 633 buf := codec.NewBuffer(b) 634 buf.EncodeInt32(m.Retval) 635 return buf.Bytes(), nil 636 } 637 func (m *TapDeleteV2Reply) Unmarshal(b []byte) error { 638 buf := codec.NewBuffer(b) 639 m.Retval = buf.DecodeInt32() 640 return nil 641 } 642 643 func init() { file_tapv2_binapi_init() } 644 func file_tapv2_binapi_init() { 645 api.RegisterMessage((*SwInterfaceTapV2Details)(nil), "sw_interface_tap_v2_details_1e2b2a47") 646 api.RegisterMessage((*SwInterfaceTapV2Dump)(nil), "sw_interface_tap_v2_dump_f9e6675e") 647 api.RegisterMessage((*TapCreateV2)(nil), "tap_create_v2_2d0d6570") 648 api.RegisterMessage((*TapCreateV2Reply)(nil), "tap_create_v2_reply_5383d31f") 649 api.RegisterMessage((*TapCreateV3)(nil), "tap_create_v3_3f3fd1df") 650 api.RegisterMessage((*TapCreateV3Reply)(nil), "tap_create_v3_reply_5383d31f") 651 api.RegisterMessage((*TapDeleteV2)(nil), "tap_delete_v2_f9e6675e") 652 api.RegisterMessage((*TapDeleteV2Reply)(nil), "tap_delete_v2_reply_e8d4e804") 653 } 654 655 // Messages returns list of all messages in this module. 656 func AllMessages() []api.Message { 657 return []api.Message{ 658 (*SwInterfaceTapV2Details)(nil), 659 (*SwInterfaceTapV2Dump)(nil), 660 (*TapCreateV2)(nil), 661 (*TapCreateV2Reply)(nil), 662 (*TapCreateV3)(nil), 663 (*TapCreateV3Reply)(nil), 664 (*TapDeleteV2)(nil), 665 (*TapDeleteV2Reply)(nil), 666 } 667 }