1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
5 // source: /usr/share/vpp/api/core/gre.api.json
7 // Package gre contains generated bindings for API file gre.api.
17 api "git.fd.io/govpp.git/api"
18 interface_types "git.fd.io/govpp.git/binapi/interface_types"
19 ip_types "git.fd.io/govpp.git/binapi/ip_types"
20 tunnel_types "git.fd.io/govpp.git/binapi/tunnel_types"
21 codec "git.fd.io/govpp.git/codec"
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
34 VersionCrc = 0xb9021569
37 // GreTunnelType defines enum 'gre_tunnel_type'.
38 type GreTunnelType uint8
41 GRE_API_TUNNEL_TYPE_L3 GreTunnelType = 0
42 GRE_API_TUNNEL_TYPE_TEB GreTunnelType = 1
43 GRE_API_TUNNEL_TYPE_ERSPAN GreTunnelType = 2
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",
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,
59 func (x GreTunnelType) String() string {
60 s, ok := GreTunnelType_name[uint8(x)]
64 return "GreTunnelType(" + strconv.Itoa(int(x)) + ")"
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"`
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"`
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
93 func (m *GreTunnelAddDel) Size() (size int) {
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
111 func (m *GreTunnelAddDel) Marshal(b []byte) ([]byte, error) {
113 b = make([]byte, m.Size())
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
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))
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"`
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
160 func (m *GreTunnelAddDelReply) Size() (size int) {
164 size += 4 // m.Retval
165 size += 4 // m.SwIfIndex
168 func (m *GreTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
170 b = make([]byte, m.Size())
172 buf := codec.NewBuffer(b)
173 buf.EncodeInt32(m.Retval)
174 buf.EncodeUint32(uint32(m.SwIfIndex))
175 return buf.Bytes(), nil
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())
184 // GreTunnelDetails defines message 'gre_tunnel_details'.
185 type GreTunnelDetails struct {
186 Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"`
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
196 func (m *GreTunnelDetails) Size() (size int) {
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
213 func (m *GreTunnelDetails) Marshal(b []byte) ([]byte, error) {
215 b = make([]byte, m.Size())
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
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))
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"`
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
259 func (m *GreTunnelDump) Size() (size int) {
263 size += 4 // m.SwIfIndex
266 func (m *GreTunnelDump) Marshal(b []byte) ([]byte, error) {
268 b = make([]byte, m.Size())
270 buf := codec.NewBuffer(b)
271 buf.EncodeUint32(uint32(m.SwIfIndex))
272 return buf.Bytes(), nil
274 func (m *GreTunnelDump) Unmarshal(b []byte) error {
275 buf := codec.NewBuffer(b)
276 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
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")
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),