Browse code

Sun cc ser core support: - major makefile changes - lots of warning fixed - replaced incompatible expr-statement defines ( ({ }) ). - special LOG, DBG, DPrint version for suncc

Andrei Pelinescu-Onciul authored on 01/03/2002 23:21:25
Showing 18 changed files
... ...
@@ -8,7 +8,7 @@
8 8
 VERSION = 0
9 9
 PATCHLEVEL = 8
10 10
 SUBLEVEL = 7
11
-EXTRAVERSION = -2
11
+EXTRAVERSION = -3-suncc
12 12
 
13 13
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
14 14
 OS = $(shell uname -s)
... ...
@@ -76,9 +76,12 @@ ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/ )
76 76
 
77 77
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
78 78
 	 -DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\
79
-	 -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
79
+	 -DDNS_IP_HACK  -DPKG_MALLOC \
80 80
 	 -DF_MALLOC  -DUSE_SYNONIM\
81
-	 -DWAIT -DNEW_HNAME -DNOISY_REPLIES -DBOGDAN_TRIFLE \
81
+	 -DSHM_MEM  -DSHM_MMAP \
82
+	 -DNO_DEBUG \
83
+	 -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 \
84
+	 -DWAIT -DNEW_HNAME # -DNOISY_REPLIES -DBOGDAN_TRIFLE \
82 85
 	 #-DNO_DEBUG \
83 86
 	 #-DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=0 \
84 87
 	 #-DNOSMP \
... ...
@@ -95,7 +98,9 @@ ifeq ($(ARCH), i386)
95 95
 endif
96 96
 
97 97
 ifeq ($(ARCH), sparc64)
98
-	DEFS+= -DFAST_LOCK
98
+ifeq 	($(CC_NAME), gcc)
99
+		DEFS+= -DFAST_LOCK
100
+endif
99 101
 endif
100 102
 
101 103
 
... ...
@@ -109,34 +114,51 @@ mode = release
109 109
 #common
110 110
 CC=gcc
111 111
 LD= $(CC)
112
-CC_VER= $(CC) $(shell $(CC) --version)
113
-CC_LONGVER=$(shell $(CC) -v 2>&1)
114
-MKDEP=gcc -MM $(DEFS)
112
+CC_LONGVER=$(shell if  $(CC) -v 2>/dev/null; then \
113
+						$(CC) -v 2>&1 ;\
114
+					else \
115
+						$(CC) -V 2>&1 ; \
116
+					fi )
115 117
 MKTAGS=ctags -R .
116 118
 
117 119
 #find-out the compiler's name
118 120
 
119 121
 ifneq (,$(findstring gcc, $(CC_LONGVER)))
120 122
 	CC_NAME=gcc
123
+	CC_VER=$(CC) $(shell $(CC) --version)
124
+	MKDEP=$(CC) -MM $(DEFS)
121 125
 	#transform gcc version into 2.9x or 3.0
122 126
 	CC_SHORTVER=$(shell $(CC) --version | \
123 127
 				 sed -e 's/[^0-9]*-\(.*\)/\1/'| \
124 128
 				 sed -e 's/2\.9.*/2.9x/' -e 's/3\..\..*/3.0/')
125
-else
129
+endif
130
+
131
+ifneq (, $(findstring Sun, $(CC_LONGVER)))
132
+	CC_NAME=suncc
133
+	CC_SHORTVER=$(shell echo $(CC_LONGVER)|head -1| \
134
+					sed -e 's/.*\([0-9]\.[0-9]\).*/\1/g' )
135
+	CC_VER=$(CC) $(CC_SHORTVER)
136
+	MKDEP=$(CC) -xM1 $(DEFS)
137
+endif
138
+
139
+ifeq (,$(CC_NAME))
140
+#not found
126 141
 	CC_NAME=$(CC)
127 142
 	CC_SHORTVER=unknown
143
+	CC_VER=unknown
144
+	MKDEP=gcc -MM $(DEFS)
128 145
 endif
129 146
 
130 147
 
131 148
 # setting CFLAGS
132 149
 ifeq ($(mode), release)
133
-	#common stuff
134
-	CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) -Winline\
135
-			#-Wmissing-prototypes \
136 150
 	#if i386
137 151
 ifeq	($(ARCH), i386)
138 152
 		# if gcc 
139 153
 ifeq		($(CC_NAME), gcc)
154
+				#common stuff
155
+				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) -Winline\
156
+					#-Wmissing-prototypes \
140 157
 			#if gcc 3.0
141 158
 ifeq			($(CC_SHORTVER), 3.0)
142 159
 					CFLAGS+=-minline-all-stringops -malign-double \
... ...
@@ -169,6 +191,9 @@ endif	#ARCH, i386
169 169
 ifeq	($(ARCH), sparc64)
170 170
 			#if gcc
171 171
 ifeq		($(CC_NAME), gcc)
172
+				#common stuff
173
+				CFLAGS=-O9 -funroll-loops  -Wcast-align $(PROFILE) -Winline\
174
+					#-Wmissing-prototypes \
172 175
 				#if gcc 3.0
173 176
 ifeq			($(CC_SHORTVER), 3.0)
174 177
 					#use 32bit for now
... ...
@@ -193,27 +218,52 @@ endif			#CC_SHORTVER, 2.9x
193 193
 endif			#CC_SHORTVER, 3.0
194 194
 
195 195
 else		#CC_NAME, gcc
196
+ifeq		($(CC_NAME), suncc)
197
+			CFLAGS+=-xO5 -fast -native -xarch=v8plusa -xCC \
198
+					-xc99 # C99 support
199
+			# -Dinline="" # add this if cc < 5.3 (define inline as null)
200
+else
196 201
 				#other compilers
197 202
 $(error 			Unsupported compiler ($(CC):$(CC_NAME)), try gcc)
203
+endif		#CC_NAME, suncc
198 204
 endif		#CC_NAME, gcc
199 205
 endif	#ARCH, sparc64
200 206
 
201 207
 
202 208
 
203 209
 # setting LDFLAGS
210
+ifeq	($(CC_NAME), gcc)
211
+	#gcc and maybe others
204 212
 	LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
213
+endif
214
+ifeq	($(CC_NAME), suncc)
215
+	LDFLAGS+=-xO5 $(PROFILE)
216
+endif
205 217
 	# we need -fPIC -DPIC only for shared objects, we don't need them for
206 218
 	# the executable file, because it's always loaded at a fixed address
207 219
 	# -andrei
208 220
 else	#mode,release
209
-	CFLAGS=-g -Wcast-align -Winline $(PROFILE)
210
-	LDFLAGS+=-g -Wl,-E $(PROFILE)
221
+ifeq	($(CC_NAME), gcc)
222
+		CFLAGS=-g -Wcast-align -Winline $(PROFILE)
223
+		LDFLAGS+=-g -Wl,-E $(PROFILE)
224
+endif
225
+ifeq	($(CC_NAME), suncc)
226
+		CFLAGS= -g $(PROFILE)
227
+		LDFLAGS+=-g $(PROFILE)
228
+endif
229
+
211 230
 endif #mode=release
212 231
 
213 232
 
214 233
 #*FLAGS used for compiling the modules
234
+ifeq	($(CC_NAME), gcc)
215 235
 MOD_CFLAGS=-fPIC -DPIC $(CFLAGS)
216 236
 MOD_LDFLAGS=-shared $(LDFLAGS)
237
+endif
238
+ifeq	($(CC_NAME), suncc)
239
+MOD_CFLAGS=-Kpic  $(CFLAGS)
240
+MOD_LDFLAGS=-G $(LDFLAGS)
241
+endif
217 242
 
218 243
 LEX=flex
219 244
 YACC=bison
... ...
@@ -239,8 +289,12 @@ ifeq  ($(OS), SunOS)
239 239
 	endif
240 240
 
241 241
 	YACC=yacc
242
-	LIBS+=-L/usr/local/lib -lxnet -lrt # or -lnsl -lsocket or -lglibc ?
243
-	# -lrt needed for sched_yield; some systems may require -lposix4
242
+
243
+ifeq ($(CC_NAME), suncc)
244
+	LIBS=-lfast
245
+endif
246
+	LIBS+=-ldl -L/usr/local/lib -lfl -lxnet -lrt
247
+	# -lrt needed for sched_yield
244 248
 endif
