nat: use correct data types for memory sizes
[vpp.git] / src / plugins / nat / nat66.h
1 /*
2  * Copyright (c) 2018 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 NAT66 global declarations
18  */
19 #ifndef __included_nat66_h__
20 #define __included_nat66_h__
21
22 #include <vppinfra/bihash_24_8.h>
23 #include <nat/nat.h>
24
25 typedef struct
26 {
27   ip6_address_t l_addr;
28   ip6_address_t e_addr;
29   u32 fib_index;
30 } nat66_static_mapping_t;
31
32 typedef struct
33 {
34   union
35   {
36     struct
37     {
38       ip6_address_t addr;
39       u32 fib_index;
40       u32 rsvd;
41     };
42     u64 as_u64[3];
43   };
44 } nat66_sm_key_t;
45
46 typedef struct
47 {
48   /** Interface pool */
49   snat_interface_t *interfaces;
50   /** Static mapping pool */
51   nat66_static_mapping_t *sm;
52   /** Static mapping by local address lookup table */
53   clib_bihash_24_8_t sm_l;
54   /** Static mapping by external address lookup table */
55   clib_bihash_24_8_t sm_e;
56   /** Session counters */
57   vlib_combined_counter_main_t session_counters;
58   /** node index **/
59   u32 in2out_node_index;
60   u32 out2in_node_index;
61
62   u32 outside_vrf_id;
63   u32 outside_fib_index;
64 } nat66_main_t;
65
66 extern nat66_main_t nat66_main;
67 extern vlib_node_registration_t nat66_in2out_node;
68 extern vlib_node_registration_t nat66_out2in_node;
69
70 void nat66_init (vlib_main_t * vm);
71 typedef int (*nat66_interface_walk_fn_t) (snat_interface_t * i, void *ctx);
72 void nat66_interfaces_walk (nat66_interface_walk_fn_t fn, void *ctx);
73 int nat66_interface_add_del (u32 sw_if_index, u8 is_inside, u8 is_add);
74 typedef int (*nat66_static_mapping_walk_fn_t) (nat66_static_mapping_t * sm,
75                                                void *ctx);
76 void nat66_static_mappings_walk (nat66_static_mapping_walk_fn_t fn,
77                                  void *ctx);
78 nat66_static_mapping_t *nat66_static_mapping_get (ip6_address_t * addr,
79                                                   u32 fib_index, u8 is_local);
80 int nat66_static_mapping_add_del (ip6_address_t * l_addr,
81                                   ip6_address_t * e_addr, u32 vrf_id,
82                                   u8 is_add);
83
84 #endif /* __included_nat66_h__ */
85
86 /*
87  * fd.io coding-style-patch-verification: ON
88  *
89  * Local Variables:
90  * eval: (c-set-style "gnu")
91  * End:
92  */