fcbf2c27d8ef7d08ecc9cb64423ffe1eb3b70d0d
[govpp.git] / internal / testbinapi / binapi2001 / rdma / rdma.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/rdma.api.json
6
7 // Package rdma contains generated bindings for API file rdma.api.
8 //
9 // Contents:
10 //   1 alias
11 //   7 enums
12 //   4 messages
13 //
14 package rdma
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    = "rdma"
30         APIVersion = "1.0.0"
31         VersionCrc = 0x5ce233e0
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 // RdmaMode defines enum 'rdma_mode'.
180 type RdmaMode uint32
181
182 const (
183         RDMA_API_MODE_AUTO RdmaMode = 0
184         RDMA_API_MODE_IBV  RdmaMode = 1
185         RDMA_API_MODE_DV   RdmaMode = 2
186 )
187
188 var (
189         RdmaMode_name = map[uint32]string{
190                 0: "RDMA_API_MODE_AUTO",
191                 1: "RDMA_API_MODE_IBV",
192                 2: "RDMA_API_MODE_DV",
193         }
194         RdmaMode_value = map[string]uint32{
195                 "RDMA_API_MODE_AUTO": 0,
196                 "RDMA_API_MODE_IBV":  1,
197                 "RDMA_API_MODE_DV":   2,
198         }
199 )
200
201 func (x RdmaMode) String() string {
202         s, ok := RdmaMode_name[uint32(x)]
203         if ok {
204                 return s
205         }
206         return "RdmaMode(" + strconv.Itoa(int(x)) + ")"
207 }
208
209 // RxMode defines enum 'rx_mode'.
210 type RxMode uint32
211
212 const (
213         RX_MODE_API_UNKNOWN   RxMode = 0
214         RX_MODE_API_POLLING   RxMode = 1
215         RX_MODE_API_INTERRUPT RxMode = 2
216         RX_MODE_API_ADAPTIVE  RxMode = 3
217         RX_MODE_API_DEFAULT   RxMode = 4
218 )
219
220 var (
221         RxMode_name = map[uint32]string{
222                 0: "RX_MODE_API_UNKNOWN",
223                 1: "RX_MODE_API_POLLING",
224                 2: "RX_MODE_API_INTERRUPT",
225                 3: "RX_MODE_API_ADAPTIVE",
226                 4: "RX_MODE_API_DEFAULT",
227         }
228         RxMode_value = map[string]uint32{
229                 "RX_MODE_API_UNKNOWN":   0,
230                 "RX_MODE_API_POLLING":   1,
231                 "RX_MODE_API_INTERRUPT": 2,
232                 "RX_MODE_API_ADAPTIVE":  3,
233                 "RX_MODE_API_DEFAULT":   4,
234         }
235 )
236
237 func (x RxMode) String() string {
238         s, ok := RxMode_name[uint32(x)]
239         if ok {
240                 return s
241         }
242         return "RxMode(" + strconv.Itoa(int(x)) + ")"
243 }
244
245 // SubIfFlags defines enum 'sub_if_flags'.
246 type SubIfFlags uint32
247
248 const (
249         SUB_IF_API_FLAG_NO_TAGS           SubIfFlags = 1
250         SUB_IF_API_FLAG_ONE_TAG           SubIfFlags = 2
251         SUB_IF_API_FLAG_TWO_TAGS          SubIfFlags = 4
252         SUB_IF_API_FLAG_DOT1AD            SubIfFlags = 8
253         SUB_IF_API_FLAG_EXACT_MATCH       SubIfFlags = 16
254         SUB_IF_API_FLAG_DEFAULT           SubIfFlags = 32
255         SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY SubIfFlags = 64
256         SUB_IF_API_FLAG_INNER_VLAN_ID_ANY SubIfFlags = 128
257         SUB_IF_API_FLAG_MASK_VNET         SubIfFlags = 254
258         SUB_IF_API_FLAG_DOT1AH            SubIfFlags = 256
259 )
260
261 var (
262         SubIfFlags_name = map[uint32]string{
263                 1:   "SUB_IF_API_FLAG_NO_TAGS",
264                 2:   "SUB_IF_API_FLAG_ONE_TAG",
265                 4:   "SUB_IF_API_FLAG_TWO_TAGS",
266                 8:   "SUB_IF_API_FLAG_DOT1AD",
267                 16:  "SUB_IF_API_FLAG_EXACT_MATCH",
268                 32:  "SUB_IF_API_FLAG_DEFAULT",
269                 64:  "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY",
270                 128: "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY",
271                 254: "SUB_IF_API_FLAG_MASK_VNET",
272                 256: "SUB_IF_API_FLAG_DOT1AH",
273         }
274         SubIfFlags_value = map[string]uint32{
275                 "SUB_IF_API_FLAG_NO_TAGS":           1,
276                 "SUB_IF_API_FLAG_ONE_TAG":           2,
277                 "SUB_IF_API_FLAG_TWO_TAGS":          4,
278                 "SUB_IF_API_FLAG_DOT1AD":            8,
279                 "SUB_IF_API_FLAG_EXACT_MATCH":       16,
280                 "SUB_IF_API_FLAG_DEFAULT":           32,
281                 "SUB_IF_API_FLAG_OUTER_VLAN_ID_ANY": 64,
282                 "SUB_IF_API_FLAG_INNER_VLAN_ID_ANY": 128,
283                 "SUB_IF_API_FLAG_MASK_VNET":         254,
284                 "SUB_IF_API_FLAG_DOT1AH":            256,
285         }
286 )
287
288 func (x SubIfFlags) String() string {
289         s, ok := SubIfFlags_name[uint32(x)]
290         if ok {
291                 return s
292         }
293         str := func(n uint32) string {
294                 s, ok := SubIfFlags_name[uint32(n)]
295                 if ok {
296                         return s
297                 }
298                 return "SubIfFlags(" + strconv.Itoa(int(n)) + ")"
299         }
300         for i := uint32(0); i <= 32; i++ {
301                 val := uint32(x)
302                 if val&(1<<i) != 0 {
303                         if s != "" {
304                                 s += "|"
305                         }
306                         s += str(1 << i)
307                 }
308         }
309         if s == "" {
310                 return str(uint32(x))
311         }
312         return s
313 }
314
315 // InterfaceIndex defines alias 'interface_index'.
316 type InterfaceIndex uint32
317
318 // RdmaCreate defines message 'rdma_create'.
319 type RdmaCreate struct {
320         HostIf  string   `binapi:"string[64],name=host_if" json:"host_if,omitempty"`
321         Name    string   `binapi:"string[64],name=name" json:"name,omitempty"`
322         RxqNum  uint16   `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"`
323         RxqSize uint16   `binapi:"u16,name=rxq_size,default=1024" json:"rxq_size,omitempty"`
324         TxqSize uint16   `binapi:"u16,name=txq_size,default=1024" json:"txq_size,omitempty"`
325         Mode    RdmaMode `binapi:"rdma_mode,name=mode,default=0" json:"mode,omitempty"`
326 }
327
328 func (m *RdmaCreate) Reset()               { *m = RdmaCreate{} }
329 func (*RdmaCreate) GetMessageName() string { return "rdma_create" }
330 func (*RdmaCreate) GetCrcString() string   { return "076fe418" }
331 func (*RdmaCreate) GetMessageType() api.MessageType {
332         return api.RequestMessage
333 }
334
335 func (m *RdmaCreate) Size() (size int) {
336         if m == nil {
337                 return 0
338         }
339         size += 64 // m.HostIf
340         size += 64 // m.Name
341         size += 2  // m.RxqNum
342         size += 2  // m.RxqSize
343         size += 2  // m.TxqSize
344         size += 4  // m.Mode
345         return size
346 }
347 func (m *RdmaCreate) Marshal(b []byte) ([]byte, error) {
348         if b == nil {
349                 b = make([]byte, m.Size())
350         }
351         buf := codec.NewBuffer(b)
352         buf.EncodeString(m.HostIf, 64)
353         buf.EncodeString(m.Name, 64)
354         buf.EncodeUint16(m.RxqNum)
355         buf.EncodeUint16(m.RxqSize)
356         buf.EncodeUint16(m.TxqSize)
357         buf.EncodeUint32(uint32(m.Mode))
358         return buf.Bytes(), nil
359 }
360 func (m *RdmaCreate) Unmarshal(b []byte) error {
361         buf := codec.NewBuffer(b)
362         m.HostIf = buf.DecodeString(64)
363         m.Name = buf.DecodeString(64)
364         m.RxqNum = buf.DecodeUint16()
365         m.RxqSize = buf.DecodeUint16()
366         m.TxqSize = buf.DecodeUint16()
367         m.Mode = RdmaMode(buf.DecodeUint32())
368         return nil
369 }
370
371 // RdmaCreateReply defines message 'rdma_create_reply'.
372 type RdmaCreateReply struct {
373         Retval    int32          `binapi:"i32,name=retval" json:"retval,omitempty"`
374         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
375 }
376
377 func (m *RdmaCreateReply) Reset()               { *m = RdmaCreateReply{} }
378 func (*RdmaCreateReply) GetMessageName() string { return "rdma_create_reply" }
379 func (*RdmaCreateReply) GetCrcString() string   { return "5383d31f" }
380 func (*RdmaCreateReply) GetMessageType() api.MessageType {
381         return api.ReplyMessage
382 }
383
384 func (m *RdmaCreateReply) Size() (size int) {
385         if m == nil {
386                 return 0
387         }
388         size += 4 // m.Retval
389         size += 4 // m.SwIfIndex
390         return size
391 }
392 func (m *RdmaCreateReply) Marshal(b []byte) ([]byte, error) {
393         if b == nil {
394                 b = make([]byte, m.Size())
395         }
396         buf := codec.NewBuffer(b)
397         buf.EncodeInt32(m.Retval)
398         buf.EncodeUint32(uint32(m.SwIfIndex))
399         return buf.Bytes(), nil
400 }
401 func (m *RdmaCreateReply) Unmarshal(b []byte) error {
402         buf := codec.NewBuffer(b)
403         m.Retval = buf.DecodeInt32()
404         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
405         return nil
406 }
407
408 // RdmaDelete defines message 'rdma_delete'.
409 type RdmaDelete struct {
410         SwIfIndex InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
411 }
412
413 func (m *RdmaDelete) Reset()               { *m = RdmaDelete{} }
414 func (*RdmaDelete) GetMessageName() string { return "rdma_delete" }
415 func (*RdmaDelete) GetCrcString() string   { return "f9e6675e" }
416 func (*RdmaDelete) GetMessageType() api.MessageType {
417         return api.RequestMessage
418 }
419
420 func (m *RdmaDelete) Size() (size int) {
421         if m == nil {
422                 return 0
423         }
424         size += 4 // m.SwIfIndex
425         return size
426 }
427 func (m *RdmaDelete) Marshal(b []byte) ([]byte, error) {
428         if b == nil {
429                 b = make([]byte, m.Size())
430         }
431         buf := codec.NewBuffer(b)
432         buf.EncodeUint32(uint32(m.SwIfIndex))
433         return buf.Bytes(), nil
434 }
435 func (m *RdmaDelete) Unmarshal(b []byte) error {
436         buf := codec.NewBuffer(b)
437         m.SwIfIndex = InterfaceIndex(buf.DecodeUint32())
438         return nil
439 }
440
441 // RdmaDeleteReply defines message 'rdma_delete_reply'.
442 type RdmaDeleteReply struct {
443         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
444 }
445
446 func (m *RdmaDeleteReply) Reset()               { *m = RdmaDeleteReply{} }
447 func (*RdmaDeleteReply) GetMessageName() string { return "rdma_delete_reply" }
448 func (*RdmaDeleteReply) GetCrcString() string   { return "e8d4e804" }
449 func (*RdmaDeleteReply) GetMessageType() api.MessageType {
450         return api.ReplyMessage
451 }
452
453 func (m *RdmaDeleteReply) Size() (size int) {
454         if m == nil {
455                 return 0
456         }
457         size += 4 // m.Retval
458         return size
459 }
460 func (m *RdmaDeleteReply) Marshal(b []byte) ([]byte, error) {
461         if b == nil {
462                 b = make([]byte, m.Size())
463         }
464         buf := codec.NewBuffer(b)
465         buf.EncodeInt32(m.Retval)
466         return buf.Bytes(), nil
467 }
468 func (m *RdmaDeleteReply) Unmarshal(b []byte) error {
469         buf := codec.NewBuffer(b)
470         m.Retval = buf.DecodeInt32()
471         return nil
472 }
473
474 func init() { file_rdma_binapi_init() }
475 func file_rdma_binapi_init() {
476         api.RegisterMessage((*RdmaCreate)(nil), "rdma_create_076fe418")
477         api.RegisterMessage((*RdmaCreateReply)(nil), "rdma_create_reply_5383d31f")
478         api.RegisterMessage((*RdmaDelete)(nil), "rdma_delete_f9e6675e")
479         api.RegisterMessage((*RdmaDeleteReply)(nil), "rdma_delete_reply_e8d4e804")
480 }
481
482 // Messages returns list of all messages in this module.
483 func AllMessages() []api.Message {
484         return []api.Message{
485                 (*RdmaCreate)(nil),
486                 (*RdmaCreateReply)(nil),
487                 (*RdmaDelete)(nil),
488                 (*RdmaDeleteReply)(nil),
489         }
490 }