summaryrefslogtreecommitdiffstats
path: root/binapi/punt/punt.ba.go
blob: 18ff6782466380c6341610d4aea55279cbf7b90e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
//  binapi-generator: v0.4.0-dev
//  VPP:              20.05-release
// source: /usr/share/vpp/api/core/punt.api.json

// Package punt contains generated bindings for API file punt.api.
//
// Contents:
//   1 enum
//   5 structs
//   1 union
//  10 messages
//
package punt

import (
	api "git.fd.io/govpp.git/api"
	ip_types "git.fd.io/govpp.git/binapi/ip_types"
	codec "git.fd.io/govpp.git/codec"
	"strconv"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the GoVPP api package it is being compiled against.
// A compilation error at this line likely means your copy of the
// GoVPP api package needs to be updated.
const _ = api.GoVppAPIPackageIsVersion2

const (
	APIFile    = "punt"
	APIVersion = "2.2.1"
	VersionCrc = 0x31354154
)

// PuntType defines enum 'punt_type'.
type PuntType uint32

const (
	PUNT_API_TYPE_L4        PuntType = 1
	PUNT_API_TYPE_IP_PROTO  PuntType = 2
	PUNT_API_TYPE_EXCEPTION PuntType = 3
)

var (
	PuntType_name = map[uint32]string{
		1: "PUNT_API_TYPE_L4",
		2: "PUNT_API_TYPE_IP_PROTO",
		3: "PUNT_API_TYPE_EXCEPTION",
	}
	PuntType_value = map[string]uint32{
		"PUNT_API_TYPE_L4":        1,
		"PUNT_API_TYPE_IP_PROTO":  2,
		"PUNT_API_TYPE_EXCEPTION": 3,
	}
)

func (x PuntType) String() string {
	s, ok := PuntType_name[uint32(x)]
	if ok {
		return s
	}
	return "PuntType(" + strconv.Itoa(int(x)) + ")"
}

// Punt defines type 'punt'.
type Punt struct {
	Type PuntType  `binapi:"punt_type,name=type" json:"type,omitempty"`
	Punt PuntUnion `binapi:"punt_union,name=punt" json:"punt,omitempty"`
}

// PuntException defines type 'punt_exception'.
type PuntException struct {
	ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
}

// PuntIPProto defines type 'punt_ip_proto'.
type PuntIPProto struct {
	Af       ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
	Protocol ip_types.IPProto       `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"`
}

// PuntL4 defines type 'punt_l4'.
type PuntL4 struct {
	Af       ip_types.AddressFamily `binapi:"address_family,name=af" json:"af,omitempty"`
	Protocol ip_types.IPProto       `binapi:"ip_proto,name=protocol" json:"protocol,omitempty"`
	Port     uint16                 `binapi:"u16,name=port" json:"port,omitempty"`
}

// PuntReason defines type 'punt_reason'.
type PuntReason struct {
	ID   uint32 `binapi:"u32,name=id" json:"id,omitempty"`
	Name string `binapi:"string[],name=name" json:"name,omitempty"`
}

// PuntUnion defines union 'punt_union'.
type PuntUnion struct {
	// Exception *PuntException
	// L4 *PuntL4
	// IPProto *PuntIPProto
	XXX_UnionData [4]byte
}

func PuntUnionException(a PuntException) (u PuntUnion) {
	u.SetException(a)
	return
}
func (u *PuntUnion) SetException(a PuntException) {
	buf := codec.NewBuffer(u.XXX_UnionData[:])
	buf.EncodeUint32(a.ID)
}
func (u *PuntUnion) GetException() (a PuntException) {
	buf := codec.NewBuffer(u.XXX_UnionData[:])
	a.ID = buf.DecodeUint32()
	return
}

func PuntUnionL4(a PuntL4) (u PuntUnion) {
	u.SetL4(a)
	return
}
func (u *PuntUnion) SetL4(a PuntL4) {
	buf := codec.NewBuffer(u.XXX_UnionData[:])
	buf.EncodeUint8(uint8(a.Af))
	buf.EncodeUint8(uint8(a.Protocol))
	buf.EncodeUint16(a.Port)
}
func (u *PuntUnion) GetL4() (a PuntL4) {
	buf := codec.NewBuffer(u.XXX_UnionData[:])
	a.Af = ip_types.AddressFamily(buf.DecodeUint8())
	a.Protocol = ip_types.IPProto(buf.DecodeUint8())
	a.Port = buf.DecodeUint16()
	return
}

func PuntUnionIPProto(a PuntIPProto) (u PuntUnion) {
	u.SetIPProto(a)
	return
}
func (u *PuntUnion) SetIPProto(a PuntIPProto) {
	buf := codec.NewBuffer(u.XXX_UnionData[:])
	buf.EncodeUint8(uint8(a.Af))
	buf.EncodeUint8(uint8(a.Protocol))
}
func (u *PuntUnion) GetIPProto() (a PuntIPProto) {
	buf := codec.NewBuffer(u.XXX_UnionData[:])
	a.Af = ip_types.AddressFamily(buf.DecodeUint8())
	a.Protocol = ip_types.IPProto(buf.DecodeUint8())
	return
}

// PuntReasonDetails defines message 'punt_reason_details'.
type PuntReasonDetails struct {
	Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"`
}

func (m *PuntReasonDetails) Reset()               { *m = PuntReasonDetails{} }
func (*PuntReasonDetails) GetMessageName() string { return "punt_reason_details" }
func (*PuntReasonDetails) GetCrcString() string   { return "2c9d4a40" }
func (*PuntReasonDetails) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *PuntReasonDetails) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4                      // m.Reason.ID
	size += 4 + len(m.Reason.Name) // m.Reason.Name
	return size
}
func (m *PuntReasonDetails) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint32(m.Reason.ID)
	buf.EncodeString(m.Reason.Name, 0)
	return buf.Bytes(), nil
}
func (m *PuntReasonDetails) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Reason.ID = buf.DecodeUint32()
	m.Reason.Name = buf.DecodeString(0)
	return nil
}

