FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
stn.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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 #ifndef SRC_PLUGINS_STN_STN_H_
17 #define SRC_PLUGINS_STN_STN_H_
18 
19 #include <vlib/vlib.h>
20 #include <vnet/ip/ip4.h>
21 #include <vnet/ip/ip6.h>
22 #include <vppinfra/bihash_16_8.h>
23 
24 typedef struct {
25  ip46_address_t address;
28 } stn_rule_t;
29 
30 typedef struct {
31  /* pool of stn rules */
33 
34  /* number of rules */
36 
37  /* hash table used to retrieve the rule from the ip address */
38  clib_bihash_16_8_t rule_by_address_table;
39 
42 
44 } stn_main_t;
45 
46 typedef struct {
47  /** Destination address of intercepted packets */
48  ip46_address_t address;
49  /** TX interface to send packets to */
51  /** Whether to delete the rule */
54 
55 /**
56  * Add or delete an stn rule.
57  */
59 
60 extern stn_main_t stn_main;
61 
64 
65 #endif /* SRC_PLUGINS_STN_STN_H_ */
vlib.h
stn_rule_add_del
int stn_rule_add_del(stn_rule_add_del_args_t *args)
Add or delete an stn rule.
Definition: stn.c:285
stn_main
stn_main_t stn_main
Definition: stn.c:24
stn_rule_t::sw_if_index
u32 sw_if_index
Definition: stn.h:27
stn_rule_t::next_node_index
u32 next_node_index
Definition: stn.h:26
stn_main_t::rules
stn_rule_t * rules
Definition: stn.h:32
stn_rule_t
Definition: stn.h:24
u16
unsigned short u16
Definition: types.h:57
vm
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
stn_rule_add_del_args_t::del
u8 del
Whether to delete the rule.
Definition: stn.h:52
stn_rule_add_del_args_t::address
ip46_address_t address
Destination address of intercepted packets.
Definition: stn.h:48
stn_rule_add_del_args_t::sw_if_index
u32 sw_if_index
TX interface to send packets to.
Definition: stn.h:50
stn_api_init
clib_error_t * stn_api_init(vlib_main_t *vm, stn_main_t *sm)
Definition: stn_api.c:96
stn_main_t::msg_id_base
u16 msg_id_base
Definition: stn.h:43
stn_rule_add_del_args_t
Definition: stn.h:46
stn_main_t::punt_to_stn_ip4_next_index
u32 punt_to_stn_ip4_next_index
Definition: stn.h:40
stn_rule_t::address
ip46_address_t address
Definition: stn.h:25
stn_main_t::n_rules
u32 n_rules
Definition: stn.h:35
u32
unsigned int u32
Definition: types.h:88
stn_main_t::punt_to_stn_ip6_next_index
u32 punt_to_stn_ip6_next_index
Definition: stn.h:41
stn_main_t::rule_by_address_table
clib_bihash_16_8_t rule_by_address_table
Definition: stn.h:38
bihash_16_8.h
ip4.h
vlib_main_t
Definition: main.h:102
u8
unsigned char u8
Definition: types.h:56
clib_error_t
Definition: clib_error.h:21
stn_main_t
Definition: stn.h:30
ip6.h