Change module name to go.fd.io/govpp
[govpp.git] / binapi / udp / udp.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.6.0-dev
4 //  VPP:              22.02-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 enum
11 //   2 structs
12 //   8 messages
13 //
14 package udp
15
16 import (
17         "strconv"
18
19         api "go.fd.io/govpp/api"
20         ip_types "go.fd.io/govpp/binapi/ip_types"
21         codec "go.fd.io/govpp/codec"
22 )
23
24 // This is a compile-time assertion to ensure that this generated file
25 // is compatible with the GoVPP api package it is being compiled against.
26 // A compilation error at this line likely means your copy of the
27 // GoVPP api package needs to be updated.
28 const _ = api.GoVppAPIPackageIsVersion2
29
30 const (
31         APIFile    = "udp"
32         APIVersion = "1.1.0"
33         VersionCrc = 0x2d3db5fa
34 )
35
36 // UDPDecapNextProto defines enum 'udp_decap_next_proto'.
37 type UDPDecapNextProto uint32
38
39 const (
40         UDP_API_DECAP_PROTO_IP4  UDPDecapNextProto = 1
41         UDP_API_DECAP_PROTO_IP6  UDPDecapNextProto = 2
42         UDP_API_DECAP_PROTO_MPLS UDPDecapNextProto = 3
43 )
44
45 var (
46         UDPDecapNextProto_name = map[uint32]string{
47                 1: "UDP_API_DECAP_PROTO_IP4",
48                 2: "UDP_API_DECAP_PROTO_IP6",
49                 3: "UDP_API_DECAP_PROTO_MPLS",
50         }
51         UDPDecapNextProto_value = map[string]uint32{
52                 "UDP_API_DECAP_PROTO_IP4":  1,
53                 "UDP_API_DECAP_PROTO_IP6":  2,
54                 "UDP_API_DECAP_PROTO_MPLS": 3,
55         }
56 )
57
58 func (x UDPDecapNextProto) String() string {
59         s, ok := UDPDecapNextProto_name[uint32(x)]
60         if ok {
61                 return s
62         }
63         return "UDPDecapNextProto(" + strconv.Itoa(int(x)) + ")"
64 }
65
66 // UDPDecap defines type 'udp_decap'.
67 type UDPDecap struct {
68         IsIP4     uint8             `binapi:"u8,name=is_ip4" json:"is_ip4,omitempty"`
69         Port      uint16            `binapi:"u16,name=port" json:"port,omitempty"`
70         NextProto UDPDecapNextProto `binapi:"udp_decap_next_proto,name=next_proto" json:"next_proto,omitempty"`
71 }
72
73 // UDPEncap defines type 'udp_encap'.
74 type UDPEncap struct {
75         TableID uint32           `binapi:"u32,name=table_id" json:"table_id,omitempty"`
76         SrcPort uint16           `binapi:"u16,name=src_port" json:"src_port,omitempty"`
77         DstPort uint16           `binapi:"u16,name=dst_port" json:"dst_port,omitempty"`
78         SrcIP   ip_types.Address `binapi:"address,name=src_ip" json:"src_ip,omitempty"`
79         DstIP   ip_types.Address `binapi:"address,name=dst_ip" json:"dst_ip,omitempty"`
80         ID      uint32           `binapi:"u32,name=id" json:"id,omitempty"`
81 }
82
83 // UDPDecapAddDel defines message 'udp_decap_add_del'.
84 type UDPDecapAddDel struct {
85         IsAdd    bool     `binapi:"bool,name=is_add" json:"is_add,omitempty"`
86         UDPDecap UDPDecap `binapi:"udp_decap,name=udp_decap" json:"udp_decap,omitempty"`
87 }
88
89 func (m *UDPDecapAddDel) Reset()               { *m = UDPDecapAddDel{} }
90 func (*UDPDecapAddDel) GetMessageName() string { return "udp_decap_add_del" }
91 func (*UDPDecapAddDel) GetCrcString() string   { return "d155c6ac" }
92 func (*UDPDecapAddDel) GetMessageType() api.MessageType {
93         return api.RequestMessage
94 }
95
96 func (m *UDPDecapAddDel) Size() (size int) {
97         if m == nil {
98                 return 0
99         }
100         size += 1 // m.IsAdd
101         size += 1 // m.UDPDecap.IsIP4
102         size += 2 // m.UDPDecap.Port
103         size += 4 // m.UDPDecap.NextProto
104         return size
105 }
106 func (m *UDPDecapAddDel) Marshal(b []byte) ([]byte, error) {
107         if b == nil {
108                 b = make([]byte, m.Size())
109         }
110         buf := codec.NewBuffer(b)
111         buf.EncodeBool(m.IsAdd)
112         buf.EncodeUint8(m.UDPDecap.IsIP4)
113         buf.EncodeUint16(m.UDPDecap.Port)
114         buf.EncodeUint32(uint32(m.UDPDecap.NextProto))
115         return buf.Bytes(), nil
116 }
117 func (m *UDPDecapAddDel) Unmarshal(b []byte) error {
118         buf := codec.NewBuffer(b)
119         m.IsAdd = buf.DecodeBool()
120         m.UDPDecap.IsIP4 = buf.DecodeUint8()
121         m.UDPDecap.Port = buf.DecodeUint16()
122         m.UDPDecap.NextProto = UDPDecapNextProto(buf.DecodeUint32())
123         return nil
124 }
125
126 // UDPDecapAddDelReply defines message 'udp_decap_add_del_reply'.
127 type UDPDecapAddDelReply struct {
128         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
129 }
130
131 func (m *UDPDecapAddDelReply) Reset()               { *m = UDPDecapAddDelReply{} }
132 func (*UDPDecapAddDelReply) GetMessageName() string { return "udp_decap_add_del_reply" }
133 func (*UDPDecapAddDelReply) GetCrcString() string   { return "e8d4e804" }
134 func (*UDPDecapAddDelReply) GetMessageType() api.MessageType {
135         return api.ReplyMessage
136 }
137
138 func (m *UDPDecapAddDelReply) Size() (size int) {
139         if m == nil {
140                 return 0
141         }
142         size += 4 // m.Retval
143         return size
144 }
145 func (m *UDPDecapAddDelReply) Marshal(b []byte) ([]byte, error) {
146         if b == nil {
147                 b = make([]byte, m.Size())
148         }
149         buf := codec.NewBuffer(b)
150         buf.EncodeInt32(m.Retval)
151         return buf.Bytes(), nil
152 }
153 func (m *UDPDecapAddDelReply) Unmarshal(b []byte) error {
154         buf := codec.NewBuffer(b)
155         m.Retval = buf.DecodeInt32()
156         return nil
157 }
158
159 // UDPEncapAdd defines message 'udp_encap_add'.
160 type UDPEncapAdd struct {
161         UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"`
162 }
163
164 func (m *UDPEncapAdd) Reset()               { *m = UDPEncapAdd{} }
165 func (*UDPEncapAdd) GetMessageName() string { return "udp_encap_add" }
166 func (*UDPEncapAdd) GetCrcString() string   { return "f74a60b1" }
167 func (*UDPEncapAdd) GetMessageType() api.MessageType {
168         return api.RequestMessage
169 }
170
171 func (m *UDPEncapAdd) Size() (size int) {
172         if m == nil {
173                 return 0
174         }
175         size += 4      // m.UDPEncap.TableID
176         size += 2      // m.UDPEncap.SrcPort
177         size += 2      // m.UDPEncap.DstPort
178         size += 1      // m.UDPEncap.SrcIP.Af
179         size += 1 * 16 // m.UDPEncap.SrcIP.Un
180         size += 1      // m.UDPEncap.DstIP.Af
181         size += 1 * 16 // m.UDPEncap.DstIP.Un
182         size += 4      // m.UDPEncap.ID
183         return size
184 }
185 func (m *UDPEncapAdd) Marshal(b []byte) ([]byte, error) {
186         if b == nil {
187                 b = make([]byte, m.Size())
188         }
189         buf := codec.NewBuffer(b)
190         buf.EncodeUint32(m.UDPEncap.TableID)
191         buf.EncodeUint16(m.UDPEncap.SrcPort)
192         buf.EncodeUint16(m.UDPEncap.DstPort)
193         buf.EncodeUint8(uint8(m.UDPEncap.SrcIP.Af))
194         buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 16)
195         buf.EncodeUint8(uint8(m.UDPEncap.DstIP.Af))
196         buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 16)
197         buf.EncodeUint32(m.UDPEncap.ID)
198         return buf.Bytes(), nil
199 }
200 func (m *UDPEncapAdd) Unmarshal(b []byte) error {
201         buf := codec.NewBuffer(b)
202         m.UDPEncap.TableID = buf.DecodeUint32()
203         m.UDPEncap.SrcPort = buf.DecodeUint16()
204         m.UDPEncap.DstPort = buf.DecodeUint16()
205         m.UDPEncap.SrcIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
206         copy(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
207         m.UDPEncap.DstIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
208         copy(m.UDPEncap.DstIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
209         m.UDPEncap.ID = buf.DecodeUint32()
210         return nil
211 }
212
213 // UDPEncapAddReply defines message 'udp_encap_add_reply'.
214 type UDPEncapAddReply struct {
215         Retval int32  `binapi:"i32,name=retval" json:"retval,omitempty"`
216         ID     uint32 `binapi:"u32,name=id" json:"id,omitempty"`
217 }
218
219 func (m *UDPEncapAddReply) Reset()               { *m = UDPEncapAddReply{} }
220 func (*UDPEncapAddReply) GetMessageName() string { return "udp_encap_add_reply" }
221 func (*UDPEncapAddReply) GetCrcString() string   { return "e2fc8294" }
222 func (*UDPEncapAddReply) GetMessageType() api.MessageType {
223         return api.ReplyMessage
224 }
225
226 func (m *UDPEncapAddReply) Size() (size int) {
227         if m == nil {
228                 return 0
229         }
230         size += 4 // m.Retval
231         size += 4 // m.ID
232         return size
233 }
234 func (m *UDPEncapAddReply) Marshal(b []byte) ([]byte, error) {
235         if b == nil {
236                 b = make([]byte, m.Size())
237         }
238         buf := codec.NewBuffer(b)
239         buf.EncodeInt32(m.Retval)
240         buf.EncodeUint32(m.ID)
241         return buf.Bytes(), nil
242 }
243 func (m *UDPEncapAddReply) Unmarshal(b []byte) error {
244         buf := codec.NewBuffer(b)
245         m.Retval = buf.DecodeInt32()
246         m.ID = buf.DecodeUint32()
247         return nil
248 }
249
250 // UDPEncapDel defines message 'udp_encap_del'.
251 type UDPEncapDel struct {
252         ID uint32 `binapi:"u32,name=id" json:"id,omitempty"`
253 }
254
255 func (m *UDPEncapDel) Reset()               { *m = UDPEncapDel{} }
256 func (*UDPEncapDel) GetMessageName() string { return "udp_encap_del" }
257 func (*UDPEncapDel) GetCrcString() string   { return "3a91bde5" }
258 func (*UDPEncapDel) GetMessageType() api.MessageType {
259         return api.RequestMessage
260 }
261
262 func (m *UDPEncapDel) Size() (size int) {
263         if m == nil {
264                 return 0
265         }
266         size += 4 // m.ID
267         return size
268 }
269 func (m *UDPEncapDel) Marshal(b []byte) ([]byte, error) {
270         if b == nil {
271                 b = make([]byte, m.Size())
272         }
273         buf := codec.NewBuffer(b)
274         buf.EncodeUint32(m.ID)
275         return buf.Bytes(), nil
276 }
277 func (m *UDPEncapDel) Unmarshal(b []byte) error {
278         buf := codec.NewBuffer(b)
279         m.ID = buf.DecodeUint32()
280         return nil
281 }
282
283 // UDPEncapDelReply defines message 'udp_encap_del_reply'.
284 type UDPEncapDelReply struct {
285         Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
286 }
287
288 func (m *UDPEncapDelReply) Reset()               { *m = UDPEncapDelReply{} }
289 func (*UDPEncapDelReply) GetMessageName() string { return "udp_encap_del_reply" }
290 func (*UDPEncapDelReply) GetCrcString() string   { return "e8d4e804" }
291 func (*UDPEncapDelReply) GetMessageType() api.MessageType {
292         return api.ReplyMessage
293 }
294
295 func (m *UDPEncapDelReply) Size() (size int) {
296         if m == nil {
297                 return 0
298         }
299         size += 4 // m.Retval
300         return size
301 }
302 func (m *UDPEncapDelReply) 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 *UDPEncapDelReply) Unmarshal(b []byte) error {
311         buf := codec.NewBuffer(b)
312         m.Retval = buf.DecodeInt32()
313         return nil
314 }
315
316 // UDPEncapDetails defines message 'udp_encap_details'.
317 type UDPEncapDetails struct {
318         UDPEncap UDPEncap `binapi:"udp_encap,name=udp_encap" json:"udp_encap,omitempty"`
319 }
320
321 func (m *UDPEncapDetails) Reset()               { *m = UDPEncapDetails{} }
322 func (*UDPEncapDetails) GetMessageName() string { return "udp_encap_details" }
323 func (*UDPEncapDetails) GetCrcString() string   { return "8cfb9c76" }
324 func (*UDPEncapDetails) GetMessageType() api.MessageType {
325         return api.ReplyMessage
326 }
327
328 func (m *UDPEncapDetails) Size() (size int) {
329         if m == nil {
330                 return 0
331         }
332         size += 4      // m.UDPEncap.TableID
333         size += 2      // m.UDPEncap.SrcPort
334         size += 2      // m.UDPEncap.DstPort
335         size += 1      // m.UDPEncap.SrcIP.Af
336         size += 1 * 16 // m.UDPEncap.SrcIP.Un
337         size += 1      // m.UDPEncap.DstIP.Af
338         size += 1 * 16 // m.UDPEncap.DstIP.Un
339         size += 4      // m.UDPEncap.ID
340         return size
341 }
342 func (m *UDPEncapDetails) Marshal(b []byte) ([]byte, error) {
343         if b == nil {
344                 b = make([]byte, m.Size())
345         }
346         buf := codec.NewBuffer(b)
347         buf.EncodeUint32(m.UDPEncap.TableID)
348         buf.EncodeUint16(m.UDPEncap.SrcPort)
349         buf.EncodeUint16(m.UDPEncap.DstPort)
350         buf.EncodeUint8(uint8(m.UDPEncap.SrcIP.Af))
351         buf.EncodeBytes(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], 16)
352         buf.EncodeUint8(uint8(m.UDPEncap.DstIP.Af))
353         buf.EncodeBytes(m.UDPEncap.DstIP.Un.XXX_UnionData[:], 16)
354         buf.EncodeUint32(m.UDPEncap.ID)
355         return buf.Bytes(), nil
356 }
357 func (m *UDPEncapDetails) Unmarshal(b []byte) error {
358         buf := codec.NewBuffer(b)
359         m.UDPEncap.TableID = buf.DecodeUint32()
360         m.UDPEncap.SrcPort = buf.DecodeUint16()
361         m.UDPEncap.DstPort = buf.DecodeUint16()
362         m.UDPEncap.SrcIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
363         copy(m.UDPEncap.SrcIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
364         m.UDPEncap.DstIP.Af = ip_types.AddressFamily(buf.DecodeUint8())
365         copy(m.UDPEncap.DstIP.Un.XXX_UnionData[:], buf.DecodeBytes(16))
366         m.UDPEncap.ID = buf.DecodeUint32()
367         return nil
368 }
369
370 // UDPEncapDump defines message 'udp_encap_dump'.
371 type UDPEncapDump struct{}
372
373 func (m *UDPEncapDump) Reset()               { *m = UDPEncapDump{} }
374 func (*UDPEncapDump) GetMessageName() string { return "udp_encap_dump" }
375 func (*UDPEncapDump) GetCrcString() string   { return "51077d14" }
376 func (*UDPEncapDump) GetMessageType() api.MessageType {
377         return api.RequestMessage
378 }
379
380 func (m *UDPEncapDump) Size() (size int) {
381         if m == nil {
382                 return 0
383         }
384         return size
385 }
386 func (m *UDPEncapDump) Marshal(b []byte) ([]byte, error) {
387         if b == nil {
388                 b = make([]byte, m.Size())
389         }
390         buf := codec.NewBuffer(b)
391         return buf.Bytes(), nil
392 }
393 func (m *UDPEncapDump) Unmarshal(b []byte) error {
394         return nil
395 }
396
397 func init() { file_udp_binapi_init() }
398 func file_udp_binapi_init() {
399         api.RegisterMessage((*UDPDecapAddDel)(nil), "udp_decap_add_del_d155c6ac")
400         api.RegisterMessage((*UDPDecapAddDelReply)(nil), "udp_decap_add_del_reply_e8d4e804")
401         api.RegisterMessage((*UDPEncapAdd)(nil), "udp_encap_add_f74a60b1")
402         api.RegisterMessage((*UDPEncapAddReply)(nil), "udp_encap_add_reply_e2fc8294")
403         api.RegisterMessage((*UDPEncapDel)(nil), "udp_encap_del_3a91bde5")
404         api.RegisterMessage((*UDPEncapDelReply)(nil), "udp_encap_del_reply_e8d4e804")
405         api.RegisterMessage((*UDPEncapDetails)(nil), "udp_encap_details_8cfb9c76")
406         api.RegisterMessage((*UDPEncapDump)(nil), "udp_encap_dump_51077d14")
407 }
408
409 // Messages returns list of all messages in this module.
410 func AllMessages() []api.Message {
411         return []api.Message{
412                 (*UDPDecapAddDel)(nil),
413                 (*UDPDecapAddDelReply)(nil),
414                 (*UDPEncapAdd)(nil),
415                 (*UDPEncapAddReply)(nil),
416                 (*UDPEncapDel)(nil),
417                 (*UDPEncapDelReply)(nil),
418                 (*UDPEncapDetails)(nil),
419                 (*UDPEncapDump)(nil),
420         }
421 }