binapigen: fix union size
[govpp.git] / binapi / l3xc / l3xc.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/l3xc.api.json
6
7 // Package l3xc contains generated bindings for API file l3xc.api.
8 //
9 // Contents:
10 //   1 struct
11 //   8 messages
12 //
13 package l3xc
14
15 import (
16         api "git.fd.io/govpp.git/api"
17         fib_types "git.fd.io/govpp.git/binapi/fib_types"
18         interface_types "git.fd.io/govpp.git/binapi/interface_types"
19         _ "git.fd.io/govpp.git/binapi/ip_types"
20         codec "git.fd.io/govpp.git/codec"
21 )
22
23 // This is a compile-time assertion to ensure that this generated file
24 // is compatible with the GoVPP api package it is being compiled against.
25 // A compilation error at this line likely means your copy of the
26 // GoVPP api package needs to be updated.
27 const _ = api.GoVppAPIPackageIsVersion2
28
29 const (
30         APIFile    = "l3xc"
31         APIVersion = "1.0.1"
32         VersionCrc = 0xaf18effb
33 )
34
35 // L3xc defines type 'l3xc'.
36 type L3xc struct {
37         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
38         IsIP6     bool                           `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"`
39         NPaths    uint8                          `binapi:"u8,name=n_paths" json:"-"`
40         Paths     []fib_types.FibPath            `binapi:"fib_path[n_paths],name=paths" json:"paths,omitempty"`
41 }
42
43 // L3xcDel defines message 'l3xc_del'.
44 type L3xcDel struct {
45         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
46         IsIP6     bool                           `binapi:"bool,name=is_ip6" json:"is_ip6,omitempty"`
47 }
48
49 func (m *L3xcDel) Reset()               { *m = L3xcDel{} }
50 func (*L3xcDel) GetMessageName() string { return "l3xc_del" }
51 func (*L3xcDel) GetCrcString() string   { return "e7dbef91" }
52 func (*L3xcDel) GetMessageType() api.MessageType {
53         return api.RequestMessage
54 }
55
56 func (m *L3xcDel) Size() (size int) {
57         if m == nil {
58                 return 0
59         }
60         size += 4 // m.SwIfIndex
61         size += 1 // m.IsIP6
62         return size
63 }
64 func (m *L3xcDel) Marshal(b []byte) ([]byte, error) {
65         if b == nil {
66                 b = make([]byte, m.Size())
67         }
68         buf := codec.NewBuffer(b)
69         buf.EncodeUint32(uint32(m.SwIfIndex))
70         buf.EncodeBool(m.IsIP6)
71         return buf.Bytes(), nil
72 }
73 func (m *L3xcDel) Unmarshal(b []byte) error {
74         buf := codec.NewBuffer(b)
75         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
76         m.IsIP6 = buf.DecodeBool()
77         return nil
78 }
79
80 // L3xcDelReply defines message 'l3xc_del_reply'.
81 type L3xcDelReply struct {
82         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
83 }
84
85 func (m *L3xcDelReply) Reset()               { *m = L3xcDelReply{} }
86 func (*L3xcDelReply) GetMessageName() string { return "l3xc_del_reply" }
87 func (*L3xcDelReply) GetCrcString() string   { return "e8d4e804" }
88 func (*L3xcDelReply) GetMessageType() api.MessageType {
89         return api.ReplyMessage
90 }
91
92 func (m *L3xcDelReply) Size() (size int) {
93         if m == nil {
94                 return 0
95         }
96         size += 4 // m.Retval
97         return size
98 }
99 func (m *L3xcDelReply) Marshal(b []byte) ([]byte, error) {
100         if b == nil {
101                 b = make([]byte, m.Size())
102         }
103         buf := codec.NewBuffer(b)
104         buf.EncodeInt32(m.Retval)
105         return buf.Bytes(), nil
106 }
107 func (m *L3xcDelReply) Unmarshal(b []byte) error {
108         buf := codec.NewBuffer(b)
109         m.Retval = buf.DecodeInt32()
110         return nil
111 }
112
113 // L3xcDetails defines message 'l3xc_details'.
114 type L3xcDetails struct {
115         L3xc L3xc `binapi:"l3xc,name=l3xc" json:"l3xc,omitempty"`
116 }
117
118 func (m *L3xcDetails) Reset()               { *m = L3xcDetails{} }
119 func (*L3xcDetails) GetMessageName() string { return "l3xc_details" }
120 func (*L3xcDetails) GetCrcString() string   { return "d4f69627" }
121 func (*L3xcDetails) GetMessageType() api.MessageType {
122         return api.ReplyMessage
123 }
124
125 func (m *L3xcDetails) Size() (size int) {
126         if m == nil {
127                 return 0
128         }
129         size += 4 // m.L3xc.SwIfIndex
130         size += 1 // m.L3xc.IsIP6
131         size += 1 // m.L3xc.NPaths
132         for j2 := 0; j2 < len(m.L3xc.Paths); j2++ {
133                 var s2 fib_types.FibPath
134                 _ = s2
135                 if j2 < len(m.L3xc.Paths) {
136                         s2 = m.L3xc.Paths[j2]
137                 }
138                 size += 4      // s2.SwIfIndex
139                 size += 4      // s2.TableID
140                 size += 4      // s2.RpfID
141                 size += 1      // s2.Weight
142                 size += 1      // s2.Preference
143                 size += 4      // s2.Type
144                 size += 4      // s2.Flags
145                 size += 4      // s2.Proto
146                 size += 1 * 16 // s2.Nh.Address
147                 size += 4      // s2.Nh.ViaLabel
148                 size += 4      // s2.Nh.ObjID
149                 size += 4      // s2.Nh.ClassifyTableIndex
150                 size += 1      // s2.NLabels
151                 for j3 := 0; j3 < 16; j3++ {
152                         size += 1 // s2.LabelStack[j3].IsUniform
153                         size += 4 // s2.LabelStack[j3].Label
154                         size += 1 // s2.LabelStack[j3].TTL
155                         size += 1 // s2.LabelStack[j3].Exp
156                 }
157         }
158         return size
159 }
160 func (m *L3xcDetails) Marshal(b []byte) ([]byte, error) {
161         if b == nil {
162                 b = make([]byte, m.Size())
163         }
164         buf := codec.NewBuffer(b)
165         buf.EncodeUint32(uint32(m.L3xc.SwIfIndex))
166         buf.EncodeBool(m.L3xc.IsIP6)
167         buf.EncodeUint8(uint8(len(m.L3xc.Paths)))
168         for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
169                 var v1 fib_types.FibPath // Paths
170                 if j1 < len(m.L3xc.Paths) {
171                         v1 = m.L3xc.Paths[j1]
172                 }
173                 buf.EncodeUint32(v1.SwIfIndex)
174                 buf.EncodeUint32(v1.TableID)
175                 buf.EncodeUint32(v1.RpfID)
176                 buf.EncodeUint8(v1.Weight)
177                 buf.EncodeUint8(v1.Preference)
178                 buf.EncodeUint32(uint32(v1.Type))
179                 buf.EncodeUint32(uint32(v1.Flags))
180                 buf.EncodeUint32(uint32(v1.Proto))
181                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
182                 buf.EncodeUint32(v1.Nh.ViaLabel)
183                 buf.EncodeUint32(v1.Nh.ObjID)
184                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
185                 buf.EncodeUint8(v1.NLabels)
186                 for j2 := 0; j2 < 16; j2++ {
187                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
188                         buf.EncodeUint32(v1.LabelStack[j2].Label)
189                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
190                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
191                 }
192         }
193         return buf.Bytes(), nil
194 }
195 func (m *L3xcDetails) Unmarshal(b []byte) error {
196         buf := codec.NewBuffer(b)
197         m.L3xc.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
198         m.L3xc.IsIP6 = buf.DecodeBool()
199         m.L3xc.NPaths = buf.DecodeUint8()
200         m.L3xc.Paths = make([]fib_types.FibPath, m.L3xc.NPaths)
201         for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
202                 m.L3xc.Paths[j1].SwIfIndex = buf.DecodeUint32()
203                 m.L3xc.Paths[j1].TableID = buf.DecodeUint32()
204                 m.L3xc.Paths[j1].RpfID = buf.DecodeUint32()
205                 m.L3xc.Paths[j1].Weight = buf.DecodeUint8()
206                 m.L3xc.Paths[j1].Preference = buf.DecodeUint8()
207                 m.L3xc.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32())
208                 m.L3xc.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32())
209                 m.L3xc.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32())
210                 copy(m.L3xc.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
211                 m.L3xc.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
212                 m.L3xc.Paths[j1].Nh.ObjID = buf.DecodeUint32()
213                 m.L3xc.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
214                 m.L3xc.Paths[j1].NLabels = buf.DecodeUint8()
215                 for j2 := 0; j2 < 16; j2++ {
216                         m.L3xc.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
217                         m.L3xc.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
218                         m.L3xc.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
219                         m.L3xc.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
220                 }
221         }
222         return nil
223 }
224
225 // L3xcDump defines message 'l3xc_dump'.
226 type L3xcDump struct {
227         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
228 }
229
230 func (m *L3xcDump) Reset()               { *m = L3xcDump{} }
231 func (*L3xcDump) GetMessageName() string { return "l3xc_dump" }
232 func (*L3xcDump) GetCrcString() string   { return "f9e6675e" }
233 func (*L3xcDump) GetMessageType() api.MessageType {
234         return api.RequestMessage
235 }
236
237 func (m *L3xcDump) Size() (size int) {
238         if m == nil {
239                 return 0
240         }
241         size += 4 // m.SwIfIndex
242         return size
243 }
244 func (m *L3xcDump) Marshal(b []byte) ([]byte, error) {
245         if b == nil {
246                 b = make([]byte, m.Size())
247         }
248         buf := codec.NewBuffer(b)
249         buf.EncodeUint32(uint32(m.SwIfIndex))
250         return buf.Bytes(), nil
251 }
252 func (m *L3xcDump) Unmarshal(b []byte) error {
253         buf := codec.NewBuffer(b)
254         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
255         return nil
256 }
257
258 // L3xcPluginGetVersion defines message 'l3xc_plugin_get_version'.
259 type L3xcPluginGetVersion struct{}
260
261 func (m *L3xcPluginGetVersion) Reset()               { *m = L3xcPluginGetVersion{} }
262 func (*L3xcPluginGetVersion) GetMessageName() string { return "l3xc_plugin_get_version" }
263 func (*L3xcPluginGetVersion) GetCrcString() string   { return "51077d14" }
264 func (*L3xcPluginGetVersion) GetMessageType() api.MessageType {
265         return api.RequestMessage
266 }
267
268 func (m *L3xcPluginGetVersion) Size() (size int) {
269         if m == nil {
270                 return 0
271         }
272         return size
273 }
274 func (m *L3xcPluginGetVersion) Marshal(b []byte) ([]byte, error) {
275         if b == nil {
276                 b = make([]byte, m.Size())
277         }
278         buf := codec.NewBuffer(b)
279         return buf.Bytes(), nil
280 }
281 func (m *L3xcPluginGetVersion) Unmarshal(b []byte) error {
282         return nil
283 }
284
285 // L3xcPluginGetVersionReply defines message 'l3xc_plugin_get_version_reply'.
286 type L3xcPluginGetVersionReply struct {
287         Major uint32 `binapi:"u32,name=major" json:"major,omitempty"`
288         Minor uint32 `binapi:"u32,name=minor" json:"minor,omitempty"`
289 }
290
291 func (m *L3xcPluginGetVersionReply) Reset()               { *m = L3xcPluginGetVersionReply{} }
292 func (*L3xcPluginGetVersionReply) GetMessageName() string { return "l3xc_plugin_get_version_reply" }
293 func (*L3xcPluginGetVersionReply) GetCrcString() string   { return "9b32cf86" }
294 func (*L3xcPluginGetVersionReply) GetMessageType() api.MessageType {
295         return api.ReplyMessage
296 }
297
298 func (m *L3xcPluginGetVersionReply) Size() (size int) {
299         if m == nil {
300                 return 0
301         }
302         size += 4 // m.Major
303         size += 4 // m.Minor
304         return size
305 }
306 func (m *L3xcPluginGetVersionReply) Marshal(b []byte) ([]byte, error) {
307         if b == nil {
308                 b = make([]byte, m.Size())
309         }
310         buf := codec.NewBuffer(b)
311         buf.EncodeUint32(m.Major)
312         buf.EncodeUint32(m.Minor)
313         return buf.Bytes(), nil
314 }
315 func (m *L3xcPluginGetVersionReply) Unmarshal(b []byte) error {
316         buf := codec.NewBuffer(b)
317         m.Major = buf.DecodeUint32()
318         m.Minor = buf.DecodeUint32()
319         return nil
320 }
321
322 // L3xcUpdate defines message 'l3xc_update'.
323 type L3xcUpdate struct {
324         L3xc L3xc `binapi:"l3xc,name=l3xc" json:"l3xc,omitempty"`
325 }
326
327 func (m *L3xcUpdate) Reset()               { *m = L3xcUpdate{} }
328 func (*L3xcUpdate) GetMessageName() string { return "l3xc_update" }
329 func (*L3xcUpdate) GetCrcString() string   { return "0787b1d3" }
330 func (*L3xcUpdate) GetMessageType() api.MessageType {
331         return api.RequestMessage
332 }
333
334 func (m *L3xcUpdate) Size() (size int) {
335         if m == nil {
336                 return 0
337         }
338         size += 4 // m.L3xc.SwIfIndex
339         size += 1 // m.L3xc.IsIP6
340         size += 1 // m.L3xc.NPaths
341         for j2 := 0; j2 < len(m.L3xc.Paths); j2++ {
342                 var s2 fib_types.FibPath
343                 _ = s2
344                 if j2 < len(m.L3xc.Paths) {
345                         s2 = m.L3xc.Paths[j2]
346                 }
347                 size += 4      // s2.SwIfIndex
348                 size += 4      // s2.TableID
349                 size += 4      // s2.RpfID
350                 size += 1      // s2.Weight
351                 size += 1      // s2.Preference
352                 size += 4      // s2.Type
353                 size += 4      // s2.Flags
354                 size += 4      // s2.Proto
355                 size += 1 * 16 // s2.Nh.Address
356                 size += 4      // s2.Nh.ViaLabel
357                 size += 4      // s2.Nh.ObjID
358                 size += 4      // s2.Nh.ClassifyTableIndex
359                 size += 1      // s2.NLabels
360                 for j3 := 0; j3 < 16; j3++ {
361                         size += 1 // s2.LabelStack[j3].IsUniform
362                         size += 4 // s2.LabelStack[j3].Label
363                         size += 1 // s2.LabelStack[j3].TTL
364                         size += 1 // s2.LabelStack[j3].Exp
365                 }
366         }
367         return size
368 }
369 func (m *L3xcUpdate) Marshal(b []byte) ([]byte, error) {
370         if b == nil {
371                 b = make([]byte, m.Size())
372         }
373         buf := codec.NewBuffer(b)
374         buf.EncodeUint32(uint32(m.L3xc.SwIfIndex))
375         buf.EncodeBool(m.L3xc.IsIP6)
376         buf.EncodeUint8(uint8(len(m.L3xc.Paths)))
377         for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
378                 var v1 fib_types.FibPath // Paths
379                 if j1 < len(m.L3xc.Paths) {
380                         v1 = m.L3xc.Paths[j1]
381                 }
382                 buf.EncodeUint32(v1.SwIfIndex)
383                 buf.EncodeUint32(v1.TableID)
384                 buf.EncodeUint32(v1.RpfID)
385                 buf.EncodeUint8(v1.Weight)
386                 buf.EncodeUint8(v1.Preference)
387                 buf.EncodeUint32(uint32(v1.Type))
388                 buf.EncodeUint32(uint32(v1.Flags))
389                 buf.EncodeUint32(uint32(v1.Proto))
390                 buf.EncodeBytes(v1.Nh.Address.XXX_UnionData[:], 16)
391                 buf.EncodeUint32(v1.Nh.ViaLabel)
392                 buf.EncodeUint32(v1.Nh.ObjID)
393                 buf.EncodeUint32(v1.Nh.ClassifyTableIndex)
394                 buf.EncodeUint8(v1.NLabels)
395                 for j2 := 0; j2 < 16; j2++ {
396                         buf.EncodeUint8(v1.LabelStack[j2].IsUniform)
397                         buf.EncodeUint32(v1.LabelStack[j2].Label)
398                         buf.EncodeUint8(v1.LabelStack[j2].TTL)
399                         buf.EncodeUint8(v1.LabelStack[j2].Exp)
400                 }
401         }
402         return buf.Bytes(), nil
403 }
404 func (m *L3xcUpdate) Unmarshal(b []byte) error {
405         buf := codec.NewBuffer(b)
406         m.L3xc.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
407         m.L3xc.IsIP6 = buf.DecodeBool()
408         m.L3xc.NPaths = buf.DecodeUint8()
409         m.L3xc.Paths = make([]fib_types.FibPath, m.L3xc.NPaths)
410         for j1 := 0; j1 < len(m.L3xc.Paths); j1++ {
411                 m.L3xc.Paths[j1].SwIfIndex = buf.DecodeUint32()
412                 m.L3xc.Paths[j1].TableID = buf.DecodeUint32()
413                 m.L3xc.Paths[j1].RpfID = buf.DecodeUint32()
414                 m.L3xc.Paths[j1].Weight = buf.DecodeUint8()
415                 m.L3xc.Paths[j1].Preference = buf.DecodeUint8()
416                 m.L3xc.Paths[j1].Type = fib_types.FibPathType(buf.DecodeUint32())
417                 m.L3xc.Paths[j1].Flags = fib_types.FibPathFlags(buf.DecodeUint32())
418                 m.L3xc.Paths[j1].Proto = fib_types.FibPathNhProto(buf.DecodeUint32())
419                 copy(m.L3xc.Paths[j1].Nh.Address.XXX_UnionData[:], buf.DecodeBytes(16))
420                 m.L3xc.Paths[j1].Nh.ViaLabel = buf.DecodeUint32()
421                 m.L3xc.Paths[j1].Nh.ObjID = buf.DecodeUint32()
422                 m.L3xc.Paths[j1].Nh.ClassifyTableIndex = buf.DecodeUint32()
423                 m.L3xc.Paths[j1].NLabels = buf.DecodeUint8()
424                 for j2 := 0; j2 < 16; j2++ {
425                         m.L3xc.Paths[j1].LabelStack[j2].IsUniform = buf.DecodeUint8()
426                         m.L3xc.Paths[j1].LabelStack[j2].Label = buf.DecodeUint32()
427                         m.L3xc.Paths[j1].LabelStack[j2].TTL = buf.DecodeUint8()
428                         m.L3xc.Paths[j1].LabelStack[j2].Exp = buf.DecodeUint8()
429                 }
430         }
431         return nil
432 }
433
434 // L3xcUpdateReply defines message 'l3xc_update_reply'.
435 type L3xcUpdateReply struct {
436         Retval     int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
437         StatsIndex uint32 `binapi:"u32,name=stats_index" json:"stats_index,omitempty"`
438 }
439
440 func (m *L3xcUpdateReply) Reset()               { *m = L3xcUpdateReply{} }
441 func (*L3xcUpdateReply) GetMessageName() string { return "l3xc_update_reply" }
442 func (*L3xcUpdateReply) GetCrcString() string   { return "1992deab" }
443 func (*L3xcUpdateReply) GetMessageType() api.MessageType {
444         return api.ReplyMessage
445 }
446
447 func (m *L3xcUpdateReply) Size() (size int) {
448         if m == nil {
449                 return 0
450         }
451         size += 4 // m.Retval
452         size += 4 // m.StatsIndex
453         return size
454 }
455 func (m *L3xcUpdateReply) Marshal(b []byte) ([]byte, error) {
456         if b == nil {
457                 b = make([]byte, m.Size())
458         }
459         buf := codec.NewBuffer(b)
460         buf.EncodeInt32(m.Retval)
461         buf.EncodeUint32(m.StatsIndex)
462         return buf.Bytes(), nil
463 }
464 func (m *L3xcUpdateReply) Unmarshal(b []byte) error {
465         buf := codec.NewBuffer(b)
466         m.Retval = buf.DecodeInt32()
467         m.StatsIndex = buf.DecodeUint32()
468         return nil
469 }
470
471 func init() { file_l3xc_binapi_init() }
472 func file_l3xc_binapi_init() {
473         api.RegisterMessage((*L3xcDel)(nil), "l3xc_del_e7dbef91")
474         api.RegisterMessage((*L3xcDelReply)(nil), "l3xc_del_reply_e8d4e804")
475         api.RegisterMessage((*L3xcDetails)(nil), "l3xc_details_d4f69627")
476         api.RegisterMessage((*L3xcDump)(nil), "l3xc_dump_f9e6675e")
477         api.RegisterMessage((*L3xcPluginGetVersion)(nil), "l3xc_plugin_get_version_51077d14")
478         api.RegisterMessage((*L3xcPluginGetVersionReply)(nil), "l3xc_plugin_get_version_reply_9b32cf86")
479         api.RegisterMessage((*L3xcUpdate)(nil), "l3xc_update_0787b1d3")
480         api.RegisterMessage((*L3xcUpdateReply)(nil), "l3xc_update_reply_1992deab")
481 }
482
483 // Messages returns list of all messages in this module.
484 func AllMessages() []api.Message {
485         return []api.Message{
486                 (*L3xcDel)(nil),
487                 (*L3xcDelReply)(nil),
488                 (*L3xcDetails)(nil),
489                 (*L3xcDump)(nil),
490                 (*L3xcPluginGetVersion)(nil),
491                 (*L3xcPluginGetVersionReply)(nil),
492                 (*L3xcUpdate)(nil),
493                 (*L3xcUpdateReply)(nil),
494         }
495 }