Improve binapi generator
[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 // source: /usr/share/vpp/api/plugins/flowprobe.api.json
6
7 // Package flowprobe contains generated bindings for API file flowprobe.api.
8 //
9 // Contents:
10 //   2 enums
11 //   4 messages
12 //
13 package flowprobe
14
15 import (
16         api "git.fd.io/govpp.git/api"
17         interface_types "git.fd.io/govpp.git/binapi/interface_types"
18         codec "git.fd.io/govpp.git/codec"
19         "strconv"
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() int {
147         if m == nil {
148                 return 0
149         }
150         var size int
151         size += 1 // m.RecordFlags
152         size += 4 // m.ActiveTimer
153         size += 4 // m.PassiveTimer
154         return size
155 }
156 func (m *FlowprobeParams) Marshal(b []byte) ([]byte, error) {
157         var buf *codec.Buffer
158         if b == nil {
159                 buf = codec.NewBuffer(make([]byte, m.Size()))
160         } else {
161                 buf = codec.NewBuffer(b)
162         }
163         buf.EncodeUint8(uint8(m.RecordFlags))
164         buf.EncodeUint32(uint32(m.ActiveTimer))
165         buf.EncodeUint32(uint32(m.PassiveTimer))
166         return buf.Bytes(), nil
167 }
168 func (m *FlowprobeParams) Unmarshal(b []byte) error {
169         buf := codec.NewBuffer(b)
170         m.RecordFlags = FlowprobeRecordFlags(buf.DecodeUint8())
171         m.ActiveTimer = buf.DecodeUint32()
172         m.PassiveTimer = buf.DecodeUint32()
173         return nil
174 }
175
176 // FlowprobeParamsReply defines message 'flowprobe_params_reply'.
177 type FlowprobeParamsReply struct {
178         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
179 }
180
181 func (m *FlowprobeParamsReply) Reset()               { *m = FlowprobeParamsReply{} }
182 func (*FlowprobeParamsReply) GetMessageName() string { return "flowprobe_params_reply" }
183 func (*FlowprobeParamsReply) GetCrcString() string   { return "e8d4e804" }
184 func (*FlowprobeParamsReply) GetMessageType() api.MessageType {
185         return api.ReplyMessage
186 }
187
188 func (m *FlowprobeParamsReply) Size() int {
189         if m == nil {
190                 return 0
191         }
192         var size int
193         size += 4 // m.Retval
194         return size
195 }
196 func (m *FlowprobeParamsReply) Marshal(b []byte) ([]byte, error) {
197         var buf *codec.Buffer
198         if b == nil {
199                 buf = codec.NewBuffer(make([]byte, m.Size()))
200         } else {
201                 buf = codec.NewBuffer(b)
202         }
203         buf.EncodeUint32(uint32(m.Retval))
204         return buf.Bytes(), nil
205 }
206 func (m *FlowprobeParamsReply) Unmarshal(b []byte) error {
207         buf := codec.NewBuffer(b)
208         m.Retval = int32(buf.DecodeUint32())
209         return nil
210 }
211
212 // FlowprobeTxInterfaceAddDel defines message 'flowprobe_tx_interface_add_del'.
213 type FlowprobeTxInterfaceAddDel struct {
214         IsAdd     bool                           `binapi:"bool,name=is_add" json:"is_add,omitempty"`
215         Which     FlowprobeWhichFlags            `binapi:"flowprobe_which_flags,name=which" json:"which,omitempty"`
216         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
217 }
218
219 func (m *FlowprobeTxInterfaceAddDel) Reset()               { *m = FlowprobeTxInterfaceAddDel{} }
220 func (*FlowprobeTxInterfaceAddDel) GetMessageName() string { return "flowprobe_tx_interface_add_del" }
221 func (*FlowprobeTxInterfaceAddDel) GetCrcString() string   { return "b782c976" }
222 func (*FlowprobeTxInterfaceAddDel) GetMessageType() api.MessageType {
223         return api.RequestMessage
224 }
225
226 func (m *FlowprobeTxInterfaceAddDel) Size() int {
227         if m == nil {
228                 return 0
229         }
230         var size int
231         size += 1 // m.IsAdd
232         size += 1 // m.Which
233         size += 4 // m.SwIfIndex
234         return size
235 }
236 func (m *FlowprobeTxInterfaceAddDel) Marshal(b []byte) ([]byte, error) {
237         var buf *codec.Buffer
238         if b == nil {
239                 buf = codec.NewBuffer(make([]byte, m.Size()))
240         } else {
241                 buf = codec.NewBuffer(b)
242         }
243         buf.EncodeBool(m.IsAdd)
244         buf.EncodeUint8(uint8(m.Which))
245         buf.EncodeUint32(uint32(m.SwIfIndex))
246         return buf.Bytes(), nil
247 }
248 func (m *FlowprobeTxInterfaceAddDel) Unmarshal(b []byte) error {
249         buf := codec.NewBuffer(b)
250         m.IsAdd = buf.DecodeBool()
251         m.Which = FlowprobeWhichFlags(buf.DecodeUint8())
252         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
253         return nil
254 }
255
256 // FlowprobeTxInterfaceAddDelReply defines message 'flowprobe_tx_interface_add_del_reply'.
257 type FlowprobeTxInterfaceAddDelReply struct {
258         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
259 }
260
261 func (m *FlowprobeTxInterfaceAddDelReply) Reset() { *m = FlowprobeTxInterfaceAddDelReply{} }
262 func (*FlowprobeTxInterfaceAddDelReply) GetMessageName() string {
263         return "flowprobe_tx_interface_add_del_reply"
264 }
265 func (*FlowprobeTxInterfaceAddDelReply) GetCrcString() string { return "e8d4e804" }
266 func (*FlowprobeTxInterfaceAddDelReply) GetMessageType() api.MessageType {
267         return api.ReplyMessage
268 }
269
270 func (m *FlowprobeTxInterfaceAddDelReply) Size() int {
271         if m == nil {
272                 return 0
273         }
274         var size int
275         size += 4 // m.Retval
276         return size
277 }
278 func (m *FlowprobeTxInterfaceAddDelReply) Marshal(b []byte) ([]byte, error) {
279         var buf *codec.Buffer
280         if b == nil {
281                 buf = codec.NewBuffer(make([]byte, m.Size()))
282         } else {
283                 buf = codec.NewBuffer(b)
284         }
285         buf.EncodeUint32(uint32(m.Retval))
286         return buf.Bytes(), nil
287 }
288 func (m *FlowprobeTxInterfaceAddDelReply) Unmarshal(b []byte) error {
289         buf := codec.NewBuffer(b)
290         m.Retval = int32(buf.DecodeUint32())
291         return nil
292 }
293
294 func init() { file_flowprobe_binapi_init() }
295 func file_flowprobe_binapi_init() {
296         api.RegisterMessage((*FlowprobeParams)(nil), "flowprobe_params_baa46c09")
297         api.RegisterMessage((*FlowprobeParamsReply)(nil), "flowprobe_params_reply_e8d4e804")
298         api.RegisterMessage((*FlowprobeTxInterfaceAddDel)(nil), "flowprobe_tx_interface_add_del_b782c976")
299         api.RegisterMessage((*FlowprobeTxInterfaceAddDelReply)(nil), "flowprobe_tx_interface_add_del_reply_e8d4e804")
300 }
301
302 // Messages returns list of all messages in this module.
303 func AllMessages() []api.Message {
304         return []api.Message{
305                 (*FlowprobeParams)(nil),
306                 (*FlowprobeParamsReply)(nil),
307                 (*FlowprobeTxInterfaceAddDel)(nil),
308                 (*FlowprobeTxInterfaceAddDelReply)(nil),
309         }
310 }