245 249
 
246 250
 ifeq ($(OS), FreeBSD)
... ...
@@ -71,8 +71,8 @@ int do_action(struct action* a, struct sip_msg* msg)
71 71
 					case URIPORT_ST:
72 72
 									if (uri.port.s){
73 73
 									 /*port=strtol(uri.port.s,&end,10);*/
74
-										port=str2s(uri.port.s, uri.port.len,
75
-													&err);
74
+										port=str2s((unsigned char*)uri.port.s, 
75
+													uri.port.len, &err);
76 76
 										/*if ((end)&&(*end)){*/
77 77
 										if (err){
78 78
 											LOG(L_ERR, "ERROR: do_action: "
... ...
@@ -140,7 +140,11 @@ int do_action(struct action* a, struct sip_msg* msg)
140 140
 					p->addr_idx=0;
141 141
 				p->ok=1;
142 142
 			}
143
+			memcpy(&(to->sin_addr.s_addr), p->host.h_addr_list[p->addr_idx],
144
+					sizeof(to->sin_addr.s_addr));
145
+			/*
143 146
 			to->sin_addr.s_addr=*((long*)p->host.h_addr_list[p->addr_idx]);
147
+			*/
144 148
 			p->tx++;
145 149
 			p->tx_bytes+=msg->len;
146 150
 			ret=udp_send(msg->orig, msg->len, (struct sockaddr*)to,
... ...
@@ -592,7 +592,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
592 592
 		| SET_URI error { $$=0; yyerror("missing '(' or ')' ?"); }
593 593
 		| SET_URI LPAREN error RPAREN { $$=0; yyerror("bad argument, "
594 594
 										"string expected"); }
595
-		| ID LPAREN RPAREN			{ f_tmp=find_export($1, 0);
595
+		| ID LPAREN RPAREN			{ f_tmp=(void*)find_export($1, 0);
596 596
 									   if (f_tmp==0){
597 597
 										yyerror("unknown command, missing"
598 598
 										" loadmodule?\n");
... ...
@@ -606,7 +606,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
606 606
 													);
607 607
 									   }
608 608
 									}
609
-		| ID LPAREN STRING RPAREN { f_tmp=find_export($1, 1);
609
+		| ID LPAREN STRING RPAREN { f_tmp=(void*)find_export($1, 1);
610 610
 									if (f_tmp==0){
611 611
 										yyerror("unknown command, missing"
612 612
 										" loadmodule?\n");
... ...
@@ -621,7 +621,7 @@ cmd:		FORWARD LPAREN host RPAREN	{ $$=mk_action(	FORWARD_T,
621 621
 									}
622 622
 								  }
623 623
 		| ID LPAREN STRING  COMMA STRING RPAREN 
624
-								  { f_tmp=find_export($1, 2);
624
+								  { f_tmp=(void*)find_export($1, 2);
625 625
 									if (f_tmp==0){
626 626
 										yyerror("unknown command, missing"
627 627
 										" loadmodule?\n");
... ...
@@ -30,18 +30,35 @@
30 30
 void dprint (char* format, ...);
31 31
 
32 32
 #ifdef NO_DEBUG
33
-	#define DPrint(fmt, args...)
33
+	#ifdef __SUNPRO_C
34
+		#define DPrint(...)
35
+	#else
36
+		#define DPrint(fmt, args...)
37
+	#endif
34 38
 #else
35
-	#define DPrint(fmt,args...) \
36
-		do{ \
37
-			if (debug>=DPRINT_LEV){ \
38
-				if (log_stderr){ \
39
-					dprint (fmt, ## args); \
40
-				}else{ \
41
-					syslog(DPRINT_LEV|L_FAC, fmt, ## args); \
42
-				}\
43
-			} \
44
-		}while(0)
39
+	#ifdef __SUNPRO_C
40
+		#define DPrint( ...) \
41
+			do{ \
42
+				if (debug>=DPRINT_LEV){ \
43
+					if (log_stderr){ \
44
+						dprint (__VA_ARGS__); \
45
+					}else{ \
46
+						syslog(DPRINT_LEV|L_FAC,  __VA_ARGS__); \
47
+					}\
48
+				} \
49
+			}while(0)
50
+	#else
51
+			#define DPrint(fmt,args...) \
52
+			do{ \
53
+				if (debug>=DPRINT_LEV){ \
54
+					if (log_stderr){ \
55
+						dprint (fmt, ## args); \
56
+					}else{ \
57
+						syslog(DPRINT_LEV|L_FAC, fmt, ## args); \
58
+					}\
59
+				} \
60
+			}while(0)
61
+	#endif
45 62
 
46 63
 #endif
47 64
 
... ...
@@ -50,10 +67,46 @@ void dprint (char* format, ...);
50 50
 #endif
51 51
 
52 52
 #ifdef NO_LOG
53
-	#define LOG(lev, fmt, args...)
53
+	#ifdef __SUNPRO_C
54
+		#define LOG(lev, ...)
55
+	#else
56
+		#define LOG(lev, fmt, args...)
57
+	#endif
54 58
 #else
55
-
56
-	#define LOG(lev, fmt, args...) \
59
+	#ifdef __SUNPRO_C
60
+		#define LOG(lev, ...) \
61
+			do { \
62
+				if (debug>=(lev)){ \
63
+					if (log_stderr) dprint (__VA_ARGS__); \
64
+					else { \
65
+						switch(lev){ \
66
+							case L_CRIT: \
67
+								syslog(LOG_CRIT | L_FAC, __VA_ARGS__); \
68
+								break; \
69
+							case L_ALERT: \
70
+								syslog(LOG_ALERT | L_FAC, __VA_ARGS__); \
71
+								break; \
72
+							case L_ERR: \
73
+								syslog(LOG_ERR | L_FAC, __VA_ARGS__); \
74
+								break; \
75
+							case L_WARN: \
76
+								syslog(LOG_WARNING | L_FAC, __VA_ARGS__);\
77
+								break; \
78
+							case L_NOTICE: \
79
+								syslog(LOG_NOTICE | L_FAC, __VA_ARGS__); \
80
+								break; \
81
+							case L_INFO: \
82
+								syslog(LOG_INFO | L_FAC, __VA_ARGS__); \
83
+								break; \
84
+							case L_DBG: \
85
+								syslog(LOG_DEBUG | L_FAC, __VA_ARGS__); \
86
+								break; \
87
+						} \
88
+					} \
89
+				} \
90
+			}while(0)
91
+	#else
92
+		#define LOG(lev, fmt, args...) \
57 93
 			do { \
58 94
 				if (debug>=(lev)){ \
59 95
 					if (log_stderr) dprint (fmt, ## args); \
... ...
@@ -84,13 +137,22 @@ void dprint (char* format, ...);
84 84
 					} \
85 85
 				} \
86 86
 			}while(0)
87
+	#endif /*SUN_PRO_C*/
87 88
 #endif
88 89
 
89 90
 
90 91
 #ifdef NO_DEBUG
91
-	#define DBG(fmt, args...)
92
+	#ifdef __SUNPRO_C
93
+		#define DBG(...)
94
+	#else
95
+		#define DBG(fmt, args...)
96
+	#endif
92 97
 #else
93
-	#define DBG(fmt, args...) LOG(L_DBG, fmt, ## args)
98
+	#ifdef __SUNPRO_C
99
+		#define DBG(...) LOG(L_DBG, __VA_ARGS__)
100
+	#else
101
+		#define DBG(fmt, args...) LOG(L_DBG, fmt, ## args)
102
+	#endif
94 103
 #endif
95 104
 
96 105
 #endif /* ifndef dprint_h */
... ...
@@ -63,8 +63,12 @@ int forward_request( struct sip_msg* msg, struct proxy_l * p)
63 63
 			p->addr_idx++;
64 64
 		p->ok=1;
65 65
 	}
66
-	/* ? not 64bit clean?*/
66
+	
67
+	memcpy(&(to->sin_addr.s_addr), p->host.h_addr_list[p->addr_idx],
68
+			sizeof(to->sin_addr.s_addr));
69
+	/* 
67 70
 	to->sin_addr.s_addr=*((long*)p->host.h_addr_list[p->addr_idx]);
71
+	*/
68 72
 
69 73
 	p->tx++;
70 74
 	p->tx_bytes+=len;
... ...
@@ -98,7 +102,7 @@ int update_sock_struct_from_via( struct sockaddr_in* to,  struct via_body* via )
98 98
 	to->sin_port = (via->port)?htons(via->port): htons(SIP_PORT);
99 99
 
100 100
 #ifdef DNS_IP_HACK
101
-	to->sin_addr.s_addr=str2ip(via->host.s, via->host.len, &err);
101
+	to->sin_addr.s_addr=str2ip((unsigned char*)via->host.s,via->host.len,&err);
102 102
 	if (err)
103 103
 #endif
104 104
 	{
... ...
@@ -109,7 +113,11 @@ int update_sock_struct_from_via( struct sockaddr_in* to,  struct via_body* via )
109 109
 					via->host.s);
110 110
 			return -1;
111 111
 		}
112
+		memcpy(&(to->sin_addr.s_addr), he->h_addr_list[0], 
113
+				sizeof(to->sin_addr.s_addr));
114
+		/*
112 115
 		to->sin_addr.s_addr=*((long*)he->h_addr_list[0]);
116
+		*/
113 117
 	}
114 118
 	return 1;
115 119
 }
... ...
@@ -388,7 +388,7 @@ int main_loop()
388 388
 		for(;;) sleep(LONG_SLEEP);
389 389
 	}
390 390
 	
391
-	return 0;
391
+	/*return 0; */
392 392
  error:
393 393
 	return -1;
394 394
 
... ...
@@ -748,7 +748,8 @@ int main(int argc, char** argv)
748 748
 			DPrint("ERROR: could not resolve %s\n", names[r]);
749 749
 			goto error;
750 750
 		}
751
-		addresses[r]=*((long*)he->h_addr_list[0]);
751
+		memcpy(&addresses[r], he->h_addr_list[0], sizeof(int));
752
+		/*addresses[r]=*((long*)he->h_addr_list[0]);*/
752 753
 		printf("%s [%s] : %d\n",names[r],
753 754
 				inet_ntoa(*(struct in_addr*)&addresses[r]),
754 755
 				(unsigned short)port_no);
... ...
@@ -57,13 +57,16 @@ static void* shm_mempool=(void*)-1;
57 57
 	struct qm_block* shm_block;
58 58
 #endif
59 59
 
60
-#define sh_realloc(_p, _size) ({ \
61
-		char *_c; \
62
-		shm_lock(); \
63
-		shm_free_unsafe( (_p) ); \
64
-		_c=shm_malloc_unsafe( (_size) ); \
65
-		shm_unlock(); \
66
-		_c; })
60
+
61
+inline static void* sh_realloc(void* p, unsigned int size)
62
+{
63
+	void *r;
64
+	shm_lock(); 
65
+	shm_free_unsafe(p);
66
+	r=shm_malloc_unsafe(size);
67
+	shm_unlock();
68
+	return r;
69
+}
67 70
 
68 71
 /* look at a buffer if there is perhaps enough space for the new size
69 72
    (It is benefitial to do so because vq_malloc is pretty stateful
... ...
@@ -83,7 +86,11 @@ void* _shm_resize( void* p , unsigned int s)
83 83
 #ifdef VQ_MALLOC
84 84
 	struct vqm_frag *f;
85 85
 #else
86
-#	warning shm_resize performs suboptimally without VQ_MALLOC!
86
+	#ifdef __SUNPRO_C
87
+		/*no warning support on Sun cc */
88
+	#else
89
+		#warning shm_resize performs suboptimally without VQ_MALLOC!
90
+	#endif
87 91
 #endif
88 92
 
89 93
 	if (p==0) {
... ...
@@ -214,6 +221,9 @@ void shm_mem_destroy()
214 214
 #ifndef SHM_MMAP
215 215
 	struct shmid_ds shm_info;
216 216
 #endif
217
+#ifndef FAST_LOCK
218
+	union semun zero_un;
219
+#endif
217 220
 	
218 221
 	DBG("shm_mem_destroy\n");
219 222
 	if (shm_mempool && (shm_mempool!=(void*)-1)) {
... ...
@@ -232,7 +242,8 @@ void shm_mem_destroy()
232 232
 #endif
233 233
 #ifndef FAST_LOCK
234 234
 	if (shm_semid!=-1) {
235
-		semctl(shm_semid, 0, IPC_RMID, (union semun)0);
235
+		zero_un.val=0;
236
+		semctl(shm_semid, 0, IPC_RMID, zero_un);
236 237
 		shm_semid=-1;
237 238
 	}
238 239
 #endif
... ...
@@ -126,18 +126,24 @@ again:
126 126
 
127 127
 #define shm_malloc_unsafe(_size ) \
128 128
 	MY_MALLOC(shm_block, (_size), __FILE__, __FUNCTION__, __LINE__ )
129
-#define shm_malloc(_size) \
130
-({\
131
-	void *p;\
132
-	\
129
+
130
+
131
+
132
+inline static void* shm_malloc(unsigned int size)
133
+{
134
+	void *p;
135
+	
133 136
 	shm_lock();\
134
-	p=shm_malloc_unsafe( (_size) );\
135
-	shm_unlock();\
136
-	p; \
137
-})
137
+	p=shm_malloc_unsafe(size);
138
+	shm_unlock();
139
+	return p; 
140
+}
141
+
142
+
138 143
 
139 144
 #define shm_free_unsafe( _p  ) \
140 145
 	MY_FREE( shm_block, (_p), __FILE__, __FUNCTION__, __LINE__ )
146
+
141 147
 #define shm_free(_p) \
142 148
 do { \
143 149
 		shm_lock(); \
... ...
@@ -148,21 +154,27 @@ do { \
148 148
 #define shm_resize(_p, _s ) \
149 149
 	_shm_resize( (_p), (_s),   __FILE__, __FUNCTION__, __LINE__)
150 150
 
151
+
152
+
151 153
 #else
152 154
 
155
+
153 156
 #define shm_malloc_unsafe(_size) MY_MALLOC(shm_block, (_size))
154
-#define shm_malloc(size) \
155
-({\
156
-	void *p;\
157
-	\
158
-		shm_lock();\
159
-		p=shm_malloc_unsafe(size); \
160
-		shm_unlock();\
161
-	 p; \
162
-})
157
+
158
+inline static void* shm_malloc(unsigned int size)
159
+{
160
+	void *p;
161
+	
162
+	shm_lock();
163
+	p=shm_malloc_unsafe(size);
164
+	shm_unlock();
165
+	 return p; 
166
+}
167
+
163 168
 
164 169
 
165 170
 #define shm_free_unsafe( _p ) MY_FREE(shm_block, (_p))
171
+
166 172
 #define shm_free(_p) \
167 173
 do { \
168 174
 		shm_lock(); \
... ...
@@ -170,8 +182,11 @@ do { \
170 170
 		shm_unlock(); \
171 171
 }while(0)
172 172
 
173
+
174
+
173 175
 #define shm_resize(_p, _s) _shm_resize( (_p), (_s))
174 176
 
177
+
175 178
 #endif
176 179
 
177 180
 
... ...
@@ -324,7 +324,7 @@ char* parse_hostport(char* buf, str* host, short int* port)
324 324
 		*port=0;
325 325
 	}else{
326 326
 		*tmp=0;
327
-		*port=str2s(tmp+1, strlen(tmp+1), &err);
327
+		*port=str2s((unsigned char*)(tmp+1), strlen(tmp+1), &err);
328 328
 		if (err ){
329 329
 			LOG(L_INFO, 
330 330
 					"ERROR: hostport: trailing chars in port number: %s\n",
... ...
@@ -504,8 +504,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
504 504
 						fl->u.request.uri.s=tmp;
505 505
 						state=P_URI;
506 506
 						break;
507
-						state=VER3;
508
-						break;
509 507
 					case L_VER:
510 508
 					case VER1:
511 509
 					case VER2:
... ...
@@ -553,8 +551,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
553 553
 						fl->u.request.uri.s=tmp;
554 554
 						state=P_URI;
555 555
 						break;
556
-						state=VER3;
557
-						break;
558 556
 					case L_VER:
559 557
 					case VER1:
560 558
 					case VER2:
... ...
@@ -602,8 +598,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
602 602
 						fl->u.request.uri.s=tmp;
603 603
 						state=P_URI;
604 604
 						break;
605
-						state=VER3;
606
-						break;
607 605
 					case L_VER:
608 606
 					case VER1:
609 607
 					case VER2:
... ...
@@ -657,8 +651,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
657 657
 						fl->u.request.uri.s=tmp;
658 658
 						state=P_URI;
659 659
 						break;
660
-						state=VER3;
661
-						break;
662 660
 					case L_VER:
663 661
 					case VER1:
664 662
 					case VER2:
... ...
@@ -709,8 +701,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
709 709
 						fl->u.request.uri.s=tmp;
710 710
 						state=P_URI;
711 711
 						break;
712
-						state=VER3;
713
-						break;
714 712
 					case L_VER:
715 713
 					case VER1:
716 714
 					case VER2:
... ...
@@ -761,8 +751,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
761 761
 						fl->u.request.uri.s=tmp;
762 762
 						state=P_URI;
763 763
 						break;
764
-						state=VER3;
765
-						break;
766 764
 					case L_VER:
767 765
 					case VER1:
768 766
 					case VER2:
... ...
@@ -810,8 +798,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
810 810
 						fl->u.request.uri.s=tmp;
811 811
 						state=P_URI;
812 812
 						break;
813
-						state=VER3;
814
-						break;
815 813
 					case L_VER:
816 814
 					case VER1:
817 815
 					case VER2:
... ...
@@ -859,8 +845,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
859 859
 						fl->u.request.uri.s=tmp;
860 860
 						state=P_URI;
861 861
 						break;
862
-						state=VER3;
863
-						break;
864 862
 					case L_VER:
865 863
 					case VER1:
866 864
 					case VER2:
... ...
@@ -905,8 +889,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
905 905
 						fl->u.request.uri.s=tmp;
906 906
 						state=P_URI;
907 907
 						break;
908
-						state=VER3;
909
-						break;
910 908
 					case L_VER:
911 909
 					case VER1:
912 910
 					case VER2:
... ...
@@ -954,8 +936,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
954 954
 						fl->u.request.uri.s=tmp;
955 955
 						state=P_URI;
956 956
 						break;
957
-						state=VER3;
958
-						break;
959 957
 					case L_VER:
960 958
 					case VER1:
961 959
 					case VER2:
... ...
@@ -1058,8 +1038,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
1058 1058
 						fl->u.request.uri.s=tmp;
1059 1059
 						state=P_URI;
1060 1060
 						break;
1061
-						state=VER3;
1062
-						break;
1063 1061
 					case L_VER:
1064 1062
 					case VER1:
1065 1063
 					case VER2:
... ...
@@ -1102,8 +1080,6 @@ char* parse_fline(char* buffer, char* end, struct msg_start* fl)
1102 1102
 						fl->u.request.uri.s=tmp;
1103 1103
 						state=P_URI;
1104 1104
 						break;
1105
-						state=VER3;
1106
-						break;
1107 1105
 					case L_VER:
1108 1106
 					case VER1:
1109 1107
 					case VER2:
... ...
@@ -33,7 +33,7 @@ enum{ S_PARA_NAME=20, PARA_NAME, S_EQUAL, S_PARA_VALUE, TAG1, TAG2, TAG3
33 33
 
34 34
 
35 35
 char* parse_to_param(char *buffer, char *end, struct to_body *to_b,
36
-								unsigned int *returned_status)
36
+								int *returned_status)
37 37
 {
38 38
 	struct to_param *param=0;
39 39
 	int status =PARA_START;
... ...
@@ -1699,7 +1699,7 @@ endofpacket:
1699 1699
 	vb->error=VIA_PARSE_OK;
1700 1700
 	vb->bsize=tmp-buffer;
1701 1701
 	if (vb->port_str.s){
1702
-		vb->port=str2s(vb->port_str.s, vb->port_str.len, &err);
1702
+		vb->port=str2s((unsigned char*)vb->port_str.s, vb->port_str.len, &err);
1703 1703
 		if (err){
1704 1704
 					LOG(L_ERR, "ERROR: parse_via: invalid port number <%s>\n",
1705 1705
 						vb->port_str.s);
... ...
@@ -1712,7 +1712,7 @@ nextvia:
1712 1712
 	vb->error=VIA_PARSE_OK;
1713 1713
 	vb->bsize=tmp-buffer;
1714 1714
 	if (vb->port_str.s){
1715
-		vb->port=str2s(vb->port_str.s, vb->port_str.len, &err);
1715
+		vb->port=str2s((unsigned char*)vb->port_str.s, vb->port_str.len, &err);
1716 1716
 		if (err){
1717 1717
 					LOG(L_ERR, "ERROR: parse_via: invalid port number <%s>\n",
1718 1718
 						vb->port_str.s);
... ...
@@ -7,40 +7,38 @@
7 7
 
8 8
 char* eat_line(char* buffer, unsigned int len);
9 9
 
10
-/* turn the most frequently called functions into macros */
11
-
12
-
13
-#define eat_space_end(buffer,pend)                                       \
14
-  ( {   char *_p;                                                 	\
15
-	char *_pe=(pend);						\
16
-        for(_p=(buffer);(_p<_pe)&& (*_p==' ' || *_p=='\t') ;_p++);		\
17
-        _p;                                                              \
18
-  } )
19
-
20
-#define eat_token_end(buffer,pend)					\
21
-  ( { char *_p       ;							\
22
-      char *_pe=(pend);						\
23
-      for (_p=(buffer);(_p<_pe)&&					\
24
-                        (*_p!=' ')&&(*_p!='\t')&&(*_p!='\n')&&(*_p!='\r');	\
25
-                _p++);							\
26
-      _p;								\
27
-  } )
28
-
29
-#define eat_token2_end(buffer,pend,delim)					\
30
-  ( { char *_p       ;							\
31
-      char *_pe=(pend);						\
32
-      for (_p=(buffer);(_p<_pe)&&					\
33
-                        (*_p!=(delim))&&(*_p!='\n')&&(*_p!='\r');		\
34
-                _p++);							\
35
-      _p;								\
36
-  } )
37
-
38
-#define is_empty_end(buffer, pend )					\
39
-  ( { char *_p;								\
40
-      char *_pe=(pend);						\
41
-      _p=eat_space_end( buffer, _pe );					\
42
-      ((_p<(pend )) && (*_p=='\r' || *_p=='\n')) ? 1 : 0;			\
43
-  } )
10
+/* turn the most frequently called functions into inline functions */
11
+
12
+
13
+inline static char* eat_space_end(char* p, char* pend)
14
+{
15
+	for(;(p<pend)&&(*p==' ' || *p=='\t') ;p++);
16
+	return p;
17
+}
18
+
19
+
20
+
21
+inline static char* eat_token_end(char* p, char* pend)
22
+{
23
+	for (;(p<pend)&&(*p!=' ')&&(*p!='\t')&&(*p!='\n')&&(*p!='\r'); p++);
24
+	return p;
25
+}
26
+
27
+
28
+
29
+inline static char* eat_token2_end(char* p, char* pend, char delim)
30
+{
31
+	for (;(p<pend)&&(*p!=(delim))&&(*p!='\n')&&(*p!='\r'); p++);
32
+	return p;
33
+}
34
+
35
+
36
+
37
+inline static int is_empty_end(char* p, char* pend )
38
+{
39
+	p=eat_space_end(p, pend );
40
+	return ((p<(pend )) && (*p=='\r' || *p=='\n'));
41
+}
44 42
 
45 43
 
46 44
 #endif
... ...
@@ -176,7 +176,7 @@ struct proxy_l* mk_proxy(char* name, unsigned short port)
176 176
 	p->port=port;
177 177
 #ifdef DNS_IP_HACK
178 178
 	len=strlen(name);
179
-	ip=str2ip(name, len, &err);
179
+	ip=str2ip((unsigned char*)name, len, &err);
180 180
 	if (err==0){
181 181
 		p->host.h_name=malloc(len+1);
182 182
 		if (p->host.h_name==0) goto error;
... ...
@@ -128,7 +128,7 @@ int load_module(char* path)
128 128
 		}
129 129
 	}
130 130
 	/* launch register */
131
-	mod_register = dlsym(handle, "mod_register");
131
+	mod_register = (module_register)dlsym(handle, "mod_register");
132 132
 	if ( (error =dlerror())!=0 ){
133 133
 		LOG(L_ERR, "ERROR: load_module: %s\n", error);
134 134
 		goto error1;
... ...
@@ -176,7 +176,7 @@ struct sr_module* find_module(void* f, int *i)
176 176
 	int r;
177 177
 	for (t=modules;t;t=t->next){
178 178
 		for(r=0;r<t->exports->cmd_no;r++) 
179
-			if (f==t->exports->cmd_pointers[r]) {
179
+			if (f==(void*)t->exports->cmd_pointers[r]) {
180 180
 				if (i) *i=r;
181 181
 				return t;
182 182
 			}
... ...
@@ -1,231 +1,231 @@
1
-#ifndef STRS_H
2
-#define STRS_H
3
-
4
-#define via1 0x3a616976   /* "via:" */
5
-#define viA1 0x3a416976   /* "viA:" */
6
-#define vIa1 0x3a614976   /* "vIa:" */
7
-#define vIA1 0x3a414976   /* "vIA:" */
8
-#define Via1 0x3a616956   /* "Via:" */
9
-#define ViA1 0x3a416956   /* "ViA:" */
10
-#define VIa1 0x3a614956   /* "VIa:" */
11
-#define VIA1 0x3a414956   /* "VIA:" */
12
-
13
-#define via2 0x20616976   /* "via " */
14
-#define viA2 0x20416976   /* "viA " */
15
-#define vIa2 0x20614976   /* "vIa " */
16
-#define vIA2 0x20414976   /* "vIA " */
17
-#define Via2 0x20616956   /* "Via " */
18
-#define ViA2 0x20416956   /* "ViA " */
19
-#define VIa2 0x20614956   /* "VIa " */
20
-#define VIA2 0x20414956   /* "VIA " */
21
-
22
-#define from 0x6d6f7266   /* "from" */
23
-#define froM 0x4d6f7266   /* "froM" */
24
-#define frOm 0x6d4f7266   /* "frOm" */
25
-#define frOM 0x4d4f7266   /* "frOM" */
26
-#define fRom 0x6d6f5266   /* "fRom" */
27
-#define fRoM 0x4d6f5266   /* "fRoM" */
28
-#define fROm 0x6d4f5266   /* "fROm" */
29
-#define fROM 0x4d4f5266   /* "fROM" */
30
-#define From 0x6d6f7246   /* "From" */
31
-#define FroM 0x4d6f7246   /* "FroM" */
32
-#define FrOm 0x6d4f7246   /* "FrOm" */
33
-#define FrOM 0x4d4f7246   /* "FrOM" */
34
-#define FRom 0x6d6f5246   /* "FRom" */
35
-#define FRoM 0x4d6f5246   /* "FRoM" */
36
-#define FROm 0x6d4f5246   /* "FROm" */
37
-#define FROM 0x4d4f5246   /* "FROM" */
38
-
39
-#define to12 0x203a6f74   /* "to: " */
40
-#define tO12 0x203a4f74   /* "tO: " */
41
-#define To12 0x203a6f54   /* "To: " */
42
-#define TO12 0x203a4f54   /* "TO: " */
43
-
44
-#define to21 0x3a206f74   /* "to :" */
45
-#define tO21 0x3a204f74   /* "tO :" */
46
-#define To21 0x3a206f54   /* "To :" */
47
-#define TO21 0x3a204f54   /* "TO :" */
48
-
49
-#define cseq 0x71657363   /* "cseq" */
50
-#define cseQ 0x51657363   /* "cseQ" */
51
-#define csEq 0x71457363   /* "csEq" */
52
-#define csEQ 0x51457363   /* "csEQ" */
53
-#define cSeq 0x71655363   /* "cSeq" */
54
-#define cSeQ 0x51655363   /* "cSeQ" */
55
-#define cSEq 0x71455363   /* "cSEq" */
56
-#define cSEQ 0x51455363   /* "cSEQ" */
57
-#define Cseq 0x71657343   /* "Cseq" */
58
-#define CseQ 0x51657343   /* "CseQ" */
59
-#define CsEq 0x71457343   /* "CsEq" */
60
-#define CsEQ 0x51457343   /* "CsEQ" */
61
-#define CSeq 0x71655343   /* "CSeq" */
62
-#define CSeQ 0x51655343   /* "CSeQ" */
63
-#define CSEq 0x71455343   /* "CSEq" */
64
-#define CSEQ 0x51455343   /* "CSEQ" */
65
-
66
-#define call 0x6c6c6163   /* "call" */
67
-#define calL 0x4c6c6163   /* "calL" */
68
-#define caLl 0x6c4c6163   /* "caLl" */
69
-#define caLL 0x4c4c6163   /* "caLL" */
70
-#define cAll 0x6c6c4163   /* "cAll" */
71
-#define cAlL 0x4c6c4163   /* "cAlL" */
72
-#define cALl 0x6c4c4163   /* "cALl" */
73
-#define cALL 0x4c4c4163   /* "cALL" */
74
-#define Call 0x6c6c6143   /* "Call" */
75
-#define CalL 0x4c6c6143   /* "CalL" */
76
-#define CaLl 0x6c4c6143   /* "CaLl" */
77
-#define CaLL 0x4c4c6143   /* "CaLL" */
78
-#define CAll 0x6c6c4143   /* "CAll" */
79
-#define CAlL 0x4c6c4143   /* "CAlL" */
80
-#define CALl 0x6c4c4143   /* "CALl" */
81
-#define CALL 0x4c4c4143   /* "CALL" */
82
-
83
-#define _id1 0x3a64692d   /* "-id:" */
84
-#define _iD1 0x3a44692d   /* "-iD:" */
85
-#define _Id1 0x3a64492d   /* "-Id:" */
86
-#define _ID1 0x3a44492d   /* "-ID:" */
87
-
88
-#define _id2 0x2064692d   /* "-id " */
89
-#define _iD2 0x2044692d   /* "-iD " */
90
-#define _Id2 0x2064492d   /* "-Id " */
91
-#define _ID2 0x2044492d   /* "-ID " */
92
-
93
-#define cont 0x746e6f63   /* "cont" */
94
-#define conT 0x546e6f63   /* "conT" */
95
-#define coNt 0x744e6f63   /* "coNt" */
96
-#define coNT 0x544e6f63   /* "coNT" */
97
-#define cOnt 0x746e4f63   /* "cOnt" */
98
-#define cOnT 0x546e4f63   /* "cOnT" */
99
-#define cONt 0x744e4f63   /* "cONt" */
100
-#define cONT 0x544e4f63   /* "cONT" */
101
-#define Cont 0x746e6f43   /* "Cont" */
102
-#define ConT 0x546e6f43   /* "ConT" */
103
-#define CoNt 0x744e6f43   /* "CoNt" */
104
-#define CoNT 0x544e6f43   /* "CoNT" */
105
-#define COnt 0x746e4f43   /* "COnt" */
106
-#define COnT 0x546e4f43   /* "COnT" */
107
-#define CONt 0x744e4f43   /* "CONt" */
108
-#define CONT 0x544e4f43   /* "CONT" */
109
-
110
-#define act1 0x3a746361   /* "act:" */
111
-#define acT1 0x3a546361   /* "acT:" */
112
-#define aCt1 0x3a744361   /* "aCt:" */
113
-#define aCT1 0x3a544361   /* "aCT:" */
114
-#define Act1 0x3a746341   /* "Act:" */
115
-#define AcT1 0x3a546341   /* "AcT:" */
116
-#define ACt1 0x3a744341   /* "ACt:" */
117
-#define ACT1 0x3a544341   /* "ACT:" */
118
-
119
-#define act2 0x20746361   /* "act " */
120
-#define acT2 0x20546361   /* "acT " */
121
-#define aCt2 0x20744361   /* "aCt " */
122
-#define aCT2 0x20544361   /* "aCT " */
123
-#define Act2 0x20746341   /* "Act " */
124
-#define AcT2 0x20546341   /* "AcT " */
125
-#define ACt2 0x20744341   /* "ACt " */
126
-#define ACT2 0x20544341   /* "ACT " */
127
-
128
-#define max_ 0x2d78616d   /* "max-" */
129
-#define maX_ 0x2d58616d   /* "maX-" */
130
-#define mAx_ 0x2d78416d   /* "mAx-" */
131
-#define mAX_ 0x2d58416d   /* "mAX-" */
132
-#define Max_ 0x2d78614d   /* "Max-" */
133
-#define MaX_ 0x2d58614d   /* "MaX-" */
134
-#define MAx_ 0x2d78414d   /* "MAx-" */
135
-#define MAX_ 0x2d58414d   /* "MAX-" */
136
-
137
-#define forw 0x77726f66   /* "forw" */
138
-#define forW 0x57726f66   /* "forW" */
139
-#define foRw 0x77526f66   /* "foRw" */
140
-#define foRW 0x57526f66   /* "foRW" */
141
-#define fOrw 0x77724f66   /* "fOrw" */
142
-#define fOrW 0x57724f66   /* "fOrW" */
143
-#define fORw 0x77524f66   /* "fORw" */
144
-#define fORW 0x57524f66   /* "fORW" */
145
-#define Forw 0x77726f46   /* "Forw" */
146
-#define ForW 0x57726f46   /* "ForW" */
147
-#define FoRw 0x77526f46   /* "FoRw" */
148
-#define FoRW 0x57526f46   /* "FoRW" */
149
-#define FOrw 0x77724f46   /* "FOrw" */
150
-#define FOrW 0x57724f46   /* "FOrW" */
151
-#define FORw 0x77524f46   /* "FORw" */
152
-#define FORW 0x57524f46   /* "FORW" */
153
-
154
-#define ards 0x73647261   /* "ards" */
155
-#define ardS 0x53647261   /* "ardS" */
156
-#define arDs 0x73447261   /* "arDs" */
157
-#define arDS 0x53447261   /* "arsd" */
158
-#define aRds 0x73645261   /* "aRds" */
159
-#define aRdS 0x53645261   /* "aRdS" */
160
-#define aRDs 0x73445261   /* "aRDs" */
161
-#define aRDS 0x53445261   /* "aRDS" */
162
-#define Ards 0x73647241   /* "Ards" */
163
-#define ArdS 0x53647241   /* "ArdS" */
164
-#define ArDs 0x73447241   /* "ArDs" */
165
-#define ArDS 0x53447241   /* "ArDS" */
166
-#define ARds 0x73645241   /* "ARds" */
167
-#define ARdS 0x53645241   /* "ARdS" */
168
-#define ARDs 0x73445241   /* "ARDs" */
169
-#define ARDS 0x53445241   /* "ARDS" */
170
-
171
-#define rout 0x74756f72   /* "rout" */
172
-#define rouT 0x54756f72   /* "rouT" */
173
-#define roUt 0x74556f72   /* "roUt" */
174
-#define roUT 0x54556f72   /* "roUT" */
175
-#define rOut 0x74754f72   /* "rOut" */
176
-#define rOuT 0x54754f72   /* "rOuT" */
177
-#define rOUt 0x74554f72   /* "rOUt" */
178
-#define rOUT 0x54554f72   /* "rOUT" */
179
-#define Rout 0x74756f52   /* "Rout" */
180
-#define RouT 0x54756f52   /* "RouT" */
181
-#define RoUt 0x74556f52   /* "RoUt" */
182
-#define RoUT 0x54556f52   /* "RoUT" */
183
-#define ROut 0x74754f52   /* "ROut" */
184
-#define ROuT 0x54754f52   /* "ROuT" */
185
-#define ROUt 0x74554f52   /* "ROUt" */
186
-#define ROUT 0x54554f52   /* "ROUT" */
187
-
188
-#define reco 0x6f636572   /* "reco" */
189
-#define recO 0x4f636572   /* "recO" */
190
-#define reCo 0x6f436572   /* "reCo" */
191
-#define reCO 0x4f436572   /* "reCO" */
192
-#define rEco 0x6f634572   /* "rEco" */
193
-#define rEcO 0x4f634572   /* "rEcO" */
194
-#define rECo 0x6f434572   /* "rECo" */
195
-#define rECO 0x4f434572   /* "rECO" */
196
-#define Reco 0x6f636552   /* "Reco" */
197
-#define RecO 0x4f636552   /* "RecO" */
198
-#define ReCo 0x6f436552   /* "ReCo" */
199
-#define ReCO 0x4f436552   /* "ReCO" */
200
-#define REco 0x6f634552   /* "REco" */
201
-#define REcO 0x4f634552   /* "REcO" */
202
-#define RECo 0x6f434552   /* "RECo" */
203
-#define RECO 0x4f434552   /* "RECO" */
204
-
205
-#define rd_r 0x722d6472   /* "rd-r" */
206
-#define rd_R 0x522d6472   /* "rd-R" */
207
-#define rD_r 0x722d4472   /* "rD-r" */
208
-#define rD_R 0x522d4472   /* "rD-R" */
209
-#define Rd_r 0x722d6452   /* "Rd-r" */
210
-#define Rd_R 0x522d6452   /* "Rd-R" */
211
-#define RD_r 0x722d4452   /* "RD-r" */
212
-#define RD_R 0x522d4452   /* "RD-R" */
213
-
214
-#define oute 0x6574756f   /* "oute" */
215
-#define outE 0x4574756f   /* "outE" */
216
-#define ouTe 0x6554756f   /* "ouTe" */
217
-#define ouTE 0x4554756f   /* "ouTE" */
218
-#define oUte 0x6574556f   /* "oUte" */
219
-#define oUtE 0x4574556f   /* "oUtE" */
220
-#define oUTe 0x6554556f   /* "oUTe" */
221
-#define oUTE 0x4554556f   /* "oUTE" */
222
-#define Oute 0x6574754f   /* "Oute" */
223
-#define OutE 0x4574754f   /* "OutE" */
224
-#define OuTe 0x6554754f   /* "OuTe" */
225
-#define OuTE 0x4554754f   /* "OuTE" */
226
-#define OUte 0x6574554f   /* "OUte" */
227
-#define OUtE 0x4574554f   /* "OUtE" */
228
-#define OUTe 0x6554554f   /* "OUTe" */
229
-#define OUTE 0x4554554f   /* "OUTE" */
230
-
231
-#endif
1
+#ifndef STRS_H
2
+#define STRS_H
3
+
4
+#define via1 0x3a616976   /* "via:" */
5
+#define viA1 0x3a416976   /* "viA:" */
6
+#define vIa1 0x3a614976   /* "vIa:" */
7
+#define vIA1 0x3a414976   /* "vIA:" */
8
+#define Via1 0x3a616956   /* "Via:" */
9
+#define ViA1 0x3a416956   /* "ViA:" */
10
+#define VIa1 0x3a614956   /* "VIa:" */
11
+#define VIA1 0x3a414956   /* "VIA:" */
12
+
13
+#define via2 0x20616976   /* "via " */
14
+#define viA2 0x20416976   /* "viA " */
15
+#define vIa2 0x20614976   /* "vIa " */
16
+#define vIA2 0x20414976   /* "vIA " */
17
+#define Via2 0x20616956   /* "Via " */
18
+#define ViA2 0x20416956   /* "ViA " */
19
+#define VIa2 0x20614956   /* "VIa " */
20
+#define VIA2 0x20414956   /* "VIA " */
21
+
22
+#define from 0x6d6f7266   /* "from" */
23
+#define froM 0x4d6f7266   /* "froM" */
24
+#define frOm 0x6d4f7266   /* "frOm" */
25
+#define frOM 0x4d4f7266   /* "frOM" */
26
+#define fRom 0x6d6f5266   /* "fRom" */
27
+#define fRoM 0x4d6f5266   /* "fRoM" */
28
+#define fROm 0x6d4f5266   /* "fROm" */
29
+#define fROM 0x4d4f5266   /* "fROM" */
30
+#define From 0x6d6f7246   /* "From" */
31
+#define FroM 0x4d6f7246   /* "FroM" */
32
+#define FrOm 0x6d4f7246   /* "FrOm" */
33
+#define FrOM 0x4d4f7246   /* "FrOM" */
34
+#define FRom 0x6d6f5246   /* "FRom" */
35
+#define FRoM 0x4d6f5246   /* "FRoM" */
36
+#define FROm 0x6d4f5246   /* "FROm" */
37
+#define FROM 0x4d4f5246   /* "FROM" */
38
+
39
+#define to12 0x203a6f74   /* "to: " */
40
+#define tO12 0x203a4f74   /* "tO: " */
41
+#define To12 0x203a6f54   /* "To: " */
42
+#define TO12 0x203a4f54   /* "TO: " */
43
+
44
+#define to21 0x3a206f74   /* "to :" */
45
+#define tO21 0x3a204f74   /* "tO :" */
46
+#define To21 0x3a206f54   /* "To :" */
47
+#define TO21 0x3a204f54   /* "TO :" */
48
+
49
+#define cseq 0x71657363   /* "cseq" */
50
+#define cseQ 0x51657363   /* "cseQ" */
51
+#define csEq 0x71457363   /* "csEq" */
52
+#define csEQ 0x51457363   /* "csEQ" */
53
+#define cSeq 0x71655363   /* "cSeq" */
54
+#define cSeQ 0x51655363   /* "cSeQ" */
55
+#define cSEq 0x71455363   /* "cSEq" */
56
+#define cSEQ 0x51455363   /* "cSEQ" */
57
+#define Cseq 0x71657343   /* "Cseq" */
58
+#define CseQ 0x51657343   /* "CseQ" */
59
+#define CsEq 0x71457343   /* "CsEq" */
60
+#define CsEQ 0x51457343   /* "CsEQ" */
61
+#define CSeq 0x71655343   /* "CSeq" */
62
+#define CSeQ 0x51655343   /* "CSeQ" */
63
+#define CSEq 0x71455343   /* "CSEq" */
64
+#define CSEQ 0x51455343   /* "CSEQ" */
65
+
66
+#define call 0x6c6c6163   /* "call" */
67
+#define calL 0x4c6c6163   /* "calL" */
68
+#define caLl 0x6c4c6163   /* "caLl" */
69
+#define caLL 0x4c4c6163   /* "caLL" */
70
+#define cAll 0x6c6c4163   /* "cAll" */
71
+#define cAlL 0x4c6c4163   /* "cAlL" */
72
+#define cALl 0x6c4c4163   /* "cALl" */
73
+#define cALL 0x4c4c4163   /* "cALL" */
74
+#define Call 0x6c6c6143   /* "Call" */
75
+#define CalL 0x4c6c6143   /* "CalL" */
76
+#define CaLl 0x6c4c6143   /* "CaLl" */
77
+#define CaLL 0x4c4c6143   /* "CaLL" */
78
+#define CAll 0x6c6c4143   /* "CAll" */
79
+#define CAlL 0x4c6c4143   /* "CAlL" */
80
+#define CALl 0x6c4c4143   /* "CALl" */
81
+#define CALL 0x4c4c4143   /* "CALL" */
82
+
83
+#define _id1 0x3a64692d   /* "-id:" */
84
+#define _iD1 0x3a44692d   /* "-iD:" */
85
+#define _Id1 0x3a64492d   /* "-Id:" */
86
+#define _ID1 0x3a44492d   /* "-ID:" */
87
+
88
+#define _id2 0x2064692d   /* "-id " */
89
+#define _iD2 0x2044692d   /* "-iD " */
90
+#define _Id2 0x2064492d   /* "-Id " */
91
+#define _ID2 0x2044492d   /* "-ID " */
92
+
93
+#define cont 0x746e6f63   /* "cont" */
94
+#define conT 0x546e6f63   /* "conT" */
95
+#define coNt 0x744e6f63   /* "coNt" */
96
+#define coNT 0x544e6f63   /* "coNT" */
97
+#define cOnt 0x746e4f63   /* "cOnt" */
98
+#define cOnT 0x546e4f63   /* "cOnT" */
99
+#define cONt 0x744e4f63   /* "cONt" */
100
+#define cONT 0x544e4f63   /* "cONT" */
101
+#define Cont 0x746e6f43   /* "Cont" */
102
+#define ConT 0x546e6f43   /* "ConT" */
103
+#define CoNt 0x744e6f43   /* "CoNt" */
104
+#define CoNT 0x544e6f43   /* "CoNT" */
105
+#define COnt 0x746e4f43   /* "COnt" */
106
+#define COnT 0x546e4f43   /* "COnT" */
107
+#define CONt 0x744e4f43   /* "CONt" */
108
+#define CONT 0x544e4f43   /* "CONT" */
109
+
110
+#define act1 0x3a746361   /* "act:" */
111
+#define acT1 0x3a546361   /* "acT:" */
112
+#define aCt1 0x3a744361   /* "aCt:" */
113
+#define aCT1 0x3a544361   /* "aCT:" */
114
+#define Act1 0x3a746341   /* "Act:" */
115
+#define AcT1 0x3a546341   /* "AcT:" */
116
+#define ACt1 0x3a744341   /* "ACt:" */
117
+#define ACT1 0x3a544341   /* "ACT:" */
118
+
119
+#define act2 0x20746361   /* "act " */
120
+#define acT2 0x20546361   /* "acT " */
121
+#define aCt2 0x20744361   /* "aCt " */
122
+#define aCT2 0x20544361   /* "aCT " */
123
+#define Act2 0x20746341   /* "Act " */
124
+#define AcT2 0x20546341   /* "AcT " */
125
+#define ACt2 0x20744341   /* "ACt " */
126
+#define ACT2 0x20544341   /* "ACT " */
127
+
128
+#define max_ 0x2d78616d   /* "max-" */
129
+#define maX_ 0x2d58616d   /* "maX-" */
130
+#define mAx_ 0x2d78416d   /* "mAx-" */
131
+#define mAX_ 0x2d58416d   /* "mAX-" */
132
+#define Max_ 0x2d78614d   /* "Max-" */
133
+#define MaX_ 0x2d58614d   /* "MaX-" */
134
+#define MAx_ 0x2d78414d   /* "MAx-" */
135
+#define MAX_ 0x2d58414d   /* "MAX-" */
136
+
137
+#define forw 0x77726f66   /* "forw" */
138
+#define forW 0x57726f66   /* "forW" */
139
+#define foRw 0x77526f66   /* "foRw" */
140
+#define foRW 0x57526f66   /* "foRW" */
141
+#define fOrw 0x77724f66   /* "fOrw" */
142
+#define fOrW 0x57724f66   /* "fOrW" */
143
+#define fORw 0x77524f66   /* "fORw" */
144
+#define fORW 0x57524f66   /* "fORW" */
145
+#define Forw 0x77726f46   /* "Forw" */
146
+#define ForW 0x57726f46   /* "ForW" */
147
+#define FoRw 0x77526f46   /* "FoRw" */
148
+#define FoRW 0x57526f46   /* "FoRW" */
149
+#define FOrw 0x77724f46   /* "FOrw" */
150
+#define FOrW 0x57724f46   /* "FOrW" */
151
+#define FORw 0x77524f46   /* "FORw" */
152
+#define FORW 0x57524f46   /* "FORW" */
153
+
154
+#define ards 0x73647261   /* "ards" */
155
+#define ardS 0x53647261   /* "ardS" */
156
+#define arDs 0x73447261   /* "arDs" */
157
+#define arDS 0x53447261   /* "arsd" */
158
+#define aRds 0x73645261   /* "aRds" */
159
+#define aRdS 0x53645261   /* "aRdS" */
160
+#define aRDs 0x73445261   /* "aRDs" */
161
+#define aRDS 0x53445261   /* "aRDS" */
162
+#define Ards 0x73647241   /* "Ards" */
163
+#define ArdS 0x53647241   /* "ArdS" */
164
+#define ArDs 0x73447241   /* "ArDs" */
165
+#define ArDS 0x53447241   /* "ArDS" */
166
+#define ARds 0x73645241   /* "ARds" */
167
+#define ARdS 0x53645241   /* "ARdS" */
168
+#define ARDs 0x73445241   /* "ARDs" */
169
+#define ARDS 0x53445241   /* "ARDS" */
170
+
171
+#define rout 0x74756f72   /* "rout" */
172
+#define rouT 0x54756f72   /* "rouT" */
173
+#define roUt 0x74556f72   /* "roUt" */
174
+#define roUT 0x54556f72   /* "roUT" */
175
+#define rOut 0x74754f72   /* "rOut" */
176
+#define rOuT 0x54754f72   /* "rOuT" */
177
+#define rOUt 0x74554f72   /* "rOUt" */
178
+#define rOUT 0x54554f72   /* "rOUT" */
179
+#define Rout 0x74756f52   /* "Rout" */
180
+#define RouT 0x54756f52   /* "RouT" */
181
+#define RoUt 0x74556f52   /* "RoUt" */
182
+#define RoUT 0x54556f52   /* "RoUT" */
183
+#define ROut 0x74754f52   /* "ROut" */
184
+#define ROuT 0x54754f52   /* "ROuT" */
185
+#define ROUt 0x74554f52   /* "ROUt" */
186
+#define ROUT 0x54554f52   /* "ROUT" */
187
+
188
+#define reco 0x6f636572   /* "reco" */
189
+#define recO 0x4f636572   /* "recO" */
190
+#define reCo 0x6f436572   /* "reCo" */
191
+#define reCO 0x4f436572   /* "reCO" */
192
+#define rEco 0x6f634572   /* "rEco" */
193
+#define rEcO 0x4f634572   /* "rEcO" */
194
+#define rECo 0x6f434572   /* "rECo" */
195
+#define rECO 0x4f434572   /* "rECO" */
196
+#define Reco 0x6f636552   /* "Reco" */
197
+#define RecO 0x4f636552   /* "RecO" */
198
+#define ReCo 0x6f436552   /* "ReCo" */
199
+#define ReCO 0x4f436552   /* "ReCO" */
200
+#define REco 0x6f634552   /* "REco" */
201
+#define REcO 0x4f634552   /* "REcO" */
202
+#define RECo 0x6f434552   /* "RECo" */
203
+#define RECO 0x4f434552   /* "RECO" */
204
+
205
+#define rd_r 0x722d6472   /* "rd-r" */
206
+#define rd_R 0x522d6472   /* "rd-R" */
207
+#define rD_r 0x722d4472   /* "rD-r" */
208
+#define rD_R 0x522d4472   /* "rD-R" */
209
+#define Rd_r 0x722d6452   /* "Rd-r" */
210
+#define Rd_R 0x522d6452   /* "Rd-R" */
211
+#define RD_r 0x722d4452   /* "RD-r" */
212
+#define RD_R 0x522d4452   /* "RD-R" */
213
+
214
+#define oute 0x6574756f   /* "oute" */
215
+#define outE 0x4574756f   /* "outE" */
216
+#define ouTe 0x6554756f   /* "ouTe" */
217
+#define ouTE 0x4554756f   /* "ouTE" */
218
+#define oUte 0x6574556f   /* "oUte" */
219
+#define oUtE 0x4574556f   /* "oUtE" */
220
+#define oUTe 0x6554556f   /* "oUTe" */
221
+#define oUTE 0x4554556f   /* "oUTE" */
222
+#define Oute 0x6574754f   /* "Oute" */
223
+#define OutE 0x4574754f   /* "OutE" */
224
+#define OuTe 0x6554754f   /* "OuTe" */
225
+#define OuTE 0x4554754f   /* "OuTE" */
226
+#define OUte 0x6574554f   /* "OUte" */
227
+#define OUtE 0x4574554f   /* "OUtE" */
228
+#define OUTe 0x6554554f   /* "OUTe" */
229
+#define OUTE 0x4554554f   /* "OUTE" */
230
+
231
+#endif
... ...
@@ -157,11 +157,11 @@ int udp_rcv_loop()
157 157
 	static char buf [BUF_SIZE+1];
158 158
 #endif
159 159
 
160
-	struct sockaddr* from;
160
+	struct sockaddr_in* from;
161 161
 	int fromlen;
162 162
 
163 163
 
164
-	from=(struct sockaddr*) malloc(sizeof(struct sockaddr));
164
+	from=(struct sockaddr_in*) malloc(sizeof(struct sockaddr_in));
165 165
 	if (from==0){
166 166
 		LOG(L_ERR, "ERROR: udp_rcv_loop: out of memory\n");
167 167
 		goto error;
... ...
@@ -176,8 +176,9 @@ int udp_rcv_loop()
176 176
 			goto error;
177 177
 		}
178 178
 #endif
179
-		fromlen=sizeof(struct sockaddr);
180
-		len=recvfrom(udp_sock, buf, BUF_SIZE, 0, from, &fromlen);
179
+		fromlen=sizeof(struct sockaddr_in);
180
+		len=recvfrom(udp_sock, buf, BUF_SIZE, 0, (struct sockaddr*)from,
181
+						&fromlen);
181 182
 		if (len==-1){
182 183
 			LOG(L_ERR, "ERROR: udp_rcv_loop:recvfrom: %s\n",
183 184
 						strerror(errno));
... ...
@@ -188,14 +189,15 @@ int udp_rcv_loop()
188 188
 		buf[len+1]=0;
189 189
 		
190 190
 		/* receive_msg must free buf too!*/
191
-		receive_msg(buf, len, ((struct sockaddr_in*)from)->sin_addr.s_addr);
191
+		receive_msg(buf, len, from->sin_addr.s_addr);
192 192
 		
193 193
 	/* skip: do other stuff */
194 194
 		
195 195
 	}
196
-	
196
+	/*
197 197
 	if (from) free(from);
198 198
 	return 0;
199
+	*/
199 200
 	
200 201
 error:
201 202
 	if (from) free(from);
... ...
@@ -11,7 +11,7 @@
11 11
 
12 12
 /* returns string beginning and length without insignificant chars */
13 13
 #define trim_len( _len, _begin, _mystr ) \
14
-	({ 	static char _c; \
14
+	do{ 	static char _c; \
15 15
 		(_len)=(_mystr).len; \
16 16
 		while ((_len) && ((_c=(_mystr).s[(_len)-1])==0 || _c=='\r' || _c=='\n' || _c==' ' || _c=='\t' )) \
17 17
 			(_len)--; \
... ...
@@ -20,13 +20,13 @@
20 20
 			(_len)--;\
21 21
 			(_begin)++; \
22 22
 		} \
23
-	})
23
+	}while(0)
24 24
 
25 25
 #define trim_r( _mystr ) \
26
-	({	static _c; \
26
+	do{	static _c; \
27 27
 		while( ((_mystr).len) && ((_c=(_mystr).s[(_mystr).len-1]))==0 || _c=='\r' || _c=='\n') \
28 28
 			(_mystr).len--; \
29
-	})
29
+	}while(0)
30 30
 
31 31
 
32 32
 #define  translate_pointer( _new_buf , _org_buf , _p) \
... ...
@@ -36,7 +36,7 @@
36 36
 
37 37
 /* converts a str to an u. short, returns the u. short and sets *err on
38 38
  * error and if err!=null
39
- * */
39
+  */
40 40
 static inline unsigned short str2s(unsigned char* str, unsigned int len,
41 41
 									int *err)
42 42
 {