summaryrefslogtreecommitdiffstats
path: root/binapi/span/span.ba.go
blob: 490ff1a56bbe229d2636c3aceb7c2b15e7c0a088 (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
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
//  binapi-generator: v0.4.0
//  VPP:              21.06-release
// source: /usr/share/vpp/api/core/span.api.json

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

import (
	"strconv"

	api "git.fd.io/govpp.git/api"
	interface_types "git.fd.io/govpp.git/binapi/interface_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    = "span"
	APIVersion = "2.0.0"
	VersionCrc = 0x34ee02b
)

// SpanState defines enum 'span_state'.
type SpanState uint32

const (
	SPAN_STATE_API_DISABLED SpanState = 0
	SPAN_STATE_API_RX       SpanState = 1
	SPAN_STATE_API_TX       SpanState = 2
	SPAN_STATE_API_RX_TX    SpanState = 3
)

var (
	SpanState_name = map[uint32]string{
		0: "SPAN_STATE_API_DISABLED",
		1: "SPAN_STATE_API_RX",
		2: "SPAN_STATE_API_TX",
		3: "SPAN_STATE_API_RX_TX",
	}
	SpanState_value = map[string]uint32{
		"SPAN_STATE_API_DISABLED": 0,
		"SPAN_STATE_API_RX":       1,
		"SPAN_STATE_API_TX":       2,
		"SPAN_STATE_API_RX_TX":    3,
	}
)

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

// SwInterfaceSpanDetails defines message 'sw_interface_span_details'.
type SwInterfaceSpanDetails struct {
	SwIfIndexFrom interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_from" json:"sw_if_index_from,omitempty"`
	SwIfIndexTo   interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_to" json:"sw_if_index_to,omitempty"`
	State         SpanState                      `binapi:"span_state,name=state" json:"state,omitempty"`
	IsL2          bool                           `binapi:"bool,name=is_l2" json:"is_l2,omitempty"`
}

func (m *SwInterfaceSpanDetails) Reset()               { *m = SwInterfaceSpanDetails{} }
func (*SwInterfaceSpanDetails) GetMessageName() string { return "sw_interface_span_details" }
func (*SwInterfaceSpanDetails) GetCrcString() string   { return "8a20e79f" }
func (*SwInterfaceSpanDetails) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *SwInterfaceSpanDetails) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.SwIfIndexFrom
	size += 4 // m.SwIfIndexTo
	size += 4 // m.State
	size += 1 // m.IsL2
	return size
}
func (m *SwInterfaceSpanDetails) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint32(uint32(m.SwIfIndexFrom))
	buf.EncodeUint32(uint32(m.SwIfIndexTo))
	buf.EncodeUint32(uint32(m.State))
	buf.EncodeBool(m.IsL2)
	return buf.Bytes(), nil
}
func (m *SwInterfaceSpanDetails) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.SwIfIndexFrom = interface_types.InterfaceIndex(buf.DecodeUint32())
	m.SwIfIndexTo = interface_types.InterfaceIndex(buf.DecodeUint32())
	m.State = SpanState(buf.DecodeUint32())
	m.IsL2 = buf.DecodeBool()
	return nil
}

// SwInterfaceSpanDump defines message 'sw_interface_span_dump'.
type SwInterfaceSpanDump struct {
	IsL2 bool `binapi:"bool,name=is_l2" json:"is_l2,omitempty"`
}

func (m *SwInterfaceSpanDump) Reset()               { *m = SwInterfaceSpanDump{} }
func (*SwInterfaceSpanDump) GetMessageName() string { return "sw_interface_span_dump" }
func (*SwInterfaceSpanDump) GetCrcString() string   { return "d6cf0c3d" }
func (*SwInterfaceSpanDump) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *SwInterfaceSpanDump) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 1 // m.IsL2
	return size
}
func (m *SwInterfaceSpanDump) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeBool(m.IsL2)
	return buf.Bytes(), nil
}
func (m *SwInterfaceSpanDump) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.IsL2 = buf.DecodeBool()
	return nil
}

// SwInterfaceSpanEnableDisable defines message 'sw_interface_span_enable_disable'.
type SwInterfaceSpanEnableDisable struct {
	SwIfIndexFrom interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_from" json:"sw_if_index_from,omitempty"`
	SwIfIndexTo   interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index_to" json:"sw_if_index_to,omitempty"`
	State         SpanState                      `binapi:"span_state,name=state" json:"state,omitempty"`
	IsL2          bool                           `binapi:"bool,name=is_l2" json:"is_l2,omitempty"`
}

func (m *SwInterfaceSpanEnableDisable) Reset() { *m = SwInterfaceSpanEnableDisable{} }
func (*SwInterfaceSpanEnableDisable) GetMessageName() string {
	return "sw_interface_span_enable_disable"
}
func (*SwInterfaceSpanEnableDisable) GetCrcString() string { return "23ddd96b" }
func (*SwInterfaceSpanEnableDisable) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *SwInterfaceSpanEnableDisable) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.SwIfIndexFrom
	size += 4 // m.SwIfIndexTo
	size += 4 // m.State
	size += 1 // m.IsL2
	return size
}
func (m *SwInterfaceSpanEnableDisable) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint32(uint32(m.SwIfIndexFrom))
	buf.EncodeUint32(uint32(m.SwIfIndexTo))
	buf.EncodeUint32(uint32(m.State))
	buf.EncodeBool(m.IsL2)
	return buf.Bytes(), nil
}
func (m *SwInterfaceSpanEnableDisable) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.SwIfIndexFrom = interface_types.InterfaceIndex(buf.DecodeUint32())
	m.SwIfIndexTo = interface_types.InterfaceIndex(buf.DecodeUint32())
	m.State = SpanState(buf.DecodeUint32())
	m.IsL2 = buf.DecodeBool()
	return nil
}

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

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

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

func init() { file_span_binapi_init() }
func file_span_binapi_init() {
	api.RegisterMessage((*SwInterfaceSpanDetails)(nil), "sw_interface_span_details_8a20e79f")
	api.RegisterMessage((*SwInterfaceSpanDump)(nil), "sw_interface_span_dump_d6cf0c3d")
	api.RegisterMessage((*SwInterfaceSpanEnableDisable)(nil), "sw_interface_span_enable_disable_23ddd96b")
	api.RegisterMessage((*SwInterfaceSpanEnableDisableReply)(nil), "sw_interface_span_enable_disable_reply_e8d4e804")
}

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