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