aboutsummaryrefslogtreecommitdiffstats
path: root/binapi/stn/stn.ba.go
blob: b44adf5b878b6d68122bcd6c98c06dd2fe81ccda (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
// 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/plugins/stn.api.json

// Package stn contains generated bindings for API file stn.api.
//
// Contents:
//   4 messages
//
package stn

import (
	api "git.fd.io/govpp.git/api"
	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    = "stn"
	APIVersion = "2.0.0"
	VersionCrc = 0x5a5079cd
)

// StnAddDelRule defines message 'stn_add_del_rule'.
type StnAddDelRule struct {
	IPAddress ip_types.Address               `binapi:"address,name=ip_address" json:"ip_address,omitempty"`
	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
	IsAdd     bool                           `binapi:"bool,name=is_add" json:"is_add,omitempty"`
}

func (m *StnAddDelRule) Reset()               { *m = StnAddDelRule{} }
func (*StnAddDelRule) GetMessageName() string { return "stn_add_del_rule" }
func (*StnAddDelRule) GetCrcString() string   { return "53f751e6" }
func (*StnAddDelRule) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *StnAddDelRule) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 1      // m.IPAddress.Af
	size += 1 * 16 // m.IPAddress.Un
	size += 4      // m.SwIfIndex
	size += 1      // m.IsAdd
	return size
}
func (m *StnAddDelRule) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint8(uint8(m.IPAddress.Af))
	buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
	buf.EncodeUint32(uint32(m.SwIfIndex))
	buf.EncodeBool(m.IsAdd)
	return buf.Bytes(), nil
}
func (m *StnAddDelRule) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
	copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	m.IsAdd = buf.DecodeBool()
	return nil
}

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

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

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

// StnRulesDetails defines message 'stn_rules_details'.
type StnRulesDetails struct {
	IPAddress ip_types.Address               `binapi:"address,name=ip_address" json:"ip_address,omitempty"`
	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
}

func (m *StnRulesDetails) Reset()               { *m = StnRulesDetails{} }
func (*StnRulesDetails) GetMessageName() string { return "stn_rules_details" }
func (*StnRulesDetails) GetCrcString() string   { return "b0f6606c" }
func (*StnRulesDetails) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *StnRulesDetails) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 1      // m.IPAddress.Af
	size += 1 * 16 // m.IPAddress.Un
	size += 4      // m.SwIfIndex
	return size
}
func (m *StnRulesDetails) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint8(uint8(m.IPAddress.Af))
	buf.EncodeBytes(m.IPAddress.Un.XXX_UnionData[:], 16)
	buf.EncodeUint32(uint32(m.SwIfIndex))
	return buf.Bytes(), nil
}
func (m *StnRulesDetails) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.IPAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
	copy(m.IPAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	return nil
}

// StnRulesDump defines message 'stn_rules_dump'.
type StnRulesDump struct{}

func (m *StnRulesDump) Reset()               { *m = StnRulesDump{} }
func (*StnRulesDump) GetMessageName() string { return "stn_rules_dump" }
func (*StnRulesDump) GetCrcString() string   { return "51077d14" }
func (*StnRulesDump) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *StnRulesDump) Size() (size int) {
	if m == nil {
		return 0
	}
	return size
}
func (m *StnRulesDump) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	return buf.Bytes(), nil
}
func (m *StnRulesDump) Unmarshal(b []byte) error {
	return nil
}

func init() { file_stn_binapi_init() }
func file_stn_binapi_init() {
	api.RegisterMessage((*StnAddDelRule)(nil), "stn_add_del_rule_53f751e6")
	api.RegisterMessage((*StnAddDelRuleReply)(nil), "stn_add_del_rule_reply_e8d4e804")
	api.RegisterMessage((*StnRulesDetails)(nil), "stn_rules_details_b0f6606c")
	api.RegisterMessage((*StnRulesDump)(nil), "stn_rules_dump_51077d14")
}

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