binapigen: fix union size
[govpp.git] / binapi / nsh / nsh.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/nsh.api.json
6
7 // Package nsh contains generated bindings for API file nsh.api.
8 //
9 // Contents:
10 //   8 messages
11 //
12 package nsh
13
14 import (
15         api "git.fd.io/govpp.git/api"
16         interface_types "git.fd.io/govpp.git/binapi/interface_types"
17         codec "git.fd.io/govpp.git/codec"
18 )
19
20 // This is a compile-time assertion to ensure that this generated file
21 // is compatible with the GoVPP api package it is being compiled against.
22 // A compilation error at this line likely means your copy of the
23 // GoVPP api package needs to be updated.
24 const _ = api.GoVppAPIPackageIsVersion2
25
26 const (
27         APIFile    = "nsh"
28         APIVersion = "1.0.0"
29         VersionCrc = 0x43be6707
30 )
31
32 // NshAddDelEntry defines message 'nsh_add_del_entry'.
33 type NshAddDelEntry struct {
34         IsAdd        bool   `binapi:"bool,name=is_add" json:"is_add,omitempty"`
35         NspNsi       uint32 `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"`
36         MdType       uint8  `binapi:"u8,name=md_type" json:"md_type,omitempty"`
37         VerOC        uint8  `binapi:"u8,name=ver_o_c" json:"ver_o_c,omitempty"`
38         TTL          uint8  `binapi:"u8,name=ttl" json:"ttl,omitempty"`
39         Length       uint8  `binapi:"u8,name=length" json:"length,omitempty"`
40         NextProtocol uint8  `binapi:"u8,name=next_protocol" json:"next_protocol,omitempty"`
41         C1           uint32 `binapi:"u32,name=c1" json:"c1,omitempty"`
42         C2           uint32 `binapi:"u32,name=c2" json:"c2,omitempty"`
43         C3           uint32 `binapi:"u32,name=c3" json:"c3,omitempty"`
44         C4           uint32 `binapi:"u32,name=c4" json:"c4,omitempty"`
45         TlvLength    uint8  `binapi:"u8,name=tlv_length" json:"tlv_length,omitempty"`
46         Tlv          []byte `binapi:"u8[248],name=tlv" json:"tlv,omitempty"`
47 }
48
49 func (m *NshAddDelEntry) Reset()               { *m = NshAddDelEntry{} }
50 func (*NshAddDelEntry) GetMessageName() string { return "nsh_add_del_entry" }
51 func (*NshAddDelEntry) GetCrcString() string   { return "7dea480b" }
52 func (*NshAddDelEntry) GetMessageType() api.MessageType {
53         return api.RequestMessage
54 }
55
56 func (m *NshAddDelEntry) Size() (size int) {
57         if m == nil {
58                 return 0
59         }
60         size += 1       // m.IsAdd
61         size += 4       // m.NspNsi
62         size += 1       // m.MdType
63         size += 1       // m.VerOC
64         size += 1       // m.TTL
65         size += 1       // m.Length
66         size += 1       // m.NextProtocol
67         size += 4       // m.C1
68         size += 4       // m.C2
69         size += 4       // m.C3
70         size += 4       // m.C4
71         size += 1       // m.TlvLength
72         size += 1 * 248 // m.Tlv
73         return size
74 }
75 func (m *NshAddDelEntry) Marshal(b []byte) ([]byte, error) {
76         if b == nil {
77                 b = make([]byte, m.Size())
78         }
79         buf := codec.NewBuffer(b)
80         buf.EncodeBool(m.IsAdd)
81         buf.EncodeUint32(m.NspNsi)
82         buf.EncodeUint8(m.MdType)
83         buf.EncodeUint8(m.VerOC)
84         buf.EncodeUint8(m.TTL)
85         buf.EncodeUint8(m.Length)
86         buf.EncodeUint8(m.NextProtocol)
87         buf.EncodeUint32(m.C1)
88         buf.EncodeUint32(m.C2)
89         buf.EncodeUint32(m.C3)
90         buf.EncodeUint32(m.C4)
91         buf.EncodeUint8(m.TlvLength)
92         buf.EncodeBytes(m.Tlv, 248)
93         return buf.Bytes(), nil
94 }
95 func (m *NshAddDelEntry) Unmarshal(b []byte) error {
96         buf := codec.NewBuffer(b)
97         m.IsAdd = buf.DecodeBool()
98         m.NspNsi = buf.DecodeUint32()
99         m.MdType = buf.DecodeUint8()
100         m.VerOC = buf.DecodeUint8()
101         m.TTL = buf.DecodeUint8()
102         m.Length = buf.DecodeUint8()
103         m.NextProtocol = buf.DecodeUint8()
104         m.C1 = buf.DecodeUint32()
105         m.C2 = buf.DecodeUint32()
106         m.C3 = buf.DecodeUint32()
107         m.C4 = buf.DecodeUint32()
108         m.TlvLength = buf.DecodeUint8()
109         m.Tlv = make([]byte, 248)
110         copy(m.Tlv, buf.DecodeBytes(len(m.Tlv)))
111         return nil
112 }
113
114 // NshAddDelEntryReply defines message 'nsh_add_del_entry_reply'.
115 type NshAddDelEntryReply struct {
116         Retval     int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
117         EntryIndex uint32 `binapi:"u32,name=entry_index" json:"entry_index,omitempty"`
118 }
119
120 func (m *NshAddDelEntryReply) Reset()               { *m = NshAddDelEntryReply{} }
121 func (*NshAddDelEntryReply) GetMessageName() string { return "nsh_add_del_entry_reply" }
122 func (*NshAddDelEntryReply) GetCrcString() string   { return "6296a9eb" }
123 func (*NshAddDelEntryReply) GetMessageType() api.MessageType {
124         return api.ReplyMessage
125 }
126
127 func (m *NshAddDelEntryReply) Size() (size int) {
128         if m == nil {
129                 return 0
130         }
131         size += 4 // m.Retval
132         size += 4 // m.EntryIndex
133         return size
134 }
135 func (m *NshAddDelEntryReply) Marshal(b []byte) ([]byte, error) {
136         if b == nil {
137                 b = make([]byte, m.Size())
138         }
139         buf := codec.NewBuffer(b)
140         buf.EncodeInt32(m.Retval)
141         buf.EncodeUint32(m.EntryIndex)
142         return buf.Bytes(), nil
143 }
144 func (m *NshAddDelEntryReply) Unmarshal(b []byte) error {
145         buf := codec.NewBuffer(b)
146         m.Retval = buf.DecodeInt32()
147         m.EntryIndex = buf.DecodeUint32()
148         return nil
149 }
150
151 // NshAddDelMap defines message 'nsh_add_del_map'.
152 type NshAddDelMap struct {
153         IsAdd        bool                           `binapi:"bool,name=is_add" json:"is_add,omitempty"`
154         NspNsi       uint32                         `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"`
155         MappedNspNsi uint32                         `binapi:"u32,name=mapped_nsp_nsi" json:"mapped_nsp_nsi,omitempty"`
156         NshAction    uint32                         `binapi:"u32,name=nsh_action" json:"nsh_action,omitempty"`
157         SwIfIndex    interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
158         RxSwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"`
159         NextNode     uint32                         `binapi:"u32,name=next_node" json:"next_node,omitempty"`
160 }
161
162 func (m *NshAddDelMap) Reset()               { *m = NshAddDelMap{} }
163 func (*NshAddDelMap) GetMessageName() string { return "nsh_add_del_map" }
164 func (*NshAddDelMap) GetCrcString() string   { return "898d857d" }
165 func (*NshAddDelMap) GetMessageType() api.MessageType {
166         return api.RequestMessage
167 }
168
169 func (m *NshAddDelMap) Size() (size int) {
170         if m == nil {
171                 return 0
172         }
173         size += 1 // m.IsAdd
174         size += 4 // m.NspNsi
175         size += 4 // m.MappedNspNsi
176         size += 4 // m.NshAction
177         size += 4 // m.SwIfIndex
178         size += 4 // m.RxSwIfIndex
179         size += 4 // m.NextNode
180         return size
181 }
182 func (m *NshAddDelMap) Marshal(b []byte) ([]byte, error) {
183         if b == nil {
184                 b = make([]byte, m.Size())
185         }
186         buf := codec.NewBuffer(b)
187         buf.EncodeBool(m.IsAdd)
188         buf.EncodeUint32(m.NspNsi)
189         buf.EncodeUint32(m.MappedNspNsi)
190         buf.EncodeUint32(m.NshAction)
191         buf.EncodeUint32(uint32(m.SwIfIndex))
192         buf.EncodeUint32(uint32(m.RxSwIfIndex))
193         buf.EncodeUint32(m.NextNode)
194         return buf.Bytes(), nil
195 }
196 func (m *NshAddDelMap) Unmarshal(b []byte) error {
197         buf := codec.NewBuffer(b)
198         m.IsAdd = buf.DecodeBool()
199         m.NspNsi = buf.DecodeUint32()
200         m.MappedNspNsi = buf.DecodeUint32()
201         m.NshAction = buf.DecodeUint32()
202         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
203         m.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
204         m.NextNode = buf.DecodeUint32()
205         return nil
206 }
207
208 // NshAddDelMapReply defines message 'nsh_add_del_map_reply'.
209 type NshAddDelMapReply struct {
210         Retval   int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
211         MapIndex uint32 `binapi:"u32,name=map_index" json:"map_index,omitempty"`
212 }
213
214 func (m *NshAddDelMapReply) Reset()               { *m = NshAddDelMapReply{} }
215 func (*NshAddDelMapReply) GetMessageName() string { return "nsh_add_del_map_reply" }
216 func (*NshAddDelMapReply) GetCrcString() string   { return "b2b127ef" }
217 func (*NshAddDelMapReply) GetMessageType() api.MessageType {
218         return api.ReplyMessage
219 }
220
221 func (m *NshAddDelMapReply) Size() (size int) {
222         if m == nil {
223                 return 0
224         }
225         size += 4 // m.Retval
226         size += 4 // m.MapIndex
227         return size
228 }
229 func (m *NshAddDelMapReply) Marshal(b []byte) ([]byte, error) {
230         if b == nil {
231                 b = make([]byte, m.Size())
232         }
233         buf := codec.NewBuffer(b)
234         buf.EncodeInt32(m.Retval)
235         buf.EncodeUint32(m.MapIndex)
236         return buf.Bytes(), nil
237 }
238 func (m *NshAddDelMapReply) Unmarshal(b []byte) error {
239         buf := codec.NewBuffer(b)
240         m.Retval = buf.DecodeInt32()
241         m.MapIndex = buf.DecodeUint32()
242         return nil
243 }
244
245 // NshEntryDetails defines message 'nsh_entry_details'.
246 type NshEntryDetails struct {
247         EntryIndex   uint32 `binapi:"u32,name=entry_index" json:"entry_index,omitempty"`
248         NspNsi       uint32 `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"`
249         MdType       uint8  `binapi:"u8,name=md_type" json:"md_type,omitempty"`
250         VerOC        uint8  `binapi:"u8,name=ver_o_c" json:"ver_o_c,omitempty"`
251         TTL          uint8  `binapi:"u8,name=ttl" json:"ttl,omitempty"`
252         Length       uint8  `binapi:"u8,name=length" json:"length,omitempty"`
253         NextProtocol uint8  `binapi:"u8,name=next_protocol" json:"next_protocol,omitempty"`
254         C1           uint32 `binapi:"u32,name=c1" json:"c1,omitempty"`
255         C2           uint32 `binapi:"u32,name=c2" json:"c2,omitempty"`
256         C3           uint32 `binapi:"u32,name=c3" json:"c3,omitempty"`
257         C4           uint32 `binapi:"u32,name=c4" json:"c4,omitempty"`
258         TlvLength    uint8  `binapi:"u8,name=tlv_length" json:"tlv_length,omitempty"`
259         Tlv          []byte `binapi:"u8[248],name=tlv" json:"tlv,omitempty"`
260 }
261
262 func (m *NshEntryDetails) Reset()               { *m = NshEntryDetails{} }
263 func (*NshEntryDetails) GetMessageName() string { return "nsh_entry_details" }
264 func (*NshEntryDetails) GetCrcString() string   { return "046fb556" }
265 func (*NshEntryDetails) GetMessageType() api.MessageType {
266         return api.ReplyMessage
267 }
268
269 func (m *NshEntryDetails) Size() (size int) {
270         if m == nil {
271                 return 0
272         }
273         size += 4       // m.EntryIndex
274         size += 4       // m.NspNsi
275         size += 1       // m.MdType
276         size += 1       // m.VerOC
277         size += 1       // m.TTL
278         size += 1       // m.Length
279         size += 1       // m.NextProtocol
280         size += 4       // m.C1
281         size += 4       // m.C2
282         size += 4       // m.C3
283         size += 4       // m.C4
284         size += 1       // m.TlvLength
285         size += 1 * 248 // m.Tlv
286         return size
287 }
288 func (m *NshEntryDetails) Marshal(b []byte) ([]byte, error) {
289         if b == nil {
290                 b = make([]byte, m.Size())
291         }
292         buf := codec.NewBuffer(b)
293         buf.EncodeUint32(m.EntryIndex)
294         buf.EncodeUint32(m.NspNsi)
295         buf.EncodeUint8(m.MdType)
296         buf.EncodeUint8(m.VerOC)
297         buf.EncodeUint8(m.TTL)
298         buf.EncodeUint8(m.Length)
299         buf.EncodeUint8(m.NextProtocol)
300         buf.EncodeUint32(m.C1)
301         buf.EncodeUint32(m.C2)
302         buf.EncodeUint32(m.C3)
303         buf.EncodeUint32(m.C4)
304         buf.EncodeUint8(m.TlvLength)
305         buf.EncodeBytes(m.Tlv, 248)
306         return buf.Bytes(), nil
307 }
308 func (m *NshEntryDetails) Unmarshal(b []byte) error {
309         buf := codec.NewBuffer(b)
310         m.EntryIndex = buf.DecodeUint32()
311         m.NspNsi = buf.DecodeUint32()
312         m.MdType = buf.DecodeUint8()
313         m.VerOC = buf.DecodeUint8()
314         m.TTL = buf.DecodeUint8()
315         m.Length = buf.DecodeUint8()
316         m.NextProtocol = buf.DecodeUint8()
317         m.C1 = buf.DecodeUint32()
318         m.C2 = buf.DecodeUint32()
319         m.C3 = buf.DecodeUint32()
320         m.C4 = buf.DecodeUint32()
321         m.TlvLength = buf.DecodeUint8()
322         m.Tlv = make([]byte, 248)
323         copy(m.Tlv, buf.DecodeBytes(len(m.Tlv)))
324         return nil
325 }
326
327 // NshEntryDump defines message 'nsh_entry_dump'.
328 type NshEntryDump struct {
329         EntryIndex uint32 `binapi:"u32,name=entry_index" json:"entry_index,omitempty"`
330 }
331
332 func (m *NshEntryDump) Reset()               { *m = NshEntryDump{} }
333 func (*NshEntryDump) GetMessageName() string { return "nsh_entry_dump" }
334 func (*NshEntryDump) GetCrcString() string   { return "cdaf8ccb" }
335 func (*NshEntryDump) GetMessageType() api.MessageType {
336         return api.RequestMessage
337 }
338
339 func (m *NshEntryDump) Size() (size int) {
340         if m == nil {
341                 return 0
342         }
343         size += 4 // m.EntryIndex
344         return size
345 }
346 func (m *NshEntryDump) Marshal(b []byte) ([]byte, error) {
347         if b == nil {
348                 b = make([]byte, m.Size())
349         }
350         buf := codec.NewBuffer(b)
351         buf.EncodeUint32(m.EntryIndex)
352         return buf.Bytes(), nil
353 }
354 func (m *NshEntryDump) Unmarshal(b []byte) error {
355         buf := codec.NewBuffer(b)
356         m.EntryIndex = buf.DecodeUint32()
357         return nil
358 }
359
360 // NshMapDetails defines message 'nsh_map_details'.
361 type NshMapDetails struct {
362         MapIndex     uint32                         `binapi:"u32,name=map_index" json:"map_index,omitempty"`
363         NspNsi       uint32                         `binapi:"u32,name=nsp_nsi" json:"nsp_nsi,omitempty"`
364         MappedNspNsi uint32                         `binapi:"u32,name=mapped_nsp_nsi" json:"mapped_nsp_nsi,omitempty"`
365         NshAction    uint32                         `binapi:"u32,name=nsh_action" json:"nsh_action,omitempty"`
366         SwIfIndex    interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
367         RxSwIfIndex  interface_types.InterfaceIndex `binapi:"interface_index,name=rx_sw_if_index" json:"rx_sw_if_index,omitempty"`
368         NextNode     uint32                         `binapi:"u32,name=next_node" json:"next_node,omitempty"`
369 }
370
371 func (m *NshMapDetails) Reset()               { *m = NshMapDetails{} }
372 func (*NshMapDetails) GetMessageName() string { return "nsh_map_details" }
373 func (*NshMapDetails) GetCrcString() string   { return "b34ac8a1" }
374 func (*NshMapDetails) GetMessageType() api.MessageType {
375         return api.ReplyMessage
376 }
377
378 func (m *NshMapDetails) Size() (size int) {
379         if m == nil {
380                 return 0
381         }
382         size += 4 // m.MapIndex
383         size += 4 // m.NspNsi
384         size += 4 // m.MappedNspNsi
385         size += 4 // m.NshAction
386         size += 4 // m.SwIfIndex
387         size += 4 // m.RxSwIfIndex
388         size += 4 // m.NextNode
389         return size
390 }
391 func (m *NshMapDetails) Marshal(b []byte) ([]byte, error) {
392         if b == nil {
393                 b = make([]byte, m.Size())
394         }
395         buf := codec.NewBuffer(b)
396         buf.EncodeUint32(m.MapIndex)
397         buf.EncodeUint32(m.NspNsi)
398         buf.EncodeUint32(m.MappedNspNsi)
399         buf.EncodeUint32(m.NshAction)
400         buf.EncodeUint32(uint32(m.SwIfIndex))
401         buf.EncodeUint32(uint32(m.RxSwIfIndex))
402         buf.EncodeUint32(m.NextNode)
403         return buf.Bytes(), nil
404 }
405 func (m *NshMapDetails) Unmarshal(b []byte) error {
406         buf := codec.NewBuffer(b)
407         m.MapIndex = buf.DecodeUint32()
408         m.NspNsi = buf.DecodeUint32()
409         m.MappedNspNsi = buf.DecodeUint32()
410         m.NshAction = buf.DecodeUint32()
411         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
412         m.RxSwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
413         m.NextNode = buf.DecodeUint32()
414         return nil
415 }
416
417 // NshMapDump defines message 'nsh_map_dump'.
418 type NshMapDump struct {
419         MapIndex uint32 `binapi:"u32,name=map_index" json:"map_index,omitempty"`
420 }
421
422 func (m *NshMapDump) Reset()               { *m = NshMapDump{} }
423 func (*NshMapDump) GetMessageName() string { return "nsh_map_dump" }
424 func (*NshMapDump) GetCrcString() string   { return "8fc06b82" }
425 func (*NshMapDump) GetMessageType() api.MessageType {
426         return api.RequestMessage
427 }
428
429 func (m *NshMapDump) Size() (size int) {
430         if m == nil {
431                 return 0
432         }
433         size += 4 // m.MapIndex
434         return size
435 }
436 func (m *NshMapDump) Marshal(b []byte) ([]byte, error) {
437         if b == nil {
438                 b = make([]byte, m.Size())
439         }
440         buf := codec.NewBuffer(b)
441         buf.EncodeUint32(m.MapIndex)
442         return buf.Bytes(), nil
443 }
444 func (m *NshMapDump) Unmarshal(b []byte) error {
445         buf := codec.NewBuffer(b)
446         m.MapIndex = buf.DecodeUint32()
447         return nil
448 }
449
450 func init() { file_nsh_binapi_init() }
451 func file_nsh_binapi_init() {
452         api.RegisterMessage((*NshAddDelEntry)(nil), "nsh_add_del_entry_7dea480b")
453         api.RegisterMessage((*NshAddDelEntryReply)(nil), "nsh_add_del_entry_reply_6296a9eb")
454         api.RegisterMessage((*NshAddDelMap)(nil), "nsh_add_del_map_898d857d")
455         api.RegisterMessage((*NshAddDelMapReply)(nil), "nsh_add_del_map_reply_b2b127ef")
456         api.RegisterMessage((*NshEntryDetails)(nil), "nsh_entry_details_046fb556")
457         api.RegisterMessage((*NshEntryDump)(nil), "nsh_entry_dump_cdaf8ccb")
458         api.RegisterMessage((*NshMapDetails)(nil), "nsh_map_details_b34ac8a1")
459         api.RegisterMessage((*NshMapDump)(nil), "nsh_map_dump_8fc06b82")
460 }
461
462 // Messages returns list of all messages in this module.
463 func AllMessages() []api.Message {
464         return []api.Message{
465                 (*NshAddDelEntry)(nil),
466                 (*NshAddDelEntryReply)(nil),
467                 (*NshAddDelMap)(nil),
468                 (*NshAddDelMapReply)(nil),
469                 (*NshEntryDetails)(nil),
470                 (*NshEntryDump)(nil),
471                 (*NshMapDetails)(nil),
472                 (*NshMapDump)(nil),
473         }
474 }