1a123bd025d343f440e8589a89a7a8a4cc24eca6
[govpp.git] / binapi / gre / gre.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 gre contains generated bindings for API file gre.api.
7 //
8 // Contents:
9 //   1 enum
10 //   1 struct
11 //   4 messages
12 //
13 package gre
14
15 import (
16         "strconv"
17
18         api "git.fd.io/govpp.git/api"
19         interface_types "git.fd.io/govpp.git/binapi/interface_types"
20         ip_types "git.fd.io/govpp.git/binapi/ip_types"
21         tunnel_types "git.fd.io/govpp.git/binapi/tunnel_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 const (
32         APIFile    = "gre"
33         APIVersion = "2.1.0"
34         VersionCrc = 0xb9021569
35 )
36
37 // GreTunnelType defines enum 'gre_tunnel_type'.
38 type GreTunnelType uint8
39
40 const (
41         GRE_API_TUNNEL_TYPE_L3     GreTunnelType = 0
42         GRE_API_TUNNEL_TYPE_TEB    GreTunnelType = 1
43         GRE_API_TUNNEL_TYPE_ERSPAN GreTunnelType = 2
44 )
45
46 var (
47         GreTunnelType_name = map[uint8]string{
48                 0: "GRE_API_TUNNEL_TYPE_L3",
49                 1: "GRE_API_TUNNEL_TYPE_TEB",
50                 2: "GRE_API_TUNNEL_TYPE_ERSPAN",
51         }
52         GreTunnelType_value = map[string]uint8{
53                 "GRE_API_TUNNEL_TYPE_L3":     0,
54                 "GRE_API_TUNNEL_TYPE_TEB":    1,
55                 "GRE_API_TUNNEL_TYPE_ERSPAN": 2,
56         }
57 )
58
59 func (x GreTunnelType) String() string {
60         s, ok := GreTunnelType_name[uint8(x)]
61         if ok {
62                 return s
63         }
64         return "GreTunnelType(" + strconv.Itoa(int(x)) + ")"
65 }
66
67 // GreTunnel defines type 'gre_tunnel'.
68 type GreTunnel struct {
69         Type         GreTunnelType                      `binapi:"gre_tunnel_type,name=type" json:"type,omitempty"`
70         Mode         tunnel_types.TunnelMode            `binapi:"tunnel_mode,name=mode" json:"mode,omitempty"`
71         Flags        tunnel_types.TunnelEncapDecapFlags `binapi:"tunnel_encap_decap_flags,name=flags" json:"flags,omitempty"`
72         SessionID    uint16                             `binapi:"u16,name=session_id" json:"session_id,omitempty"`
73         Instance     uint32                             `binapi:"u32,name=instance" json:"instance,omitempty"`
74         OuterTableID uint32                             `binapi:"u32,name=outer_table_id" json:"outer_table_id,omitempty"`
75         SwIfIndex    interface_types.InterfaceIndex     `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
76         Src          ip_types.Address                   `binapi:"address,name=src" json:"src,omitempty"`
77         Dst          ip_types.Address                   `binapi:"address,name=dst" json:"dst,omitempty"`
78 }
79
80 // GreTunnelAddDel defines message 'gre_tunnel_add_del'.
81 type GreTunnelAddDel struct {
82         IsAdd  bool      `binapi:"bool,name=is_add" json:"is_add,omitempty"`
83         Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"`
84 }
85
86 func (m *GreTunnelAddDel) Reset()               { *m = GreTunnelAddDel{} }
87 func (*GreTunnelAddDel) GetMessageName() string { return "gre_tunnel_add_del" }
88 func (*GreTunnelAddDel) GetCrcString() string   { return "6efc9c22" }
89 func (*GreTunnelAddDel) GetMessageType() api.MessageType {
90         return api.RequestMessage
91 }
92
93 func (m *GreTunnelAddDel) Size() (size int) {
94         if m == nil {
95                 return 0
96         }
97         size += 1      // m.IsAdd
98         size += 1      // m.Tunnel.Type
99         size += 1      // m.Tunnel.Mode
100         size += 1      // m.Tunnel.Flags
101         size += 2      // m.Tunnel.SessionID
102         size += 4      // m.Tunnel.Instance
103         size += 4      // m.Tunnel.OuterTableID
104         size += 4      // m.Tunnel.SwIfIndex
105         size += 1      // m.Tunnel.Src.Af
106         size += 1 * 16 // m.Tunnel.Src.Un
107         size += 1      // m.Tunnel.Dst.Af
108         size += 1 * 16 // m.Tunnel.Dst.Un
109         return size
110 }
111 func (m *GreTunnelAddDel) Marshal(b []byte) ([]byte, error) {
112         if b == nil {
113                 b = make([]byte, m.Size())
114         }
115         buf := codec.NewBuffer(b)
116         buf.EncodeBool(m.IsAdd)
117         buf.EncodeUint8(uint8(m.Tunnel.Type))
118         buf.EncodeUint8(uint8(m.Tunnel.Mode))
119         buf.EncodeUint8(uint8(m.Tunnel.Flags))
120         buf.EncodeUint16(m.Tunnel.SessionID)
121         buf.EncodeUint32(m.Tunnel.Instance)
122         buf.EncodeUint32(m.Tunnel.OuterTableID)
123         buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
124         buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
125         buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
126         buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
127         buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
128         return buf.Bytes(), nil
129 }
130 func (m *GreTunnelAddDel) Unmarshal(b []byte) error {
131         buf := codec.NewBuffer(b)
132         m.IsAdd = buf.DecodeBool()
133         m.Tunnel.Type = GreTunnelType(buf.DecodeUint8())
134         m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8())
135         m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8())
136         m.Tunnel.SessionID = buf.DecodeUint16()
137         m.Tunnel.Instance = buf.DecodeUint32()
138         m.Tunnel.OuterTableID = buf.DecodeUint32()
139         m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
140         m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8())
141         copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16))
142         m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
143         copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
144         return nil
145 }
146
147 // GreTunnelAddDelReply defines message 'gre_tunnel_add_del_reply'.
148 type GreTunnelAddDelReply struct {
149         Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
150         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
151 }
152
153 func (m *GreTunnelAddDelReply) Reset()               { *m = GreTunnelAddDelReply{} }
154 func (*GreTunnelAddDelReply) GetMessageName() string { return "gre_tunnel_add_del_reply" }
155 func (*GreTunnelAddDelReply) GetCrcString() string   { return "5383d31f" }
156 func (*GreTunnelAddDelReply) GetMessageType() api.MessageType {
157         return api.ReplyMessage
158 }
159
160 func (m *GreTunnelAddDelReply) Size() (size int) {
161         if m == nil {
162                 return 0
163         }
164         size += 4 // m.Retval
165         size += 4 // m.SwIfIndex
166         return size
167 }
168 func (m *GreTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
169         if b == nil {
170                 b = make([]byte, m.Size())
171         }
172         buf := codec.NewBuffer(b)
173         buf.EncodeInt32(m.Retval)
174         buf.EncodeUint32(uint32(m.SwIfIndex))
175         return buf.Bytes(), nil
176 }
177 func (m *GreTunnelAddDelReply) Unmarshal(b []byte) error {
178         buf := codec.NewBuffer(b)
179         m.Retval = buf.DecodeInt32()
180         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
181         return nil
182 }
183
184 // GreTunnelDetails defines message 'gre_tunnel_details'.
185 type GreTunnelDetails struct {
186         Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"`
187 }
188
189 func (m *GreTunnelDetails) Reset()               { *m = GreTunnelDetails{} }
190 func (*GreTunnelDetails) GetMessageName() string { return "gre_tunnel_details" }
191 func (*GreTunnelDetails) GetCrcString() string   { return "003bfbf1" }
192 func (*GreTunnelDetails) GetMessageType() api.MessageType {
193         return api.ReplyMessage
194 }
195
196 func (m *GreTunnelDetails) Size() (size int) {
197         if m == nil {
198                 return 0
199         }
200         size += 1      // m.Tunnel.Type
201         size += 1      // m.Tunnel.Mode
202         size += 1      // m.Tunnel.Flags
203         size += 2      // m.Tunnel.SessionID
204         size += 4      // m.Tunnel.Instance
205         size += 4      // m.Tunnel.OuterTableID
206         size += 4      // m.Tunnel.SwIfIndex
207         size += 1      // m.Tunnel.Src.Af
208         size += 1 * 16 // m.Tunnel.Src.Un
209         size += 1      // m.Tunnel.Dst.Af
210         size += 1 * 16 // m.Tunnel.Dst.Un
211         return size
212 }
213 func (m *GreTunnelDetails) Marshal(b []byte) ([]byte, error) {
214         if b == nil {
215                 b = make([]byte, m.Size())
216         }
217         buf := codec.NewBuffer(b)
218         buf.EncodeUint8(uint8(m.Tunnel.Type))
219         buf.EncodeUint8(uint8(m.Tunnel.Mode))
220         buf.EncodeUint8(uint8(m.Tunnel.Flags))
221         buf.EncodeUint16(m.Tunnel.SessionID)
222         buf.EncodeUint32(m.Tunnel.Instance)
223         buf.EncodeUint32(m.Tunnel.OuterTableID)
224         buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
225         buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
226         buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
227         buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
228         buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
229         return buf.Bytes(), nil
230 }
231 func (m *GreTunnelDetails) Unmarshal(b []byte) error {
232         buf := codec.NewBuffer(b)
233         m.Tunnel.Type = GreTunnelType(buf.DecodeUint8())
234         m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8())
235         m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8())
236         m.Tunnel.SessionID = buf.DecodeUint16()
237         m.Tunnel.Instance = buf.DecodeUint32()
238         m.Tunnel.OuterTableID = buf.DecodeUint32()
239         m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
240         m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8())
241         copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16))
242         m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
243         copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
244         return nil
245 }
246
247 // GreTunnelDump defines message 'gre_tunnel_dump'.
248 type GreTunnelDump struct {
249         SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
250 }
251
252 func (m *GreTunnelDump) Reset()               { *m = GreTunnelDump{} }
253 func (*GreTunnelDump) GetMessageName() string { return "gre_tunnel_dump" }
254 func (*GreTunnelDump) GetCrcString() string   { return "f9e6675e" }
255 func (*GreTunnelDump) GetMessageType() api.MessageType {
256         return api.RequestMessage
257 }
258
259 func (m *GreTunnelDump) Size() (size int) {
260         if m == nil {
261                 return 0
262         }
263         size += 4 // m.SwIfIndex
264         return size
265 }
266 func (m *GreTunnelDump) Marshal(b []byte) ([]byte, error) {
267         if b == nil {
268                 b = make([]byte, m.Size())
269         }
270         buf := codec.NewBuffer(b)
271         buf.EncodeUint32(uint32(m.SwIfIndex))
272         return buf.Bytes(), nil
273 }
274 func (m *GreTunnelDump) Unmarshal(b []byte) error {
275         buf := codec.NewBuffer(b)
276         m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
277         return nil
278 }
279
280 func init() { file_gre_binapi_init() }
281 func file_gre_binapi_init() {
282         api.RegisterMessage((*GreTunnelAddDel)(nil), "gre_tunnel_add_del_6efc9c22")
283         api.RegisterMessage((*GreTunnelAddDelReply)(nil), "gre_tunnel_add_del_reply_5383d31f")
284         api.RegisterMessage((*GreTunnelDetails)(nil), "gre_tunnel_details_003bfbf1")
285         api.RegisterMessage((*GreTunnelDump)(nil), "gre_tunnel_dump_f9e6675e")
286 }
287
288 // Messages returns list of all messages in this module.
289 func AllMessages() []api.Message {
290         return []api.Message{
291                 (*GreTunnelAddDel)(nil),
292                 (*GreTunnelAddDelReply)(nil),
293                 (*GreTunnelDetails)(nil),
294                 (*GreTunnelDump)(nil),
295         }
296 }