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
November
October
September
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
May 2017
----- 2024 -----
November 2024
October 2024
September 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
298 discussions
Start a n
N
ew thread
git:master:ac4cc61b: modules: readme files regenerated - auth_ephemeral ... [skip ci]
by Kamailio Dev
Module: kamailio Branch: master Commit: ac4cc61b8633ececd3046d55d0c3abcef80fc05f URL:
https://github.com/kamailio/kamailio/commit/ac4cc61b8633ececd3046d55d0c3abc…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org> Committer: Kamailio Dev <kamailio.dev(a)kamailio.org> Date: 2017-05-03T14:16:19+02:00 modules: readme files regenerated - auth_ephemeral ... [skip ci] --- Modified: src/modules/auth_ephemeral/README --- Diff:
https://github.com/kamailio/kamailio/commit/ac4cc61b8633ececd3046d55d0c3abc…
Patch:
https://github.com/kamailio/kamailio/commit/ac4cc61b8633ececd3046d55d0c3abc…
--- diff --git a/src/modules/auth_ephemeral/README b/src/modules/auth_ephemeral/README index 88a4af9..72b8c6d 100644 --- a/src/modules/auth_ephemeral/README +++ b/src/modules/auth_ephemeral/README @@ -228,7 +228,8 @@ modparam("auth_ephemeral", "username_format", 0) * 0 - SHA1 (default, as per IETF/RFC) * 1 - SHA256 - * 2 - SHA512 + * 2 - SHA384 + * 3 - SHA512 Example 1.5. sha_algorithm parameter usage ...
7 years, 6 months
1
0
0
0
git:master:ced9bfbd: auth_ephemeral: Some more safety checks, added SHA384 as an option
by Carsten Bock
Module: kamailio Branch: master Commit: ced9bfbd2ad2c538bd2e3f190a34932d3ffde276 URL:
https://github.com/kamailio/kamailio/commit/ced9bfbd2ad2c538bd2e3f190a34932…
Author: Carsten Bock <carsten(a)ng-voice.com> Committer: Carsten Bock <carsten(a)ng-voice.com> Date: 2017-05-03T14:15:56+02:00 auth_ephemeral: Some more safety checks, added SHA384 as an option --- Modified: src/modules/auth_ephemeral/auth_ephemeral_mod.h Modified: src/modules/auth_ephemeral/authorize.c Modified: src/modules/auth_ephemeral/doc/auth_ephemeral_admin.xml --- Diff:
https://github.com/kamailio/kamailio/commit/ced9bfbd2ad2c538bd2e3f190a34932…
Patch:
https://github.com/kamailio/kamailio/commit/ced9bfbd2ad2c538bd2e3f190a34932…
7 years, 6 months
1
0
0
0
git:5.0:623840e7: db_cluster: free allocated structure at init time
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.0 Commit: 623840e7487cec1862531893c3644776835d9387 URL:
https://github.com/kamailio/kamailio/commit/623840e7487cec1862531893c364477…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2017-05-03T08:59:35+02:00 db_cluster: free allocated structure at init time - avoid reopening driver db connections if already set (cherry picked from commit 08f8e0bc72b9f16f76b78110c9c95b1ba7f1ce25) --- Modified: src/modules/db_cluster/dbcl_api.c Modified: src/modules/db_cluster/dbcl_data.c --- Diff:
https://github.com/kamailio/kamailio/commit/623840e7487cec1862531893c364477…
Patch:
https://github.com/kamailio/kamailio/commit/623840e7487cec1862531893c364477…
--- diff --git a/src/modules/db_cluster/dbcl_api.c b/src/modules/db_cluster/dbcl_api.c index 1f24cc5..6ef6ec4 100644 --- a/src/modules/db_cluster/dbcl_api.c +++ b/src/modules/db_cluster/dbcl_api.c @@ -311,10 +311,12 @@ void db_cluster_close(db1_con_t* _h) LM_DBG("executing db cluster close command\n"); cls = (dbcl_cls_t*)_h->tail; cls->ref--; - if(cls->ref > 0) - return; - /* close connections */ - dbcl_close_connections(cls); + if(cls->ref <= 0) { + /* close connections */ + dbcl_close_connections(cls); + } + /* free _h - allocated for each db_cluster_init() */ + pkg_free(_h); return; } diff --git a/src/modules/db_cluster/dbcl_data.c b/src/modules/db_cluster/dbcl_data.c index 534030c..47f9444 100644 --- a/src/modules/db_cluster/dbcl_data.c +++ b/src/modules/db_cluster/dbcl_data.c @@ -442,7 +442,8 @@ int dbcl_init_connections(dbcl_cls_t *cls) { for(j=0; j<cls->rlist[i].clen; j++) { - if(cls->rlist[i].clist[j] != NULL && cls->rlist[i].clist[j]->flags!=0) + if(cls->rlist[i].clist[j] != NULL && cls->rlist[i].clist[j]->flags!=0 + && cls->rlist[i].clist[j]->dbh==NULL) { LM_DBG("setting up read connection [%.*s]\n", cls->rlist[i].clist[j]->name.len, @@ -459,7 +460,8 @@ int dbcl_init_connections(dbcl_cls_t *cls) } for(j=0; j<cls->wlist[i].clen; j++) { - if(cls->wlist[i].clist[j] != NULL && cls->wlist[i].clist[j]->flags!=0) + if(cls->wlist[i].clist[j] != NULL && cls->wlist[i].clist[j]->flags!=0 + && cls->wlist[i].clist[j]->dbh==NULL) { LM_DBG("setting up write connection [%.*s]\n", cls->wlist[i].clist[j]->name.len,
7 years, 6 months
1
0
0
0
git:5.0:cfaca9f7: htable: Fix memory leak when reloading an empty htable from database
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.0 Commit: cfaca9f7b468b138280c288edfa830995f714ea1 URL:
https://github.com/kamailio/kamailio/commit/cfaca9f7b468b138280c288edfa8309…
Author: Kristian Høgh <kfh(a)uni-tel.dk> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2017-05-03T08:58:27+02:00 htable: Fix memory leak when reloading an empty htable from database (cherry picked from commit 07ce768fc6064867ed33d7ab6c9cbbb05db329db) --- Modified: src/modules/htable/ht_db.c --- Diff:
https://github.com/kamailio/kamailio/commit/cfaca9f7b468b138280c288edfa8309…
Patch:
https://github.com/kamailio/kamailio/commit/cfaca9f7b468b138280c288edfa8309…
--- diff --git a/src/modules/htable/ht_db.c b/src/modules/htable/ht_db.c index 83a9f01..fd5ec46 100644 --- a/src/modules/htable/ht_db.c +++ b/src/modules/htable/ht_db.c @@ -247,6 +247,7 @@ int ht_db_load_table(ht_t *ht, str *dbtable, int mode) } else { if(RES_ROW_N(db_res)==0) { + ht_dbf.free_result(ht_db_con, db_res); LM_DBG("Nothing to be loaded in hash table\n"); return 0; }
7 years, 6 months
1
0
0
0
git:5.0:23783b89: htable: close db connection in some error cases for rpc command
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.0 Commit: 23783b89d800ce75f3655a253e1d21c5fd8cad6c URL:
https://github.com/kamailio/kamailio/commit/23783b89d800ce75f3655a253e1d21c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2017-05-03T08:58:16+02:00 htable: close db connection in some error cases for rpc command (cherry picked from commit 1051a1bbc70cf84d6ebd7aa76a9b1ebd2e17e710) --- Modified: src/modules/htable/htable.c --- Diff:
https://github.com/kamailio/kamailio/commit/23783b89d800ce75f3655a253e1d21c…
Patch:
https://github.com/kamailio/kamailio/commit/23783b89d800ce75f3655a253e1d21c…
--- diff --git a/src/modules/htable/htable.c b/src/modules/htable/htable.c index d04143d..8f79c77 100644 --- a/src/modules/htable/htable.c +++ b/src/modules/htable/htable.c @@ -1030,12 +1030,14 @@ static void htable_rpc_reload(rpc_t* rpc, void* c) if (rpc->scan(c, "S", &htname) < 1) { + ht_db_close_con(); rpc->fault(c, 500, "No htable name given"); return; } ht = ht_get_table(&htname); if(ht==NULL) { + ht_db_close_con(); rpc->fault(c, 500, "No such htable"); return; }
7 years, 6 months
1
0
0
0
git:master:d4c392fa: statsd: functions exported to kemi interface
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: d4c392fa4bdf7316a24063df9ae1a615d94c1711 URL:
https://github.com/kamailio/kamailio/commit/d4c392fa4bdf7316a24063df9ae1a61…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2017-05-03T08:37:39+02:00 statsd: functions exported to kemi interface --- Modified: src/modules/statsd/statsd.c --- Diff:
https://github.com/kamailio/kamailio/commit/d4c392fa4bdf7316a24063df9ae1a61…
Patch:
https://github.com/kamailio/kamailio/commit/d4c392fa4bdf7316a24063df9ae1a61…
--- diff --git a/src/modules/statsd/statsd.c b/src/modules/statsd/statsd.c index c4c56ea..469f390 100644 --- a/src/modules/statsd/statsd.c +++ b/src/modules/statsd/statsd.c @@ -25,6 +25,7 @@ #include "../../core/usr_avp.h" #include "../../core/pvar.h" #include "../../core/lvalue.h" +#include "../../core/kemi.h" #include "lib_statsd.h" @@ -118,11 +119,21 @@ static int func_gauge(struct sip_msg* msg, char* key, char* val) return statsd_gauge(key, val); } +static int ki_statsd_gauge(sip_msg_t* msg, str* key, str* val) +{ + return statsd_gauge(key->s, val->s); +} + static int func_set(struct sip_msg* msg, char* key, char* val) { return statsd_set(key, val); } +static int ki_statsd_set(sip_msg_t* msg, str* key, str* val) +{ + return statsd_set(key->s, val->s); +} + static int func_time_start(struct sip_msg *msg, char *key) { int_str avp_key, avp_val; @@ -141,6 +152,10 @@ static int func_time_start(struct sip_msg *msg, char *key) return 1; } +static int ki_statsd_start(sip_msg_t *msg, str *key) +{ + return func_time_start(msg, key->s); +} static int func_time_end(struct sip_msg *msg, char *key) { @@ -182,18 +197,30 @@ static int func_time_end(struct sip_msg *msg, char *key) return statsd_timing(key, result); } +static int ki_statsd_stop(sip_msg_t *msg, str *key) +{ + return func_time_end(msg, key->s); +} static int func_incr(struct sip_msg *msg, char *key) { return statsd_count(key, "+1"); } +static int ki_statsd_incr(sip_msg_t *msg, str *key) +{ + return statsd_count(key->s, "+1"); +} static int func_decr(struct sip_msg *msg, char *key) { return statsd_count(key, "-1"); } +static int ki_statsd_decr(sip_msg_t *msg, str *key) +{ + return statsd_count(key->s, "-1"); +} char* get_milliseconds(char *dst){ struct timeval tv; @@ -204,3 +231,52 @@ char* get_milliseconds(char *dst){ snprintf(dst, 21, "%ld", millis); return dst; } + +/** + * + */ +/* clang-format off */ +static sr_kemi_t sr_kemi_statsd_exports[] = { + { str_init("statsd"), str_init("statsd_gauge"), + SR_KEMIP_INT, ki_statsd_gauge, + { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, + { str_init("statsd"), str_init("statsd_start"), + SR_KEMIP_INT, ki_statsd_start, + { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, + { str_init("statsd"), str_init("statsd_stop"), + SR_KEMIP_INT, ki_statsd_stop, + { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, + { str_init("statsd"), str_init("statsd_incr"), + SR_KEMIP_INT, ki_statsd_incr, + { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, + { str_init("statsd"), str_init("statsd_decr"), + SR_KEMIP_INT, ki_statsd_decr, + { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, + { str_init("statsd"), str_init("statsd_set"), + SR_KEMIP_INT, ki_statsd_set, + { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, + + { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } } +}; +/* clang-format on */ + +/** + * + */ +int mod_register(char *path, int *dlflags, void *p1, void *p2) +{ + sr_kemi_modules_add(sr_kemi_statsd_exports); + return 0; +} \ No newline at end of file
7 years, 6 months
1
0
0
0
git:master:8577eb15: statsc: exported functions to kemi interface
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 8577eb15d97116ce0a64c5ae2bdaa561a4d7535d URL:
https://github.com/kamailio/kamailio/commit/8577eb15d97116ce0a64c5ae2bdaa56…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2017-05-03T08:23:25+02:00 statsc: exported functions to kemi interface --- Modified: src/modules/statsc/statsc_mod.c --- Diff:
https://github.com/kamailio/kamailio/commit/8577eb15d97116ce0a64c5ae2bdaa56…
Patch:
https://github.com/kamailio/kamailio/commit/8577eb15d97116ce0a64c5ae2bdaa56…
--- diff --git a/src/modules/statsc/statsc_mod.c b/src/modules/statsc/statsc_mod.c index cc25b2f..77c112b 100644 --- a/src/modules/statsc/statsc_mod.c +++ b/src/modules/statsc/statsc_mod.c @@ -31,6 +31,7 @@ #include "../../core/timer_proc.h" #include "../../core/rpc.h" #include "../../core/rpc_lookup.h" +#include "../../core/kemi.h" #include "../../core/parser/parse_param.h" @@ -119,11 +120,20 @@ static void mod_destroy(void) /** * */ -static int w_statsc_reset(sip_msg_t* msg, char* p1, char* p2) +static int ki_statsc_reset(sip_msg_t* msg) { + LM_ERR("not implemented yet\n"); return 1; } +/** + * + */ +static int w_statsc_reset(sip_msg_t* msg, char* p1, char* p2) +{ + return ki_statsc_reset(msg); +} + typedef int (*statsc_func_t)(void *p, int64_t *res); typedef struct statsc_nmap { @@ -473,3 +483,26 @@ int statsc_init_rpc(void) return 0; } +/** + * + */ +/* clang-format off */ +static sr_kemi_t sr_kemi_statsc_exports[] = { + { str_init("statsc"), str_init("statsc_reset"), + SR_KEMIP_INT, ki_statsc_reset, + { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, + + { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } } +}; +/* clang-format on */ + +/** + * + */ +int mod_register(char *path, int *dlflags, void *p1, void *p2) +{ + sr_kemi_modules_add(sr_kemi_statsc_exports); + return 0; +} \ No newline at end of file
7 years, 6 months
1
0
0
0
git:master:fedacebc: statistics: exported functions to kemi interface
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: fedacebc49b5abf5ee1d7543ee966072d681ef57 URL:
https://github.com/kamailio/kamailio/commit/fedacebc49b5abf5ee1d7543ee96607…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2017-05-03T08:18:57+02:00 statistics: exported functions to kemi interface --- Modified: src/modules/statistics/statistics.c --- Diff:
https://github.com/kamailio/kamailio/commit/fedacebc49b5abf5ee1d7543ee96607…
Patch:
https://github.com/kamailio/kamailio/commit/fedacebc49b5abf5ee1d7543ee96607…
--- diff --git a/src/modules/statistics/statistics.c b/src/modules/statistics/statistics.c index 80f55ec..499b419 100644 --- a/src/modules/statistics/statistics.c +++ b/src/modules/statistics/statistics.c @@ -39,6 +39,7 @@ #include "../../core/dprint.h" #include "../../core/ut.h" #include "../../core/mod_fix.h" +#include "../../core/kemi.h" #include "../../core/counters.h" #include "../../core/mem/mem.h" #include "stats_funcs.h" @@ -240,6 +241,18 @@ static int w_update_stat(struct sip_msg *msg, char *stat_p, char *long_p) return 1; } +static int ki_update_stat(sip_msg_t *msg, str *sname, int sval) +{ + stat_var *stat; + + stat = get_stat(sname); + if(stat == 0) { + LM_ERR("variable <%.*s> not defined\n", sname->len, sname->s); + return -1; + } + update_stat(stat, (long)sval); + return 1; +} static int w_reset_stat(struct sip_msg *msg, char* stat_p, char *foo) { @@ -264,8 +277,47 @@ static int w_reset_stat(struct sip_msg *msg, char* stat_p, char *foo) reset_stat( stat ); } + return 1; +} +static int ki_reset_stat(sip_msg_t *msg, str* sname) +{ + stat_var *stat; + + stat = get_stat(sname); + if(stat == 0) { + LM_ERR("variable <%.*s> not defined\n", sname->len, sname->s); + return -1; + } + reset_stat( stat ); return 1; } +/** + * + */ +/* clang-format off */ +static sr_kemi_t sr_kemi_statistics_exports[] = { + { str_init("statistics"), str_init("update_stat"), + SR_KEMIP_INT, ki_update_stat, + { SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, + { str_init("statistics"), str_init("reset_stat"), + SR_KEMIP_INT, ki_reset_stat, + { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, + + { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } } +}; +/* clang-format on */ +/** + * + */ +int mod_register(char *path, int *dlflags, void *p1, void *p2) +{ + sr_kemi_modules_add(sr_kemi_statistics_exports); + return 0; +} \ No newline at end of file
7 years, 6 months
1
0
0
0
git:master:a081a6ee: sst: exported functions to kemi interface
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: a081a6ee5c8891b5e4c436f60110813a391c0084 URL:
https://github.com/kamailio/kamailio/commit/a081a6ee5c8891b5e4c436f60110813…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2017-05-03T08:07:03+02:00 sst: exported functions to kemi interface --- Modified: src/modules/sst/sst.c Modified: src/modules/sst/sst_handlers.c Modified: src/modules/sst/sst_handlers.h --- Diff:
https://github.com/kamailio/kamailio/commit/a081a6ee5c8891b5e4c436f60110813…
Patch:
https://github.com/kamailio/kamailio/commit/a081a6ee5c8891b5e4c436f60110813…
7 years, 6 months
1
0
0
0
git:master:4751b777: kazoo : fix json keys
by lazedo
Module: kamailio Branch: master Commit: 4751b77727730ad67ea003afd07ec91b0f7cd45b URL:
https://github.com/kamailio/kamailio/commit/4751b77727730ad67ea003afd07ec91…
Author: lazedo <luis.azedo(a)factorlusitano.com> Committer: lazedo <luis.azedo(a)factorlusitano.com> Date: 2017-05-03T01:12:06+01:00 kazoo : fix json keys size of key and some refactoring --- Modified: src/modules/kazoo/kz_json.c --- Diff:
https://github.com/kamailio/kamailio/commit/4751b77727730ad67ea003afd07ec91…
Patch:
https://github.com/kamailio/kamailio/commit/4751b77727730ad67ea003afd07ec91…
--- diff --git a/src/modules/kazoo/kz_json.c b/src/modules/kazoo/kz_json.c index 65d864b..3f51cbf 100644 --- a/src/modules/kazoo/kz_json.c +++ b/src/modules/kazoo/kz_json.c @@ -46,10 +46,13 @@ enum json_type kz_json_get_type(struct json_object *jso) return json_object_get_type(jso); } -char** str_split(char* a_str, const char a_delim) +typedef str* json_key; +typedef json_key* json_keys; + +json_keys str_split(char* a_str, const char a_delim, int* c) { - char** result = 0; - size_t count = 0; + json_keys result = 0; + int count = 0; char* tmp = a_str; char* last_comma = 0; char delim[2]; @@ -73,34 +76,43 @@ char** str_split(char* a_str, const char a_delim) /* Add space for terminating null string so caller knows where the list of returned strings ends. */ - count++; +// count++; + *c = count; + LM_DBG("COUNT %d\n", count); - result = pkg_malloc(sizeof(char*) * count); + result = pkg_malloc(sizeof(json_key) * count); + memset(result, 0, sizeof(json_key) * count); if (result) { - size_t idx = 0; + int idx = 0; char* token = strtok(a_str, delim); while (token) { + LM_DBG("TOKEN %d : %s\n", idx, token); + assert(idx < count); + + result[idx] = pkg_malloc(sizeof(str)); len = strlen(token); - char* ptr = pkg_malloc( (len+1) * sizeof(char)); - *(result + idx) = ptr; - memcpy(ptr, token, len); - ptr[len] = '\0'; + + result[idx]->len = len; + result[idx]->s = pkg_malloc((len + 1) * sizeof(char)); + strncpy(result[idx]->s, token, len); + result[idx]->s[len] = '\0'; + int i = 0; while(i < len) { - if(ptr[i] == kz_json_escape_char) - ptr[i] = '.'; + if(result[idx]->s[i] == kz_json_escape_char) + result[idx]->s[i] = '.'; i++; } + LM_DBG("TOKEN2 %d : %s\n", idx, result[idx]->s); token = strtok(0, delim); idx++; } - assert(idx == count - 1); - *(result + idx) = 0; + assert(idx == count); } return result; @@ -108,10 +120,12 @@ char** str_split(char* a_str, const char a_delim) struct json_object * kz_json_get_field_object(str* json, str* field) { - char** tokens; + json_keys keys; + json_key key; char* dup; - char f1[25], f2[25];//, f3[25]; - int i; + char* token; + char f1[250], f2[250];//, f3[25]; + int i, parts; dup = pkg_malloc(json->len+1); memcpy(dup, json->s, json->len); @@ -132,19 +146,22 @@ struct json_object * kz_json_get_field_object(str* json, str* field) dup = pkg_malloc(field->len+1); memcpy(dup, field->s, field->len); dup[field->len] = '\0'; - tokens = str_split(dup, '.'); + keys = str_split(dup, '.', &parts); pkg_free(dup); - if (tokens) + if (keys) { jtree = j; - for (i = 0; *(tokens + i); i++) + for (i = 0; i < parts; i++) { + key = keys[i]; + LM_DBG("TOKEN %d , %p, %p : %s\n", i, keys[i], key->s, key->s); + if(jtree != NULL) { - str field = str_init(*(tokens + i)); + //str field1 = str_init(token); // check for idx [] - int sresult = sscanf(field.s, "%[^[][%[^]]]", f1, f2); //, f3); - LM_DBG("CHECK IDX %d - %s , %s, %s\n", sresult, field.s, f1, (sresult > 1? f2 : "(null)")); + int sresult = sscanf(key->s, "%[^[][%[^]]]", f1, f2); //, f3); + LM_DBG("CHECK IDX %d - %s , %s, %s\n", sresult, key->s, f1, (sresult > 1? f2 : "(null)")); jtree = kz_json_get_object(jtree, f1); if(jtree != NULL) { @@ -160,9 +177,15 @@ struct json_object * kz_json_get_field_object(str* json, str* field) } } } - pkg_free(*(tokens + i)); } - pkg_free(tokens); + + for(i = 0;i < parts; i++) { + LM_DBG("FREE %d\n", i); + pkg_free(keys[i]->s); + pkg_free(keys[i]); + } + + pkg_free(keys); }
7 years, 6 months
1
0
0
0
← Newer
1
...
23
24
25
26
27
28
29
30
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Results per page:
10
25
50
100
200