Improve binapi generator
[govpp.git] / binapi / 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.05-release
5 // source: /usr/share/vpp/api/plugins/rdma.api.json
6
7 // Package rdma contains generated bindings for API file rdma.api.
8 //
9 // Contents:
10 //   1 enum
11 //   4 messages
12 //
13 package rdma
14
15 import (
16         api "git.fd.io/govpp.git/api"
17         interface_types "git.fd.io/govpp.git/binapi/interface_types"
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 = 0x8b33158c
32 )
33
34 // RdmaMode defines enum 'rdma_mode'.
35 type RdmaMode uint32
36
37 const (
38         RDMA_API_MODE_AUTO RdmaMode = 0
39         RDMA_API_MODE_IBV  RdmaMode = 1
40         RDMA_API_MODE_DV   RdmaMode = 2
41 )
42
43 var (
44         RdmaMode_name = map[uint32]string{
45                 0: "RDMA_API_MODE_AUTO",
46                 1: "RDMA_API_MODE_IBV",
47                 2: "RDMA_API_MODE_DV",
48         }
49         RdmaMode_value = map[string]uint32{
50                 "RDMA_API_MODE_AUTO": 0,
51                 "RDMA_API_MODE_IBV":  1,
52                 "RDMA_API_MODE_DV":   2,
53         }
54 )
55
56 func (x RdmaMode) String() string {
57         s, ok := RdmaMode_name[uint32(x)]
58         if ok {
59                 return s
60         }
61         return "RdmaMode(" + strconv.Itoa(int(x)) + ")"
62 }
63
64 // RdmaCreate defines message 'rdma_create'.
65 type RdmaCreate struct {
66         HostIf  string   `binapi:"string[64],name=host_if" json:"host_if,omitempty"`
67         Name    string   `binapi:"string[64],name=name" json:"name,omitempty"`
68         RxqNum  uint16   `binapi:"u16,name=rxq_num,default=%!s(float64=1)" json:"rxq_num,omitempty"`
69         RxqSize uint16   `binapi:"u16,name=rxq_size,default=%!s(float64=1024)" json:"rxq_size,omitempty"`
70         TxqSize uint16   `binapi:"u16,name=txq_size,default=%!s(float64=1024)" json:"txq_size,omitempty"`
71         Mode    RdmaMode `binapi:"rdma_mode,name=mode,default=%!s(float64=0)" json:"mode,omitempty"`
72 }
73
74 func (m *RdmaCreate) Reset()               { *m = RdmaCreate{} }
75 func (*RdmaCreate) GetMessageName() string { return "rdma_create" }
76 func (*RdmaCreate) GetCrcString() string   { return "076fe418" }
77 func (*RdmaCreate) GetMessageType() api.MessageType {
78         return api.RequestMessage
79 }
80
81 func (m *RdmaCreate) Size() int {
82         if m == nil {
83                 return 0
84         }
85         var size int
86         size += 64 // m.HostIf
87         size += 64 // m.Name
88         size += 2  // m.RxqNum
89         size += 2  // m.RxqSize
90         size += 2  // m.TxqSize
91         size += 4  // m.Mode
92         return size
93 }
94 func (m *RdmaCreate) Marshal(b []byte) ([]byte, error) {
95         var buf *codec.Buffer
96         if b == nil {
97                 buf = codec.NewBuffer(make([]byte, m.Size()))
98         } else {
99                 buf = codec.NewBuffer(b)
100         }
101         buf.EncodeString(m.HostIf, 64)
102         buf.EncodeString(m.Name, 64)
103         buf.EncodeUint16(uint16(m.RxqNum))
104         buf.EncodeUint16(uint16(m.RxqSize))
105         buf.EncodeUint16(uint16(m.TxqSize))
106         buf.EncodeUint32(uint32(m.Mode))
107         return buf.Bytes(), nil
108 }
109 func (m *RdmaCreate) Unmarshal(b []byte) error {
110         buf := codec.NewBuffer(b)
111         m.HostIf = buf.DecodeString(64)
112         m.Name = buf.DecodeString(64)
113         m.RxqNum = buf.DecodeUint16()
114         m.RxqSize = buf.DecodeUint16()
115         m.TxqSize = buf.DecodeUint16()
116         m.Mode = RdmaMode(buf.DecodeUint32())
117         return nil
118 }
119
120 // RdmaCreateReply defines message 'rdma_create_reply'.
121 type RdmaCreateReply struct {
122         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
123         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
124 }
125
126 func (m *RdmaCreateReply) Reset()               { *m = RdmaCreateReply{} }
127 func (*RdmaCreateReply) GetMessageName() string { return "rdma_create_reply" }
128 func (*RdmaCreateReply) GetCrcString() string   { return "5383d31f" }
129 func (*RdmaCreateReply) GetMessageType() api.MessageType {
130         return api.ReplyMessage
131 }
132
133 func (m *RdmaCreateReply) Size() int {
134         if m == nil {
135                 return 0
136         }
137         var size int
138         size += 4 // m.Retval
139         size += 4 // m.SwIfIndex
140         return size
141 }
142 func (m *RdmaCreateReply) Marshal(b []byte) ([]byte, error) {
143         var buf *codec.Buffer
144         if b == nil {
145                 buf = codec.NewBuffer(make([]byte, m.Size()))
146         } else {
147                 buf = codec.NewBuffer(b)
148         }
149         buf.EncodeUint32(uint32(m.Retval))
150         buf.EncodeUint32(uint32(m.SwIfIndex))
151         return buf.Bytes(), nil
152 }
153 func (m *RdmaCreateReply) Unmarshal(b []byte) error {
154         buf := codec.NewBuffer(b)
155         m.Retval = int32(buf.DecodeUint32())
156         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
157         return nil
158 }
159
160 // RdmaDelete defines message 'rdma_delete'.
161 type RdmaDelete struct {
162         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
163 }
164
165 func (m *RdmaDelete) Reset()               { *m = RdmaDelete{} }
166 func (*RdmaDelete) GetMessageName() string { return "rdma_delete" }
167 func (*RdmaDelete) GetCrcString() string   { return "f9e6675e" }
168 func (*RdmaDelete) GetMessageType() api.MessageType {
169         return api.RequestMessage
170 }
171
172 func (m *RdmaDelete) Size() int {
173         if m == nil {
174                 return 0
175         }
176         var size int
177         size += 4 // m.SwIfIndex
178         return size
179 }
180 func (m *RdmaDelete) Marshal(b []byte) ([]byte, error) {
181         var buf *codec.Buffer
182         if b == nil {
183                 buf = codec.NewBuffer(make([]byte, m.Size()))
184         } else {
185                 buf = codec.NewBuffer(b)
186         }
187         buf.EncodeUint32(uint32(m.SwIfIndex))
188         return buf.Bytes(), nil
189 }
190 func (m *RdmaDelete) Unmarshal(b []byte) error {
191         buf := codec.NewBuffer(b)
192         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
193         return nil
194 }
195
196 // RdmaDeleteReply defines message 'rdma_delete_reply'.
197 type RdmaDeleteReply struct {
198         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
199 }
200
201 func (m *RdmaDeleteReply) Reset()               { *m = RdmaDeleteReply{} }
202 func (*RdmaDeleteReply) GetMessageName() string { return "rdma_delete_reply" }
203 func (*RdmaDeleteReply) GetCrcString() string   { return "e8d4e804" }
204 func (*RdmaDeleteReply) GetMessageType() api.MessageType {
205         return api.ReplyMessage
206 }
207
208 func (m *RdmaDeleteReply) Size() int {
209         if m == nil {
210                 return 0
211         }
212         var size int
213         size += 4 // m.Retval
214         return size
215 }
216 func (m *RdmaDeleteReply) Marshal(b []byte) ([]byte, error) {
217         var buf *codec.Buffer
218         if b == nil {
219                 buf = codec.NewBuffer(make([]byte, m.Size()))
220         } else {
221                 buf = codec.NewBuffer(b)
222         }
223         buf.EncodeUint32(uint32(m.Retval))
224         return buf.Bytes(), nil
225 }
226 func (m *RdmaDeleteReply) Unmarshal(b []byte) error {
227         buf := codec.NewBuffer(b)
228         m.Retval = int32(buf.DecodeUint32())
229         return nil
230 }
231
232 func init() { file_rdma_binapi_init() }
233 func file_rdma_binapi_init() {
234         api.RegisterMessage((*RdmaCreate)(nil), "rdma_create_076fe418")
235         api.RegisterMessage((*RdmaCreateReply)(nil), "rdma_create_reply_5383d31f")
236         api.RegisterMessage((*RdmaDelete)(nil), "rdma_delete_f9e6675e")
237         api.RegisterMessage((*RdmaDeleteReply)(nil), "rdma_delete_reply_e8d4e804")
238 }
239
240 // Messages returns list of all messages in this module.
241 func AllMessages() []api.Message {
242         return []api.Message{
243                 (*RdmaCreate)(nil),
244                 (*RdmaCreateReply)(nil),
245                 (*RdmaDelete)(nil),
246                 (*RdmaDeleteReply)(nil),
247         }
248 }