f8483fc6488e875016a188d97c53ee69077fd99e
[govpp.git] / binapi / punt / punt.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
6 // Package punt contains generated bindings for API file punt.api.
7 //
8 // Contents:
9 //   1 enum
10 //   5 structs
11 //   1 union
12 //  10 messages
13 //
14 package punt
15
16 import (
17         "strconv"
18
19         api "git.fd.io/govpp.git/api"
20         ip_types "git.fd.io/govpp.git/binapi/ip_types"
21         codec "git.fd.io/govpp.git/codec"
22 )
23
24 // This is a compile-time assertion to ensure that this generated file
25 // is compatible with the GoVPP api package it is being compiled against.
26 // A compilation error at this line likely means your copy of the
27 // GoVPP api package needs to be updated.
28 const _ = api.GoVppAPIPackageIsVersion2
29
30 const (
31         APIFile    = "punt"
32         APIVersion = "2.2.1"
33         VersionCrc = 0x31354154
34 )
35
36 // PuntType defines enum 'punt_type'.
37 type PuntType uint32
38
39 const (
40         PUNT_API_TYPE_L4        PuntType = 1
41         PUNT_API_TYPE_IP_PROTO  PuntType = 2
42         PUNT_API_TYPE_EXCEPTION PuntType = 3
43 )
44
45 var (
46         PuntType_name = map[uint32]string{
47                 1: "PUNT_API_TYPE_L4",
48                 2: "PUNT_API_TYPE_IP_PROTO",
49                 3: "PUNT_API_TYPE_EXCEPTION",
50         }
51         PuntType_value = map[string]uint32{
52                 "PUNT_API_TYPE_L4":        1,
53                 "PUNT_API_TYPE_IP_PROTO":  2,
54                 "PUNT_API_TYPE_EXCEPTION": 3,
55         }
56 )
57
58 func (x PuntType) String() string {
59         s, ok := PuntType_name[uint32(x)]
60         if ok {
61                 return s
62         }
63         return "PuntType(" + strconv.Itoa(int(x)) + ")"
64 }
65
66 // Punt defines type 'punt'.
67 type Punt struct {
68         Type PuntType  `binapi:"punt_type,name=type" json:"type,omitempty"`
69         Punt PuntUnion `binapi:"punt_union,name=punt" json:"punt,omitempty"`
70 }
71
72 // PuntException defines type 'punt_exception'.
73 type PuntException struct {
74         ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
75 }
76
77 // PuntIPProto defines type 'punt_ip_proto'.
78 type PuntIPProto struct {
79         Af       ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
80         Protocol ip_types.IPProto       `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"`
81 }
82
83 // PuntL4 defines type 'punt_l4'.
84 type PuntL4 struct {
85         Af       ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
86         Protocol ip_types.IPProto       `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"`
87         Port     uint16                 `binapi:"u16,name=port" json:"port,omitempty"`
88 }
89
90 // PuntReason defines type 'punt_reason'.
91 type PuntReason struct {
92         ID   uint32 `binapi:"u32,name=id" json:"id,omitempty"`
93         Name string `binapi:"string[],name=name" json:"name,omitempty"`
94 }
95
96 // PuntUnion defines union 'punt_union'.
97 type PuntUnion struct {
98         // Exception *PuntException
99         // L4 *PuntL4
100         // IPProto *PuntIPProto
101         XXX_UnionData [4]byte
102 }
103
104 func PuntUnionException(a PuntException) (u PuntUnion) {
105         u.SetException(a)
106         return
107 }
108 func (u *PuntUnion) SetException(a PuntException) {
109         buf := codec.NewBuffer(u.XXX_UnionData[:])
110         buf.EncodeUint32(a.ID)
111 }
112 func (u *PuntUnion) GetException() (a PuntException) {
113         buf := codec.NewBuffer(u.XXX_UnionData[:])
114         a.ID = buf.DecodeUint32()
115         return
116 }
117
118 func PuntUnionL4(a PuntL4) (u PuntUnion) {
119         u.SetL4(a)
120         return
121 }
122 func (u *PuntUnion) SetL4(a PuntL4) {
123         buf := codec.NewBuffer(u.XXX_UnionData[:])
124         buf.EncodeUint8(uint8(a.Af))
125         buf.EncodeUint8(uint8(a.Protocol))
126         buf.EncodeUint16(a.Port)
127 }
128 func (u *PuntUnion) GetL4() (a PuntL4) {
129         buf := codec.NewBuffer(u.XXX_UnionData[:])
130         a.Af = ip_types.AddressFamily(buf.DecodeUint8())
131         a.Protocol = ip_types.IPProto(buf.DecodeUint8())
132         a.Port = buf.DecodeUint16()
133         return
134 }
135
136 func PuntUnionIPProto(a PuntIPProto) (u PuntUnion) {
137         u.SetIPProto(a)
138         return
139 }
140 func (u *PuntUnion) SetIPProto(a PuntIPProto) {
141         buf := codec.NewBuffer(u.XXX_UnionData[:])
142         buf.EncodeUint8(uint8(a.Af))
143         buf.EncodeUint8(uint8(a.Protocol))
144 }
145 func (u *PuntUnion) GetIPProto() (a PuntIPProto) {
146         buf := codec.NewBuffer(u.XXX_UnionData[:])
147         a.Af = ip_types.AddressFamily(buf.DecodeUint8())
148         a.Protocol = ip_types.IPProto(buf.DecodeUint8())
149         return
150 }
151
152 // PuntReasonDetails defines message 'punt_reason_details'.
153 type PuntReasonDetails struct {
154         Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"`
155 }
156
157 func (m *PuntReasonDetails) Reset()               { *m = PuntReasonDetails{} }
158 func (*PuntReasonDetails) GetMessageName() string { return "punt_reason_details" }
159 func (*PuntReasonDetails) GetCrcString() string   { return "2c9d4a40" }
160 func (*PuntReasonDetails) GetMessageType() api.MessageType {
161         return api.ReplyMessage
162 }
163
164 func (m *PuntReasonDetails) Size() (size int) {
165         if m == nil {
166                 return 0
167         }
168         size += 4                      // m.Reason.ID
169         size += 4 + len(m.Reason.Name) // m.Reason.Name
170         return size
171 }
172 func (m *PuntReasonDetails) Marshal(b []byte) ([]byte, error) {
173         if b == nil {
174                 b = make([]byte, m.Size())
175         }
176         buf := codec.NewBuffer(b)
177         buf.EncodeUint32(m.Reason.ID)
178         buf.EncodeString(m.Reason.Name, 0)
179         return buf.Bytes(), nil
180 }
181 func (m *PuntReasonDetails) Unmarshal(b []byte) error {
182         buf := codec.NewBuffer(b)
183         m.Reason.ID = buf.DecodeUint32()
184         m.Reason.Name = buf.DecodeString(0)
185         return nil
186 }
187
188 // PuntReasonDump defines message 'punt_reason_dump'.
189 type PuntReasonDump struct {
190         Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"`
191 }
192
193 func (m *PuntReasonDump) Reset()               { *m = PuntReasonDump{} }
194 func (*PuntReasonDump) GetMessageName() string { return "punt_reason_dump" }
195 func (*PuntReasonDump) GetCrcString() string   { return "5c0dd4fe" }
196 func (*PuntReasonDump) GetMessageType() api.MessageType {
197         return api.RequestMessage
198 }
199
200 func (m *PuntReasonDump) Size() (size int) {
201         if m == nil {
202                 return 0
203         }
204         size += 4                      // m.Reason.ID
205         size += 4 + len(m.Reason.Name) // m.Reason.Name
206         return size
207 }
208 func (m *PuntReasonDump) Marshal(b []byte) ([]byte, error) {
209         if b == nil {
210                 b = make([]byte, m.Size())
211         }
212         buf := codec.NewBuffer(b)
213         buf.EncodeUint32(m.Reason.ID)
214         buf.EncodeString(m.Reason.Name, 0)
215         return buf.Bytes(), nil
216 }
217 func (m *PuntReasonDump) Unmarshal(b []byte) error {
218         buf := codec.NewBuffer(b)
219         m.Reason.ID = buf.DecodeUint32()
220         m.Reason.Name = buf.DecodeString(0)
221         return nil
222 }
223
224 // PuntSocketDeregister defines message 'punt_socket_deregister'.
225 type PuntSocketDeregister struct {
226         Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"`
227 }
228
229 func (m *PuntSocketDeregister) Reset()               { *m = PuntSocketDeregister{} }
230 func (*PuntSocketDeregister) GetMessageName() string { return "punt_socket_deregister" }
231 func (*PuntSocketDeregister) GetCrcString() string   { return "98a444f4" }
232 func (*PuntSocketDeregister) GetMessageType() api.MessageType {
233         return api.RequestMessage
234 }
235
236 func (m *PuntSocketDeregister) Size() (size int) {
237         if m == nil {
238                 return 0
239         }
240         size += 4     // m.Punt.Type
241         size += 1 * 4 // m.Punt.Punt
242         return size
243 }
244 func (m *PuntSocketDeregister) Marshal(b []byte) ([]byte, error) {
245         if b == nil {
246                 b = make([]byte, m.Size())
247         }
248         buf := codec.NewBuffer(b)
249         buf.EncodeUint32(uint32(m.Punt.Type))
250         buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
251         return buf.Bytes(), nil
252 }
253 func (m *PuntSocketDeregister) Unmarshal(b []byte) error {
254         buf := codec.NewBuffer(b)
255         m.Punt.Type = PuntType(buf.DecodeUint32())
256         copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
257         return nil
258 }
259
260 // PuntSocketDeregisterReply defines message 'punt_socket_deregister_reply'.
261 type PuntSocketDeregisterReply struct {
262         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
263 }
264
265 func (m *PuntSocketDeregisterReply) Reset()               { *m = PuntSocketDeregisterReply{} }
266 func (*PuntSocketDeregisterReply) GetMessageName() string { return "punt_socket_deregister_reply" }
267 func (*PuntSocketDeregisterReply) GetCrcString() string   { return "e8d4e804" }
268 func (*PuntSocketDeregisterReply) GetMessageType() api.MessageType {
269         return api.ReplyMessage
270 }
271
272 func (m *PuntSocketDeregisterReply) Size() (size int) {
273         if m == nil {
274                 return 0
275         }
276         size += 4 // m.Retval
277         return size
278 }
279 func (m *PuntSocketDeregisterReply) Marshal(b []byte) ([]byte, error) {
280         if b == nil {
281                 b = make([]byte, m.Size())
282         }
283         buf := codec.NewBuffer(b)
284         buf.EncodeInt32(m.Retval)
285         return buf.Bytes(), nil
286 }
287 func (m *PuntSocketDeregisterReply) Unmarshal(b []byte) error {
288         buf := codec.NewBuffer(b)
289         m.Retval = buf.DecodeInt32()
290         return nil
291 }
292
293 // PuntSocketDetails defines message 'punt_socket_details'.
294 type PuntSocketDetails struct {
295         Punt     Punt   `binapi:"punt,name=punt" json:"punt,omitempty"`
296         Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
297 }
298
299 func (m *PuntSocketDetails) Reset()               { *m = PuntSocketDetails{} }
300 func (*PuntSocketDetails) GetMessageName() string { return "punt_socket_details" }
301 func (*PuntSocketDetails) GetCrcString() string   { return "1de0ce75" }
302 func (*PuntSocketDetails) GetMessageType() api.MessageType {
303         return api.ReplyMessage
304 }
305
306 func (m *PuntSocketDetails) Size() (size int) {
307         if m == nil {
308                 return 0
309         }
310         size += 4     // m.Punt.Type
311         size += 1 * 4 // m.Punt.Punt
312         size += 108   // m.Pathname
313         return size
314 }
315 func (m *PuntSocketDetails) Marshal(b []byte) ([]byte, error) {
316         if b == nil {
317                 b = make([]byte, m.Size())
318         }
319         buf := codec.NewBuffer(b)
320         buf.EncodeUint32(uint32(m.Punt.Type))
321         buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
322         buf.EncodeString(m.Pathname, 108)
323         return buf.Bytes(), nil
324 }
325 func (m *PuntSocketDetails) Unmarshal(b []byte) error {
326         buf := codec.NewBuffer(b)
327         m.Punt.Type = PuntType(buf.DecodeUint32())
328         copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
329         m.Pathname = buf.DecodeString(108)
330         return nil
331 }
332
333 // PuntSocketDump defines message 'punt_socket_dump'.
334 type PuntSocketDump struct {
335         Type PuntType `binapi:"punt_type,name=type" json:"type,omitempty"`
336 }
337
338 func (m *PuntSocketDump) Reset()               { *m = PuntSocketDump{} }
339 func (*PuntSocketDump) GetMessageName() string { return "punt_socket_dump" }
340 func (*PuntSocketDump) GetCrcString() string   { return "52974935" }
341 func (*PuntSocketDump) GetMessageType() api.MessageType {
342         return api.RequestMessage
343 }
344
345 func (m *PuntSocketDump) Size() (size int) {
346         if m == nil {
347                 return 0
348         }
349         size += 4 // m.Type
350         return size
351 }
352 func (m *PuntSocketDump) Marshal(b []byte) ([]byte, error) {
353         if b == nil {
354                 b = make([]byte, m.Size())
355         }
356         buf := codec.NewBuffer(b)
357         buf.EncodeUint32(uint32(m.Type))
358         return buf.Bytes(), nil
359 }
360 func (m *PuntSocketDump) Unmarshal(b []byte) error {
361         buf := codec.NewBuffer(b)
362         m.Type = PuntType(buf.DecodeUint32())
363         return nil
364 }
365
366 // PuntSocketRegister defines message 'punt_socket_register'.
367 type PuntSocketRegister struct {
368         HeaderVersion uint32 `binapi:"u32,name=header_version" json:"header_version,omitempty"`
369         Punt          Punt   `binapi:"punt,name=punt" json:"punt,omitempty"`
370         Pathname      string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
371 }
372
373 func (m *PuntSocketRegister) Reset()               { *m = PuntSocketRegister{} }
374 func (*PuntSocketRegister) GetMessageName() string { return "punt_socket_register" }
375 func (*PuntSocketRegister) GetCrcString() string   { return "c8cd10fa" }
376 func (*PuntSocketRegister) GetMessageType() api.MessageType {
377         return api.RequestMessage
378 }
379
380 func (m *PuntSocketRegister) Size() (size int) {
381         if m == nil {
382                 return 0
383         }
384         size += 4     // m.HeaderVersion
385         size += 4     // m.Punt.Type
386         size += 1 * 4 // m.Punt.Punt
387         size += 108   // m.Pathname
388         return size
389 }
390 func (m *PuntSocketRegister) Marshal(b []byte) ([]byte, error) {
391         if b == nil {
392                 b = make([]byte, m.Size())
393         }
394         buf := codec.NewBuffer(b)
395         buf.EncodeUint32(m.HeaderVersion)
396         buf.EncodeUint32(uint32(m.Punt.Type))
397         buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
398         buf.EncodeString(m.Pathname, 108)
399         return buf.Bytes(), nil
400 }
401 func (m *PuntSocketRegister) Unmarshal(b []byte) error {
402         buf := codec.NewBuffer(b)
403         m.HeaderVersion = buf.DecodeUint32()
404         m.Punt.Type = PuntType(buf.DecodeUint32())
405         copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
406         m.Pathname = buf.DecodeString(108)
407         return nil
408 }
409
410 // PuntSocketRegisterReply defines message 'punt_socket_register_reply'.
411 type PuntSocketRegisterReply struct {
412         Retval   int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
413         Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
414 }
415
416 func (m *PuntSocketRegisterReply) Reset()               { *m = PuntSocketRegisterReply{} }
417 func (*PuntSocketRegisterReply) GetMessageName() string { return "punt_socket_register_reply" }
418 func (*PuntSocketRegisterReply) GetCrcString() string   { return "bd30ae90" }
419 func (*PuntSocketRegisterReply) GetMessageType() api.MessageType {
420         return api.ReplyMessage
421 }
422
423 func (m *PuntSocketRegisterReply) Size() (size int) {
424         if m == nil {
425                 return 0
426         }
427         size += 4   // m.Retval
428         size += 108 // m.Pathname
429         return size
430 }
431 func (m *PuntSocketRegisterReply) 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         buf.EncodeString(m.Pathname, 108)
438         return buf.Bytes(), nil
439 }
440 func (m *PuntSocketRegisterReply) Unmarshal(b []byte) error {
441         buf := codec.NewBuffer(b)
442         m.Retval = buf.DecodeInt32()
443         m.Pathname = buf.DecodeString(108)
444         return nil
445 }
446
447 // SetPunt defines message 'set_punt'.
448 type SetPunt struct {
449         IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
450         Punt  Punt `binapi:"punt,name=punt" json:"punt,omitempty"`
451 }
452
453 func (m *SetPunt) Reset()               { *m = SetPunt{} }
454 func (*SetPunt) GetMessageName() string { return "set_punt" }
455 func (*SetPunt) GetCrcString() string   { return "83799618" }
456 func (*SetPunt) GetMessageType() api.MessageType {
457         return api.RequestMessage
458 }
459
460 func (m *SetPunt) Size() (size int) {
461         if m == nil {
462                 return 0
463         }
464         size += 1     // m.IsAdd
465         size += 4     // m.Punt.Type
466         size += 1 * 4 // m.Punt.Punt
467         return size
468 }
469 func (m *SetPunt) Marshal(b []byte) ([]byte, error) {
470         if b == nil {
471                 b = make([]byte, m.Size())
472         }
473         buf := codec.NewBuffer(b)
474         buf.EncodeBool(m.IsAdd)
475         buf.EncodeUint32(uint32(m.Punt.Type))
476         buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
477         return buf.Bytes(), nil
478 }
479 func (m *SetPunt) Unmarshal(b []byte) error {
480         buf := codec.NewBuffer(b)
481         m.IsAdd = buf.DecodeBool()
482         m.Punt.Type = PuntType(buf.DecodeUint32())
483         copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
484         return nil
485 }
486
487 // SetPuntReply defines message 'set_punt_reply'.
488 type SetPuntReply struct {
489         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
490 }
491
492 func (m *SetPuntReply) Reset()               { *m = SetPuntReply{} }
493 func (*SetPuntReply) GetMessageName() string { return "set_punt_reply" }
494 func (*SetPuntReply) GetCrcString() string   { return "e8d4e804" }
495 func (*SetPuntReply) GetMessageType() api.MessageType {
496         return api.ReplyMessage
497 }
498
499 func (m *SetPuntReply) Size() (size int) {
500         if m == nil {
501                 return 0
502         }
503         size += 4 // m.Retval
504         return size
505 }
506 func (m *SetPuntReply) Marshal(b []byte) ([]byte, error) {
507         if b == nil {
508                 b = make([]byte, m.Size())
509         }
510         buf := codec.NewBuffer(b)
511         buf.EncodeInt32(m.Retval)
512         return buf.Bytes(), nil
513 }
514 func (m *SetPuntReply) Unmarshal(b []byte) error {
515         buf := codec.NewBuffer(b)
516         m.Retval = buf.DecodeInt32()
517         return nil
518 }
519
520 func init() { file_punt_binapi_init() }
521 func file_punt_binapi_init() {
522         api.RegisterMessage((*PuntReasonDetails)(nil), "punt_reason_details_2c9d4a40")
523         api.RegisterMessage((*PuntReasonDump)(nil), "punt_reason_dump_5c0dd4fe")
524         api.RegisterMessage((*PuntSocketDeregister)(nil), "punt_socket_deregister_98a444f4")
525         api.RegisterMessage((*PuntSocketDeregisterReply)(nil), "punt_socket_deregister_reply_e8d4e804")
526         api.RegisterMessage((*PuntSocketDetails)(nil), "punt_socket_details_1de0ce75")
527         api.RegisterMessage((*PuntSocketDump)(nil), "punt_socket_dump_52974935")
528         api.RegisterMessage((*PuntSocketRegister)(nil), "punt_socket_register_c8cd10fa")
529         api.RegisterMessage((*PuntSocketRegisterReply)(nil), "punt_socket_register_reply_bd30ae90")
530         api.RegisterMessage((*SetPunt)(nil), "set_punt_83799618")
531         api.RegisterMessage((*SetPuntReply)(nil), "set_punt_reply_e8d4e804")
532 }
533
534 // Messages returns list of all messages in this module.
535 func AllMessages() []api.Message {
536         return []api.Message{
537                 (*PuntReasonDetails)(nil),
538                 (*PuntReasonDump)(nil),
539                 (*PuntSocketDeregister)(nil),
540                 (*PuntSocketDeregisterReply)(nil),
541                 (*PuntSocketDetails)(nil),
542                 (*PuntSocketDump)(nil),
543                 (*PuntSocketRegister)(nil),
544                 (*PuntSocketRegisterReply)(nil),
545                 (*SetPunt)(nil),
546                 (*SetPuntReply)(nil),
547         }
548 }