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