Browse code

pike: renamed common name structs and globals to have module prefix

Daniel-Constantin Mierla authored on 24/03/2020 15:39:54
Showing 11 changed files
... ...
@@ -32,19 +32,19 @@
32 32
 
33 33
 
34 34
 
35
-static struct ip_tree*  root = 0;
35
+static pike_ip_tree_t*  pike_root = 0;
36 36
 
37 37
 
38
-static inline struct ip_node* prv_get_tree_branch(unsigned char b)
38
+static inline pike_ip_node_t* prv_get_tree_branch(unsigned char b)
39 39
 {
40
-	return root->entries[b].node;
40
+	return pike_root->entries[b].node;
41 41
 }
42 42
 
43 43
 
44 44
 /* locks a tree branch */
45 45
 static inline void prv_lock_tree_branch(unsigned char b)
46 46
 {
47
-	lock_set_get( root->entry_lock_set, root->entries[b].lock_idx);
47
+	lock_set_get(pike_root->entry_lock_set, pike_root->entries[b].lock_idx);
48 48
 }
49 49
 
50 50
 
... ...
@@ -52,12 +52,12 @@ static inline void prv_lock_tree_branch(unsigned char b)
52 52
 /* unlocks a tree branch */
53 53
 static inline void prv_unlock_tree_branch(unsigned char b)
54 54
 {
55
-	lock_set_release( root->entry_lock_set, root->entries[b].lock_idx);
55
+	lock_set_release(pike_root->entry_lock_set, pike_root->entries[b].lock_idx);
56 56
 }
57 57
 
58 58
 
59 59
 /* wrapper functions */
60
-struct ip_node* get_tree_branch(unsigned char b)
60
+pike_ip_node_t* get_tree_branch(unsigned char b)
61 61
 {
62 62
 	return prv_get_tree_branch(b);
63 63
 }
... ...
@@ -111,43 +111,48 @@ int init_ip_tree(int maximum_hits)
111 111
 	int size;
112 112
 	int i;
113 113
 
