Update generated binapi to v22.02 & makefile changes
[govpp.git] / internal / testbinapi / binapi2001 / nsim / nsim.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.5.0-dev
4 //  VPP:              20.01
5 // source: .vppapi/plugins/nsim.api.json
6
7 // Package nsim contains generated bindings for API file nsim.api.
8 //
9 // Contents:
10 //   1 alias
11 //   6 enums
12 //   6 messages
13 //
14 package nsim
15
16 import (
17         "strconv"
18
19         api "git.fd.io/govpp.git/api"
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    = "nsim"
31         APIVersion = "2.1.1"
32         VersionCrc = 0xd61e346f
33 )
34
35 // IfStatusFlags defines enum 'if_status_flags'.
36 type IfStatusFlags uint32
37
38 const (
39         IF_STATUS_API_FLAG_ADMIN_UP IfStatusFlags = 1
40         IF_STATUS_API_FLAG_LINK_UP  IfStatusFlags = 2
41 )
42
43 var (
44         IfStatusFlags_name = map[uint32]string{
45                 1: "IF_STATUS_API_FLAG_ADMIN_UP",
46                 2: "IF_STATUS_API_FLAG_LINK_UP",
47         }
48         IfStatusFlags_value = map[string]uint32{
49                 "IF_STATUS_API_FLAG_ADMIN_UP": 1,
50                 "IF_STATUS_API_FLAG_LINK_UP":  2,
51         }
52 )
53
54 func (x IfStatusFlags) String() string {
55         s, ok := IfStatusFlags_name[uint32(x)]
56         if ok {
57                 return s
58         }
59         str := func(n uint32) string {
60                 s, ok := IfStatusFlags_name[uint32(n)]
61                 if ok {
62                         return s
63                 }
64                 return "IfStatusFlags(" + strconv.Itoa(int(n)) + ")"
65         }
66         for i := uint32(0); i <= 32; i++ {
67                 val := uint32(x)
68                 if val&(1<<i) != 0 {
69                         if s != "" {
70                                 s += "|"
71                         }
72                         s += str(1 << i)
73                 }
74         }
75         if s == "" {
76                 return str(uint32(x))
77         }
78         return s
79 }
80
81 // IfType defines enum 'if_type'.
82 type IfType uint32
83
84 const (
85         IF_API_TYPE_HARDWARE IfType = 1
86         IF_API_TYPE_SUB      IfType = 2
87         IF_API_TYPE_P2P      IfType = 3
88         IF_API_TYPE_PIPE     IfType = 4
89 )
90
91 var (
92         IfType_name = map[uint32]string{
93                 1: "IF_API_TYPE_HARDWARE",
94                 2: "IF_API_TYPE_SUB",
95                 3: "IF_API_TYPE_P2P",
96                 4: "IF_API_TYPE_PIPE",
97         }
98         IfType_value = map[string]uint32{
99                 "IF_API_TYPE_HARDWARE": 1,
100                 "IF_API_TYPE_SUB":      2,
101                 "IF_API_TYPE_P2P":      3,
102                 "IF_API_TYPE_PIPE":     4,
103         }
104 )
105
106 func (x IfType) String() string {
107         s, ok := IfType_name[uint32(x)]
108         if ok {
109                 return s
110         }
111         return "IfType(" + strconv.Itoa(int(x)) + ")"
112 }
113
114 // LinkDuplex defines enum 'link_duplex'.
115 type LinkDuplex uint32
116
117 const (
118         LINK_DUPLEX_API_UNKNOWN LinkDuplex = 0
119         LINK_DUPLEX_API_HALF    LinkDuplex = 1
120         LINK_DUPLEX_API_FULL    LinkDuplex = 2
121 )
122
123 var (
124         LinkDuplex_name = map[uint32]string{
125                 0: "LINK_DUPLEX_API_UNKNOWN",
126                 1: "LINK_DUPLEX_API_HALF",
127                 2: "LINK_DUPLEX_API_FULL",
128         }
129         LinkDuplex_value = map[string]uint32{
130                 "LINK_DUPLEX_API_UNKNOWN": 0,
131                 "LINK_DUPLEX_API_HALF":    1,
132                 "LINK_DUPLEX_API_FULL":    2,
133         }
134 )
135
136 func (x LinkDuplex) String() string {
137         s, ok := LinkDuplex_name[uint32(x)]
138         if ok {
139                 return s
140         }
141         return "LinkDuplex(" + strconv.Itoa(int(x)) + ")"
142 }
143
144 // MtuProto defines enum 'mtu_proto'.
145 type MtuProto uint32
146
147 const (
148         MTU_PROTO_API_L3   MtuProto = 1
149         MTU_PROTO_API_IP4  MtuProto = 2
150         MTU_PROTO_API_IP6  MtuProto = 3
151         MTU_PROTO_API_MPLS MtuProto = 4
152         MTU_PROTO_API_N    MtuProto = 5
153 )
154
155 var (
156         MtuProto_name = map[uint32]string{
157                 1: "MTU_PROTO_API_L3",
158                 2: "MTU_PROTO_API_IP4",
159                 3: "MTU_PROTO_API_IP6",
160                 4: "MTU_PROTO_API_MPLS",
161                 5: "MTU_PROTO_API_N",
162         }
163         MtuProto_value = map[string]uint32{
164                 "MTU_PROTO_API_L3":   1,
165                 "MTU_PROTO_API_IP4":  2,
166                 "MTU_PROTO_API_IP6":  3,
167                 "MTU_PROTO_API_MPLS": 4,
168                 "MTU_PROTO_API_N":    5,
169         }
170 )
171
172 func (x MtuProto) String() string {
173         s, ok := MtuProto_name[uint32(x)]
174         if ok {
175                 return s
176         }
177         return "MtuProto(" + strconv.Itoa(int(x)) + ")"
178 }
179
180 // RxMode defines enum 'rx_mode'.
181 type RxMode uint32
182
183 const (
184         RX_MODE_API_UNKNOWN   RxMode = 0
185         RX_MODE_API_POLLING   RxMode = 1
186         RX_MODE_API_INTERRUPT RxMode = 2
187         RX_MODE_API_ADAPTIVE  RxMode = 3
188         RX_MODE_API_DEFAULT   RxMode = 4
189 )
190
191 var (
192         RxMode_name = map[uint32]string{
193                 0: "RX_MODE_API_UNKNOWN",
194                 1: "RX_MODE_API_POLLING",
195                 2: "RX_MODE_API_INTERRUPT",
196                 3: "RX_MODE_API_ADAPTIVE",
197                 4: "RX_MODE_API_DEFAULT",
198         }
199         RxMode_value = map[string]uint32{
200                 "RX_MODE_API_UNKNOWN":   0,
201                 "RX_MODE_API_POLLING":   1,
202                 "RX_MODE_API_INTERRUPT": 2,
203                 "RX_MODE_API_ADAPTIVE":  3,
204                 "RX_MODE_API_DEFAULT":   4,
205         }
206 )
207
208 func (x RxMode) String() string {
209         s, ok := RxMode_name[uint32(x)]
210         if ok {
211                 return s
212         }
213         return "RxMode(" + strconv.Itoa(int(x)) + ")"
214 }
215
216 // SubIfFlags defines enum 'sub_if_flags'.
217 type SubIfFlags uint32
218
219 const (
220         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
221         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
222         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
223         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
224         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
225         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
226         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
227         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
228         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
229         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
230 )
231
232 var (
233         SubIfFlags_name = map[uint32]string{
234                 1:   "SUB_IF_API_FLAG_NO_TAGS",
235                 2:   "SUB_IF_API_FLAG_ONE_TAG",
236                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
237                 8:   "SUB_IF_API_FLAG_DOT1AD",
238                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
239                 32:  "SUB_IF_API_FLAG_DEFAULT",
240                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
241                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
242                 254: "SUB_IF_API_FLAG_MASK_VNET",
243                 256: "SUB_IF_API_FLAG_DOT1AH",
244         }
245         SubIfFlags_value = map[string]uint32{
246                 "SUB_IF_API_FLAG_NO_TAGS":           1,
247                 "SUB_IF_API_FLAG_ONE_TAG":           2,
248                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
249                 "SUB_IF_API_FLAG_DOT1AD":            8,
250                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
251                 "SUB_IF_API_FLAG_DEFAULT":           32,
252                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
253                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
254                 "SUB_IF_API_FLAG_MASK_VNET":         254,
255                 "SUB_IF_API_FLAG_DOT1AH":            256,
256         }
257 )
258
259 func (x SubIfFlags) String() string {
260         s, ok := SubIfFlags_name[uint32(x)]
261         if ok {
262                 return s
263         }
264         str := func(n uint32) string {
265                 s, ok := SubIfFlags_name[uint32(n)]
266                 if ok {
267                         return s
268                 }
269                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
270         }
271         for i := uint32(0); i <= 32; i++ {
272                 val := uint32(x)
273                 if val&(1<<i) != 0 {
274                         if s != "" {
275                                 s += "|"
276                         }
277                         s += str(1 << i)
278                 }
279         }
280         if s == "" {
281                 return str(uint32(x))
282         }
283         return s
284 }
285
286 // InterfaceIndex defines alias 'interface_index'.
287 type InterfaceIndex uint32
288
289 // NsimConfigure defines message 'nsim_configure'.
290 type NsimConfigure struct {
291         DelayInUsec              uint32 `binapi:"u32,name=delay_in_usec" json:"delay_in_usec,omitempty"`
292         AveragePacketSize        uint32 `binapi:"u32,name=average_packet_size" json:"average_packet_size,omitempty"`
293         BandwidthInBitsPerSecond uint64 `binapi:"u64,name=bandwidth_in_bits_per_second" json:"bandwidth_in_bits_per_second,omitempty"`
294         PacketsPerDrop           uint32 `binapi:"u32,name=packets_per_drop" json:"packets_per_drop,omitempty"`
295 }
296
297 func (m *NsimConfigure) Reset()               { *m = NsimConfigure{} }
298 func (*NsimConfigure) GetMessageName() string { return "nsim_configure" }
299 func (*NsimConfigure) GetCrcString() string   { return "16ed400f" }
300 func (*NsimConfigure) GetMessageType() api.MessageType {
301         return api.RequestMessage
302 }
303
304 func (m *NsimConfigure) Size() (size int) {
305         if m == nil {
306                 return 0
307         }
308         size += 4 // m.DelayInUsec
309         size += 4 // m.AveragePacketSize
310         size += 8 // m.BandwidthInBitsPerSecond
311         size += 4 // m.PacketsPerDrop
312         return size
313 }
314 func (m *NsimConfigure) Marshal(b []byte) ([]byte, error) {
315         if b == nil {
316                 b = make([]byte, m.Size())
317         }
318         buf := codec.NewBuffer(b)
319         buf.EncodeUint32(m.DelayInUsec)
320         buf.EncodeUint32(m.AveragePacketSize)
321         buf.EncodeUint64(m.BandwidthInBitsPerSecond)
322         buf.EncodeUint32(m.PacketsPerDrop)
323         return buf.Bytes(), nil
324 }
325 func (m *NsimConfigure) Unmarshal(b []byte) error {
326         buf := codec.NewBuffer(b)
327         m.DelayInUsec = buf.DecodeUint32()
328         m.AveragePacketSize = buf.DecodeUint32()
329         m.BandwidthInBitsPerSecond = buf.DecodeUint64()
330         m.PacketsPerDrop = buf.DecodeUint32()
331         return nil
332 }
333
334 // NsimConfigureReply defines message 'nsim_configure_reply'.
335 type NsimConfigureReply struct {
336         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
337 }
338
339 func (m *NsimConfigureReply) Reset()               { *m = NsimConfigureReply{} }
340 func (*NsimConfigureReply) GetMessageName() string { return "nsim_configure_reply" }
341 func (*NsimConfigureReply) GetCrcString() string   { return "e8d4e804" }
342 func (*NsimConfigureReply) GetMessageType() api.MessageType {
343         return api.ReplyMessage
344 }
345
346 func (m *NsimConfigureReply) Size() (size int) {
347         if m == nil {
348                 return 0
349         }
350         size += 4 // m.Retval
351         return size
352 }
353 func (m *NsimConfigureReply) Marshal(b []byte) ([]byte, error) {
354         if b == nil {
355                 b = make([]byte, m.Size())
356         }
357         buf := codec.NewBuffer(b)
358         buf.EncodeInt32(m.Retval)
359         return buf.Bytes(), nil
360 }
361 func (m *NsimConfigureReply) Unmarshal(b []byte) error {
362         buf := codec.NewBuffer(b)
363         m.Retval = buf.DecodeInt32()
364         return nil
365 }
366
367 // NsimCrossConnectEnableDisable defines message 'nsim_cross_connect_enable_disable'.
368 type NsimCrossConnectEnableDisable struct {
369         EnableDisable bool           `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"`
370         SwIfIndex0    InterfaceIndex `binapi:"interface_index,name=sw_if_index0" json:"sw_if_index0,omitempty"`
371         SwIfIndex1    InterfaceIndex `binapi:"interface_index,name=sw_if_index1" json:"sw_if_index1,omitempty"`
372 }
373
374 func (m *NsimCrossConnectEnableDisable) Reset() { *m = NsimCrossConnectEnableDisable{} }
375 func (*NsimCrossConnectEnableDisable) GetMessageName() string {
376         return "nsim_cross_connect_enable_disable"
377 }
378 func (*NsimCrossConnectEnableDisable) GetCrcString() string { return "16f70bdf" }
379 func (*NsimCrossConnectEnableDisable) GetMessageType() api.MessageType {
380         return api.RequestMessage
381 }
382
383 func (m *NsimCrossConnectEnableDisable) Size() (size int) {
384         if m == nil {
385                 return 0
386         }
387         size += 1 // m.EnableDisable
388         size += 4 // m.SwIfIndex0
389         size += 4 // m.SwIfIndex1
390         return size
391 }
392 func (m *NsimCrossConnectEnableDisable) Marshal(b []byte) ([]byte, error) {
393         if b == nil {
394                 b = make([]byte, m.Size())
395         }
396         buf := codec.NewBuffer(b)
397         buf.EncodeBool(m.EnableDisable)
398         buf.EncodeUint32(uint32(m.SwIfIndex0))
399         buf.EncodeUint32(uint32(m.SwIfIndex1))
400         return buf.Bytes(), nil
401 }
402 func (m *NsimCrossConnectEnableDisable) Unmarshal(b []byte) error {
403         buf := codec.NewBuffer(b)
404         m.EnableDisable = buf.DecodeBool()
405         m.SwIfIndex0 = InterfaceIndex(buf.DecodeUint32())
406         m.SwIfIndex1 = InterfaceIndex(buf.DecodeUint32())
407         return nil
408 }
409
410 // NsimCrossConnectEnableDisableReply defines message 'nsim_cross_connect_enable_disable_reply'.
411 type NsimCrossConnectEnableDisableReply struct {
412         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
413 }
414
415 func (m *NsimCrossConnectEnableDisableReply) Reset() { *m = NsimCrossConnectEnableDisableReply{} }
416 func (*NsimCrossConnectEnableDisableReply) GetMessageName() string {
417         return "nsim_cross_connect_enable_disable_reply"
418 }
419 func (*NsimCrossConnectEnableDisableReply) GetCrcString() string { return "e8d4e804" }
420 func (*NsimCrossConnectEnableDisableReply) GetMessageType() api.MessageType {
421         return api.ReplyMessage
422 }
423
424 func (m *NsimCrossConnectEnableDisableReply) Size() (size int) {
425         if m == nil {
426                 return 0
427         }
428         size += 4 // m.Retval
429         return size
430 }
431 func (m *NsimCrossConnectEnableDisableReply) Marshal(b []byte) ([]byte, error) {
432         if b == nil {
433                 b = make([]byte, m.Size())
434         }
435         buf := codec.NewBuffer(b)
436         buf.EncodeInt32(m.Retval)
437         return buf.Bytes(), nil
438 }
439 func (m *NsimCrossConnectEnableDisableReply) Unmarshal(b []byte) error {
440         buf := codec.NewBuffer(b)
441         m.Retval = buf.DecodeInt32()
442         return nil
443 }
444
445 // NsimOutputFeatureEnableDisable defines message 'nsim_output_feature_enable_disable'.
446 type NsimOutputFeatureEnableDisable struct {
447         EnableDisable bool           `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"`
448         SwIfIndex     InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
449 }
450
451 func (m *NsimOutputFeatureEnableDisable) Reset() { *m = NsimOutputFeatureEnableDisable{} }
452 func (*NsimOutputFeatureEnableDisable) GetMessageName() string {
453         return "nsim_output_feature_enable_disable"
454 }
455 func (*NsimOutputFeatureEnableDisable) GetCrcString() string { return "3865946c" }
456 func (*NsimOutputFeatureEnableDisable) GetMessageType() api.MessageType {
457         return api.RequestMessage
458 }
459
460 func (m *NsimOutputFeatureEnableDisable) Size() (size int) {
461         if m == nil {
462                 return 0
463         }
464         size += 1 // m.EnableDisable
465         size += 4 // m.SwIfIndex
466         return size
467 }
468 func (m *NsimOutputFeatureEnableDisable) Marshal(b []byte) ([]byte, error) {
469         if b == nil {
470                 b = make([]byte, m.Size())
471         }
472         buf := codec.NewBuffer(b)
473         buf.EncodeBool(m.EnableDisable)
474         buf.EncodeUint32(uint32(m.SwIfIndex))
475         return buf.Bytes(), nil
476 }
477 func (m *NsimOutputFeatureEnableDisable) Unmarshal(b []byte) error {
478         buf := codec.NewBuffer(b)
479         m.EnableDisable = buf.DecodeBool()
480         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
481         return nil
482 }
483
484 // NsimOutputFeatureEnableDisableReply defines message 'nsim_output_feature_enable_disable_reply'.
485 type NsimOutputFeatureEnableDisableReply struct {
486         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
487 }
488
489 func (m *NsimOutputFeatureEnableDisableReply) Reset() { *m = NsimOutputFeatureEnableDisableReply{} }
490 func (*NsimOutputFeatureEnableDisableReply) GetMessageName() string {
491         return "nsim_output_feature_enable_disable_reply"
492 }
493 func (*NsimOutputFeatureEnableDisableReply) GetCrcString() string { return "e8d4e804" }
494 func (*NsimOutputFeatureEnableDisableReply) GetMessageType() api.MessageType {
495         return api.ReplyMessage
496 }
497
498 func (m *NsimOutputFeatureEnableDisableReply) Size() (size int) {
499         if m == nil {
500                 return 0
501         }
502         size += 4 // m.Retval
503         return size
504 }
505 func (m *NsimOutputFeatureEnableDisableReply) Marshal(b []byte) ([]byte, error) {
506         if b == nil {
507                 b = make([]byte, m.Size())
508         }
509         buf := codec.NewBuffer(b)
510         buf.EncodeInt32(m.Retval)
511         return buf.Bytes(), nil
512 }
513 func (m *NsimOutputFeatureEnableDisableReply) Unmarshal(b []byte) error {
514         buf := codec.NewBuffer(b)
515         m.Retval = buf.DecodeInt32()
516         return nil
517 }
518
519 func init() { file_nsim_binapi_init() }
520 func file_nsim_binapi_init() {
521         api.RegisterMessage((*NsimConfigure)(nil), "nsim_configure_16ed400f")
522         api.RegisterMessage((*NsimConfigureReply)(nil), "nsim_configure_reply_e8d4e804")
523         api.RegisterMessage((*NsimCrossConnectEnableDisable)(nil), "nsim_cross_connect_enable_disable_16f70bdf")
524         api.RegisterMessage((*NsimCrossConnectEnableDisableReply)(nil), "nsim_cross_connect_enable_disable_reply_e8d4e804")
525         api.RegisterMessage((*NsimOutputFeatureEnableDisable)(nil), "nsim_output_feature_enable_disable_3865946c")
526         api.RegisterMessage((*NsimOutputFeatureEnableDisableReply)(nil), "nsim_output_feature_enable_disable_reply_e8d4e804")
527 }
528
529 // Messages returns list of all messages in this module.
530 func AllMessages() []api.Message {
531         return []api.Message{
532                 (*NsimConfigure)(nil),
533                 (*NsimConfigureReply)(nil),
534                 (*NsimCrossConnectEnableDisable)(nil),
535                 (*NsimCrossConnectEnableDisableReply)(nil),
536                 (*NsimOutputFeatureEnableDisable)(nil),
537                 (*NsimOutputFeatureEnableDisableReply)(nil),
538         }
539 }