diff options
author | Florin Coras <fcoras@cisco.com> | 2017-11-05 23:07:07 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2017-11-06 21:45:22 +0000 |
commit | c97a7398fc465c480a3ac66cf4b0f91a034ed564 (patch) | |
tree | 31467dcc219751cd89903e83b66c3315e31be947 /src/vnet/session/session_rules_table.h | |
parent | a3d933c87f146df801aa3947c25b6f1b2538f847 (diff) |
session: add rule tags
Change-Id: Id5ebb410f509ac4c83d60e48efd54e00035e5ce6
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session_rules_table.h')
-rw-r--r-- | src/vnet/session/session_rules_table.h | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/src/vnet/session/session_rules_table.h b/src/vnet/session/session_rules_table.h index 27b0f8856f5..9bab61e7539 100644 --- a/src/vnet/session/session_rules_table.h +++ b/src/vnet/session/session_rules_table.h @@ -54,50 +54,67 @@ typedef CLIB_PACKED (struct }) session_mask_or_match_6_t; /* *INDENT-ON* */ +#define SESSION_RULE_TAG_MAX_LEN 64 +#define SESSION_RULES_TABLE_ACTION_DROP (((u32)~0) - 1) +#define SESSION_RULES_TABLE_INVALID_INDEX MMA_TABLE_INVALID_INDEX + typedef struct _session_rules_table_add_del_args { - u8 transport_proto; fib_prefix_t lcl; fib_prefix_t rmt; u16 lcl_port; u16 rmt_port; u32 action_index; + u8 *tag; u8 is_add; } session_rule_table_add_del_args_t; -#define SESSION_RULES_TABLE_ACTION_DROP (((u32)~0) - 1) +typedef struct _rule_tag +{ + u8 *tag; +} session_rule_tag_t; typedef struct _session_rules_table_t { /** - * Per fib proto and transport proto session rules tables + * Per fib proto session rules tables + */ + mma_rules_table_16_t session_rules_tables_16; + mma_rules_table_40_t session_rules_tables_40; + /** + * Hash table that maps tags to rules + */ + uword *rules_by_tag; + /** + * Pool of rules tags + */ + session_rule_tag_t *rule_tags; + /** + * Hash table that maps rule indices to tags */ - mma_rules_table_16_t session_rules_tables_16[TRANSPORT_N_PROTO]; - mma_rules_table_40_t session_rules_tables_40[TRANSPORT_N_PROTO]; + uword *tags_by_rules; } session_rules_table_t; -void *session_rules_table_get (session_rules_table_t * srt, - u8 transport_proto, u8 fib_proto); u32 session_rules_table_lookup4 (session_rules_table_t * srt, - u8 transport_proto, ip4_address_t * lcl_ip, + ip4_address_t * lcl_ip, ip4_address_t * rmt_ip, u16 lcl_port, u16 rmt_port); u32 session_rules_table_lookup6 (session_rules_table_t * srt, - u8 transport_proto, ip6_address_t * lcl_ip, + ip6_address_t * lcl_ip, ip6_address_t * rmt_ip, u16 lcl_port, u16 rmt_port); void session_rules_table_cli_dump (vlib_main_t * vm, - session_rules_table_t * srt, u8 fib_proto, - u8 transport_proto); + session_rules_table_t * srt, u8 fib_proto); void session_rules_table_show_rule (vlib_main_t * vm, session_rules_table_t * srt, - u8 transport_proto, ip46_address_t * lcl_ip, u16 lcl_port, ip46_address_t * rmt_ip, u16 rmt_port, u8 is_ip4); clib_error_t *session_rules_table_add_del (session_rules_table_t * srt, session_rule_table_add_del_args_t * args); +u8 *session_rules_table_rule_tag (session_rules_table_t * srt, u32 ri, + u8 is_ip4); void session_rules_table_init (session_rules_table_t * srt); #endif /* SRC_VNET_SESSION_SESSION_RULES_TABLE_H_ */ /* |