Skip to content

Commit

Permalink
add some details
Browse files Browse the repository at this point in the history
  • Loading branch information
wqlxx committed Apr 21, 2013
1 parent b680813 commit 0a3afb1
Show file tree
Hide file tree
Showing 5 changed files with 357 additions and 258 deletions.
23 changes: 23 additions & 0 deletions cm_hash.c
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;
}

36 changes: 36 additions & 0 deletions cm_hash.h
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;

42 changes: 42 additions & 0 deletions common.h
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

Loading

0 comments on commit 0a3afb1

Please sign in to comment.