Improve binapi generator
[govpp.git] / binapi / pipe / pipe.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/core/pipe.api.json
6
7 // Package pipe contains generated bindings for API file pipe.api.
8 //
9 // Contents:
10 //   6 messages
11 //
12 package pipe
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    = "pipe"
28         APIVersion = "1.0.1"
29         VersionCrc = 0xd22736c9
30 )
31
32 // PipeCreate defines message 'pipe_create'.
33 type PipeCreate struct {
34         IsSpecified  bool   `binapi:"bool,name=is_specified" json:"is_specified,omitempty"`
35         UserInstance uint32 `binapi:"u32,name=user_instance" json:"user_instance,omitempty"`
36 }
37
38 func (m *PipeCreate) Reset()               { *m = PipeCreate{} }
39 func (*PipeCreate) GetMessageName() string { return "pipe_create" }
40 func (*PipeCreate) GetCrcString() string   { return "bb263bd3" }
41 func (*PipeCreate) GetMessageType() api.MessageType {
42         return api.RequestMessage
43 }
44
45 func (m *PipeCreate) Size() int {
46         if m == nil {
47                 return 0
48         }
49         var size int
50         size += 1 // m.IsSpecified
51         size += 4 // m.UserInstance
52         return size
53 }
54 func (m *PipeCreate) Marshal(b []byte) ([]byte, error) {
55         var buf *codec.Buffer
56         if b == nil {
57                 buf = codec.NewBuffer(make([]byte, m.Size()))
58         } else {
59                 buf = codec.NewBuffer(b)
60         }
61         buf.EncodeBool(m.IsSpecified)
62         buf.EncodeUint32(uint32(m.UserInstance))
63         return buf.Bytes(), nil
64 }
65 func (m *PipeCreate) Unmarshal(b []byte) error {
66         buf := codec.NewBuffer(b)
67         m.IsSpecified = buf.DecodeBool()
68         m.UserInstance = buf.DecodeUint32()
69         return nil
70 }
71
72 // PipeCreateReply defines message 'pipe_create_reply'.
73 type PipeCreateReply struct {
74         Retval        int32                             `binapi:"i32,name=retval" json:"retval,omitempty"`
75         SwIfIndex     interface_types.InterfaceIndex    `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
76         PipeSwIfIndex [2]interface_types.InterfaceIndex `binapi:"interface_index[2],name=pipe_sw_if_index" json:"pipe_sw_if_index,omitempty"`
77 }
78
79 func (m *PipeCreateReply) Reset()               { *m = PipeCreateReply{} }
80 func (*PipeCreateReply) GetMessageName() string { return "pipe_create_reply" }
81 func (*PipeCreateReply) GetCrcString() string   { return "d4c2c2b3" }
82 func (*PipeCreateReply) GetMessageType() api.MessageType {
83         return api.ReplyMessage
84 }
85
86 func (m *PipeCreateReply) Size() int {
87         if m == nil {
88                 return 0
89         }
90         var size int
91         size += 4 // m.Retval
92         size += 4 // m.SwIfIndex
93         for j1 := 0; j1 < 2; j1++ {
94                 var s1 interface_types.InterfaceIndex
95                 _ = s1
96                 if j1 < len(m.PipeSwIfIndex) {
97                         s1 = m.PipeSwIfIndex[j1]
98                 }
99                 size += 4 // s1
100         }
101         return size
102 }
103 func (m *PipeCreateReply) Marshal(b []byte) ([]byte, error) {
104         var buf *codec.Buffer
105         if b == nil {
106                 buf = codec.NewBuffer(make([]byte, m.Size()))
107         } else {
108                 buf = codec.NewBuffer(b)
109         }
110         buf.EncodeUint32(uint32(m.Retval))
111         buf.EncodeUint32(uint32(m.SwIfIndex))
112         for j0 := 0; j0 < 2; j0++ {
113                 var v0 interface_types.InterfaceIndex
114                 if j0 < len(m.PipeSwIfIndex) {
115                         v0 = m.PipeSwIfIndex[j0]
116                 }
117                 buf.EncodeUint32(uint32(v0))
118         }
119         return buf.Bytes(), nil
120 }
121 func (m *PipeCreateReply) Unmarshal(b []byte) error {
122         buf := codec.NewBuffer(b)
123         m.Retval = int32(buf.DecodeUint32())
124         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
125         for j0 := 0; j0 < 2; j0++ {
126                 m.PipeSwIfIndex[j0] = interface_types.InterfaceIndex(buf.DecodeUint32())
127         }
128         return nil
129 }
130
131 // PipeDelete defines message 'pipe_delete'.
132 type PipeDelete struct {
133         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
134 }
135
136 func (m *PipeDelete) Reset()               { *m = PipeDelete{} }
137 func (*PipeDelete) GetMessageName() string { return "pipe_delete" }
138 func (*PipeDelete) GetCrcString() string   { return "f9e6675e" }
139 func (*PipeDelete) GetMessageType() api.MessageType {
140         return api.RequestMessage
141 }
142
143 func (m *PipeDelete) Size() int {
144         if m == nil {
145                 return 0
146         }
147         var size int
148         size += 4 // m.SwIfIndex
149         return size
150 }
151 func (m *PipeDelete) Marshal(b []byte) ([]byte, error) {
152         var buf *codec.Buffer
153         if b == nil {
154                 buf = codec.NewBuffer(make([]byte, m.Size()))
155         } else {
156                 buf = codec.NewBuffer(b)
157         }
158         buf.EncodeUint32(uint32(m.SwIfIndex))
159         return buf.Bytes(), nil
160 }
161 func (m *PipeDelete) Unmarshal(b []byte) error {
162         buf := codec.NewBuffer(b)
163         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
164         return nil
165 }
166
167 // PipeDeleteReply defines message 'pipe_delete_reply'.
168 type PipeDeleteReply struct {
169         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
170 }
171
172 func (m *PipeDeleteReply) Reset()               { *m = PipeDeleteReply{} }
173 func (*PipeDeleteReply) GetMessageName() string { return "pipe_delete_reply" }
174 func (*PipeDeleteReply) GetCrcString() string   { return "e8d4e804" }
175 func (*PipeDeleteReply) GetMessageType() api.MessageType {
176         return api.ReplyMessage
177 }
178
179 func (m *PipeDeleteReply) Size() int {
180         if m == nil {
181                 return 0
182         }
183         var size int
184         size += 4 // m.Retval
185         return size
186 }
187 func (m *PipeDeleteReply) Marshal(b []byte) ([]byte, error) {
188         var buf *codec.Buffer
189         if b == nil {
190                 buf = codec.NewBuffer(make([]byte, m.Size()))
191         } else {
192                 buf = codec.NewBuffer(b)
193         }
194         buf.EncodeUint32(uint32(m.Retval))
195         return buf.Bytes(), nil
196 }
197 func (m *PipeDeleteReply) Unmarshal(b []byte) error {
198         buf := codec.NewBuffer(b)
199         m.Retval = int32(buf.DecodeUint32())
200         return nil
201 }
202
203 // PipeDetails defines message 'pipe_details'.
204 type PipeDetails struct {
205         SwIfIndex     interface_types.InterfaceIndex    `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
206         PipeSwIfIndex [2]interface_types.InterfaceIndex `binapi:"interface_index[2],name=pipe_sw_if_index" json:"pipe_sw_if_index,omitempty"`
207         Instance      uint32                            `binapi:"u32,name=instance" json:"instance,omitempty"`
208 }
209
210 func (m *PipeDetails) Reset()               { *m = PipeDetails{} }
211 func (*PipeDetails) GetMessageName() string { return "pipe_details" }
212 func (*PipeDetails) GetCrcString() string   { return "43ac107a" }
213 func (*PipeDetails) GetMessageType() api.MessageType {
214         return api.ReplyMessage
215 }
216
217 func (m *PipeDetails) Size() int {
218         if m == nil {
219                 return 0
220         }
221         var size int
222         size += 4 // m.SwIfIndex
223         for j1 := 0; j1 < 2; j1++ {
224                 var s1 interface_types.InterfaceIndex
225                 _ = s1
226                 if j1 < len(m.PipeSwIfIndex) {
227                         s1 = m.PipeSwIfIndex[j1]
228                 }
229                 size += 4 // s1
230         }
231         size += 4 // m.Instance
232         return size
233 }
234 func (m *PipeDetails) Marshal(b []byte) ([]byte, error) {
235         var buf *codec.Buffer
236         if b == nil {
237                 buf = codec.NewBuffer(make([]byte, m.Size()))
238         } else {
239                 buf = codec.NewBuffer(b)
240         }
241         buf.EncodeUint32(uint32(m.SwIfIndex))
242         for j0 := 0; j0 < 2; j0++ {
243                 var v0 interface_types.InterfaceIndex
244                 if j0 < len(m.PipeSwIfIndex) {
245                         v0 = m.PipeSwIfIndex[j0]
246                 }
247                 buf.EncodeUint32(uint32(v0))
248         }
249         buf.EncodeUint32(uint32(m.Instance))
250         return buf.Bytes(), nil
251 }
252 func (m *PipeDetails) Unmarshal(b []byte) error {
253         buf := codec.NewBuffer(b)
254         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
255         for j0 := 0; j0 < 2; j0++ {
256                 m.PipeSwIfIndex[j0] = interface_types.InterfaceIndex(buf.DecodeUint32())
257         }
258         m.Instance = buf.DecodeUint32()
259         return nil
260 }
261
262 // PipeDump defines message 'pipe_dump'.
263 type PipeDump struct{}
264
265 func (m *PipeDump) Reset()               { *m = PipeDump{} }
266 func (*PipeDump) GetMessageName() string { return "pipe_dump" }
267 func (*PipeDump) GetCrcString() string   { return "51077d14" }
268 func (*PipeDump) GetMessageType() api.MessageType {
269         return api.RequestMessage
270 }
271
272 func (m *PipeDump) Size() int {
273         if m == nil {
274                 return 0
275         }
276         var size int
277         return size
278 }
279 func (m *PipeDump) Marshal(b []byte) ([]byte, error) {
280         var buf *codec.Buffer
281         if b == nil {
282                 buf = codec.NewBuffer(make([]byte, m.Size()))
283         } else {
284                 buf = codec.NewBuffer(b)
285         }
286         return buf.Bytes(), nil
287 }
288 func (m *PipeDump) Unmarshal(b []byte) error {
289         return nil
290 }
291
292 func init() { file_pipe_binapi_init() }
293 func file_pipe_binapi_init() {
294         api.RegisterMessage((*PipeCreate)(nil), "pipe_create_bb263bd3")
295         api.RegisterMessage((*PipeCreateReply)(nil), "pipe_create_reply_d4c2c2b3")
296         api.RegisterMessage((*PipeDelete)(nil), "pipe_delete_f9e6675e")
297         api.RegisterMessage((*PipeDeleteReply)(nil), "pipe_delete_reply_e8d4e804")
298         api.RegisterMessage((*PipeDetails)(nil), "pipe_details_43ac107a")
299         api.RegisterMessage((*PipeDump)(nil), "pipe_dump_51077d14")
300 }
301
302 // Messages returns list of all messages in this module.
303 func AllMessages() []api.Message {
304         return []api.Message{
305                 (*PipeCreate)(nil),
306                 (*PipeCreateReply)(nil),
307                 (*PipeDelete)(nil),
308                 (*PipeDeleteReply)(nil),
309                 (*PipeDetails)(nil),
310                 (*PipeDump)(nil),
311         }
312 }