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