// PuntReasonDump defines message 'punt_reason_dump'.
type PuntReasonDump struct {
	Reason PuntReason `binapi:"punt_reason,name=reason" json:"reason,omitempty"`
}

func (m *PuntReasonDump) Reset()               { *m = PuntReasonDump{} }
func (*PuntReasonDump) GetMessageName() string { return "punt_reason_dump" }
func (*PuntReasonDump) GetCrcString() string   { return "5c0dd4fe" }
func (*PuntReasonDump) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *PuntReasonDump) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4                      // m.Reason.ID
	size += 4 + len(m.Reason.Name) // m.Reason.Name
	return size
}
func (m *PuntReasonDump) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint32(m.Reason.ID)
	buf.EncodeString(m.Reason.Name, 0)
	return buf.Bytes(), nil
}
func (m *PuntReasonDump) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Reason.ID = buf.DecodeUint32()
	m.Reason.Name = buf.DecodeString(0)
	return nil
}

// PuntSocketDeregister defines message 'punt_socket_deregister'.
type PuntSocketDeregister struct {
	Punt Punt `binapi:"punt,name=punt" json:"punt,omitempty"`
}

func (m *PuntSocketDeregister) Reset()               { *m = PuntSocketDeregister{} }
func (*PuntSocketDeregister) GetMessageName() string { return "punt_socket_deregister" }
func (*PuntSocketDeregister) GetCrcString() string   { return "98a444f4" }
func (*PuntSocketDeregister) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *PuntSocketDeregister) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4     // m.Punt.Type
	size += 1 * 4 // m.Punt.Punt
	return size
}
func (m *PuntSocketDeregister) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint32(uint32(m.Punt.Type))
	buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
	return buf.Bytes(), nil
}
func (m *PuntSocketDeregister) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Punt.Type = PuntType(buf.DecodeUint32())
	copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
	return nil
}

// PuntSocketDeregisterReply defines message 'punt_socket_deregister_reply'.
type PuntSocketDeregisterReply struct {
	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
}

