1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.5.0-dev
5 // source: /usr/share/vpp/api/core/punt.api.json
7 // Package punt contains generated bindings for API file punt.api.
20 api "git.fd.io/govpp.git/api"
21 ip_types "git.fd.io/govpp.git/binapi/ip_types"
22 codec "git.fd.io/govpp.git/codec"
25 // This is a compile-time assertion to ensure that this generated file
26 // is compatible with the GoVPP api package it is being compiled against.
27 // A compilation error at this line likely means your copy of the
28 // GoVPP api package needs to be updated.
29 const _ = api.GoVppAPIPackageIsVersion2
34 VersionCrc = 0xee63b6c7
37 // PuntType defines enum 'punt_type'.
41 PUNT_API_TYPE_L4 PuntType = 1
42 PUNT_API_TYPE_IP_PROTO PuntType = 2
43 PUNT_API_TYPE_EXCEPTION PuntType = 3
47 PuntType_name = map[uint32]string{
48 1: "PUNT_API_TYPE_L4",
49 2: "PUNT_API_TYPE_IP_PROTO",
50 3: "PUNT_API_TYPE_EXCEPTION",
52 PuntType_value = map[string]uint32{
53 "PUNT_API_TYPE_L4": 1,
54 "PUNT_API_TYPE_IP_PROTO": 2,
55 "PUNT_API_TYPE_EXCEPTION": 3,
59 func (x PuntType) String() string {
60 s, ok := PuntType_name[uint32(x)]
64 return "PuntType(" + strconv.Itoa(int(x)) + ")"
67 // Punt defines type 'punt'.
69 Type PuntType `binapi:"punt_type,name=type" json:"type,omitempty"`
70 Punt PuntUnion `binapi:"punt_union,name=punt" json:"punt,omitempty"`
73 // PuntException defines type 'punt_exception'.
74 type PuntException struct {
75 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
78 // PuntIPProto defines type 'punt_ip_proto'.
79 type PuntIPProto struct {
80 Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
81 Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"`
84 // PuntL4 defines type 'punt_l4'.
86 Af ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
87 Protocol ip_types.IPProto `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"`
88 Port uint16 `binapi:"u16,name=port" json:"port,omitempty"`
91 // PuntReason defines type 'punt_reason'.
92 type PuntReason struct {
93 ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
94 Name string `binapi:"string[],name=name" json:"name,omitempty"`
97 // PuntUnion defines union 'punt_union'.
98 type PuntUnion struct {
99 // PuntUnion can be one of:
100 // - Exception *PuntException
102 // - IPProto *PuntIPProto
103 XXX_UnionData [4]byte
106 func PuntUnionException(a PuntException) (u PuntUnion) {
110 func (u *PuntUnion) SetException(a PuntException) {
111 buf := codec.NewBuffer(u.XXX_UnionData[:])
112 buf.EncodeUint32(a.ID)
114 func (u *PuntUnion) GetException() (a PuntException) {
115 buf := codec.NewBuffer(u.XXX_UnionData[:])
116 a.ID = buf.DecodeUint32()
120 func PuntUnionL4(a PuntL4) (u PuntUnion) {
124 func (u *PuntUnion) SetL4(a PuntL4) {
125 buf := codec.NewBuffer(u.XXX_UnionData[:])
126 buf.EncodeUint8(uint8(a.Af))
127 buf.EncodeUint8(uint8(a.Protocol))
128 buf.EncodeUint16(a.Port)
130 func (u *PuntUnion) GetL4() (a PuntL4) {
131 buf := codec.NewBuffer(u.XXX_UnionData[:])
132 a.Af = ip_types.AddressFamily(buf.DecodeUint8())
133 a.Protocol = ip_types.IPProto(buf.DecodeUint8())
134 a.Port = buf.DecodeUint16()
138 func PuntUnionIPProto(a PuntIPProto) (u PuntUnion) {
142 func (u *PuntUnion) SetIPProto(a PuntIPProto) {
143 buf := codec.NewBuffer(u.XXX_UnionData[:])
144 buf.EncodeUint8(uint8(a.Af))
145 buf.EncodeUint8(uint8(a.Protocol))
147 func (u *PuntUnion) GetIPProto() (a PuntIPProto) {
148 buf := codec.NewBuffer(u.XXX_UnionData[:])
149 a.Af = ip_types.AddressFamily(buf.DecodeUint8())
150 a.Protocol = ip_types.IPProto(buf.DecodeUint8())
154 // PuntReasonDetails defines message 'punt_reason_details'.
155 type PuntReasonDetails struct {
156 Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"`
159 func (m *PuntReasonDetails) Reset() { *m = PuntReasonDetails{} }
160 func (*PuntReasonDetails) GetMessageName() string { return "punt_reason_details" }
161 func (*PuntReasonDetails) GetCrcString() string { return "2c9d4a40" }
162 func (*PuntReasonDetails) GetMessageType() api.MessageType {
163 return api.ReplyMessage
166 func (m *PuntReasonDetails) Size() (size int) {
170 size += 4 // m.Reason.ID
171 size += 4 + len(m.Reason.Name) // m.Reason.Name
174 func (m *PuntReasonDetails) Marshal(b []byte) ([]byte, error) {
176 b = make([]byte, m.Size())
178 buf := codec.NewBuffer(b)
179 buf.EncodeUint32(m.Reason.ID)
180 buf.EncodeString(m.Reason.Name, 0)
181 return buf.Bytes(), nil
183 func (m *PuntReasonDetails) Unmarshal(b []byte) error {
184 buf := codec.NewBuffer(b)
185 m.Reason.ID = buf.DecodeUint32()
186 m.Reason.Name = buf.DecodeString(0)
190 // PuntReasonDump defines message 'punt_reason_dump'.
191 type PuntReasonDump struct {
192 Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"`
195 func (m *PuntReasonDump) Reset() { *m = PuntReasonDump{} }
196 func (*PuntReasonDump) GetMessageName() string { return "punt_reason_dump" }
197 func (*PuntReasonDump) GetCrcString() string { return "5c0dd4fe" }
198 func (*PuntReasonDump) GetMessageType() api.MessageType {
199 return api.RequestMessage
202 func (m *PuntReasonDump) Size() (size int) {
206 size += 4 // m.Reason.ID
207 size += 4 + len(m.Reason.Name) // m.Reason.Name
210 func (m *PuntReasonDump) Marshal(b []byte) ([]byte, error) {
212 b = make([]byte, m.Size())
214 buf := codec.NewBuffer(b)
215 buf.EncodeUint32(m.Reason.ID)
216 buf.EncodeString(m.Reason.Name, 0)
217 return buf.Bytes(), nil
219 func (m *PuntReasonDump) Unmarshal(b []byte) error {
220 buf := codec.NewBuffer(b)
221 m.Reason.ID = buf.DecodeUint32()
222 m.Reason.Name = buf.DecodeString(0)
226 // PuntSocketDeregister defines message 'punt_socket_deregister'.
227 type PuntSocketDeregister struct {
228 Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"`
231 func (m *PuntSocketDeregister) Reset() { *m = PuntSocketDeregister{} }
232 func (*PuntSocketDeregister) GetMessageName() string { return "punt_socket_deregister" }
233 func (*PuntSocketDeregister) GetCrcString() string { return "98fc9102" }
234 func (*PuntSocketDeregister) GetMessageType() api.MessageType {
235 return api.RequestMessage
238 func (m *PuntSocketDeregister) Size() (size int) {
242 size += 4 // m.Punt.Type
243 size += 1 * 4 // m.Punt.Punt
246 func (m *PuntSocketDeregister) Marshal(b []byte) ([]byte, error) {
248 b = make([]byte, m.Size())
250 buf := codec.NewBuffer(b)
251 buf.EncodeUint32(uint32(m.Punt.Type))
252 buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
253 return buf.Bytes(), nil
255 func (m *PuntSocketDeregister) Unmarshal(b []byte) error {
256 buf := codec.NewBuffer(b)
257 m.Punt.Type = PuntType(buf.DecodeUint32())
258 copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
262 // PuntSocketDeregisterReply defines message 'punt_socket_deregister_reply'.
263 type PuntSocketDeregisterReply struct {
264 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
267 func (m *PuntSocketDeregisterReply) Reset() { *m = PuntSocketDeregisterReply{} }
268 func (*PuntSocketDeregisterReply) GetMessageName() string { return "punt_socket_deregister_reply" }
269 func (*PuntSocketDeregisterReply) GetCrcString() string { return "e8d4e804" }
270 func (*PuntSocketDeregisterReply) GetMessageType() api.MessageType {
271 return api.ReplyMessage
274 func (m *PuntSocketDeregisterReply) Size() (size int) {
278 size += 4 // m.Retval
281 func (m *PuntSocketDeregisterReply) Marshal(b []byte) ([]byte, error) {
283 b = make([]byte, m.Size())
285 buf := codec.NewBuffer(b)
286 buf.EncodeInt32(m.Retval)
287 return buf.Bytes(), nil
289 func (m *PuntSocketDeregisterReply) Unmarshal(b []byte) error {
290 buf := codec.NewBuffer(b)
291 m.Retval = buf.DecodeInt32()
295 // PuntSocketDetails defines message 'punt_socket_details'.
296 type PuntSocketDetails struct {
297 Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"`
298 Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
301 func (m *PuntSocketDetails) Reset() { *m = PuntSocketDetails{} }
302 func (*PuntSocketDetails) GetMessageName() string { return "punt_socket_details" }
303 func (*PuntSocketDetails) GetCrcString() string { return "de575080" }
304 func (*PuntSocketDetails) GetMessageType() api.MessageType {
305 return api.ReplyMessage
308 func (m *PuntSocketDetails) Size() (size int) {
312 size += 4 // m.Punt.Type
313 size += 1 * 4 // m.Punt.Punt
314 size += 108 // m.Pathname
317 func (m *PuntSocketDetails) Marshal(b []byte) ([]byte, error) {
319 b = make([]byte, m.Size())
321 buf := codec.NewBuffer(b)
322 buf.EncodeUint32(uint32(m.Punt.Type))
323 buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
324 buf.EncodeString(m.Pathname, 108)
325 return buf.Bytes(), nil
327 func (m *PuntSocketDetails) Unmarshal(b []byte) error {
328 buf := codec.NewBuffer(b)
329 m.Punt.Type = PuntType(buf.DecodeUint32())
330 copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
331 m.Pathname = buf.DecodeString(108)
335 // PuntSocketDump defines message 'punt_socket_dump'.
336 type PuntSocketDump struct {
337 Type PuntType `binapi:"punt_type,name=type" json:"type,omitempty"`
340 func (m *PuntSocketDump) Reset() { *m = PuntSocketDump{} }
341 func (*PuntSocketDump) GetMessageName() string { return "punt_socket_dump" }
342 func (*PuntSocketDump) GetCrcString() string { return "52974935" }
343 func (*PuntSocketDump) GetMessageType() api.MessageType {
344 return api.RequestMessage
347 func (m *PuntSocketDump) Size() (size int) {
354 func (m *PuntSocketDump) Marshal(b []byte) ([]byte, error) {
356 b = make([]byte, m.Size())
358 buf := codec.NewBuffer(b)
359 buf.EncodeUint32(uint32(m.Type))
360 return buf.Bytes(), nil
362 func (m *PuntSocketDump) Unmarshal(b []byte) error {
363 buf := codec.NewBuffer(b)
364 m.Type = PuntType(buf.DecodeUint32())
368 // PuntSocketRegister defines message 'punt_socket_register'.
369 type PuntSocketRegister struct {
370 HeaderVersion uint32 `binapi:"u32,name=header_version" json:"header_version,omitempty"`
371 Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"`
372 Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
375 func (m *PuntSocketRegister) Reset() { *m = PuntSocketRegister{} }
376 func (*PuntSocketRegister) GetMessageName() string { return "punt_socket_register" }
377 func (*PuntSocketRegister) GetCrcString() string { return "95268cbf" }
378 func (*PuntSocketRegister) GetMessageType() api.MessageType {
379 return api.RequestMessage
382 func (m *PuntSocketRegister) Size() (size int) {
386 size += 4 // m.HeaderVersion
387 size += 4 // m.Punt.Type
388 size += 1 * 4 // m.Punt.Punt
389 size += 108 // m.Pathname
392 func (m *PuntSocketRegister) Marshal(b []byte) ([]byte, error) {
394 b = make([]byte, m.Size())
396 buf := codec.NewBuffer(b)
397 buf.EncodeUint32(m.HeaderVersion)
398 buf.EncodeUint32(uint32(m.Punt.Type))
399 buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
400 buf.EncodeString(m.Pathname, 108)
401 return buf.Bytes(), nil
403 func (m *PuntSocketRegister) Unmarshal(b []byte) error {
404 buf := codec.NewBuffer(b)
405 m.HeaderVersion = buf.DecodeUint32()
406 m.Punt.Type = PuntType(buf.DecodeUint32())
407 copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
408 m.Pathname = buf.DecodeString(108)
412 // PuntSocketRegisterReply defines message 'punt_socket_register_reply'.
413 type PuntSocketRegisterReply struct {
414 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
415 Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
418 func (m *PuntSocketRegisterReply) Reset() { *m = PuntSocketRegisterReply{} }
419 func (*PuntSocketRegisterReply) GetMessageName() string { return "punt_socket_register_reply" }
420 func (*PuntSocketRegisterReply) GetCrcString() string { return "bd30ae90" }
421 func (*PuntSocketRegisterReply) GetMessageType() api.MessageType {
422 return api.ReplyMessage
425 func (m *PuntSocketRegisterReply) Size() (size int) {
429 size += 4 // m.Retval
430 size += 108 // m.Pathname
433 func (m *PuntSocketRegisterReply) Marshal(b []byte) ([]byte, error) {
435 b = make([]byte, m.Size())
437 buf := codec.NewBuffer(b)
438 buf.EncodeInt32(m.Retval)
439 buf.EncodeString(m.Pathname, 108)
440 return buf.Bytes(), nil
442 func (m *PuntSocketRegisterReply) Unmarshal(b []byte) error {
443 buf := codec.NewBuffer(b)
444 m.Retval = buf.DecodeInt32()
445 m.Pathname = buf.DecodeString(108)
449 // SetPunt defines message 'set_punt'.
450 type SetPunt struct {
451 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
452 Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"`
455 func (m *SetPunt) Reset() { *m = SetPunt{} }
456 func (*SetPunt) GetMessageName() string { return "set_punt" }
457 func (*SetPunt) GetCrcString() string { return "aa83d523" }
458 func (*SetPunt) GetMessageType() api.MessageType {
459 return api.RequestMessage
462 func (m *SetPunt) Size() (size int) {
467 size += 4 // m.Punt.Type
468 size += 1 * 4 // m.Punt.Punt
471 func (m *SetPunt) Marshal(b []byte) ([]byte, error) {
473 b = make([]byte, m.Size())
475 buf := codec.NewBuffer(b)
476 buf.EncodeBool(m.IsAdd)
477 buf.EncodeUint32(uint32(m.Punt.Type))
478 buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
479 return buf.Bytes(), nil
481 func (m *SetPunt) Unmarshal(b []byte) error {
482 buf := codec.NewBuffer(b)
483 m.IsAdd = buf.DecodeBool()
484 m.Punt.Type = PuntType(buf.DecodeUint32())
485 copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
489 // SetPuntReply defines message 'set_punt_reply'.
490 type SetPuntReply struct {
491 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
494 func (m *SetPuntReply) Reset() { *m = SetPuntReply{} }
495 func (*SetPuntReply) GetMessageName() string { return "set_punt_reply" }
496 func (*SetPuntReply) GetCrcString() string { return "e8d4e804" }
497 func (*SetPuntReply) GetMessageType() api.MessageType {
498 return api.ReplyMessage
501 func (m *SetPuntReply) Size() (size int) {
505 size += 4 // m.Retval
508 func (m *SetPuntReply) Marshal(b []byte) ([]byte, error) {
510 b = make([]byte, m.Size())
512 buf := codec.NewBuffer(b)
513 buf.EncodeInt32(m.Retval)
514 return buf.Bytes(), nil
516 func (m *SetPuntReply) Unmarshal(b []byte) error {
517 buf := codec.NewBuffer(b)
518 m.Retval = buf.DecodeInt32()
522 func init() { file_punt_binapi_init() }
523 func file_punt_binapi_init() {
524 api.RegisterMessage((*PuntReasonDetails)(nil), "punt_reason_details_2c9d4a40")
525 api.RegisterMessage((*PuntReasonDump)(nil), "punt_reason_dump_5c0dd4fe")
526 api.RegisterMessage((*PuntSocketDeregister)(nil), "punt_socket_deregister_98fc9102")
527 api.RegisterMessage((*PuntSocketDeregisterReply)(nil), "punt_socket_deregister_reply_e8d4e804")
528 api.RegisterMessage((*PuntSocketDetails)(nil), "punt_socket_details_de575080")
529 api.RegisterMessage((*PuntSocketDump)(nil), "punt_socket_dump_52974935")
530 api.RegisterMessage((*PuntSocketRegister)(nil), "punt_socket_register_95268cbf")
531 api.RegisterMessage((*PuntSocketRegisterReply)(nil), "punt_socket_register_reply_bd30ae90")
532 api.RegisterMessage((*SetPunt)(nil), "set_punt_aa83d523")
533 api.RegisterMessage((*SetPuntReply)(nil), "set_punt_reply_e8d4e804")
536 // Messages returns list of all messages in this module.
537 func AllMessages() []api.Message {
538 return []api.Message{
539 (*PuntReasonDetails)(nil),
540 (*PuntReasonDump)(nil),
541 (*PuntSocketDeregister)(nil),
542 (*PuntSocketDeregisterReply)(nil),
543 (*PuntSocketDetails)(nil),
544 (*PuntSocketDump)(nil),
545 (*PuntSocketRegister)(nil),
546 (*PuntSocketRegisterReply)(nil),
548 (*SetPuntReply)(nil),