2 * Copyright (c) 2017-2019 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.
16 #ifndef SRC_VNET_SESSION_SESSION_RULES_TABLE_H_
17 #define SRC_VNET_SESSION_SESSION_RULES_TABLE_H_
19 #include <vnet/vnet.h>
20 #include <vnet/fib/fib.h>
21 #include <vnet/session/session_types.h>
22 #include <vnet/session/transport.h>
23 #include <vnet/session/mma_16.h>
24 #include <vnet/session/mma_40.h>
27 typedef CLIB_PACKED (struct
40 }) session_mask_or_match_4_t;
42 typedef CLIB_PACKED (struct
55 }) session_mask_or_match_6_t;
58 #define SESSION_RULE_TAG_MAX_LEN 64
59 #define SESSION_RULES_TABLE_INVALID_INDEX MMA_TABLE_INVALID_INDEX
60 #define SESSION_RULES_TABLE_ACTION_DROP (MMA_TABLE_INVALID_INDEX - 1)
61 #define SESSION_RULES_TABLE_ACTION_ALLOW (MMA_TABLE_INVALID_INDEX - 2)
63 typedef struct _session_rules_table_add_del_args
72 } session_rule_table_add_del_args_t;
74 typedef struct _rule_tag
79 typedef struct _session_rules_table_t
82 * Per fib proto session rules tables
84 mma_rules_table_16_t session_rules_tables_16;
85 mma_rules_table_40_t session_rules_tables_40;
87 * Hash table that maps tags to rules
93 session_rule_tag_t *rule_tags;
95 * Hash table that maps rule indices to tags
98 } session_rules_table_t;
100 u32 session_rules_table_lookup4 (session_rules_table_t * srt,
101 ip4_address_t * lcl_ip,
102 ip4_address_t * rmt_ip, u16 lcl_port,
104 u32 session_rules_table_lookup6 (session_rules_table_t * srt,
105 ip6_address_t * lcl_ip,
106 ip6_address_t * rmt_ip, u16 lcl_port,
108 void session_rules_table_cli_dump (vlib_main_t * vm,
109 session_rules_table_t * srt, u8 fib_proto);
110 void session_rules_table_show_rule (vlib_main_t * vm,
111 session_rules_table_t * srt,
112 ip46_address_t * lcl_ip, u16 lcl_port,
113 ip46_address_t * rmt_ip, u16 rmt_port,
116 session_rules_table_add_del (session_rules_table_t *srt,
117 session_rule_table_add_del_args_t *args);
118 u8 *session_rules_table_rule_tag (session_rules_table_t * srt, u32 ri,
120 void session_rules_table_init (session_rules_table_t * srt);
121 void session_rules_table_free (session_rules_table_t *srt);
122 #endif /* SRC_VNET_SESSION_SESSION_RULES_TABLE_H_ */
124 * fd.io coding-style-patch-verification: ON
127 * eval: (c-set-style "gnu")