Reorganize source tree to use single autotools instance
[vpp.git] / src / vnet / dhcpv6 / proxy.h
1 /*
2  * proxy.h: dhcp proxy 
3  *
4  * Copyright (c) 2013 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef included_dhcpv6_proxy_h
19 #define included_dhcpv6_proxy_h
20
21 #include <vnet/vnet.h>
22 #include <vnet/ethernet/ethernet.h>
23 #include <vnet/ip/ip.h>
24 #include <vnet/ip/ip4.h>
25 #include <vnet/ip/ip6_packet.h>
26 #include <vnet/pg/pg.h>
27 #include <vnet/ip/format.h>
28 #include <vnet/ip/udp.h>
29 #include <vnet/dhcpv6/packet.h>
30
31 typedef enum {
32 #define dhcpv6_proxy_error(n,s) DHCPV6_PROXY_ERROR_##n,
33 #include <vnet/dhcpv6/proxy_error.def>
34 #undef dhcpv6_proxy_error
35   DHCPV6_PROXY_N_ERROR,
36 } dhcpv6_proxy_error_t;
37
38 typedef struct {
39   u32 oui;
40   u32 fib_id;
41 } dhcpv6_vss_id;
42
43 typedef union {
44   u8 as_u8[8];
45   dhcpv6_vss_id vpn_id;
46 } dhcpv6_vss_info;
47
48 typedef struct {
49   ip6_address_t dhcp6_server;
50   ip6_address_t dhcp6_src_address;
51   u32 insert_vss;
52   u32 server_fib6_index;
53   u32 valid;
54 } dhcpv6_server_t;
55
56 typedef struct {
57   /* Pool of DHCP servers */
58   dhcpv6_server_t * dhcp6_servers;
59
60   /* Pool of selected DHCP server. Zero is the default server */
61    u32 * dhcp6_server_index_by_rx_fib_index;
62
63   /* all DHCP servers address */
64   ip6_address_t all_dhcpv6_server_address;
65   ip6_address_t all_dhcpv6_server_relay_agent_address;
66
67   /* to drop pkts in server-to-client direction */
68   u32 error_drop_node_index;
69
70   dhcpv6_vss_info *vss;
71
72   /* hash lookup specific vrf_id -> VSS vector index*/
73   uword  *vss_index_by_vrf_id;
74    
75   /* convenience */
76   vlib_main_t * vlib_main;
77   vnet_main_t * vnet_main;
78 } dhcpv6_proxy_main_t;
79
80 dhcpv6_proxy_main_t dhcpv6_proxy_main;
81
82 int dhcpv6_proxy_set_server (ip6_address_t *addr, ip6_address_t *src_address,
83                              u32 fib_id, int insert_vss, int is_del);
84
85 int dhcpv6_proxy_set_vss(u32 tbl_id,
86                          u32 oui,
87                          u32 fib_id, 
88                          int is_del);
89
90 int dhcpv6_proxy_set_server_2 (ip6_address_t *addr, ip6_address_t *src_address,
91                              u32 rx_fib_id,
92                              u32 server_fib_id,
93                              int insert_vss, int is_del);
94
95 #endif /* included_dhcpv6_proxy_h */