diff --git a/src/modules/pike/ip_tree.c b/src/modules/pike/ip_tree.c index 69e43554b0f..e8b93b84f2b 100644 --- a/src/modules/pike/ip_tree.c +++ b/src/modules/pike/ip_tree.c @@ -32,19 +32,19 @@ -static struct ip_tree* root = 0; +static pike_ip_tree_t* pike_root = 0; -static inline struct ip_node* prv_get_tree_branch(unsigned char b) +static inline pike_ip_node_t* prv_get_tree_branch(unsigned char b) { - return root->entries[b].node; + return pike_root->entries[b].node; } /* locks a tree branch */ static inline void prv_lock_tree_branch(unsigned char b) { - lock_set_get( root->entry_lock_set, root->entries[b].lock_idx); + lock_set_get(pike_root->entry_lock_set, pike_root->entries[b].lock_idx); } @@ -52,12 +52,12 @@ static inline void prv_lock_tree_branch(unsigned char b) /* unlocks a tree branch */ static inline void prv_unlock_tree_branch(unsigned char b) { - lock_set_release( root->entry_lock_set, root->entries[b].lock_idx); + lock_set_release(pike_root->entry_lock_set, pike_root->entries[b].lock_idx); } /* wrapper functions */ -struct ip_node* get_tree_branch(unsigned char b) +pike_ip_node_t* get_tree_branch(unsigned char b) { return prv_get_tree_branch(b); } @@ -111,43 +111,48 @@ int init_ip_tree(int maximum_hits) int size; int i; - /* create the root */ - root = (struct ip_tree*)shm_malloc(sizeof(struct ip_tree)); - if (root==0) { + /* create the pike_root */ + pike_root = (pike_ip_tree_t*)shm_malloc(sizeof(pike_ip_tree_t)); + if (pike_root==0) { LM_ERR("shm malloc failed\n"); goto error; } - memset( root, 0, sizeof(struct ip_tree)); + memset(pike_root, 0, sizeof(pike_ip_tree_t)); /* init lock set */ size = MAX_IP_BRANCHES; - root->entry_lock_set = init_lock_set( &size ); - if (root->entry_lock_set==0) { + pike_root->entry_lock_set = init_lock_set( &size ); + if (pike_root->entry_lock_set==0) { LM_ERR("failed to create locks\n"); goto error; } /* assign to each branch a lock */ for(i=0;ientries[i].node = 0; - root->entries[i].lock_idx = i % size; + pike_root->entries[i].node = 0; + pike_root->entries[i].lock_idx = i % size; } - root->max_hits = maximum_hits; + pike_root->max_hits = maximum_hits; return 0; error: - if (root) - shm_free(root); + if (pike_root) { + shm_free(pike_root); + pike_root = NULL; + } return -1; } -unsigned int get_max_hits() { return root != 0 ? root->max_hits : -1; } +unsigned int get_max_hits() +{ + return (pike_root != 0) ? pike_root->max_hits : -1; +} /* destroy an ip_node and all nodes under it; the nodes must be first removed * from any other lists/timers */ -static inline void destroy_ip_node(struct ip_node *node) +static inline void destroy_ip_node(pike_ip_node_t *node) { - struct ip_node *foo, *bar; + pike_ip_node_t *foo, *bar; foo = node->kids; while (foo){ @@ -166,22 +171,22 @@ void destroy_ip_tree(void) { int i; - if (root==0) + if (pike_root==0) return; /* destroy and free the lock set */ - if (root->entry_lock_set) { - lock_set_destroy(root->entry_lock_set); - lock_set_dealloc(root->entry_lock_set); + if (pike_root->entry_lock_set) { + lock_set_destroy(pike_root->entry_lock_set); + lock_set_dealloc(pike_root->entry_lock_set); } /* destroy all the nodes */ for(i=0;ientries[i].node) - destroy_ip_node(root->entries[i].node); + if (pike_root->entries[i].node) + destroy_ip_node(pike_root->entries[i].node); - shm_free( root ); - root = 0; + shm_free( pike_root ); + pike_root = 0; return; } @@ -189,16 +194,16 @@ void destroy_ip_tree(void) /* builds a new ip_node corresponding to a byte value */ -static inline struct ip_node *new_ip_node(unsigned char byte) +static inline pike_ip_node_t *new_ip_node(unsigned char byte) { - struct ip_node *new_node; + pike_ip_node_t *new_node; - new_node = (struct ip_node*)shm_malloc(sizeof(struct ip_node)); + new_node = (pike_ip_node_t*)shm_malloc(sizeof(pike_ip_node_t)); if (!new_node) { LM_ERR("no more shm mem\n"); return 0; } - memset( new_node, 0, sizeof(struct ip_node)); + memset( new_node, 0, sizeof(pike_ip_node_t)); new_node->byte = byte; return new_node; } @@ -206,9 +211,9 @@ static inline struct ip_node *new_ip_node(unsigned char byte) /* splits from the current node (dad) a new child */ -struct ip_node *split_node(struct ip_node* dad, unsigned char byte) +pike_ip_node_t *split_node(pike_ip_node_t* dad, unsigned char byte) { - struct ip_node *new_node; + pike_ip_node_t *new_node; /* create a new node */ if ( (new_node=new_ip_node(byte))==0 ) @@ -233,32 +238,32 @@ struct ip_node *split_node(struct ip_node* dad, unsigned char byte) #define is_hot_non_leaf(_node) \ - ( (_node)->hits[PREV_POS]>=root->max_hits>>2 ||\ - (_node)->hits[CURR_POS]>=root->max_hits>>2 ||\ + ( (_node)->hits[PREV_POS]>=pike_root->max_hits>>2 ||\ + (_node)->hits[CURR_POS]>=pike_root->max_hits>>2 ||\ (((_node)->hits[PREV_POS]+(_node)->hits[CURR_POS])>>1)>=\ - root->max_hits>>2 ) + pike_root->max_hits>>2 ) #define is_hot_leaf(_node) \ - ( (_node)->leaf_hits[PREV_POS]>=root->max_hits ||\ - (_node)->leaf_hits[CURR_POS]>=root->max_hits ||\ + ( (_node)->leaf_hits[PREV_POS]>=pike_root->max_hits ||\ + (_node)->leaf_hits[CURR_POS]>=pike_root->max_hits ||\ (((_node)->leaf_hits[PREV_POS]+(_node)->leaf_hits[CURR_POS])>>1)>=\ - root->max_hits ) + pike_root->max_hits ) #define is_warm_leaf(_node) \ - ( (_node)->hits[CURR_POS]>=root->max_hits>>2 ) + ( (_node)->hits[CURR_POS]>=pike_root->max_hits>>2 ) #define MAX_TYPE_VAL(_x) \ (( (1<<(8*sizeof(_x)-1))-1 )|( (1<<(8*sizeof(_x)-1)) )) -int is_node_hot_leaf(struct ip_node *node) +int is_node_hot_leaf(pike_ip_node_t *node) { return is_hot_leaf(node); } /*! \brief Used by the rpc function */ char *node_status_array[] = {"", "WARM", "HOT", "ALL"}; -node_status_t node_status(struct ip_node *node) +pike_node_status_t node_status(pike_ip_node_t *node) { if ( is_hot_leaf(node) ) return NODE_STATUS_HOT; @@ -272,14 +277,14 @@ node_status_t node_status(struct ip_node *node) /* mark with one more hit the given IP address - */ -struct ip_node* mark_node(unsigned char *ip,int ip_len, - struct ip_node **father,unsigned char *flag) +pike_ip_node_t* mark_node(unsigned char *ip,int ip_len, + pike_ip_node_t **father,unsigned char *flag) { - struct ip_node *node; - struct ip_node *kid; + pike_ip_node_t *node; + pike_ip_node_t *kid; int byte_pos; - kid = root->entries[ ip[0] ].node; + kid = pike_root->entries[ ip[0] ].node; node = 0; byte_pos = 0; @@ -325,8 +330,8 @@ struct ip_node* mark_node(unsigned char *ip,int ip_len, node->hits[CURR_POS] = 1; node->branch = ip[0]; *flag = NEW_NODE ; - /* set this node as root of the branch starting with first byte of IP*/ - root->entries[ ip[0] ].node = node; + /* set this node as pike_root of the branch starting with first byte of IP*/ + pike_root->entries[ ip[0] ].node = node; } else{ /* only a non-empty prefix of the IP was found */ if ( node->hits[CURR_POS]hits[CURR_POS])-1 ) @@ -352,13 +357,13 @@ struct ip_node* mark_node(unsigned char *ip,int ip_len, /* remove and destroy a IP node along with its subtree */ -void remove_node(struct ip_node *node) +void remove_node(pike_ip_node_t *node) { LM_DBG("destroying node %p\n",node); - /* is it a branch root node? (these nodes have no prev (father)) */ + /* is it a branch pike_root node? (these nodes have no prev (father)) */ if (node->prev==0) { - assert(root->entries[node->byte].node==node); - root->entries[node->byte].node = 0; + assert(pike_root->entries[node->byte].node==node); + pike_root->entries[node->byte].node = 0; } else { /* unlink it from kids list */ if (node->prev->kids==node) @@ -376,9 +381,9 @@ void remove_node(struct ip_node *node) destroy_ip_node(node); } -static void print_node(struct ip_node *node,int sp, FILE *f) +static void print_node(pike_ip_node_t *node,int sp, FILE *f) { - struct ip_node *foo; + pike_ip_node_t *foo; /* print current node */ if (!f) { diff --git a/src/modules/pike/ip_tree.h b/src/modules/pike/ip_tree.h index 1ae4c091b60..42817157733 100644 --- a/src/modules/pike/ip_tree.h +++ b/src/modules/pike/ip_tree.h @@ -44,59 +44,57 @@ #define NODE_IPLEAF_FLAG (1<<2) #define NODE_ISRED_FLAG (1<<3) -struct ip_node -{ +typedef struct pike_ip_node { unsigned int expires; unsigned short leaf_hits[2]; unsigned short hits[2]; unsigned char byte; unsigned char branch; - volatile unsigned short flags; - struct list_link timer_ll; - struct ip_node *prev; - struct ip_node *next; - struct ip_node *kids; -}; + volatile unsigned short flags; + pike_list_link_t timer_ll; + struct pike_ip_node *prev; + struct pike_ip_node *next; + struct pike_ip_node *kids; +} pike_ip_node_t; -struct ip_tree -{ +typedef struct ip_tree { struct entry { - struct ip_node *node; - int lock_idx; + pike_ip_node_t *node; + int lock_idx; } entries[MAX_IP_BRANCHES]; - unsigned short max_hits; - gen_lock_set_t *entry_lock_set; -}; + unsigned short max_hits; + gen_lock_set_t *entry_lock_set; +} pike_ip_tree_t; #define ll2ipnode(ptr) \ - ((struct ip_node*)((char *)(ptr)-\ - (unsigned long)(&((struct ip_node*)0)->timer_ll))) + ((pike_ip_node_t*)((char *)(ptr)-\ + (unsigned long)(&((pike_ip_node_t*)0)->timer_ll))) -int init_ip_tree(int); -void destroy_ip_tree(void); -struct ip_node* mark_node( unsigned char *ip, int ip_len, - struct ip_node **father, unsigned char *flag); -void remove_node(struct ip_node *node); -int is_node_hot_leaf(struct ip_node *node); +int init_ip_tree(int); +void destroy_ip_tree(void); +pike_ip_node_t* mark_node( unsigned char *ip, int ip_len, + pike_ip_node_t **father, unsigned char *flag); +void remove_node(pike_ip_node_t *node); +int is_node_hot_leaf(pike_ip_node_t *node); void lock_tree_branch(unsigned char b); void unlock_tree_branch(unsigned char b); -struct ip_node* get_tree_branch(unsigned char b); +pike_ip_node_t* get_tree_branch(unsigned char b); typedef enum { NODE_STATUS_OK = 0, NODE_STATUS_WARM = 1, NODE_STATUS_HOT = 2, NODE_STATUS_ALL = 3 /** used for status matching */ -} node_status_t; -node_status_t node_status(struct ip_node *node); +} pike_node_status_t; +pike_node_status_t node_status(pike_ip_node_t *node); extern char *node_status_array[]; unsigned int get_max_hits(); -void print_tree( FILE *f); +void print_tree(FILE *f); #endif diff --git a/src/modules/pike/pike.c b/src/modules/pike/pike.c index ea88540aef0..7a85d826d96 100644 --- a/src/modules/pike/pike.c +++ b/src/modules/pike/pike.c @@ -52,14 +52,14 @@ void pike_exit(void); /* parameters */ -static int time_unit = 2; -static int max_reqs = 30; -int timeout = 120; +static int pike_time_unit = 2; +static int pike_max_reqs = 30; +int pike_timeout = 120; int pike_log_level = L_WARN; /* global variables */ -gen_lock_t* timer_lock=0; -struct list_link* timer = 0; +gen_lock_t *pike_timer_lock = 0; +pike_list_link_t *pike_timer = 0; static cmd_export_t cmds[]={ @@ -68,10 +68,10 @@ static cmd_export_t cmds[]={ }; static param_export_t params[]={ - {"sampling_time_unit", INT_PARAM, &time_unit}, - {"reqs_density_per_unit", INT_PARAM, &max_reqs}, - {"remove_latency", INT_PARAM, &timeout}, - {"pike_log_level", INT_PARAM, &pike_log_level}, + {"sampling_time_unit", INT_PARAM, &pike_time_unit}, + {"reqs_density_per_unit", INT_PARAM, &pike_max_reqs}, + {"remove_latency", INT_PARAM, &pike_timeout}, + {"pike_log_level", INT_PARAM, &pike_log_level}, {0,0,0} }; @@ -102,34 +102,34 @@ static int pike_init(void) } /* alloc the timer lock */ - timer_lock=lock_alloc(); - if (timer_lock==0) { + pike_timer_lock=lock_alloc(); + if (pike_timer_lock==0) { LM_ERR(" alloc locks failed!\n"); goto error1; } /* init the lock */ - if (lock_init(timer_lock)==0){ + if (lock_init(pike_timer_lock)==0){ LM_ERR(" init lock failed\n"); goto error1; } /* init the IP tree */ - if ( init_ip_tree(max_reqs)!=0 ) { + if ( init_ip_tree(pike_max_reqs)!=0 ) { LM_ERR(" ip_tree creation failed!\n"); goto error2; } /* init timer list */ - timer = (struct list_link*)shm_malloc(sizeof(struct list_link)); - if (timer==0) { - LM_ERR(" cannot alloc shm mem for timer!\n"); + pike_timer = (pike_list_link_t*)shm_malloc(sizeof(pike_list_link_t)); + if (pike_timer==0) { + LM_ERR("cannot alloc shm mem for timer!\n"); goto error3; } - timer->next = timer->prev = timer; + pike_timer->next = pike_timer->prev = pike_timer; /* registering timing functions */ register_timer( clean_routine , 0, 1 ); - register_timer( swap_routine , 0, time_unit ); + register_timer( swap_routine , 0, pike_time_unit ); /* Register counter */ pike_counter_init(); @@ -138,10 +138,10 @@ static int pike_init(void) error3: destroy_ip_tree(); error2: - lock_destroy(timer_lock); + lock_destroy(pike_timer_lock); error1: - if (timer_lock) lock_dealloc(timer_lock); - timer_lock = 0; + if (pike_timer_lock) lock_dealloc(pike_timer_lock); + pike_timer_lock = 0; return -1; } @@ -150,15 +150,15 @@ static int pike_init(void) void pike_exit(void) { /* destroy semaphore */ - if (timer_lock) { - lock_destroy(timer_lock); - lock_dealloc(timer_lock); + if (pike_timer_lock) { + lock_destroy(pike_timer_lock); + lock_dealloc(pike_timer_lock); } /* empty the timer list head */ - if (timer) { - shm_free(timer); - timer = 0; + if (pike_timer) { + shm_free(pike_timer); + pike_timer = 0; } /* destroy the IP tree */ diff --git a/src/modules/pike/pike_funcs.c b/src/modules/pike/pike_funcs.c index 24050906806..804ebb6ec0a 100644 --- a/src/modules/pike/pike_funcs.c +++ b/src/modules/pike/pike_funcs.c @@ -39,9 +39,9 @@ -extern gen_lock_t* timer_lock; -extern struct list_link* timer; -extern int timeout; +extern gen_lock_t* pike_timer_lock; +extern pike_list_link_t* pike_timer; +extern int pike_timeout; extern int pike_log_level; counter_handle_t blocked; @@ -55,8 +55,8 @@ void pike_counter_init() int pike_check_req(sip_msg_t *msg) { - struct ip_node *node; - struct ip_node *father; + pike_ip_node_t *node; + pike_ip_node_t *father; unsigned char flags; struct ip_addr* ip; @@ -93,12 +93,12 @@ int pike_check_req(sip_msg_t *msg) node->flags, flags); /* update the timer */ - lock_get(timer_lock); + lock_get(pike_timer_lock); if ( flags&NEW_NODE ) { /* put this node into the timer list and remove its * father only if this has one kid and is not a LEAF_NODE*/ - node->expires = get_ticks() + timeout; - append_to_timer( timer, &(node->timer_ll) ); + node->expires = get_ticks() + pike_timeout; + append_to_timer( pike_timer, &(node->timer_ll) ); node->flags |= NODE_INTIMER_FLAG; if (father) { LM_DBG("father %p: flags=%d kids->next=%p\n", @@ -110,7 +110,7 @@ int pike_check_req(sip_msg_t *msg) /* if the node is maked as expired by timer, let the timer * to finish and remove the node */ if ( !(father->flags&NODE_EXPIRED_FLAG) ) { - remove_from_timer( timer, &(father->timer_ll) ); + remove_from_timer( pike_timer, &(father->timer_ll) ); father->flags &= ~NODE_INTIMER_FLAG; } else { father->flags &= ~NODE_EXPIRED_FLAG; @@ -129,8 +129,8 @@ int pike_check_req(sip_msg_t *msg) /* if node exprired, ignore the current hit and let is * expire in timer process */ if ( !(flags&NO_UPDATE) && !(node->flags&NODE_EXPIRED_FLAG) ) { - node->expires = get_ticks() + timeout; - update_in_timer( timer, &(node->timer_ll) ); + node->expires = get_ticks() + pike_timeout; + update_in_timer( pike_timer, &(node->timer_ll) ); } } else { /* debug */ @@ -140,8 +140,8 @@ int pike_check_req(sip_msg_t *msg) assert( !(node->flags&NODE_IPLEAF_FLAG) && node->kids ); } } - /*print_timer_list( timer );*/ /* debug*/ - lock_release(timer_lock); + /*print_timer_list( pike_timer );*/ /* debug*/ + lock_release(pike_timer_lock); unlock_tree_branch( ip->u.addr[0] ); /*print_tree( 0 );*/ /* debug */ @@ -167,28 +167,28 @@ int w_pike_check_req(struct sip_msg *msg, char *foo, char *bar) void clean_routine(unsigned int ticks , void *param) { static unsigned char mask[32]; /* 256 positions mask */ - struct list_link head; - struct list_link *ll; - struct ip_node *dad; - struct ip_node *node; + pike_list_link_t head; + pike_list_link_t *ll; + pike_ip_node_t *dad; + pike_ip_node_t *node; int i; /* LM_DBG("entering (%d)\n",ticks); */ /* before locking check first if the list is not empty and if can * be at least one element removed */ - if (timer==0 || is_list_empty( timer )) return; /* quick exit */ + if (pike_timer==0 || is_list_empty( pike_timer )) return; /* quick exit */ - memset(&head, 0, sizeof(struct list_link)); + memset(&head, 0, sizeof(pike_list_link_t)); /* get the expired elements */ - lock_get( timer_lock ); + lock_get( pike_timer_lock ); /* check again for empty list */ - if (is_list_empty(timer) || (ll2ipnode(timer->next)->expires>ticks )){ - lock_release( timer_lock ); + if (is_list_empty(pike_timer) || (ll2ipnode(pike_timer->next)->expires>ticks )){ + lock_release( pike_timer_lock ); return; } - check_and_split_timer( timer, ticks, &head, mask); - /*print_timer_list(timer);*/ /* debug */ - lock_release( timer_lock ); + check_and_split_timer( pike_timer, ticks, &head, mask); + /*print_timer_list(pike_timer);*/ /* debug */ + lock_release( pike_timer_lock ); /*print_tree( 0 );*/ /*debug*/ /* got something back? */ @@ -244,12 +244,12 @@ void clean_routine(unsigned int ticks , void *param) /* put it in the list only if it's not an IP leaf * (in this case, it's already there) */ if ( !(dad->flags&NODE_IPLEAF_FLAG) ) { - lock_get(timer_lock); - dad->expires = get_ticks() + timeout; + lock_get(pike_timer_lock); + dad->expires = get_ticks() + pike_timeout; assert( !has_timer_set(&(dad->timer_ll)) ); - append_to_timer( timer, &(dad->timer_ll)); + append_to_timer(pike_timer, &(dad->timer_ll)); dad->flags |= NODE_INTIMER_FLAG; - lock_release(timer_lock); + lock_release(pike_timer_lock); } else { assert( has_timer_set(&(dad->timer_ll)) ); } @@ -267,7 +267,7 @@ void clean_routine(unsigned int ticks , void *param) -static inline void refresh_node( struct ip_node *node) +static inline void refresh_node( pike_ip_node_t *node) { for( ; node ; node=node->next ) { node->hits[PREV_POS] = node->hits[CURR_POS]; @@ -288,7 +288,7 @@ static inline void refresh_node( struct ip_node *node) void swap_routine( unsigned int ticks, void *param) { - struct ip_node *node; + pike_ip_node_t *node; int i; /* LM_DBG("entering \n"); */ diff --git a/src/modules/pike/pike_funcs.h b/src/modules/pike/pike_funcs.h index def26261b73..c41aa7b3f07 100644 --- a/src/modules/pike/pike_funcs.h +++ b/src/modules/pike/pike_funcs.h @@ -28,7 +28,7 @@ void pike_counter_init(void); int pike_check_req(sip_msg_t *msg); -int w_pike_check_req(struct sip_msg *msg, char *foo, char *bar); +int w_pike_check_req(sip_msg_t *msg, char *foo, char *bar); void clean_routine(unsigned int, void*); void swap_routine(unsigned int, void*); diff --git a/src/modules/pike/pike_rpc.c b/src/modules/pike/pike_rpc.c index 58312a018e7..6c5797eba44 100644 --- a/src/modules/pike/pike_rpc.c +++ b/src/modules/pike/pike_rpc.c @@ -39,11 +39,11 @@ static unsigned int g_max_hits = 0; -static void traverse_subtree( struct ip_node *node, int depth, int options ) +static void traverse_subtree( pike_ip_node_t *node, int depth, int options ) { static unsigned char ip_addr[MAX_DEPTH]; - struct ip_node *foo; + pike_ip_node_t *foo; DBG("pike:rpc traverse_subtree, depth: %d, byte: %d", depth, node->byte); diff --git a/src/modules/pike/pike_rpc.h b/src/modules/pike/pike_rpc.h index c4ba1560110..23d0189240b 100644 --- a/src/modules/pike/pike_rpc.h +++ b/src/modules/pike/pike_rpc.h @@ -23,7 +23,7 @@ #include "../../core/rpc.h" #include "../../core/rpc_lookup.h" -extern rpc_export_t pike_rpc_methods[]; +extern rpc_export_t pike_rpc_methods[]; #endif diff --git a/src/modules/pike/pike_top.c b/src/modules/pike/pike_top.c index 62d23b0fc3a..e0bc3074620 100644 --- a/src/modules/pike/pike_top.c +++ b/src/modules/pike/pike_top.c @@ -76,7 +76,7 @@ static char *print_addr(unsigned char *ip, int iplen) int pike_top_add_entry( unsigned char *ip_addr, int addr_len, unsigned short leaf_hits[2], unsigned short hits[2], - unsigned int expires, node_status_t status ) + unsigned int expires, pike_node_status_t status ) { struct TopListItem_t *new_item = (struct TopListItem_t *)malloc(sizeof(struct TopListItem_t)); diff --git a/src/modules/pike/pike_top.h b/src/modules/pike/pike_top.h index b6f3aeaa2b9..aedcb8d178f 100644 --- a/src/modules/pike/pike_top.h +++ b/src/modules/pike/pike_top.h @@ -32,7 +32,7 @@ struct TopListItem_t { unsigned int leaf_hits[2]; unsigned int hits[2]; unsigned int expires; /*!< in seconds */ - node_status_t status; + pike_node_status_t status; struct TopListItem_t *next; }; @@ -40,7 +40,7 @@ struct TopListItem_t { // returns 1 when OK and 0 when failed int pike_top_add_entry( unsigned char *ip_addr, int addr_len, unsigned short leaf_hits[2], unsigned short hits[2], - unsigned int expires, node_status_t status ); + unsigned int expires, pike_node_status_t status ); struct TopListItem_t *pike_top_get_root(); void pike_top_list_clear(); diff --git a/src/modules/pike/timer.c b/src/modules/pike/timer.c index 5fc7bbe1f11..84b1c63d8a3 100644 --- a/src/modules/pike/timer.c +++ b/src/modules/pike/timer.c @@ -28,7 +28,7 @@ -void append_to_timer(struct list_link *head, struct list_link *new_ll ) +void append_to_timer(pike_list_link_t *head, pike_list_link_t *new_ll ) { LM_DBG("%p in %p(%p,%p)\n", new_ll, head,head->prev,head->next); assert( !has_timer_set(new_ll) ); @@ -41,7 +41,7 @@ void append_to_timer(struct list_link *head, struct list_link *new_ll ) -void remove_from_timer(struct list_link *head, struct list_link *ll) +void remove_from_timer(pike_list_link_t *head, pike_list_link_t *ll) { LM_DBG("%p from %p(%p,%p)\n", ll, head,head->prev,head->next); assert( has_timer_set(ll) ); @@ -55,11 +55,11 @@ void remove_from_timer(struct list_link *head, struct list_link *ll) /* "head" list MUST not be empty */ -void check_and_split_timer(struct list_link *head, unsigned int time, - struct list_link *split, unsigned char *mask) +void check_and_split_timer(pike_list_link_t *head, unsigned int time, + pike_list_link_t *split, unsigned char *mask) { - struct list_link *ll; - struct ip_node *node; + pike_list_link_t *ll; + pike_ip_node_t *node; unsigned char b; int i; @@ -93,10 +93,7 @@ void check_and_split_timer(struct list_link *head, unsigned int time, ll->prev = head; } - LM_DBG("succ. to split (h=%p)(p=%p,n=%p)\n", head,head->prev,head->next); + LM_DBG("succeeded to split (h=%p)(p=%p,n=%p)\n", head, head->prev, head->next); return; } - - - diff --git a/src/modules/pike/timer.h b/src/modules/pike/timer.h index 043512531d6..fcb0dc8e557 100644 --- a/src/modules/pike/timer.h +++ b/src/modules/pike/timer.h @@ -25,10 +25,10 @@ #define _PIKE_TIMER_H -struct list_link { - struct list_link *next; - struct list_link *prev; -}; +typedef struct pike_list_link { + struct pike_list_link *next; + struct pike_list_link *prev; +} pike_list_link_t; #define has_timer_set(_ll) \ @@ -37,19 +37,19 @@ struct list_link { #define is_list_empty(_head) \ ((_head)->next == (_head)) -#define update_in_timer( _head, _ll) \ +#define update_in_timer(_head, _ll) \ do { \ - remove_from_timer( _head, _ll);\ - append_to_timer( _head, _ll); \ + remove_from_timer(_head, _ll);\ + append_to_timer(_head, _ll); \ }while(0) -void append_to_timer(struct list_link *head, struct list_link *ll ); +void append_to_timer(pike_list_link_t *head, pike_list_link_t *ll); -void remove_from_timer(struct list_link *head, struct list_link *ll); +void remove_from_timer(pike_list_link_t *head, pike_list_link_t *ll); -void check_and_split_timer(struct list_link *head, unsigned int time, - struct list_link *split, unsigned char *mask); +void check_and_split_timer(pike_list_link_t *head, unsigned int time, + pike_list_link_t *split, unsigned char *mask); #endif