2 * Copyright (c) 2015 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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
15 #ifndef included_vnet_sr_h
16 #define included_vnet_sr_h
18 #include <vnet/vnet.h>
19 #include <vnet/sr/sr_packet.h>
20 #include <vnet/ip/ip6_packet.h>
22 #include <openssl/opensslconf.h>
26 #include <openssl/crypto.h>
27 #include <openssl/sha.h>
28 #include <openssl/opensslv.h>
29 #include <openssl/hmac.h>
34 } ip6_sr_tunnel_key_t;
37 /* src, dst address */
38 ip6_sr_tunnel_key_t key;
40 /* mask width for FIB entry */
43 /* first hop, to save 1 elt in the segment list */
44 ip6_address_t first_hop;
50 /* The actual ip6 sr header */
59 /* Key (header imposition case) */
60 ip6_address_t *src_address;
61 ip6_address_t *dst_address;
66 /* segment list, when inserting an ip6 SR header*/
67 ip6_address_t *segments;
70 * "Tag" list, aka segments inserted at the end of the list,
75 /* Shared secret => generate SHA-256 HMAC security fields */
78 /* Flags, e.g. cleanup, policy-list flags */
79 u16 flags_net_byte_order;
81 /* Delete the tunnnel? */
83 } ip6_sr_add_del_tunnel_args_t;
86 /* pool of tunnel instances, sr entry only */
87 ip6_sr_tunnel_t *tunnels;
89 /* find an sr "tunnel" by its outer-IP src/dst */
90 uword * tunnel_index_by_key;
92 /* ip6-lookup next index for imposition FIB entries */
93 u32 ip6_lookup_sr_next_index;
95 /* hmac key id by shared secret */
96 uword * hmac_key_by_shared_secret;
98 /* ip6-rewrite next index for reinstalling the original dst address */
99 u32 ip6_rewrite_sr_next_index;
101 /* application API callback */
104 /* validate hmac keys */
107 /* pool of hmac keys */
108 ip6_sr_hmac_key_t * hmac_keys;
114 /* enable debug spew */
118 vlib_main_t * vlib_main;
119 vnet_main_t * vnet_main;
122 ip6_sr_main_t sr_main;
124 format_function_t format_ip6_sr_header;
125 format_function_t format_ip6_sr_header_with_length;
127 vlib_node_registration_t ip6_sr_input_node;
129 int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a);
130 void vnet_register_sr_app_callback (void *cb);
132 #endif /* included_vnet_sr_h */