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