binapigen: fix union size
[govpp.git] / binapi / arp / arp.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/core/arp.api.json
6
7 // Package arp contains generated bindings for API file arp.api.
8 //
9 // Contents:
10 //   1 struct
11 //   8 messages
12 //
13 package arp
14
15 import (
16         api "git.fd.io/govpp.git/api"
17         _ "git.fd.io/govpp.git/binapi/ethernet_types"
18         interface_types "git.fd.io/govpp.git/binapi/interface_types"
19         ip_types "git.fd.io/govpp.git/binapi/ip_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    = "arp"
31         APIVersion = "1.0.0"
32         VersionCrc = 0x79ca86f2
33 )
34
35 // ProxyArp defines type 'proxy_arp'.
36 type ProxyArp struct {
37         TableID uint32              `binapi:"u32,name=table_id" json:"table_id,omitempty"`
38         Low     ip_types.IP4Address `binapi:"ip4_address,name=low" json:"low,omitempty"`
39         Hi      ip_types.IP4Address `binapi:"ip4_address,name=hi" json:"hi,omitempty"`
40 }
41
42 // ProxyArpAddDel defines message 'proxy_arp_add_del'.
43 type ProxyArpAddDel struct {
44         IsAdd bool     `binapi:"bool,name=is_add" json:"is_add,omitempty"`
45         Proxy ProxyArp `binapi:"proxy_arp,name=proxy" json:"proxy,omitempty"`
46 }
47
48 func (m *ProxyArpAddDel) Reset()               { *m = ProxyArpAddDel{} }
49 func (*ProxyArpAddDel) GetMessageName() string { return "proxy_arp_add_del" }
50 func (*ProxyArpAddDel) GetCrcString() string   { return "85486cbd" }
51 func (*ProxyArpAddDel) GetMessageType() api.MessageType {
52         return api.RequestMessage
53 }
54
55 func (m *ProxyArpAddDel) Size() (size int) {
56         if m == nil {
57                 return 0
58         }
59         size += 1     // m.IsAdd
60         size += 4     // m.Proxy.TableID
61         size += 1 * 4 // m.Proxy.Low
62         size += 1 * 4 // m.Proxy.Hi
63         return size
64 }
65 func (m *ProxyArpAddDel) Marshal(b []byte) ([]byte, error) {
66         if b == nil {
67                 b = make([]byte, m.Size())
68         }
69         buf := codec.NewBuffer(b)
70         buf.EncodeBool(m.IsAdd)
71         buf.EncodeUint32(m.Proxy.TableID)
72         buf.EncodeBytes(m.Proxy.Low[:], 4)
73         buf.EncodeBytes(m.Proxy.Hi[:], 4)
74         return buf.Bytes(), nil
75 }
76 func (m *ProxyArpAddDel) Unmarshal(b []byte) error {
77         buf := codec.NewBuffer(b)
78         m.IsAdd = buf.DecodeBool()
79         m.Proxy.TableID = buf.DecodeUint32()
80         copy(m.Proxy.Low[:], buf.DecodeBytes(4))
81         copy(m.Proxy.Hi[:], buf.DecodeBytes(4))
82         return nil
83 }
84
85 // ProxyArpAddDelReply defines message 'proxy_arp_add_del_reply'.
86 type ProxyArpAddDelReply struct {
87         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
88 }
89
90 func (m *ProxyArpAddDelReply) Reset()               { *m = ProxyArpAddDelReply{} }
91 func (*ProxyArpAddDelReply) GetMessageName() string { return "proxy_arp_add_del_reply" }
92 func (*ProxyArpAddDelReply) GetCrcString() string   { return "e8d4e804" }
93 func (*ProxyArpAddDelReply) GetMessageType() api.MessageType {
94         return api.ReplyMessage
95 }
96
97 func (m *ProxyArpAddDelReply) Size() (size int) {
98         if m == nil {
99                 return 0
100         }
101         size += 4 // m.Retval
102         return size
103 }
104 func (m *ProxyArpAddDelReply) Marshal(b []byte) ([]byte, error) {
105         if b == nil {
106                 b = make([]byte, m.Size())
107         }
108         buf := codec.NewBuffer(b)
109         buf.EncodeInt32(m.Retval)
110         return buf.Bytes(), nil
111 }
112 func (m *ProxyArpAddDelReply) Unmarshal(b []byte) error {
113         buf := codec.NewBuffer(b)
114         m.Retval = buf.DecodeInt32()
115         return nil
116 }
117
118 // ProxyArpDetails defines message 'proxy_arp_details'.
119 type ProxyArpDetails struct {
120         Proxy ProxyArp `binapi:"proxy_arp,name=proxy" json:"proxy,omitempty"`
121 }
122
123 func (m *ProxyArpDetails) Reset()               { *m = ProxyArpDetails{} }
124 func (*ProxyArpDetails) GetMessageName() string { return "proxy_arp_details" }
125 func (*ProxyArpDetails) GetCrcString() string   { return "9228c150" }
126 func (*ProxyArpDetails) GetMessageType() api.MessageType {
127         return api.ReplyMessage
128 }
129
130 func (m *ProxyArpDetails) Size() (size int) {
131         if m == nil {
132                 return 0
133         }
134         size += 4     // m.Proxy.TableID
135         size += 1 * 4 // m.Proxy.Low
136         size += 1 * 4 // m.Proxy.Hi
137         return size
138 }
139 func (m *ProxyArpDetails) Marshal(b []byte) ([]byte, error) {
140         if b == nil {
141                 b = make([]byte, m.Size())
142         }
143         buf := codec.NewBuffer(b)
144         buf.EncodeUint32(m.Proxy.TableID)
145         buf.EncodeBytes(m.Proxy.Low[:], 4)
146         buf.EncodeBytes(m.Proxy.Hi[:], 4)
147         return buf.Bytes(), nil
148 }
149 func (m *ProxyArpDetails) Unmarshal(b []byte) error {
150         buf := codec.NewBuffer(b)
151         m.Proxy.TableID = buf.DecodeUint32()
152         copy(m.Proxy.Low[:], buf.DecodeBytes(4))
153         copy(m.Proxy.Hi[:], buf.DecodeBytes(4))
154         return nil
155 }
156
157 // ProxyArpDump defines message 'proxy_arp_dump'.
158 type ProxyArpDump struct{}
159
160 func (m *ProxyArpDump) Reset()               { *m = ProxyArpDump{} }
161 func (*ProxyArpDump) GetMessageName() string { return "proxy_arp_dump" }
162 func (*ProxyArpDump) GetCrcString() string   { return "51077d14" }
163 func (*ProxyArpDump) GetMessageType() api.MessageType {
164         return api.RequestMessage
165 }
166
167 func (m *ProxyArpDump) Size() (size int) {
168         if m == nil {
169                 return 0
170         }
171         return size
172 }
173 func (m *ProxyArpDump) Marshal(b []byte) ([]byte, error) {
174         if b == nil {
175                 b = make([]byte, m.Size())
176         }
177         buf := codec.NewBuffer(b)
178         return buf.Bytes(), nil
179 }
180 func (m *ProxyArpDump) Unmarshal(b []byte) error {
181         return nil
182 }
183
184 // ProxyArpIntfcDetails defines message 'proxy_arp_intfc_details'.
185 type ProxyArpIntfcDetails struct {
186         SwIfIndex uint32 `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
187 }
188
189 func (m *ProxyArpIntfcDetails) Reset()               { *m = ProxyArpIntfcDetails{} }
190 func (*ProxyArpIntfcDetails) GetMessageName() string { return "proxy_arp_intfc_details" }
191 func (*ProxyArpIntfcDetails) GetCrcString() string   { return "f6458e5f" }
192 func (*ProxyArpIntfcDetails) GetMessageType() api.MessageType {
193         return api.ReplyMessage
194 }
195
196 func (m *ProxyArpIntfcDetails) Size() (size int) {
197         if m == nil {
198                 return 0
199         }
200         size += 4 // m.SwIfIndex
201         return size
202 }
203 func (m *ProxyArpIntfcDetails) Marshal(b []byte) ([]byte, error) {
204         if b == nil {
205                 b = make([]byte, m.Size())
206         }
207         buf := codec.NewBuffer(b)
208         buf.EncodeUint32(m.SwIfIndex)
209         return buf.Bytes(), nil
210 }
211 func (m *ProxyArpIntfcDetails) Unmarshal(b []byte) error {
212         buf := codec.NewBuffer(b)
213         m.SwIfIndex = buf.DecodeUint32()
214         return nil
215 }
216
217 // ProxyArpIntfcDump defines message 'proxy_arp_intfc_dump'.
218 type ProxyArpIntfcDump struct{}
219
220 func (m *ProxyArpIntfcDump) Reset()               { *m = ProxyArpIntfcDump{} }
221 func (*ProxyArpIntfcDump) GetMessageName() string { return "proxy_arp_intfc_dump" }
222 func (*ProxyArpIntfcDump) GetCrcString() string   { return "51077d14" }
223 func (*ProxyArpIntfcDump) GetMessageType() api.MessageType {
224         return api.RequestMessage
225 }
226
227 func (m *ProxyArpIntfcDump) Size() (size int) {
228         if m == nil {
229                 return 0
230         }
231         return size
232 }
233 func (m *ProxyArpIntfcDump) Marshal(b []byte) ([]byte, error) {
234         if b == nil {
235                 b = make([]byte, m.Size())
236         }
237         buf := codec.NewBuffer(b)
238         return buf.Bytes(), nil
239 }
240 func (m *ProxyArpIntfcDump) Unmarshal(b []byte) error {
241         return nil
242 }
243
244 // ProxyArpIntfcEnableDisable defines message 'proxy_arp_intfc_enable_disable'.
245 type ProxyArpIntfcEnableDisable struct {
246         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
247         Enable    bool                           `binapi:"bool,name=enable" json:"enable,omitempty"`
248 }
249
250 func (m *ProxyArpIntfcEnableDisable) Reset()               { *m = ProxyArpIntfcEnableDisable{} }
251 func (*ProxyArpIntfcEnableDisable) GetMessageName() string { return "proxy_arp_intfc_enable_disable" }
252 func (*ProxyArpIntfcEnableDisable) GetCrcString() string   { return "ae6cfcfb" }
253 func (*ProxyArpIntfcEnableDisable) GetMessageType() api.MessageType {
254         return api.RequestMessage
255 }
256
257 func (m *ProxyArpIntfcEnableDisable) Size() (size int) {
258         if m == nil {
259                 return 0
260         }
261         size += 4 // m.SwIfIndex
262         size += 1 // m.Enable
263         return size
264 }
265 func (m *ProxyArpIntfcEnableDisable) Marshal(b []byte) ([]byte, error) {
266         if b == nil {
267                 b = make([]byte, m.Size())
268         }
269         buf := codec.NewBuffer(b)
270         buf.EncodeUint32(uint32(m.SwIfIndex))
271         buf.EncodeBool(m.Enable)
272         return buf.Bytes(), nil
273 }
274 func (m *ProxyArpIntfcEnableDisable) Unmarshal(b []byte) error {
275         buf := codec.NewBuffer(b)
276         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
277         m.Enable = buf.DecodeBool()
278         return nil
279 }
280
281 // ProxyArpIntfcEnableDisableReply defines message 'proxy_arp_intfc_enable_disable_reply'.
282 type ProxyArpIntfcEnableDisableReply struct {
283         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
284 }
285
286 func (m *ProxyArpIntfcEnableDisableReply) Reset() { *m = ProxyArpIntfcEnableDisableReply{} }
287 func (*ProxyArpIntfcEnableDisableReply) GetMessageName() string {
288         return "proxy_arp_intfc_enable_disable_reply"
289 }
290 func (*ProxyArpIntfcEnableDisableReply) GetCrcString() string { return "e8d4e804" }
291 func (*ProxyArpIntfcEnableDisableReply) GetMessageType() api.MessageType {
292         return api.ReplyMessage
293 }
294
295 func (m *ProxyArpIntfcEnableDisableReply) Size() (size int) {
296         if m == nil {
297                 return 0
298         }
299         size += 4 // m.Retval
300         return size
301 }
302 func (m *ProxyArpIntfcEnableDisableReply) Marshal(b []byte) ([]byte, error) {
303         if b == nil {
304                 b = make([]byte, m.Size())
305         }
306         buf := codec.NewBuffer(b)
307         buf.EncodeInt32(m.Retval)
308         return buf.Bytes(), nil
309 }
310 func (m *ProxyArpIntfcEnableDisableReply) Unmarshal(b []byte) error {
311         buf := codec.NewBuffer(b)
312         m.Retval = buf.DecodeInt32()
313         return nil
314 }
315
316 func init() { file_arp_binapi_init() }
317 func file_arp_binapi_init() {
318         api.RegisterMessage((*ProxyArpAddDel)(nil), "proxy_arp_add_del_85486cbd")
319         api.RegisterMessage((*ProxyArpAddDelReply)(nil), "proxy_arp_add_del_reply_e8d4e804")
320         api.RegisterMessage((*ProxyArpDetails)(nil), "proxy_arp_details_9228c150")
321         api.RegisterMessage((*ProxyArpDump)(nil), "proxy_arp_dump_51077d14")
322         api.RegisterMessage((*ProxyArpIntfcDetails)(nil), "proxy_arp_intfc_details_f6458e5f")
323         api.RegisterMessage((*ProxyArpIntfcDump)(nil), "proxy_arp_intfc_dump_51077d14")
324         api.RegisterMessage((*ProxyArpIntfcEnableDisable)(nil), "proxy_arp_intfc_enable_disable_ae6cfcfb")
325         api.RegisterMessage((*ProxyArpIntfcEnableDisableReply)(nil), "proxy_arp_intfc_enable_disable_reply_e8d4e804")
326 }
327
328 // Messages returns list of all messages in this module.
329 func AllMessages() []api.Message {
330         return []api.Message{
331                 (*ProxyArpAddDel)(nil),
332                 (*ProxyArpAddDelReply)(nil),
333                 (*ProxyArpDetails)(nil),
334                 (*ProxyArpDump)(nil),
335                 (*ProxyArpIntfcDetails)(nil),
336                 (*ProxyArpIntfcDump)(nil),
337                 (*ProxyArpIntfcEnableDisable)(nil),
338                 (*ProxyArpIntfcEnableDisableReply)(nil),
339         }
340 }