blob: 333d2882883ffb59c1ec59f6158c2c51177a8141 [file] [log] [blame]
Neale Ranns0bfe5d82016-08-25 15:29:12 +01001/*
2 * Copyright (c) 2016 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15/**
16 * @file
17 * @brief Common utility functions for IPv4, IPv6 and L2 LISP-GPE tunnels.
18 *
19 */
20
21#ifndef LISP_GPE_TUNNEL_H__
22#define LISP_GPE_TUNNEL_H__
23
24#include <vnet/lisp-gpe/lisp_gpe.h>
25#include <vnet/lisp-gpe/lisp_gpe_packet.h>
26
27/**
28 * Forward declaration
29 */
30struct lisp_gpe_adjacency_t_;
31
32/**
33 * A Key for a tunnel
34 */
35typedef struct lisp_gpe_tunnel_key_t_
36{
37 ip_address_t rmt;
38 ip_address_t lcl;
39 u32 fib_index;
40} lisp_gpe_tunnel_key_t;
41
42/**
43 * @brief A LISP GPE Tunnel.
44 *
45 * A tunnel represents an associatation between a local and remote RLOC.
46 * As such it represents a unique LISP rewrite.
47 */
Neale Ranns5e575b12016-10-03 09:40:25 +010048typedef struct lisp_gpe_tunnel_t_
Neale Ranns0bfe5d82016-08-25 15:29:12 +010049{
50 /**
51 * RLOC pair and rloc fib_index. This is the tunnel's key.
52 */
53 lisp_gpe_tunnel_key_t *key;
54
55 /**
56 * number of reference counting locks
57 */
58 u32 locks;
59
60 /**
61 * the FIB entry through which the remote rloc is reachable
62 s */
63 fib_node_index_t fib_entry_index;
Neale Ranns5e575b12016-10-03 09:40:25 +010064} lisp_gpe_tunnel_t;
Neale Ranns0bfe5d82016-08-25 15:29:12 +010065
66extern index_t lisp_gpe_tunnel_find_or_create_and_lock (const locator_pair_t *
67 pair,
68 u32 rloc_fib_index);
69
70extern void lisp_gpe_tunnel_unlock (index_t lgti);
71
Neale Ranns5e575b12016-10-03 09:40:25 +010072extern const lisp_gpe_tunnel_t *lisp_gpe_tunnel_get (index_t lgti);
Neale Ranns0bfe5d82016-08-25 15:29:12 +010073
Neale Ranns5e575b12016-10-03 09:40:25 +010074extern u8 *lisp_gpe_tunnel_build_rewrite (const lisp_gpe_tunnel_t * lgt,
Neale Ranns0bfe5d82016-08-25 15:29:12 +010075 const struct lisp_gpe_adjacency_t_
76 *ladj,
77 lisp_gpe_next_protocol_e
78 payload_proto);
79extern u8 *format_lisp_gpe_tunnel (u8 * s, va_list * args);
80
81#endif
82
83/*
84 * fd.io coding-style-patch-verification: ON
85 *
86 * Local Variables:
87 * eval: (c-set-style "gnu")
88 * End:
89 */