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).
29 api "git.fd.io/govpp.git/api"
30 codec "git.fd.io/govpp.git/codec"
31 struc "github.com/lunixbochs/struc"
33 interface_types "git.fd.io/govpp.git/examples/binapi/interface_types"
36 // This is a compile-time assertion to ensure that this generated file
37 // is compatible with the GoVPP api package it is being compiled against.
38 // A compilation error at this line likely means your copy of the
39 // GoVPP api package needs to be updated.
40 const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package
43 // ModuleName is the name of this module.
44 ModuleName = "mactime"
45 // APIVersion is the API version of this module.
47 // VersionCrc is the CRC of this module.
48 VersionCrc = 0x9283d3e
51 // MacAddress represents VPP binary API alias 'mac_address'.
52 type MacAddress [6]uint8
54 func ParseMAC(mac string) (parsed MacAddress, err error) {
55 var hw net.HardwareAddr
56 if hw, err = net.ParseMAC(mac); err != nil {
59 copy(parsed[:], hw[:])
63 func (m *MacAddress) ToString() string {
64 return net.HardwareAddr(m[:]).String()
67 // MactimeTimeRange represents VPP binary API type 'mactime_time_range'.
68 type MactimeTimeRange struct {
69 Start float64 `binapi:"f64,name=start" json:"start,omitempty"`
70 End float64 `binapi:"f64,name=end" json:"end,omitempty"`
73 func (*MactimeTimeRange) GetTypeName() string { return "mactime_time_range" }
75 // TimeRange represents VPP binary API type 'time_range'.
76 type TimeRange struct {
77 Start float64 `binapi:"f64,name=start" json:"start,omitempty"`
78 End float64 `binapi:"f64,name=end" json:"end,omitempty"`
81 func (*TimeRange) GetTypeName() string { return "time_range" }
83 // MactimeAddDelRange represents VPP binary API message 'mactime_add_del_range'.
84 type MactimeAddDelRange struct {
85 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
86 Drop bool `binapi:"bool,name=drop" json:"drop,omitempty"`
87 Allow bool `binapi:"bool,name=allow" json:"allow,omitempty"`
88 AllowQuota uint8 `binapi:"u8,name=allow_quota" json:"allow_quota,omitempty"`
89 NoUDP10001 bool `binapi:"bool,name=no_udp_10001" json:"no_udp_10001,omitempty"`
90 DataQuota uint64 `binapi:"u64,name=data_quota" json:"data_quota,omitempty"`
91 MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
92 DeviceName string `binapi:"string[64],name=device_name" json:"device_name,omitempty" struc:"[64]byte"`
93 Count uint32 `binapi:"u32,name=count" json:"count,omitempty" struc:"sizeof=Ranges"`
94 Ranges []TimeRange `binapi:"time_range[count],name=ranges" json:"ranges,omitempty"`
97 func (m *MactimeAddDelRange) Reset() { *m = MactimeAddDelRange{} }
98 func (*MactimeAddDelRange) GetMessageName() string { return "mactime_add_del_range" }
99 func (*MactimeAddDelRange) GetCrcString() string { return "101858ef" }
100 func (*MactimeAddDelRange) GetMessageType() api.MessageType { return api.RequestMessage }
102 func (m *MactimeAddDelRange) Size() int {
113 // field[1] m.AllowQuota
115 // field[1] m.NoUDP10001
117 // field[1] m.DataQuota
119 // field[1] m.MacAddress
121 // field[1] m.DeviceName
126 for j1 := 0; j1 < len(m.Ranges); j1++ {
129 if j1 < len(m.Ranges) {
139 func (m *MactimeAddDelRange) Marshal(b []byte) ([]byte, error) {
140 o := binary.BigEndian
146 buf = make([]byte, m.Size())
165 // field[1] m.AllowQuota
166 buf[pos] = uint8(m.AllowQuota)
168 // field[1] m.NoUDP10001
173 // field[1] m.DataQuota
174 o.PutUint64(buf[pos:pos+8], uint64(m.DataQuota))
176 // field[1] m.MacAddress
177 for i := 0; i < 6; i++ {
179 if i < len(m.MacAddress) {
180 x = uint8(m.MacAddress[i])
185 // field[1] m.DeviceName
186 copy(buf[pos:pos+64], m.DeviceName)
189 o.PutUint32(buf[pos:pos+4], uint32(len(m.Ranges)))
192 for j1 := 0; j1 < len(m.Ranges); j1++ {
194 if j1 < len(m.Ranges) {
198 o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.Start)))
201 o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.End)))
206 func (m *MactimeAddDelRange) Unmarshal(tmp []byte) error {
207 o := binary.BigEndian
212 m.IsAdd = tmp[pos] != 0
215 m.Drop = tmp[pos] != 0
218 m.Allow = tmp[pos] != 0
220 // field[1] m.AllowQuota
221 m.AllowQuota = uint8(tmp[pos])
223 // field[1] m.NoUDP10001
224 m.NoUDP10001 = tmp[pos] != 0
226 // field[1] m.DataQuota
227 m.DataQuota = uint64(o.Uint64(tmp[pos : pos+8]))
229 // field[1] m.MacAddress
230 for i := 0; i < len(m.MacAddress); i++ {
231 m.MacAddress[i] = uint8(tmp[pos])
234 // field[1] m.DeviceName
236 nul := bytes.Index(tmp[pos:pos+64], []byte{0x00})
237 m.DeviceName = codec.DecodeString(tmp[pos : pos+nul])
241 m.Count = uint32(o.Uint32(tmp[pos : pos+4]))
244 m.Ranges = make([]TimeRange, int(m.Count))
245 for j1 := 0; j1 < int(m.Count); j1++ {
246 // field[2] m.Ranges[j1].Start
247 m.Ranges[j1].Start = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8])))
249 // field[2] m.Ranges[j1].End
250 m.Ranges[j1].End = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8])))
256 // MactimeAddDelRangeReply represents VPP binary API message 'mactime_add_del_range_reply'.
257 type MactimeAddDelRangeReply struct {
258 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
261 func (m *MactimeAddDelRangeReply) Reset() { *m = MactimeAddDelRangeReply{} }
262 func (*MactimeAddDelRangeReply) GetMessageName() string { return "mactime_add_del_range_reply" }
263 func (*MactimeAddDelRangeReply) GetCrcString() string { return "e8d4e804" }
264 func (*MactimeAddDelRangeReply) GetMessageType() api.MessageType { return api.ReplyMessage }
266 func (m *MactimeAddDelRangeReply) Size() int {
275 func (m *MactimeAddDelRangeReply) Marshal(b []byte) ([]byte, error) {
276 o := binary.BigEndian
282 buf = make([]byte, m.Size())
287 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
291 func (m *MactimeAddDelRangeReply) Unmarshal(tmp []byte) error {
292 o := binary.BigEndian
297 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
302 // MactimeDetails represents VPP binary API message 'mactime_details'.
303 type MactimeDetails struct {
304 PoolIndex uint32 `binapi:"u32,name=pool_index" json:"pool_index,omitempty"`
305 MacAddress MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
306 DataQuota uint64 `binapi:"u64,name=data_quota" json:"data_quota,omitempty"`
307 DataUsedInRange uint64 `binapi:"u64,name=data_used_in_range" json:"data_used_in_range,omitempty"`
308 Flags uint32 `binapi:"u32,name=flags" json:"flags,omitempty"`
309 DeviceName string `binapi:"string[64],name=device_name" json:"device_name,omitempty" struc:"[64]byte"`
310 Nranges uint32 `binapi:"u32,name=nranges" json:"nranges,omitempty" struc:"sizeof=Ranges"`
311 Ranges []MactimeTimeRange `binapi:"mactime_time_range[nranges],name=ranges" json:"ranges,omitempty"`
314 func (m *MactimeDetails) Reset() { *m = MactimeDetails{} }
315 func (*MactimeDetails) GetMessageName() string { return "mactime_details" }
316 func (*MactimeDetails) GetCrcString() string { return "44921c06" }
317 func (*MactimeDetails) GetMessageType() api.MessageType { return api.ReplyMessage }
319 func (m *MactimeDetails) Size() int {
324 // field[1] m.PoolIndex
326 // field[1] m.MacAddress
328 // field[1] m.DataQuota
330 // field[1] m.DataUsedInRange
334 // field[1] m.DeviceName
336 // field[1] m.Nranges
339 for j1 := 0; j1 < len(m.Ranges); j1++ {
340 var s1 MactimeTimeRange
342 if j1 < len(m.Ranges) {
352 func (m *MactimeDetails) Marshal(b []byte) ([]byte, error) {
353 o := binary.BigEndian
359 buf = make([]byte, m.Size())
363 // field[1] m.PoolIndex
364 o.PutUint32(buf[pos:pos+4], uint32(m.PoolIndex))
366 // field[1] m.MacAddress
367 for i := 0; i < 6; i++ {
369 if i < len(m.MacAddress) {
370 x = uint8(m.MacAddress[i])
375 // field[1] m.DataQuota
376 o.PutUint64(buf[pos:pos+8], uint64(m.DataQuota))
378 // field[1] m.DataUsedInRange
379 o.PutUint64(buf[pos:pos+8], uint64(m.DataUsedInRange))
382 o.PutUint32(buf[pos:pos+4], uint32(m.Flags))
384 // field[1] m.DeviceName
385 copy(buf[pos:pos+64], m.DeviceName)
387 // field[1] m.Nranges
388 o.PutUint32(buf[pos:pos+4], uint32(len(m.Ranges)))
391 for j1 := 0; j1 < len(m.Ranges); j1++ {
392 var v1 MactimeTimeRange
393 if j1 < len(m.Ranges) {
397 o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.Start)))
400 o.PutUint64(buf[pos:pos+8], math.Float64bits(float64(v1.End)))
405 func (m *MactimeDetails) Unmarshal(tmp []byte) error {
406 o := binary.BigEndian
410 // field[1] m.PoolIndex
411 m.PoolIndex = uint32(o.Uint32(tmp[pos : pos+4]))
413 // field[1] m.MacAddress
414 for i := 0; i < len(m.MacAddress); i++ {
415 m.MacAddress[i] = uint8(tmp[pos])
418 // field[1] m.DataQuota
419 m.DataQuota = uint64(o.Uint64(tmp[pos : pos+8]))
421 // field[1] m.DataUsedInRange
422 m.DataUsedInRange = uint64(o.Uint64(tmp[pos : pos+8]))
425 m.Flags = uint32(o.Uint32(tmp[pos : pos+4]))
427 // field[1] m.DeviceName
429 nul := bytes.Index(tmp[pos:pos+64], []byte{0x00})
430 m.DeviceName = codec.DecodeString(tmp[pos : pos+nul])
433 // field[1] m.Nranges
434 m.Nranges = uint32(o.Uint32(tmp[pos : pos+4]))
437 m.Ranges = make([]MactimeTimeRange, int(m.Nranges))
438 for j1 := 0; j1 < int(m.Nranges); j1++ {
439 // field[2] m.Ranges[j1].Start
440 m.Ranges[j1].Start = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8])))
442 // field[2] m.Ranges[j1].End
443 m.Ranges[j1].End = float64(math.Float64frombits(o.Uint64(tmp[pos : pos+8])))
449 // MactimeDump represents VPP binary API message 'mactime_dump'.
450 type MactimeDump struct {
451 MyTableEpoch uint32 `binapi:"u32,name=my_table_epoch" json:"my_table_epoch,omitempty"`
454 func (m *MactimeDump) Reset() { *m = MactimeDump{} }
455 func (*MactimeDump) GetMessageName() string { return "mactime_dump" }
456 func (*MactimeDump) GetCrcString() string { return "8f454e23" }
457 func (*MactimeDump) GetMessageType() api.MessageType { return api.RequestMessage }
459 func (m *MactimeDump) Size() int {
464 // field[1] m.MyTableEpoch
468 func (m *MactimeDump) Marshal(b []byte) ([]byte, error) {
469 o := binary.BigEndian
475 buf = make([]byte, m.Size())
479 // field[1] m.MyTableEpoch
480 o.PutUint32(buf[pos:pos+4], uint32(m.MyTableEpoch))
484 func (m *MactimeDump) Unmarshal(tmp []byte) error {
485 o := binary.BigEndian
489 // field[1] m.MyTableEpoch
490 m.MyTableEpoch = uint32(o.Uint32(tmp[pos : pos+4]))
495 // MactimeDumpReply represents VPP binary API message 'mactime_dump_reply'.
496 type MactimeDumpReply struct {
497 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
498 TableEpoch uint32 `binapi:"u32,name=table_epoch" json:"table_epoch,omitempty"`
501 func (m *MactimeDumpReply) Reset() { *m = MactimeDumpReply{} }
502 func (*MactimeDumpReply) GetMessageName() string { return "mactime_dump_reply" }
503 func (*MactimeDumpReply) GetCrcString() string { return "49bcc753" }
504 func (*MactimeDumpReply) GetMessageType() api.MessageType { return api.ReplyMessage }
506 func (m *MactimeDumpReply) Size() int {
513 // field[1] m.TableEpoch
517 func (m *MactimeDumpReply) Marshal(b []byte) ([]byte, error) {
518 o := binary.BigEndian
524 buf = make([]byte, m.Size())
529 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
531 // field[1] m.TableEpoch
532 o.PutUint32(buf[pos:pos+4], uint32(m.TableEpoch))
536 func (m *MactimeDumpReply) Unmarshal(tmp []byte) error {
537 o := binary.BigEndian
542 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
544 // field[1] m.TableEpoch
545 m.TableEpoch = uint32(o.Uint32(tmp[pos : pos+4]))
550 // MactimeEnableDisable represents VPP binary API message 'mactime_enable_disable'.
551 type MactimeEnableDisable struct {
552 EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"`
553 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
556 func (m *MactimeEnableDisable) Reset() { *m = MactimeEnableDisable{} }
557 func (*MactimeEnableDisable) GetMessageName() string { return "mactime_enable_disable" }
558 func (*MactimeEnableDisable) GetCrcString() string { return "3865946c" }
559 func (*MactimeEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage }
561 func (m *MactimeEnableDisable) Size() int {
566 // field[1] m.EnableDisable
568 // field[1] m.SwIfIndex
572 func (m *MactimeEnableDisable) Marshal(b []byte) ([]byte, error) {
573 o := binary.BigEndian
579 buf = make([]byte, m.Size())
583 // field[1] m.EnableDisable
588 // field[1] m.SwIfIndex
589 o.PutUint32(buf[pos:pos+4], uint32(m.SwIfIndex))
593 func (m *MactimeEnableDisable) Unmarshal(tmp []byte) error {
594 o := binary.BigEndian
598 // field[1] m.EnableDisable
599 m.EnableDisable = tmp[pos] != 0
601 // field[1] m.SwIfIndex
602 m.SwIfIndex = interface_types.InterfaceIndex(o.Uint32(tmp[pos : pos+4]))
607 // MactimeEnableDisableReply represents VPP binary API message 'mactime_enable_disable_reply'.
608 type MactimeEnableDisableReply struct {
609 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
612 func (m *MactimeEnableDisableReply) Reset() { *m = MactimeEnableDisableReply{} }
613 func (*MactimeEnableDisableReply) GetMessageName() string { return "mactime_enable_disable_reply" }
614 func (*MactimeEnableDisableReply) GetCrcString() string { return "e8d4e804" }
615 func (*MactimeEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage }
617 func (m *MactimeEnableDisableReply) Size() int {
626 func (m *MactimeEnableDisableReply) Marshal(b []byte) ([]byte, error) {
627 o := binary.BigEndian
633 buf = make([]byte, m.Size())
638 o.PutUint32(buf[pos:pos+4], uint32(m.Retval))
642 func (m *MactimeEnableDisableReply) Unmarshal(tmp []byte) error {
643 o := binary.BigEndian
648 m.Retval = int32(o.Uint32(tmp[pos : pos+4]))
653 func init() { file_mactime_binapi_init() }
654 func file_mactime_binapi_init() {
655 api.RegisterMessage((*MactimeAddDelRange)(nil), "mactime.MactimeAddDelRange")
656 api.RegisterMessage((*MactimeAddDelRangeReply)(nil), "mactime.MactimeAddDelRangeReply")
657 api.RegisterMessage((*MactimeDetails)(nil), "mactime.MactimeDetails")
658 api.RegisterMessage((*MactimeDump)(nil), "mactime.MactimeDump")
659 api.RegisterMessage((*MactimeDumpReply)(nil), "mactime.MactimeDumpReply")
660 api.RegisterMessage((*MactimeEnableDisable)(nil), "mactime.MactimeEnableDisable")
661 api.RegisterMessage((*MactimeEnableDisableReply)(nil), "mactime.MactimeEnableDisableReply")
664 // Messages returns list of all messages in this module.
665 func AllMessages() []api.Message {
666 return []api.Message{
667 (*MactimeAddDelRange)(nil),
668 (*MactimeAddDelRangeReply)(nil),
669 (*MactimeDetails)(nil),
671 (*MactimeDumpReply)(nil),
672 (*MactimeEnableDisable)(nil),
673 (*MactimeEnableDisableReply)(nil),
677 // Reference imports to suppress errors if they are not otherwise used.
678 var _ = api.RegisterMessage
679 var _ = codec.DecodeString
680 var _ = bytes.NewBuffer
681 var _ = context.Background
684 var _ = strings.Contains
686 var _ = binary.BigEndian
687 var _ = math.Float32bits