1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
5 // source: /usr/share/vpp/api/plugins/mactime.api.json
8 Package mactime contains generated code for VPP API file mactime.api (2.0.0).
26 api "git.fd.io/govpp.git/api"
27 codec "git.fd.io/govpp.git/codec"
28 struc "github.com/lunixbochs/struc"
30 interface_types "git.fd.io/govpp.git/examples/binapi/interface_types"
33 // This is a compile-time assertion to ensure that this generated file
34 // is compatible with the GoVPP api package it is being compiled against.
35 // A compilation error at this line likely means your copy of the
36 // GoVPP api package needs to be updated.
37 const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package
40 // ModuleName is the name of this module.
41 ModuleName = "mactime"
42 // APIVersion is the API version of this module.
44 // VersionCrc is the CRC of this module.
45 VersionCrc = 0x9283d3e
48 type IfStatusFlags = interface_types.IfStatusFlags
50 type IfType = interface_types.IfType
52 type LinkDuplex = interface_types.LinkDuplex
54 type MtuProto = interface_types.MtuProto
56 type RxMode = interface_types.RxMode
58 type SubIfFlags = interface_types.SubIfFlags
60 type InterfaceIndex = interface_types.InterfaceIndex
62 // MacAddress represents VPP binary API alias 'mac_address'.
63 type MacAddress [6]uint8
65 // MactimeTimeRange represents VPP binary API type 'mactime_time_range'.
66 type MactimeTimeRange struct {
67 Start float64 `binapi:"f64,name=start" json:"start,omitempty"`
68 End float64 `binapi:"f64,name=end" json:"end,omitempty"`
71 func (*MactimeTimeRange) GetTypeName() string { return "mactime_time_range" }
73 // TimeRange represents VPP binary API type 'time_range'.
74 type TimeRange struct {
75 Start float64 `binapi:"f64,name=start" json:"start,omitempty"`
76 End float64 `binapi:"f64,name=end" json:"end,omitempty"`
79 func (*TimeRange) GetTypeName() string { return "time_range" }
81 // MactimeAddDelRange represents VPP binary API message 'mactime_add_del_range'.
82 type MactimeAddDelRange struct {
83 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
84 Drop bool `binapi:"bool,name=drop" json:"drop,omitempty"`
85 Allow bool `binapi:"bool,name=allow" json:"allow,omitempty"`
86 AllowQuota uint8 `binapi:"u8,name=allow_quota" json:"allow_quota,omitempty"`
87 NoUDP10001 bool `binapi:"bool,name=no_udp_10001" json:"no_udp_10001,omitempty"`
88 DataQuota uint64 `binapi:"u64,name=data_quota" json:"data_quota,omitempty"`
89 MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
90 DeviceName string `binapi:"string[64],name=device_name" json:"device_name,omitempty" struc:"[64]byte"`
91 Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=Ranges"`
92 Ranges []TimeRange `binapi:"time_range[count],name=ranges" json:"ranges,omitempty"`
95 func (m *MactimeAddDelRange) Reset() { *m = MactimeAddDelRange{} }
96 func (*MactimeAddDelRange) GetMessageName() string { return "mactime_add_del_range" }
97 func (*MactimeAddDelRange) GetCrcString() string { return "101858ef" }
98 func (*MactimeAddDelRange) GetMessageType() api.MessageType { return api.RequestMessage }
100 func (m *MactimeAddDelRange) Size() int {
111 // field[1] m.AllowQuota
113 // field[1] m.NoUDP10001
115 // field[1] m.DataQuota
117 // field[1] m.MacAddress
119 // field[1] m.DeviceName
124 for j1 := 0; j1 < len(m.Ranges); j1++ {
127 if j1 < len(m.Ranges) {
137 func (m *MactimeAddDelRange) Marshal(b []byte) ([]byte, error) {
138 o := binary.BigEndian
144 buf = make([]byte, m.Size())
163 // field[1] m.AllowQuota
164 buf[pos] = uint8(m.AllowQuota)
166 // field[1] m.NoUDP10001
171 // field[1] m.DataQuota
172 o.PutUint64(buf[pos:pos+8], uint64(m.DataQuota))
174 // field[1] m.MacAddress
175 for i := 0; i < 6; i++ {
177 if i < len(m.MacAddress) {
178 x = uint8(m.MacAddress[i])
183 // field[1] m.DeviceName
184 copy(buf[pos:pos+64], m.DeviceName)
187 o.PutUint32(buf[pos:pos+4], uint32(len(m.Ranges)))
190 for j1 := 0; j1 < len(m.Ranges); j1++ {
192 if j1 < len(m.Ranges) {
196 o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.Start)))
199 o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.End)))
204 func (m *MactimeAddDelRange) Unmarshal(tmp []byte) error {
205 o := binary.BigEndian
210 m.IsAdd = tmp[pos] != 0
213 m.Drop = tmp[pos] != 0
216 m.Allow = tmp[pos] != 0
218 // field[1] m.AllowQuota
219 m.AllowQuota = uint8(tmp[pos])
221 // field[1] m.NoUDP10001
222 m.NoUDP10001 = tmp[pos] != 0
224 // field[1] m.DataQuota
225 m.DataQuota = uint64(o.Uint64(tmp[pos : pos+8]))
227 // field[1] m.MacAddress
228 for i := 0; i < len(m.MacAddress); i++ {
229 m.MacAddress[i] = uint8(tmp[pos])
232 // field[1] m.DeviceName
234 nul := bytes.Index(tmp[pos:pos+64], []byte{0x00})
235 m.DeviceName = codec.DecodeString(tmp[pos : pos+nul])
239 m.Count = uint32(o.Uint32(tmp[pos : pos+4]))
242 m.Ranges = make([]TimeRange, int(m.Count))
243 for j1 := 0; j1 < int(m.Count); j1++ {
244 // field[2] m.Ranges[j1].Start
245 m.Ranges[j1].Start = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8])))
247 // field[2] m.Ranges[j1].End
248 m.Ranges[j1].End = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8])))
254 // MactimeAddDelRangeReply represents VPP binary API message 'mactime_add_del_range_reply'.
255 type MactimeAddDelRangeReply struct {
256 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
259 func (m *MactimeAddDelRangeReply) Reset() { *m = MactimeAddDelRangeReply{} }
260 func (*MactimeAddDelRangeReply) GetMessageName() string { return "mactime_add_del_range_reply" }
261 func (*MactimeAddDelRangeReply) GetCrcString() string { return "e8d4e804" }
262 func (*MactimeAddDelRangeReply) GetMessageType() api.MessageType { return api.ReplyMessage }
264 func (m *MactimeAddDelRangeReply) Size() int {
273 func (m *MactimeAddDelRangeReply) Marshal(b []byte) ([]byte, error) {
274 o := binary.BigEndian
280 buf = make([]byte, m.Size())
285 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
289 func (m *MactimeAddDelRangeReply) Unmarshal(tmp []byte) error {
290 o := binary.BigEndian
295 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
300 // MactimeDetails represents VPP binary API message 'mactime_details'.
301 type MactimeDetails struct {
302 PoolIndex uint32 `binapi:"u32,name=pool_index" json:"pool_index,omitempty"`
303 MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
304 DataQuota uint64 `binapi:"u64,name=data_quota" json:"data_quota,omitempty"`
305 DataUsedInRange uint64 `binapi:"u64,name=data_used_in_range" json:"data_used_in_range,omitempty"`
306 Flags uint32 `binapi:"u32,name=flags" json:"flags,omitempty"`
307 DeviceName string `binapi:"string[64],name=device_name" json:"device_name,omitempty" struc:"[64]byte"`
308 Nranges uint32 `binapi:"u32,name=nranges" json:"nranges,omitempty" struc:"sizeof=Ranges"`
309 Ranges []MactimeTimeRange `binapi:"mactime_time_range[nranges],name=ranges" json:"ranges,omitempty"`
312 func (m *MactimeDetails) Reset() { *m = MactimeDetails{} }
313 func (*MactimeDetails) GetMessageName() string { return "mactime_details" }
314 func (*MactimeDetails) GetCrcString() string { return "44921c06" }
315 func (*MactimeDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
317 func (m *MactimeDetails) Size() int {
322 // field[1] m.PoolIndex
324 // field[1] m.MacAddress
326 // field[1] m.DataQuota
328 // field[1] m.DataUsedInRange
332 // field[1] m.DeviceName
334 // field[1] m.Nranges
337 for j1 := 0; j1 < len(m.Ranges); j1++ {
338 var s1 MactimeTimeRange
340 if j1 < len(m.Ranges) {
350 func (m *MactimeDetails) Marshal(b []byte) ([]byte, error) {
351 o := binary.BigEndian
357 buf = make([]byte, m.Size())
361 // field[1] m.PoolIndex
362 o.PutUint32(buf[pos:pos+4], uint32(m.PoolIndex))
364 // field[1] m.MacAddress
365 for i := 0; i < 6; i++ {
367 if i < len(m.MacAddress) {
368 x = uint8(m.MacAddress[i])
373 // field[1] m.DataQuota
374 o.PutUint64(buf[pos:pos+8], uint64(m.DataQuota))
376 // field[1] m.DataUsedInRange
377 o.PutUint64(buf[pos:pos+8], uint64(m.DataUsedInRange))
380 o.PutUint32(buf[pos:pos+4], uint32(m.Flags))
382 // field[1] m.DeviceName
383 copy(buf[pos:pos+64], m.DeviceName)
385 // field[1] m.Nranges
386 o.PutUint32(buf[pos:pos+4], uint32(len(m.Ranges)))
389 for j1 := 0; j1 < len(m.Ranges); j1++ {
390 var v1 MactimeTimeRange
391 if j1 < len(m.Ranges) {
395 o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.Start)))
398 o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.End)))
403 func (m *MactimeDetails) Unmarshal(tmp []byte) error {
404 o := binary.BigEndian
408 // field[1] m.PoolIndex
409 m.PoolIndex = uint32(o.Uint32(tmp[pos : pos+4]))
411 // field[1] m.MacAddress
412 for i := 0; i < len(m.MacAddress); i++ {
413 m.MacAddress[i] = uint8(tmp[pos])
416 // field[1] m.DataQuota
417 m.DataQuota = uint64(o.Uint64(tmp[pos : pos+8]))
419 // field[1] m.DataUsedInRange
420 m.DataUsedInRange = uint64(o.Uint64(tmp[pos : pos+8]))
423 m.Flags = uint32(o.Uint32(tmp[pos : pos+4]))
425 // field[1] m.DeviceName
427 nul := bytes.Index(tmp[pos:pos+64], []byte{0x00})
428 m.DeviceName = codec.DecodeString(tmp[pos : pos+nul])
431 // field[1] m.Nranges
432 m.Nranges = uint32(o.Uint32(tmp[pos : pos+4]))
435 m.Ranges = make([]MactimeTimeRange, int(m.Nranges))
436 for j1 := 0; j1 < int(m.Nranges); j1++ {
437 // field[2] m.Ranges[j1].Start
438 m.Ranges[j1].Start = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8])))
440 // field[2] m.Ranges[j1].End
441 m.Ranges[j1].End = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8])))
447 // MactimeDump represents VPP binary API message 'mactime_dump'.
448 type MactimeDump struct {
449 MyTableEpoch uint32 `binapi:"u32,name=my_table_epoch" json:"my_table_epoch,omitempty"`
452 func (m *MactimeDump) Reset() { *m = MactimeDump{} }
453 func (*MactimeDump) GetMessageName() string { return "mactime_dump" }
454 func (*MactimeDump) GetCrcString() string { return "8f454e23" }
455 func (*MactimeDump) GetMessageType() api.MessageType { return api.RequestMessage }
457 func (m *MactimeDump) Size() int {
462 // field[1] m.MyTableEpoch
466 func (m *MactimeDump) Marshal(b []byte) ([]byte, error) {
467 o := binary.BigEndian
473 buf = make([]byte, m.Size())
477 // field[1] m.MyTableEpoch
478 o.PutUint32(buf[pos:pos+4], uint32(m.MyTableEpoch))
482 func (m *MactimeDump) Unmarshal(tmp []byte) error {
483 o := binary.BigEndian
487 // field[1] m.MyTableEpoch
488 m.MyTableEpoch = uint32(o.Uint32(tmp[pos : pos+4]))
493 // MactimeDumpReply represents VPP binary API message 'mactime_dump_reply'.
494 type MactimeDumpReply struct {
495 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
496 TableEpoch uint32 `binapi:"u32,name=table_epoch" json:"table_epoch,omitempty"`
499 func (m *MactimeDumpReply) Reset() { *m = MactimeDumpReply{} }
500 func (*MactimeDumpReply) GetMessageName() string { return "mactime_dump_reply" }
501 func (*MactimeDumpReply) GetCrcString() string { return "49bcc753" }
502 func (*MactimeDumpReply) GetMessageType() api.MessageType { return api.ReplyMessage }
504 func (m *MactimeDumpReply) Size() int {
511 // field[1] m.TableEpoch
515 func (m *MactimeDumpReply) Marshal(b []byte) ([]byte, error) {
516 o := binary.BigEndian
522 buf = make([]byte, m.Size())
527 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
529 // field[1] m.TableEpoch
530 o.PutUint32(buf[pos:pos+4], uint32(m.TableEpoch))
534 func (m *MactimeDumpReply) Unmarshal(tmp []byte) error {
535 o := binary.BigEndian
540 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
542 // field[1] m.TableEpoch
543 m.TableEpoch = uint32(o.Uint32(tmp[pos : pos+4]))
548 // MactimeEnableDisable represents VPP binary API message 'mactime_enable_disable'.
549 type MactimeEnableDisable struct {
550 EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"`
551 SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
554 func (m *MactimeEnableDisable) Reset() { *m = MactimeEnableDisable{} }
555 func (*MactimeEnableDisable) GetMessageName() string { return "mactime_enable_disable" }
556 func (*MactimeEnableDisable) GetCrcString() string { return "3865946c" }
557 func (*MactimeEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage }
559 func (m *MactimeEnableDisable) Size() int {
564 // field[1] m.EnableDisable
566 // field[1] m.SwIfIndex
570 func (m *MactimeEnableDisable) Marshal(b []byte) ([]byte, error) {
571 o := binary.BigEndian
577 buf = make([]byte, m.Size())
581 // field[1] m.EnableDisable
586 // field[1] m.SwIfIndex
587 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
591 func (m *MactimeEnableDisable) Unmarshal(tmp []byte) error {
592 o := binary.BigEndian
596 // field[1] m.EnableDisable
597 m.EnableDisable = tmp[pos] != 0
599 // field[1] m.SwIfIndex
600 m.SwIfIndex = InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
605 // MactimeEnableDisableReply represents VPP binary API message 'mactime_enable_disable_reply'.
606 type MactimeEnableDisableReply struct {
607 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
610 func (m *MactimeEnableDisableReply) Reset() { *m = MactimeEnableDisableReply{} }
611 func (*MactimeEnableDisableReply) GetMessageName() string { return "mactime_enable_disable_reply" }
612 func (*MactimeEnableDisableReply) GetCrcString() string { return "e8d4e804" }
613 func (*MactimeEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage }
615 func (m *MactimeEnableDisableReply) Size() int {
624 func (m *MactimeEnableDisableReply) Marshal(b []byte) ([]byte, error) {
625 o := binary.BigEndian
631 buf = make([]byte, m.Size())
636 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
640 func (m *MactimeEnableDisableReply) Unmarshal(tmp []byte) error {
641 o := binary.BigEndian
646 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
651 func init() { file_mactime_binapi_init() }
652 func file_mactime_binapi_init() {
653 api.RegisterMessage((*MactimeAddDelRange)(nil), "mactime.MactimeAddDelRange")
654 api.RegisterMessage((*MactimeAddDelRangeReply)(nil), "mactime.MactimeAddDelRangeReply")
655 api.RegisterMessage((*MactimeDetails)(nil), "mactime.MactimeDetails")
656 api.RegisterMessage((*MactimeDump)(nil), "mactime.MactimeDump")
657 api.RegisterMessage((*MactimeDumpReply)(nil), "mactime.MactimeDumpReply")
658 api.RegisterMessage((*MactimeEnableDisable)(nil), "mactime.MactimeEnableDisable")
659 api.RegisterMessage((*MactimeEnableDisableReply)(nil), "mactime.MactimeEnableDisableReply")
662 // Messages returns list of all messages in this module.
663 func AllMessages() []api.Message {
664 return []api.Message{
665 (*MactimeAddDelRange)(nil),
666 (*MactimeAddDelRangeReply)(nil),
667 (*MactimeDetails)(nil),
669 (*MactimeDumpReply)(nil),
670 (*MactimeEnableDisable)(nil),
671 (*MactimeEnableDisableReply)(nil),
675 // Reference imports to suppress errors if they are not otherwise used.
676 var _ = api.RegisterMessage
677 var _ = codec.DecodeString
678 var _ = bytes.NewBuffer
679 var _ = context.Background
683 var _ = binary.BigEndian
684 var _ = math.Float32bits