14b89c7227542a5f0969109817ce3e8b95329cc6
[govpp.git] / binapi / lisp_types / lisp_types.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2 // versions:
3 //  binapi-generator: v0.5.0-dev
4 //  VPP:              22.02-release
5 // source: /usr/share/vpp/api/plugins/lisp_types.api.json
6
7 // Package lisp_types contains generated bindings for API file lisp_types.api.
8 //
9 // Contents:
10 //   2 enums
11 //   5 structs
12 //   1 union
13 //
14 package lisp_types
15
16 import (
17         "strconv"
18
19         api "git.fd.io/govpp.git/api"
20         ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
21         interface_types "git.fd.io/govpp.git/binapi/interface_types"
22         ip_types "git.fd.io/govpp.git/binapi/ip_types"
23         codec "git.fd.io/govpp.git/codec"
24 )
25
26 // This is a compile-time assertion to ensure that this generated file
27 // is compatible with the GoVPP api package it is being compiled against.
28 // A compilation error at this line likely means your copy of the
29 // GoVPP api package needs to be updated.
30 const _ = api.GoVppAPIPackageIsVersion2
31
32 const (
33         APIFile    = "lisp_types"
34         APIVersion = "1.0.0"
35         VersionCrc = 0xf05d92a6
36 )
37
38 // EidType defines enum 'eid_type'.
39 type EidType uint8
40
41 const (
42         EID_TYPE_API_PREFIX EidType = 0
43         EID_TYPE_API_MAC    EidType = 1
44         EID_TYPE_API_NSH    EidType = 2
45 )
46
47 var (
48         EidType_name = map[uint8]string{
49                 0: "EID_TYPE_API_PREFIX",
50                 1: "EID_TYPE_API_MAC",
51                 2: "EID_TYPE_API_NSH",
52         }
53         EidType_value = map[string]uint8{
54                 "EID_TYPE_API_PREFIX": 0,
55                 "EID_TYPE_API_MAC":    1,
56                 "EID_TYPE_API_NSH":    2,
57         }
58 )
59
60 func (x EidType) String() string {
61         s, ok := EidType_name[uint8(x)]
62         if ok {
63                 return s
64         }
65         return "EidType(" + strconv.Itoa(int(x)) + ")"
66 }
67
68 // HmacKeyID defines enum 'hmac_key_id'.
69 type HmacKeyID uint8
70
71 const (
72         KEY_ID_API_HMAC_NO_KEY      HmacKeyID = 0
73         KEY_ID_API_HMAC_SHA_1_96    HmacKeyID = 1
74         KEY_ID_API_HMAC_SHA_256_128 HmacKeyID = 2
75 )
76
77 var (
78         HmacKeyID_name = map[uint8]string{
79                 0: "KEY_ID_API_HMAC_NO_KEY",
80                 1: "KEY_ID_API_HMAC_SHA_1_96",
81                 2: "KEY_ID_API_HMAC_SHA_256_128",
82         }
83         HmacKeyID_value = map[string]uint8{
84                 "KEY_ID_API_HMAC_NO_KEY":      0,
85                 "KEY_ID_API_HMAC_SHA_1_96":    1,
86                 "KEY_ID_API_HMAC_SHA_256_128": 2,
87         }
88 )
89
90 func (x HmacKeyID) String() string {
91         s, ok := HmacKeyID_name[uint8(x)]
92         if ok {
93                 return s
94         }
95         return "HmacKeyID(" + strconv.Itoa(int(x)) + ")"
96 }
97
98 // Eid defines type 'eid'.
99 type Eid struct {
100         Type    EidType         `binapi:"eid_type,name=type" json:"type,omitempty"`
101         Address EidAddressUnion `binapi:"eid_address,name=address" json:"address,omitempty"`
102 }
103
104 // HmacKey defines type 'hmac_key'.
105 type HmacKey struct {
106         ID  HmacKeyID `binapi:"hmac_key_id,name=id" json:"id,omitempty"`
107         Key []byte    `binapi:"u8[64],name=key" json:"key,omitempty"`
108 }
109
110 // LocalLocator defines type 'local_locator'.
111 type LocalLocator struct {
112         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
113         Priority  uint8                          `binapi:"u8,name=priority" json:"priority,omitempty"`
114         Weight    uint8                          `binapi:"u8,name=weight" json:"weight,omitempty"`
115 }
116
117 // Nsh defines type 'nsh'.
118 type Nsh struct {
119         Spi uint32 `binapi:"u32,name=spi" json:"spi,omitempty"`
120         Si  uint8  `binapi:"u8,name=si" json:"si,omitempty"`
121 }
122
123 // RemoteLocator defines type 'remote_locator'.
124 type RemoteLocator struct {
125         Priority  uint8            `binapi:"u8,name=priority" json:"priority,omitempty"`
126         Weight    uint8            `binapi:"u8,name=weight" json:"weight,omitempty"`
127         IPAddress ip_types.Address `binapi:"address,name=ip_address" json:"ip_address,omitempty"`
128 }
129
130 // EidAddressUnion defines union 'eid_address'.
131 type EidAddressUnion struct {
132         // EidAddressUnion can be one of:
133         // - Prefix *ip_types.Prefix
134         // - Mac *ethernet_types.MacAddress
135         // - Nsh *Nsh
136         XXX_UnionData [18]byte
137 }
138
139 func EidAddressUnionPrefix(a ip_types.Prefix) (u EidAddressUnion) {
140         u.SetPrefix(a)
141         return
142 }
143 func (u *EidAddressUnion) SetPrefix(a ip_types.Prefix) {
144         buf := codec.NewBuffer(u.XXX_UnionData[:])
145         buf.EncodeUint8(uint8(a.Address.Af))
146         buf.EncodeBytes(a.Address.Un.XXX_UnionData[:], 16)
147         buf.EncodeUint8(a.Len)
148 }
149 func (u *EidAddressUnion) GetPrefix() (a ip_types.Prefix) {
150         buf := codec.NewBuffer(u.XXX_UnionData[:])
151         a.Address.Af = ip_types.AddressFamily(buf.DecodeUint8())
152         copy(a.Address.Un.XXX_UnionData[:], buf.DecodeBytes(16))
153         a.Len = buf.DecodeUint8()
154         return
155 }
156
157 func EidAddressUnionMac(a ethernet_types.MacAddress) (u EidAddressUnion) {
158         u.SetMac(a)
159         return
160 }
161 func (u *EidAddressUnion) SetMac(a ethernet_types.MacAddress) {
162         buf := codec.NewBuffer(u.XXX_UnionData[:])
163         buf.EncodeBytes(a[:], 6)
164 }
165 func (u *EidAddressUnion) GetMac() (a ethernet_types.MacAddress) {
166         buf := codec.NewBuffer(u.XXX_UnionData[:])
167         copy(a[:], buf.DecodeBytes(6))
168         return
169 }
170
171 func EidAddressUnionNsh(a Nsh) (u EidAddressUnion) {
172         u.SetNsh(a)
173         return
174 }
175 func (u *EidAddressUnion) SetNsh(a Nsh) {
176         buf := codec.NewBuffer(u.XXX_UnionData[:])
177         buf.EncodeUint32(a.Spi)
178         buf.EncodeUint8(a.Si)
179 }
180 func (u *EidAddressUnion) GetNsh() (a Nsh) {
181         buf := codec.NewBuffer(u.XXX_UnionData[:])
182         a.Spi = buf.DecodeUint32()
183         a.Si = buf.DecodeUint8()
184         return
185 }