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