FD.io VPP  v18.07-34-g55fbdb9
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_ */
Definition: stn.h:24
Definition: stn.h:30
u32 sw_if_index
TX interface to send packets to.
Definition: stn.h:50
clib_bihash_16_8_t rule_by_address_table
Definition: stn.h:38
u32 n_rules
Definition: stn.h:35
unsigned char u8
Definition: types.h:56
stn_main_t stn_main
Definition: stn.c:25
ip46_address_t address
Destination address of intercepted packets.
Definition: stn.h:48
stn_rule_t * rules
Definition: stn.h:32
u8 del
Whether to delete the rule.
Definition: stn.h:52
unsigned int u32
Definition: types.h:88
int stn_rule_add_del(stn_rule_add_del_args_t *args)
Add or delete an stn rule.
Definition: stn.c:286
clib_error_t * stn_api_init(vlib_main_t *vm, stn_main_t *sm)
Definition: stn_api.c:201
unsigned short u16
Definition: types.h:57
u32 punt_to_stn_ip4_next_index
Definition: stn.h:40
vlib_main_t * vm
Definition: buffer.c:294
u32 next_node_index
Definition: stn.h:26
u32 punt_to_stn_ip6_next_index
Definition: stn.h:41
u16 msg_id_base
Definition: stn.h:43
u32 sw_if_index
Definition: stn.h:27
ip46_address_t address
Definition: stn.h:25