kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
June 2011
----- 2024 -----
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
32 participants
167 discussions
Start a n
N
ew thread
git:master: registrar(k): reset local interator to contacts headers
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: a74f12d633188a7e70b09238c0d48b207efc66c3 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a74f12d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Sat Jun 4 10:22:09 2011 +0200 registrar(k): reset local interator to contacts headers - when the REGISTER request had more than one Contact header and max_contacts parameter was set, there were two iterations through the list fo Contacts header without reseting the iterator, resulting in not processing all Contact headers in save() - reported by Andreas Granig - instead of parsing the fist contact header as parameter to several functions, take it from sip msg structure hook --- modules_k/registrar/save.c | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/modules_k/registrar/save.c b/modules_k/registrar/save.c index 3609342..caa5465 100644 --- a/modules_k/registrar/save.c +++ b/modules_k/registrar/save.c @@ -369,12 +369,12 @@ error: * and insert all contacts from the message that have expires * > 0 */ -static inline int insert_contacts(struct sip_msg* _m, contact_t* _c, - udomain_t* _d, str* _a) +static inline int insert_contacts(struct sip_msg* _m, udomain_t* _d, str* _a) { ucontact_info_t* ci; urecord_t* r; ucontact_t* c; + contact_t* _c; unsigned int flags; int num, expires; #ifdef USE_TCP @@ -392,7 +392,7 @@ static inline int insert_contacts(struct sip_msg* _m, contact_t* _c, e_max = tcp_check = 0; } #endif - + _c = get_first_contact(_m); for( num=0,r=0,ci=0 ; _c ; _c = get_next_contact(_c) ) { /* calculate expires */ calc_contact_expires(_m, _c->expires, &expires); @@ -400,7 +400,8 @@ static inline int insert_contacts(struct sip_msg* _m, contact_t* _c, if (expires == 0) continue; - if (cfg_get(registrar, registrar_cfg, max_contacts) && (num >= cfg_get(registrar, registrar_cfg, max_contacts))) { + if (cfg_get(registrar, registrar_cfg, max_contacts) + && (num >= cfg_get(registrar, registrar_cfg, max_contacts))) { LM_INFO("too many contacts (%d) for AOR <%.*s>\n", num, _a->len, _a->s); rerrno = R_TOO_MANY; @@ -539,7 +540,7 @@ static int test_max_contacts(struct sip_msg* _m, urecord_t* _r, contact_t* _c, * == 0, delete contact */ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, - contact_t* _c, int _mode) + int _mode) { ucontact_info_t *ci; ucontact_t *c, *ptr, *ptr0; @@ -550,6 +551,7 @@ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, struct sip_uri uri; #endif int rc; + contact_t* _c; /* mem flag */ flags = mem_only; @@ -561,8 +563,11 @@ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, goto error; } - if (cfg_get(registrar, registrar_cfg, max_contacts) && test_max_contacts(_m, _r, _c, ci) != 0 ) - goto error; + if (cfg_get(registrar, registrar_cfg, max_contacts)) { + _c = get_first_contact(_m); + if(test_max_contacts(_m, _r, _c, ci) != 0) + goto error; + } #ifdef USE_TCP if ( (_m->flags&tcp_persistent_flag) && @@ -574,6 +579,7 @@ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, } #endif + _c = get_first_contact(_m); updated=0; for( ; _c ; _c = get_next_contact(_c) ) { /* calculate expires */ @@ -701,8 +707,8 @@ error: * This function will process request that * contained some contact header fields */ -static inline int add_contacts(struct sip_msg* _m, contact_t* _c, - udomain_t* _d, str* _a, int _mode) +static inline int add_contacts(struct sip_msg* _m, udomain_t* _d, + str* _a, int _mode) { int res; int ret; @@ -719,7 +725,7 @@ static inline int add_contacts(struct sip_msg* _m, contact_t* _c, } if (res == 0) { /* Contacts found */ - if ((ret=update_contacts(_m, r, _c, _mode)) < 0) { + if ((ret=update_contacts(_m, r, _mode)) < 0) { build_contact(r->contacts); ul.release_urecord(r); ul.unlock_udomain(_d, _a); @@ -728,7 +734,7 @@ static inline int add_contacts(struct sip_msg* _m, contact_t* _c, build_contact(r->contacts); ul.release_urecord(r); } else { - if (insert_contacts(_m, _c, _d, _a) < 0) { + if (insert_contacts(_m, _d, _a) < 0) { ul.unlock_udomain(_d, _a); return -4; } @@ -781,7 +787,7 @@ int save(struct sip_msg* _m, udomain_t* _d, int _cflags) } } else { mode = is_cflag_set(REG_SAVE_REPL_FL)?1:0; - if ((ret=add_contacts(_m, c, (udomain_t*)_d, &aor, mode)) < 0) + if ((ret=add_contacts(_m, (udomain_t*)_d, &aor, mode)) < 0) goto error; ret = (ret==0)?1:ret; }
13 years, 2 months
2
3
0
0
git:3.1: registrar(k): reset local interator to contacts headers
by Daniel-Constantin Mierla
Module: sip-router Branch: 3.1 Commit: 16183d4553aca270da1284255f3f6862132a3aeb URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=16183d4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Sat Jun 4 10:22:09 2011 +0200 registrar(k): reset local interator to contacts headers - when the REGISTER request had more than one Contact header and max_contacts parameter was set, there were two iterations through the list fo Contacts header without reseting the iterator, resulting in not processing all Contact headers in save() - reported by Andreas Granig - instead of parsing the fist contact header as parameter to several functions, take it from sip msg structure hook (cherry picked from commit a74f12d633188a7e70b09238c0d48b207efc66c3) --- modules_k/registrar/save.c | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) diff --git a/modules_k/registrar/save.c b/modules_k/registrar/save.c index 9955034..bc89eb6 100644 --- a/modules_k/registrar/save.c +++ b/modules_k/registrar/save.c @@ -368,12 +368,12 @@ error: * and insert all contacts from the message that have expires * > 0 */ -static inline int insert_contacts(struct sip_msg* _m, contact_t* _c, - udomain_t* _d, str* _a) +static inline int insert_contacts(struct sip_msg* _m, udomain_t* _d, str* _a) { ucontact_info_t* ci; urecord_t* r; ucontact_t* c; + contact_t* _c; unsigned int flags; int num, expires; #ifdef USE_TCP @@ -391,7 +391,7 @@ static inline int insert_contacts(struct sip_msg* _m, contact_t* _c, e_max = tcp_check = 0; } #endif - + _c = get_first_contact(_m); for( num=0,r=0,ci=0 ; _c ; _c = get_next_contact(_c) ) { /* calculate expires */ calc_contact_expires(_m, _c->expires, &expires); @@ -399,7 +399,8 @@ static inline int insert_contacts(struct sip_msg* _m, contact_t* _c, if (expires == 0) continue; - if (cfg_get(registrar, registrar_cfg, max_contacts) && (num >= cfg_get(registrar, registrar_cfg, max_contacts))) { + if (cfg_get(registrar, registrar_cfg, max_contacts) + && (num >= cfg_get(registrar, registrar_cfg, max_contacts))) { LM_INFO("too many contacts (%d) for AOR <%.*s>\n", num, _a->len, _a->s); rerrno = R_TOO_MANY; @@ -538,7 +539,7 @@ static int test_max_contacts(struct sip_msg* _m, urecord_t* _r, contact_t* _c, * == 0, delete contact */ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, - contact_t* _c, int _mode) + int _mode) { ucontact_info_t *ci; ucontact_t *c, *ptr, *ptr0; @@ -549,6 +550,7 @@ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, struct sip_uri uri; #endif int rc; + contact_t* _c; /* mem flag */ flags = mem_only; @@ -560,8 +562,11 @@ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, goto error; } - if (cfg_get(registrar, registrar_cfg, max_contacts) && test_max_contacts(_m, _r, _c, ci) != 0 ) - goto error; + if (cfg_get(registrar, registrar_cfg, max_contacts)) { + _c = get_first_contact(_m); + if(test_max_contacts(_m, _r, _c, ci) != 0) + goto error; + } #ifdef USE_TCP if ( (_m->flags&tcp_persistent_flag) && @@ -573,6 +578,7 @@ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, } #endif + _c = get_first_contact(_m); updated=0; for( ; _c ; _c = get_next_contact(_c) ) { /* calculate expires */ @@ -700,8 +706,8 @@ error: * This function will process request that * contained some contact header fields */ -static inline int add_contacts(struct sip_msg* _m, contact_t* _c, - udomain_t* _d, str* _a, int _mode) +static inline int add_contacts(struct sip_msg* _m, udomain_t* _d, + str* _a, int _mode) { int res; int ret; @@ -718,7 +724,7 @@ static inline int add_contacts(struct sip_msg* _m, contact_t* _c, } if (res == 0) { /* Contacts found */ - if ((ret=update_contacts(_m, r, _c, _mode)) < 0) { + if ((ret=update_contacts(_m, r, _mode)) < 0) { build_contact(r->contacts); ul.release_urecord(r); ul.unlock_udomain(_d, _a); @@ -727,7 +733,7 @@ static inline int add_contacts(struct sip_msg* _m, contact_t* _c, build_contact(r->contacts); ul.release_urecord(r); } else { - if (insert_contacts(_m, _c, _d, _a) < 0) { + if (insert_contacts(_m, _d, _a) < 0) { ul.unlock_udomain(_d, _a); return -4; } @@ -780,7 +786,7 @@ int save(struct sip_msg* _m, char* _d, char* _cflags) } } else { mode = is_cflag_set(REG_SAVE_REPL_FL)?1:0; - if ((ret=add_contacts(_m, c, (udomain_t*)_d, &aor, mode)) < 0) + if ((ret=add_contacts(_m, (udomain_t*)_d, &aor, mode)) < 0) goto error; ret = (ret==0)?1:ret; }
13 years, 2 months
1
0
0
0
git:master: Makefile: updated groups of modules
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 7a700da2696f6a046b172f50652270a80d422bfb URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7a700da…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Sat Jun 4 10:30:30 2011 +0200 Makefile: updated groups of modules - ipops, p_usrloc and sdpops added to kstandard group - db_sqlite excluded from default compilation (depends os sqlite libs) and added to ksqlite group --- Makefile | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 44db945..7e734ef 100644 --- a/Makefile +++ b/Makefile @@ -207,7 +207,7 @@ module_group_kstandard=acc alias_db auth auth_db benchmark call_control \ avpops cfg_db cfg_rpc ctl db_flatstore dialplan enum \ iptrtpproxy lcr mediaproxy mi_rpc pdb sanity tm topoh \ blst prefix_route counters debugger matrix mqueue mtree \ - pipelimit rtpproxy textopsx xhttp + pipelimit rtpproxy textopsx xhttp ipops p_usrloc sdpops # K mysql module module_group_kmysql=db_mysql @@ -271,6 +271,9 @@ module_group_kpython=app_python # K geoip module module_group_kgeoip=geoip +# K sqlite module +module_group_ksqlite=db_sqlite + # if not set on the cmd. line, env or in the modules.lst (cfg_group_include) # exclude the below modules. ifneq ($(group_include)$(cfg_group_include),) @@ -286,7 +289,7 @@ else osp tls oracle \ unixsock dbg print_lib auth_identity ldap \ db_berkeley db_mysql db_postgres db_oracle \ - db_unixodbc memcached mi_xmlrpc \ + db_sqlite db_unixodbc memcached mi_xmlrpc \ perl perlvdb purple \ snmpstats xmpp \ carrierroute peering \
13 years, 2 months
1
0
0
0
git:3.1: kamailio.cfg: use defined branch flag id
by Daniel-Constantin Mierla
Module: sip-router Branch: 3.1 Commit: 1312f780d4c2409536e909ea472d01489d1e7182 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1312f78…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Sat Jun 4 10:00:55 2011 +0200 kamailio.cfg: use defined branch flag id - use FLB_NATB instead of 6, like everywhere else --- etc/kamailio.cfg | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg index 9aa3915..961aaae 100644 --- a/etc/kamailio.cfg +++ b/etc/kamailio.cfg @@ -796,7 +796,7 @@ onreply_route[REPLY_ONE] { && status=~"(183)|(2[0-9][0-9])") { force_rtp_proxy(); } - if (isbflagset("6")) { + if (isbflagset(FLB_NATB)) { fix_nated_contact(); } #!endif
13 years, 2 months
1
0
0
0
git:mariusbucur/dmq: fixed some typos
by Marius Ovidiu Bucur
Module: sip-router Branch: mariusbucur/dmq Commit: 5093fc039fed1dc8f974ca797e1f0708ae1df287 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5093fc0…
Author: Marius Bucur <marius(a)marius-bucur.ro> Committer: Marius Bucur <marius(a)marius-bucur.ro> Date: Sat Jun 4 10:37:26 2011 +0300 fixed some typos --- modules_k/htable/ht_api.c | 4 ++-- modules_k/htable/ht_var.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules_k/htable/ht_api.c b/modules_k/htable/ht_api.c index 614fdf6..9681867 100644 --- a/modules_k/htable/ht_api.c +++ b/modules_k/htable/ht_api.c @@ -718,7 +718,7 @@ int ht_table_spec(char *spec) unsigned int autoexpire = 0; unsigned int size = 4; unsigned int dbmode = 0; - unsigne int dmq = 0; + unsigned int dmq = 0; str in; str tok; param_t *pit=NULL; @@ -771,7 +771,7 @@ int ht_table_spec(char *spec) LM_DBG("htable [%.*s] - initval [%d]\n", name.len, name.s, ival.n); } else if(tok.len==3 && strncmp(tok.s, "dmq", 3)==0) { - if(str2sint(&tok, &dmq)!=0) + if(str2int(&tok, &dmq)!=0) goto error; LM_DBG("htable [%.*s] - dmq [%d]\n", name.len, name.s, dmq); diff --git a/modules_k/htable/ht_var.c b/modules_k/htable/ht_var.c index 368e9ae..52b6ba3 100644 --- a/modules_k/htable/ht_var.c +++ b/modules_k/htable/ht_var.c @@ -113,7 +113,7 @@ int pv_set_ht_cell(struct sip_msg* msg, pv_param_t *param, LM_ERR("cannot get $ht name\n"); return -1; } - if(hpv->ht->usedmq) { + if(hpv->ht->dmq) { serialized_ht.s = pkg_malloc(MAX_HT_SERIALIZE_BUF); serialized_ht.len = MAX_HT_SERIALIZE_BUF; if(serialize_ht_pair(&htname, val, &hpv->htname, &serialized_ht) < 0) {
13 years, 2 months
1
0
0
0
git:mariusbucur/dmq: Merge branch 'master' into mariusbucur/dmq
by Marius Ovidiu Bucur
Module: sip-router Branch: mariusbucur/dmq Commit: 84b87a9afe9d56a1ef636c664370b458daa0db33 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=84b87a9…
Author: Marius Bucur <marius(a)marius-bucur.ro> Committer: Marius Bucur <marius(a)marius-bucur.ro> Date: Sat Jun 4 10:35:37 2011 +0300 Merge branch 'master' into mariusbucur/dmq Conflicts: modules_k/htable/ht_api.c modules_k/htable/ht_api.h ---
13 years, 2 months
1
0
0
0
git:mariusbucur/dmq: minor serialization changes
by Marius Ovidiu Bucur
Module: sip-router Branch: mariusbucur/dmq Commit: cba881c53ae0904ee296974805e81edbdf81cd6d URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cba881c…
Author: Marius Bucur <marius(a)marius-bucur.ro> Committer: Marius Bucur <marius(a)marius-bucur.ro> Date: Sat Jun 4 10:20:20 2011 +0300 minor serialization changes --- modules_k/htable/ht_serialize.c | 4 ++-- modules_k/htable/ht_var.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules_k/htable/ht_serialize.c b/modules_k/htable/ht_serialize.c index 7f47223..8540d29 100644 --- a/modules_k/htable/ht_serialize.c +++ b/modules_k/htable/ht_serialize.c @@ -44,7 +44,7 @@ int serialize_ht_pair(str* key, pv_value_t* val, str* htname, str* s) { } encoded_key.len = len; - s->len = snprintf(s->s, s->len, "%d|%d|%.*s|%.*s|%.*s", val->flags, val->ri, STR_FMT(&encoded_htname), STR_FMT(&encoded_key), STR_FMT(&encoded_val)); + s->len = snprintf(s->s, s->len, "%d %d %.*s %.*s %.*s", val->flags, val->ri, STR_FMT(&encoded_htname), STR_FMT(&encoded_key), STR_FMT(&encoded_val)); if(s->len < 0) { LM_ERR("cannot serialize data - probably an small buffer\n"); goto error; @@ -78,7 +78,7 @@ int deserialize_ht_pair(str* key, pv_value_t* val, str* htname, str* src) { encoded_key.s = pkg_malloc(src->len); memset(encoded_key.s, 0, src->len); - sscanf(src->s, "%d|%d|%s|%s|%s", &val->flags, &val->ri, encoded_htname.s, encoded_key.s, encoded_val.s); + sscanf(src->s, "%d %d %s %s %s", &val->flags, &val->ri, encoded_htname.s, encoded_key.s, encoded_val.s); encoded_htname.len = strlen(encoded_htname.s); encoded_key.len = strlen(encoded_key.s); encoded_val.len = strlen(encoded_val.s); diff --git a/modules_k/htable/ht_var.c b/modules_k/htable/ht_var.c index 26e0747..e04ad69 100644 --- a/modules_k/htable/ht_var.c +++ b/modules_k/htable/ht_var.c @@ -66,7 +66,7 @@ int pv_get_ht_cell(struct sip_msg *msg, pv_param_t *param, int dmq_ht_set_cell(str* key, pv_value_t* val, str* htname) { ht_t* ht = ht_get_table(htname); int_str isval; - LM_ERR("dmq_ht_set_cell %.*s %p %d\n", STR_FMT(htname), ht, htname->len); + LM_ERR("dmq_ht_set_cell [%.*s] (%p) (%d)\n", STR_FMT(htname), ht, htname->len); if(ht==NULL) { LM_ERR("error getting table\n"); return -1;
13 years, 2 months
1
0
0
0
git:mariusbucur/dmq: modified the htable so that a per-table basis dmq parameter can be added
by Marius Ovidiu Bucur
Module: sip-router Branch: mariusbucur/dmq Commit: 7ff94993efc1d34bbd78498a27b9de84bc8f41b8 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7ff9499…
Author: Marius Bucur <marius(a)marius-bucur.ro> Committer: Marius Bucur <marius(a)marius-bucur.ro> Date: Sat Jun 4 00:47:44 2011 +0300 modified the htable so that a per-table basis dmq parameter can be added --- modules_k/htable/ht_api.c | 15 ++++++++++++--- modules_k/htable/ht_api.h | 3 ++- modules_k/htable/ht_var.c | 2 +- modules_k/htable/htable.c | 18 +++++++----------- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/modules_k/htable/ht_api.c b/modules_k/htable/ht_api.c index fe9a66e..b221ea5 100644 --- a/modules_k/htable/ht_api.c +++ b/modules_k/htable/ht_api.c @@ -117,7 +117,7 @@ ht_t* ht_get_table(str *name) return NULL; } -int ht_pkg_init(str *name, int autoexp, str *dbtable, int size, int dbmode) +int ht_pkg_init(str *name, int autoexp, str *dbtable, int size, int dbmode, int usedmq) { unsigned int htid; ht_t *ht; @@ -156,7 +156,7 @@ int ht_pkg_init(str *name, int autoexp, str *dbtable, int size, int dbmode) if(dbtable!=NULL && dbtable->len>0) ht->dbtable = *dbtable; ht->dbmode = dbmode; - + ht->usedmq = usedmq; ht->next = _ht_pkg_root; _ht_pkg_root = ht; return 0; @@ -515,6 +515,7 @@ int ht_table_spec(char *spec) str name; str dbtable = {0, 0}; unsigned int autoexpire = 0; + unsigned int usedmq = 0; unsigned int size = 4; int type = 0; unsigned int dbmode = 0; @@ -574,6 +575,8 @@ next_token: type = 3; else if(tok.len==6 && strncmp(tok.s, "dbmode", 6)==0) type = 4; + else if(tok.len==3 && strncmp(tok.s, "dmq", 3)==0) + type = 5; else goto error; if(*p!='=') @@ -623,6 +626,12 @@ next_token: LM_DBG("htable [%.*s] - dbmode [%u]\n", name.len, name.s, dbmode); break; + case 5: + if(str2int(&tok, &usedmq)!=0) + goto error; + LM_DBG("htable [%.*s] - usedmq [%u]\n", name.len, name.s, + usedmq); + break; } while(p<in.s+in.len && (*p==';' || *p==' ' || *p=='\t' || *p=='\n' || *p=='\r')) @@ -630,7 +639,7 @@ next_token: if(p<in.s+in.len) goto next_token; - return ht_pkg_init(&name, autoexpire, &dbtable, size, dbmode); + return ht_pkg_init(&name, autoexpire, &dbtable, size, dbmode, usedmq); error: LM_ERR("invalid htable parameter [%.*s] at [%d]\n", in.len, in.s, diff --git a/modules_k/htable/ht_api.h b/modules_k/htable/ht_api.h index 71c8e21..8dc7553 100644 --- a/modules_k/htable/ht_api.h +++ b/modules_k/htable/ht_api.h @@ -55,6 +55,7 @@ typedef struct _ht unsigned int htexpire; str dbtable; int dbmode; + int usedmq; unsigned int htsize; ht_entry_t *entries; struct _ht *next; @@ -66,7 +67,7 @@ typedef struct _ht_pv { pv_elem_t *pve; } ht_pv_t, *ht_pv_p; -int ht_pkg_init(str *name, int autoexp, str *dbtable, int size, int dbmode); +int ht_pkg_init(str *name, int autoexp, str *dbtable, int size, int dbmode, int usedmq); int ht_shm_init(void); int ht_destroy(void); int ht_set_cell(ht_t *ht, str *name, int type, int_str *val, int mode); diff --git a/modules_k/htable/ht_var.c b/modules_k/htable/ht_var.c index 921cca3..26e0747 100644 --- a/modules_k/htable/ht_var.c +++ b/modules_k/htable/ht_var.c @@ -109,7 +109,7 @@ int pv_set_ht_cell(struct sip_msg* msg, pv_param_t *param, LM_ERR("cannot get $ht name\n"); return -1; } - if(ht_use_dmq) { + if(hpv->ht->usedmq) { serialized_ht.s = pkg_malloc(MAX_HT_SERIALIZE_BUF); serialized_ht.len = MAX_HT_SERIALIZE_BUF; if(serialize_ht_pair(&htname, val, &hpv->htname, &serialized_ht) < 0) { diff --git a/modules_k/htable/htable.c b/modules_k/htable/htable.c index 58a690c..62ca74d 100644 --- a/modules_k/htable/htable.c +++ b/modules_k/htable/htable.c @@ -101,7 +101,7 @@ error: return -1; } -static void add_dmq_peer() { +static void ht_add_dmq_peer() { dmq_peer_t htable_peer; memset(&ht_dmq_resp_cback, 0, sizeof(ht_dmq_resp_cback)); htable_peer.peer_id.s = "htable"; @@ -113,7 +113,6 @@ static void add_dmq_peer() { } int ht_timer_interval = 20; -int ht_use_dmq = 0; static int htable_init_rpc(void); @@ -174,7 +173,6 @@ static param_export_t params[]={ {"array_size_suffix", STR_PARAM, &ht_array_size_suffix.s}, {"fetch_rows", INT_PARAM, &ht_fetch_rows}, {"timer_interval", INT_PARAM, &ht_timer_interval}, - {"use_dmq", INT_PARAM, &ht_use_dmq}, {0,0,0} }; @@ -240,14 +238,12 @@ static int mod_init(void) } } - if(ht_use_dmq){ - if(dmq_load_api(&ht_dmq_bind) < 0) { - LM_ERR("cannot load dmq api\n"); - return -1; - } else { - add_dmq_peer(); - LM_DBG("presence-dmq loaded\n"); - } + if(dmq_load_api(&ht_dmq_bind) < 0) { + LM_ERR("cannot load dmq api\n"); + return -1; + } else { + ht_add_dmq_peer(); + LM_DBG("presence-dmq loaded\n"); } return 0; }
13 years, 2 months
3
2
0
0
git:mariusbucur/dmq: some minor modification in the serialization library
by Marius Ovidiu Bucur
Module: sip-router Branch: mariusbucur/dmq Commit: 959e8630cb1780e75c42952719e611f7b52e21b7 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=959e863…
Author: Marius Bucur <marius(a)marius-bucur.ro> Committer: Marius Bucur <marius(a)marius-bucur.ro> Date: Sat Jun 4 00:53:46 2011 +0300 some minor modification in the serialization library --- modules_k/htable/ht_serialize.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules_k/htable/ht_serialize.c b/modules_k/htable/ht_serialize.c index 8365be9..7f47223 100644 --- a/modules_k/htable/ht_serialize.c +++ b/modules_k/htable/ht_serialize.c @@ -1,6 +1,8 @@ #include "ht_serialize.h" -/* snprintf - pretty ugly, but cds/serialize is unusable for the moment */ +/* snprintf - pretty ugly, but cds/serialize is unusable for the moment + * TODO using tpl is probably a very good solution + */ int serialize_ht_pair(str* key, pv_value_t* val, str* htname, str* s) { str encoded_key = {0, 0}; str encoded_val = {0, 0}; @@ -42,7 +44,7 @@ int serialize_ht_pair(str* key, pv_value_t* val, str* htname, str* s) { } encoded_key.len = len; - s->len = snprintf(s->s, s->len, "%d %d %.*s %.*s %.*s", val->flags, val->ri, STR_FMT(&encoded_htname), STR_FMT(&encoded_key), STR_FMT(&encoded_val)); + s->len = snprintf(s->s, s->len, "%d|%d|%.*s|%.*s|%.*s", val->flags, val->ri, STR_FMT(&encoded_htname), STR_FMT(&encoded_key), STR_FMT(&encoded_val)); if(s->len < 0) { LM_ERR("cannot serialize data - probably an small buffer\n"); goto error; @@ -76,7 +78,7 @@ int deserialize_ht_pair(str* key, pv_value_t* val, str* htname, str* src) { encoded_key.s = pkg_malloc(src->len); memset(encoded_key.s, 0, src->len); - sscanf(src->s, "%d %d %s %s %s", &val->flags, &val->ri, encoded_htname.s, encoded_key.s, encoded_val.s); + sscanf(src->s, "%d|%d|%s|%s|%s", &val->flags, &val->ri, encoded_htname.s, encoded_key.s, encoded_val.s); encoded_htname.len = strlen(encoded_htname.s); encoded_key.len = strlen(encoded_key.s); encoded_val.len = strlen(encoded_val.s);
13 years, 2 months
1
0
0
0
git:mariusbucur/dmq: modified htable module so that it uses dmq for distributed tables
by Marius Ovidiu Bucur
Module: sip-router Branch: mariusbucur/dmq Commit: 50f1a5e0c2792706588d3419e4f8bd8773bda15b URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=50f1a5e…
Author: Marius Bucur <marius(a)marius-bucur.ro> Committer: Marius Bucur <marius(a)marius-bucur.ro> Date: Sat Jun 4 00:18:47 2011 +0300 modified htable module so that it uses dmq for distributed tables TODO use dmq only on a per-table basis --- modules_k/dmq/bind_dmq.c | 2 + modules_k/dmq/bind_dmq.h | 7 +++++ modules_k/dmq/dmq_funcs.c | 4 +- modules_k/dmq/dmq_funcs.h | 1 - modules_k/dmq/notification_peer.c | 9 ++++--- modules_k/htable/ht_serialize.c | 44 ++++++++++++++++++++++++++-------- modules_k/htable/ht_serialize.h | 10 ++++++++ modules_k/htable/ht_var.c | 47 ++++++++++++++++++++++++++++++++++-- modules_k/htable/ht_var.h | 2 + modules_k/htable/htable.c | 29 +++++++++++++++++----- modules_k/htable/htable.h | 12 +++++++++ 11 files changed, 139 insertions(+), 28 deletions(-) Diff:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=50f…
13 years, 2 months
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Results per page:
10
25
50
100
200