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
April 2014
----- 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
26 participants
304 discussions
Start a n
N
ew thread
git:4.1: tm: reset local lock reply status after functions that do unlock
by Daniel-Constantin Mierla
Module: sip-router Branch: 4.1 Commit: f32354f9aae3afadca98e5a1cf254d9286a3a985 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f32354f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Wed Apr 23 22:12:48 2014 +0200 tm: reset local lock reply status after functions that do unlock (cherry picked from commit 5943a8005baf8ce1239d2cf728373cb26975483a) --- modules/tm/t_reply.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 2070d9d..8e435cb 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -2480,6 +2480,7 @@ int reply_received( struct sip_msg *p_msg ) } if ( is_local(t) ) { reply_status=local_reply( t, p_msg, branch, msg_status, &cancel_data ); + replies_locked=0; if (reply_status == RPS_COMPLETED) { /* no more UAC FR/RETR (if I received a 2xx, there may * be still pending branches ... @@ -2497,6 +2498,7 @@ int reply_received( struct sip_msg *p_msg ) } else { reply_status=relay_reply( t, p_msg, branch, msg_status, &cancel_data, 1 ); + replies_locked=0; if (reply_status == RPS_COMPLETED) { /* no more UAC FR/RETR (if I received a 2xx, there may be still pending branches ... @@ -2534,7 +2536,8 @@ int reply_received( struct sip_msg *p_msg ) skip_send_reply: if (likely(replies_locked)){ - UNLOCK_REPLIES(t); /* unlock replies - this would be unlocked by send function*/ + /* unlock replies if still locked coming via goto skip_send_reply */ + UNLOCK_REPLIES(t); replies_locked=0; }
10 years, 7 months
1
0
0
0
git:master: xhttp_rpc: added handling for specifier '['
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 72a52d2cbd76eb47e832551ab46bcd6b93e7c203 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=72a52d2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Wed Apr 23 23:07:21 2014 +0200 xhttp_rpc: added handling for specifier '[' - add array into rpc result - new rpc api member aliased to rpc_struct_add (needs update for proper array value insertion) --- modules/xhttp_rpc/xhttp_rpc.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/xhttp_rpc/xhttp_rpc.c b/modules/xhttp_rpc/xhttp_rpc.c index b251409..372f0db 100644 --- a/modules/xhttp_rpc/xhttp_rpc.c +++ b/modules/xhttp_rpc/xhttp_rpc.c @@ -354,7 +354,7 @@ static int rpc_add(rpc_ctx_t* ctx, char* fmt, ...) } va_start(ap, fmt); while(*fmt) { - if (*fmt == '{') { + if (*fmt == '{' || *fmt == '[') { void_ptr = va_arg(ap, void**); ds = new_data_struct(ctx); if (!ds) goto err; @@ -544,7 +544,7 @@ static int rpc_struct_add(struct rpc_data_struct* rpc_s, char* fmt, ...) while(*fmt) { member_name.s = va_arg(ap, char*); member_name.len = (member_name.s?strlen(member_name.s):0); - if (*fmt == '{') { + if (*fmt == '{' || *fmt == '[') { void_ptr = va_arg(ap, void**); ds = new_data_struct(ctx); if (!ds) goto err; @@ -641,12 +641,15 @@ static int mod_init(void) } } + memset(&func_param, 0, sizeof(func_param)); func_param.send = (rpc_send_f)rpc_send; func_param.fault = (rpc_fault_f)rpc_fault; func_param.add = (rpc_add_f)rpc_add; func_param.scan = (rpc_scan_f)rpc_scan; func_param.printf = (rpc_printf_f)rpc_printf; func_param.struct_add = (rpc_struct_add_f)rpc_struct_add; + /* use rpc_struct_add for array_add */ + func_param.array_add = (rpc_struct_add_f)rpc_struct_add; func_param.struct_scan = (rpc_struct_scan_f)rpc_struct_scan; func_param.struct_printf = (rpc_struct_printf_f)rpc_struct_printf; func_param.capabilities = (rpc_capabilities_f)rpc_capabilities;
10 years, 7 months
1
0
0
0
git:master: dispatcher: refactored rpc command dispatcher. list to give proper xmlrpc output
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: d1b3dd1abacd98c1cb42978448fc7a20630459ea URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d1b3dd1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Wed Apr 23 23:09:20 2014 +0200 dispatcher: refactored rpc command dispatcher.list to give proper xmlrpc output - sets and destinations within sets are printed as an array of structures --- modules/dispatcher/dispatcher.c | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/modules/dispatcher/dispatcher.c b/modules/dispatcher/dispatcher.c index 4a06efb..c7dca2e 100644 --- a/modules/dispatcher/dispatcher.c +++ b/modules/dispatcher/dispatcher.c @@ -971,6 +971,8 @@ static void dispatcher_rpc_list(rpc_t* rpc, void* ctx) { void* th; void* ih; + void* rh; + void* sh; void* vh; int j; char c[3]; @@ -995,19 +997,25 @@ static void dispatcher_rpc_list(rpc_t* rpc, void* ctx) rpc->fault(ctx, 500, "Internal error root reply"); return; } - if(rpc->struct_add(th, "d{", - "SET_NO", ds_list_nr, - "SET", &ih)<0) + if(rpc->struct_add(th, "d[", + "NRSETS", ds_list_nr, + "RECORDS", &ih)<0) { - rpc->fault(ctx, 500, "Internal error set structure"); + rpc->fault(ctx, 500, "Internal error sets structure"); return; } for(list = ds_list; list!= NULL; list= list->next) { - if(rpc->struct_add(ih, "d", - "SET_ID", list->id)<0) + if (rpc->struct_add(ih, "{", "SET", &sh) < 0) + { + rpc->fault(ctx, 500, "Internal error set structure"); + return; + } + if(rpc->struct_add(sh, "d[", + "ID", list->id, + "TARGETS", &rh)<0) { rpc->fault(ctx, 500, "Internal error creating set id"); return; @@ -1015,7 +1023,7 @@ static void dispatcher_rpc_list(rpc_t* rpc, void* ctx) for(j=0; j<list->nr; j++) { - if(rpc->struct_add(ih, "{", + if(rpc->struct_add(rh, "{", "DEST", &vh)<0) { rpc->fault(ctx, 500, "Internal error creating dest");
10 years, 7 months
1
0
0
0
git:master: xmlrpc: implemented specifier '[' for array
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 1a01a1bf5d8cf8659af87898f9b02236997f19cb URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1a01a1b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Wed Apr 23 23:04:53 2014 +0200 xmlrpc: implemented specifier '[' for array - it is only for add operations (no scan) - implemented new rpc member array_add --- modules/xmlrpc/xmlrpc.c | 94 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 83 insertions(+), 11 deletions(-) diff --git a/modules/xmlrpc/xmlrpc.c b/modules/xmlrpc/xmlrpc.c index 44c398a..fb45e91 100644 --- a/modules/xmlrpc/xmlrpc.c +++ b/modules/xmlrpc/xmlrpc.c @@ -349,6 +349,7 @@ typedef struct rpc_ctx { * @sa
http://www.xml-rpc.com
*/ struct rpc_struct { + int vtype; xmlNodePtr struct_in; /**< Pointer to the structure parameter */ struct xmlrpc_reply struct_out; /**< Structure to be sent in reply */ struct xmlrpc_reply* reply; /**< Print errors here */ @@ -813,11 +814,19 @@ static int flatten_nests(struct rpc_struct* st, struct xmlrpc_reply* reply) { return 1; if (!st->nnext) { - if (add_xmlrpc_reply(&st->struct_out, &struct_suffix) < 0) return -1; + if(st->vtype == RET_ARRAY) { + if (add_xmlrpc_reply(&st->struct_out, &array_suffix) < 0) return -1; + } else { + if (add_xmlrpc_reply(&st->struct_out, &struct_suffix) < 0) return -1; + } if (add_xmlrpc_reply_offset(&st->parent->struct_out, st->offset, &st->struct_out.body) < 0) return -1; } else { flatten_nests(st->nnext, reply); - if (add_xmlrpc_reply(&st->struct_out, &struct_suffix) < 0) return -1; + if(st->vtype == RET_ARRAY) { + if (add_xmlrpc_reply(&st->struct_out, &array_suffix) < 0) return -1; + } else { + if (add_xmlrpc_reply(&st->struct_out, &struct_suffix) < 0) return -1; + } if (add_xmlrpc_reply_offset(&st->parent->struct_out, st->offset, &st->struct_out.body) < 0) return -1; } return 1; @@ -828,7 +837,11 @@ static int print_structures(struct xmlrpc_reply* reply, { while(st) { /* Close the structure first */ - if (add_xmlrpc_reply(&st->struct_out, &struct_suffix) < 0) return -1; + if(st->vtype == RET_ARRAY) { + if (add_xmlrpc_reply(&st->struct_out, &array_suffix) < 0) return -1; + } else { + if (add_xmlrpc_reply(&st->struct_out, &struct_suffix) < 0) return -1; + } if (flatten_nests(st->nnext, &st->struct_out) < 0) return -1; if (add_xmlrpc_reply_offset(reply, st->offset, &st->struct_out.body) < 0) return -1; st = st->next; @@ -929,7 +942,7 @@ static void rpc_fault(rpc_ctx_t* ctx, int code, char* fmt, ...) * coming from a XML-RPC request. */ static struct rpc_struct* new_rpcstruct(xmlDocPtr doc, xmlNodePtr structure, - struct xmlrpc_reply* reply) + struct xmlrpc_reply* reply, int vtype) { struct rpc_struct* p; @@ -943,6 +956,7 @@ static struct rpc_struct* new_rpcstruct(xmlDocPtr doc, xmlNodePtr structure, p->reply = reply; p->n = 0; + p->vtype = vtype; if (doc && structure) { /* We will be parsing structure from request */ p->doc = doc; @@ -950,8 +964,11 @@ static struct rpc_struct* new_rpcstruct(xmlDocPtr doc, xmlNodePtr structure, } else { /* We will build a reply structure */ if (init_xmlrpc_reply(&p->struct_out) < 0) goto err; - if (add_xmlrpc_reply(&p->struct_out, &struct_prefix) < 0) goto err; - + if(vtype==RET_ARRAY) { + if (add_xmlrpc_reply(&p->struct_out, &array_prefix) < 0) goto err; + } else { + if (add_xmlrpc_reply(&p->struct_out, &struct_prefix) < 0) goto err; + } } if (add_garbage(JUNK_RPCSTRUCT, p, reply) < 0) goto err; return p; @@ -1076,9 +1093,9 @@ static int rpc_add(rpc_ctx_t* ctx, char* fmt, ...) while(*fmt) { if (ctx->flags & RET_ARRAY && add_xmlrpc_reply(reply, &value_prefix) < 0) goto err; - if (*fmt == '{') { + if (*fmt == '{' || *fmt == '[') { void_ptr = va_arg(ap, void**); - p = new_rpcstruct(0, 0, reply); + p = new_rpcstruct(0, 0, reply, (*fmt=='[')?RET_ARRAY:0); if (!p) goto err; *(struct rpc_struct**)void_ptr = p; p->offset = get_reply_len(reply); @@ -1556,7 +1573,7 @@ static int rpc_scan(rpc_ctx_t* ctx, char* fmt, ...) case '{': void_ptr = va_arg(ap, void**); if (!value->xmlChildrenNode) goto error; - p = new_rpcstruct(ctx->doc, value->xmlChildrenNode, reply); + p = new_rpcstruct(ctx->doc, value->xmlChildrenNode, reply, 0); if (!p) goto error; *void_ptr = p; break; @@ -1722,14 +1739,18 @@ static int rpc_struct_add(struct rpc_struct* s, char* fmt, ...) member_name.s = va_arg(ap, char*); member_name.len = (member_name.s ? strlen(member_name.s) : 0); + if(s->vtype==RET_ARRAY && *fmt == '{') { + if (add_xmlrpc_reply(reply, &value_prefix) < 0) goto err; + if (add_xmlrpc_reply(reply, &struct_prefix) < 0) goto err; + } if (add_xmlrpc_reply(reply, &member_prefix) < 0) goto err; if (add_xmlrpc_reply(reply, &name_prefix) < 0) goto err; if (add_xmlrpc_reply_esc(reply, &member_name) < 0) goto err; if (add_xmlrpc_reply(reply, &name_suffix) < 0) goto err; if (add_xmlrpc_reply(reply, &value_prefix) < 0) goto err; - if (*fmt == '{') { + if (*fmt == '{' || *fmt == '[') { void_ptr = va_arg(ap, void**); - p = new_rpcstruct(0, 0, s->reply); + p = new_rpcstruct(0, 0, s->reply, (*fmt=='[')?RET_ARRAY:0); if (!p) goto err; *(struct rpc_struct**) void_ptr = p; @@ -1746,6 +1767,55 @@ static int rpc_struct_add(struct rpc_struct* s, char* fmt, ...) } if (add_xmlrpc_reply(reply, &value_suffix) < 0) goto err; if (add_xmlrpc_reply(reply, &member_suffix) < 0) goto err; + if(s->vtype==RET_ARRAY && *fmt == '{') { + if (add_xmlrpc_reply(reply, &struct_suffix) < 0) goto err; + if (add_xmlrpc_reply(reply, &value_suffix) < 0) goto err; + } + fmt++; + } + + va_end(ap); + return 0; + err: + va_end(ap); + return -1; +} + +/** Adds a new value to an array. + */ +static int rpc_array_add(struct rpc_struct* s, char* fmt, ...) +{ + va_list ap; + str member_name; + struct xmlrpc_reply* reply; + void* void_ptr; + struct rpc_struct* p, *tmp; + + reply = &s->struct_out; + if(s->vtype!=RET_ARRAY) { + LM_ERR("parent structure is not an array\n"); + goto err; + } + + va_start(ap, fmt); + while(*fmt) { + if (*fmt == '{' || *fmt == '[') { + void_ptr = va_arg(ap, void**); + p = new_rpcstruct(0, 0, s->reply, (*fmt=='[')?RET_ARRAY:0); + if (!p) + goto err; + *(struct rpc_struct**) void_ptr = p; + p->offset = get_reply_len(reply); + p->parent = s; + if (!s->nnext) { + s->nnext = p; + } else { + for (tmp = s; tmp->nnext; tmp=tmp->nnext); + tmp->nnext = p; + } + } else { + if (print_value(reply, reply, *fmt, &ap) < 0) goto err; + } fmt++; } @@ -2478,12 +2548,14 @@ static int mod_init(void) return -1; } + memset(&func_param, 0, sizeof(func_param)); func_param.send = (rpc_send_f)rpc_send; func_param.fault = (rpc_fault_f)rpc_fault; func_param.add = (rpc_add_f)rpc_add; func_param.scan = (rpc_scan_f)rpc_scan; func_param.printf = (rpc_printf_f)rpc_printf; func_param.struct_add = (rpc_struct_add_f)rpc_struct_add; + func_param.array_add = (rpc_array_add_f)rpc_array_add; func_param.struct_scan = (rpc_struct_scan_f)rpc_struct_scan; func_param.struct_printf = (rpc_struct_printf_f)rpc_struct_printf; func_param.capabilities = (rpc_capabilities_f)rpc_capabilities;
10 years, 7 months
1
0
0
0
git:master: ctl: init binrpc callbacks in mod init and implement '[' specifier
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 9a404279c9e4d07795c82848795622f5f0da0ca2 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9a40427…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Wed Apr 23 23:03:10 2014 +0200 ctl: init binrpc callbacks in mod init and implement '[' specifier - '[' allows adding an array - implemented rpc api member array_add --- modules/ctl/binrpc_run.c | 89 +++++++++++++++++++++++++++++++++++++++------ modules/ctl/binrpc_run.h | 2 + modules/ctl/ctl.c | 3 ++ 3 files changed, 82 insertions(+), 12 deletions(-) diff --git a/modules/ctl/binrpc_run.c b/modules/ctl/binrpc_run.c index f0ee510..216b203 100644 --- a/modules/ctl/binrpc_run.c +++ b/modules/ctl/binrpc_run.c @@ -118,24 +118,28 @@ static int rpc_add(struct binrpc_ctx* ctx, char* fmt, ...); static int rpc_scan(struct binrpc_ctx* ctx, char* fmt, ...); static int rpc_printf(struct binrpc_ctx* ctx, char* fmt, ...); static int rpc_struct_add(struct rpc_struct_l* s, char* fmt, ...); +static int rpc_array_add(struct rpc_struct_l* s, char* fmt, ...); static int rpc_struct_scan(struct rpc_struct_l* s, char* fmt, ...); /* struct scan */ static int rpc_struct_printf(struct rpc_struct_l *s, char* name, char* fmt, ...); -static rpc_t binrpc_callbacks={ - (rpc_fault_f) rpc_fault, - (rpc_send_f) rpc_send, - (rpc_add_f) rpc_add, - (rpc_scan_f) rpc_scan, - (rpc_printf_f) rpc_printf, - (rpc_struct_add_f) rpc_struct_add, - (rpc_struct_scan_f) rpc_struct_scan, - (rpc_struct_printf_f) rpc_struct_printf -}; - +static rpc_t binrpc_callbacks; +void binrpc_callbacks_init(void) +{ + memset(&binrpc_callbacks, 0, sizeof(binrpc_callbacks)); + binrpc_callbacks.fault = (rpc_fault_f)rpc_fault; + binrpc_callbacks.send = (rpc_send_f)rpc_send; + binrpc_callbacks.add = (rpc_add_f)rpc_add; + binrpc_callbacks.scan = (rpc_scan_f)rpc_scan; + binrpc_callbacks.printf = (rpc_printf_f)rpc_printf; + binrpc_callbacks.struct_add = (rpc_struct_add_f)rpc_struct_add; + binrpc_callbacks.array_add = (rpc_struct_add_f)rpc_array_add; + binrpc_callbacks.struct_scan = (rpc_struct_scan_f)rpc_struct_scan; + binrpc_callbacks.struct_printf = (rpc_struct_printf_f)rpc_struct_printf; +} /** mark a pointer for freeing when the ctx is destroyed. * @return 0 on success, -1 on error @@ -977,6 +981,7 @@ static int rpc_add(struct binrpc_ctx* ctx, char* fmt, ...) if (err<0) goto error_add; break; case '{': + case '[': err=binrpc_start_struct(&ctx->out.pkt); if (err<0) goto error_add; rs=new_rpc_struct(); @@ -1080,6 +1085,7 @@ static int rpc_struct_add(struct rpc_struct_l* s, char* fmt, ...) avp.u.strval=*(va_arg(ap, str*)); break; case '{': + case '[': avp.type=BINRPC_T_STRUCT; err=binrpc_addavp(&s->pkt, &avp); if (err<0) goto error_add; @@ -1113,7 +1119,66 @@ error: return -1; } - +/* returns 0 on success, -1 on error */ +static int rpc_array_add(struct rpc_struct_l* s, char* fmt, ...) +{ + va_list ap; + int err; + char* sv; + str* st; + struct rpc_struct_l* rs; + + va_start(ap, fmt); + for (;*fmt; fmt++){ + switch(*fmt){ + case 'd': + case 't': + case 'b': + err=binrpc_addint(&s->pkt, va_arg(ap, int)); + if (err<0) goto error_add; + break; + case 's': /* asciiz */ + sv=va_arg(ap, char*); + if (sv==0) /* fix null strings */ + sv="<null string>"; + err=binrpc_addstr(&s->pkt, sv, strlen(sv)); + if (err<0) goto error_add; + break; + case 'S': /* str */ + st=va_arg(ap, str*); + err=binrpc_addstr(&s->pkt, st->s, st->len); + if (err<0) goto error_add; + break; + case '{': + case '[': + err=binrpc_start_struct(&s->pkt); + if (err<0) goto error_add; + rs=new_rpc_struct(); + if (rs==0) goto error_mem; + rs->offset=binrpc_pkt_len(&s->pkt); + err=binrpc_end_struct(&s->pkt); + if (err<0) goto error_add; + clist_append(&s->substructs, rs, next, prev); + *(va_arg(ap, void**))=rs; + break; + case 'f': + err=binrpc_adddouble(&s->pkt, va_arg(ap, double)); + if (err<0) goto error_add; + break; + default: + LOG(L_CRIT, "BUG: binrpc: rpc_add: formatting char \'%c\'" + " not supported\n", *fmt); + goto error; + } + } + va_end(ap); + return 0; +error_mem: +error_add: +error: + va_end(ap); + return -1; +} /* returns 0 on success, -1 on error */ static int rpc_struct_printf(struct rpc_struct_l *s, char* name, diff --git a/modules/ctl/binrpc_run.h b/modules/ctl/binrpc_run.h index 6224934..680ea5f 100644 --- a/modules/ctl/binrpc_run.h +++ b/modules/ctl/binrpc_run.h @@ -36,4 +36,6 @@ int process_rpc_req(unsigned char* buf, int size, int* bytes_needed, void* sh, void** saved_state); +void binrpc_callbacks_init(void); + #endif diff --git a/modules/ctl/ctl.c b/modules/ctl/ctl.c index bd675f8..b476ea5 100644 --- a/modules/ctl/ctl.c +++ b/modules/ctl/ctl.c @@ -50,6 +50,7 @@ MODULE_VERSION #include "ctl_defaults.h" +#include "binrpc_run.h" #ifdef USE_FIFO #include "fifo_server.h" #endif @@ -229,6 +230,8 @@ static int mod_init(void) { struct id_list* l; + binrpc_callbacks_init(); + if(binrpc_max_body_size<=0) binrpc_max_body_size = 4; if(binrpc_struct_max_body_size<=0)
10 years, 7 months
1
0
0
0
git:master: ctl: fifo server implementation was lacking adding struct values
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: fa9d76128f0e20384a800c7c741365680d6eb799 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fa9d761…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Wed Apr 23 23:01:07 2014 +0200 ctl: fifo server implementation was lacking adding struct values - specifier '{' was not handled for adding values - implemented adding array with '[' specifier - array_add aliased to rpc_struct_add for the moment --- modules/ctl/fifo_server.c | 115 ++++++++++++++++++++++++--------------------- 1 files changed, 62 insertions(+), 53 deletions(-) diff --git a/modules/ctl/fifo_server.c b/modules/ctl/fifo_server.c index d5f849f..a786c21 100644 --- a/modules/ctl/fifo_server.c +++ b/modules/ctl/fifo_server.c @@ -905,12 +905,15 @@ int init_fifo_fd(char* fifo, int fifo_mode, int fifo_uid, int fifo_gid, int fifo_rpc_init() { + memset(&func_param, 0, sizeof(func_param)); func_param.send = (rpc_send_f)rpc_send; func_param.fault = (rpc_fault_f)rpc_fault; func_param.add = (rpc_add_f)rpc_add; func_param.scan = (rpc_scan_f)rpc_scan; func_param.printf = (rpc_printf_f)rpc_printf; func_param.struct_add = (rpc_struct_add_f)rpc_struct_add; + /* use rpc_struct_add for array_add */ + func_param.array_add = (rpc_array_add_f)rpc_struct_add; func_param.struct_scan = (rpc_struct_scan_f)rpc_struct_scan; func_param.struct_printf = (rpc_struct_printf_f)rpc_struct_printf; return 0; @@ -1185,7 +1188,7 @@ static int rpc_add(rpc_ctx_t* ctx, char* fmt, ...) va_start(ap, fmt); while(*fmt) { - if (*fmt == '{') { + if (*fmt == '{' || *fmt == '[') { void_ptr = va_arg(ap, void**); l = new_chunk(&s); if (!l) { @@ -1441,11 +1444,11 @@ static int rpc_scan(rpc_ctx_t* ctx, char* fmt, ...) } - static int rpc_struct_add(struct text_chunk* s, char* fmt, ...) { static char buf[MAX_LINE_BUFFER]; str st, *sp; + void** void_ptr; va_list ap; struct text_chunk* m, *c; rpc_ctx_t* ctx; @@ -1463,61 +1466,67 @@ static int rpc_struct_add(struct text_chunk* s, char* fmt, ...) } m->flags |= CHUNK_MEMBER_NAME; - switch(*fmt) { - case 'd': - case 't': - st.s = int2str(va_arg(ap, int), &st.len); - c = new_chunk(&st); - break; - - case 'f': - st.s = buf; - st.len = snprintf(buf, 256, "%f", va_arg(ap, double)); - if (st.len < 0) { - rpc_fault(ctx, 400, "Error While Converting double"); - ERR("Error while converting double\n"); + if(*fmt=='{' || *fmt=='[') { + void_ptr = va_arg(ap, void**); + m->ctx=ctx; + append_chunk(ctx, m); + *void_ptr = m; + } else { + switch(*fmt) { + case 'd': + case 't': + st.s = int2str(va_arg(ap, int), &st.len); + c = new_chunk(&st); + break; + + case 'f': + st.s = buf; + st.len = snprintf(buf, 256, "%f", va_arg(ap, double)); + if (st.len < 0) { + rpc_fault(ctx, 400, "Error While Converting double"); + ERR("Error while converting double\n"); + goto err; + } + c = new_chunk(&st); + break; + + case 'b': + st.len = 1; + st.s = ((va_arg(ap, int) == 0) ? "0" : "1"); + c = new_chunk(&st); + break; + + case 's': + st.s = va_arg(ap, char*); + st.len = strlen(st.s); + c = new_chunk_escape(&st, 1); + break; + + case 'S': + sp = va_arg(ap, str*); + c = new_chunk_escape(sp, 1); + break; + + default: + rpc_fault(ctx, 500, "Bug In SER (Invalid formatting character %c)", + *fmt); + ERR("Invalid formatting character\n"); goto err; } - c = new_chunk(&st); - break; - - case 'b': - st.len = 1; - st.s = ((va_arg(ap, int) == 0) ? "0" : "1"); - c = new_chunk(&st); - break; - - case 's': - st.s = va_arg(ap, char*); - st.len = strlen(st.s); - c = new_chunk_escape(&st, 1); - break; - - case 'S': - sp = va_arg(ap, str*); - c = new_chunk_escape(sp, 1); - break; - - default: - rpc_fault(ctx, 500, "Bug In SER (Invalid formatting character %c)", - *fmt); - ERR("Invalid formatting character\n"); - goto err; - } - if (!c) { - rpc_fault(ctx, 500, "Internal Server Error"); - goto err; + if (!c) { + rpc_fault(ctx, 500, "Internal Server Error"); + goto err; + } + c->flags |= CHUNK_MEMBER_VALUE; + c->next = s->next; + s->next = c; + if (s == ctx->last) ctx->last = c; + + m->next = s->next; + s->next = m; + if (s == ctx->last) ctx->last = m; } - c->flags |= CHUNK_MEMBER_VALUE; - c->next = s->next; - s->next = c; - if (s == ctx->last) ctx->last = c; - - m->next = s->next; - s->next = m; - if (s == ctx->last) ctx->last = m; - fmt++; } va_end(ap);
10 years, 7 months
1
0
0
0
git:master: tm: reset local lock reply status after functions that do unlock
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 5943a8005baf8ce1239d2cf728373cb26975483a URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5943a80…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Wed Apr 23 22:12:48 2014 +0200 tm: reset local lock reply status after functions that do unlock --- modules/tm/t_reply.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 2070d9d..8e435cb 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -2480,6 +2480,7 @@ int reply_received( struct sip_msg *p_msg ) } if ( is_local(t) ) { reply_status=local_reply( t, p_msg, branch, msg_status, &cancel_data ); + replies_locked=0; if (reply_status == RPS_COMPLETED) { /* no more UAC FR/RETR (if I received a 2xx, there may * be still pending branches ... @@ -2497,6 +2498,7 @@ int reply_received( struct sip_msg *p_msg ) } else { reply_status=relay_reply( t, p_msg, branch, msg_status, &cancel_data, 1 ); + replies_locked=0; if (reply_status == RPS_COMPLETED) { /* no more UAC FR/RETR (if I received a 2xx, there may be still pending branches ... @@ -2534,7 +2536,8 @@ int reply_received( struct sip_msg *p_msg ) skip_send_reply: if (likely(replies_locked)){ - UNLOCK_REPLIES(t); /* unlock replies - this would be unlocked by send function*/ + /* unlock replies if still locked coming via goto skip_send_reply */ + UNLOCK_REPLIES(t); replies_locked=0; }
10 years, 7 months
1
0
0
0
git:master: core: new rpc api to add values in an array
by Daniel-Constantin Mierla
Module: sip-router Branch: master Commit: 83247604e8c79b2df8c1e80347a96201e31d49ba URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8324760…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: Wed Apr 23 22:59:22 2014 +0200 core: new rpc api to add values in an array - memeber named array_add --- rpc.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/rpc.h b/rpc.h index addc8c8..fbaea83 100644 --- a/rpc.h +++ b/rpc.h @@ -51,7 +51,8 @@ typedef void (*rpc_fault_f)(void* ctx, int code, char* fmt, ...); /* Si typedef int (*rpc_add_f)(void* ctx, char* fmt, ...); /* Add a new piece of data to the result */ typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...); /* Retrieve request parameters */ typedef int (*rpc_printf_f)(void* ctx, char* fmt, ...); /* Add printf-like formated data to the result set */ -typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...); /* Create a new structure */ +typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...); /* Add fields in a structure */ +typedef int (*rpc_array_add_f)(void* ctx, char* fmt, ...); /* Add values in an array */ typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...); /* Scan attributes of a structure */ typedef int (*rpc_struct_printf_f)(void* ctx, char* name, char* fmt, ...); /* Struct version of rpc_printf */ @@ -74,6 +75,7 @@ typedef struct rpc { rpc_scan_f scan; rpc_printf_f printf; rpc_struct_add_f struct_add; + rpc_array_add_f array_add; rpc_struct_scan_f struct_scan; rpc_struct_printf_f struct_printf; rpc_capabilities_f capabilities;
10 years, 7 months
1
0
0
0
git:master: modules/rtpengine: documented 'force_relay' ICE flag value
by Juha Heinanen
Module: sip-router Branch: master Commit: c9aa1aab82c807e37b870787f6b56c88b067ddf1 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c9aa1aa…
Author: Juha Heinanen <jh(a)tutpro.com> Committer: Juha Heinanen <jh(a)tutpro.com> Date: Wed Apr 23 16:45:49 2014 +0300 modules/rtpengine: documented 'force_relay' ICE flag value --- modules/rtpengine/README | 143 +++++++++++++++-------------- modules/rtpengine/doc/rtpengine_admin.xml | 6 +- 2 files changed, 78 insertions(+), 71 deletions(-) Diff:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=c9a…
10 years, 7 months
1
0
0
0
git:master: rtpengine: support ICE=force_relay flag
by Richard Fuchs
Module: sip-router Branch: master Commit: 9a07154c0fd8bde372bd1c8b5967b413d11a13c9 URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9a07154…
Author: Juha Heinanen <jh(a)tutpro.com> Committer: Richard Fuchs <rfuchs(a)sipwise.com> Date: Wed Apr 23 09:33:13 2014 -0400 rtpengine: support ICE=force_relay flag author: Juha Heinanen <jh(a)tutpro.com> --- modules/rtpengine/rtpengine.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c index 0c4d782..4bc6fbf 100644 --- a/modules/rtpengine/rtpengine.c +++ b/modules/rtpengine/rtpengine.c @@ -1160,7 +1160,7 @@ static int parse_flags(struct ng_flags_parse *ng_flags, struct sip_msg *msg, enu if (!val.s) goto error; err = "invalid value"; - if (str_eq(&val, "force") || str_eq(&val, "remove")) + if (str_eq(&val, "force") || str_eq(&val, "force_relay")|| str_eq(&val, "remove")) bencode_dictionary_add_str(ng_flags->dict, "ICE", &val); else goto error;
10 years, 7 months
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
31
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
31
Results per page:
10
25
50
100
200