binapigen: fix union size
[govpp.git] / binapi / gtpu / gtpu.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/gtpu.api.json
6
7 // Package gtpu contains generated bindings for API file gtpu.api.
8 //
9 // Contents:
10 //   8 messages
11 //
12 package gtpu
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         interface_types "git.fd.io/govpp.git/binapi/interface_types"
17         ip_types "git.fd.io/govpp.git/binapi/ip_types"
18         codec "git.fd.io/govpp.git/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    = "gtpu"
29         APIVersion = "2.0.0"
30         VersionCrc = 0x30326e2d
31 )
32
33 // GtpuAddDelTunnel defines message 'gtpu_add_del_tunnel'.
34 type GtpuAddDelTunnel struct {
35         IsAdd          bool                           `binapi:"bool,name=is_add" json:"is_add,omitempty"`
36         SrcAddress     ip_types.Address               `binapi:"address,name=src_address" json:"src_address,omitempty"`
37         DstAddress     ip_types.Address               `binapi:"address,name=dst_address" json:"dst_address,omitempty"`
38         McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"`
39         EncapVrfID     uint32                         `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"`
40         DecapNextIndex uint32                         `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"`
41         Teid           uint32                         `binapi:"u32,name=teid" json:"teid,omitempty"`
42 }
43
44 func (m *GtpuAddDelTunnel) Reset()               { *m = GtpuAddDelTunnel{} }
45 func (*GtpuAddDelTunnel) GetMessageName() string { return "gtpu_add_del_tunnel" }
46 func (*GtpuAddDelTunnel) GetCrcString() string   { return "9a26a51c" }
47 func (*GtpuAddDelTunnel) GetMessageType() api.MessageType {
48         return api.RequestMessage
49 }
50
51 func (m *GtpuAddDelTunnel) Size() (size int) {
52         if m == nil {
53                 return 0
54         }
55         size += 1      // m.IsAdd
56         size += 1      // m.SrcAddress.Af
57         size += 1 * 16 // m.SrcAddress.Un
58         size += 1      // m.DstAddress.Af
59         size += 1 * 16 // m.DstAddress.Un
60         size += 4      // m.McastSwIfIndex
61         size += 4      // m.EncapVrfID
62         size += 4      // m.DecapNextIndex
63         size += 4      // m.Teid
64         return size
65 }
66 func (m *GtpuAddDelTunnel) Marshal(b []byte) ([]byte, error) {
67         if b == nil {
68                 b = make([]byte, m.Size())
69         }
70         buf := codec.NewBuffer(b)
71         buf.EncodeBool(m.IsAdd)
72         buf.EncodeUint8(uint8(m.SrcAddress.Af))
73         buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16)
74         buf.EncodeUint8(uint8(m.DstAddress.Af))
75         buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16)
76         buf.EncodeUint32(uint32(m.McastSwIfIndex))
77         buf.EncodeUint32(m.EncapVrfID)
78         buf.EncodeUint32(m.DecapNextIndex)
79         buf.EncodeUint32(m.Teid)
80         return buf.Bytes(), nil
81 }
82 func (m *GtpuAddDelTunnel) Unmarshal(b []byte) error {
83         buf := codec.NewBuffer(b)
84         m.IsAdd = buf.DecodeBool()
85         m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
86         copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
87         m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
88         copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
89         m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
90         m.EncapVrfID = buf.DecodeUint32()
91         m.DecapNextIndex = buf.DecodeUint32()
92         m.Teid = buf.DecodeUint32()
93         return nil
94 }
95
96 // GtpuAddDelTunnelReply defines message 'gtpu_add_del_tunnel_reply'.
97 type GtpuAddDelTunnelReply struct {
98         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
99         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
100 }
101
102 func (m *GtpuAddDelTunnelReply) Reset()               { *m = GtpuAddDelTunnelReply{} }
103 func (*GtpuAddDelTunnelReply) GetMessageName() string { return "gtpu_add_del_tunnel_reply" }
104 func (*GtpuAddDelTunnelReply) GetCrcString() string   { return "5383d31f" }
105 func (*GtpuAddDelTunnelReply) GetMessageType() api.MessageType {
106         return api.ReplyMessage
107 }
108
109 func (m *GtpuAddDelTunnelReply) Size() (size int) {
110         if m == nil {
111                 return 0
112         }
113         size += 4 // m.Retval
114         size += 4 // m.SwIfIndex
115         return size
116 }
117 func (m *GtpuAddDelTunnelReply) Marshal(b []byte) ([]byte, error) {
118         if b == nil {
119                 b = make([]byte, m.Size())
120         }
121         buf := codec.NewBuffer(b)
122         buf.EncodeInt32(m.Retval)
123         buf.EncodeUint32(uint32(m.SwIfIndex))
124         return buf.Bytes(), nil
125 }
126 func (m *GtpuAddDelTunnelReply) Unmarshal(b []byte) error {
127         buf := codec.NewBuffer(b)
128         m.Retval = buf.DecodeInt32()
129         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
130         return nil
131 }
132
133 // GtpuOffloadRx defines message 'gtpu_offload_rx'.
134 type GtpuOffloadRx struct {
135         HwIfIndex uint32 `binapi:"u32,name=hw_if_index" json:"hw_if_index,omitempty"`
136         SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
137         Enable    uint8  `binapi:"u8,name=enable" json:"enable,omitempty"`
138 }
139
140 func (m *GtpuOffloadRx) Reset()               { *m = GtpuOffloadRx{} }
141 func (*GtpuOffloadRx) GetMessageName() string { return "gtpu_offload_rx" }
142 func (*GtpuOffloadRx) GetCrcString() string   { return "f0b08786" }
143 func (*GtpuOffloadRx) GetMessageType() api.MessageType {
144         return api.RequestMessage
145 }
146
147 func (m *GtpuOffloadRx) Size() (size int) {
148         if m == nil {
149                 return 0
150         }
151         size += 4 // m.HwIfIndex
152         size += 4 // m.SwIfIndex
153         size += 1 // m.Enable
154         return size
155 }
156 func (m *GtpuOffloadRx) Marshal(b []byte) ([]byte, error) {
157         if b == nil {
158                 b = make([]byte, m.Size())
159         }
160         buf := codec.NewBuffer(b)
161         buf.EncodeUint32(m.HwIfIndex)
162         buf.EncodeUint32(m.SwIfIndex)
163         buf.EncodeUint8(m.Enable)
164         return buf.Bytes(), nil
165 }
166 func (m *GtpuOffloadRx) Unmarshal(b []byte) error {
167         buf := codec.NewBuffer(b)
168         m.HwIfIndex = buf.DecodeUint32()
169         m.SwIfIndex = buf.DecodeUint32()
170         m.Enable = buf.DecodeUint8()
171         return nil
172 }
173
174 // GtpuOffloadRxReply defines message 'gtpu_offload_rx_reply'.
175 type GtpuOffloadRxReply struct {
176         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
177 }
178
179 func (m *GtpuOffloadRxReply) Reset()               { *m = GtpuOffloadRxReply{} }
180 func (*GtpuOffloadRxReply) GetMessageName() string { return "gtpu_offload_rx_reply" }
181 func (*GtpuOffloadRxReply) GetCrcString() string   { return "e8d4e804" }
182 func (*GtpuOffloadRxReply) GetMessageType() api.MessageType {
183         return api.ReplyMessage
184 }
185
186 func (m *GtpuOffloadRxReply) Size() (size int) {
187         if m == nil {
188                 return 0
189         }
190         size += 4 // m.Retval
191         return size
192 }
193 func (m *GtpuOffloadRxReply) Marshal(b []byte) ([]byte, error) {
194         if b == nil {
195                 b = make([]byte, m.Size())
196         }
197         buf := codec.NewBuffer(b)
198         buf.EncodeInt32(m.Retval)
199         return buf.Bytes(), nil
200 }
201 func (m *GtpuOffloadRxReply) Unmarshal(b []byte) error {
202         buf := codec.NewBuffer(b)
203         m.Retval = buf.DecodeInt32()
204         return nil
205 }
206
207 // GtpuTunnelDetails defines message 'gtpu_tunnel_details'.
208 type GtpuTunnelDetails struct {
209         SwIfIndex      interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
210         SrcAddress     ip_types.Address               `binapi:"address,name=src_address" json:"src_address,omitempty"`
211         DstAddress     ip_types.Address               `binapi:"address,name=dst_address" json:"dst_address,omitempty"`
212         McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"`
213         EncapVrfID     uint32                         `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"`
214         DecapNextIndex uint32                         `binapi:"u32,name=decap_next_index" json:"decap_next_index,omitempty"`
215         Teid           uint32                         `binapi:"u32,name=teid" json:"teid,omitempty"`
216 }
217
218 func (m *GtpuTunnelDetails) Reset()               { *m = GtpuTunnelDetails{} }
219 func (*GtpuTunnelDetails) GetMessageName() string { return "gtpu_tunnel_details" }
220 func (*GtpuTunnelDetails) GetCrcString() string   { return "a4d81a09" }
221 func (*GtpuTunnelDetails) GetMessageType() api.MessageType {
222         return api.ReplyMessage
223 }
224
225 func (m *GtpuTunnelDetails) Size() (size int) {
226         if m == nil {
227                 return 0
228         }
229         size += 4      // m.SwIfIndex
230         size += 1      // m.SrcAddress.Af
231         size += 1 * 16 // m.SrcAddress.Un
232         size += 1      // m.DstAddress.Af
233         size += 1 * 16 // m.DstAddress.Un
234         size += 4      // m.McastSwIfIndex
235         size += 4      // m.EncapVrfID
236         size += 4      // m.DecapNextIndex
237         size += 4      // m.Teid
238         return size
239 }
240 func (m *GtpuTunnelDetails) Marshal(b []byte) ([]byte, error) {
241         if b == nil {
242                 b = make([]byte, m.Size())
243         }
244         buf := codec.NewBuffer(b)
245         buf.EncodeUint32(uint32(m.SwIfIndex))
246         buf.EncodeUint8(uint8(m.SrcAddress.Af))
247         buf.EncodeBytes(m.SrcAddress.Un.XXX_UnionData[:], 16)
248         buf.EncodeUint8(uint8(m.DstAddress.Af))
249         buf.EncodeBytes(m.DstAddress.Un.XXX_UnionData[:], 16)
250         buf.EncodeUint32(uint32(m.McastSwIfIndex))
251         buf.EncodeUint32(m.EncapVrfID)
252         buf.EncodeUint32(m.DecapNextIndex)
253         buf.EncodeUint32(m.Teid)
254         return buf.Bytes(), nil
255 }
256 func (m *GtpuTunnelDetails) Unmarshal(b []byte) error {
257         buf := codec.NewBuffer(b)
258         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
259         m.SrcAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
260         copy(m.SrcAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
261         m.DstAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
262         copy(m.DstAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
263         m.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
264         m.EncapVrfID = buf.DecodeUint32()
265         m.DecapNextIndex = buf.DecodeUint32()
266         m.Teid = buf.DecodeUint32()
267         return nil
268 }
269
270 // GtpuTunnelDump defines message 'gtpu_tunnel_dump'.
271 type GtpuTunnelDump struct {
272         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
273 }
274
275 func (m *GtpuTunnelDump) Reset()               { *m = GtpuTunnelDump{} }
276 func (*GtpuTunnelDump) GetMessageName() string { return "gtpu_tunnel_dump" }
277 func (*GtpuTunnelDump) GetCrcString() string   { return "f9e6675e" }
278 func (*GtpuTunnelDump) GetMessageType() api.MessageType {
279         return api.RequestMessage
280 }
281
282 func (m *GtpuTunnelDump) Size() (size int) {
283         if m == nil {
284                 return 0
285         }
286         size += 4 // m.SwIfIndex
287         return size
288 }
289 func (m *GtpuTunnelDump) Marshal(b []byte) ([]byte, error) {
290         if b == nil {
291                 b = make([]byte, m.Size())
292         }
293         buf := codec.NewBuffer(b)
294         buf.EncodeUint32(uint32(m.SwIfIndex))
295         return buf.Bytes(), nil
296 }
297 func (m *GtpuTunnelDump) Unmarshal(b []byte) error {
298         buf := codec.NewBuffer(b)
299         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
300         return nil
301 }
302
303 // SwInterfaceSetGtpuBypass defines message 'sw_interface_set_gtpu_bypass'.
304 type SwInterfaceSetGtpuBypass struct {
305         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
306         IsIPv6    bool                           `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"`
307         Enable    bool                           `binapi:"bool,name=enable" json:"enable,omitempty"`
308 }
309
310 func (m *SwInterfaceSetGtpuBypass) Reset()               { *m = SwInterfaceSetGtpuBypass{} }
311 func (*SwInterfaceSetGtpuBypass) GetMessageName() string { return "sw_interface_set_gtpu_bypass" }
312 func (*SwInterfaceSetGtpuBypass) GetCrcString() string   { return "65247409" }
313 func (*SwInterfaceSetGtpuBypass) GetMessageType() api.MessageType {
314         return api.RequestMessage
315 }
316
317 func (m *SwInterfaceSetGtpuBypass) Size() (size int) {
318         if m == nil {
319                 return 0
320         }
321         size += 4 // m.SwIfIndex
322         size += 1 // m.IsIPv6
323         size += 1 // m.Enable
324         return size
325 }
326 func (m *SwInterfaceSetGtpuBypass) Marshal(b []byte) ([]byte, error) {
327         if b == nil {
328                 b = make([]byte, m.Size())
329         }
330         buf := codec.NewBuffer(b)
331         buf.EncodeUint32(uint32(m.SwIfIndex))
332         buf.EncodeBool(m.IsIPv6)
333         buf.EncodeBool(m.Enable)
334         return buf.Bytes(), nil
335 }
336 func (m *SwInterfaceSetGtpuBypass) Unmarshal(b []byte) error {
337         buf := codec.NewBuffer(b)
338         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
339         m.IsIPv6 = buf.DecodeBool()
340         m.Enable = buf.DecodeBool()
341         return nil
342 }
343
344 // SwInterfaceSetGtpuBypassReply defines message 'sw_interface_set_gtpu_bypass_reply'.
345 type SwInterfaceSetGtpuBypassReply struct {
346         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
347 }
348
349 func (m *SwInterfaceSetGtpuBypassReply) Reset() { *m = SwInterfaceSetGtpuBypassReply{} }
350 func (*SwInterfaceSetGtpuBypassReply) GetMessageName() string {
351         return "sw_interface_set_gtpu_bypass_reply"
352 }
353 func (*SwInterfaceSetGtpuBypassReply) GetCrcString() string { return "e8d4e804" }
354 func (*SwInterfaceSetGtpuBypassReply) GetMessageType() api.MessageType {
355         return api.ReplyMessage
356 }
357
358 func (m *SwInterfaceSetGtpuBypassReply) Size() (size int) {
359         if m == nil {
360                 return 0
361         }
362         size += 4 // m.Retval
363         return size
364 }
365 func (m *SwInterfaceSetGtpuBypassReply) Marshal(b []byte) ([]byte, error) {
366         if b == nil {
367                 b = make([]byte, m.Size())
368         }
369         buf := codec.NewBuffer(b)
370         buf.EncodeInt32(m.Retval)
371         return buf.Bytes(), nil
372 }
373 func (m *SwInterfaceSetGtpuBypassReply) Unmarshal(b []byte) error {
374         buf := codec.NewBuffer(b)
375         m.Retval = buf.DecodeInt32()
376         return nil
377 }
378
379 func init() { file_gtpu_binapi_init() }
380 func file_gtpu_binapi_init() {
381         api.RegisterMessage((*GtpuAddDelTunnel)(nil), "gtpu_add_del_tunnel_9a26a51c")
382         api.RegisterMessage((*GtpuAddDelTunnelReply)(nil), "gtpu_add_del_tunnel_reply_5383d31f")
383         api.RegisterMessage((*GtpuOffloadRx)(nil), "gtpu_offload_rx_f0b08786")
384         api.RegisterMessage((*GtpuOffloadRxReply)(nil), "gtpu_offload_rx_reply_e8d4e804")
385         api.RegisterMessage((*GtpuTunnelDetails)(nil), "gtpu_tunnel_details_a4d81a09")
386         api.RegisterMessage((*GtpuTunnelDump)(nil), "gtpu_tunnel_dump_f9e6675e")
387         api.RegisterMessage((*SwInterfaceSetGtpuBypass)(nil), "sw_interface_set_gtpu_bypass_65247409")
388         api.RegisterMessage((*SwInterfaceSetGtpuBypassReply)(nil), "sw_interface_set_gtpu_bypass_reply_e8d4e804")
389 }
390
391 // Messages returns list of all messages in this module.
392 func AllMessages() []api.Message {
393         return []api.Message{
394                 (*GtpuAddDelTunnel)(nil),
395                 (*GtpuAddDelTunnelReply)(nil),
396                 (*GtpuOffloadRx)(nil),
397                 (*GtpuOffloadRxReply)(nil),
398                 (*GtpuTunnelDetails)(nil),
399                 (*GtpuTunnelDump)(nil),
400                 (*SwInterfaceSetGtpuBypass)(nil),
401                 (*SwInterfaceSetGtpuBypassReply)(nil),
402         }
403 }