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:
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/transport.h>
22 #include <vnet/session/mma_16.h>
23 #include <vnet/session/mma_40.h>
26 typedef CLIB_PACKED (struct
39 }) session_mask_or_match_4_t;
41 typedef CLIB_PACKED (struct
54 }) session_mask_or_match_6_t;
57 typedef struct _session_rules_table_add_del_args
66 } session_rule_table_add_del_args_t;
68 #define SESSION_RULES_TABLE_ACTION_DROP (((u32)~0) - 1)
70 typedef struct _session_rules_table_t
73 * Per fib proto and transport proto session rules tables
75 mma_rules_table_16_t session_rules_tables_16[TRANSPORT_N_PROTO];
76 mma_rules_table_40_t session_rules_tables_40[TRANSPORT_N_PROTO];
77 } session_rules_table_t;
79 void *session_rules_table_get (session_rules_table_t * srt,
80 u8 transport_proto, u8 fib_proto);
81 u32 session_rules_table_lookup4 (session_rules_table_t * srt,
82 u8 transport_proto, ip4_address_t * lcl_ip,
83 ip4_address_t * rmt_ip, u16 lcl_port,
85 u32 session_rules_table_lookup6 (session_rules_table_t * srt,
86 u8 transport_proto, ip6_address_t * lcl_ip,
87 ip6_address_t * rmt_ip, u16 lcl_port,
89 void session_rules_table_cli_dump (vlib_main_t * vm,
90 session_rules_table_t * srt, u8 fib_proto,
92 void session_rules_table_show_rule (vlib_main_t * vm,
93 session_rules_table_t * srt,
95 ip46_address_t * lcl_ip, u16 lcl_port,
96 ip46_address_t * rmt_ip, u16 rmt_port,
98 clib_error_t *session_rules_table_add_del (session_rules_table_t * srt,
99 session_rule_table_add_del_args_t *
101 void session_rules_table_init (session_rules_table_t * srt);
102 #endif /* SRC_VNET_SESSION_SESSION_RULES_TABLE_H_ */
104 * fd.io coding-style-patch-verification: ON
107 * eval: (c-set-style "gnu")