Improve binapi generator
[govpp.git] / binapi / pppoe / pppoe.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.4.0-dev
4 //  VPP:              20.05-release
5 // source: /usr/share/vpp/api/plugins/pppoe.api.json
6
7 // Package pppoe contains generated bindings for API file pppoe.api.
8 //
9 // Contents:
10 //   4 messages
11 //
12 package pppoe
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
17         interface_types "git.fd.io/govpp.git/binapi/interface_types"
18         ip_types "git.fd.io/govpp.git/binapi/ip_types"
19         codec "git.fd.io/govpp.git/codec"
20 )
21
22 // This is a compile-time assertion to ensure that this generated file
23 // is compatible with the GoVPP api package it is being compiled against.
24 // A compilation error at this line likely means your copy of the
25 // GoVPP api package needs to be updated.
26 const _ = api.GoVppAPIPackageIsVersion2
27
28 const (
29         APIFile    = "pppoe"
30         APIVersion = "2.0.0"
31         VersionCrc = 0x24ebf557
32 )
33
34 // PppoeAddDelSession defines message 'pppoe_add_del_session'.
35 type PppoeAddDelSession struct {
36         IsAdd      bool                      `binapi:"bool,name=is_add" json:"is_add,omitempty"`
37         SessionID  uint16                    `binapi:"u16,name=session_id" json:"session_id,omitempty"`
38         ClientIP   ip_types.Address          `binapi:"address,name=client_ip" json:"client_ip,omitempty"`
39         DecapVrfID uint32                    `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"`
40         ClientMac  ethernet_types.MacAddress `binapi:"mac_address,name=client_mac" json:"client_mac,omitempty"`
41 }
42
43 func (m *PppoeAddDelSession) Reset()               { *m = PppoeAddDelSession{} }
44 func (*PppoeAddDelSession) GetMessageName() string { return "pppoe_add_del_session" }
45 func (*PppoeAddDelSession) GetCrcString() string   { return "46ace853" }
46 func (*PppoeAddDelSession) GetMessageType() api.MessageType {
47         return api.RequestMessage
48 }
49
50 func (m *PppoeAddDelSession) Size() int {
51         if m == nil {
52                 return 0
53         }
54         var size int
55         size += 1      // m.IsAdd
56         size += 2      // m.SessionID
57         size += 1      // m.ClientIP.Af
58         size += 1 * 16 // m.ClientIP.Un
59         size += 4      // m.DecapVrfID
60         size += 1 * 6  // m.ClientMac
61         return size
62 }
63 func (m *PppoeAddDelSession) Marshal(b []byte) ([]byte, error) {
64         var buf *codec.Buffer
65         if b == nil {
66                 buf = codec.NewBuffer(make([]byte, m.Size()))
67         } else {
68                 buf = codec.NewBuffer(b)
69         }
70         buf.EncodeBool(m.IsAdd)
71         buf.EncodeUint16(uint16(m.SessionID))
72         buf.EncodeUint8(uint8(m.ClientIP.Af))
73         buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 0)
74         buf.EncodeUint32(uint32(m.DecapVrfID))
75         buf.EncodeBytes(m.ClientMac[:], 6)
76         return buf.Bytes(), nil
77 }
78 func (m *PppoeAddDelSession) Unmarshal(b []byte) error {
79         buf := codec.NewBuffer(b)
80         m.IsAdd = buf.DecodeBool()
81         m.SessionID = buf.DecodeUint16()
82         m.ClientIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
83         copy(m.ClientIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
84         m.DecapVrfID = buf.DecodeUint32()
85         copy(m.ClientMac[:], buf.DecodeBytes(6))
86         return nil
87 }
88
89 // PppoeAddDelSessionReply defines message 'pppoe_add_del_session_reply'.
90 type PppoeAddDelSessionReply struct {
91         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
92         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
93 }
94
95 func (m *PppoeAddDelSessionReply) Reset()               { *m = PppoeAddDelSessionReply{} }
96 func (*PppoeAddDelSessionReply) GetMessageName() string { return "pppoe_add_del_session_reply" }
97 func (*PppoeAddDelSessionReply) GetCrcString() string   { return "5383d31f" }
98 func (*PppoeAddDelSessionReply) GetMessageType() api.MessageType {
99         return api.ReplyMessage
100 }
101
102 func (m *PppoeAddDelSessionReply) Size() int {
103         if m == nil {
104                 return 0
105         }
106         var size int
107         size += 4 // m.Retval
108         size += 4 // m.SwIfIndex
109         return size
110 }
111 func (m *PppoeAddDelSessionReply) Marshal(b []byte) ([]byte, error) {
112         var buf *codec.Buffer
113         if b == nil {
114                 buf = codec.NewBuffer(make([]byte, m.Size()))
115         } else {
116                 buf = codec.NewBuffer(b)
117         }
118         buf.EncodeUint32(uint32(m.Retval))
119         buf.EncodeUint32(uint32(m.SwIfIndex))
120         return buf.Bytes(), nil
121 }
122 func (m *PppoeAddDelSessionReply) Unmarshal(b []byte) error {
123         buf := codec.NewBuffer(b)
124         m.Retval = int32(buf.DecodeUint32())
125         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
126         return nil
127 }
128
129 // PppoeSessionDetails defines message 'pppoe_session_details'.
130 type PppoeSessionDetails struct {
131         SwIfIndex    interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
132         SessionID    uint16                         `binapi:"u16,name=session_id" json:"session_id,omitempty"`
133         ClientIP     ip_types.Address               `binapi:"address,name=client_ip" json:"client_ip,omitempty"`
134         EncapIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=encap_if_index" json:"encap_if_index,omitempty"`
135         DecapVrfID   uint32                         `binapi:"u32,name=decap_vrf_id" json:"decap_vrf_id,omitempty"`
136         LocalMac     ethernet_types.MacAddress      `binapi:"mac_address,name=local_mac" json:"local_mac,omitempty"`
137         ClientMac    ethernet_types.MacAddress      `binapi:"mac_address,name=client_mac" json:"client_mac,omitempty"`
138 }
139
140 func (m *PppoeSessionDetails) Reset()               { *m = PppoeSessionDetails{} }
141 func (*PppoeSessionDetails) GetMessageName() string { return "pppoe_session_details" }
142 func (*PppoeSessionDetails) GetCrcString() string   { return "332bc742" }
143 func (*PppoeSessionDetails) GetMessageType() api.MessageType {
144         return api.ReplyMessage
145 }
146
147 func (m *PppoeSessionDetails) Size() int {
148         if m == nil {
149                 return 0
150         }
151         var size int
152         size += 4      // m.SwIfIndex
153         size += 2      // m.SessionID
154         size += 1      // m.ClientIP.Af
155         size += 1 * 16 // m.ClientIP.Un
156         size += 4      // m.EncapIfIndex
157         size += 4      // m.DecapVrfID
158         size += 1 * 6  // m.LocalMac
159         size += 1 * 6  // m.ClientMac
160         return size
161 }
162 func (m *PppoeSessionDetails) Marshal(b []byte) ([]byte, error) {
163         var buf *codec.Buffer
164         if b == nil {
165                 buf = codec.NewBuffer(make([]byte, m.Size()))
166         } else {
167                 buf = codec.NewBuffer(b)
168         }
169         buf.EncodeUint32(uint32(m.SwIfIndex))
170         buf.EncodeUint16(uint16(m.SessionID))
171         buf.EncodeUint8(uint8(m.ClientIP.Af))
172         buf.EncodeBytes(m.ClientIP.Un.XXX_UnionData[:], 0)
173         buf.EncodeUint32(uint32(m.EncapIfIndex))
174         buf.EncodeUint32(uint32(m.DecapVrfID))
175         buf.EncodeBytes(m.LocalMac[:], 6)
176         buf.EncodeBytes(m.ClientMac[:], 6)
177         return buf.Bytes(), nil
178 }
179 func (m *PppoeSessionDetails) Unmarshal(b []byte) error {
180         buf := codec.NewBuffer(b)
181         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
182         m.SessionID = buf.DecodeUint16()
183         m.ClientIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
184         copy(m.ClientIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
185         m.EncapIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
186         m.DecapVrfID = buf.DecodeUint32()
187         copy(m.LocalMac[:], buf.DecodeBytes(6))
188         copy(m.ClientMac[:], buf.DecodeBytes(6))
189         return nil
190 }
191
192 // PppoeSessionDump defines message 'pppoe_session_dump'.
193 type PppoeSessionDump struct {
194         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
195 }
196
197 func (m *PppoeSessionDump) Reset()               { *m = PppoeSessionDump{} }
198 func (*PppoeSessionDump) GetMessageName() string { return "pppoe_session_dump" }
199 func (*PppoeSessionDump) GetCrcString() string   { return "f9e6675e" }
200 func (*PppoeSessionDump) GetMessageType() api.MessageType {
201         return api.RequestMessage
202 }
203
204 func (m *PppoeSessionDump) Size() int {
205         if m == nil {
206                 return 0
207         }
208         var size int
209         size += 4 // m.SwIfIndex
210         return size
211 }
212 func (m *PppoeSessionDump) Marshal(b []byte) ([]byte, error) {
213         var buf *codec.Buffer
214         if b == nil {
215                 buf = codec.NewBuffer(make([]byte, m.Size()))
216         } else {
217                 buf = codec.NewBuffer(b)
218         }
219         buf.EncodeUint32(uint32(m.SwIfIndex))
220         return buf.Bytes(), nil
221 }
222 func (m *PppoeSessionDump) Unmarshal(b []byte) error {
223         buf := codec.NewBuffer(b)
224         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
225         return nil
226 }
227
228 func init() { file_pppoe_binapi_init() }
229 func file_pppoe_binapi_init() {
230         api.RegisterMessage((*PppoeAddDelSession)(nil), "pppoe_add_del_session_46ace853")
231         api.RegisterMessage((*PppoeAddDelSessionReply)(nil), "pppoe_add_del_session_reply_5383d31f")
232         api.RegisterMessage((*PppoeSessionDetails)(nil), "pppoe_session_details_332bc742")
233         api.RegisterMessage((*PppoeSessionDump)(nil), "pppoe_session_dump_f9e6675e")
234 }
235
236 // Messages returns list of all messages in this module.
237 func AllMessages() []api.Message {
238         return []api.Message{
239                 (*PppoeAddDelSession)(nil),
240                 (*PppoeAddDelSessionReply)(nil),
241                 (*PppoeSessionDetails)(nil),
242                 (*PppoeSessionDump)(nil),
243         }
244 }