114
-	/* create the root */
115
-	root = (struct ip_tree*)shm_malloc(sizeof(struct ip_tree));
116
-	if (root==0) {
114
+	/* create the pike_root */
115
+	pike_root = (pike_ip_tree_t*)shm_malloc(sizeof(pike_ip_tree_t));
116
+	if (pike_root==0) {
117 117
 		LM_ERR("shm malloc failed\n");
118 118
 		goto error;
119 119
 	}
120
-	memset( root, 0, sizeof(struct ip_tree));
120
+	memset(pike_root, 0, sizeof(pike_ip_tree_t));
121 121
 
122 122
 	/* init lock set */
123 123
 	size = MAX_IP_BRANCHES;
124
-	root->entry_lock_set = init_lock_set( &size );
125
-	if (root->entry_lock_set==0) {
124
+	pike_root->entry_lock_set = init_lock_set( &size );
125
+	if (pike_root->entry_lock_set==0) {
126 126
 		LM_ERR("failed to create locks\n");
127 127
 		goto error;
128 128
 	}
129 129
 	/* assign to each branch a lock */
130 130
 	for(i=0;i<MAX_IP_BRANCHES;i++) {
131
-		root->entries[i].node = 0;
132
-		root->entries[i].lock_idx = i % size;
131
+		pike_root->entries[i].node = 0;
132
+		pike_root->entries[i].lock_idx = i % size;
133 133
 	}
134 134
 
135
-	root->max_hits = maximum_hits;
135
+	pike_root->max_hits = maximum_hits;
136 136
 
137 137
 	return 0;
138 138
 error:
139
-	if (root)
140
-		shm_free(root);
139
+	if (pike_root) {
140
+		shm_free(pike_root);
141
+		pike_root = NULL;
142
+	}
141 143
 	return -1;
142 144
 }
143 145
 
144
-unsigned int get_max_hits() { return root != 0 ? root->max_hits : -1; }
146
+unsigned int get_max_hits()
147
+{
148
+	return (pike_root != 0) ? pike_root->max_hits : -1;
149
+}
145 150
 
146 151
 /* destroy an ip_node and all nodes under it; the nodes must be first removed
147 152
  * from any other lists/timers */
148
-static inline void destroy_ip_node(struct ip_node *node)
153
+static inline void destroy_ip_node(pike_ip_node_t *node)
149 154
 {
150
-	struct ip_node *foo, *bar;
155
+	pike_ip_node_t *foo, *bar;
151 156
 
152 157
 	foo = node->kids;
153 158
 	while (foo){
... ...
@@ -166,22 +171,22 @@ void destroy_ip_tree(void)
166 166
 {
167 167
 	int i;
168 168
 
169
-	if (root==0)
169
+	if (pike_root==0)
170 170
 		return;
171 171
 
172 172
 	/* destroy and free the lock set */
173
-	if (root->entry_lock_set) {
174
-		lock_set_destroy(root->entry_lock_set);
175
-		lock_set_dealloc(root->entry_lock_set);
173
+	if (pike_root->entry_lock_set) {
174
+		lock_set_destroy(pike_root->entry_lock_set);
175
+		lock_set_dealloc(pike_root->entry_lock_set);
176 176
 	}
177 177
 
178 178
 	/* destroy all the nodes */
179 179
 	for(i=0;i<MAX_IP_BRANCHES;i++)
180
-		if (root->entries[i].node)
181
-			destroy_ip_node(root->entries[i].node);
180
+		if (pike_root->entries[i].node)
181
+			destroy_ip_node(pike_root->entries[i].node);
182 182
 
183
-	shm_free( root );
184
-	root = 0;
183
+	shm_free( pike_root );
184
+	pike_root = 0;
185 185
 
186 186
 	return;
187 187
 }
... ...
@@ -189,16 +194,16 @@ void destroy_ip_tree(void)
189 189
 
190 190
 
191 191
 /* builds a new ip_node corresponding to a byte value */
192
-static inline struct ip_node *new_ip_node(unsigned char byte)
192
+static inline pike_ip_node_t *new_ip_node(unsigned char byte)
193 193
 {
194
-	struct ip_node *new_node;
194
+	pike_ip_node_t *new_node;
195 195
 
196
-	new_node = (struct ip_node*)shm_malloc(sizeof(struct ip_node));
196
+	new_node = (pike_ip_node_t*)shm_malloc(sizeof(pike_ip_node_t));
197 197
 	if (!new_node) {
198 198
 		LM_ERR("no more shm mem\n");
199 199
 		return 0;
200 200
 	}
201
-	memset( new_node, 0, sizeof(struct ip_node));
201
+	memset( new_node, 0, sizeof(pike_ip_node_t));
202 202
 	new_node->byte = byte;
203 203
 	return new_node;
204 204
 }
... ...
@@ -206,9 +211,9 @@ static inline struct ip_node *new_ip_node(unsigned char byte)
206 206
 
207 207
 
208 208
 /* splits from the current node (dad) a new child */
209
-struct ip_node *split_node(struct ip_node* dad, unsigned char byte)
209
+pike_ip_node_t *split_node(pike_ip_node_t* dad, unsigned char byte)
210 210
 {
211
-	struct ip_node *new_node;
211
+	pike_ip_node_t *new_node;
212 212
 
213 213
 	/* create a new node */
214 214
 	if ( (new_node=new_ip_node(byte))==0 )
... ...
@@ -233,32 +238,32 @@ struct ip_node *split_node(struct ip_node* dad, unsigned char byte)
233 233
 
234 234
 
235 235
 #define is_hot_non_leaf(_node) \
236
-	( (_node)->hits[PREV_POS]>=root->max_hits>>2 ||\
237
-		(_node)->hits[CURR_POS]>=root->max_hits>>2 ||\
236
+	( (_node)->hits[PREV_POS]>=pike_root->max_hits>>2 ||\
237
+		(_node)->hits[CURR_POS]>=pike_root->max_hits>>2 ||\
238 238
 		(((_node)->hits[PREV_POS]+(_node)->hits[CURR_POS])>>1)>=\
239
-			root->max_hits>>2 )
239
+			pike_root->max_hits>>2 )
240 240
 
241 241
 #define is_hot_leaf(_node) \
242
-	( (_node)->leaf_hits[PREV_POS]>=root->max_hits ||\
243
-		(_node)->leaf_hits[CURR_POS]>=root->max_hits ||\
242
+	( (_node)->leaf_hits[PREV_POS]>=pike_root->max_hits ||\
243
+		(_node)->leaf_hits[CURR_POS]>=pike_root->max_hits ||\
244 244
 		(((_node)->leaf_hits[PREV_POS]+(_node)->leaf_hits[CURR_POS])>>1)>=\
245
-			root->max_hits )
245
+			pike_root->max_hits )
246 246
 
247 247
 #define is_warm_leaf(_node) \
248
-	( (_node)->hits[CURR_POS]>=root->max_hits>>2 )
248
+	( (_node)->hits[CURR_POS]>=pike_root->max_hits>>2 )
249 249
 
250 250
 #define MAX_TYPE_VAL(_x) \
251 251
 	(( (1<<(8*sizeof(_x)-1))-1 )|( (1<<(8*sizeof(_x)-1)) ))
252 252
 
253 253
 
254
-int is_node_hot_leaf(struct ip_node *node)
254
+int is_node_hot_leaf(pike_ip_node_t *node)
255 255
 {
256 256
 	return is_hot_leaf(node);
257 257
 }
258 258
 
259 259
 /*! \brief Used by the rpc function */
260 260
 char *node_status_array[] = {"", "WARM", "HOT", "ALL"};
261
-node_status_t node_status(struct ip_node *node)
261
+pike_node_status_t node_status(pike_ip_node_t *node)
262 262
 {
263 263
 	if ( is_hot_leaf(node) )
264 264
 		return NODE_STATUS_HOT;
... ...
@@ -272,14 +277,14 @@ node_status_t node_status(struct ip_node *node)
272 272
 
273 273
 
274 274
 /* mark with one more hit the given IP address - */
275
-struct ip_node* mark_node(unsigned char *ip,int ip_len,
276
-							struct ip_node **father,unsigned char *flag)
275
+pike_ip_node_t* mark_node(unsigned char *ip,int ip_len,
276
+							pike_ip_node_t **father,unsigned char *flag)
277 277
 {
278
-	struct ip_node *node;
279
-	struct ip_node *kid;
278
+	pike_ip_node_t *node;
279
+	pike_ip_node_t *kid;
280 280
 	int    byte_pos;
281 281
 
282
-	kid = root->entries[ ip[0] ].node;
282
+	kid = pike_root->entries[ ip[0] ].node;
283 283
 	node = 0;
284 284
 	byte_pos = 0;
285 285
 
... ...
@@ -325,8 +330,8 @@ struct ip_node* mark_node(unsigned char *ip,int ip_len,
325 325
 		node->hits[CURR_POS] = 1;
326 326
 		node->branch = ip[0];
327 327
 		*flag = NEW_NODE ;
328
-		/* set this node as root of the branch starting with first byte of IP*/
329
-		root->entries[ ip[0] ].node = node;
328
+		/* set this node as pike_root of the branch starting with first byte of IP*/
329
+		pike_root->entries[ ip[0] ].node = node;
330 330
 	} else{
331 331
 		/* only a non-empty prefix of the IP was found */
332 332
 		if ( node->hits[CURR_POS]<MAX_TYPE_VAL(node->hits[CURR_POS])-1 )
... ...
@@ -352,13 +357,13 @@ struct ip_node* mark_node(unsigned char *ip,int ip_len,
352 352
 
353 353
 
354 354
 /* remove and destroy a IP node along with its subtree */
355
-void remove_node(struct ip_node *node)
355
+void remove_node(pike_ip_node_t *node)
356 356
 {
357 357
 	LM_DBG("destroying node %p\n",node);
358
-	/* is it a branch root node? (these nodes have no prev (father)) */
358
+	/* is it a branch pike_root node? (these nodes have no prev (father)) */
359 359
 	if (node->prev==0) {
360
-		assert(root->entries[node->byte].node==node);
361
-		root->entries[node->byte].node = 0;
360
+		assert(pike_root->entries[node->byte].node==node);
361
+		pike_root->entries[node->byte].node = 0;
362 362
 	} else {
363 363
 		/* unlink it from kids list */
364 364
 		if (node->prev->kids==node)
... ...
@@ -376,9 +381,9 @@ void remove_node(struct ip_node *node)
376 376
 	destroy_ip_node(node);
377 377
 }
378 378
 
379
-static void print_node(struct ip_node *node,int sp, FILE *f)
379
+static void print_node(pike_ip_node_t *node,int sp, FILE *f)
380 380
 {
381
-	struct ip_node *foo;
381
+	pike_ip_node_t *foo;
382 382
 
383 383
 	/* print current node */
384 384
 	if (!f) {
... ...
@@ -44,59 +44,57 @@
44 44
 #define NODE_IPLEAF_FLAG   (1<<2)
45 45
 #define NODE_ISRED_FLAG    (1<<3)
46 46
 
47
-struct ip_node
48
-{
47
+typedef struct pike_ip_node {
49 48
 	unsigned int      expires;
50 49
 	unsigned short    leaf_hits[2];
51 50
 	unsigned short    hits[2];
52 51
 	unsigned char     byte;
53 52
 	unsigned char     branch;
54
-	volatile unsigned short    flags;
55
-	struct list_link  timer_ll;
56
-	struct ip_node    *prev;
57
-	struct ip_node    *next;
58
-	struct ip_node    *kids;
59
-};
53
+	volatile unsigned short flags;
54
+	pike_list_link_t  timer_ll;
55
+	struct pike_ip_node    *prev;
56
+	struct pike_ip_node    *next;
57
+	struct pike_ip_node    *kids;
58
+} pike_ip_node_t;
60 59
 
61 60
 
62
-struct ip_tree
63
-{
61
+typedef struct ip_tree {
64 62
 	struct entry {
65
-		struct ip_node *node;
66
-		int            lock_idx;
63
+		pike_ip_node_t *node;
64
+		int lock_idx;
67 65
 	} entries[MAX_IP_BRANCHES];
68
-	unsigned short   max_hits;
69
-	gen_lock_set_t  *entry_lock_set;
70
-};
66
+	unsigned short max_hits;
67
+	gen_lock_set_t *entry_lock_set;
68
+} pike_ip_tree_t;
71 69
 
72 70
 
73 71
 #define ll2ipnode(ptr) \
74
-	((struct ip_node*)((char *)(ptr)-\
75
-		(unsigned long)(&((struct ip_node*)0)->timer_ll)))
72
+	((pike_ip_node_t*)((char *)(ptr)-\
73
+		(unsigned long)(&((pike_ip_node_t*)0)->timer_ll)))
76 74
 
77 75
 
78
-int    init_ip_tree(int);
79
-void   destroy_ip_tree(void);
80
-struct ip_node* mark_node( unsigned char *ip, int ip_len,
81
-			struct ip_node **father, unsigned char *flag);
82
-void   remove_node(struct ip_node *node);
83
-int is_node_hot_leaf(struct ip_node *node);
76
+int init_ip_tree(int);
77
+void destroy_ip_tree(void);
78
+pike_ip_node_t* mark_node( unsigned char *ip, int ip_len,
79
+			pike_ip_node_t **father, unsigned char *flag);
80
+void remove_node(pike_ip_node_t *node);
81
+int is_node_hot_leaf(pike_ip_node_t *node);
84 82
 
85 83
 void lock_tree_branch(unsigned char b);
86 84
 void unlock_tree_branch(unsigned char b);
87
-struct ip_node* get_tree_branch(unsigned char b);
85
+pike_ip_node_t* get_tree_branch(unsigned char b);
88 86
 
89 87
 typedef enum {
90 88
 	NODE_STATUS_OK    = 0,
91 89
 	NODE_STATUS_WARM  = 1,
92 90
 	NODE_STATUS_HOT   = 2,
93 91
 	NODE_STATUS_ALL   = 3   /** used for status matching */
94
-} node_status_t;
95
-node_status_t node_status(struct ip_node *node);
92
+} pike_node_status_t;
93
+pike_node_status_t node_status(pike_ip_node_t *node);
96 94
 extern char *node_status_array[];
97 95
 unsigned int get_max_hits();
98 96
 
99
-void print_tree( FILE *f);
97
+void print_tree(FILE *f);
100 98
 
101 99
 
102 100
 #endif
... ...
@@ -52,14 +52,14 @@ void pike_exit(void);
52 52
 
53 53
 
54 54
 /* parameters */
55
-static int time_unit = 2;
56
-static int max_reqs  = 30;
57
-int timeout   = 120;
55
+static int pike_time_unit = 2;
56
+static int pike_max_reqs  = 30;
57
+int pike_timeout   = 120;
58 58
 int pike_log_level = L_WARN;
59 59
 
60 60
 /* global variables */
61
-gen_lock_t*             timer_lock=0;
62
-struct list_link*       timer = 0;
61
+gen_lock_t       *pike_timer_lock = 0;
62
+pike_list_link_t *pike_timer = 0;
63 63
 
64 64
 
65 65
 static cmd_export_t cmds[]={
... ...
@@ -68,10 +68,10 @@ static cmd_export_t cmds[]={
68 68
 };
69 69
 
70 70
 static param_export_t params[]={
71
-	{"sampling_time_unit",    INT_PARAM,  &time_unit},
72
-	{"reqs_density_per_unit", INT_PARAM,  &max_reqs},
73
-	{"remove_latency",        INT_PARAM,  &timeout},
74
-	{"pike_log_level",        INT_PARAM, &pike_log_level},
71
+	{"sampling_time_unit",    INT_PARAM,  &pike_time_unit},
72
+	{"reqs_density_per_unit", INT_PARAM,  &pike_max_reqs},
73
+	{"remove_latency",        INT_PARAM,  &pike_timeout},
74
+	{"pike_log_level",        INT_PARAM,  &pike_log_level},
75 75
 	{0,0,0}
76 76
 };
77 77
 
... ...
@@ -102,34 +102,34 @@ static int pike_init(void)
102 102
 	}
103 103
 
104 104
 	/* alloc the timer lock */
105
-	timer_lock=lock_alloc();
106
-	if (timer_lock==0) {
105
+	pike_timer_lock=lock_alloc();
106
+	if (pike_timer_lock==0) {
107 107
 		LM_ERR(" alloc locks failed!\n");
108 108
 		goto error1;
109 109
 	}
110 110
 	/* init the lock */
111
-	if (lock_init(timer_lock)==0){
111
+	if (lock_init(pike_timer_lock)==0){
112 112
 		LM_ERR(" init lock failed\n");
113 113
 		goto error1;
114 114
 	}
115 115
 
116 116
 	/* init the IP tree */
117
-	if ( init_ip_tree(max_reqs)!=0 ) {
117
+	if ( init_ip_tree(pike_max_reqs)!=0 ) {
118 118
 		LM_ERR(" ip_tree creation failed!\n");
119 119
 		goto error2;
120 120
 	}
121 121
 
122 122
 	/* init timer list */
123
-	timer = (struct list_link*)shm_malloc(sizeof(struct list_link));
124
-	if (timer==0) {
125
-		LM_ERR(" cannot alloc shm mem for timer!\n");
123
+	pike_timer = (pike_list_link_t*)shm_malloc(sizeof(pike_list_link_t));
124
+	if (pike_timer==0) {
125
+		LM_ERR("cannot alloc shm mem for timer!\n");
126 126
 		goto error3;
127 127
 	}
128
-	timer->next = timer->prev = timer;
128
+	pike_timer->next = pike_timer->prev = pike_timer;
129 129
 
130 130
 	/* registering timing functions  */
131 131
 	register_timer( clean_routine , 0, 1 );
132
-	register_timer( swap_routine , 0, time_unit );
132
+	register_timer( swap_routine , 0, pike_time_unit );
133 133
 
134 134
 	/* Register counter */
135 135
 	pike_counter_init();
... ...
@@ -138,10 +138,10 @@ static int pike_init(void)
138 138
 error3:
139 139
 	destroy_ip_tree();
140 140
 error2:
141
-	lock_destroy(timer_lock);
141
+	lock_destroy(pike_timer_lock);
142 142
 error1:
143
-	if (timer_lock) lock_dealloc(timer_lock);
144
-	timer_lock = 0;
143
+	if (pike_timer_lock) lock_dealloc(pike_timer_lock);
144
+	pike_timer_lock = 0;
145 145
 	return -1;
146 146
 }
147 147
 
... ...
@@ -150,15 +150,15 @@ error1:
150 150
 void pike_exit(void)
151 151
 {
152 152
 	/* destroy semaphore */
153
-	if (timer_lock) {
154
-		lock_destroy(timer_lock);
155
-		lock_dealloc(timer_lock);
153
+	if (pike_timer_lock) {
154
+		lock_destroy(pike_timer_lock);
155
+		lock_dealloc(pike_timer_lock);
156 156
 	}
157 157
 
158 158
 	/* empty the timer list head */
159
-	if (timer) {
160
-		shm_free(timer);
161
-		timer = 0;
159
+	if (pike_timer) {
160
+		shm_free(pike_timer);
161
+		pike_timer = 0;
162 162
 	}
163 163
 
164 164
 	/* destroy the IP tree */
... ...
@@ -39,9 +39,9 @@
39 39
 
40 40
 
41 41
 
42
-extern gen_lock_t*       timer_lock;
43
-extern struct list_link* timer;
44
-extern int               timeout;
42
+extern gen_lock_t*       pike_timer_lock;
43
+extern pike_list_link_t* pike_timer;
44
+extern int               pike_timeout;
45 45
 extern int               pike_log_level;
46 46
 
47 47
 counter_handle_t blocked;
... ...
@@ -55,8 +55,8 @@ void pike_counter_init()
55 55
 
56 56
 int pike_check_req(sip_msg_t *msg)
57 57
 {
58
-	struct ip_node *node;
59
-	struct ip_node *father;
58
+	pike_ip_node_t *node;
59
+	pike_ip_node_t *father;
60 60
 	unsigned char flags;
61 61
 	struct ip_addr* ip;
62 62
 
... ...
@@ -93,12 +93,12 @@ int pike_check_req(sip_msg_t *msg)
93 93
 		node->flags, flags);
94 94
 
95 95
 	/* update the timer */
96
-	lock_get(timer_lock);
96
+	lock_get(pike_timer_lock);
97 97
 	if ( flags&NEW_NODE ) {
98 98
 		/* put this node into the timer list and remove its
99 99
 		 * father only if this has one kid and is not a LEAF_NODE*/
100
-		node->expires =  get_ticks() + timeout;
101
-		append_to_timer( timer, &(node->timer_ll) );
100
+		node->expires =  get_ticks() + pike_timeout;
101
+		append_to_timer( pike_timer, &(node->timer_ll) );
102 102
 		node->flags |= NODE_INTIMER_FLAG;
103 103
 		if (father) {
104 104
 			LM_DBG("father %p: flags=%d kids->next=%p\n",
... ...
@@ -110,7 +110,7 @@ int pike_check_req(sip_msg_t *msg)
110 110
 				/* if the node is maked as expired by timer, let the timer
111 111
 				 * to finish and remove the node */
112 112
 				if ( !(father->flags&NODE_EXPIRED_FLAG) ) {
113
-					remove_from_timer( timer, &(father->timer_ll) );
113
+					remove_from_timer( pike_timer, &(father->timer_ll) );
114 114
 					father->flags &= ~NODE_INTIMER_FLAG;
115 115
 				} else {
116 116
 					father->flags &= ~NODE_EXPIRED_FLAG;
... ...
@@ -129,8 +129,8 @@ int pike_check_req(sip_msg_t *msg)
129 129
 			/* if node exprired, ignore the current hit and let is
130 130
 			 * expire in timer process */
131 131
 			if ( !(flags&NO_UPDATE) && !(node->flags&NODE_EXPIRED_FLAG) ) {
132
-				node->expires = get_ticks() + timeout;
133
-				update_in_timer( timer, &(node->timer_ll) );
132
+				node->expires = get_ticks() + pike_timeout;
133
+				update_in_timer( pike_timer, &(node->timer_ll) );
134 134
 			}
135 135
 		} else {
136 136
 			/* debug */
... ...
@@ -140,8 +140,8 @@ int pike_check_req(sip_msg_t *msg)
140 140
 			assert( !(node->flags&NODE_IPLEAF_FLAG) && node->kids );
141 141
 		}
142 142
 	}
143
-	/*print_timer_list( timer );*/ /* debug*/
144
-	lock_release(timer_lock);
143
+	/*print_timer_list( pike_timer );*/ /* debug*/
144
+	lock_release(pike_timer_lock);
145 145
 
146 146
 	unlock_tree_branch( ip->u.addr[0] );
147 147
 	/*print_tree( 0 );*/ /* debug */
... ...
@@ -167,28 +167,28 @@ int w_pike_check_req(struct sip_msg *msg, char *foo, char *bar)
167 167
 void clean_routine(unsigned int ticks , void *param)
168 168
 {
169 169
 	static unsigned char mask[32];  /* 256 positions mask */
170
-	struct list_link head;
171
-	struct list_link *ll;
172
-	struct ip_node   *dad;
173
-	struct ip_node   *node;
170
+	pike_list_link_t head;
171
+	pike_list_link_t *ll;
172
+	pike_ip_node_t   *dad;
173
+	pike_ip_node_t   *node;
174 174
 	int i;
175 175
 
176 176
 	/* LM_DBG("entering (%d)\n",ticks); */
177 177
 	/* before locking check first if the list is not empty and if can
178 178
 	 * be at least one element removed */
179
-	if (timer==0 || is_list_empty( timer )) return; /* quick exit */
179
+	if (pike_timer==0 || is_list_empty( pike_timer )) return; /* quick exit */
180 180
 
181
-	memset(&head, 0, sizeof(struct list_link));
181
+	memset(&head, 0, sizeof(pike_list_link_t));
182 182
 	/* get the expired elements */
183
-	lock_get( timer_lock );
183
+	lock_get( pike_timer_lock );
184 184
 	/* check again for empty list */
185
-	if (is_list_empty(timer) || (ll2ipnode(timer->next)->expires>ticks )){
186
-		lock_release( timer_lock );
185
+	if (is_list_empty(pike_timer) || (ll2ipnode(pike_timer->next)->expires>ticks )){
186
+		lock_release( pike_timer_lock );
187 187
 		return;
188 188
 	}
189
-	check_and_split_timer( timer, ticks, &head, mask);
190
-	/*print_timer_list(timer);*/ /* debug */
191
-	lock_release( timer_lock );
189
+	check_and_split_timer( pike_timer, ticks, &head, mask);
190
+	/*print_timer_list(pike_timer);*/ /* debug */
191
+	lock_release( pike_timer_lock );
192 192
 	/*print_tree( 0 );*/  /*debug*/
193 193
 
194 194
 	/* got something back? */
... ...
@@ -244,12 +244,12 @@ void clean_routine(unsigned int ticks , void *param)
244 244
 						/* put it in the list only if it's not an IP leaf
245 245
 						 * (in this case, it's already there) */
246 246
 						if ( !(dad->flags&NODE_IPLEAF_FLAG) ) {
247
-							lock_get(timer_lock);
248
-							dad->expires = get_ticks() + timeout;
247
+							lock_get(pike_timer_lock);
248
+							dad->expires = get_ticks() + pike_timeout;
249 249
 							assert( !has_timer_set(&(dad->timer_ll)) );
250
-							append_to_timer( timer, &(dad->timer_ll));
250
+							append_to_timer(pike_timer, &(dad->timer_ll));
251 251
 							dad->flags |= NODE_INTIMER_FLAG;
252
-							lock_release(timer_lock);
252
+							lock_release(pike_timer_lock);
253 253
 						} else {
254 254
 							assert( has_timer_set(&(dad->timer_ll)) );
255 255
 						}
... ...
@@ -267,7 +267,7 @@ void clean_routine(unsigned int ticks , void *param)
267 267
 
268 268
 
269 269
 
270
-static inline void refresh_node( struct ip_node *node)
270
+static inline void refresh_node( pike_ip_node_t *node)
271 271
 {
272 272
 	for( ; node ; node=node->next ) {
273 273
 		node->hits[PREV_POS] = node->hits[CURR_POS];
... ...
@@ -288,7 +288,7 @@ static inline void refresh_node( struct ip_node *node)
288 288
 
289 289
 void swap_routine( unsigned int ticks, void *param)
290 290
 {
291
-	struct ip_node *node;
291
+	pike_ip_node_t *node;
292 292
 	int i;
293 293
 
294 294
 	/* LM_DBG("entering \n"); */
... ...
@@ -28,7 +28,7 @@
28 28
 
29 29
 void pike_counter_init(void);
30 30
 int  pike_check_req(sip_msg_t *msg);
31
-int  w_pike_check_req(struct sip_msg *msg, char *foo, char *bar);
31
+int  w_pike_check_req(sip_msg_t *msg, char *foo, char *bar);
32 32
 void clean_routine(unsigned int, void*);
33 33
 void swap_routine(unsigned int, void*);
34 34
 
... ...
@@ -39,11 +39,11 @@
39 39
 
40 40
 static unsigned int g_max_hits = 0;
41 41
 
42
-static void traverse_subtree( struct ip_node *node, int depth, int options )
42
+static void traverse_subtree( pike_ip_node_t *node, int depth, int options )
43 43
 {
44 44
 	static unsigned char ip_addr[MAX_DEPTH];
45 45
 
46
-	struct ip_node *foo;
46
+	pike_ip_node_t *foo;
47 47
 
48 48
 	DBG("pike:rpc traverse_subtree, depth: %d, byte: %d", depth, node->byte);
49 49
 
... ...
@@ -23,7 +23,7 @@
23 23
 
24 24
 #include "../../core/rpc.h"
25 25
 #include "../../core/rpc_lookup.h"
26
-extern rpc_export_t pike_rpc_methods[];
27 26
 
27
+extern rpc_export_t pike_rpc_methods[];
28 28
 
29 29
 #endif
... ...
@@ -76,7 +76,7 @@ static char *print_addr(unsigned char *ip, int iplen)
76 76
 
77 77
 int pike_top_add_entry( unsigned char *ip_addr, int addr_len,
78 78
 		unsigned short leaf_hits[2], unsigned short hits[2],
79
-		unsigned int expires, node_status_t status )
79
+		unsigned int expires, pike_node_status_t status )
80 80
 {
81 81
 	struct TopListItem_t *new_item
82 82
 				= (struct TopListItem_t *)malloc(sizeof(struct TopListItem_t));
... ...
@@ -32,7 +32,7 @@ struct TopListItem_t {
32 32
 	unsigned int  	leaf_hits[2];
33 33
 	unsigned int  	hits[2];
34 34
 	unsigned int    expires;	/*!< in seconds */
35
-	node_status_t   status;
35
+	pike_node_status_t   status;
36 36
 
37 37
 	struct TopListItem_t *next;
38 38
 };
... ...
@@ -40,7 +40,7 @@ struct TopListItem_t {
40 40
 // returns 1 when OK and 0 when failed
41 41
 int pike_top_add_entry( unsigned char *ip_addr, int addr_len,
42 42
 		unsigned short leaf_hits[2], unsigned short hits[2],
43
-		unsigned int expires, node_status_t status );
43
+		unsigned int expires, pike_node_status_t status );
44 44
 
45 45
 struct TopListItem_t *pike_top_get_root();
46 46
 void pike_top_list_clear();
... ...
@@ -28,7 +28,7 @@
28 28
 
29 29
 
30 30
 
31
-void append_to_timer(struct list_link *head, struct list_link *new_ll )
31
+void append_to_timer(pike_list_link_t *head, pike_list_link_t *new_ll )
32 32
 {
33 33
 	LM_DBG("%p in %p(%p,%p)\n",	new_ll, head,head->prev,head->next);
34 34
 	assert( !has_timer_set(new_ll) );
... ...
@@ -41,7 +41,7 @@ void append_to_timer(struct list_link *head, struct list_link *new_ll )
41 41
 
42 42
 
43 43
 
44
-void remove_from_timer(struct list_link *head, struct list_link *ll)
44
+void remove_from_timer(pike_list_link_t *head, pike_list_link_t *ll)
45 45
 {
46 46
 	LM_DBG("%p from %p(%p,%p)\n", ll, head,head->prev,head->next);
47 47
 	assert( has_timer_set(ll) );
... ...
@@ -55,11 +55,11 @@ void remove_from_timer(struct list_link *head, struct list_link *ll)
55 55
 
56 56
 
57 57
 /* "head" list MUST not be empty */
58
-void check_and_split_timer(struct list_link *head, unsigned int time,
59
-							struct list_link *split, unsigned char *mask)
58
+void check_and_split_timer(pike_list_link_t *head, unsigned int time,
59
+							pike_list_link_t *split, unsigned char *mask)
60 60
 {
61
-	struct list_link *ll;
62
-	struct ip_node   *node;
61
+	pike_list_link_t *ll;
62
+	pike_ip_node_t   *node;
63 63
 	unsigned char b;
64 64
 	int i;
65 65
 
... ...
@@ -93,10 +93,7 @@ void check_and_split_timer(struct list_link *head, unsigned int time,
93 93
 		ll->prev = head;
94 94
 	}
95 95
 
96
-	LM_DBG("succ. to split (h=%p)(p=%p,n=%p)\n", head,head->prev,head->next);
96
+	LM_DBG("succeeded to split (h=%p)(p=%p,n=%p)\n", head, head->prev, head->next);
97 97
 	return;
98 98
 }
99 99
 
100
-
101
-
102
-
... ...
@@ -25,10 +25,10 @@
25 25
 #define _PIKE_TIMER_H
26 26
 
27 27
 
28
-struct list_link {
29
-	struct list_link *next;
30
-	struct list_link *prev;
31
-};
28
+typedef struct pike_list_link {
29
+	struct pike_list_link *next;
30
+	struct pike_list_link *prev;
31
+} pike_list_link_t;
32 32
 
33 33
 
34 34
 #define has_timer_set(_ll) \
... ...
@@ -37,19 +37,19 @@ struct list_link {
37 37
 #define is_list_empty(_head) \
38 38
 	((_head)->next == (_head))
39 39
 
40
-#define update_in_timer( _head, _ll) \
40
+#define update_in_timer(_head, _ll) \
41 41
 	do { \
42
-		remove_from_timer( _head, _ll);\
43
-		append_to_timer( _head, _ll); \
42
+		remove_from_timer(_head, _ll);\
43
+		append_to_timer(_head, _ll); \
44 44
 	}while(0)
45 45
 
46 46
 
47
-void append_to_timer(struct list_link *head, struct list_link *ll );
47
+void append_to_timer(pike_list_link_t *head, pike_list_link_t *ll);
48 48
 
49
-void remove_from_timer(struct list_link *head, struct list_link *ll);
49
+void remove_from_timer(pike_list_link_t *head, pike_list_link_t *ll);
50 50
 
51
-void check_and_split_timer(struct list_link *head, unsigned int time,
52
-		struct list_link *split, unsigned char *mask);
51
+void check_and_split_timer(pike_list_link_t *head, unsigned int time,
52
+		pike_list_link_t *split, unsigned char *mask);
53 53
 
54 54
 
55 55
 #endif