github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/mactime/mactime.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/mactime.api.json 6 7 // Package mactime contains generated bindings for API file mactime.api. 8 // 9 // Contents: 10 // - 2 structs 11 // - 7 messages 12 package mactime 13 14 import ( 15 ethernet_types "github.com/networkservicemesh/govpp/binapi/ethernet_types" 16 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 17 api "go.fd.io/govpp/api" 18 codec "go.fd.io/govpp/codec" 19 ) 20 21 // This is a compile-time assertion to ensure that this generated file 22 // is compatible with the GoVPP api package it is being compiled against. 23 // A compilation error at this line likely means your copy of the 24 // GoVPP api package needs to be updated. 25 const _ = api.GoVppAPIPackageIsVersion2 26 27 const ( 28 APIFile = "mactime" 29 APIVersion = "2.0.0" 30 VersionCrc = 0xc72e296e 31 ) 32 33 // MactimeTimeRange defines type 'mactime_time_range'. 34 type MactimeTimeRange struct { 35 Start float64 `binapi:"f64,name=start" json:"start,omitempty"` 36 End float64 `binapi:"f64,name=end" json:"end,omitempty"` 37 } 38 39 // TimeRange defines type 'time_range'. 40 type TimeRange struct { 41 Start float64 `binapi:"f64,name=start" json:"start,omitempty"` 42 End float64 `binapi:"f64,name=end" json:"end,omitempty"` 43 } 44 45 // @brief configure per src-mac time ranges 46 // 47 // * 48 // * Usage: 49 // * to create a static allow entry: 50 // * set mac_address, device_name, is_add=1, and allow=1. 51 // * 52 // * to create a static drop entry: 53 // * set mac_address, device_name, is_add=1, and drop=1. 54 // * 55 // * to create a (time-range-based) dynamic allow entry: 56 // * set mac_address, device_name, is_add=1, set allow=1. 57 // * set count = number of ranges 58 // * set each range start/end in seconds since Sunday began 59 // * As in: start/end >= 0.0 && start/end < 7.0 *86400.0 60 // * 61 // * to create a (time-range-based) dynamic allow entry with quota: 62 // * Outside of stated time ranges, such entries revert to allow with no quota. 63 // * previous setup, s/allow=1/allow_quota=1/ 64 // * 65 // * to create a (time-range-based) dynamic drop entry: 66 // * Same procedure to create a dynamic allow entry, 67 // * set drop=1 instead of allow=1 68 // * 69 // * to delete a per src-mac entry (of any kind) 70 // * set mac_address, is_add=0 71 // * note: deletes all ranges. 72 // * 73 // * See mactime_test.c:api_mactime_add_del_range(...) for 74 // * a working example. 75 // 76 // MactimeAddDelRange defines message 'mactime_add_del_range'. 77 type MactimeAddDelRange struct { 78 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` 79 Drop bool `binapi:"bool,name=drop" json:"drop,omitempty"` 80 Allow bool `binapi:"bool,name=allow" json:"allow,omitempty"` 81 AllowQuota uint8 `binapi:"u8,name=allow_quota" json:"allow_quota,omitempty"` 82 NoUDP10001 bool `binapi:"bool,name=no_udp_10001" json:"no_udp_10001,omitempty"` 83 DataQuota uint64 `binapi:"u64,name=data_quota" json:"data_quota,omitempty"` 84 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` 85 DeviceName string `binapi:"string[64],name=device_name" json:"device_name,omitempty"` 86 Count uint32 `binapi:"u32,name=count" json:"-"` 87 Ranges []TimeRange `binapi:"time_range[count],name=ranges" json:"ranges,omitempty"` 88 } 89 90 func (m *MactimeAddDelRange) Reset() { *m = MactimeAddDelRange{} } 91 func (*MactimeAddDelRange) GetMessageName() string { return "mactime_add_del_range" } 92 func (*MactimeAddDelRange) GetCrcString() string { return "cb56e877" } 93 func (*MactimeAddDelRange) GetMessageType() api.MessageType { 94 return api.RequestMessage 95 } 96 97 func (m *MactimeAddDelRange) Size() (size int) { 98 if m == nil { 99 return 0 100 } 101 size += 1 // m.IsAdd 102 size += 1 // m.Drop 103 size += 1 // m.Allow 104 size += 1 // m.AllowQuota 105 size += 1 // m.NoUDP10001 106 size += 8 // m.DataQuota 107 size += 1 * 6 // m.MacAddress 108 size += 64 // m.DeviceName 109 size += 4 // m.Count 110 for j1 := 0; j1 < len(m.Ranges); j1++ { 111 var s1 TimeRange 112 _ = s1 113 if j1 < len(m.Ranges) { 114 s1 = m.Ranges[j1] 115 } 116 size += 8 // s1.Start 117 size += 8 // s1.End 118 } 119 return size 120 } 121 func (m *MactimeAddDelRange) Marshal(b []byte) ([]byte, error) { 122 if b == nil { 123 b = make([]byte, m.Size()) 124 } 125 buf := codec.NewBuffer(b) 126 buf.EncodeBool(m.IsAdd) 127 buf.EncodeBool(m.Drop) 128 buf.EncodeBool(m.Allow) 129 buf.EncodeUint8(m.AllowQuota) 130 buf.EncodeBool(m.NoUDP10001) 131 buf.EncodeUint64(m.DataQuota) 132 buf.EncodeBytes(m.MacAddress[:], 6) 133 buf.EncodeString(m.DeviceName, 64) 134 buf.EncodeUint32(uint32(len(m.Ranges))) 135 for j0 := 0; j0 < len(m.Ranges); j0++ { 136 var v0 TimeRange // Ranges 137 if j0 < len(m.Ranges) { 138 v0 = m.Ranges[j0] 139 } 140 buf.EncodeFloat64(v0.Start) 141 buf.EncodeFloat64(v0.End) 142 } 143 return buf.Bytes(), nil 144 } 145 func (m *MactimeAddDelRange) Unmarshal(b []byte) error { 146 buf := codec.NewBuffer(b) 147 m.IsAdd = buf.DecodeBool() 148 m.Drop = buf.DecodeBool() 149 m.Allow = buf.DecodeBool() 150 m.AllowQuota = buf.DecodeUint8() 151 m.NoUDP10001 = buf.DecodeBool() 152 m.DataQuota = buf.DecodeUint64() 153 copy(m.MacAddress[:], buf.DecodeBytes(6)) 154 m.DeviceName = buf.DecodeString(64) 155 m.Count = buf.DecodeUint32() 156 m.Ranges = make([]TimeRange, m.Count) 157 for j0 := 0; j0 < len(m.Ranges); j0++ { 158 m.Ranges[j0].Start = buf.DecodeFloat64() 159 m.Ranges[j0].End = buf.DecodeFloat64() 160 } 161 return nil 162 } 163 164 // MactimeAddDelRangeReply defines message 'mactime_add_del_range_reply'. 165 type MactimeAddDelRangeReply struct { 166 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 167 } 168 169 func (m *MactimeAddDelRangeReply) Reset() { *m = MactimeAddDelRangeReply{} } 170 func (*MactimeAddDelRangeReply) GetMessageName() string { return "mactime_add_del_range_reply" } 171 func (*MactimeAddDelRangeReply) GetCrcString() string { return "e8d4e804" } 172 func (*MactimeAddDelRangeReply) GetMessageType() api.MessageType { 173 return api.ReplyMessage 174 } 175 176 func (m *MactimeAddDelRangeReply) Size() (size int) { 177 if m == nil { 178 return 0 179 } 180 size += 4 // m.Retval 181 return size 182 } 183 func (m *MactimeAddDelRangeReply) Marshal(b []byte) ([]byte, error) { 184 if b == nil { 185 b = make([]byte, m.Size()) 186 } 187 buf := codec.NewBuffer(b) 188 buf.EncodeInt32(m.Retval) 189 return buf.Bytes(), nil 190 } 191 func (m *MactimeAddDelRangeReply) Unmarshal(b []byte) error { 192 buf := codec.NewBuffer(b) 193 m.Retval = buf.DecodeInt32() 194 return nil 195 } 196 197 // @brief mactime table entry details 198 // MactimeDetails defines message 'mactime_details'. 199 type MactimeDetails struct { 200 PoolIndex uint32 `binapi:"u32,name=pool_index" json:"pool_index,omitempty"` 201 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` 202 DataQuota uint64 `binapi:"u64,name=data_quota" json:"data_quota,omitempty"` 203 DataUsedInRange uint64 `binapi:"u64,name=data_used_in_range" json:"data_used_in_range,omitempty"` 204 Flags uint32 `binapi:"u32,name=flags" json:"flags,omitempty"` 205 DeviceName string `binapi:"string[64],name=device_name" json:"device_name,omitempty"` 206 Nranges uint32 `binapi:"u32,name=nranges" json:"-"` 207 Ranges []MactimeTimeRange `binapi:"mactime_time_range[nranges],name=ranges" json:"ranges,omitempty"` 208 } 209 210 func (m *MactimeDetails) Reset() { *m = MactimeDetails{} } 211 func (*MactimeDetails) GetMessageName() string { return "mactime_details" } 212 func (*MactimeDetails) GetCrcString() string { return "da25b13a" } 213 func (*MactimeDetails) GetMessageType() api.MessageType { 214 return api.ReplyMessage 215 } 216 217 func (m *MactimeDetails) Size() (size int) { 218 if m == nil { 219 return 0 220 } 221 size += 4 // m.PoolIndex 222 size += 1 * 6 // m.MacAddress 223 size += 8 // m.DataQuota 224 size += 8 // m.DataUsedInRange 225 size += 4 // m.Flags 226 size += 64 // m.DeviceName 227 size += 4 // m.Nranges 228 for j1 := 0; j1 < len(m.Ranges); j1++ { 229 var s1 MactimeTimeRange 230 _ = s1 231 if j1 < len(m.Ranges) { 232 s1 = m.Ranges[j1] 233 } 234 size += 8 // s1.Start 235 size += 8 // s1.End 236 } 237 return size 238 } 239 func (m *MactimeDetails) Marshal(b []byte) ([]byte, error) { 240 if b == nil { 241 b = make([]byte, m.Size()) 242 } 243 buf := codec.NewBuffer(b) 244 buf.EncodeUint32(m.PoolIndex) 245 buf.EncodeBytes(m.MacAddress[:], 6) 246 buf.EncodeUint64(m.DataQuota) 247 buf.EncodeUint64(m.DataUsedInRange) 248 buf.EncodeUint32(m.Flags) 249 buf.EncodeString(m.DeviceName, 64) 250 buf.EncodeUint32(uint32(len(m.Ranges))) 251 for j0 := 0; j0 < len(m.Ranges); j0++ { 252 var v0 MactimeTimeRange // Ranges 253 if j0 < len(m.Ranges) { 254 v0 = m.Ranges[j0] 255 } 256 buf.EncodeFloat64(v0.Start) 257 buf.EncodeFloat64(v0.End) 258 } 259 return buf.Bytes(), nil 260 } 261 func (m *MactimeDetails) Unmarshal(b []byte) error { 262 buf := codec.NewBuffer(b) 263 m.PoolIndex = buf.DecodeUint32() 264 copy(m.MacAddress[:], buf.DecodeBytes(6)) 265 m.DataQuota = buf.DecodeUint64() 266 m.DataUsedInRange = buf.DecodeUint64() 267 m.Flags = buf.DecodeUint32() 268 m.DeviceName = buf.DecodeString(64) 269 m.Nranges = buf.DecodeUint32() 270 m.Ranges = make([]MactimeTimeRange, m.Nranges) 271 for j0 := 0; j0 < len(m.Ranges); j0++ { 272 m.Ranges[j0].Start = buf.DecodeFloat64() 273 m.Ranges[j0].End = buf.DecodeFloat64() 274 } 275 return nil 276 } 277 278 // @brief dump mactime table 279 // 280 // * 281 // * Request a mactime client pool dump 282 // * Sequence: 283 // * client send vl_api_mactime_dump to vpp 284 // * vpp replies with zero or more vl_api_mactime_entry_t's 285 // * vpp replies with a vl_api_mactime_dump_reply_t 286 // * - my_table_epoch dump table only if update needed, 0 => full dump 287 // 288 // MactimeDump defines message 'mactime_dump'. 289 type MactimeDump struct { 290 MyTableEpoch uint32 `binapi:"u32,name=my_table_epoch" json:"my_table_epoch,omitempty"` 291 } 292 293 func (m *MactimeDump) Reset() { *m = MactimeDump{} } 294 func (*MactimeDump) GetMessageName() string { return "mactime_dump" } 295 func (*MactimeDump) GetCrcString() string { return "8f454e23" } 296 func (*MactimeDump) GetMessageType() api.MessageType { 297 return api.RequestMessage 298 } 299 300 func (m *MactimeDump) Size() (size int) { 301 if m == nil { 302 return 0 303 } 304 size += 4 // m.MyTableEpoch 305 return size 306 } 307 func (m *MactimeDump) Marshal(b []byte) ([]byte, error) { 308 if b == nil { 309 b = make([]byte, m.Size()) 310 } 311 buf := codec.NewBuffer(b) 312 buf.EncodeUint32(m.MyTableEpoch) 313 return buf.Bytes(), nil 314 } 315 func (m *MactimeDump) Unmarshal(b []byte) error { 316 buf := codec.NewBuffer(b) 317 m.MyTableEpoch = buf.DecodeUint32() 318 return nil 319 } 320 321 // @brief dump mactime table reply 322 // - Includes the vpp table epoch, needed to optimize API traffic 323 // 324 // MactimeDumpReply defines message 'mactime_dump_reply'. 325 type MactimeDumpReply struct { 326 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 327 TableEpoch uint32 `binapi:"u32,name=table_epoch" json:"table_epoch,omitempty"` 328 } 329 330 func (m *MactimeDumpReply) Reset() { *m = MactimeDumpReply{} } 331 func (*MactimeDumpReply) GetMessageName() string { return "mactime_dump_reply" } 332 func (*MactimeDumpReply) GetCrcString() string { return "49bcc753" } 333 func (*MactimeDumpReply) GetMessageType() api.MessageType { 334 return api.ReplyMessage 335 } 336 337 func (m *MactimeDumpReply) Size() (size int) { 338 if m == nil { 339 return 0 340 } 341 size += 4 // m.Retval 342 size += 4 // m.TableEpoch 343 return size 344 } 345 func (m *MactimeDumpReply) Marshal(b []byte) ([]byte, error) { 346 if b == nil { 347 b = make([]byte, m.Size()) 348 } 349 buf := codec.NewBuffer(b) 350 buf.EncodeInt32(m.Retval) 351 buf.EncodeUint32(m.TableEpoch) 352 return buf.Bytes(), nil 353 } 354 func (m *MactimeDumpReply) Unmarshal(b []byte) error { 355 buf := codec.NewBuffer(b) 356 m.Retval = buf.DecodeInt32() 357 m.TableEpoch = buf.DecodeUint32() 358 return nil 359 } 360 361 // @brief api to enable or disable the time-based src mac filter on 362 // 363 // an interface 364 // 365 // MactimeEnableDisable defines message 'mactime_enable_disable'. 366 type MactimeEnableDisable struct { 367 EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"` 368 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 369 } 370 371 func (m *MactimeEnableDisable) Reset() { *m = MactimeEnableDisable{} } 372 func (*MactimeEnableDisable) GetMessageName() string { return "mactime_enable_disable" } 373 func (*MactimeEnableDisable) GetCrcString() string { return "3865946c" } 374 func (*MactimeEnableDisable) GetMessageType() api.MessageType { 375 return api.RequestMessage 376 } 377 378 func (m *MactimeEnableDisable) Size() (size int) { 379 if m == nil { 380 return 0 381 } 382 size += 1 // m.EnableDisable 383 size += 4 // m.SwIfIndex 384 return size 385 } 386 func (m *MactimeEnableDisable) Marshal(b []byte) ([]byte, error) { 387 if b == nil { 388 b = make([]byte, m.Size()) 389 } 390 buf := codec.NewBuffer(b) 391 buf.EncodeBool(m.EnableDisable) 392 buf.EncodeUint32(uint32(m.SwIfIndex)) 393 return buf.Bytes(), nil 394 } 395 func (m *MactimeEnableDisable) Unmarshal(b []byte) error { 396 buf := codec.NewBuffer(b) 397 m.EnableDisable = buf.DecodeBool() 398 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 399 return nil 400 } 401 402 // MactimeEnableDisableReply defines message 'mactime_enable_disable_reply'. 403 type MactimeEnableDisableReply struct { 404 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 405 } 406 407 func (m *MactimeEnableDisableReply) Reset() { *m = MactimeEnableDisableReply{} } 408 func (*MactimeEnableDisableReply) GetMessageName() string { return "mactime_enable_disable_reply" } 409 func (*MactimeEnableDisableReply) GetCrcString() string { return "e8d4e804" } 410 func (*MactimeEnableDisableReply) GetMessageType() api.MessageType { 411 return api.ReplyMessage 412 } 413 414 func (m *MactimeEnableDisableReply) Size() (size int) { 415 if m == nil { 416 return 0 417 } 418 size += 4 // m.Retval 419 return size 420 } 421 func (m *MactimeEnableDisableReply) Marshal(b []byte) ([]byte, error) { 422 if b == nil { 423 b = make([]byte, m.Size()) 424 } 425 buf := codec.NewBuffer(b) 426 buf.EncodeInt32(m.Retval) 427 return buf.Bytes(), nil 428 } 429 func (m *MactimeEnableDisableReply) Unmarshal(b []byte) error { 430 buf := codec.NewBuffer(b) 431 m.Retval = buf.DecodeInt32() 432 return nil 433 } 434 435 func init() { file_mactime_binapi_init() } 436 func file_mactime_binapi_init() { 437 api.RegisterMessage((*MactimeAddDelRange)(nil), "mactime_add_del_range_cb56e877") 438 api.RegisterMessage((*MactimeAddDelRangeReply)(nil), "mactime_add_del_range_reply_e8d4e804") 439 api.RegisterMessage((*MactimeDetails)(nil), "mactime_details_da25b13a") 440 api.RegisterMessage((*MactimeDump)(nil), "mactime_dump_8f454e23") 441 api.RegisterMessage((*MactimeDumpReply)(nil), "mactime_dump_reply_49bcc753") 442 api.RegisterMessage((*MactimeEnableDisable)(nil), "mactime_enable_disable_3865946c") 443 api.RegisterMessage((*MactimeEnableDisableReply)(nil), "mactime_enable_disable_reply_e8d4e804") 444 } 445 446 // Messages returns list of all messages in this module. 447 func AllMessages() []api.Message { 448 return []api.Message{ 449 (*MactimeAddDelRange)(nil), 450 (*MactimeAddDelRangeReply)(nil), 451 (*MactimeDetails)(nil), 452 (*MactimeDump)(nil), 453 (*MactimeDumpReply)(nil), 454 (*MactimeEnableDisable)(nil), 455 (*MactimeEnableDisableReply)(nil), 456 } 457 }