diff options
author | 2020-07-17 10:36:28 +0200 | |
---|---|---|
committer | 2020-07-17 11:43:41 +0200 | |
commit | d1f24d37bd447b64e402298bb8eb2479681facf9 (patch) | |
tree | a3fc21ba730a91d8a402c7a5bf9c614e3677c4fc /binapi/pppoe/pppoe.ba.go | |
parent | 1548c7e12531e3d055567d761c580a1c7ff0ac40 (diff) |
Improve binapi generator
- simplified Size/Marshal/Unmarshal methods
- replace struc in unions with custom marshal/unmarshal
- fix imports in generated files
- fix mock adapter
- generate rpc service using low-level stream API (dumps generate control ping or stream msg..)
- move examples/binapi to binapi and generate all API for latest release
- add binapigen.Plugin for developing custom generator plugins
- optionally generate HTTP handlers (REST API) for RPC services
- add govpp program for browsing VPP API
Change-Id: I092e9ed2b0c17972b3476463c3d4b14dd76ed42b
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'binapi/pppoe/pppoe.ba.go')
-rw-r--r-- | binapi/pppoe/pppoe.ba.go | 244 |
1 files changed, 244 insertions, 0 deletions
diff --git a/binapi/pppoe/pppoe.ba.go b/binapi/pppoe/pppoe.ba.go new file mode 100644 index 0000000..0b7cafb --- /dev/null +++ b/binapi/pppoe/pppoe.ba.go @@ -0,0 +1,244 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. +// versions: +// binapi-generator: v0.4.0-dev +// VPP: 20.05-release +// source: /usr/share/vpp/api/plugins/pppoe.api.json + +// Package pppoe contains generated bindings for API file pppoe.api. +// +// Contents: +// 4 messages +// +package pppoe + +import ( + api "git.fd.io/govpp.git/api" + ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types" + interface_types "git.fd.io/govpp.git/binapi/interface_types" + ip_types "git.fd.io/govpp.git/binapi/ip_types" + codec "git.fd.io/govpp.git/codec" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the GoVPP api package it is being compiled against. +// A compilation error at this line likely means your copy of the +// GoVPP api package needs to be updated. +const _ = api.GoVppAPIPackageIsVersion2 + +const ( + APIFile = "pppoe" + APIVersion = "2.0.0" + VersionCrc = 0x24ebf557 +) + +// PppoeAddDelSession defines message 'pppoe_add_del_session'. +type PppoeAddDelSession struct { + IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"` + SessionID uint16 `binapi:"u16,name=session_id" json:"session_id,omitempty"` + ClientIP ip_types.Address `binapi:"address,name=client_ip" json:"client_ip,omitempty"` + DecapVrfID uint32 `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"` + ClientMac ethernet_types.MacAddress `binapi:"mac_address,name=client_mac" json:"client_mac,omitempty"` +} + +func (m *PppoeAddDelSession) Reset() { *m = PppoeAddDelSession{} } +func (*PppoeAddDelSession) GetMessageName() string { return "pppoe_add_del_session" } +func (*PppoeAddDelSession) GetCrcString() string { return "46ace853" } +func (*PppoeAddDelSession) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PppoeAddDelSession) Size() int { + if m == nil { + return 0 + } + var size int + size += 1 // m.IsAdd + size += 2 // m.SessionID + size += 1 // m.ClientIP.Af + size += 1 * 16 // m.ClientIP.Un + size += 4 // m.DecapVrfID + size += 1 * 6 // m.ClientMac + return size +} +func (m *PppoeAddDelSession) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeBool(m.IsAdd) + buf.EncodeUint16(uint16(m.SessionID)) + buf.EncodeUint8(uint8(m.ClientIP.Af)) + buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.DecapVrfID)) + buf.EncodeBytes(m.ClientMac[:], 6) + return buf.Bytes(), nil +} +func (m *PppoeAddDelSession) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.IsAdd = buf.DecodeBool() + m.SessionID = buf.DecodeUint16() + m.ClientIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.ClientIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.DecapVrfID = buf.DecodeUint32() + copy(m.ClientMac[:], buf.DecodeBytes(6)) + return nil +} + +// PppoeAddDelSessionReply defines message 'pppoe_add_del_session_reply'. +type PppoeAddDelSessionReply struct { + Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *PppoeAddDelSessionReply) Reset() { *m = PppoeAddDelSessionReply{} } +func (*PppoeAddDelSessionReply) GetMessageName() string { return "pppoe_add_del_session_reply" } +func (*PppoeAddDelSessionReply) GetCrcString() string { return "5383d31f" } +func (*PppoeAddDelSessionReply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PppoeAddDelSessionReply) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *PppoeAddDelSessionReply) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.Retval)) + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *PppoeAddDelSessionReply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = int32(buf.DecodeUint32()) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +// PppoeSessionDetails defines message 'pppoe_session_details'. +type PppoeSessionDetails struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` + SessionID uint16 `binapi:"u16,name=session_id" json:"session_id,omitempty"` + ClientIP ip_types.Address `binapi:"address,name=client_ip" json:"client_ip,omitempty"` + EncapIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=encap_if_index" json:"encap_if_index,omitempty"` + DecapVrfID uint32 `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"` + LocalMac ethernet_types.MacAddress `binapi:"mac_address,name=local_mac" json:"local_mac,omitempty"` + ClientMac ethernet_types.MacAddress `binapi:"mac_address,name=client_mac" json:"client_mac,omitempty"` +} + +func (m *PppoeSessionDetails) Reset() { *m = PppoeSessionDetails{} } +func (*PppoeSessionDetails) GetMessageName() string { return "pppoe_session_details" } +func (*PppoeSessionDetails) GetCrcString() string { return "332bc742" } +func (*PppoeSessionDetails) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *PppoeSessionDetails) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + size += 2 // m.SessionID + size += 1 // m.ClientIP.Af + size += 1 * 16 // m.ClientIP.Un + size += 4 // m.EncapIfIndex + size += 4 // m.DecapVrfID + size += 1 * 6 // m.LocalMac + size += 1 * 6 // m.ClientMac + return size +} +func (m *PppoeSessionDetails) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + buf.EncodeUint16(uint16(m.SessionID)) + buf.EncodeUint8(uint8(m.ClientIP.Af)) + buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 0) + buf.EncodeUint32(uint32(m.EncapIfIndex)) + buf.EncodeUint32(uint32(m.DecapVrfID)) + buf.EncodeBytes(m.LocalMac[:], 6) + buf.EncodeBytes(m.ClientMac[:], 6) + return buf.Bytes(), nil +} +func (m *PppoeSessionDetails) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.SessionID = buf.DecodeUint16() + m.ClientIP.Af = ip_types.AddressFamily(buf.DecodeUint8()) + copy(m.ClientIP.Un.XXX_UnionData[:], buf.DecodeBytes(16)) + m.EncapIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + m.DecapVrfID = buf.DecodeUint32() + copy(m.LocalMac[:], buf.DecodeBytes(6)) + copy(m.ClientMac[:], buf.DecodeBytes(6)) + return nil +} + +// PppoeSessionDump defines message 'pppoe_session_dump'. +type PppoeSessionDump struct { + SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` +} + +func (m *PppoeSessionDump) Reset() { *m = PppoeSessionDump{} } +func (*PppoeSessionDump) GetMessageName() string { return "pppoe_session_dump" } +func (*PppoeSessionDump) GetCrcString() string { return "f9e6675e" } +func (*PppoeSessionDump) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *PppoeSessionDump) Size() int { + if m == nil { + return 0 + } + var size int + size += 4 // m.SwIfIndex + return size +} +func (m *PppoeSessionDump) Marshal(b []byte) ([]byte, error) { + var buf *codec.Buffer + if b == nil { + buf = codec.NewBuffer(make([]byte, m.Size())) + } else { + buf = codec.NewBuffer(b) + } + buf.EncodeUint32(uint32(m.SwIfIndex)) + return buf.Bytes(), nil +} +func (m *PppoeSessionDump) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + +func init() { file_pppoe_binapi_init() } +func file_pppoe_binapi_init() { + api.RegisterMessage((*PppoeAddDelSession)(nil), "pppoe_add_del_session_46ace853") + api.RegisterMessage((*PppoeAddDelSessionReply)(nil), "pppoe_add_del_session_reply_5383d31f") + api.RegisterMessage((*PppoeSessionDetails)(nil), "pppoe_session_details_332bc742") + api.RegisterMessage((*PppoeSessionDump)(nil), "pppoe_session_dump_f9e6675e") +} + +// Messages returns list of all messages in this module. +func AllMessages() []api.Message { + return []api.Message{ + (*PppoeAddDelSession)(nil), + (*PppoeAddDelSessionReply)(nil), + (*PppoeSessionDetails)(nil), + (*PppoeSessionDump)(nil), + } +} |