92e155b6017518135c950d94e21bca9276399f48
[govpp.git] / binapi / flowprobe / flowprobe.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.4.0-dev
4 //  VPP:              20.05-release
5
6 // Package flowprobe contains generated bindings for API file flowprobe.api.
7 //
8 // Contents:
9 //   2 enums
10 //   4 messages
11 //
12 package flowprobe
13
14 import (
15         "strconv"
16
17         api "git.fd.io/govpp.git/api"
18         interface_types "git.fd.io/govpp.git/binapi/interface_types"
19         codec "git.fd.io/govpp.git/codec"
20 )
21
22 // This is a compile-time assertion to ensure that this generated file
23 // is compatible with the GoVPP api package it is being compiled against.
24 // A compilation error at this line likely means your copy of the
25 // GoVPP api package needs to be updated.
26 const _ = api.GoVppAPIPackageIsVersion2
27
28 const (
29         APIFile    = "flowprobe"
30         APIVersion = "1.0.0"
31         VersionCrc = 0xe904179b
32 )
33
34 // FlowprobeRecordFlags defines enum 'flowprobe_record_flags'.
35 type FlowprobeRecordFlags uint8
36
37 const (
38         FLOWPROBE_RECORD_FLAG_L2 FlowprobeRecordFlags = 1
39         FLOWPROBE_RECORD_FLAG_L3 FlowprobeRecordFlags = 2
40         FLOWPROBE_RECORD_FLAG_L4 FlowprobeRecordFlags = 4
41 )
42
43 var (
44         FlowprobeRecordFlags_name = map[uint8]string{
45                 1: "FLOWPROBE_RECORD_FLAG_L2",
46                 2: "FLOWPROBE_RECORD_FLAG_L3",
47                 4: "FLOWPROBE_RECORD_FLAG_L4",
48         }
49         FlowprobeRecordFlags_value = map[string]uint8{
50                 "FLOWPROBE_RECORD_FLAG_L2": 1,
51                 "FLOWPROBE_RECORD_FLAG_L3": 2,
52                 "FLOWPROBE_RECORD_FLAG_L4": 4,
53         }
54 )
55
56 func (x FlowprobeRecordFlags) String() string {
57         s, ok := FlowprobeRecordFlags_name[uint8(x)]
58         if ok {
59                 return s
60         }
61         str := func(n uint8) string {
62                 s, ok := FlowprobeRecordFlags_name[uint8(n)]
63                 if ok {
64                         return s
65                 }
66                 return "FlowprobeRecordFlags(" + strconv.Itoa(int(n)) + ")"
67         }
68         for i := uint8(0); i <= 8; i++ {
69                 val := uint8(x)
70                 if val&(1<<i) != 0 {
71                         if s != "" {
72                                 s += "|"
73                         }
74                         s += str(1 << i)
75                 }
76         }
77         if s == "" {
78                 return str(uint8(x))
79         }
80         return s
81 }
82
83 // FlowprobeWhichFlags defines enum 'flowprobe_which_flags'.
84 type FlowprobeWhichFlags uint8
85
86 const (
87         FLOWPROBE_WHICH_FLAG_IP4 FlowprobeWhichFlags = 1
88         FLOWPROBE_WHICH_FLAG_L2  FlowprobeWhichFlags = 2
89         FLOWPROBE_WHICH_FLAG_IP6 FlowprobeWhichFlags = 4
90 )
91
92 var (
93         FlowprobeWhichFlags_name = map[uint8]string{
94                 1: "FLOWPROBE_WHICH_FLAG_IP4",
95                 2: "FLOWPROBE_WHICH_FLAG_L2",
96                 4: "FLOWPROBE_WHICH_FLAG_IP6",
97         }
98         FlowprobeWhichFlags_value = map[string]uint8{
99                 "FLOWPROBE_WHICH_FLAG_IP4": 1,
100                 "FLOWPROBE_WHICH_FLAG_L2":  2,
101                 "FLOWPROBE_WHICH_FLAG_IP6": 4,
102         }
103 )
104
105 func (x FlowprobeWhichFlags) String() string {
106         s, ok := FlowprobeWhichFlags_name[uint8(x)]
107         if ok {
108                 return s
109         }
110         str := func(n uint8) string {
111                 s, ok := FlowprobeWhichFlags_name[uint8(n)]
112                 if ok {
113                         return s
114                 }
115                 return "FlowprobeWhichFlags(" + strconv.Itoa(int(n)) + ")"
116         }
117         for i := uint8(0); i <= 8; i++ {
118                 val := uint8(x)
119                 if val&(1<<i) != 0 {
120                         if s != "" {
121                                 s += "|"
122                         }
123                         s += str(1 << i)
124                 }
125         }
126         if s == "" {
127                 return str(uint8(x))
128         }
129         return s
130 }
131
132 // FlowprobeParams defines message 'flowprobe_params'.
133 type FlowprobeParams struct {
134         RecordFlags  FlowprobeRecordFlags `binapi:"flowprobe_record_flags,name=record_flags" json:"record_flags,omitempty"`
135         ActiveTimer  uint32               `binapi:"u32,name=active_timer" json:"active_timer,omitempty"`
136         PassiveTimer uint32               `binapi:"u32,name=passive_timer" json:"passive_timer,omitempty"`
137 }
138
139 func (m *FlowprobeParams) Reset()               { *m = FlowprobeParams{} }
140 func (*FlowprobeParams) GetMessageName() string { return "flowprobe_params" }
141 func (*FlowprobeParams) GetCrcString() string   { return "baa46c09" }
142 func (*FlowprobeParams) GetMessageType() api.MessageType {
143         return api.RequestMessage
144 }
145
146 func (m *FlowprobeParams) Size() (size int) {
147         if m == nil {
148                 return 0
149         }
150         size += 1 // m.RecordFlags
151         size += 4 // m.ActiveTimer
152         size += 4 // m.PassiveTimer
153         return size
154 }
155 func (m *FlowprobeParams) Marshal(b []byte) ([]byte, error) {
156         if b == nil {
157                 b = make([]byte, m.Size())
158         }
159         buf := codec.NewBuffer(b)
160         buf.EncodeUint8(uint8(m.RecordFlags))
161         buf.EncodeUint32(m.ActiveTimer)
162         buf.EncodeUint32(m.PassiveTimer)
163         return buf.Bytes(), nil
164 }
165 func (m *FlowprobeParams) Unmarshal(b []byte) error {
166         buf := codec.NewBuffer(b)
167         m.RecordFlags = FlowprobeRecordFlags(buf.DecodeUint8())
168         m.ActiveTimer = buf.DecodeUint32()
169         m.PassiveTimer = buf.DecodeUint32()
170         return nil
171 }
172
173 // FlowprobeParamsReply defines message 'flowprobe_params_reply'.
174 type FlowprobeParamsReply struct {
175         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
176 }
177
178 func (m *FlowprobeParamsReply) Reset()               { *m = FlowprobeParamsReply{} }
179 func (*FlowprobeParamsReply) GetMessageName() string { return "flowprobe_params_reply" }
180 func (*FlowprobeParamsReply) GetCrcString() string   { return "e8d4e804" }
181 func (*FlowprobeParamsReply) GetMessageType() api.MessageType {
182         return api.ReplyMessage
183 }
184
185 func (m *FlowprobeParamsReply) Size() (size int) {
186         if m == nil {
187                 return 0
188         }
189         size += 4 // m.Retval
190         return size
191 }
192 func (m *FlowprobeParamsReply) Marshal(b []byte) ([]byte, error) {
193         if b == nil {
194                 b = make([]byte, m.Size())
195         }
196         buf := codec.NewBuffer(b)
197         buf.EncodeInt32(m.Retval)
198         return buf.Bytes(), nil
199 }
200 func (m *FlowprobeParamsReply) Unmarshal(b []byte) error {
201         buf := codec.NewBuffer(b)
202         m.Retval = buf.DecodeInt32()
203         return nil
204 }
205
206 // FlowprobeTxInterfaceAddDel defines message 'flowprobe_tx_interface_add_del'.
207 type FlowprobeTxInterfaceAddDel struct {
208         IsAdd     bool                           `binapi:"bool,name=is_add" json:"is_add,omitempty"`
209         Which     FlowprobeWhichFlags            `binapi:"flowprobe_which_flags,name=which" json:"which,omitempty"`
210         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
211 }
212
213 func (m *FlowprobeTxInterfaceAddDel) Reset()               { *m = FlowprobeTxInterfaceAddDel{} }
214 func (*FlowprobeTxInterfaceAddDel) GetMessageName() string { return "flowprobe_tx_interface_add_del" }
215 func (*FlowprobeTxInterfaceAddDel) GetCrcString() string   { return "b782c976" }
216 func (*FlowprobeTxInterfaceAddDel) GetMessageType() api.MessageType {
217         return api.RequestMessage
218 }
219
220 func (m *FlowprobeTxInterfaceAddDel) Size() (size int) {
221         if m == nil {
222                 return 0
223         }
224         size += 1 // m.IsAdd
225         size += 1 // m.Which
226         size += 4 // m.SwIfIndex
227         return size
228 }
229 func (m *FlowprobeTxInterfaceAddDel) Marshal(b []byte) ([]byte, error) {
230         if b == nil {
231                 b = make([]byte, m.Size())
232         }
233         buf := codec.NewBuffer(b)
234         buf.EncodeBool(m.IsAdd)
235         buf.EncodeUint8(uint8(m.Which))
236         buf.EncodeUint32(uint32(m.SwIfIndex))
237         return buf.Bytes(), nil
238 }
239 func (m *FlowprobeTxInterfaceAddDel) Unmarshal(b []byte) error {
240         buf := codec.NewBuffer(b)
241         m.IsAdd = buf.DecodeBool()
242         m.Which = FlowprobeWhichFlags(buf.DecodeUint8())
243         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
244         return nil
245 }
246
247 // FlowprobeTxInterfaceAddDelReply defines message 'flowprobe_tx_interface_add_del_reply'.
248 type FlowprobeTxInterfaceAddDelReply struct {
249         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
250 }
251
252 func (m *FlowprobeTxInterfaceAddDelReply) Reset() { *m = FlowprobeTxInterfaceAddDelReply{} }
253 func (*FlowprobeTxInterfaceAddDelReply) GetMessageName() string {
254         return "flowprobe_tx_interface_add_del_reply"
255 }
256 func (*FlowprobeTxInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" }
257 func (*FlowprobeTxInterfaceAddDelReply) GetMessageType() api.MessageType {
258         return api.ReplyMessage
259 }
260
261 func (m *FlowprobeTxInterfaceAddDelReply) Size() (size int) {
262         if m == nil {
263                 return 0
264         }
265         size += 4 // m.Retval
266         return size
267 }
268 func (m *FlowprobeTxInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) {
269         if b == nil {
270                 b = make([]byte, m.Size())
271         }
272         buf := codec.NewBuffer(b)
273         buf.EncodeInt32(m.Retval)
274         return buf.Bytes(), nil
275 }
276 func (m *FlowprobeTxInterfaceAddDelReply) Unmarshal(b []byte) error {
277         buf := codec.NewBuffer(b)
278         m.Retval = buf.DecodeInt32()
279         return nil
280 }
281
282 func init() { file_flowprobe_binapi_init() }
283 func file_flowprobe_binapi_init() {
284         api.RegisterMessage((*FlowprobeParams)(nil), "flowprobe_params_baa46c09")
285         api.RegisterMessage((*FlowprobeParamsReply)(nil), "flowprobe_params_reply_e8d4e804")
286         api.RegisterMessage((*FlowprobeTxInterfaceAddDel)(nil), "flowprobe_tx_interface_add_del_b782c976")
287         api.RegisterMessage((*FlowprobeTxInterfaceAddDelReply)(nil), "flowprobe_tx_interface_add_del_reply_e8d4e804")
288 }
289
290 // Messages returns list of all messages in this module.
291 func AllMessages() []api.Message {
292         return []api.Message{
293                 (*FlowprobeParams)(nil),
294                 (*FlowprobeParamsReply)(nil),
295                 (*FlowprobeTxInterfaceAddDel)(nil),
296                 (*FlowprobeTxInterfaceAddDelReply)(nil),
297         }
298 }