-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wqlxx
committed
Apr 21, 2013
1 parent
b680813
commit 0a3afb1
Showing
5 changed files
with
357 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*brief acl global entry hash key hook*/ | ||
static inline uint32 | ||
_sys_acl_entry_hash_key(void *data) | ||
{ | ||
sys_acl_entry_t *p_entry = (sys_acl_entry_t *)data; | ||
return p_entry->entry_id; | ||
} | ||
|
||
/*brief acl global entry hash comparison hook*/ | ||
static inline bool | ||
_sys_acl_entry_hash_cmp(void *data1, void *data2) | ||
{ | ||
sys_acl_entry_t *p_entry1 = (sys_acl_entry_t *)data1; | ||
sys_acl_entry_t *p_entry2 = (sys_acl_entry_t *)data2; | ||
|
||
if(p_entry1->entry_id == p_entry2->entry_id); | ||
{ | ||
return TRUE; | ||
} | ||
|
||
return FALSE; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
|
||
struct cm_hash_backet_s | ||
{ | ||
struct cm_hash_backet_s *next; | ||
|
||
uint32 key; | ||
|
||
void *data; | ||
}; | ||
typedef struct cm_hash_backet_s cm_hash_backet_t; | ||
|
||
|
||
struct cm_hash_s | ||
{ | ||
cm_hash_backet_t ***index; | ||
|
||
/* <Hash table size = block_size * block_num*/ | ||
|
||
/* Hash table block num*/ | ||
uint16 block_num; | ||
|
||
/* Hash table block size*/ | ||
uint16 block_size; | ||
|
||
/*current hash backet size*/ | ||
uint32 count; | ||
|
||
/* key make function*/ | ||
uint32 (*hash_key)(void* data); | ||
|
||
/*data compare function*/ | ||
bool (*hash_cmp)(void* backet_data, void* data); | ||
}; | ||
typedef struct cm_hash_s cm_hash_t; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#ifndef _COMMON_H_ | ||
#define _COMMON_H_ 1 | ||
|
||
enum error_e{ | ||
CM_E_NONE, | ||
CM_E_ERR, | ||
CM_E_ERR_RET, | ||
CM_E_ZERO, | ||
CM_E_PTR_INVALID, | ||
CM_E_NO_MEMORY, | ||
CM_E_ACLQOS_DIFFERENT_TYPE, | ||
CM_E_ACLQOS_ENTRY_EXIST, | ||
CM_E_ACLQOS_LABEL_NOT_EXIST, | ||
CM_E_ACLQOS_ENTRY_NOT_EXIST, | ||
CM_E_ACLQOS_INVALID_KEY_TYPE, | ||
CM_E_ACLQOS_INVALID_ACTION, | ||
CM_E_ACL_GET_BLOCK_INDEX_FAILED | ||
}; | ||
typedef enum error_e error_t; | ||
|
||
enum cm_action_flag_e{ | ||
CTC_ACLQOS_ACTION_DISCARD_FLAG, | ||
CTC_ACLQOS_ACTION_DENY_BRIDGE_FLAG, | ||
CTC_ACLQOS_ACTION_DENY_LEARN_FLAG, | ||
CTC_ACLQOS_ACTION_DENY_ROUTE_FLAG, | ||
CTC_ACLQOS_ACTION_DENY_REPLACE_COS_FLAG, | ||
CTC_ACLQOS_ACTION_DENY_REPLACE_DSCP_FLAG, | ||
CTC_ACLQOS_ACTION_STATS_FLAG, | ||
CTC_ACLQOS_ACTION_FLOW_ID_FLAGS, | ||
CTC_ACLQOS_ACTION_FLOW_ID_FLAG, | ||
CTC_ACLQOS_ACTION_FLOW_POLICER_FLAG, | ||
CTC_ACLQOS_ACTION_COPY_TO_CPU_FLAG, | ||
CTC_ACLQOS_ACTION_INVALID_FLAG | ||
}; | ||
typedef enum cm_action_flag_e cm_action_flags_t; | ||
|
||
|
||
#define CM_ETH_ADDR_LEN 6 | ||
typedef uint8 mac_addr_t[CM_ETH_ADDR_LEN]; | ||
|
||
#endif | ||
|
Oops, something went wrong.