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