Browse code

Replaced dprintf for fprintf (dprintf is somewhat gnu-specific and does not compile on Mac). even though it was just used for debugging (not on the module) it prevented compilation

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5192 689a6050-402a-0410-94f2-e92a70836424

Elias Baixas authored on 13/11/2008 10:18:48
Showing 32 changed files
... ...
@@ -62,19 +62,19 @@ int encode_allow(char *hdrstart,int hdrlen,unsigned int *bodi,char *where)
62 62
    return 4;
63 63
 }
64 64
 
65
-int print_encoded_allow(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
65
+int print_encoded_allow(FILE *fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
66 66
 {
67 67
    unsigned int i,j=0,body;
68 68
 
69 69
    memcpy(&body,payload,4);
70 70
    body=ntohl(body);
71
-   dprintf(fd,"%sMETHODS=",prefix);
71
+   fprintf(fd,"%sMETHODS=",prefix);
72 72
    if(body==0)
73
-      dprintf(fd,"UNKNOWN");
73
+      fprintf(fd,"UNKNOWN");
74 74
    for(i=0;i<32;j=(0x01<<i),i++){
75 75
       if(body & (j<15))
76
-	 dprintf(fd,",%s",mismetodos[i]);
76
+	 fprintf(fd,",%s",mismetodos[i]);
77 77
    }
78
-   dprintf(fd,"\n");
78
+   fprintf(fd,"\n");
79 79
    return 1;
80 80
 }
... ...
@@ -21,4 +21,4 @@
21 21
 
22 22
 
23 23
 int encode_allow(char *hdrstart,int hdrlen,unsigned int *bodi,char *where);
24
-int print_encoded_allow(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
24
+int print_encoded_allow(FILE *fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
... ...
@@ -159,18 +159,18 @@ int encode_contact(char *hdrstart,int hdrlen,contact_t *body,unsigned char *wher
159 159
    return i;
160 160
 }
161 161
 
162
-int print_encoded_contact_body(int fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix)
162
+int print_encoded_contact_body(FILE *fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix)
163 163
 {
164 164
    unsigned char flags, numcontacts;
165 165
    int i,offset;
166 166
 
167 167
    flags=payload[0];
168
-   dprintf(fd,"%s",prefix);
168
+   fprintf(fd,"%s",prefix);
169 169
    for(i=0;i<paylen;i++)
170
-      dprintf(fd,"%s%d%s",i==0?"ENCODED CONTACT BODY:[":":",payload[i],i==paylen-1?"]\n":"");
170
+      fprintf(fd,"%s%d%s",i==0?"ENCODED CONTACT BODY:[":":",payload[i],i==paylen-1?"]\n":"");
171 171
 
172 172
    if(flags & STAR_F){
173
-      dprintf(fd,"%sSTART CONTACT\n",prefix);
173
+      fprintf(fd,"%sSTART CONTACT\n",prefix);
174 174
       return 1;
175 175
    }
176 176
    numcontacts=payload[1];
... ...
@@ -185,39 +185,39 @@ int print_encoded_contact_body(int fd,char *hdr,int hdrlen,unsigned char *payloa
185 185
    }
186 186
    return 1;
187 187
 }
188
-int print_encoded_contact(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
188
+int print_encoded_contact(FILE *fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
189 189
 {
190 190
    int i=2;/* flags + urilength */
191 191
    unsigned char flags=0;
192 192
 
193 193
    flags=payload[0];
194
-   dprintf(fd,"%s",prefix);
194
+   fprintf(fd,"%s",prefix);
195 195
    for(i=0;i<paylen;i++)
196
-      dprintf(fd,"%s%d%s",i==0?"ENCODED CONTACT=[":":",payload[i],i==paylen-1?"]\n":"");
196
+      fprintf(fd,"%s%d%s",i==0?"ENCODED CONTACT=[":":",payload[i],i==paylen-1?"]\n":"");
197 197
    i=2;
198 198
    if(flags & HAS_NAME_F){
199
-      dprintf(fd,"%sCONTACT NAME=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
199
+      fprintf(fd,"%sCONTACT NAME=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
200 200
       i+=2;
201 201
    }
202 202
    if(flags & HAS_Q_F){
203
-      dprintf(fd,"%sCONTACT Q=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
203
+      fprintf(fd,"%sCONTACT Q=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
204 204
       i+=2;
205 205
    }
206 206
    if(flags & HAS_EXPIRES_F){
207
-      dprintf(fd,"%sCONTACT EXPIRES=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
207
+      fprintf(fd,"%sCONTACT EXPIRES=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
208 208
       i+=2;
209 209
    }
210 210
    if(flags & HAS_RECEIVED_F){
211
-      dprintf(fd,"%sCONTACT RECEIVED=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
211
+      fprintf(fd,"%sCONTACT RECEIVED=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
212 212
       i+=2;
213 213
    }
214 214
    if(flags & HAS_METHOD_F){
215
-      dprintf(fd,"%sCONTACT METHOD=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
215
+      fprintf(fd,"%sCONTACT METHOD=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
216 216
       i+=2;
217 217
    }
218 218
    if(print_encoded_uri(fd,&payload[i],payload[1],hdr,hdrlen,strcat(prefix,"  "))<0){
219 219
       prefix[strlen(prefix)-2]=0;
220
-      dprintf(fd,"Error parsing URI\n");
220
+      fprintf(fd,"Error parsing URI\n");
221 221
       return -1;
222 222
    }
223 223
    prefix[strlen(prefix)-2]=0;
... ...
@@ -230,7 +230,7 @@ int print_encoded_contact(int fd,char *hdr,int hdrlen,unsigned char* payload,int
230 230
 /**
231 231
  *
232 232
  */
233
-int dump_contact_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,int fd,char segregationLevel,char *prefix)
233
+int dump_contact_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,FILE *fd,char segregationLevel,char *prefix)
234 234
 {
235 235
    unsigned char flags, numcontacts;
236 236
    int i,offset;
... ...
@@ -257,7 +257,7 @@ int dump_contact_body_test(char *hdr,int hdrlen,unsigned char *payload,int payle
257 257
    return 1;
258 258
 }
259 259
 
260
-int dump_contact_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,int fd,char segregationLevel,char *prefix)
260
+int dump_contact_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,FILE *fd,char segregationLevel,char *prefix)
261 261
 {
262 262
    int i=2;/* flags + urilength */
263 263
    unsigned char flags=0;
... ...
@@ -282,36 +282,36 @@ int dump_contact_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,int
282 282
       return print_uri_junit_tests(hdr,hdrlen,&payload[i],payload[1],fd,1,"");
283 283
    if((segregationLevel & JUNIT) && !(segregationLevel & ONLY_URIS)){
284 284
       i=2;
285
-      dprintf(fd,"%sgetAddress.getDisplayName=(S)",prefix);
285
+      fprintf(fd,"%sgetAddress.getDisplayName=(S)",prefix);
286 286
       if(flags & HAS_NAME_F){
287
-	 dprintf(fd,"%.*s\n",payload[i+1],&hdr[payload[i]]);
287
+	 fprintf(fd,"%.*s\n",payload[i+1],&hdr[payload[i]]);
288 288
 	 i+=2;
289 289
       }else
290
-	 dprintf(fd,"(null)\n");
291
-      dprintf(fd,"%sgetQValue=(F)",prefix);
290
+	 fprintf(fd,"(null)\n");
291
+      fprintf(fd,"%sgetQValue=(F)",prefix);
292 292
       if(flags & HAS_Q_F){
293
-	 dprintf(fd,"%.*s\n",payload[i+1],&hdr[payload[i]]);
293
+	 fprintf(fd,"%.*s\n",payload[i+1],&hdr[payload[i]]);
294 294
 	 i+=2;
295 295
       }else
296
-	 dprintf(fd,"(null)\n");
297
-      dprintf(fd,"%sgetExpires=(I)",prefix);
296
+	 fprintf(fd,"(null)\n");
297
+      fprintf(fd,"%sgetExpires=(I)",prefix);
298 298
       if(flags & HAS_EXPIRES_F){
299
-	 dprintf(fd,"%.*s\n",payload[i+1],&hdr[payload[i]]);
299
+	 fprintf(fd,"%.*s\n",payload[i+1],&hdr[payload[i]]);
300 300
 	 i+=2;
301 301
       }else
302
-	 dprintf(fd,"(null)\n");
302
+	 fprintf(fd,"(null)\n");
303 303
       if(flags & HAS_RECEIVED_F){
304 304
 	 i+=2;
305 305
       }
306 306
       if(flags & HAS_METHOD_F){
307 307
 	 i+=2;
308 308
       }
309
-      dprintf(fd,"%sgetParameter=(SAVP)",prefix);
309
+      fprintf(fd,"%sgetParameter=(SAVP)",prefix);
310 310
       for(i+=payload[1];i<paylen-1;i+=2){
311 311
 	 printf("%.*s=",payload[i+1]-payload[i]-1,&hdr[payload[i]]);
312 312
 	 printf("%.*s;",(payload[i+2]-payload[i+1])==0?0:(payload[i+2]-payload[i+1]-1),&hdr[payload[i+1]]);
313 313
       }
314
-      dprintf(fd,"\n");
314
+      fprintf(fd,"\n");
315 315
    }
316 316
    return 0;
317 317
 }
... ...
@@ -23,7 +23,7 @@
23 23
 #define STAR_F 0x01
24 24
 int encode_contact_body(char *hdr,int hdrlen,contact_body_t *contact_parsed,unsigned char *where);
25 25
 int encode_contact(char *hdr,int hdrlen,contact_t *mycontact,unsigned char *where);
26
-int print_encoded_contact_body(int fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix);
27
-int print_encoded_contact(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
28
-int dump_contact_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,int fd,char segregationLevel,char *prefix);
29
-int dump_contact_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,int fd,char segregationLevel,char *prefix);
26
+int print_encoded_contact_body(FILE* fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix);
27
+int print_encoded_contact(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
28
+int dump_contact_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,FILE* fd,char segregationLevel,char *prefix);
29
+int dump_contact_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,FILE* fd,char segregationLevel,char *prefix);
... ...
@@ -58,16 +58,16 @@ int encode_content_disposition(char *hdrstart,int hdrlen,struct disposition *bod
58 58
    return i;
59 59
 }
60 60
 
61
-int print_encoded_content_disposition(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
61
+int print_encoded_content_disposition(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
62 62
 {
63 63
    int i=3;/* flags + urilength */
64 64
    unsigned char flags=0;
65 65
 
66 66
    flags=payload[0];
67
-   printf("%s",prefix);
67
+   fprintf(fd,"%s",prefix);
68 68
    for(i=0;i<paylen;i++)
69
-      printf("%s%d%s",i==0?"ENCODED CONTENT-DISPOSITION=[":":",payload[i],i==paylen-1?"]\n":"");
70
-   printf("%sCONTENT DISPOSITION:[%.*s]\n",prefix,payload[2],&hdr[payload[1]]);
69
+      fprintf(fd,"%s%d%s",i==0?"ENCODED CONTENT-DISPOSITION=[":":",payload[i],i==paylen-1?"]\n":"");
70
+   fprintf(fd,"%sCONTENT DISPOSITION:[%.*s]\n",prefix,payload[2],&hdr[payload[1]]);
71 71
    print_encoded_parameters(fd,&payload[3],hdr,paylen-3,prefix);
72 72
    return 0;
73 73
 }
... ...
@@ -21,4 +21,4 @@
21 21
 
22 22
 
23 23
 int encode_content_disposition(char *hdrstart,int hdrlen,struct disposition *body,unsigned char *where);
24
-int print_encoded_content_disposition(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
24
+int print_encoded_content_disposition(FILE *fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
... ...
@@ -61,7 +61,7 @@ int encode_contentlength(char *hdr,int hdrlen,long int len,char *where)
61 61
 
62 62
 }
63 63
 
64
-int print_encoded_contentlength(int fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix)
64
+int print_encoded_contentlength(FILE *fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix)
65 65
 {
66 66
    long int content_length;
67 67
    int i;
... ...
@@ -69,10 +69,10 @@ int print_encoded_contentlength(int fd,char *hdr,int hdrlen,unsigned char *paylo
69 69
    memcpy(&content_length,&payload[1],payload[0]);
70 70
    content_length=ntohl(content_length);
71 71
 
72
-   dprintf(fd,"%s",prefix);
72
+   fprintf(fd,"%s",prefix);
73 73
    for(i=0;i<paylen;i++)
74
-      dprintf(fd,"%s%d%s",i==0?"ENCODED CONTENT LENGTH BODY:[":":",payload[i],i==paylen-1?"]\n":"");
75
-   dprintf(fd,"%s  CONTENT LENGTH=[%d]\n",prefix,(int)content_length);
74
+      fprintf(fd,"%s%d%s",i==0?"ENCODED CONTENT LENGTH BODY:[":":",payload[i],i==paylen-1?"]\n":"");
75
+   fprintf(fd,"%s  CONTENT LENGTH=[%d]\n",prefix,(int)content_length);
76 76
    return 1;
77 77
 }
78 78
 
... ...
@@ -21,4 +21,4 @@
21 21
 
22 22
 
23 23
 int encode_contentlength(char *hdr,int hdrlen,long int len,char *where);
24
-int print_encoded_contentlength(int fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix);
24
+int print_encoded_contentlength(FILE* fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix);
... ...
@@ -49,7 +49,7 @@ int encode_content_type(char *hdrstart,int hdrlen,unsigned int bodi,char *where)
49 49
    return encode_mime_type(hdrstart,hdrlen,bodi,where);
50 50
 }
51 51
 
52
-int print_encoded_content_type(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
52
+int print_encoded_content_type(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
53 53
 {
54 54
    unsigned int type;
55 55
    memcpy(&type,payload,sizeof(unsigned int));
... ...
@@ -68,7 +68,7 @@ int encode_accept(char *hdrstart,int hdrlen,unsigned int *bodi,char *where)
68 68
    return 1+i*sizeof(unsigned int);
69 69
 }
70 70
 
71
-int print_encoded_accept(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
71
+int print_encoded_accept(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
72 72
 {
73 73
    int i;
74 74
    unsigned int type;
... ...
@@ -90,7 +90,7 @@ int encode_mime_type(char *hdrstart,int hdrlen,unsigned int bodi,char *where)
90 90
    return sizeof(int);
91 91
 }
92 92
 
93
-int print_encoded_mime_type(int fd,char *hdr,int hdrlen,unsigned int* payload,int paylen,char *prefix)
93
+int print_encoded_mime_type(FILE *fd,char *hdr,int hdrlen,unsigned int* payload,int paylen,char *prefix)
94 94
 {
95 95
    unsigned int type;
96 96
    char *chtype,*chsubtype;
... ...
@@ -168,7 +168,7 @@ int print_encoded_mime_type(int fd,char *hdr,int hdrlen,unsigned int* payload,in
168 168
 	 chsubtype="(didnt know this subtype existed)";
169 169
    }
170 170
 
171
-   dprintf(fd,"%sTYPE:[%s]\n",prefix,chtype);
172
-   dprintf(fd,"%sSUBTYPE:[%s]\n",prefix,chsubtype);
171
+   fprintf(fd,"%sTYPE:[%s]\n",prefix,chtype);
172
+   fprintf(fd,"%sSUBTYPE:[%s]\n",prefix,chsubtype);
173 173
    return 0;
174 174
 }
... ...
@@ -23,6 +23,6 @@
23 23
 int encode_content_type(char *hdrstart,int hdrlen,unsigned int bodi,char *where);
24 24
 int encode_accept(char *hdrstart,int hdrlen,unsigned int *bodi,char *where);
25 25
 int encode_mime_type(char *hdrstart,int hdrlen,unsigned int bodi,char *where);
26
-int print_encoded_mime_type(int fd,char *hdr,int hdrlen,unsigned int* payload,int paylen,char *prefix);
27
-int print_encoded_content_type(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
28
-int print_encoded_accept(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
26
+int print_encoded_mime_type(FILE* fd,char *hdr,int hdrlen,unsigned int* payload,int paylen,char *prefix);
27
+int print_encoded_content_type(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
28
+int print_encoded_accept(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
... ...
@@ -81,14 +81,14 @@ int encode_cseq(char *hdrstart,int hdrlen,struct cseq_body *body,unsigned char *
81 81
    return 9;
82 82
 }
83 83
 
84
-int print_encoded_cseq(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
84
+int print_encoded_cseq(FILE *fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
85 85
 {
86 86
    unsigned int cseqnum;
87 87
    char *what;
88 88
 
89 89
    memcpy(&cseqnum,&payload[1],4);
90 90
    cseqnum=ntohl(cseqnum);
91
-   dprintf(fd,"%sCSEQ NUMBER=%d==%.*s\n",prefix,cseqnum,payload[6],&hdr[payload[5]]);
91
+   fprintf(fd,"%sCSEQ NUMBER=%d==%.*s\n",prefix,cseqnum,payload[6],&hdr[payload[5]]);
92 92
    switch(payload[0]){
93 93
       case 0:
94 94
 	 what="UNDEFINED";
... ...
@@ -139,7 +139,7 @@ int print_encoded_cseq(int fd,char *hdr,int hdrlen,unsigned char* payload,int pa
139 139
 	 what="UNKNOWN?";
140 140
 	 break;
141 141
    }
142
-   dprintf(fd,"%sCSEQ METHOD=%s==%.*s\n",prefix,what,payload[8],&hdr[payload[7]]);
142
+   fprintf(fd,"%sCSEQ METHOD=%s==%.*s\n",prefix,what,payload[8],&hdr[payload[7]]);
143 143
    return 1;
144 144
 
145 145
 }
... ...
@@ -23,4 +23,4 @@
23 23
 #include "../../str.h"
24 24
 #include "../../parser/msg_parser.h"
25 25
 int encode_cseq(char *hdrstart,int hdrlen,struct cseq_body *body,unsigned char *where);
26
-int print_encoded_cseq(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
26
+int print_encoded_cseq(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
... ...
@@ -152,59 +152,59 @@ int encode_digest(char *hdrstart,int hdrlen,dig_cred_t *digest,unsigned char *wh
152 152
 }
153 153
 
154 154
 
155
-int print_encoded_digest(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
155
+int print_encoded_digest(FILE *fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
156 156
 {
157 157
    int i=2;/* flags + flags1 */
158 158
    unsigned char flags1,flags2;
159 159
 
160 160
    flags1=payload[0];
161 161
    flags2=payload[1];
162
-   dprintf(fd,"%s",prefix);
162
+   fprintf(fd,"%s",prefix);
163 163
    for(i=0;i<paylen;i++)
164
-      dprintf(fd,"%s%d%s",i==0?"ENCODED DIGEST=[":":",payload[i],i==paylen-1?"]\n":"");
164
+      fprintf(fd,"%s%d%s",i==0?"ENCODED DIGEST=[":":",payload[i],i==paylen-1?"]\n":"");
165 165
    i=2;
166 166
    if(flags1 & HAS_NAME_F){
167
-      dprintf(fd,"%sDIGEST NAME=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
167
+      fprintf(fd,"%sDIGEST NAME=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
168 168
       i+=2;
169 169
    }
170 170
    if(flags1& HAS_REALM_F){
171
-      dprintf(fd,"%sDIGEST REALM=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
171
+      fprintf(fd,"%sDIGEST REALM=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
172 172
       i+=2;
173 173
    }
174 174
    if(flags1& HAS_NONCE_F){
175
-      dprintf(fd,"%sDIGEST NONCE=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
175
+      fprintf(fd,"%sDIGEST NONCE=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
176 176
       i+=2;
177 177
    }
178 178
    if(flags1& HAS_URI_F){
179 179
       if(print_encoded_uri(fd,&payload[i+1],payload[i],hdr,hdrlen,strcat(prefix,"  "))<0){
180 180
 	 prefix[strlen(prefix)-2]=0;
181
-	 dprintf(fd,"Error parsing encoded URI\n");
181
+	 fprintf(fd,"Error parsing encoded URI\n");
182 182
 	 return -1;
183 183
       }
184 184
       i+=payload[i]+1;
185 185
    }
186 186
    if(flags1& HAS_RESPONSE_F){
187
-      dprintf(fd,"%sDIGEST RESPONSE=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
187
+      fprintf(fd,"%sDIGEST RESPONSE=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
188 188
       i+=2;
189 189
    }
190 190
    if(flags1& HAS_ALG_F){
191
-      dprintf(fd,"%sDIGEST ALGORITHM=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
191
+      fprintf(fd,"%sDIGEST ALGORITHM=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
192 192
       i+=2;
193 193
    }
194 194
    if(flags1& HAS_CNONCE_F){
195
-      dprintf(fd,"%sDIGEST CNONCE=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
195
+      fprintf(fd,"%sDIGEST CNONCE=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
196 196
       i+=2;
197 197
    }
198 198
    if(flags1& HAS_OPAQUE_F){
199
-      dprintf(fd,"%sDIGEST OPAQUE=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
199
+      fprintf(fd,"%sDIGEST OPAQUE=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
200 200
       i+=2;
201 201
    }
202 202
    if(flags2& HAS_QoP_F){
203
-      dprintf(fd,"%sDIGEST QualityOfProtection=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
203
+      fprintf(fd,"%sDIGEST QualityOfProtection=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
204 204
       i+=2;
205 205
    }
206 206
    if(flags2& HAS_NC_F){
207
-      dprintf(fd,"%sDIGEST NonceCount=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
207
+      fprintf(fd,"%sDIGEST NonceCount=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
208 208
       i+=2;
209 209
    }
210 210
    return 0;
... ...
@@ -214,7 +214,7 @@ int print_encoded_digest(int fd,char *hdr,int hdrlen,unsigned char* payload,int
214 214
 /**
215 215
  *
216 216
  */
217
-int dump_digest_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,int fd,char segregationLevel)
217
+int dump_digest_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,FILE* fd,char segregationLevel)
218 218
 {
219 219
    int i=2;/* 2*flags */
220 220
    unsigned char flags1=0,flags2=0;
... ...
@@ -21,5 +21,5 @@
21 21
 
22 22
 
23 23
 int encode_digest(char *hdrstart,int hdrlen,dig_cred_t *digest,unsigned char *where);
24
-int print_encoded_digest(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
25
-int dump_digest_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,int fd,char segregationLevel);
24
+int print_encoded_digest(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
25
+int dump_digest_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,FILE* fd,char segregationLevel);
... ...
@@ -59,12 +59,12 @@ int encode_expires(char *hdrstart,int hdrlen,exp_body_t *body,unsigned char *whe
59 59
    return 6;
60 60
 }
61 61
 
62
-int print_encoded_expires(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
62
+int print_encoded_expires(FILE *fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
63 63
 {
64 64
    int i;
65 65
    memcpy(&i,payload,4);
66 66
    i=ntohl(i);
67
-   dprintf(fd,"%sEXPIRES VALUE=%d==%.*s\n",prefix,i,payload[5],&hdr[payload[4]]);
67
+   fprintf(fd,"%sEXPIRES VALUE=%d==%.*s\n",prefix,i,payload[5],&hdr[payload[4]]);
68 68
    return 1;
69 69
 }
70 70
 
... ...
@@ -21,4 +21,4 @@
21 21
 
22 22
 
23 23
 int encode_expires(char *hdrstart,int hdrlen,exp_body_t *body,unsigned char *where);
24
-int print_encoded_expires(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
24
+int print_encoded_expires(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
... ...
@@ -327,7 +327,7 @@ error:
327 327
    return -1;
328 328
 }
329 329
 
330
-int print_encoded_header(int fd,char *msg,int msglen,unsigned char *payload,int len,char type,char *prefix)
330
+int print_encoded_header(FILE *fd,char *msg,int msglen,unsigned char *payload,int len,char type,char *prefix)
331 331
 {
332 332
    char *hdr_start_ptr;
333 333
    short int start_idx,i;
... ...
@@ -339,11 +339,11 @@ int print_encoded_header(int fd,char *msg,int msglen,unsigned char *payload,int
339 339
    memcpy(&i,payload+HEADER_LEN_IDX,2);
340 340
    i=ntohs(i);
341 341
 
342
-   dprintf(fd,"%sHEADER NAME:[%.*s]\n",prefix,payload[HEADER_NAME_LEN_IDX],hdr_start_ptr);
343
-   dprintf(fd,"%sHEADER:[%.*s]\n",prefix,i-2,hdr_start_ptr);
344
-   dprintf(fd,"%sHEADER CODE=",prefix);
342
+   fprintf(fd,"%sHEADER NAME:[%.*s]\n",prefix,payload[HEADER_NAME_LEN_IDX],hdr_start_ptr);
343
+   fprintf(fd,"%sHEADER:[%.*s]\n",prefix,i-2,hdr_start_ptr);
344
+   fprintf(fd,"%sHEADER CODE=",prefix);
345 345
    for(i=0;i<len;i++)
346
-      dprintf(fd,"%s%d%s",i==0?"[":":",payload[i],i==len-1?"]\n":"");
346
+      fprintf(fd,"%s%d%s",i==0?"[":":",payload[i],i==len-1?"]\n":"");
347 347
    if(len==4)
348 348
       return 1;
349 349
    switch(type){
... ...
@@ -437,7 +437,7 @@ int print_encoded_header(int fd,char *msg,int msglen,unsigned char *payload,int
437 437
    return 1;
438 438
 }
439 439
 
440
-int dump_headers_test(char *msg,int msglen,unsigned char *payload,int len,char type,int fd,char segregationLevel)
440
+int dump_headers_test(char *msg,int msglen,unsigned char *payload,int len,char type,FILE* fd,char segregationLevel)
441 441
 {
442 442
    char *hdr_start_ptr;
443 443
    short int start_idx;
... ...
@@ -504,15 +504,15 @@ int dump_headers_test(char *msg,int msglen,unsigned char *payload,int len,char t
504 504
    return 1;
505 505
 }
506 506
 
507
-int dump_standard_hdr_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,int fd)
507
+int dump_standard_hdr_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,FILE* fd)
508 508
 {
509 509
    int i;
510 510
    i=htonl(hdrlen);
511
-   write(fd,&i,4);
512
-   write(fd,hdr,hdrlen);
511
+   fwrite(&i,1,4,fd);
512
+   fwrite(hdr,1,hdrlen,fd);
513 513
    i=htonl(paylen);
514
-   write(fd,&i,4);
515
-   write(fd,payload,paylen);
516
-   write(fd,&theSignal,4);
514
+   fwrite(&i,1,4,fd);
515
+   fwrite(payload,1,paylen,fd);
516
+   fwrite(&theSignal,1,4,fd);
517 517
    return 0;
518 518
 }
... ...
@@ -22,7 +22,7 @@
22 22
 
23 23
 #include "../../parser/hf.h"
24 24
 #include "../../str.h"
25
-int print_encoded_header(int fd,char *msg,int len,unsigned char *payload,int paylen,char type,char *prefix);
25
+int print_encoded_header(FILE* fd,char *msg,int len,unsigned char *payload,int paylen,char type,char *prefix);
26 26
 int encode_header(struct sip_msg *msg,struct hdr_field *hdr,unsigned char *payload,int paylen);
27
-int dump_headers_test(char *msg,int msglen,unsigned char *payload,int len,char type,int fd,char segregationLevel);
28
-int dump_standard_hdr_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,int fd);
27
+int dump_headers_test(char *msg,int msglen,unsigned char *payload,int len,char type,FILE* fd,char segregationLevel);
28
+int dump_standard_hdr_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,FILE* fd);
... ...
@@ -299,7 +299,7 @@ error:
299 299
    return -1;
300 300
 }
301 301
 
302
-int print_encoded_msg(int fd,char *code,char *prefix)
302
+int print_encoded_msg(FILE* fd,char *code,char *prefix)
303 303
 {
304 304
    unsigned short int i,j,k,l,m,msglen;
305 305
    char r,*msg;
... ...
@@ -313,12 +313,12 @@ int print_encoded_msg(int fd,char *code,char *prefix)
313 313
    j=ntohs(j);
314 314
    msglen=ntohs(msglen);
315 315
    for(k=0;k<j;k++)
316
-      dprintf(fd,"%s%d%s",k==0?"ENCODED-MSG:[":":",payload[k],k==j-1?"]\n":"");
316
+      fprintf(fd,"%s%d%s",k==0?"ENCODED-MSG:[":":",payload[k],k==j-1?"]\n":"");
317 317
    msg=(char*)&payload[j];
318
-   dprintf(fd,"MESSAGE:\n[%.*s]\n",msglen,msg);
318
+   fprintf(fd,"MESSAGE:\n[%.*s]\n",msglen,msg);
319 319
    r=(i<100)?1:0;
320 320
    if(r){
321
-      dprintf(fd,"%sREQUEST CODE=%d==%.*s,URI=%.*s,VERSION=%*.s\n",prefix,i,
321
+      fprintf(fd,"%sREQUEST CODE=%d==%.*s,URI=%.*s,VERSION=%*.s\n",prefix,i,
322 322
 	    payload[METHOD_CODE_IDX+1],&msg[payload[METHOD_CODE_IDX]],
323 323
 	    payload[URI_REASON_IDX+1],&msg[payload[URI_REASON_IDX]],
324 324
 	    payload[VERSION_IDX+1],&msg[payload[VERSION_IDX]]);
... ...
@@ -326,7 +326,7 @@ int print_encoded_msg(int fd,char *code,char *prefix)
326 326
       prefix[strlen(prefix)-2]=0;
327 327
       i=REQUEST_URI_IDX+1+payload[REQUEST_URI_IDX];
328 328
    }else{
329
-      dprintf(fd,"%sRESPONSE CODE=%d==%.*s,REASON=%.*s,VERSION=%.*s\n",prefix,i,
329
+      fprintf(fd,"%sRESPONSE CODE=%d==%.*s,REASON=%.*s,VERSION=%.*s\n",prefix,i,
330 330
 	    payload[METHOD_CODE_IDX+1],&msg[payload[METHOD_CODE_IDX]],
331 331
 	    payload[URI_REASON_IDX+1],&msg[payload[URI_REASON_IDX]],
332 332
 	    payload[VERSION_IDX+1],&msg[payload[VERSION_IDX]]);
... ...
@@ -334,13 +334,13 @@ int print_encoded_msg(int fd,char *code,char *prefix)
334 334
    }
335 335
    k=((payload[CONTENT_IDX]<<8)|payload[CONTENT_IDX+1]);
336 336
    j=msglen-k;
337
-   dprintf(fd,"%sMESSAGE CONTENT:%.*s\n",prefix,j,&msg[k]);
337
+   fprintf(fd,"%sMESSAGE CONTENT:%.*s\n",prefix,j,&msg[k]);
338 338
    j=payload[i];
339
-   dprintf(fd,"%sHEADERS PRESENT(%d):",prefix,j);
339
+   fprintf(fd,"%sHEADERS PRESENT(%d):",prefix,j);
340 340
    i++;
341 341
    for(k=i;k<i+(j*3);k+=3)
342
-      dprintf(fd,"%c%d%c",k==i?'[':',',payload[k],k==(i+3*j-3)?']':' ');
343
-   dprintf(fd,"\n");
342
+      fprintf(fd,"%c%d%c",k==i?'[':',',payload[k],k==(i+3*j-3)?']':' ');
343
+   fprintf(fd,"\n");
344 344
    for(k=i;k<i+(j*3);k+=3){
345 345
       memcpy(&l,&payload[k+1],2);
346 346
       memcpy(&m,&payload[k+4],2);
... ...
@@ -358,7 +358,7 @@ int print_encoded_msg(int fd,char *code,char *prefix)
358 358
  * must be dumped
359 359
  */
360 360
 
361
-int dump_msg_test(char *code,int fd,char header,char segregationLevel)
361
+int dump_msg_test(char *code,FILE* fd,char header,char segregationLevel)
362 362
 {
363 363
    unsigned short int i,j,l,m,msglen;
364 364
    int k;
... ...
@@ -372,8 +372,8 @@ int dump_msg_test(char *code,int fd,char header,char segregationLevel)
372 372
    j=ntohs(j);
373 373
    msglen=ntohs(msglen);
374 374
    if(header==0){
375
-      write(fd,code,j+msglen);
376
-      write(fd,&theSignal,4);
375
+      fwrite(code,1,j+msglen,fd);
376
+      fwrite(&theSignal,1,4,fd);
377 377
       return 0;
378 378
    }
379 379
    msg=(char*)&payload[j];
... ...
@@ -383,12 +383,12 @@ int dump_msg_test(char *code,int fd,char header,char segregationLevel)
383 383
 	 if(!(segregationLevel & JUNIT)){ 
384 384
 	    
385 385
 	    k=htonl(payload[REQUEST_URI_IDX+1]+payload[REQUEST_URI_IDX+2]);
386
-	    write(fd,&k,4);
387
-	    write(fd,msg,ntohl(k));
386
+	    fwrite(&k,1,4,fd);
387
+	    fwrite(msg,1,ntohl(k),fd);
388 388
 	    k=htonl((long)payload[REQUEST_URI_IDX]);
389
-	    write(fd,&k,4);
390
-	    write(fd,&payload[REQUEST_URI_IDX+1],payload[REQUEST_URI_IDX]);
391
-	    write(fd,&theSignal,4);
389
+	    fwrite(&k,1,4,fd);
390
+	    fwrite(&payload[REQUEST_URI_IDX+1],1,payload[REQUEST_URI_IDX],fd);
391
+	    fwrite(&theSignal,1,4,fd);
392 392
 	 }else
393 393
 	    print_uri_junit_tests(msg,payload[REQUEST_URI_IDX+1]+payload[REQUEST_URI_IDX+2]
394 394
 		  ,&payload[REQUEST_URI_IDX+1],payload[REQUEST_URI_IDX],fd,1,"");
... ...
@@ -424,7 +424,7 @@ int dump_msg_test(char *code,int fd,char header,char segregationLevel)
424 424
  * must be dumped
425 425
  */
426 426
 
427
-int print_msg_junit_test(char *code,int fd,char header,char segregationLevel)
427
+int print_msg_junit_test(char *code,FILE* fd,char header,char segregationLevel)
428 428
 {
429 429
    unsigned short int i,j,l,m,msglen;
430 430
    int k;
... ...
@@ -438,8 +438,8 @@ int print_msg_junit_test(char *code,int fd,char header,char segregationLevel)
438 438
    j=ntohs(j);
439 439
    msglen=ntohs(msglen);
440 440
    if(header==0){
441
-      write(fd,code,j+msglen);
442
-      write(fd,&theSignal,4);
441
+      fwrite(code,1,j+msglen,fd);
442
+      fwrite(&theSignal,1,4,fd);
443 443
       return 0;
444 444
    }
445 445
    msg=(char*)&payload[j];
... ...
@@ -447,12 +447,12 @@ int print_msg_junit_test(char *code,int fd,char header,char segregationLevel)
447 447
    if(r){
448 448
       if(segregationLevel & ALSO_RURI){
449 449
 	 k=htonl(50);
450
-	 write(fd,&k,4);
451
-	 write(fd,msg,50);
450
+	 fwrite(&k,1,4,fd);
451
+	 fwrite(msg,1,50,fd);
452 452
 	 k=htonl((long)payload[REQUEST_URI_IDX]);
453
-	 write(fd,&k,4);
454
-	 write(fd,&payload[REQUEST_URI_IDX+1],payload[REQUEST_URI_IDX]);
455
-	 write(fd,&theSignal,4);
453
+	 fwrite(&k,1,4,fd);
454
+	 fwrite(&payload[REQUEST_URI_IDX+1],1,payload[REQUEST_URI_IDX],fd);
455
+	 fwrite(&theSignal,1,4,fd);
456 456
       }
457 457
       i=REQUEST_URI_IDX+1+payload[REQUEST_URI_IDX];
458 458
    }else{
... ...
@@ -40,6 +40,6 @@
40 40
 #define GET_PAY_SIZE( A ) (ntohs(((short*)( A ))[1]) + ntohs(((short*)( A ))[2]))
41 41
 char get_header_code(struct hdr_field *f);
42 42
 int encode_msg(struct sip_msg *msg,char *payload,int len);
43
-int print_encoded_msg(int fd,char *code,char *prefix);
44
-int dump_msg_test(char *code,int fd,char header,char segregationLevel);
43
+int print_encoded_msg(FILE* fd,char *code,char *prefix);
44
+int dump_msg_test(char *code,FILE* fd,char header,char segregationLevel);
45 45
 extern unsigned int theSignal;
... ...
@@ -210,12 +210,12 @@ param_t *reverseParameters(param_t *p)
210 210
 
211 211
 /*prints the encoded parameters
212 212
  */
213
-int print_encoded_parameters(int fd,unsigned char *payload,char *hdr,int paylen,char *prefix)
213
+int print_encoded_parameters(FILE *fd,unsigned char *payload,char *hdr,int paylen,char *prefix)
214 214
 {
215 215
    int i;
216 216
    for(i=0;i<paylen-1;i+=2){
217
-      dprintf(fd,"%s[PARAMETER[%.*s]",prefix,payload[i+1]-payload[i]-1,&hdr[payload[i]]);
218
-      dprintf(fd,"VALUE[%.*s]]\n",(payload[i+2]-payload[i+1])==0?0:(payload[i+2]-payload[i+1]-1),&hdr[payload[i+1]]);
217
+      fprintf(fd,"%s[PARAMETER[%.*s]",prefix,payload[i+1]-payload[i]-1,&hdr[payload[i]]);
218
+      fprintf(fd,"VALUE[%.*s]]\n",(payload[i+2]-payload[i+1])==0?0:(payload[i+2]-payload[i+1]-1),&hdr[payload[i+1]]);
219 219
    }
220 220
    return 0;
221 221
 }
... ...
@@ -23,4 +23,4 @@
23 23
 #include "../../parser/parse_param.h"  /*for param_t def*/
24 24
 int encode_parameters(unsigned char *where,void *pars,char *hdrstart,void *_body,char to);
25 25
 param_t *reverseParameters(param_t *p);
26
-int print_encoded_parameters(int fd,unsigned char *payload,char *hdr,int paylen,char *prefix);
26
+int print_encoded_parameters(FILE* fd,unsigned char *payload,char *hdr,int paylen,char *prefix);
... ...
@@ -125,15 +125,15 @@ int encode_route(char *hdrstart,int hdrlen,rr_t *body,unsigned char *where)
125 125
 }
126 126
 
127 127
 
128
-int print_encoded_route_body(int fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix)
128
+int print_encoded_route_body(FILE *fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix)
129 129
 {
130 130
    unsigned char flags, numroutes;
131 131
    int i,offset;
132 132
 
133 133
    flags=payload[0];
134
-   dprintf(fd,"%s",prefix);
134
+   fprintf(fd,"%s",prefix);
135 135
    for(i=0;i<paylen;i++)
136
-      dprintf(fd,"%s%d%s",i==0?"ENCODED CONTACT BODY:[":":",payload[i],i==paylen-1?"]\n":"");
136
+      fprintf(fd,"%s%d%s",i==0?"ENCODED CONTACT BODY:[":":",payload[i],i==paylen-1?"]\n":"");
137 137
 
138 138
    numroutes=payload[1];
139 139
    if(numroutes==0){
... ...
@@ -148,36 +148,36 @@ int print_encoded_route_body(int fd,char *hdr,int hdrlen,unsigned char *payload,
148 148
    return 1;
149 149
 }
150 150
 
151
-int print_encoded_route(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
151
+int print_encoded_route(FILE *fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
152 152
 {
153 153
    int i=2;/* flags + urilength */
154 154
    unsigned char flags=0;
155 155
 
156 156
    flags=payload[0];
157
-   dprintf(fd,"%s",prefix);
157
+   fprintf(fd,"%s",prefix);
158 158
    for(i=0;i<paylen;i++)
159
-      dprintf(fd,"%s%d%s",i==0?"ENCODED ROUTE=[":":",payload[i],i==paylen-1?"]\n":"");
159
+      fprintf(fd,"%s%d%s",i==0?"ENCODED ROUTE=[":":",payload[i],i==paylen-1?"]\n":"");
160 160
    i=2;
161 161
    if(flags & HAS_NAME_F){
162
-      dprintf(fd,"%sNAME=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
162
+      fprintf(fd,"%sNAME=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
163 163
       i+=2;
164 164
    }
165 165
    if(print_encoded_uri(fd,&payload[i],payload[1],hdr,hdrlen,strcat(prefix,"  "))<0){
166 166
       prefix[strlen(prefix)-2]=0;
167
-      dprintf(fd,"Error parsing URI\n");
167
+      fprintf(fd,"Error parsing URI\n");
168 168
       return -1;
169 169
    }
170 170
    prefix[strlen(prefix)-2]=0;
171 171
    print_encoded_parameters(fd,&payload[i+payload[1]],hdr,paylen-i-payload[1],prefix);
172 172
    /* for(i+=payload[1];i<paylen-1;i+=2){
173
-      dprintf(fd,"%s[PARAMETER[%.*s]",prefix,payload[i+1]-payload[i]-1,&hdr[payload[i]]);
174
-      dprintf(fd,"VALUE[%.*s]]\n",(payload[i+2]-payload[i+1])==0?0:(payload[i+2]-payload[i+1]-1),&hdr[payload[i+1]]);
173
+      fprintf(fd,"%s[PARAMETER[%.*s]",prefix,payload[i+1]-payload[i]-1,&hdr[payload[i]]);
174
+      fprintf(fd,"VALUE[%.*s]]\n",(payload[i+2]-payload[i+1])==0?0:(payload[i+2]-payload[i+1]-1),&hdr[payload[i+1]]);
175 175
    }*/
176 176
    return 0;
177 177
 }
178 178
 
179 179
 
180
-int dump_route_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,int fd,char segregationLevel,char *prefix)
180
+int dump_route_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,FILE* fd,char segregationLevel,char *prefix)
181 181
 {
182 182
    unsigned char flags, numroutes;
183 183
    int i,offset;
... ...
@@ -201,7 +201,7 @@ int dump_route_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,
201 201
    return 1;
202 202
 }
203 203
 
204
-int dump_route_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,int fd,char segregationLevel,char *prefix)
204
+int dump_route_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,FILE* fd,char segregationLevel,char *prefix)
205 205
 {
206 206
    int i=2;/* flags + urilength */
207 207
    unsigned char flags=0;
... ...
@@ -222,12 +222,12 @@ int dump_route_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,int f
222 222
    }
223 223
    if(segregationLevel & JUNIT){
224 224
       i=2;
225
-      dprintf(fd,"%sgetAddress.getDisplayName=(S)",prefix);
225
+      fprintf(fd,"%sgetAddress.getDisplayName=(S)",prefix);
226 226
       if(flags & HAS_NAME_F){
227
-	 dprintf(fd,"%.*s\n",payload[i+1],&hdr[payload[i]]);
227
+	 fprintf(fd,"%.*s\n",payload[i+1],&hdr[payload[i]]);
228 228
 	 i+=2;
229 229
       }else
230
-	 dprintf(fd,"(null)\n");
230
+	 fprintf(fd,"(null)\n");
231 231
       return print_uri_junit_tests(hdr,hdrlen,&payload[i],payload[1],fd,0,"getAddress.getURI.");
232 232
    }
233 233
    return 0;
... ...
@@ -25,7 +25,7 @@
25 25
 int encode_route_body(char *hdr,int hdrlen,rr_t *route_parsed,unsigned char *where);
26 26
 int encode_route(char *hdrstart,int hdrlen,rr_t *body,unsigned char *where);
27 27
 /* TESTING FUNCTIONS */
28
-int print_encoded_route_body(int fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix);
29
-int print_encoded_route(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
30
-int dump_route_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,int fd,char segregationLevel,char *prefix);
31
-int dump_route_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,int fd,char segregationLevel,char *prefix);
28
+int print_encoded_route_body(FILE* fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix);
29
+int print_encoded_route(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
30
+int dump_route_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,FILE* fd,char segregationLevel,char *prefix);
31
+int dump_route_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,FILE* fd,char segregationLevel,char *prefix);
... ...
@@ -103,26 +103,26 @@ int encode_to_body(char *hdrstart,int hdrlen,struct to_body *body,unsigned char
103 103
    return i;
104 104
 }
105 105
 
106
-int print_encoded_to_body(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
106
+int print_encoded_to_body(FILE *fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
107 107
 {
108 108
    int i=2;/* flags + urilength */
109 109
    unsigned char flags=0;
110 110
 
111 111
    flags=payload[0];
112
-   dprintf(fd,"%s",prefix);
112
+   fprintf(fd,"%s",prefix);
113 113
    for(i=0;i<paylen;i++)
114
-      dprintf(fd,"%s%d%s",i==0?"BODY CODE=[":":",payload[i],i==paylen-1?"]\n":"");
114
+      fprintf(fd,"%s%d%s",i==0?"BODY CODE=[":":",payload[i],i==paylen-1?"]\n":"");
115 115
    i=2;
116 116
    if(flags & HAS_DISPLAY_F){
117
-      dprintf(fd,"%sDISPLAY NAME=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
117
+      fprintf(fd,"%sDISPLAY NAME=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
118 118
       i+=2;
119 119
    }
120 120
    if(flags & HAS_TAG_F){
121
-      dprintf(fd,"%sTAG=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
121
+      fprintf(fd,"%sTAG=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
122 122
       i+=2;
123 123
    }
124 124
    if(print_encoded_uri(fd,&payload[i],payload[1],hdr,hdrlen,strcat(prefix,"  "))<0){
125
-      dprintf(fd,"Error parsing URI\n");
125
+      fprintf(fd,"Error parsing URI\n");
126 126
       prefix[strlen(prefix)-2]=0;
127 127
       return -1;
128 128
    }
... ...
@@ -144,7 +144,7 @@ int print_encoded_to_body(int fd,char *hdr,int hdrlen,unsigned char* payload,int
144 144
  *
145 145
  * return 0 on success, <0 on error
146 146
  */
147
-int dump_to_body_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,int fd,char segregationLevel)
147
+int dump_to_body_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,FILE* fd,char segregationLevel)
148 148
 {
149 149
    int i=2;/* flags + urilength */
150 150
    unsigned char flags=0;
... ...
@@ -27,5 +27,5 @@
27 27
 #define HAS_TAG_F	0x02
28 28
 #define HAS_OTHERPAR_F	0x04
29 29
 int encode_to_body(char *hdrstart,int hdrlen,struct to_body *body,unsigned char *where);
30
-int print_encoded_to_body(int fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix);
31
-int dump_to_body_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,int fd,char segregationLevel);
30
+int print_encoded_to_body(FILE* fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix);
31
+int dump_to_body_test(char *hdr,int hdrlen,unsigned char* payload,int paylen,FILE* fd,char segregationLevel);
... ...
@@ -238,75 +238,75 @@ error:
238 238
    return -1;
239 239
 }
240 240
 
241
-int print_encoded_uri(int fd,unsigned char *payload,int paylen,char *hdrstart,int hdrlen,char *prefix)
241
+int print_encoded_uri(FILE *fd,unsigned char *payload,int paylen,char *hdrstart,int hdrlen,char *prefix)
242 242
 {
243 243
    int i=4,j=0;/*1*pointer+1*len+2*flags*/
244 244
    unsigned char uriidx=0,flags1=0,flags2=0,urilen;
245 245
    char *ch_uriptr,*uritype=NULL,*secure=NULL;
246 246
 
247 247
    uriidx=payload[0];
248
-   dprintf(fd,"%s",prefix);
248
+   fprintf(fd,"%s",prefix);
249 249
    for(j=0;j<paylen;j++)
250
-      dprintf(fd,"%s%d%s",j==0?"ENCODED-URI:[":":",payload[j],j==paylen-1?"]\n":"");
250
+      fprintf(fd,"%s%d%s",j==0?"ENCODED-URI:[":":",payload[j],j==paylen-1?"]\n":"");
251 251
    if(uriidx>hdrlen){
252
-      dprintf(fd,"bad index for start of uri: hdrlen=%d uri_index=%d\n",hdrlen,uriidx);
252
+      fprintf(fd,"bad index for start of uri: hdrlen=%d uri_index=%d\n",hdrlen,uriidx);
253 253
       return -1;
254 254
    }
255 255
    ch_uriptr = hdrstart+uriidx;
256 256
    urilen=payload[1];
257 257
    flags1=payload[2];
258 258
    flags2=payload[3];
259
-   dprintf(fd,"%sURI:[%.*s]\n",prefix,urilen,ch_uriptr);
259
+   fprintf(fd,"%sURI:[%.*s]\n",prefix,urilen,ch_uriptr);
260 260
    uritype=flags1&SIP_OR_TEL_F?"SIP":"TEL";
261 261
    secure=flags1&SECURE_F?"S":"";
262
-   dprintf(fd,"%s  TYPE:[%s%s]\n",prefix,uritype,secure);
262
+   fprintf(fd,"%s  TYPE:[%s%s]\n",prefix,uritype,secure);
263 263
    if(flags1 & USER_F){
264
-      dprintf(fd,"%s  USER:[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
264
+      fprintf(fd,"%s  USER:[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
265 265
       ++i;
266 266
    }
267 267
    if(flags1 & PASSWORD_F){
268
-      dprintf(fd,"%s  PASSWORD=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
268
+      fprintf(fd,"%s  PASSWORD=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
269 269
       ++i;
270 270
    }
271 271
    if(flags1 & HOST_F){
272
-      dprintf(fd,"%s  HOST=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
272
+      fprintf(fd,"%s  HOST=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
273 273
       ++i;
274 274
    }
275 275
    if(flags1 & PORT_F){
276
-      dprintf(fd,"%s  PORT=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
276
+      fprintf(fd,"%s  PORT=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
277 277
       ++i;
278 278
    }
279 279
    if(flags1 & PARAMETERS_F){
280
-      dprintf(fd,"%s  PARAMETERS=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
280
+      fprintf(fd,"%s  PARAMETERS=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
281 281
       ++i;
282 282
    }
283 283
    if(flags1 & HEADERS_F){
284
-      dprintf(fd,"%s  HEADERS=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
284
+      fprintf(fd,"%s  HEADERS=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
285 285
       ++i;
286 286
    }
287 287
    ++i;
288 288
    if(flags2 & TRANSPORT_F){
289
-      dprintf(fd,"%s  TRANSPORT=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
289
+      fprintf(fd,"%s  TRANSPORT=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
290 290
       i+=2;
291 291
    }
292 292
    if(flags2 & TTL_F){
293
-      dprintf(fd,"%s  TTL_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
293
+      fprintf(fd,"%s  TTL_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
294 294
       i+=2;
295 295
    }
296 296
    if(flags2 & USER_F){
297
-      dprintf(fd,"%s  USER_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
297
+      fprintf(fd,"%s  USER_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
298 298
       i+=2;
299 299
    }
300 300
    if(flags2 & METHOD_F){
301
-      dprintf(fd,"%s  METHOD_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
301
+      fprintf(fd,"%s  METHOD_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
302 302
       i+=2;
303 303
    }
304 304
    if(flags2 & MADDR_F){
305
-      dprintf(fd,"%s  MADDR_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
305
+      fprintf(fd,"%s  MADDR_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
306 306
       i+=2;
307 307
    }
308 308
    if(flags2 & LR_F){
309
-      dprintf(fd,"%s  LR_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
309
+      fprintf(fd,"%s  LR_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
310 310
       i+=2;
311 311
    }
312 312
    print_encoded_parameters(fd,&payload[i],ch_uriptr,paylen-i,prefix);
... ...
@@ -314,7 +314,7 @@ int print_encoded_uri(int fd,unsigned char *payload,int paylen,char *hdrstart,in
314 314
 }
315 315
 
316 316
 
317
-int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int paylen,int fd,char also_hdr,char *prefix)
317
+int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int paylen,FILE *fd,char also_hdr,char *prefix)
318 318
 {
319 319
    int i=4,k=0,m=0;/*1*pointer+1*len+2*flags*/
320 320
    unsigned char uriidx=0,flags1=0,flags2=0,urilen;
... ...
@@ -322,7 +322,7 @@ int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int p
322 322
 
323 323
    uriidx=payload[0];
324 324
    if(uriidx>hdrlen){
325
-      dprintf(fd,"bad index for start of uri: hdrlen=%d uri_index=%d\n",hdrlen,uriidx);
325
+      fprintf(fd,"bad index for start of uri: hdrlen=%d uri_index=%d\n",hdrlen,uriidx);
326 326
       return -1;
327 327
    }
328 328
 
... ...
@@ -332,51 +332,51 @@ int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int p
332 332
    urilen=payload[1];
333 333
    flags1=payload[2];
334 334
    flags2=payload[3];
335
-   dprintf(fd,"%stoString=(S)%.*s\n",prefix,urilen,ch_uriptr);
335
+   fprintf(fd,"%stoString=(S)%.*s\n",prefix,urilen,ch_uriptr);
336 336
    uritype=flags1&SIP_OR_TEL_F?"sip":"tel";
337 337
    secure=flags1&SECURE_F?"s":"";
338
-   dprintf(fd,"%sgetScheme=(S)%s%s\n",prefix,uritype,secure);
339
-   dprintf(fd,"%sisSecure=(B)%s\n",prefix,flags1&SECURE_F?"true":"false");
340
-   dprintf(fd,"%sisSipURI=(B)%s\n",prefix,"true");
341
-   dprintf(fd,"%sgetUser=(S)",prefix);
338
+   fprintf(fd,"%sgetScheme=(S)%s%s\n",prefix,uritype,secure);
339
+   fprintf(fd,"%sisSecure=(B)%s\n",prefix,flags1&SECURE_F?"true":"false");
340
+   fprintf(fd,"%sisSipURI=(B)%s\n",prefix,"true");
341
+   fprintf(fd,"%sgetUser=(S)",prefix);
342 342
    if(flags1 & USER_F){
343
-      dprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
343
+      fprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
344 344
       ++i;
345 345
    }else 
346
-      dprintf(fd,"(null)\n");
347
-   dprintf(fd,"%sgetUserPassword=(S)",prefix);
346
+      fprintf(fd,"(null)\n");
347
+   fprintf(fd,"%sgetUserPassword=(S)",prefix);
348 348
    if(flags1 & PASSWORD_F){
349
-      dprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
349
+      fprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
350 350
       ++i;
351 351
    }else
352
-      dprintf(fd,"(null)\n");
353
-   dprintf(fd,"%sgetHost=(S)",prefix);
352
+      fprintf(fd,"(null)\n");
353
+   fprintf(fd,"%sgetHost=(S)",prefix);
354 354
    if(flags1 & HOST_F){
355
-      dprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
355
+      fprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
356 356
       ++i;
357 357
    }else
358
-      dprintf(fd,"(null)\n");/*can't happen*/
359
-   dprintf(fd,"%sgetPort=(I)",prefix);
358
+      fprintf(fd,"(null)\n");/*can't happen*/
359
+   fprintf(fd,"%sgetPort=(I)",prefix);
360 360
    if(flags1 & PORT_F){
361
-      dprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
361
+      fprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
362 362
       ++i;
363 363
    }else
364
-      dprintf(fd,"(null)\n");
364
+      fprintf(fd,"(null)\n");
365 365
    /*user=phone;transport=udp*/
366 366
    if(flags1 & PARAMETERS_F){
367 367
       aux=&ch_uriptr[payload[i]];
368 368
       aux2=NULL;
369 369
       aux3=aux;
370 370
       m=(payload[i+1]-1-payload[i]);
371
-      dprintf(fd,"%sgetParameter=(SAVP)",prefix);/*SVP = Attribute Value Pair*/
371
+      fprintf(fd,"%sgetParameter=(SAVP)",prefix);/*SVP = Attribute Value Pair*/
372 372
       for(k=0;k<=m;k++){
373 373
 	 if((aux3[k]==';'||(k==m)) && aux2==NULL){/*no parameterValue was found*/
374
-	    dprintf(fd,"%.*s=;",(int)(aux3-aux+k),aux);
374
+	    fprintf(fd,"%.*s=;",(int)(aux3-aux+k),aux);
375 375
 	    aux2=NULL;/*resets the parameterValue-start pointer*/
376 376
 	    aux=aux3+1+k;/*points to the next parameter*/
377 377
 	 }else 
378 378
 	    if((aux3[k]==';'||(k==m)) && aux2!=NULL){
379
-	       dprintf(fd,"%.*s=%.*s;",(int)(aux2-aux),aux,(int)(aux3-aux2-1+k),aux2+1);
379
+	       fprintf(fd,"%.*s=%.*s;",(int)(aux2-aux),aux,(int)(aux3-aux2-1+k),aux2+1);
380 380
 	       aux2=NULL;
381 381
 	       aux=aux3+1+k;
382 382
 	    } else 
... ...
@@ -384,7 +384,7 @@ int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int p
384 384
 		  aux2=aux3+k;
385 385
 	       }
386 386
       }
387
-      dprintf(fd,"\n");
387
+      fprintf(fd,"\n");
388 388
       ++i;
389 389
    }
390 390
    if(flags1 & HEADERS_F){
... ...
@@ -392,15 +392,15 @@ int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int p
392 392
       aux2=NULL;
393 393
       aux3=aux;
394 394
       m=(payload[i+1]-1-payload[i]);
395
-      dprintf(fd,"%sgetHeader=(SAVP)",prefix);
395
+      fprintf(fd,"%sgetHeader=(SAVP)",prefix);
396 396
       for(k=0;k<=m;k++){
397 397
 	 if((aux3[k]==';'||(k==m)) && aux2==NULL){/*no parameterValue was found*/
398
-	    dprintf(fd,"%.*s=;",(int)(aux3-aux+k),aux);
398
+	    fprintf(fd,"%.*s=;",(int)(aux3-aux+k),aux);
399 399
 	    aux2=NULL;/*resets the parameterValue-start pointer*/
400 400
 	    aux=aux3+1+k;/*points to the next parameter*/
401 401
 	 }else 
402 402
 	    if((aux3[k]==';'||(k==m)) && aux2!=NULL){
403
-	       dprintf(fd,"%.*s=%.*s;",(int)(aux2-aux),aux,(int)(aux3-aux2-1+k),aux2+1);
403
+	       fprintf(fd,"%.*s=%.*s;",(int)(aux2-aux),aux,(int)(aux3-aux2-1+k),aux2+1);
404 404
 	       aux2=NULL;
405 405
 	       aux=aux3+1+k;
406 406
 	    } else 
... ...
@@ -408,43 +408,43 @@ int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int p
408 408
 		  aux2=aux3+k;
409 409
 	       }
410 410
       }
411
-      dprintf(fd,"\n");
411
+      fprintf(fd,"\n");
412 412
       ++i;
413 413
    }
414 414
    ++i;
415
-   dprintf(fd,"%sgetTransportParam=(S)",prefix);
415
+   fprintf(fd,"%sgetTransportParam=(S)",prefix);
416 416
    if(flags2 & TRANSPORT_F){
417
-      dprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
417
+      fprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
418 418
       i+=2;
419 419
    }else
420
-      dprintf(fd,"(null)\n");
421
-   dprintf(fd,"%sgetTTLparam=(I)",prefix);
420
+      fprintf(fd,"(null)\n");
421
+   fprintf(fd,"%sgetTTLparam=(I)",prefix);
422 422
    if(flags2 & TTL_F){
423
-      dprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
423
+      fprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
424 424
       i+=2;
425 425
    }else
426
-      dprintf(fd,"(null)\n");
427
-   dprintf(fd,"%sgetUserParam=(S)",prefix);
426
+      fprintf(fd,"(null)\n");
427
+   fprintf(fd,"%sgetUserParam=(S)",prefix);
428 428
    if(flags2 & USER_F){
429
-      dprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
429
+      fprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
430 430
       i+=2;
431 431
    }else
432
-      dprintf(fd,"(null)\n");
433
-   dprintf(fd,"%sgetMethodParam=(S)",prefix);
432
+      fprintf(fd,"(null)\n");
433
+   fprintf(fd,"%sgetMethodParam=(S)",prefix);
434 434
    if(flags2 & METHOD_F){
435
-      dprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
435
+      fprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
436 436
       i+=2;
437 437
    }else
438
-      dprintf(fd,"(null)\n");
439
-   dprintf(fd,"%sgetMAddrParam=(S)",prefix);
438
+      fprintf(fd,"(null)\n");
439
+   fprintf(fd,"%sgetMAddrParam=(S)",prefix);
440 440
    if(flags2 & MADDR_F){
441
-      dprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
441
+      fprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
442 442
       i+=2;
443 443
    }else
444
-      dprintf(fd,"(null)\n");
444
+      fprintf(fd,"(null)\n");
445 445
    if(flags2 & LR_F){
446 446
       i+=2;
447 447
    }
448
-   dprintf(fd,"\n");
448
+   fprintf(fd,"\n");
449 449
    return 0;
450 450
 }
... ...
@@ -41,5 +41,5 @@
41 41
 #define MAX_XURI_LEN	23
42 42
 
43 43
 int encode_uri2(char *hdr,int hdrlen,str uri_str, struct sip_uri *uri_parsed,unsigned char *where);
44
-int print_encoded_uri(int fd,unsigned char *payload,int paylen,char *hdr,int hdrlen,char *prefix);
45
-int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int paylen,int fd,char also_hdr,char *prefix);
44
+int print_encoded_uri(FILE* fd,unsigned char *payload,int paylen,char *hdr,int hdrlen,char *prefix);
45
+int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int paylen,FILE* fd,char also_hdr,char *prefix);
... ...
@@ -150,17 +150,17 @@ int encode_via(char *hdrstart,int hdrlen,struct via_body *body,unsigned char *wh
150 150
    return i;
151 151
 }
152 152
 
153
-int print_encoded_via_body(int fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix)
153
+int print_encoded_via_body(FILE *fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix)
154 154
 {
155 155
    unsigned char flags, numvias;
156 156
    int i,offset;
157 157
 
158 158
    flags=payload[0];
159
-   dprintf(fd,"%s",prefix);
159
+   fprintf(fd,"%s",prefix);
160 160
    for(i=0;i<paylen;i++)
161
-      dprintf(fd,"%s%d%s",i==0?"ENCODED VIA BODY:[":":",payload[i],i==paylen-1?"]\n":"");
161
+      fprintf(fd,"%s%d%s",i==0?"ENCODED VIA BODY:[":":",payload[i],i==paylen-1?"]\n":"");
162 162
    numvias=payload[1];
163
-   dprintf(fd,"%s%d","NUMBER OF VIAS:",numvias);
163
+   fprintf(fd,"%s%d","NUMBER OF VIAS:",numvias);
164 164
    if(numvias==0){
165 165
       LM_ERR("no vias present?\n");
166 166
       return -1;
... ...
@@ -173,58 +173,58 @@ int print_encoded_via_body(int fd,char *hdr,int hdrlen,unsigned char *payload,in
173 173
    return 1;
174 174
 }
175 175
 
176
-int print_encoded_via(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
176
+int print_encoded_via(FILE *fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix)
177 177
 {
178 178
    int i=2;/* flags + urilength */
179 179
    unsigned char flags=0;
180 180
 
181 181
    flags=payload[0];
182
-   dprintf(fd,"%s",prefix);
182
+   fprintf(fd,"%s",prefix);
183 183
    for(i=0;i<paylen;i++)
184
-      dprintf(fd,"%s%d%s",i==0?"ENCODED VIA=[":":",payload[i],i==paylen-1?"]\n":"");
184
+      fprintf(fd,"%s%d%s",i==0?"ENCODED VIA=[":":",payload[i],i==paylen-1?"]\n":"");
185 185
 
186
-   dprintf(fd,"%sPROT=[%.*s]\n",prefix,payload[2]-payload[1]-1,&hdr[payload[1]]);
187
-   dprintf(fd,"%sVER=[%.*s]\n",prefix,payload[3]-payload[2]-1,&hdr[payload[2]]);
188
-   dprintf(fd,"%sTRANSP=[%.*s]\n",prefix,payload[4]-payload[3]-1,&hdr[payload[3]]);
186
+   fprintf(fd,"%sPROT=[%.*s]\n",prefix,payload[2]-payload[1]-1,&hdr[payload[1]]);
187
+   fprintf(fd,"%sVER=[%.*s]\n",prefix,payload[3]-payload[2]-1,&hdr[payload[2]]);
188
+   fprintf(fd,"%sTRANSP=[%.*s]\n",prefix,payload[4]-payload[3]-1,&hdr[payload[3]]);
189 189
 
190
-   dprintf(fd,"%sHOST=[%.*s]\n",prefix,payload[6]-payload[5]-1,&hdr[payload[5]]);
190
+   fprintf(fd,"%sHOST=[%.*s]\n",prefix,payload[6]-payload[5]-1,&hdr[payload[5]]);
191 191
    if(flags & HAS_PORT_F){
192
-      dprintf(fd,"%sPORT=[%.*s]\n",prefix,payload[7]-payload[6]-1,&hdr[payload[6]]);
192
+      fprintf(fd,"%sPORT=[%.*s]\n",prefix,payload[7]-payload[6]-1,&hdr[payload[6]]);
193 193
       i=8;
194 194
    }else
195 195
       i=7;
196 196
    if(flags & HAS_PARAMS_F){
197
-      dprintf(fd,"%sPARAMS=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
197
+      fprintf(fd,"%sPARAMS=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
198 198
       i+=2;
199 199
    }
200 200
    if(flags & HAS_BRANCH_F){
201
-      dprintf(fd,"%sBRANCH=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
201
+      fprintf(fd,"%sBRANCH=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
202 202
       i+=2;
203 203
    }
204 204
    if(flags & HAS_RECEIVED_F){
205
-      dprintf(fd,"%sRECEIVED=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
205
+      fprintf(fd,"%sRECEIVED=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
206 206
       i+=2;
207 207
    }
208 208
    if(flags & HAS_RPORT_F){
209
-      dprintf(fd,"%sRPORT=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
209
+      fprintf(fd,"%sRPORT=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
210 210
       i+=2;
211 211
    }
212 212
    if(flags & HAS_I_F){
213
-      dprintf(fd,"%sI=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
213
+      fprintf(fd,"%sI=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
214 214
       i+=2;
215 215
    }
216 216
    if(flags & HAS_ALIAS_F){
217
-      dprintf(fd,"%sALIAS=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
217
+      fprintf(fd,"%sALIAS=[%.*s]\n",prefix,payload[i+1],&hdr[payload[i]]);
218 218
       i+=2;
219 219
    }
220 220
    for(;i<paylen-1;i+=2){
221
-      dprintf(fd,"%s[PARAMETER[%.*s]",prefix,payload[i+1]-payload[i]-1,&hdr[payload[i]]);
222
-      dprintf(fd,"VALUE[%.*s]]\n",(payload[i+2]-payload[i+1])==0?0:(payload[i+2]-payload[i+1]-1),&hdr[payload[i+1]]);
221
+      fprintf(fd,"%s[PARAMETER[%.*s]",prefix,payload[i+1]-payload[i]-1,&hdr[payload[i]]);
222
+      fprintf(fd,"VALUE[%.*s]]\n",(payload[i+2]-payload[i+1])==0?0:(payload[i+2]-payload[i+1]-1),&hdr[payload[i+1]]);
223 223
    }
224 224
    return 0;
225 225
 }
226 226
 
227
-int dump_via_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,int fd,char segregationLevel)
227
+int dump_via_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,FILE* fd,char segregationLevel)
228 228
 {
229 229
    unsigned char flags, numvias;
230 230
    int i,offset;
... ...
@@ -22,6 +22,6 @@
22 22
 
23 23
 int encode_via_body(char *hdr,int hdrlen,struct via_body *via_parsed,unsigned char *where);
24 24
 int encode_via(char *hdrstart,int hdrlen,struct via_body *body,unsigned char *where);
25
-int print_encoded_via_body(int fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix);
26
-int print_encoded_via(int fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
27
-int dump_via_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,int fd,char segregationLevel);
25
+int print_encoded_via_body(FILE* fd,char *hdr,int hdrlen,unsigned char *payload,int paylen,char *prefix);
26
+int print_encoded_via(FILE* fd,char *hdr,int hdrlen,unsigned char* payload,int paylen,char *prefix);
27
+int dump_via_body_test(char *hdr,int hdrlen,unsigned char *payload,int paylen,FILE* fd,char segregationLevel);
... ...
@@ -60,7 +60,7 @@
60 60
 
61 61
 static inline int memstr(char *haystack,int hlen,char *needle,int nlen);
62 62
 
63
-int buffered_printer(int infd)
63
+int buffered_printer(FILE* infd)
64 64
 {
65 65
    int i,k=0,retval;
66 66
    char *missatge=0,*myerror="";
... ...
@@ -68,7 +68,7 @@ int buffered_printer(int infd)
68 68
    static char mybuffer[1400];
69 69
    static int end=0,last=0;
70 70
 
71
-   while((i=read(infd,&mybuffer[last],1400-last))==1400-last){
71
+   while((i=fread(&mybuffer[last],1,1400-last,infd))==1400-last){
72 72
       if((end=memstr(mybuffer,last+i,"\n\n\n",3))<0){
73 73
 	 last+=i;
74 74
 	 return 0;
... ...
@@ -86,7 +86,7 @@ int buffered_printer(int infd)
86 86
 	 msg.buf=missatge;
87 87
 	 msg.len=end;
88 88
 	 if(!parse_msg(msg.buf,msg.len,&msg))
89
-	    print_msg_info(1,&msg);
89
+	    print_msg_info(stdout,&msg);
90 90
 	 printf("PARSED:%d,last=%d,end=%d\n",k++,last,end);
91 91
 	 free_sip_msg(&msg);
92 92
 	 pkg_free(missatge);
... ...
@@ -105,7 +105,7 @@ exit:
105 105
    return retval;
106 106
 }
107 107
 
108
-int coded_buffered_printer(int infd)
108
+int coded_buffered_printer(FILE* infd)
109 109
 {
110 110
    int i,lastlast;
111 111
    char spaces[50];
... ...
@@ -116,7 +116,7 @@ int coded_buffered_printer(int infd)
116 116
 
117 117
    do{
118 118
       lastlast=1500-last;
119
-      i=read(infd,&mybuffer[last],lastlast);
119
+      i=fread(&mybuffer[last],1,lastlast,infd);
120 120
       printf("read i=%d\n",i);
121 121
       if(i==0)
122 122
 	 break;
... ...
@@ -127,7 +127,7 @@ int coded_buffered_printer(int infd)
127 127
       }
128 128
       if(last>=size){
129 129
 	 printf("should print message: last=%d, size=%d\n",last,size);
130
-	 if(print_encoded_msg(1,mybuffer,spaces)<0){
130
+	 if(print_encoded_msg(stdout,mybuffer,spaces)<0){
131 131
 	    printf("Unable to print encoded msg\n");
132 132
 	    return -1;
133 133
 	 }
... ...
@@ -146,7 +146,7 @@ int coded_buffered_printer(int infd)
146 146
       return 1;
147 147
 }
148 148
 
149
-int print_msg_info(int fd,struct sip_msg* msg)
149
+int print_msg_info(FILE* fd,struct sip_msg* msg)
150 150
 {
151 151
    char *payload=0;
152 152
    char *prefix=0;
... ...
@@ -21,6 +21,6 @@
21 21
 
22 22
 
23 23
 #include "../../parser/msg_parser.h"
24
-int buffered_printer(int infd);
25
-int print_msg_info(int fd,struct sip_msg* msg);
26
-int coded_buffered_printer(int infd);
24
+int buffered_printer(FILE* infd);
25
+int print_msg_info(FILE* fd,struct sip_msg* msg);
26
+int coded_buffered_printer(FILE* infd);