Release 0.3.0
[govpp.git] / examples / binapi / ip_types / ip_types.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // source: /usr/share/vpp/api/core/ip_types.api.json
3
4 /*
5 Package ip_types is a generated VPP binary API for 'ip_types' module.
6
7 It consists of:
8           4 enums
9           5 aliases
10           6 types
11           1 union
12 */
13 package ip_types
14
15 import (
16         bytes "bytes"
17         context "context"
18         api "git.fd.io/govpp.git/api"
19         struc "github.com/lunixbochs/struc"
20         io "io"
21         strconv "strconv"
22 )
23
24 const (
25         // ModuleName is the name of this module.
26         ModuleName = "ip_types"
27         // APIVersion is the API version of this module.
28         APIVersion = "3.0.0"
29         // VersionCrc is the CRC of this module.
30         VersionCrc = 0x80424562
31 )
32
33 // AddressFamily represents VPP binary API enum 'address_family'.
34 type AddressFamily uint32
35
36 const (
37         ADDRESS_IP4 AddressFamily = 0
38         ADDRESS_IP6 AddressFamily = 1
39 )
40
41 var AddressFamily_name = map[uint32]string{
42         0: "ADDRESS_IP4",
43         1: "ADDRESS_IP6",
44 }
45
46 var AddressFamily_value = map[string]uint32{
47         "ADDRESS_IP4": 0,
48         "ADDRESS_IP6": 1,
49 }
50
51 func (x AddressFamily) String() string {
52         s, ok := AddressFamily_name[uint32(x)]
53         if ok {
54                 return s
55         }
56         return strconv.Itoa(int(x))
57 }
58
59 // IPDscp represents VPP binary API enum 'ip_dscp'.
60 type IPDscp uint8
61
62 const (
63         IP_API_DSCP_CS0  IPDscp = 0
64         IP_API_DSCP_CS1  IPDscp = 8
65         IP_API_DSCP_AF11 IPDscp = 10
66         IP_API_DSCP_AF12 IPDscp = 12
67         IP_API_DSCP_AF13 IPDscp = 14
68         IP_API_DSCP_CS2  IPDscp = 16
69         IP_API_DSCP_AF21 IPDscp = 18
70         IP_API_DSCP_AF22 IPDscp = 20
71         IP_API_DSCP_AF23 IPDscp = 22
72         IP_API_DSCP_CS3  IPDscp = 24
73         IP_API_DSCP_AF31 IPDscp = 26
74         IP_API_DSCP_AF32 IPDscp = 28
75         IP_API_DSCP_AF33 IPDscp = 30
76         IP_API_DSCP_CS4  IPDscp = 32
77         IP_API_DSCP_AF41 IPDscp = 34
78         IP_API_DSCP_AF42 IPDscp = 36
79         IP_API_DSCP_AF43 IPDscp = 38
80         IP_API_DSCP_CS5  IPDscp = 40
81         IP_API_DSCP_EF   IPDscp = 46
82         IP_API_DSCP_CS6  IPDscp = 48
83         IP_API_DSCP_CS7  IPDscp = 50
84 )
85
86 var IPDscp_name = map[uint8]string{
87         0:  "IP_API_DSCP_CS0",
88         8:  "IP_API_DSCP_CS1",
89         10: "IP_API_DSCP_AF11",
90         12: "IP_API_DSCP_AF12",
91         14: "IP_API_DSCP_AF13",
92         16: "IP_API_DSCP_CS2",
93         18: "IP_API_DSCP_AF21",
94         20: "IP_API_DSCP_AF22",
95         22: "IP_API_DSCP_AF23",
96         24: "IP_API_DSCP_CS3",
97         26: "IP_API_DSCP_AF31",
98         28: "IP_API_DSCP_AF32",
99         30: "IP_API_DSCP_AF33",
100         32: "IP_API_DSCP_CS4",
101         34: "IP_API_DSCP_AF41",
102         36: "IP_API_DSCP_AF42",
103         38: "IP_API_DSCP_AF43",
104         40: "IP_API_DSCP_CS5",
105         46: "IP_API_DSCP_EF",
106         48: "IP_API_DSCP_CS6",
107         50: "IP_API_DSCP_CS7",
108 }
109
110 var IPDscp_value = map[string]uint8{
111         "IP_API_DSCP_CS0":  0,
112         "IP_API_DSCP_CS1":  8,
113         "IP_API_DSCP_AF11": 10,
114         "IP_API_DSCP_AF12": 12,
115         "IP_API_DSCP_AF13": 14,
116         "IP_API_DSCP_CS2":  16,
117         "IP_API_DSCP_AF21": 18,
118         "IP_API_DSCP_AF22": 20,
119         "IP_API_DSCP_AF23": 22,
120         "IP_API_DSCP_CS3":  24,
121         "IP_API_DSCP_AF31": 26,
122         "IP_API_DSCP_AF32": 28,
123         "IP_API_DSCP_AF33": 30,
124         "IP_API_DSCP_CS4":  32,
125         "IP_API_DSCP_AF41": 34,
126         "IP_API_DSCP_AF42": 36,
127         "IP_API_DSCP_AF43": 38,
128         "IP_API_DSCP_CS5":  40,
129         "IP_API_DSCP_EF":   46,
130         "IP_API_DSCP_CS6":  48,
131         "IP_API_DSCP_CS7":  50,
132 }
133
134 func (x IPDscp) String() string {
135         s, ok := IPDscp_name[uint8(x)]
136         if ok {
137                 return s
138         }
139         return strconv.Itoa(int(x))
140 }
141
142 // IPEcn represents VPP binary API enum 'ip_ecn'.
143 type IPEcn uint8
144
145 const (
146         IP_API_ECN_NONE IPEcn = 0
147         IP_API_ECN_ECT0 IPEcn = 1
148         IP_API_ECN_ECT1 IPEcn = 2
149         IP_API_ECN_CE   IPEcn = 3
150 )
151
152 var IPEcn_name = map[uint8]string{
153         0: "IP_API_ECN_NONE",
154         1: "IP_API_ECN_ECT0",
155         2: "IP_API_ECN_ECT1",
156         3: "IP_API_ECN_CE",
157 }
158
159 var IPEcn_value = map[string]uint8{
160         "IP_API_ECN_NONE": 0,
161         "IP_API_ECN_ECT0": 1,
162         "IP_API_ECN_ECT1": 2,
163         "IP_API_ECN_CE":   3,
164 }
165
166 func (x IPEcn) String() string {
167         s, ok := IPEcn_name[uint8(x)]
168         if ok {
169                 return s
170         }
171         return strconv.Itoa(int(x))
172 }
173
174 // IPProto represents VPP binary API enum 'ip_proto'.
175 type IPProto uint32
176
177 const (
178         IP_API_PROTO_HOPOPT   IPProto = 0
179         IP_API_PROTO_ICMP     IPProto = 1
180         IP_API_PROTO_IGMP     IPProto = 2
181         IP_API_PROTO_TCP      IPProto = 6
182         IP_API_PROTO_UDP      IPProto = 17
183         IP_API_PROTO_GRE      IPProto = 47
184         IP_API_PROTO_AH       IPProto = 50
185         IP_API_PROTO_ESP      IPProto = 51
186         IP_API_PROTO_EIGRP    IPProto = 88
187         IP_API_PROTO_OSPF     IPProto = 89
188         IP_API_PROTO_SCTP     IPProto = 132
189         IP_API_PROTO_RESERVED IPProto = 255
190 )
191
192 var IPProto_name = map[uint32]string{
193         0:   "IP_API_PROTO_HOPOPT",
194         1:   "IP_API_PROTO_ICMP",
195         2:   "IP_API_PROTO_IGMP",
196         6:   "IP_API_PROTO_TCP",
197         17:  "IP_API_PROTO_UDP",
198         47:  "IP_API_PROTO_GRE",
199         50:  "IP_API_PROTO_AH",
200         51:  "IP_API_PROTO_ESP",
201         88:  "IP_API_PROTO_EIGRP",
202         89:  "IP_API_PROTO_OSPF",
203         132: "IP_API_PROTO_SCTP",
204         255: "IP_API_PROTO_RESERVED",
205 }
206
207 var IPProto_value = map[string]uint32{
208         "IP_API_PROTO_HOPOPT":   0,
209         "IP_API_PROTO_ICMP":     1,
210         "IP_API_PROTO_IGMP":     2,
211         "IP_API_PROTO_TCP":      6,
212         "IP_API_PROTO_UDP":      17,
213         "IP_API_PROTO_GRE":      47,
214         "IP_API_PROTO_AH":       50,
215         "IP_API_PROTO_ESP":      51,
216         "IP_API_PROTO_EIGRP":    88,
217         "IP_API_PROTO_OSPF":     89,
218         "IP_API_PROTO_SCTP":     132,
219         "IP_API_PROTO_RESERVED": 255,
220 }
221
222 func (x IPProto) String() string {
223         s, ok := IPProto_name[uint32(x)]
224         if ok {
225                 return s
226         }
227         return strconv.Itoa(int(x))
228 }
229
230 // AddressWithPrefix represents VPP binary API alias 'address_with_prefix'.
231 type AddressWithPrefix Prefix
232
233 // IP4Address represents VPP binary API alias 'ip4_address'.
234 type IP4Address [4]uint8
235
236 // IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'.
237 type IP4AddressWithPrefix IP4Prefix
238
239 // IP6Address represents VPP binary API alias 'ip6_address'.
240 type IP6Address [16]uint8
241
242 // IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'.
243 type IP6AddressWithPrefix IP6Prefix
244
245 // Address represents VPP binary API type 'address'.
246 type Address struct {
247         Af AddressFamily
248         Un AddressUnion
249 }
250
251 func (*Address) GetTypeName() string { return "address" }
252
253 // IP4Prefix represents VPP binary API type 'ip4_prefix'.
254 type IP4Prefix struct {
255         Address IP4Address
256         Len     uint8
257 }
258
259 func (*IP4Prefix) GetTypeName() string { return "ip4_prefix" }
260
261 // IP6Prefix represents VPP binary API type 'ip6_prefix'.
262 type IP6Prefix struct {
263         Address IP6Address
264         Len     uint8
265 }
266
267 func (*IP6Prefix) GetTypeName() string { return "ip6_prefix" }
268
269 // Mprefix represents VPP binary API type 'mprefix'.
270 type Mprefix struct {
271         Af               AddressFamily
272         GrpAddressLength uint16
273         GrpAddress       AddressUnion
274         SrcAddress       AddressUnion
275 }
276
277 func (*Mprefix) GetTypeName() string { return "mprefix" }
278
279 // Prefix represents VPP binary API type 'prefix'.
280 type Prefix struct {
281         Address Address
282         Len     uint8
283 }
284
285 func (*Prefix) GetTypeName() string { return "prefix" }
286
287 // PrefixMatcher represents VPP binary API type 'prefix_matcher'.
288 type PrefixMatcher struct {
289         Le uint8
290         Ge uint8
291 }
292
293 func (*PrefixMatcher) GetTypeName() string { return "prefix_matcher" }
294
295 // AddressUnion represents VPP binary API union 'address_union'.
296 type AddressUnion struct {
297         XXX_UnionData [16]byte
298 }
299
300 func (*AddressUnion) GetTypeName() string { return "address_union" }
301
302 func AddressUnionIP4(a IP4Address) (u AddressUnion) {
303         u.SetIP4(a)
304         return
305 }
306 func (u *AddressUnion) SetIP4(a IP4Address) {
307         var b = new(bytes.Buffer)
308         if err := struc.Pack(b, &a); err != nil {
309                 return
310         }
311         copy(u.XXX_UnionData[:], b.Bytes())
312 }
313 func (u *AddressUnion) GetIP4() (a IP4Address) {
314         var b = bytes.NewReader(u.XXX_UnionData[:])
315         struc.Unpack(b, &a)
316         return
317 }
318
319 func AddressUnionIP6(a IP6Address) (u AddressUnion) {
320         u.SetIP6(a)
321         return
322 }
323 func (u *AddressUnion) SetIP6(a IP6Address) {
324         var b = new(bytes.Buffer)
325         if err := struc.Pack(b, &a); err != nil {
326                 return
327         }
328         copy(u.XXX_UnionData[:], b.Bytes())
329 }
330 func (u *AddressUnion) GetIP6() (a IP6Address) {
331         var b = bytes.NewReader(u.XXX_UnionData[:])
332         struc.Unpack(b, &a)
333         return
334 }
335
336 // This is a compile-time assertion to ensure that this generated file
337 // is compatible with the GoVPP api package it is being compiled against.
338 // A compilation error at this line likely means your copy of the
339 // GoVPP api package needs to be updated.
340 const _ = api.GoVppAPIPackageIsVersion1 // please upgrade the GoVPP api package
341
342 // Reference imports to suppress errors if they are not otherwise used.
343 var _ = api.RegisterMessage
344 var _ = bytes.NewBuffer
345 var _ = context.Background
346 var _ = io.Copy
347 var _ = strconv.Itoa
348 var _ = struc.Pack