Mercurial > hg > freeDiameter
annotate extensions/app_sip/libdiamsip.c @ 367:a2c268b2d8fe
MySQL bugfix
author | Alexandre Westfahl <awestfahl@freediameter.net> |
---|---|
date | Fri, 02 Jul 2010 14:46:39 +0900 |
parents | da11085cf6d9 |
children | 8e260030f32c |
rev | line source |
---|---|
364
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
1 /********************************************************************************************************* |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
2 * Software License Agreement (BSD License) * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
3 * Author: Alexandre Westfahl <awestfahl@freediameter.net> * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
4 * * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
5 * Copyright (c) 2010, Alexandre Westfahl, Teraoka Laboratory (Keio University), and the WIDE Project. * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
6 * * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
7 * All rights reserved. * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
8 * * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
9 * Redistribution and use of this software in source and binary forms, with or without modification, are * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
10 * permitted provided that the following conditions are met: * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
11 * * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
12 * * Redistributions of source code must retain the above * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
13 * copyright notice, this list of conditions and the * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
14 * following disclaimer. * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
15 * * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
16 * * Redistributions in binary form must reproduce the above * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
17 * copyright notice, this list of conditions and the * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
18 * following disclaimer in the documentation and/or other * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
19 * materials provided with the distribution. * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
20 * * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
21 * * Neither the name of the Teraoka Laboratory nor the * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
22 * names of its contributors may be used to endorse or * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
23 * promote products derived from this software without * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
24 * specific prior written permission of Teraoka Laboratory * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
25 * * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
26 * * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
28 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
29 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
33 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
34 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
da11085cf6d9
Updated Copyright information of SIP extension
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
360
diff
changeset
|
35 *********************************************************************************************************/ |
360
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
36 #include <mysql.h> |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
37 #include "diamsip.h" |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
38 |
367
a2c268b2d8fe
MySQL bugfix
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
364
diff
changeset
|
39 MYSQL *conn; |
360
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
40 /* |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
41 void calculate_nonce(u8 * nonce) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
42 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
43 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
44 nonce="lkgbsljhsdjdsgj"; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
45 return; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
46 }*/ |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
47 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
48 void clear_digest(char * digest, char * readable_digest, int digestlength) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
49 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
50 int i=0; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
51 for(i=0;i<digestlength * 2;i++) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
52 sprintf(&readable_digest[2 * i], "%2.2hhx", digest[i]); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
53 readable_digest[2 * digestlength]='\0'; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
54 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
55 return; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
56 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
57 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
58 // You must create a table like this "char clearDigest[DIGEST_LEN*2+1];" |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
59 void calc_md5(char *clearDigest, char * data) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
60 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
61 gcry_md_hd_t md5; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
62 uint8_t * binDigest=NULL; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
63 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
64 CHECK_MALLOC_DO(binDigest=malloc(DIGEST_LEN),return); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
65 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
66 gcry_md_open(&md5,GCRY_MD_MD5, 0); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
67 gcry_md_write(md5, (char *)data, sizeof(data)); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
68 memcpy(binDigest, gcry_md_read(md5, GCRY_MD_MD5),gcry_md_get_algo_dlen(GCRY_MD_MD5)); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
69 gcry_md_close(md5); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
70 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
71 clear_digest(binDigest, clearDigest, DIGEST_LEN); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
72 free(binDigest); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
73 return; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
74 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
75 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
76 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
77 /* Search a given AVP model in an AVP (extracted from libfreediameter/message.c ) */ |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
78 int fd_avp_search_avp ( struct avp * groupedavp, struct dict_object * what, struct avp ** avp ) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
79 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
80 struct avp * nextavp; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
81 struct avp_hdr * nextavphdr; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
82 struct dict_avp_data dictdata; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
83 enum dict_object_type dicttype; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
84 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
85 TRACE_ENTRY("%p %p %p", groupedavp, what, avp); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
86 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
87 CHECK_FCT( fd_dict_getval(what, &dictdata) ); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
88 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
89 // Loop only in the group AVP |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
90 CHECK_FCT( fd_msg_browse(groupedavp, MSG_BRW_FIRST_CHILD, (void *)&nextavp, NULL) ); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
91 CHECK_FCT( fd_msg_avp_hdr( nextavp, &nextavphdr ) ); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
92 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
93 while (nextavphdr) { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
94 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
95 if ( (nextavphdr->avp_code == dictdata.avp_code) && (nextavphdr->avp_vendor == dictdata.avp_vendor) ) // always 0 if no Vendor flag |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
96 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
97 break; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
98 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
99 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
100 // Otherwise move to next AVP in the grouped AVP |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
101 CHECK_FCT( fd_msg_browse(nextavp, MSG_BRW_NEXT, (void *)&nextavp, NULL) ); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
102 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
103 if(nextavp!=NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
104 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
105 CHECK_FCT( fd_msg_avp_hdr( nextavp, &nextavphdr ) ); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
106 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
107 else |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
108 nextavphdr=NULL; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
109 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
110 if (avp) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
111 *avp = nextavp; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
112 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
113 if (avp && nextavp) { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
114 struct dictionary * dict; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
115 CHECK_FCT( fd_dict_getdict( what, &dict) ); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
116 CHECK_FCT_DO( fd_msg_parse_dict( nextavp, dict, NULL ), ); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
117 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
118 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
119 if (avp || nextavp) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
120 return 0; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
121 else |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
122 return ENOENT; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
123 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
124 struct avp_hdr *walk_digest(struct avp *avp, int avp_code) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
125 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
126 struct avp_hdr *temphdr=NULL; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
127 CHECK_FCT_DO(fd_msg_browse ( avp, MSG_BRW_WALK, &avp, NULL),0 ); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
128 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
129 while(avp!=NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
130 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
131 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
132 CHECK_FCT_DO( fd_msg_avp_hdr( avp,&temphdr ),0); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
133 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
134 if(temphdr->avp_code==avp_code) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
135 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
136 //We found the AVP so we set avp to NULL to exit the loop |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
137 avp=NULL; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
138 return temphdr; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
139 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
140 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
141 else if(temphdr->avp_code==380)//SIP-Authorization AVP |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
142 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
143 //We didn't found the AVP but we finished browsing the Authentication AVP |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
144 avp=NULL; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
145 temphdr=NULL; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
146 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
147 return temphdr; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
148 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
149 else |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
150 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
151 CHECK_FCT_DO(fd_msg_browse ( avp, MSG_BRW_WALK, &avp, NULL),0 ); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
152 temphdr=NULL; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
153 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
154 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
155 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
156 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
157 return temphdr; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
158 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
159 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
160 int start_mysql_connection(char *server,char *user, char *password, char *database) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
161 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
162 conn = mysql_init(NULL); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
163 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
164 mysql_options(conn, MYSQL_OPT_RECONNECT, "true"); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
165 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
166 if (!mysql_real_connect(conn, server,user, password, database, 0, NULL, 0)) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
167 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
168 TRACE_DEBUG(INFO,"Unable to connect to database (%s) with login:%s",database,user); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
169 return 1; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
170 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
171 return 0; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
172 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
173 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
174 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
175 //You must free ""result"" after using this function |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
176 void request_mysql(char *query) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
177 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
178 //We check if the connection is still up |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
179 mysql_ping(conn); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
180 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
181 if (mysql_query(conn, query)) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
182 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
183 TRACE_DEBUG(INFO,"Query %s failed", query); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
184 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
185 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
186 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
187 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
188 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
189 void close_mysql_connection() |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
190 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
191 mysql_close(conn); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
192 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
193 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
194 /* |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
195 void nonce_add_element(char * nonce) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
196 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
197 noncechain *newelt=malloc(sizeof(noncechain)); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
198 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
199 newelt->nonce=nonce; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
200 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
201 newelt->timestamp=(int)time(NULL); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
202 newelt->next=NULL; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
203 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
204 if(listnonce==NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
205 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
206 listnonce=newelt; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
207 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
208 else |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
209 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
210 noncechain* temp=listnonce; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
211 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
212 while(temp->next != NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
213 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
214 if(temp->timestamp < ((int)time(NULL)-300)) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
215 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
216 listnonce=temp->next; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
217 free(temp); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
218 temp=listnonce; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
219 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
220 temp = temp->next; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
221 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
222 temp->next = newelt; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
223 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
224 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
225 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
226 void nonce_del_element(char * nonce) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
227 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
228 if(listnonce!=NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
229 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
230 noncechain *temp=listnonce, *tempbefore=NULL; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
231 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
232 if(listnonce->next==NULL && strcmp(listnonce->nonce,nonce)==0) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
233 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
234 free(listnonce); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
235 listnonce=NULL; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
236 return; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
237 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
238 while(temp->next != NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
239 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
240 if(strcmp(temp->nonce,nonce)==0) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
241 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
242 if(tempbefore==NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
243 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
244 listnonce=temp->next; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
245 free(temp); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
246 return; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
247 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
248 tempbefore->next=temp->next; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
249 free(temp); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
250 break; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
251 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
252 tempbefore=temp; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
253 temp = temp->next; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
254 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
255 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
256 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
257 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
258 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
259 int nonce_check_element(char * nonce) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
260 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
261 if(listnonce==NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
262 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
263 //Not found |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
264 return 0; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
265 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
266 else |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
267 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
268 noncechain* temp=listnonce; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
269 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
270 while(temp->next != NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
271 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
272 if(strcmp(temp->nonce,nonce)==0) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
273 return 1; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
274 else |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
275 temp = temp->next; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
276 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
277 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
278 return 0; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
279 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
280 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
281 void nonce_deletelistnonce() |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
282 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
283 if(listnonce !=NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
284 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
285 noncechain* temp=listnonce; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
286 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
287 while(listnonce->next != NULL) |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
288 { |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
289 temp = listnonce->next; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
290 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
291 free(listnonce); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
292 |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
293 listnonce=temp; |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
294 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
295 free(listnonce); |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
296 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
297 } |
1740bee6c821
Initial App_SIP import
Alexandre Westfahl <awestfahl@freediameter.net>
parents:
diff
changeset
|
298 */ |