1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.5.0-dev
5 // source: /usr/share/vpp/api/core/gre.api.json
7 // Package gre contains generated bindings for API file gre.api.
19 api "git.fd.io/govpp.git/api"
20 interface_types "git.fd.io/govpp.git/binapi/interface_types"
21 ip_types "git.fd.io/govpp.git/binapi/ip_types"
22 tunnel_types "git.fd.io/govpp.git/binapi/tunnel_types"
23 codec "git.fd.io/govpp.git/codec"
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
35 VersionCrc = 0x98b44dd1
38 // GreTunnelType defines enum 'gre_tunnel_type'.
39 type GreTunnelType uint8
42 GRE_API_TUNNEL_TYPE_L3 GreTunnelType = 0
43 GRE_API_TUNNEL_TYPE_TEB GreTunnelType = 1
44 GRE_API_TUNNEL_TYPE_ERSPAN GreTunnelType = 2
48 GreTunnelType_name = map[uint8]string{
49 0: "GRE_API_TUNNEL_TYPE_L3",
50 1: "GRE_API_TUNNEL_TYPE_TEB",
51 2: "GRE_API_TUNNEL_TYPE_ERSPAN",
53 GreTunnelType_value = map[string]uint8{
54 "GRE_API_TUNNEL_TYPE_L3": 0,
55 "GRE_API_TUNNEL_TYPE_TEB": 1,
56 "GRE_API_TUNNEL_TYPE_ERSPAN": 2,
60 func (x GreTunnelType) String() string {
61 s, ok := GreTunnelType_name[uint8(x)]
65 return "GreTunnelType(" + strconv.Itoa(int(x)) + ")"
68 // GreTunnel defines type 'gre_tunnel'.
69 type GreTunnel struct {
70 Type GreTunnelType `binapi:"gre_tunnel_type,name=type" json:"type,omitempty"`
71 Mode tunnel_types.TunnelMode `binapi:"tunnel_mode,name=mode" json:"mode,omitempty"`
72 Flags tunnel_types.TunnelEncapDecapFlags `binapi:"tunnel_encap_decap_flags,name=flags" json:"flags,omitempty"`
73 SessionID uint16 `binapi:"u16,name=session_id" json:"session_id,omitempty"`
74 Instance uint32 `binapi:"u32,name=instance" json:"instance,omitempty"`
75 OuterTableID uint32 `binapi:"u32,name=outer_table_id" json:"outer_table_id,omitempty"`
76 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
77 Src ip_types.Address `binapi:"address,name=src" json:"src,omitempty"`
78 Dst ip_types.Address `binapi:"address,name=dst" json:"dst,omitempty"`
81 // GreTunnelAddDel defines message 'gre_tunnel_add_del'.
82 type GreTunnelAddDel struct {
83 IsAdd bool `binapi:"bool,name=is_add" json:"is_add,omitempty"`
84 Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"`
87 func (m *GreTunnelAddDel) Reset() { *m = GreTunnelAddDel{} }
88 func (*GreTunnelAddDel) GetMessageName() string { return "gre_tunnel_add_del" }
89 func (*GreTunnelAddDel) GetCrcString() string { return "a27d7f17" }
90 func (*GreTunnelAddDel) GetMessageType() api.MessageType {
91 return api.RequestMessage
94 func (m *GreTunnelAddDel) Size() (size int) {
99 size += 1 // m.Tunnel.Type
100 size += 1 // m.Tunnel.Mode
101 size += 1 // m.Tunnel.Flags
102 size += 2 // m.Tunnel.SessionID
103 size += 4 // m.Tunnel.Instance
104 size += 4 // m.Tunnel.OuterTableID
105 size += 4 // m.Tunnel.SwIfIndex
106 size += 1 // m.Tunnel.Src.Af
107 size += 1 * 16 // m.Tunnel.Src.Un
108 size += 1 // m.Tunnel.Dst.Af
109 size += 1 * 16 // m.Tunnel.Dst.Un
112 func (m *GreTunnelAddDel) Marshal(b []byte) ([]byte, error) {
114 b = make([]byte, m.Size())
116 buf := codec.NewBuffer(b)
117 buf.EncodeBool(m.IsAdd)
118 buf.EncodeUint8(uint8(m.Tunnel.Type))
119 buf.EncodeUint8(uint8(m.Tunnel.Mode))
120 buf.EncodeUint8(uint8(m.Tunnel.Flags))
121 buf.EncodeUint16(m.Tunnel.SessionID)
122 buf.EncodeUint32(m.Tunnel.Instance)
123 buf.EncodeUint32(m.Tunnel.OuterTableID)
124 buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
125 buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
126 buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
127 buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
128 buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
129 return buf.Bytes(), nil
131 func (m *GreTunnelAddDel) Unmarshal(b []byte) error {
132 buf := codec.NewBuffer(b)
133 m.IsAdd = buf.DecodeBool()
134 m.Tunnel.Type = GreTunnelType(buf.DecodeUint8())
135 m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8())
136 m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8())
137 m.Tunnel.SessionID = buf.DecodeUint16()
138 m.Tunnel.Instance = buf.DecodeUint32()
139 m.Tunnel.OuterTableID = buf.DecodeUint32()
140 m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
141 m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8())
142 copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16))
143 m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
144 copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
148 // GreTunnelAddDelReply defines message 'gre_tunnel_add_del_reply'.
149 type GreTunnelAddDelReply struct {
150 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
151 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
154 func (m *GreTunnelAddDelReply) Reset() { *m = GreTunnelAddDelReply{} }
155 func (*GreTunnelAddDelReply) GetMessageName() string { return "gre_tunnel_add_del_reply" }
156 func (*GreTunnelAddDelReply) GetCrcString() string { return "5383d31f" }
157 func (*GreTunnelAddDelReply) GetMessageType() api.MessageType {
158 return api.ReplyMessage
161 func (m *GreTunnelAddDelReply) Size() (size int) {
165 size += 4 // m.Retval
166 size += 4 // m.SwIfIndex
169 func (m *GreTunnelAddDelReply) Marshal(b []byte) ([]byte, error) {
171 b = make([]byte, m.Size())
173 buf := codec.NewBuffer(b)
174 buf.EncodeInt32(m.Retval)
175 buf.EncodeUint32(uint32(m.SwIfIndex))
176 return buf.Bytes(), nil
178 func (m *GreTunnelAddDelReply) Unmarshal(b []byte) error {
179 buf := codec.NewBuffer(b)
180 m.Retval = buf.DecodeInt32()
181 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
185 // GreTunnelDetails defines message 'gre_tunnel_details'.
186 type GreTunnelDetails struct {
187 Tunnel GreTunnel `binapi:"gre_tunnel,name=tunnel" json:"tunnel,omitempty"`
190 func (m *GreTunnelDetails) Reset() { *m = GreTunnelDetails{} }
191 func (*GreTunnelDetails) GetMessageName() string { return "gre_tunnel_details" }
192 func (*GreTunnelDetails) GetCrcString() string { return "24435433" }
193 func (*GreTunnelDetails) GetMessageType() api.MessageType {
194 return api.ReplyMessage
197 func (m *GreTunnelDetails) Size() (size int) {
201 size += 1 // m.Tunnel.Type
202 size += 1 // m.Tunnel.Mode
203 size += 1 // m.Tunnel.Flags
204 size += 2 // m.Tunnel.SessionID
205 size += 4 // m.Tunnel.Instance
206 size += 4 // m.Tunnel.OuterTableID
207 size += 4 // m.Tunnel.SwIfIndex
208 size += 1 // m.Tunnel.Src.Af
209 size += 1 * 16 // m.Tunnel.Src.Un
210 size += 1 // m.Tunnel.Dst.Af
211 size += 1 * 16 // m.Tunnel.Dst.Un
214 func (m *GreTunnelDetails) Marshal(b []byte) ([]byte, error) {
216 b = make([]byte, m.Size())
218 buf := codec.NewBuffer(b)
219 buf.EncodeUint8(uint8(m.Tunnel.Type))
220 buf.EncodeUint8(uint8(m.Tunnel.Mode))
221 buf.EncodeUint8(uint8(m.Tunnel.Flags))
222 buf.EncodeUint16(m.Tunnel.SessionID)
223 buf.EncodeUint32(m.Tunnel.Instance)
224 buf.EncodeUint32(m.Tunnel.OuterTableID)
225 buf.EncodeUint32(uint32(m.Tunnel.SwIfIndex))
226 buf.EncodeUint8(uint8(m.Tunnel.Src.Af))
227 buf.EncodeBytes(m.Tunnel.Src.Un.XXX_UnionData[:], 16)
228 buf.EncodeUint8(uint8(m.Tunnel.Dst.Af))
229 buf.EncodeBytes(m.Tunnel.Dst.Un.XXX_UnionData[:], 16)
230 return buf.Bytes(), nil
232 func (m *GreTunnelDetails) Unmarshal(b []byte) error {
233 buf := codec.NewBuffer(b)
234 m.Tunnel.Type = GreTunnelType(buf.DecodeUint8())
235 m.Tunnel.Mode = tunnel_types.TunnelMode(buf.DecodeUint8())
236 m.Tunnel.Flags = tunnel_types.TunnelEncapDecapFlags(buf.DecodeUint8())
237 m.Tunnel.SessionID = buf.DecodeUint16()
238 m.Tunnel.Instance = buf.DecodeUint32()
239 m.Tunnel.OuterTableID = buf.DecodeUint32()
240 m.Tunnel.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
241 m.Tunnel.Src.Af = ip_types.AddressFamily(buf.DecodeUint8())
242 copy(m.Tunnel.Src.Un.XXX_UnionData[:], buf.DecodeBytes(16))
243 m.Tunnel.Dst.Af = ip_types.AddressFamily(buf.DecodeUint8())
244 copy(m.Tunnel.Dst.Un.XXX_UnionData[:], buf.DecodeBytes(16))
248 // GreTunnelDump defines message 'gre_tunnel_dump'.
249 type GreTunnelDump struct {
250 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
253 func (m *GreTunnelDump) Reset() { *m = GreTunnelDump{} }
254 func (*GreTunnelDump) GetMessageName() string { return "gre_tunnel_dump" }
255 func (*GreTunnelDump) GetCrcString() string { return "f9e6675e" }
256 func (*GreTunnelDump) GetMessageType() api.MessageType {
257 return api.RequestMessage
260 func (m *GreTunnelDump) Size() (size int) {
264 size += 4 // m.SwIfIndex
267 func (m *GreTunnelDump) Marshal(b []byte) ([]byte, error) {
269 b = make([]byte, m.Size())
271 buf := codec.NewBuffer(b)
272 buf.EncodeUint32(uint32(m.SwIfIndex))
273 return buf.Bytes(), nil
275 func (m *GreTunnelDump) Unmarshal(b []byte) error {
276 buf := codec.NewBuffer(b)
277 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
281 func init() { file_gre_binapi_init() }
282 func file_gre_binapi_init() {
283 api.RegisterMessage((*GreTunnelAddDel)(nil), "gre_tunnel_add_del_a27d7f17")
284 api.RegisterMessage((*GreTunnelAddDelReply)(nil), "gre_tunnel_add_del_reply_5383d31f")
285 api.RegisterMessage((*GreTunnelDetails)(nil), "gre_tunnel_details_24435433")
286 api.RegisterMessage((*GreTunnelDump)(nil), "gre_tunnel_dump_f9e6675e")
289 // Messages returns list of all messages in this module.
290 func AllMessages() []api.Message {
291 return []api.Message{
292 (*GreTunnelAddDel)(nil),
293 (*GreTunnelAddDelReply)(nil),
294 (*GreTunnelDetails)(nil),
295 (*GreTunnelDump)(nil),