Browse code

modules_k/*: moved k modules in directory modules/

Daniel-Constantin Mierla authored on 20/01/2013 11:57:52
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,450 +0,0 @@
1
-/* $Id$
2
- *
3
- * Copyright (C) 2006-2007 VozTelecom Sistemas S.L
4
- *
5
- * This file is part of Kamailio, a free SIP server.
6
- *
7
- * Kamailio is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version
11
- *
12
- * Kamailio is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License 
18
- * along with this program; if not, write to the Free Software 
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
- */
21
-
22
-/*
23
- * =====================================================================================
24
- * 
25
- *        Filename:  xuri.c
26
- * 
27
- *     Description:  first trial to implement xuri
28
- * 
29
- *         Version:  1.0
30
- *         Created:  16/11/05 18:07:24 CET
31
- *        Revision:  none
32
- *        Compiler:  gcc
33
- * 
34
- *          Author:  Elias Baixas (EB), elias@conillera.net
35
- *         Company:  VozTele.com
36
- * 
37
- * =====================================================================================
38
- */
39
-
40
-#define _GNU_SOURCE
41
-#include <stdio.h>
42
-#include <assert.h>
43
-#include <string.h>
44
-#include <netinet/in.h>
45
-#include "../../mem/mem.h"
46
-#include "../../parser/msg_parser.h"
47
-#include "../../dprint.h"
48
-#include "encode_uri.h"
49
-#include "encode_parameters.h"
50
-#include "encode_header.h"
51
-#include "xaddress.h"
52
-
53
-#define REL_PTR(a,b) ((unsigned char)(b-a))
54
-
55
-/*The XURI is one of the most important parts in SEAS, as
56
- * most of the SIP MESSAGE structured headers (that is,
57
- * headers which have a well-specified body construction)
58
- * use the URI as the body (ie. via, route, record-route,
59
- * contact, from, to, RURI)
60
- *
61
- * the XURI is a codified structure of flags and pointers
62
- * that ease the parsing of the URI string.
63
- *
64
- * 1: The first byte of the structure, is a
65
- * HEADER_START-based pointer to the beginning of the URI
66
- * (including the "sip:").  
67
- * 1: The next byte is the length of the uri, so URIMAX 
68
- * is 256 (enough...) 
69
- * 2: Flags specifying the parts that are present in the URI
70
- *
71
- * as follows:
72
- * 	1: first byte
73
- * 		SIP_OR_TEL_F	0x01 it is SIP or TEL uri.
74
- *		SECURE_F	0x02 it is secure or not (SIPS,TELS)
75
- *		USER_F		0x04 it as a user part (user@host)
76
- *		PASSWORD_F	0x08 it has a password part
77
- *		HOST_F		0x10 it has a host part
78
- *		PORT_F		0x20 it has a port part
79
- *		PARAMETERS_F	0x40 it has a port part
80
- *		HEADERS_F	0x80 it has a port part
81
- *	1: second byte
82
- *		TRANSPORT_F	0x01 it has other parameters
83
- *		TTL_F		0x02 it has headers
84
- *		USER_F		0x04 it has the transport parameter
85
- *		METHOD_F	0x08 it has the ttl parameter
86
- *		MADDR_F		0x10 it has the user parameter
87
- *		LR_F		0x20 it has the method parameter
88
- *
89
- * All the following bytes are URI_START-based pointers to
90
- * the fields that are present in the uri, as specified by
91
- * the flags. They must appear in the same order shown in
92
- * the flags, and only appear if the flag was set to 1.
93
- *
94
- * the end of the field, will be the place where the
95
- * following pointer points to, minus one (note that all the
96
- * fields present in a URI are preceded by 1 character, ie
97
- * sip[:user][:passwod][@host][:port][;param1=x][;param2=y][?hdr1=a][&hdr2=b]$p
98
- * it will be necessary to have a pointer at the end,
99
- * pointing two past the end of the uri, so that the length
100
- * of the last header can be computed.
101
- *
102
- * The reason to have the OTHER and HEADERS flags at the
103
- * beginning(just after the strictly-uri stuff), is that it
104
- * will be necessary to know the length of the parameters
105
- * section and the headers section.  
106
- *
107
- * The parameters can
108
- * appear in an arbitrary order, so they won't be following
109
- * the convention of transport-ttl-user-method-maddr-lr, so
110
- * we can't rely on the next pointer to compute the length
111
- * of the previous pointer field, as the ttl param can 
112
- * appear before the transport param. so the parameter 
113
- * pointers must have 2 bytes: pointer+length.
114
- *
115
- */
116
-int encode_uri2(char *hdr,int hdrlen,str uri_str, struct sip_uri *uri_parsed,unsigned char *payload)
117
-{
118
-   int i=4,j;/* 1*pointer+1*len+2*flags*/
119
-   unsigned int scheme;
120
-   unsigned char flags1=0,flags2=0,uriptr;
121
-
122
-   uriptr=REL_PTR(hdr,uri_str.s);
123
-   if(uri_str.len>255 || uriptr>hdrlen){
124
-      LM_ERR("uri too long, or out of the sip_msg bounds\n");
125
-      return -1;
126
-   }
127
-   payload[0]=uriptr;
128
-   payload[1]=(unsigned char)uri_str.len;
129
-   if(uri_parsed->user.s && uri_parsed->user.len){
130
-      flags1 |= USER_F;
131
-      payload[i++]=REL_PTR(uri_str.s,uri_parsed->user.s);
132
-   }
133
-   if(uri_parsed->passwd.s && uri_parsed->passwd.len){
134
-      flags1 |= PASSWORD_F;
135
-      payload[i++]=REL_PTR(uri_str.s,uri_parsed->passwd.s);
136
-   }
137
-   if(uri_parsed->host.s && uri_parsed->host.len){
138
-      flags1 |= HOST_F;
139
-      payload[i++]=REL_PTR(uri_str.s,uri_parsed->host.s);
140
-   }
141
-   if(uri_parsed->port.s && uri_parsed->port.len){
142
-      flags1 |= PORT_F;
143
-      payload[i++]=REL_PTR(uri_str.s,uri_parsed->port.s);
144
-   }
145
-   if(uri_parsed->params.s && uri_parsed->params.len){
146
-      flags1 |= PARAMETERS_F;
147
-      payload[i++]=REL_PTR(uri_str.s,uri_parsed->params.s);
148
-   }
149
-   if(uri_parsed->headers.s && uri_parsed->headers.len){
150
-      flags1 |= HEADERS_F;
151
-      payload[i++]=REL_PTR(uri_str.s,uri_parsed->headers.s);
152
-   }
153
-   payload[i]=(unsigned char)(uri_str.len+1);
154
-   i++;
155
-
156
-   if(uri_parsed->transport.s && uri_parsed->transport.len){
157
-      flags2 |= TRANSPORT_F;
158
-      payload[i]=REL_PTR(uri_str.s,uri_parsed->transport.s);
159
-      payload[i+1]=(unsigned char)(uri_parsed->transport.len);
160
-      i+=2;
161
-   }
162
-   if(uri_parsed->ttl.s && uri_parsed->ttl.len){
163
-      flags2 |= TTL_F;
164
-      payload[i]=REL_PTR(uri_str.s,uri_parsed->ttl.s);
165
-      payload[i+1]=(unsigned char)uri_parsed->ttl.len;
166
-      i+=2;
167
-   }
168
-   if(uri_parsed->user_param.s && uri_parsed->user_param.len){
169
-      flags2 |= USER_F;
170
-      payload[i]=REL_PTR(uri_str.s,uri_parsed->user_param.s);
171
-      payload[i+1]=(unsigned char)uri_parsed->user_param.len;
172
-      i+=2;
173
-   }
174
-   if(uri_parsed->method.s && uri_parsed->method.len){
175
-      flags2 |= METHOD_F;
176
-      payload[i]=REL_PTR(uri_str.s,uri_parsed->method.s);
177
-      payload[i+1]=(unsigned char)uri_parsed->method.len;
178
-      i+=2;
179
-   }
180
-   if(uri_parsed->maddr.s && uri_parsed->maddr.len){
181
-      flags2 |= MADDR_F;
182
-      payload[i]=REL_PTR(uri_str.s,uri_parsed->maddr.s);
183
-      payload[i+1]=(unsigned char)uri_parsed->maddr.len;
184
-      i+=2;
185
-   }
186
-   if(uri_parsed->lr.s && uri_parsed->lr.len){
187
-      flags2 |= LR_F;
188
-      payload[i]=REL_PTR(uri_str.s,uri_parsed->lr.s);
189
-      payload[i+1]=(unsigned char)uri_parsed->lr.len;
190
-      i+=2;
191
-   }
192
-   /*in parse_uri, when there's a user=phone, the type
193
-    * is set to TEL_URI_T, even if there's a sip: in the beginning
194
-    * so lets check it by ourselves:
195
-   switch(uri_parsed->type){
196
-      case SIP_URI_T:
197
-	 flags1 |= SIP_OR_TEL_F;
198
-	 break;
199
-      case SIPS_URI_T:
200
-	 flags1 |= (SIP_OR_TEL_F|SECURE_F);
201
-	 break;
202
-      case TEL_URI_T:
203
-	 break;
204
-      case TELS_URI_T:
205
-	 flags1 |= SECURE_F;
206
-	 break;
207
-      default:
208
-	 return -1;
209
-   }*/
210
-#define SIP_SCH		0x3a706973
211
-#define SIPS_SCH	0x73706973
212
-#define TEL_SCH		0x3a6c6574
213
-#define TELS_SCH	0x736c6574
214
-   scheme=uri_str.s[0]+(uri_str.s[1]<<8)+(uri_str.s[2]<<16)+(uri_str.s[3]<<24);
215
-   scheme|=0x20202020;
216
-   if (scheme==SIP_SCH){
217
-      flags1 |= SIP_OR_TEL_F;
218
-   }else if(scheme==SIPS_SCH){
219
-      if(uri_str.s[4]==':'){
220
-	 flags1 |= (SIP_OR_TEL_F|SECURE_F);
221
-      }else goto error;
222
-   }else if (scheme==TEL_SCH){
223
-      /*nothing*/
224
-   }else if (scheme==TELS_SCH){
225
-      if(uri_str.s[4]==':'){
226
-	 flags1 |= SECURE_F;
227
-      }
228
-   }else goto error;
229
-	
230
-   payload[2]=flags1;
231
-   payload[3]=flags2;
232
-   j=i;
233
-   i+=encode_parameters(&payload[i],uri_parsed->params.s,uri_str.s,&uri_parsed->params.len,'u');
234
-   if(i<j)
235
-      goto error;
236
-   return i;
237
-error:
238
-   return -1;
239
-}
240
-
241
-int print_encoded_uri(FILE *fd,unsigned char *payload,int paylen,char *hdrstart,int hdrlen,char *prefix)
242
-{
243
-   int i=4,j=0;/*1*pointer+1*len+2*flags*/
244
-   unsigned char uriidx=0,flags1=0,flags2=0,urilen;
245
-   char *ch_uriptr,*uritype=NULL,*secure=NULL;
246
-
247
-   uriidx=payload[0];
248
-   fprintf(fd,"%s",prefix);
249
-   for(j=0;j<paylen;j++)
250
-      fprintf(fd,"%s%d%s",j==0?"ENCODED-URI:[":":",payload[j],j==paylen-1?"]\n":"");
251
-   if(uriidx>hdrlen){
252
-      fprintf(fd,"bad index for start of uri: hdrlen=%d uri_index=%d\n",hdrlen,uriidx);
253
-      return -1;
254
-   }
255
-   ch_uriptr = hdrstart+uriidx;
256
-   urilen=payload[1];
257
-   flags1=payload[2];
258
-   flags2=payload[3];
259
-   fprintf(fd,"%sURI:[%.*s]\n",prefix,urilen,ch_uriptr);
260
-   uritype=flags1&SIP_OR_TEL_F?"SIP":"TEL";
261
-   secure=flags1&SECURE_F?"S":"";
262
-   fprintf(fd,"%s  TYPE:[%s%s]\n",prefix,uritype,secure);
263
-   if(flags1 & USER_F){
264
-      fprintf(fd,"%s  USER:[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
265
-      ++i;
266
-   }
267
-   if(flags1 & PASSWORD_F){
268
-      fprintf(fd,"%s  PASSWORD=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
269
-      ++i;
270
-   }
271
-   if(flags1 & HOST_F){
272
-      fprintf(fd,"%s  HOST=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
273
-      ++i;
274
-   }
275
-   if(flags1 & PORT_F){
276
-      fprintf(fd,"%s  PORT=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
277
-      ++i;
278
-   }
279
-   if(flags1 & PARAMETERS_F){
280
-      fprintf(fd,"%s  PARAMETERS=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
281
-      ++i;
282
-   }
283
-   if(flags1 & HEADERS_F){
284
-      fprintf(fd,"%s  HEADERS=[%.*s]\n",prefix,(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
285
-      ++i;
286
-   }
287
-   ++i;
288
-   if(flags2 & TRANSPORT_F){
289
-      fprintf(fd,"%s  TRANSPORT=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
290
-      i+=2;
291
-   }
292
-   if(flags2 & TTL_F){
293
-      fprintf(fd,"%s  TTL_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
294
-      i+=2;
295
-   }
296
-   if(flags2 & USER_F){
297
-      fprintf(fd,"%s  USER_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
298
-      i+=2;
299
-   }
300
-   if(flags2 & METHOD_F){
301
-      fprintf(fd,"%s  METHOD_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
302
-      i+=2;
303
-   }
304
-   if(flags2 & MADDR_F){
305
-      fprintf(fd,"%s  MADDR_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
306
-      i+=2;
307
-   }
308
-   if(flags2 & LR_F){
309
-      fprintf(fd,"%s  LR_F=[%.*s]\n",prefix,payload[i+1],&ch_uriptr[payload[i]]);
310
-      i+=2;
311
-   }
312
-   print_encoded_parameters(fd,&payload[i],ch_uriptr,paylen-i,prefix);
313
-   return 0;
314
-}
315
-
316
-
317
-int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int paylen,FILE *fd,char also_hdr,char *prefix)
318
-{
319
-   int i=4,k=0,m=0;/*1*pointer+1*len+2*flags*/
320
-   unsigned char uriidx=0,flags1=0,flags2=0,urilen;
321
-   char *ch_uriptr,*aux,*aux2,*aux3,*uritype=NULL,*secure=NULL;
322
-
323
-   uriidx=payload[0];
324
-   if(uriidx>hdrlen){
325
-      fprintf(fd,"bad index for start of uri: hdrlen=%d uri_index=%d\n",hdrlen,uriidx);
326
-      return -1;
327
-   }
328
-
329
-   if(also_hdr)
330
-      dump_standard_hdr_test(hdrstart,hdrlen,payload,paylen,fd);
331
-   ch_uriptr = hdrstart+uriidx;
332
-   urilen=payload[1];
333
-   flags1=payload[2];
334
-   flags2=payload[3];
335
-   fprintf(fd,"%stoString=(S)%.*s\n",prefix,urilen,ch_uriptr);
336
-   uritype=flags1&SIP_OR_TEL_F?"sip":"tel";
337
-   secure=flags1&SECURE_F?"s":"";
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
-   if(flags1 & USER_F){
343
-      fprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
344
-      ++i;
345
-   }else 
346
-      fprintf(fd,"(null)\n");
347
-   fprintf(fd,"%sgetUserPassword=(S)",prefix);
348
-   if(flags1 & PASSWORD_F){
349
-      fprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
350
-      ++i;
351
-   }else
352
-      fprintf(fd,"(null)\n");
353
-   fprintf(fd,"%sgetHost=(S)",prefix);
354
-   if(flags1 & HOST_F){
355
-      fprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
356
-      ++i;
357
-   }else
358
-      fprintf(fd,"(null)\n");/*can't happen*/
359
-   fprintf(fd,"%sgetPort=(I)",prefix);
360
-   if(flags1 & PORT_F){
361
-      fprintf(fd,"%.*s\n",(payload[i+1]-1)-payload[i],&ch_uriptr[payload[i]]);
362
-      ++i;
363
-   }else
364
-      fprintf(fd,"(null)\n");
365
-   /*user=phone;transport=udp*/
366
-   if(flags1 & PARAMETERS_F){
367
-      aux=&ch_uriptr[payload[i]];
368
-      aux2=NULL;
369
-      aux3=aux;
370
-      m=(payload[i+1]-1-payload[i]);
371
-      fprintf(fd,"%sgetParameter=(SAVP)",prefix);/*SVP = Attribute Value Pair*/
372
-      for(k=0;k<=m;k++){
373
-	 if((aux3[k]==';'||(k==m)) && aux2==NULL){/*no parameterValue was found*/
374
-	    fprintf(fd,"%.*s=;",(int)(aux3-aux+k),aux);
375
-	    aux2=NULL;/*resets the parameterValue-start pointer*/
376
-	    aux=aux3+1+k;/*points to the next parameter*/
377
-	 }else 
378
-	    if((aux3[k]==';'||(k==m)) && aux2!=NULL){
379
-	       fprintf(fd,"%.*s=%.*s;",(int)(aux2-aux),aux,(int)(aux3-aux2-1+k),aux2+1);
380
-	       aux2=NULL;
381
-	       aux=aux3+1+k;
382
-	    } else 
383
-	       if(aux3[k]=='='){
384
-		  aux2=aux3+k;
385
-	       }
386
-      }
387
-      fprintf(fd,"\n");
388
-      ++i;
389
-   }
390
-   if(flags1 & HEADERS_F){
391
-      aux=&ch_uriptr[payload[i]];
392
-      aux2=NULL;
393
-      aux3=aux;
394
-      m=(payload[i+1]-1-payload[i]);
395
-      fprintf(fd,"%sgetHeader=(SAVP)",prefix);
396
-      for(k=0;k<=m;k++){
397
-	 if((aux3[k]==';'||(k==m)) && aux2==NULL){/*no parameterValue was found*/
398
-	    fprintf(fd,"%.*s=;",(int)(aux3-aux+k),aux);
399
-	    aux2=NULL;/*resets the parameterValue-start pointer*/
400
-	    aux=aux3+1+k;/*points to the next parameter*/
401
-	 }else 
402
-	    if((aux3[k]==';'||(k==m)) && aux2!=NULL){
403
-	       fprintf(fd,"%.*s=%.*s;",(int)(aux2-aux),aux,(int)(aux3-aux2-1+k),aux2+1);
404
-	       aux2=NULL;
405
-	       aux=aux3+1+k;
406
-	    } else 
407
-	       if(aux3[k]=='='){
408
-		  aux2=aux3+k;
409
-	       }
410
-      }
411
-      fprintf(fd,"\n");
412
-      ++i;
413
-   }
414
-   ++i;
415
-   fprintf(fd,"%sgetTransportParam=(S)",prefix);
416
-   if(flags2 & TRANSPORT_F){
417
-      fprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
418
-      i+=2;
419
-   }else
420
-      fprintf(fd,"(null)\n");
421
-   fprintf(fd,"%sgetTTLparam=(I)",prefix);
422
-   if(flags2 & TTL_F){
423
-      fprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
424
-      i+=2;
425
-   }else
426
-      fprintf(fd,"(null)\n");
427
-   fprintf(fd,"%sgetUserParam=(S)",prefix);
428
-   if(flags2 & USER_F){
429
-      fprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
430
-      i+=2;
431
-   }else
432
-      fprintf(fd,"(null)\n");
433
-   fprintf(fd,"%sgetMethodParam=(S)",prefix);
434
-   if(flags2 & METHOD_F){
435
-      fprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
436
-      i+=2;
437
-   }else
438
-      fprintf(fd,"(null)\n");
439
-   fprintf(fd,"%sgetMAddrParam=(S)",prefix);
440
-   if(flags2 & MADDR_F){
441
-      fprintf(fd,"%.*s\n",payload[i+1],&ch_uriptr[payload[i]]);
442
-      i+=2;
443
-   }else
444
-      fprintf(fd,"(null)\n");
445
-   if(flags2 & LR_F){
446
-      i+=2;
447
-   }
448
-   fprintf(fd,"\n");
449
-   return 0;
450
-}
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 1 changed files
... ...
@@ -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
 }
Browse code

- change name in copyright headers

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

Henning Westerholt authored on 28/07/2008 15:39:28
Showing 1 changed files
... ...
@@ -2,14 +2,14 @@
2 2
  *
3 3
  * Copyright (C) 2006-2007 VozTelecom Sistemas S.L
4 4
  *
5
- * This file is part of openser, a free SIP server.
5
+ * This file is part of Kamailio, a free SIP server.
6 6
  *
7
- * openser is free software; you can redistribute it and/or modify
7
+ * Kamailio is free software; you can redistribute it and/or modify
8 8
  * it under the terms of the GNU General Public License as published by
9 9
  * the Free Software Foundation; either version 2 of the License, or
10 10
  * (at your option) any later version
11 11
  *
12
- * openser is distributed in the hope that it will be useful,
12
+ * Kamailio is distributed in the hope that it will be useful,
13 13
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 14
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 15
  * GNU General Public License for more details.
Browse code

- changed LOG with LM_*

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

Anca Vamanu authored on 19/10/2007 15:15:01
Showing 1 changed files
... ...
@@ -121,7 +121,7 @@ int encode_uri2(char *hdr,int hdrlen,str uri_str, struct sip_uri *uri_parsed,uns
121 121
 
122 122
    uriptr=REL_PTR(hdr,uri_str.s);
123 123
    if(uri_str.len>255 || uriptr>hdrlen){
124
-      LOG(L_ERR,"uri too long, or out of the sip_msg bounds\n");
124
+      LM_ERR("uri too long, or out of the sip_msg bounds\n");
125 125
       return -1;
126 126
    }
127 127
    payload[0]=uriptr;
Browse code

- added license and copyright

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

Daniel-Constantin Mierla authored on 11/03/2007 19:20:59
Showing 1 changed files
... ...
@@ -1,4 +1,24 @@
1
-/* $Id$ */
1
+/* $Id$
2
+ *
3
+ * Copyright (C) 2006-2007 VozTelecom Sistemas S.L
4
+ *
5
+ * This file is part of openser, a free SIP server.
6
+ *
7
+ * openser is free software; you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation; either version 2 of the License, or
10
+ * (at your option) any later version
11
+ *
12
+ * openser is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License 
18
+ * along with this program; if not, write to the Free Software 
19
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
+ */
21
+
2 22
 /*
3 23
  * =====================================================================================
4 24
  * 
Browse code

reverted to old logging system. fixed a couple of warnings regarding printf("%d",(int)sizeof(something))

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

Elias Baixas authored on 08/03/2007 11:08:03
Showing 1 changed files
... ...
@@ -101,7 +101,7 @@ int encode_uri2(char *hdr,int hdrlen,str uri_str, struct sip_uri *uri_parsed,uns
101 101
 
102 102
    uriptr=REL_PTR(hdr,uri_str.s);
103 103
    if(uri_str.len>255 || uriptr>hdrlen){
104
-      SLOG(L_ERR,"uri too long, or out of the sip_msg bounds\n");
104
+      LOG(L_ERR,"uri too long, or out of the sip_msg bounds\n");
105 105
       return -1;
106 106
    }
107 107
    payload[0]=uriptr;
Browse code

Changed the logging system

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

Elias Baixas authored on 01/03/2007 17:25:55
Showing 1 changed files
... ...
@@ -95,12 +95,13 @@
95 95
  */
96 96
 int encode_uri2(char *hdr,int hdrlen,str uri_str, struct sip_uri *uri_parsed,unsigned char *payload)
97 97
 {
98
-   int i=4;/* 1*pointer+1*len+2*flags*/
98
+   int i=4,j;/* 1*pointer+1*len+2*flags*/
99
+   unsigned int scheme;
99 100
    unsigned char flags1=0,flags2=0,uriptr;
100 101
 
101 102
    uriptr=REL_PTR(hdr,uri_str.s);
102 103
    if(uri_str.len>255 || uriptr>hdrlen){
103
-      LOG(L_ERR,"ERROR: uri2xuri: uri too long, or out of the sip_msg bounds\n");
104
+      SLOG(L_ERR,"uri too long, or out of the sip_msg bounds\n");
104 105
       return -1;
105 106
    }
106 107
    payload[0]=uriptr;
... ...
@@ -168,6 +169,9 @@ int encode_uri2(char *hdr,int hdrlen,str uri_str, struct sip_uri *uri_parsed,uns
168 169
       payload[i+1]=(unsigned char)uri_parsed->lr.len;
169 170
       i+=2;
170 171
    }
172
+   /*in parse_uri, when there's a user=phone, the type
173
+    * is set to TEL_URI_T, even if there's a sip: in the beginning
174
+    * so lets check it by ourselves:
171 175
    switch(uri_parsed->type){
172 176
       case SIP_URI_T:
173 177
 	 flags1 |= SIP_OR_TEL_F;
... ...
@@ -182,11 +186,36 @@ int encode_uri2(char *hdr,int hdrlen,str uri_str, struct sip_uri *uri_parsed,uns
182 186
 	 break;
183 187
       default:
184 188
 	 return -1;
185
-   }
189
+   }*/
190
+#define SIP_SCH		0x3a706973
191
+#define SIPS_SCH	0x73706973
192
+#define TEL_SCH		0x3a6c6574
193
+#define TELS_SCH	0x736c6574
194
+   scheme=uri_str.s[0]+(uri_str.s[1]<<8)+(uri_str.s[2]<<16)+(uri_str.s[3]<<24);
195
+   scheme|=0x20202020;
196
+   if (scheme==SIP_SCH){
197
+      flags1 |= SIP_OR_TEL_F;
198
+   }else if(scheme==SIPS_SCH){
199
+      if(uri_str.s[4]==':'){
200
+	 flags1 |= (SIP_OR_TEL_F|SECURE_F);
201
+      }else goto error;
202
+   }else if (scheme==TEL_SCH){
203
+      /*nothing*/
204
+   }else if (scheme==TELS_SCH){
205
+      if(uri_str.s[4]==':'){
206
+	 flags1 |= SECURE_F;
207
+      }
208
+   }else goto error;
209
+	
186 210
    payload[2]=flags1;
187 211
    payload[3]=flags2;
212
+   j=i;
188 213
    i+=encode_parameters(&payload[i],uri_parsed->params.s,uri_str.s,&uri_parsed->params.len,'u');
214
+   if(i<j)
215
+      goto error;
189 216
    return i;
217
+error:
218
+   return -1;
190 219
 }
191 220
 
192 221
 int print_encoded_uri(int fd,unsigned char *payload,int paylen,char *hdrstart,int hdrlen,char *prefix)
... ...
@@ -200,7 +229,7 @@ int print_encoded_uri(int fd,unsigned char *payload,int paylen,char *hdrstart,in
200 229
    for(j=0;j<paylen;j++)
201 230
       dprintf(fd,"%s%d%s",j==0?"ENCODED-URI:[":":",payload[j],j==paylen-1?"]\n":"");
202 231
    if(uriidx>hdrlen){
203
-      dprintf(fd,"ERROR: print_encoded_uri: bad index for start of uri: hdrlen=%d uri_index=%d\n",hdrlen,uriidx);
232
+      dprintf(fd,"bad index for start of uri: hdrlen=%d uri_index=%d\n",hdrlen,uriidx);
204 233
       return -1;
205 234
    }
206 235
    ch_uriptr = hdrstart+uriidx;
... ...
@@ -273,7 +302,7 @@ int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int p
273 302
 
274 303
    uriidx=payload[0];
275 304
    if(uriidx>hdrlen){
276
-      dprintf(fd,"ERROR: print_encoded_uri: bad index for start of uri: hdrlen=%d uri_index=%d\n",hdrlen,uriidx);
305
+      dprintf(fd,"bad index for start of uri: hdrlen=%d uri_index=%d\n",hdrlen,uriidx);
277 306
       return -1;
278 307
    }
279 308
 
Browse code

fixed 64-bits warnings

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

Bogdan-Andrei Iancu authored on 06/02/2007 09:55:30
Showing 1 changed files
... ...
@@ -322,12 +322,12 @@ int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int p
322 322
       dprintf(fd,"%sgetParameter=(SAVP)",prefix);/*SVP = Attribute Value Pair*/
323 323
       for(k=0;k<=m;k++){
324 324
 	 if((aux3[k]==';'||(k==m)) && aux2==NULL){/*no parameterValue was found*/
325
-	    dprintf(fd,"%.*s=;",aux3-aux+k,aux);
325
+	    dprintf(fd,"%.*s=;",(int)(aux3-aux+k),aux);
326 326
 	    aux2=NULL;/*resets the parameterValue-start pointer*/
327 327
 	    aux=aux3+1+k;/*points to the next parameter*/
328 328
 	 }else 
329 329
 	    if((aux3[k]==';'||(k==m)) && aux2!=NULL){
330
-	       dprintf(fd,"%.*s=%.*s;",aux2-aux,aux,aux3-aux2-1+k,aux2+1);
330
+	       dprintf(fd,"%.*s=%.*s;",(int)(aux2-aux),aux,(int)(aux3-aux2-1+k),aux2+1);
331 331
 	       aux2=NULL;
332 332
 	       aux=aux3+1+k;
333 333
 	    } else 
... ...
@@ -346,12 +346,12 @@ int print_uri_junit_tests(char *hdrstart,int hdrlen,unsigned char *payload,int p
346 346
       dprintf(fd,"%sgetHeader=(SAVP)",prefix);
347 347
       for(k=0;k<=m;k++){
348 348
 	 if((aux3[k]==';'||(k==m)) && aux2==NULL){/*no parameterValue was found*/
349
-	    dprintf(fd,"%.*s=;",aux3-aux+k,aux);
349
+	    dprintf(fd,"%.*s=;",(int)(aux3-aux+k),aux);
350 350
 	    aux2=NULL;/*resets the parameterValue-start pointer*/
351 351
 	    aux=aux3+1+k;/*points to the next parameter*/
352 352
 	 }else 
353 353
 	    if((aux3[k]==';'||(k==m)) && aux2!=NULL){
354
-	       dprintf(fd,"%.*s=%.*s;",aux2-aux,aux,aux3-aux2-1+k,aux2+1);