binapigen: fix union size
[govpp.git] / binapi / vxlan_gbp / vxlan_gbp.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_gbp.api.json
6
7 // Package vxlan_gbp contains generated bindings for API file vxlan_gbp.api.
8 //
9 // Contents:
10 //   1 enum
11 //   1 struct
12 //   6 messages
13 //
14 package vxlan_gbp
15
16 import (
17         "strconv"
18
19         api "git.fd.io/govpp.git/api"
20         interface_types "git.fd.io/govpp.git/binapi/interface_types"
21         ip_types "git.fd.io/govpp.git/binapi/ip_types"
22         codec "git.fd.io/govpp.git/codec"
23 )
24
25 // This is a compile-time assertion to ensure that this generated file
26 // is compatible with the GoVPP api package it is being compiled against.
27 // A compilation error at this line likely means your copy of the
28 // GoVPP api package needs to be updated.
29 const _ = api.GoVppAPIPackageIsVersion2
30
31 const (
32         APIFile    = "vxlan_gbp"
33         APIVersion = "1.1.1"
34         VersionCrc = 0xfa8aff54
35 )
36
37 // VxlanGbpAPITunnelMode defines enum 'vxlan_gbp_api_tunnel_mode'.
38 type VxlanGbpAPITunnelMode uint32
39
40 const (
41         VXLAN_GBP_API_TUNNEL_MODE_L2 VxlanGbpAPITunnelMode = 1
42         VXLAN_GBP_API_TUNNEL_MODE_L3 VxlanGbpAPITunnelMode = 2
43 )
44
45 var (
46         VxlanGbpAPITunnelMode_name = map[uint32]string{
47                 1: "VXLAN_GBP_API_TUNNEL_MODE_L2",
48                 2: "VXLAN_GBP_API_TUNNEL_MODE_L3",
49         }
50         VxlanGbpAPITunnelMode_value = map[string]uint32{
51                 "VXLAN_GBP_API_TUNNEL_MODE_L2": 1,
52                 "VXLAN_GBP_API_TUNNEL_MODE_L3": 2,
53         }
54 )
55
56 func (x VxlanGbpAPITunnelMode) String() string {
57         s, ok := VxlanGbpAPITunnelMode_name[uint32(x)]
58         if ok {
59                 return s
60         }
61         return "VxlanGbpAPITunnelMode(" + strconv.Itoa(int(x)) + ")"
62 }
63
64 // VxlanGbpTunnel defines type 'vxlan_gbp_tunnel'.
65 type VxlanGbpTunnel struct {
66         Instance       uint32                         `binapi:"u32,name=instance" json:"instance,omitempty"`
67         Src            ip_types.Address               `binapi:"address,name=src" json:"src,omitempty"`
68         Dst            ip_types.Address               `binapi:"address,name=dst" json:"dst,omitempty"`
69         McastSwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=mcast_sw_if_index" json:"mcast_sw_if_index,omitempty"`
70         EncapTableID   uint32                         `binapi:"u32,name=encap_table_id" json:"encap_table_id,omitempty"`
71         Vni            uint32                         `binapi:"u32,name=vni" json:"vni,omitempty"`
72         SwIfIndex      interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
73         Mode           VxlanGbpAPITunnelMode          `binapi:"vxlan_gbp_api_tunnel_mode,name=mode" json:"mode,omitempty"`
74 }
75
76 // SwInterfaceSetVxlanGbpBypass defines message 'sw_interface_set_vxlan_gbp_bypass'.
77 type SwInterfaceSetVxlanGbpBypass struct {
78         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
79         IsIPv6    bool                           `binapi:"bool,name=is_ipv6" json:"is_ipv6,omitempty"`
80         Enable    bool                           `binapi:"bool,name=enable,default=true" json:"enable,omitempty"`
81 }
82
83 func (m *SwInterfaceSetVxlanGbpBypass) Reset() { *m = SwInterfaceSetVxlanGbpBypass{} }
84 func (*SwInterfaceSetVxlanGbpBypass) GetMessageName() string {
85         return "sw_interface_set_vxlan_gbp_bypass"
86 }
87 func (*SwInterfaceSetVxlanGbpBypass) GetCrcString() string { return "65247409" }
88 func (*SwInterfaceSetVxlanGbpBypass) GetMessageType() api.MessageType {
89         return api.RequestMessage
90 }
91
92 func (m *SwInterfaceSetVxlanGbpBypass) Size() (size int) {
93         if m == nil {
94                 return 0
95         }
96         size += 4 // m.SwIfIndex
97         size += 1 // m.IsIPv6
98         size += 1 // m.Enable
99         return size
100 }
101 func (m *SwInterfaceSetVxlanGbpBypass) Marshal(b []byte) ([]byte, error) {
102         if b == nil {
103                 b = make([]byte, m.Size())
104         }
105         buf := codec.NewBuffer(b)
106         buf.EncodeUint32(uint32(m.SwIfIndex))
107         buf.EncodeBool(m.IsIPv6)
108         buf.EncodeBool(m.Enable)
109         return buf.Bytes(), nil
110 }
111 func (m *SwInterfaceSetVxlanGbpBypass) Unmarshal(b []byte) error {
112         buf := codec.NewBuffer(b)
113         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
114         m.IsIPv6 = buf.DecodeBool()
115         m.Enable = buf.DecodeBool()
116         return nil
117 }
118
119 // SwInterfaceSetVxlanGbpBypassReply defines message 'sw_interface_set_vxlan_gbp_bypass_reply'.
120 type SwInterfaceSetVxlanGbpBypassReply struct {
121         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
122 }
123
124 func (m *SwInterfaceSetVxlanGbpBypassReply) Reset() { *m = SwInterfaceSetVxlanGbpBypassReply{} }
125 func (*SwInterfaceSetVxlanGbpBypassReply) GetMessageName() string {
126         return "sw_interface_set_vxlan_gbp_bypass_reply"
127 }
128 func (*SwInterfaceSetVxlanGbpBypassReply) GetCrcString() string { return "e8d4e804" }
129 func (*SwInterfaceSetVxlanGbpBypassReply) GetMessageType() api.MessageType {
130         return api.ReplyMessage
131 }
132
133 func (m *SwInterfaceSetVxlanGbpBypassReply) Size() (size int) {
134         if m == nil {
135                 return 0
136         }
137         size += 4 // m.Retval
138         return size
139 }
140 func (m *SwInterfaceSetVxlanGbpBypassReply) Marshal(b []byte) ([]byte, error) {
141         if b == nil {
142                 b = make([]byte, m.Size())
143         }
144         buf := codec.NewBuffer(b)
145         buf.EncodeInt32(m.Retval)
146         return buf.Bytes(), nil
147 }
148 func (m *SwInterfaceSetVxlanGbpBypassReply) Unmarshal(b []byte) error {
149         buf := codec.NewBuffer(b)
150         m.Retval = buf.DecodeInt32()
151         return nil
152 }
153
154 // VxlanGbpTunnelAddDel defines message 'vxlan_gbp_tunnel_add_del'.
155 type VxlanGbpTunnelAddDel struct {
156         IsAdd  bool           `binapi:"bool,name=is_add,default=true" json:"is_add,omitempty"`
157         Tunnel VxlanGbpTunnel `binapi:"vxlan_gbp_tunnel,name=tunnel" json:"tunnel,omitempty"`
158 }
159
160 func (m *VxlanGbpTunnelAddDel) Reset()               { *m = VxlanGbpTunnelAddDel{} }
161 func (*VxlanGbpTunnelAddDel) GetMessageName() string { return "vxlan_gbp_tunnel_add_del" }
162 func (*VxlanGbpTunnelAddDel) GetCrcString() string   { return "8c819166" }
163 func (*VxlanGbpTunnelAddDel) GetMessageType() api.MessageType {
164         return api.RequestMessage
165 }
166
167 func (m *VxlanGbpTunnelAddDel) Size() (size int) {
168         if m == nil {
169                 return 0
170         }
171         size += 1      // m.IsAdd
172         size += 4      // m.Tunnel.Instance
173         size += 1      // m.Tunnel.Src.Af
174         size += 1 * 16 // m.Tunnel.Src.Un
175         size += 1      // m.Tunnel.Dst.Af
176         size += 1 * 16 // m.Tunnel.Dst.Un
177         size += 4      // m.Tunnel.McastSwIfIndex
178         size += 4      // m.Tunnel.EncapTableID
179         size += 4      // m.Tunnel.Vni
180         size += 4      // m.Tunnel.SwIfIndex
181         size += 4      // m.Tunnel.Mode
182         return size
183 }
184 func (m *VxlanGbpTunnelAddDel) Marshal(b []byte) ([]byte, error) {
185         if b == nil {
186                 b = make([]byte, m.Size())
187         }
188         buf := codec.NewBuffer(b)
189         buf.EncodeBool(m.IsAdd)
190         buf.EncodeUint32(m.Tunnel.Instance)
191         buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
192         buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
193         buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
194         buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
195         buf.EncodeUint32(uint32(m.Tunnel.McastSwIfIndex))
196         buf.EncodeUint32(m.Tunnel.EncapTableID)
197         buf.EncodeUint32(m.Tunnel.Vni)
198         buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
199         buf.EncodeUint32(uint32(m.Tunnel.Mode))
200         return buf.Bytes(), nil
201 }
202 func (m *VxlanGbpTunnelAddDel) Unmarshal(b []byte) error {
203         buf := codec.NewBuffer(b)
204         m.IsAdd = buf.DecodeBool()
205         m.Tunnel.Instance = buf.DecodeUint32()
206         m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8())
207         copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16))
208         m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
209         copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
210         m.Tunnel.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
211         m.Tunnel.EncapTableID = buf.DecodeUint32()
212         m.Tunnel.Vni = buf.DecodeUint32()
213         m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
214         m.Tunnel.Mode = VxlanGbpAPITunnelMode(buf.DecodeUint32())
215         return nil
216 }
217
218 // VxlanGbpTunnelAddDelReply defines message 'vxlan_gbp_tunnel_add_del_reply'.
219 type VxlanGbpTunnelAddDelReply struct {
220         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
221         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
222 }
223
224 func (m *VxlanGbpTunnelAddDelReply) Reset()               { *m = VxlanGbpTunnelAddDelReply{} }
225 func (*VxlanGbpTunnelAddDelReply) GetMessageName() string { return "vxlan_gbp_tunnel_add_del_reply" }
226 func (*VxlanGbpTunnelAddDelReply) GetCrcString() string   { return "5383d31f" }
227 func (*VxlanGbpTunnelAddDelReply) GetMessageType() api.MessageType {
228         return api.ReplyMessage
229 }
230
231 func (m *VxlanGbpTunnelAddDelReply) Size() (size int) {
232         if m == nil {
233                 return 0
234         }
235         size += 4 // m.Retval
236         size += 4 // m.SwIfIndex
237         return size
238 }
239 func (m *VxlanGbpTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
240         if b == nil {
241                 b = make([]byte, m.Size())
242         }
243         buf := codec.NewBuffer(b)
244         buf.EncodeInt32(m.Retval)
245         buf.EncodeUint32(uint32(m.SwIfIndex))
246         return buf.Bytes(), nil
247 }
248 func (m *VxlanGbpTunnelAddDelReply) Unmarshal(b []byte) error {
249         buf := codec.NewBuffer(b)
250         m.Retval = buf.DecodeInt32()
251         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
252         return nil
253 }
254
255 // VxlanGbpTunnelDetails defines message 'vxlan_gbp_tunnel_details'.
256 type VxlanGbpTunnelDetails struct {
257         Tunnel VxlanGbpTunnel `binapi:"vxlan_gbp_tunnel,name=tunnel" json:"tunnel,omitempty"`
258 }
259
260 func (m *VxlanGbpTunnelDetails) Reset()               { *m = VxlanGbpTunnelDetails{} }
261 func (*VxlanGbpTunnelDetails) GetMessageName() string { return "vxlan_gbp_tunnel_details" }
262 func (*VxlanGbpTunnelDetails) GetCrcString() string   { return "1da24016" }
263 func (*VxlanGbpTunnelDetails) GetMessageType() api.MessageType {
264         return api.ReplyMessage
265 }
266
267 func (m *VxlanGbpTunnelDetails) Size() (size int) {
268         if m == nil {
269                 return 0
270         }
271         size += 4      // m.Tunnel.Instance
272         size += 1      // m.Tunnel.Src.Af
273         size += 1 * 16 // m.Tunnel.Src.Un
274         size += 1      // m.Tunnel.Dst.Af
275         size += 1 * 16 // m.Tunnel.Dst.Un
276         size += 4      // m.Tunnel.McastSwIfIndex
277         size += 4      // m.Tunnel.EncapTableID
278         size += 4      // m.Tunnel.Vni
279         size += 4      // m.Tunnel.SwIfIndex
280         size += 4      // m.Tunnel.Mode
281         return size
282 }
283 func (m *VxlanGbpTunnelDetails) Marshal(b []byte) ([]byte, error) {
284         if b == nil {
285                 b = make([]byte, m.Size())
286         }
287         buf := codec.NewBuffer(b)
288         buf.EncodeUint32(m.Tunnel.Instance)
289         buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
290         buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
291         buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
292         buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
293         buf.EncodeUint32(uint32(m.Tunnel.McastSwIfIndex))
294         buf.EncodeUint32(m.Tunnel.EncapTableID)
295         buf.EncodeUint32(m.Tunnel.Vni)
296         buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
297         buf.EncodeUint32(uint32(m.Tunnel.Mode))
298         return buf.Bytes(), nil
299 }
300 func (m *VxlanGbpTunnelDetails) Unmarshal(b []byte) error {
301         buf := codec.NewBuffer(b)
302         m.Tunnel.Instance = buf.DecodeUint32()
303         m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8())
304         copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16))
305         m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
306         copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
307         m.Tunnel.McastSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
308         m.Tunnel.EncapTableID = buf.DecodeUint32()
309         m.Tunnel.Vni = buf.DecodeUint32()
310         m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
311         m.Tunnel.Mode = VxlanGbpAPITunnelMode(buf.DecodeUint32())
312         return nil
313 }
314
315 // VxlanGbpTunnelDump defines message 'vxlan_gbp_tunnel_dump'.
316 type VxlanGbpTunnelDump struct {
317         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index,default=4294967295" json:"sw_if_index,omitempty"`
318 }
319
320 func (m *VxlanGbpTunnelDump) Reset()               { *m = VxlanGbpTunnelDump{} }
321 func (*VxlanGbpTunnelDump) GetMessageName() string { return "vxlan_gbp_tunnel_dump" }
322 func (*VxlanGbpTunnelDump) GetCrcString() string   { return "f9e6675e" }
323 func (*VxlanGbpTunnelDump) GetMessageType() api.MessageType {
324         return api.RequestMessage
325 }
326
327 func (m *VxlanGbpTunnelDump) Size() (size int) {
328         if m == nil {
329                 return 0
330         }
331         size += 4 // m.SwIfIndex
332         return size
333 }
334 func (m *VxlanGbpTunnelDump) Marshal(b []byte) ([]byte, error) {
335         if b == nil {
336                 b = make([]byte, m.Size())
337         }
338         buf := codec.NewBuffer(b)
339         buf.EncodeUint32(uint32(m.SwIfIndex))
340         return buf.Bytes(), nil
341 }
342 func (m *VxlanGbpTunnelDump) Unmarshal(b []byte) error {
343         buf := codec.NewBuffer(b)
344         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
345         return nil
346 }
347
348 func init() { file_vxlan_gbp_binapi_init() }
349 func file_vxlan_gbp_binapi_init() {
350         api.RegisterMessage((*SwInterfaceSetVxlanGbpBypass)(nil), "sw_interface_set_vxlan_gbp_bypass_65247409")
351         api.RegisterMessage((*SwInterfaceSetVxlanGbpBypassReply)(nil), "sw_interface_set_vxlan_gbp_bypass_reply_e8d4e804")
352         api.RegisterMessage((*VxlanGbpTunnelAddDel)(nil), "vxlan_gbp_tunnel_add_del_8c819166")
353         api.RegisterMessage((*VxlanGbpTunnelAddDelReply)(nil), "vxlan_gbp_tunnel_add_del_reply_5383d31f")
354         api.RegisterMessage((*VxlanGbpTunnelDetails)(nil), "vxlan_gbp_tunnel_details_1da24016")
355         api.RegisterMessage((*VxlanGbpTunnelDump)(nil), "vxlan_gbp_tunnel_dump_f9e6675e")
356 }
357
358 // Messages returns list of all messages in this module.
359 func AllMessages() []api.Message {
360         return []api.Message{
361                 (*SwInterfaceSetVxlanGbpBypass)(nil),
362                 (*SwInterfaceSetVxlanGbpBypassReply)(nil),
363                 (*VxlanGbpTunnelAddDel)(nil),
364                 (*VxlanGbpTunnelAddDelReply)(nil),
365                 (*VxlanGbpTunnelDetails)(nil),
366                 (*VxlanGbpTunnelDump)(nil),
367         }
368 }