func (m *PuntSocketDeregisterReply) Reset()               { *m = PuntSocketDeregisterReply{} }
func (*PuntSocketDeregisterReply) GetMessageName() string { return "punt_socket_deregister_reply" }
func (*PuntSocketDeregisterReply) GetCrcString() string   { return "e8d4e804" }
func (*PuntSocketDeregisterReply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *PuntSocketDeregisterReply) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.Retval
	return size
}
func (m *PuntSocketDeregisterReply) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeInt32(m.Retval)
	return buf.Bytes(), nil
}
func (m *PuntSocketDeregisterReply) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Retval = buf.DecodeInt32()
	return nil
}

// PuntSocketDetails defines message 'punt_socket_details'.
type PuntSocketDetails struct {
	Punt     Punt   `binapi:"punt,name=punt" json:"punt,omitempty"`
	Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
}

func (m *PuntSocketDetails) Reset()               { *m = PuntSocketDetails{} }
func (*PuntSocketDetails) GetMessageName() string { return "punt_socket_details" }
func (*PuntSocketDetails) GetCrcString() string   { return "1de0ce75" }
func (*PuntSocketDetails) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *PuntSocketDetails) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4     // m.Punt.Type
	size += 1 * 4 // m.Punt.Punt
	size += 108   // m.Pathname
	return size
}
func (m *PuntSocketDetails) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint32(uint32(m.Punt.Type))
	buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
	buf.EncodeString(m.Pathname, 108)
	return buf.Bytes(), nil
}
func (m *PuntSocketDetails) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Punt.Type = PuntType(buf.DecodeUint32())
	copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
	m.Pathname = buf.DecodeString(108)
	return nil
}

// PuntSocketDump defines message 'punt_socket_dump'.
type PuntSocketDump struct {
	Type PuntType `binapi:"punt_type,name=type" json:"type,omitempty"`
}

func (m *PuntSocketDump) Reset()               { *m = PuntSocketDump{} }
func (*PuntSocketDump) GetMessageName() string { return "punt_socket_dump" }
func (*PuntSocketDump) GetCrcString() string   { return "52974935" }
func (*PuntSocketDump) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *PuntSocketDump) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.Type
	return size
}
func (m *PuntSocketDump) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint32(uint32(m.Type))
	return buf.Bytes(), nil
}
func (m *PuntSocketDump) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Type = PuntType(buf.DecodeUint32())
	return nil
}

// PuntSocketRegister defines message 'punt_socket_register'.
type PuntSocketRegister struct {
	HeaderVersion uint32 `binapi:"u32,name=header_version" json:"header_version,omitempty"`
	Punt          Punt   `binapi:"punt,name=punt" json:"punt,omitempty"`
	Pathname      string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
}

func (m *PuntSocketRegister) Reset()               { *m = PuntSocketRegister{} }
func (*PuntSocketRegister) GetMessageName() string { return "punt_socket_register" }
func (*PuntSocketRegister) GetCrcString() string   { return "c8cd10fa" }
func (*PuntSocketRegister) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *PuntSocketRegister) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4     // m.HeaderVersion
	size += 4     // m.Punt.Type
	size += 1 * 4 // m.Punt.Punt
	size += 108   // m.Pathname
	return size
}
func (m *PuntSocketRegister) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint32(m.HeaderVersion)
	buf.EncodeUint32(uint32(m.Punt.Type))
	buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
	buf.EncodeString(m.Pathname, 108)
	return buf.Bytes(), nil
}
func (m *PuntSocketRegister) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.HeaderVersion = buf.DecodeUint32()
	m.Punt.Type = PuntType(buf.DecodeUint32())
	copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
	m.Pathname = buf.DecodeString(108)
	return nil
}

// PuntSocketRegisterReply defines message 'punt_socket_register_reply'.
type PuntSocketRegisterReply struct {
	Retval   int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
	Pathname string `binapi:"string[108],name=pathname" json:"pathname,omitempty"`
}

