Binary API generator improvements
[govpp.git] / examples / binapi / fib_types / fib_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/fib_types.api.json
6
7 /*
8 Package fib_types contains generated code for VPP API file fib_types.api (2.0.0).
9
10 It consists of:
11           5 aliases
12           7 enums
13           9 types
14           1 union
15 */
16 package fib_types
17
18 import (
19         "bytes"
20         "context"
21         "encoding/binary"
22         "fmt"
23         "io"
24         "math"
25         "net"
26         "strconv"
27         "strings"
28
29         api "git.fd.io/govpp.git/api"
30         codec "git.fd.io/govpp.git/codec"
31         struc "github.com/lunixbochs/struc"
32
33         ip_types "git.fd.io/govpp.git/examples/binapi/ip_types"
34 )
35
36 // This is a compile-time assertion to ensure that this generated file
37 // is compatible with the GoVPP api package it is being compiled against.
38 // A compilation error at this line likely means your copy of the
39 // GoVPP api package needs to be updated.
40 const _ = api.GoVppAPIPackageIsVersion2 // please upgrade the GoVPP api package
41
42 const (
43         // ModuleName is the name of this module.
44         ModuleName = "fib_types"
45         // APIVersion is the API version of this module.
46         APIVersion = "2.0.0"
47         // VersionCrc is the CRC of this module.
48         VersionCrc = 0xd6a5938
49 )
50
51 type AddressFamily = ip_types.AddressFamily
52
53 // FibPathFlags represents VPP binary API enum 'fib_path_flags'.
54 type FibPathFlags uint32
55
56 const (
57         FIB_API_PATH_FLAG_NONE                 FibPathFlags = 0
58         FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED FibPathFlags = 1
59         FIB_API_PATH_FLAG_RESOLVE_VIA_HOST     FibPathFlags = 2
60         FIB_API_PATH_FLAG_POP_PW_CW            FibPathFlags = 4
61 )
62
63 var (
64         FibPathFlags_name = map[uint32]string{
65                 0: "FIB_API_PATH_FLAG_NONE",
66                 1: "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED",
67                 2: "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST",
68                 4: "FIB_API_PATH_FLAG_POP_PW_CW",
69         }
70         FibPathFlags_value = map[string]uint32{
71                 "FIB_API_PATH_FLAG_NONE":                 0,
72                 "FIB_API_PATH_FLAG_RESOLVE_VIA_ATTACHED": 1,
73                 "FIB_API_PATH_FLAG_RESOLVE_VIA_HOST":     2,
74                 "FIB_API_PATH_FLAG_POP_PW_CW":            4,
75         }
76 )
77
78 func (x FibPathFlags) String() string {
79         s, ok := FibPathFlags_name[uint32(x)]
80         if ok {
81                 return s
82         }
83         return "FibPathFlags(" + strconv.Itoa(int(x)) + ")"
84 }
85
86 // FibPathNhProto represents VPP binary API enum 'fib_path_nh_proto'.
87 type FibPathNhProto uint32
88
89 const (
90         FIB_API_PATH_NH_PROTO_IP4      FibPathNhProto = 0
91         FIB_API_PATH_NH_PROTO_IP6      FibPathNhProto = 1
92         FIB_API_PATH_NH_PROTO_MPLS     FibPathNhProto = 2
93         FIB_API_PATH_NH_PROTO_ETHERNET FibPathNhProto = 3
94         FIB_API_PATH_NH_PROTO_BIER     FibPathNhProto = 4
95 )
96
97 var (
98         FibPathNhProto_name = map[uint32]string{
99                 0: "FIB_API_PATH_NH_PROTO_IP4",
100                 1: "FIB_API_PATH_NH_PROTO_IP6",
101                 2: "FIB_API_PATH_NH_PROTO_MPLS",
102                 3: "FIB_API_PATH_NH_PROTO_ETHERNET",
103                 4: "FIB_API_PATH_NH_PROTO_BIER",
104         }
105         FibPathNhProto_value = map[string]uint32{
106                 "FIB_API_PATH_NH_PROTO_IP4":      0,
107                 "FIB_API_PATH_NH_PROTO_IP6":      1,
108                 "FIB_API_PATH_NH_PROTO_MPLS":     2,
109                 "FIB_API_PATH_NH_PROTO_ETHERNET": 3,
110                 "FIB_API_PATH_NH_PROTO_BIER":     4,
111         }
112 )
113
114 func (x FibPathNhProto) String() string {
115         s, ok := FibPathNhProto_name[uint32(x)]
116         if ok {
117                 return s
118         }
119         return "FibPathNhProto(" + strconv.Itoa(int(x)) + ")"
120 }
121
122 // FibPathType represents VPP binary API enum 'fib_path_type'.
123 type FibPathType uint32
124
125 const (
126         FIB_API_PATH_TYPE_NORMAL        FibPathType = 0
127         FIB_API_PATH_TYPE_LOCAL         FibPathType = 1
128         FIB_API_PATH_TYPE_DROP          FibPathType = 2
129         FIB_API_PATH_TYPE_UDP_ENCAP     FibPathType = 3
130         FIB_API_PATH_TYPE_BIER_IMP      FibPathType = 4
131         FIB_API_PATH_TYPE_ICMP_UNREACH  FibPathType = 5
132         FIB_API_PATH_TYPE_ICMP_PROHIBIT FibPathType = 6
133         FIB_API_PATH_TYPE_SOURCE_LOOKUP FibPathType = 7
134         FIB_API_PATH_TYPE_DVR           FibPathType = 8
135         FIB_API_PATH_TYPE_INTERFACE_RX  FibPathType = 9
136         FIB_API_PATH_TYPE_CLASSIFY      FibPathType = 10
137 )
138
139 var (
140         FibPathType_name = map[uint32]string{
141                 0:  "FIB_API_PATH_TYPE_NORMAL",
142                 1:  "FIB_API_PATH_TYPE_LOCAL",
143                 2:  "FIB_API_PATH_TYPE_DROP",
144                 3:  "FIB_API_PATH_TYPE_UDP_ENCAP",
145                 4:  "FIB_API_PATH_TYPE_BIER_IMP",
146                 5:  "FIB_API_PATH_TYPE_ICMP_UNREACH",
147                 6:  "FIB_API_PATH_TYPE_ICMP_PROHIBIT",
148                 7:  "FIB_API_PATH_TYPE_SOURCE_LOOKUP",
149                 8:  "FIB_API_PATH_TYPE_DVR",
150                 9:  "FIB_API_PATH_TYPE_INTERFACE_RX",
151                 10: "FIB_API_PATH_TYPE_CLASSIFY",
152         }
153         FibPathType_value = map[string]uint32{
154                 "FIB_API_PATH_TYPE_NORMAL":        0,
155                 "FIB_API_PATH_TYPE_LOCAL":         1,
156                 "FIB_API_PATH_TYPE_DROP":          2,
157                 "FIB_API_PATH_TYPE_UDP_ENCAP":     3,
158                 "FIB_API_PATH_TYPE_BIER_IMP":      4,
159                 "FIB_API_PATH_TYPE_ICMP_UNREACH":  5,
160                 "FIB_API_PATH_TYPE_ICMP_PROHIBIT": 6,
161                 "FIB_API_PATH_TYPE_SOURCE_LOOKUP": 7,
162                 "FIB_API_PATH_TYPE_DVR":           8,
163                 "FIB_API_PATH_TYPE_INTERFACE_RX":  9,
164                 "FIB_API_PATH_TYPE_CLASSIFY":      10,
165         }
166 )
167
168 func (x FibPathType) String() string {
169         s, ok := FibPathType_name[uint32(x)]
170         if ok {
171                 return s
172         }
173         return "FibPathType(" + strconv.Itoa(int(x)) + ")"
174 }
175
176 type IPDscp = ip_types.IPDscp
177
178 type IPEcn = ip_types.IPEcn
179
180 type IPProto = ip_types.IPProto
181
182 type AddressWithPrefix = ip_types.AddressWithPrefix
183
184 type IP4Address = ip_types.IP4Address
185
186 type IP4AddressWithPrefix = ip_types.IP4AddressWithPrefix
187
188 type IP6Address = ip_types.IP6Address
189
190 type IP6AddressWithPrefix = ip_types.IP6AddressWithPrefix
191
192 type Address = ip_types.Address
193
194 // FibMplsLabel represents VPP binary API type 'fib_mpls_label'.
195 type FibMplsLabel struct {
196         IsUniform uint8  `binapi:"u8,name=is_uniform" json:"is_uniform,omitempty"`
197         Label     uint32 `binapi:"u32,name=label" json:"label,omitempty"`
198         TTL       uint8  `binapi:"u8,name=ttl" json:"ttl,omitempty"`
199         Exp       uint8  `binapi:"u8,name=exp" json:"exp,omitempty"`
200 }
201
202 func (*FibMplsLabel) GetTypeName() string { return "fib_mpls_label" }
203
204 // FibPath represents VPP binary API type 'fib_path'.
205 type FibPath struct {
206         SwIfIndex  uint32           `binapi:"u32,name=sw_if_index" json:"sw_if_index,omitempty"`
207         TableID    uint32           `binapi:"u32,name=table_id" json:"table_id,omitempty"`
208         RpfID      uint32           `binapi:"u32,name=rpf_id" json:"rpf_id,omitempty"`
209         Weight     uint8            `binapi:"u8,name=weight" json:"weight,omitempty"`
210         Preference uint8            `binapi:"u8,name=preference" json:"preference,omitempty"`
211         Type       FibPathType      `binapi:"fib_path_type,name=type" json:"type,omitempty"`
212         Flags      FibPathFlags     `binapi:"fib_path_flags,name=flags" json:"flags,omitempty"`
213         Proto      FibPathNhProto   `binapi:"fib_path_nh_proto,name=proto" json:"proto,omitempty"`
214         Nh         FibPathNh        `binapi:"fib_path_nh,name=nh" json:"nh,omitempty"`
215         NLabels    uint8            `binapi:"u8,name=n_labels" json:"n_labels,omitempty"`
216         LabelStack [16]FibMplsLabel `binapi:"fib_mpls_label[16],name=label_stack" json:"label_stack,omitempty" struc:"[16]FibMplsLabel"`
217 }
218
219 func (*FibPath) GetTypeName() string { return "fib_path" }
220
221 // FibPathNh represents VPP binary API type 'fib_path_nh'.
222 type FibPathNh struct {
223         Address            ip_types.AddressUnion `binapi:"address_union,name=address" json:"address,omitempty"`
224         ViaLabel           uint32                `binapi:"u32,name=via_label" json:"via_label,omitempty"`
225         ObjID              uint32                `binapi:"u32,name=obj_id" json:"obj_id,omitempty"`
226         ClassifyTableIndex uint32                `binapi:"u32,name=classify_table_index" json:"classify_table_index,omitempty"`
227 }
228
229 func (*FibPathNh) GetTypeName() string { return "fib_path_nh" }
230
231 type IP4Prefix = ip_types.IP4Prefix
232
233 type IP6Prefix = ip_types.IP6Prefix
234
235 type Mprefix = ip_types.Mprefix
236
237 type Prefix = ip_types.Prefix
238
239 type PrefixMatcher = ip_types.PrefixMatcher
240
241 type AddressUnion = ip_types.AddressUnion
242
243 // Reference imports to suppress errors if they are not otherwise used.
244 var _ = api.RegisterMessage
245 var _ = codec.DecodeString
246 var _ = bytes.NewBuffer
247 var _ = context.Background
248 var _ = io.Copy
249 var _ = strconv.Itoa
250 var _ = strings.Contains
251 var _ = struc.Pack
252 var _ = binary.BigEndian
253 var _ = math.Float32bits
254 var _ = net.ParseIP
255 var _ = fmt.Errorf