Improve binapi generator
[govpp.git] / binapi / udp / udp.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/udp.api.json
6
7 // Package udp contains generated bindings for API file udp.api.
8 //
9 // Contents:
10 //   1 struct
11 //   6 messages
12 //
13 package udp
14
15 import (
16         api "git.fd.io/govpp.git/api"
17         ip_types "git.fd.io/govpp.git/binapi/ip_types"
18         codec "git.fd.io/govpp.git/codec"
19 )
20
21 // This is a compile-time assertion to ensure that this generated file
22 // is compatible with the GoVPP api package it is being compiled against.
23 // A compilation error at this line likely means your copy of the
24 // GoVPP api package needs to be updated.
25 const _ = api.GoVppAPIPackageIsVersion2
26
27 const (
28         APIFile    = "udp"
29         APIVersion = "1.1.0"
30         VersionCrc = 0xb827bf4f
31 )
32
33 // UDPEncap defines type 'udp_encap'.
34 type UDPEncap struct {
35         TableID uint32           `binapi:"u32,name=table_id" json:"table_id,omitempty"`
36         SrcPort uint16           `binapi:"u16,name=src_port" json:"src_port,omitempty"`
37         DstPort uint16           `binapi:"u16,name=dst_port" json:"dst_port,omitempty"`
38         SrcIP   ip_types.Address `binapi:"address,name=src_ip" json:"src_ip,omitempty"`
39         DstIP   ip_types.Address `binapi:"address,name=dst_ip" json:"dst_ip,omitempty"`
40         ID      uint32           `binapi:"u32,name=id" json:"id,omitempty"`
41 }
42
43 // UDPEncapAdd defines message 'udp_encap_add'.
44 type UDPEncapAdd struct {
45         UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"`
46 }
47
48 func (m *UDPEncapAdd) Reset()               { *m = UDPEncapAdd{} }
49 func (*UDPEncapAdd) GetMessageName() string { return "udp_encap_add" }
50 func (*UDPEncapAdd) GetCrcString() string   { return "61d5fc48" }
51 func (*UDPEncapAdd) GetMessageType() api.MessageType {
52         return api.RequestMessage
53 }
54
55 func (m *UDPEncapAdd) Size() int {
56         if m == nil {
57                 return 0
58         }
59         var size int
60         size += 4      // m.UDPEncap.TableID
61         size += 2      // m.UDPEncap.SrcPort
62         size += 2      // m.UDPEncap.DstPort
63         size += 1      // m.UDPEncap.SrcIP.Af
64         size += 1 * 16 // m.UDPEncap.SrcIP.Un
65         size += 1      // m.UDPEncap.DstIP.Af
66         size += 1 * 16 // m.UDPEncap.DstIP.Un
67         size += 4      // m.UDPEncap.ID
68         return size
69 }
70 func (m *UDPEncapAdd) Marshal(b []byte) ([]byte, error) {
71         var buf *codec.Buffer
72         if b == nil {
73                 buf = codec.NewBuffer(make([]byte, m.Size()))
74         } else {
75                 buf = codec.NewBuffer(b)
76         }
77         buf.EncodeUint32(uint32(m.UDPEncap.TableID))
78         buf.EncodeUint16(uint16(m.UDPEncap.SrcPort))
79         buf.EncodeUint16(uint16(m.UDPEncap.DstPort))
80         buf.EncodeUint8(uint8(m.UDPEncap.SrcIP.Af))
81         buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 0)
82         buf.EncodeUint8(uint8(m.UDPEncap.DstIP.Af))
83         buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 0)
84         buf.EncodeUint32(uint32(m.UDPEncap.ID))
85         return buf.Bytes(), nil
86 }
87 func (m *UDPEncapAdd) Unmarshal(b []byte) error {
88         buf := codec.NewBuffer(b)
89         m.UDPEncap.TableID = buf.DecodeUint32()
90         m.UDPEncap.SrcPort = buf.DecodeUint16()
91         m.UDPEncap.DstPort = buf.DecodeUint16()
92         m.UDPEncap.SrcIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
93         copy(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
94         m.UDPEncap.DstIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
95         copy(m.UDPEncap.DstIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
96         m.UDPEncap.ID = buf.DecodeUint32()
97         return nil
98 }
99
100 // UDPEncapAddReply defines message 'udp_encap_add_reply'.
101 type UDPEncapAddReply struct {
102         Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
103         ID     uint32 `binapi:"u32,name=id" json:"id,omitempty"`
104 }
105
106 func (m *UDPEncapAddReply) Reset()               { *m = UDPEncapAddReply{} }
107 func (*UDPEncapAddReply) GetMessageName() string { return "udp_encap_add_reply" }
108 func (*UDPEncapAddReply) GetCrcString() string   { return "e2fc8294" }
109 func (*UDPEncapAddReply) GetMessageType() api.MessageType {
110         return api.ReplyMessage
111 }
112
113 func (m *UDPEncapAddReply) Size() int {
114         if m == nil {
115                 return 0
116         }
117         var size int
118         size += 4 // m.Retval
119         size += 4 // m.ID
120         return size
121 }
122 func (m *UDPEncapAddReply) Marshal(b []byte) ([]byte, error) {
123         var buf *codec.Buffer
124         if b == nil {
125                 buf = codec.NewBuffer(make([]byte, m.Size()))
126         } else {
127                 buf = codec.NewBuffer(b)
128         }
129         buf.EncodeUint32(uint32(m.Retval))
130         buf.EncodeUint32(uint32(m.ID))
131         return buf.Bytes(), nil
132 }
133 func (m *UDPEncapAddReply) Unmarshal(b []byte) error {
134         buf := codec.NewBuffer(b)
135         m.Retval = int32(buf.DecodeUint32())
136         m.ID = buf.DecodeUint32()
137         return nil
138 }
139
140 // UDPEncapDel defines message 'udp_encap_del'.
141 type UDPEncapDel struct {
142         ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
143 }
144
145 func (m *UDPEncapDel) Reset()               { *m = UDPEncapDel{} }
146 func (*UDPEncapDel) GetMessageName() string { return "udp_encap_del" }
147 func (*UDPEncapDel) GetCrcString() string   { return "3a91bde5" }
148 func (*UDPEncapDel) GetMessageType() api.MessageType {
149         return api.RequestMessage
150 }
151
152 func (m *UDPEncapDel) Size() int {
153         if m == nil {
154                 return 0
155         }
156         var size int
157         size += 4 // m.ID
158         return size
159 }
160 func (m *UDPEncapDel) Marshal(b []byte) ([]byte, error) {
161         var buf *codec.Buffer
162         if b == nil {
163                 buf = codec.NewBuffer(make([]byte, m.Size()))
164         } else {
165                 buf = codec.NewBuffer(b)
166         }
167         buf.EncodeUint32(uint32(m.ID))
168         return buf.Bytes(), nil
169 }
170 func (m *UDPEncapDel) Unmarshal(b []byte) error {
171         buf := codec.NewBuffer(b)
172         m.ID = buf.DecodeUint32()
173         return nil
174 }
175
176 // UDPEncapDelReply defines message 'udp_encap_del_reply'.
177 type UDPEncapDelReply struct {
178         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
179 }
180
181 func (m *UDPEncapDelReply) Reset()               { *m = UDPEncapDelReply{} }
182 func (*UDPEncapDelReply) GetMessageName() string { return "udp_encap_del_reply" }
183 func (*UDPEncapDelReply) GetCrcString() string   { return "e8d4e804" }
184 func (*UDPEncapDelReply) GetMessageType() api.MessageType {
185         return api.ReplyMessage
186 }
187
188 func (m *UDPEncapDelReply) 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 *UDPEncapDelReply) 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 *UDPEncapDelReply) Unmarshal(b []byte) error {
207         buf := codec.NewBuffer(b)
208         m.Retval = int32(buf.DecodeUint32())
209         return nil
210 }
211
212 // UDPEncapDetails defines message 'udp_encap_details'.
213 type UDPEncapDetails struct {
214         UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"`
215 }
216
217 func (m *UDPEncapDetails) Reset()               { *m = UDPEncapDetails{} }
218 func (*UDPEncapDetails) GetMessageName() string { return "udp_encap_details" }
219 func (*UDPEncapDetails) GetCrcString() string   { return "87c82821" }
220 func (*UDPEncapDetails) GetMessageType() api.MessageType {
221         return api.ReplyMessage
222 }
223
224 func (m *UDPEncapDetails) Size() int {
225         if m == nil {
226                 return 0
227         }
228         var size int
229         size += 4      // m.UDPEncap.TableID
230         size += 2      // m.UDPEncap.SrcPort
231         size += 2      // m.UDPEncap.DstPort
232         size += 1      // m.UDPEncap.SrcIP.Af
233         size += 1 * 16 // m.UDPEncap.SrcIP.Un
234         size += 1      // m.UDPEncap.DstIP.Af
235         size += 1 * 16 // m.UDPEncap.DstIP.Un
236         size += 4      // m.UDPEncap.ID
237         return size
238 }
239 func (m *UDPEncapDetails) Marshal(b []byte) ([]byte, error) {
240         var buf *codec.Buffer
241         if b == nil {
242                 buf = codec.NewBuffer(make([]byte, m.Size()))
243         } else {
244                 buf = codec.NewBuffer(b)
245         }
246         buf.EncodeUint32(uint32(m.UDPEncap.TableID))
247         buf.EncodeUint16(uint16(m.UDPEncap.SrcPort))
248         buf.EncodeUint16(uint16(m.UDPEncap.DstPort))
249         buf.EncodeUint8(uint8(m.UDPEncap.SrcIP.Af))
250         buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 0)
251         buf.EncodeUint8(uint8(m.UDPEncap.DstIP.Af))
252         buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 0)
253         buf.EncodeUint32(uint32(m.UDPEncap.ID))
254         return buf.Bytes(), nil
255 }
256 func (m *UDPEncapDetails) Unmarshal(b []byte) error {
257         buf := codec.NewBuffer(b)
258         m.UDPEncap.TableID = buf.DecodeUint32()
259         m.UDPEncap.SrcPort = buf.DecodeUint16()
260         m.UDPEncap.DstPort = buf.DecodeUint16()
261         m.UDPEncap.SrcIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
262         copy(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
263         m.UDPEncap.DstIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
264         copy(m.UDPEncap.DstIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
265         m.UDPEncap.ID = buf.DecodeUint32()
266         return nil
267 }
268
269 // UDPEncapDump defines message 'udp_encap_dump'.
270 type UDPEncapDump struct{}
271
272 func (m *UDPEncapDump) Reset()               { *m = UDPEncapDump{} }
273 func (*UDPEncapDump) GetMessageName() string { return "udp_encap_dump" }
274 func (*UDPEncapDump) GetCrcString() string   { return "51077d14" }
275 func (*UDPEncapDump) GetMessageType() api.MessageType {
276         return api.RequestMessage
277 }
278
279 func (m *UDPEncapDump) Size() int {
280         if m == nil {
281                 return 0
282         }
283         var size int
284         return size
285 }
286 func (m *UDPEncapDump) Marshal(b []byte) ([]byte, error) {
287         var buf *codec.Buffer
288         if b == nil {
289                 buf = codec.NewBuffer(make([]byte, m.Size()))
290         } else {
291                 buf = codec.NewBuffer(b)
292         }
293         return buf.Bytes(), nil
294 }
295 func (m *UDPEncapDump) Unmarshal(b []byte) error {
296         return nil
297 }
298
299 func init() { file_udp_binapi_init() }
300 func file_udp_binapi_init() {
301         api.RegisterMessage((*UDPEncapAdd)(nil), "udp_encap_add_61d5fc48")
302         api.RegisterMessage((*UDPEncapAddReply)(nil), "udp_encap_add_reply_e2fc8294")
303         api.RegisterMessage((*UDPEncapDel)(nil), "udp_encap_del_3a91bde5")
304         api.RegisterMessage((*UDPEncapDelReply)(nil), "udp_encap_del_reply_e8d4e804")
305         api.RegisterMessage((*UDPEncapDetails)(nil), "udp_encap_details_87c82821")
306         api.RegisterMessage((*UDPEncapDump)(nil), "udp_encap_dump_51077d14")
307 }
308
309 // Messages returns list of all messages in this module.
310 func AllMessages() []api.Message {
311         return []api.Message{
312                 (*UDPEncapAdd)(nil),
313                 (*UDPEncapAddReply)(nil),
314                 (*UDPEncapDel)(nil),
315                 (*UDPEncapDelReply)(nil),
316                 (*UDPEncapDetails)(nil),
317                 (*UDPEncapDump)(nil),
318         }
319 }