func (m *PuntSocketRegisterReply) Reset()               { *m = PuntSocketRegisterReply{} }
func (*PuntSocketRegisterReply) GetMessageName() string { return "punt_socket_register_reply" }
func (*PuntSocketRegisterReply) GetCrcString() string   { return "bd30ae90" }
func (*PuntSocketRegisterReply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *PuntSocketRegisterReply) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4   // m.Retval
	size += 108 // m.Pathname
	return size
}
func (m *PuntSocketRegisterReply) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeInt32(m.Retval)
	buf.EncodeString(m.Pathname, 108)
	return buf.Bytes(), nil
}
func (m *PuntSocketRegisterReply) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Retval = buf.DecodeInt32()
	m.Pathname = buf.DecodeString(108)
	return nil
}

// SetPunt defines message 'set_punt'.
type SetPunt struct {
	IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
	Punt  Punt `binapi:"punt,name=punt" json:"punt,omitempty"`
}

func (m *SetPunt) Reset()               { *m = SetPunt{} }
func (*SetPunt) GetMessageName() string { return "set_punt" }
func (*SetPunt) GetCrcString() string   { return "83799618" }
func (*SetPunt) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *SetPunt) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 1     // m.IsAdd
	size += 4     // m.Punt.Type
	size += 1 * 4 // m.Punt.Punt
	return size
}
func (m *SetPunt) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeBool(m.IsAdd)
	buf.EncodeUint32(uint32(m.Punt.Type))
	buf.EncodeBytes(m.Punt.Punt.XXX_UnionData[:], 4)
	return buf.Bytes(), nil
}
func (m *SetPunt) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.IsAdd = buf.DecodeBool()
	m.Punt.Type = PuntType(buf.DecodeUint32())
	copy(m.Punt.Punt.XXX_UnionData[:], buf.DecodeBytes(4))
	return nil
}

// SetPuntReply defines message 'set_punt_reply'.
type SetPuntReply struct {
	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
}

func (m *SetPuntReply) Reset()               { *m = SetPuntReply{} }
func (*SetPuntReply) GetMessageName() string { return "set_punt_reply" }
func (*SetPuntReply) GetCrcString() string   { return "e8d4e804" }
func (*SetPuntReply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *SetPuntReply) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.Retval
	return size
}
func (m *SetPuntReply) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeInt32(m.Retval)
	return buf.Bytes(), nil
}
func (m *SetPuntReply) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Retval = buf.DecodeInt32()
	return nil
}

func init() { file_punt_binapi_init() }
func file_punt_binapi_init() {
	api.RegisterMessage((*PuntReasonDetails)(nil), "punt_reason_details_2c9d4a40")
	api.RegisterMessage((*PuntReasonDump)(nil), "punt_reason_dump_5c0dd4fe")
	api.RegisterMessage((*PuntSocketDeregister)(nil), "punt_socket_deregister_98a444f4")
	api.RegisterMessage((*PuntSocketDeregisterReply)(nil), "punt_socket_deregister_reply_e8d4e804")
	api.RegisterMessage((*PuntSocketDetails)(nil), "punt_socket_details_1de0ce75")
	api.RegisterMessage((*PuntSocketDump)(nil), "punt_socket_dump_52974935")
	api.RegisterMessage((*PuntSocketRegister)(nil), "punt_socket_register_c8cd10fa")
	api.RegisterMessage((*PuntSocketRegisterReply)(nil), "punt_socket_register_reply_bd30ae90")
	api.RegisterMessage((*SetPunt)(nil), "set_punt_83799618")
	api.RegisterMessage((*SetPuntReply)(nil), "set_punt_reply_e8d4e804")
}

// Messages returns list of all messages in this module.
func AllMessages() []api.Message {
	return []api.Message{
		(*PuntReasonDetails)(nil),
		(*PuntReasonDump)(nil),
		(*PuntSocketDeregister)(nil),
		(*PuntSocketDeregisterReply)(nil),
		(*PuntSocketDetails)(nil),
		(*PuntSocketDump)(nil),
		(*PuntSocketRegister)(nil),
		(*PuntSocketRegisterReply)(nil),
		(*SetPunt)(nil),
		(*SetPuntReply)(nil),
	}
}