1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0
4 // VPP: 20.05.1-release
5 // source: /usr/share/vpp/api/core/l2tp.api.json
7 // Package l2tp contains generated bindings for API file l2tp.api.
18 api "git.fd.io/govpp.git/api"
19 _ "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"
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 = 0xb018cef7
37 // L2tLookupKey defines enum 'l2t_lookup_key'.
38 type L2tLookupKey uint8
41 L2T_LOOKUP_KEY_API_SRC_ADDR L2tLookupKey = 0
42 L2T_LOOKUP_KEY_API_DST_ADDR L2tLookupKey = 1
43 L2T_LOOKUP_KEY_API_SESSION_ID L2tLookupKey = 2
47 L2tLookupKey_name = map[uint8]string{
48 0: "L2T_LOOKUP_KEY_API_SRC_ADDR",
49 1: "L2T_LOOKUP_KEY_API_DST_ADDR",
50 2: "L2T_LOOKUP_KEY_API_SESSION_ID",
52 L2tLookupKey_value = map[string]uint8{
53 "L2T_LOOKUP_KEY_API_SRC_ADDR": 0,
54 "L2T_LOOKUP_KEY_API_DST_ADDR": 1,
55 "L2T_LOOKUP_KEY_API_SESSION_ID": 2,
59 func (x L2tLookupKey) String() string {
60 s, ok := L2tLookupKey_name[uint8(x)]
64 return "L2tLookupKey(" + strconv.Itoa(int(x)) + ")"
67 // L2tpv3CreateTunnel defines message 'l2tpv3_create_tunnel'.
68 type L2tpv3CreateTunnel struct {
69 ClientAddress ip_types.Address `binapi:"address,name=client_address" json:"client_address,omitempty"`
70 OurAddress ip_types.Address `binapi:"address,name=our_address" json:"our_address,omitempty"`
71 LocalSessionID uint32 `binapi:"u32,name=local_session_id" json:"local_session_id,omitempty"`
72 RemoteSessionID uint32 `binapi:"u32,name=remote_session_id" json:"remote_session_id,omitempty"`
73 LocalCookie uint64 `binapi:"u64,name=local_cookie" json:"local_cookie,omitempty"`
74 RemoteCookie uint64 `binapi:"u64,name=remote_cookie" json:"remote_cookie,omitempty"`
75 L2SublayerPresent bool `binapi:"bool,name=l2_sublayer_present" json:"l2_sublayer_present,omitempty"`
76 EncapVrfID uint32 `binapi:"u32,name=encap_vrf_id" json:"encap_vrf_id,omitempty"`
79 func (m *L2tpv3CreateTunnel) Reset() { *m = L2tpv3CreateTunnel{} }
80 func (*L2tpv3CreateTunnel) GetMessageName() string { return "l2tpv3_create_tunnel" }
81 func (*L2tpv3CreateTunnel) GetCrcString() string { return "596892cb" }
82 func (*L2tpv3CreateTunnel) GetMessageType() api.MessageType {
83 return api.RequestMessage
86 func (m *L2tpv3CreateTunnel) Size() (size int) {
90 size += 1 // m.ClientAddress.Af
91 size += 1 * 16 // m.ClientAddress.Un
92 size += 1 // m.OurAddress.Af
93 size += 1 * 16 // m.OurAddress.Un
94 size += 4 // m.LocalSessionID
95 size += 4 // m.RemoteSessionID
96 size += 8 // m.LocalCookie
97 size += 8 // m.RemoteCookie
98 size += 1 // m.L2SublayerPresent
99 size += 4 // m.EncapVrfID
102 func (m *L2tpv3CreateTunnel) Marshal(b []byte) ([]byte, error) {
104 b = make([]byte, m.Size())
106 buf := codec.NewBuffer(b)
107 buf.EncodeUint8(uint8(m.ClientAddress.Af))
108 buf.EncodeBytes(m.ClientAddress.Un.XXX_UnionData[:], 16)
109 buf.EncodeUint8(uint8(m.OurAddress.Af))
110 buf.EncodeBytes(m.OurAddress.Un.XXX_UnionData[:], 16)
111 buf.EncodeUint32(m.LocalSessionID)
112 buf.EncodeUint32(m.RemoteSessionID)
113 buf.EncodeUint64(m.LocalCookie)
114 buf.EncodeUint64(m.RemoteCookie)
115 buf.EncodeBool(m.L2SublayerPresent)
116 buf.EncodeUint32(m.EncapVrfID)
117 return buf.Bytes(), nil
119 func (m *L2tpv3CreateTunnel) Unmarshal(b []byte) error {
120 buf := codec.NewBuffer(b)
121 m.ClientAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
122 copy(m.ClientAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
123 m.OurAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
124 copy(m.OurAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
125 m.LocalSessionID = buf.DecodeUint32()
126 m.RemoteSessionID = buf.DecodeUint32()
127 m.LocalCookie = buf.DecodeUint64()
128 m.RemoteCookie = buf.DecodeUint64()
129 m.L2SublayerPresent = buf.DecodeBool()
130 m.EncapVrfID = buf.DecodeUint32()
134 // L2tpv3CreateTunnelReply defines message 'l2tpv3_create_tunnel_reply'.
135 type L2tpv3CreateTunnelReply struct {
136 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
137 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
140 func (m *L2tpv3CreateTunnelReply) Reset() { *m = L2tpv3CreateTunnelReply{} }
141 func (*L2tpv3CreateTunnelReply) GetMessageName() string { return "l2tpv3_create_tunnel_reply" }
142 func (*L2tpv3CreateTunnelReply) GetCrcString() string { return "5383d31f" }
143 func (*L2tpv3CreateTunnelReply) GetMessageType() api.MessageType {
144 return api.ReplyMessage
147 func (m *L2tpv3CreateTunnelReply) Size() (size int) {
151 size += 4 // m.Retval
152 size += 4 // m.SwIfIndex
155 func (m *L2tpv3CreateTunnelReply) Marshal(b []byte) ([]byte, error) {
157 b = make([]byte, m.Size())
159 buf := codec.NewBuffer(b)
160 buf.EncodeInt32(m.Retval)
161 buf.EncodeUint32(uint32(m.SwIfIndex))
162 return buf.Bytes(), nil
164 func (m *L2tpv3CreateTunnelReply) Unmarshal(b []byte) error {
165 buf := codec.NewBuffer(b)
166 m.Retval = buf.DecodeInt32()
167 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
171 // L2tpv3InterfaceEnableDisable defines message 'l2tpv3_interface_enable_disable'.
172 type L2tpv3InterfaceEnableDisable struct {
173 EnableDisable bool `binapi:"bool,name=enable_disable" json:"enable_disable,omitempty"`
174 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
177 func (m *L2tpv3InterfaceEnableDisable) Reset() { *m = L2tpv3InterfaceEnableDisable{} }
178 func (*L2tpv3InterfaceEnableDisable) GetMessageName() string {
179 return "l2tpv3_interface_enable_disable"
181 func (*L2tpv3InterfaceEnableDisable) GetCrcString() string { return "3865946c" }
182 func (*L2tpv3InterfaceEnableDisable) GetMessageType() api.MessageType {
183 return api.RequestMessage
186 func (m *L2tpv3InterfaceEnableDisable) Size() (size int) {
190 size += 1 // m.EnableDisable
191 size += 4 // m.SwIfIndex
194 func (m *L2tpv3InterfaceEnableDisable) Marshal(b []byte) ([]byte, error) {
196 b = make([]byte, m.Size())
198 buf := codec.NewBuffer(b)
199 buf.EncodeBool(m.EnableDisable)
200 buf.EncodeUint32(uint32(m.SwIfIndex))
201 return buf.Bytes(), nil
203 func (m *L2tpv3InterfaceEnableDisable) Unmarshal(b []byte) error {
204 buf := codec.NewBuffer(b)
205 m.EnableDisable = buf.DecodeBool()
206 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
210 // L2tpv3InterfaceEnableDisableReply defines message 'l2tpv3_interface_enable_disable_reply'.
211 type L2tpv3InterfaceEnableDisableReply struct {
212 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
215 func (m *L2tpv3InterfaceEnableDisableReply) Reset() { *m = L2tpv3InterfaceEnableDisableReply{} }
216 func (*L2tpv3InterfaceEnableDisableReply) GetMessageName() string {
217 return "l2tpv3_interface_enable_disable_reply"
219 func (*L2tpv3InterfaceEnableDisableReply) GetCrcString() string { return "e8d4e804" }
220 func (*L2tpv3InterfaceEnableDisableReply) GetMessageType() api.MessageType {
221 return api.ReplyMessage
224 func (m *L2tpv3InterfaceEnableDisableReply) Size() (size int) {
228 size += 4 // m.Retval
231 func (m *L2tpv3InterfaceEnableDisableReply) Marshal(b []byte) ([]byte, error) {
233 b = make([]byte, m.Size())
235 buf := codec.NewBuffer(b)
236 buf.EncodeInt32(m.Retval)
237 return buf.Bytes(), nil
239 func (m *L2tpv3InterfaceEnableDisableReply) Unmarshal(b []byte) error {
240 buf := codec.NewBuffer(b)
241 m.Retval = buf.DecodeInt32()
245 // L2tpv3SetLookupKey defines message 'l2tpv3_set_lookup_key'.
246 type L2tpv3SetLookupKey struct {
247 Key L2tLookupKey `binapi:"l2t_lookup_key,name=key" json:"key,omitempty"`
250 func (m *L2tpv3SetLookupKey) Reset() { *m = L2tpv3SetLookupKey{} }
251 func (*L2tpv3SetLookupKey) GetMessageName() string { return "l2tpv3_set_lookup_key" }
252 func (*L2tpv3SetLookupKey) GetCrcString() string { return "c9892c86" }
253 func (*L2tpv3SetLookupKey) GetMessageType() api.MessageType {
254 return api.RequestMessage
257 func (m *L2tpv3SetLookupKey) Size() (size int) {
264 func (m *L2tpv3SetLookupKey) Marshal(b []byte) ([]byte, error) {
266 b = make([]byte, m.Size())
268 buf := codec.NewBuffer(b)
269 buf.EncodeUint8(uint8(m.Key))
270 return buf.Bytes(), nil
272 func (m *L2tpv3SetLookupKey) Unmarshal(b []byte) error {
273 buf := codec.NewBuffer(b)
274 m.Key = L2tLookupKey(buf.DecodeUint8())
278 // L2tpv3SetLookupKeyReply defines message 'l2tpv3_set_lookup_key_reply'.
279 type L2tpv3SetLookupKeyReply struct {
280 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
283 func (m *L2tpv3SetLookupKeyReply) Reset() { *m = L2tpv3SetLookupKeyReply{} }
284 func (*L2tpv3SetLookupKeyReply) GetMessageName() string { return "l2tpv3_set_lookup_key_reply" }
285 func (*L2tpv3SetLookupKeyReply) GetCrcString() string { return "e8d4e804" }
286 func (*L2tpv3SetLookupKeyReply) GetMessageType() api.MessageType {
287 return api.ReplyMessage
290 func (m *L2tpv3SetLookupKeyReply) Size() (size int) {
294 size += 4 // m.Retval
297 func (m *L2tpv3SetLookupKeyReply) Marshal(b []byte) ([]byte, error) {
299 b = make([]byte, m.Size())
301 buf := codec.NewBuffer(b)
302 buf.EncodeInt32(m.Retval)
303 return buf.Bytes(), nil
305 func (m *L2tpv3SetLookupKeyReply) Unmarshal(b []byte) error {
306 buf := codec.NewBuffer(b)
307 m.Retval = buf.DecodeInt32()
311 // L2tpv3SetTunnelCookies defines message 'l2tpv3_set_tunnel_cookies'.
312 type L2tpv3SetTunnelCookies struct {
313 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
314 NewLocalCookie uint64 `binapi:"u64,name=new_local_cookie" json:"new_local_cookie,omitempty"`
315 NewRemoteCookie uint64 `binapi:"u64,name=new_remote_cookie" json:"new_remote_cookie,omitempty"`
318 func (m *L2tpv3SetTunnelCookies) Reset() { *m = L2tpv3SetTunnelCookies{} }
319 func (*L2tpv3SetTunnelCookies) GetMessageName() string { return "l2tpv3_set_tunnel_cookies" }
320 func (*L2tpv3SetTunnelCookies) GetCrcString() string { return "b3f4faf7" }
321 func (*L2tpv3SetTunnelCookies) GetMessageType() api.MessageType {
322 return api.RequestMessage
325 func (m *L2tpv3SetTunnelCookies) Size() (size int) {
329 size += 4 // m.SwIfIndex
330 size += 8 // m.NewLocalCookie
331 size += 8 // m.NewRemoteCookie
334 func (m *L2tpv3SetTunnelCookies) Marshal(b []byte) ([]byte, error) {
336 b = make([]byte, m.Size())
338 buf := codec.NewBuffer(b)
339 buf.EncodeUint32(uint32(m.SwIfIndex))
340 buf.EncodeUint64(m.NewLocalCookie)
341 buf.EncodeUint64(m.NewRemoteCookie)
342 return buf.Bytes(), nil
344 func (m *L2tpv3SetTunnelCookies) Unmarshal(b []byte) error {
345 buf := codec.NewBuffer(b)
346 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
347 m.NewLocalCookie = buf.DecodeUint64()
348 m.NewRemoteCookie = buf.DecodeUint64()
352 // L2tpv3SetTunnelCookiesReply defines message 'l2tpv3_set_tunnel_cookies_reply'.
353 type L2tpv3SetTunnelCookiesReply struct {
354 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
357 func (m *L2tpv3SetTunnelCookiesReply) Reset() { *m = L2tpv3SetTunnelCookiesReply{} }
358 func (*L2tpv3SetTunnelCookiesReply) GetMessageName() string { return "l2tpv3_set_tunnel_cookies_reply" }
359 func (*L2tpv3SetTunnelCookiesReply) GetCrcString() string { return "e8d4e804" }
360 func (*L2tpv3SetTunnelCookiesReply) GetMessageType() api.MessageType {
361 return api.ReplyMessage
364 func (m *L2tpv3SetTunnelCookiesReply) Size() (size int) {
368 size += 4 // m.Retval
371 func (m *L2tpv3SetTunnelCookiesReply) Marshal(b []byte) ([]byte, error) {
373 b = make([]byte, m.Size())
375 buf := codec.NewBuffer(b)
376 buf.EncodeInt32(m.Retval)
377 return buf.Bytes(), nil
379 func (m *L2tpv3SetTunnelCookiesReply) Unmarshal(b []byte) error {
380 buf := codec.NewBuffer(b)
381 m.Retval = buf.DecodeInt32()
385 // SwIfL2tpv3TunnelDetails defines message 'sw_if_l2tpv3_tunnel_details'.
386 type SwIfL2tpv3TunnelDetails struct {
387 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
388 InterfaceName string `binapi:"string[64],name=interface_name" json:"interface_name,omitempty"`
389 ClientAddress ip_types.Address `binapi:"address,name=client_address" json:"client_address,omitempty"`
390 OurAddress ip_types.Address `binapi:"address,name=our_address" json:"our_address,omitempty"`
391 LocalSessionID uint32 `binapi:"u32,name=local_session_id" json:"local_session_id,omitempty"`
392 RemoteSessionID uint32 `binapi:"u32,name=remote_session_id" json:"remote_session_id,omitempty"`
393 LocalCookie []uint64 `binapi:"u64[2],name=local_cookie" json:"local_cookie,omitempty"`
394 RemoteCookie uint64 `binapi:"u64,name=remote_cookie" json:"remote_cookie,omitempty"`
395 L2SublayerPresent bool `binapi:"bool,name=l2_sublayer_present" json:"l2_sublayer_present,omitempty"`
398 func (m *SwIfL2tpv3TunnelDetails) Reset() { *m = SwIfL2tpv3TunnelDetails{} }
399 func (*SwIfL2tpv3TunnelDetails) GetMessageName() string { return "sw_if_l2tpv3_tunnel_details" }
400 func (*SwIfL2tpv3TunnelDetails) GetCrcString() string { return "1dab5c7e" }
401 func (*SwIfL2tpv3TunnelDetails) GetMessageType() api.MessageType {
402 return api.ReplyMessage
405 func (m *SwIfL2tpv3TunnelDetails) Size() (size int) {
409 size += 4 // m.SwIfIndex
410 size += 64 // m.InterfaceName
411 size += 1 // m.ClientAddress.Af
412 size += 1 * 16 // m.ClientAddress.Un
413 size += 1 // m.OurAddress.Af
414 size += 1 * 16 // m.OurAddress.Un
415 size += 4 // m.LocalSessionID
416 size += 4 // m.RemoteSessionID
417 size += 8 * 2 // m.LocalCookie
418 size += 8 // m.RemoteCookie
419 size += 1 // m.L2SublayerPresent
422 func (m *SwIfL2tpv3TunnelDetails) Marshal(b []byte) ([]byte, error) {
424 b = make([]byte, m.Size())
426 buf := codec.NewBuffer(b)
427 buf.EncodeUint32(uint32(m.SwIfIndex))
428 buf.EncodeString(m.InterfaceName, 64)
429 buf.EncodeUint8(uint8(m.ClientAddress.Af))
430 buf.EncodeBytes(m.ClientAddress.Un.XXX_UnionData[:], 16)
431 buf.EncodeUint8(uint8(m.OurAddress.Af))
432 buf.EncodeBytes(m.OurAddress.Un.XXX_UnionData[:], 16)
433 buf.EncodeUint32(m.LocalSessionID)
434 buf.EncodeUint32(m.RemoteSessionID)
435 for i := 0; i < 2; i++ {
437 if i < len(m.LocalCookie) {
438 x = uint64(m.LocalCookie[i])
442 buf.EncodeUint64(m.RemoteCookie)
443 buf.EncodeBool(m.L2SublayerPresent)
444 return buf.Bytes(), nil
446 func (m *SwIfL2tpv3TunnelDetails) Unmarshal(b []byte) error {
447 buf := codec.NewBuffer(b)
448 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
449 m.InterfaceName = buf.DecodeString(64)
450 m.ClientAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
451 copy(m.ClientAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
452 m.OurAddress.Af = ip_types.AddressFamily(buf.DecodeUint8())
453 copy(m.OurAddress.Un.XXX_UnionData[:], buf.DecodeBytes(16))
454 m.LocalSessionID = buf.DecodeUint32()
455 m.RemoteSessionID = buf.DecodeUint32()
456 m.LocalCookie = make([]uint64, 2)
457 for i := 0; i < len(m.LocalCookie); i++ {
458 m.LocalCookie[i] = buf.DecodeUint64()
460 m.RemoteCookie = buf.DecodeUint64()
461 m.L2SublayerPresent = buf.DecodeBool()
465 // SwIfL2tpv3TunnelDump defines message 'sw_if_l2tpv3_tunnel_dump'.
466 type SwIfL2tpv3TunnelDump struct{}
468 func (m *SwIfL2tpv3TunnelDump) Reset() { *m = SwIfL2tpv3TunnelDump{} }
469 func (*SwIfL2tpv3TunnelDump) GetMessageName() string { return "sw_if_l2tpv3_tunnel_dump" }
470 func (*SwIfL2tpv3TunnelDump) GetCrcString() string { return "51077d14" }
471 func (*SwIfL2tpv3TunnelDump) GetMessageType() api.MessageType {
472 return api.RequestMessage
475 func (m *SwIfL2tpv3TunnelDump) Size() (size int) {
481 func (m *SwIfL2tpv3TunnelDump) Marshal(b []byte) ([]byte, error) {
483 b = make([]byte, m.Size())
485 buf := codec.NewBuffer(b)
486 return buf.Bytes(), nil
488 func (m *SwIfL2tpv3TunnelDump) Unmarshal(b []byte) error {
492 func init() { file_l2tp_binapi_init() }
493 func file_l2tp_binapi_init() {
494 api.RegisterMessage((*L2tpv3CreateTunnel)(nil), "l2tpv3_create_tunnel_596892cb")
495 api.RegisterMessage((*L2tpv3CreateTunnelReply)(nil), "l2tpv3_create_tunnel_reply_5383d31f")
496 api.RegisterMessage((*L2tpv3InterfaceEnableDisable)(nil), "l2tpv3_interface_enable_disable_3865946c")
497 api.RegisterMessage((*L2tpv3InterfaceEnableDisableReply)(nil), "l2tpv3_interface_enable_disable_reply_e8d4e804")
498 api.RegisterMessage((*L2tpv3SetLookupKey)(nil), "l2tpv3_set_lookup_key_c9892c86")
499 api.RegisterMessage((*L2tpv3SetLookupKeyReply)(nil), "l2tpv3_set_lookup_key_reply_e8d4e804")
500 api.RegisterMessage((*L2tpv3SetTunnelCookies)(nil), "l2tpv3_set_tunnel_cookies_b3f4faf7")
501 api.RegisterMessage((*L2tpv3SetTunnelCookiesReply)(nil), "l2tpv3_set_tunnel_cookies_reply_e8d4e804")
502 api.RegisterMessage((*SwIfL2tpv3TunnelDetails)(nil), "sw_if_l2tpv3_tunnel_details_1dab5c7e")
503 api.RegisterMessage((*SwIfL2tpv3TunnelDump)(nil), "sw_if_l2tpv3_tunnel_dump_51077d14")
506 // Messages returns list of all messages in this module.
507 func AllMessages() []api.Message {
508 return []api.Message{
509 (*L2tpv3CreateTunnel)(nil),
510 (*L2tpv3CreateTunnelReply)(nil),
511 (*L2tpv3InterfaceEnableDisable)(nil),
512 (*L2tpv3InterfaceEnableDisableReply)(nil),
513 (*L2tpv3SetLookupKey)(nil),
514 (*L2tpv3SetLookupKeyReply)(nil),
515 (*L2tpv3SetTunnelCookies)(nil),
516 (*L2tpv3SetTunnelCookiesReply)(nil),
517 (*SwIfL2tpv3TunnelDetails)(nil),
518 (*SwIfL2tpv3TunnelDump)(nil),