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