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