summaryrefslogtreecommitdiffstats
path: root/binapi/urpf/urpf.ba.go
blob: 3ffd6820cb47d403489fcae10562a61ee1e3cf30 (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
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
//  binapi-generator: v0.5.0-dev
//  VPP:              22.02-release
// source: /usr/share/vpp/api/plugins/urpf.api.json

// Package urpf contains generated bindings for API file urpf.api.
//
// Contents:
//   1 enum
//   2 messages
//
package urpf

import (
	"strconv"

	api "git.fd.io/govpp.git/api"
	_ "git.fd.io/govpp.git/binapi/fib_types"
	interface_types "git.fd.io/govpp.git/binapi/interface_types"
	ip_types "git.fd.io/govpp.git/binapi/ip_types"
	codec "git.fd.io/govpp.git/codec"
)

// 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    = "urpf"
	APIVersion = "1.0.0"
	VersionCrc = 0xb2bfd2c4
)

// UrpfMode defines enum 'urpf_mode'.
type UrpfMode uint8

const (
	URPF_API_MODE_OFF    UrpfMode = 1
	URPF_API_MODE_LOOSE  UrpfMode = 2
	URPF_API_MODE_STRICT UrpfMode = 3
)

var (
	UrpfMode_name = map[uint8]string{
		1: "URPF_API_MODE_OFF",
		2: "URPF_API_MODE_LOOSE",
		3: "URPF_API_MODE_STRICT",
	}
	UrpfMode_value = map[string]uint8{
		"URPF_API_MODE_OFF":    1,
		"URPF_API_MODE_LOOSE":  2,
		"URPF_API_MODE_STRICT": 3,
	}
)

func (x UrpfMode) String() string {
	s, ok := UrpfMode_name[uint8(x)]
	if ok {
		return s
	}
	return "UrpfMode(" + strconv.Itoa(int(x)) + ")"
}

// UrpfUpdate defines message 'urpf_update'.
type UrpfUpdate struct {
	IsInput   bool                           `binapi:"bool,name=is_input,default=true" json:"is_input,omitempty"`
	Mode      UrpfMode                       `binapi:"urpf_mode,name=mode" json:"mode,omitempty"`
	Af        ip_types.AddressFamily         `binapi:"address_family,name=af" json:"af,omitempty"`
	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
}

func (m *UrpfUpdate) Reset()               { *m = UrpfUpdate{} }
func (*UrpfUpdate) GetMessageName() string { return "urpf_update" }
func (*UrpfUpdate) GetCrcString() string   { return "2bf8a77c" }
func (*UrpfUpdate) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *UrpfUpdate) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 1 // m.IsInput
	size += 1 // m.Mode
	size += 1 // m.Af
	size += 4 // m.SwIfIndex
	return size
}
func (m *UrpfUpdate) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeBool(m.IsInput)
	buf.EncodeUint8(uint8(m.Mode))
	buf.EncodeUint8(uint8(m.Af))
	buf.EncodeUint32(uint32(m.SwIfIndex))
	return buf.Bytes(), nil
}
func (m *UrpfUpdate) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.IsInput = buf.DecodeBool()
	m.Mode = UrpfMode(buf.DecodeUint8())
	m.Af = ip_types.AddressFamily(buf.DecodeUint8())
	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	return nil
}

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

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

func (m *UrpfUpdateReply) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.Retval
	return size
}
func (m *UrpfUpdateReply) 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 *UrpfUpdateReply) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Retval = buf.DecodeInt32()
	return nil
}

func init() { file_urpf_binapi_init() }
func file_urpf_binapi_init() {
	api.RegisterMessage((*UrpfUpdate)(nil), "urpf_update_2bf8a77c")
	api.RegisterMessage((*UrpfUpdateReply)(nil), "urpf_update_reply_e8d4e804")
}

// Messages returns list of all messages in this module.
func AllMessages() []api.Message {
	return []api.Message{
		(*UrpfUpdate)(nil),
		(*UrpfUpdateReply)(nil),
	}
}