Module: sip-router
Branch: andrei/rve_f_params
Commit: d709a720cdbc578eb27184061708f730d2552b6f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d709a72…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Aug 5 23:13:12 2010 +0200
core: automatically fill known fixup_free functions
When a module is loaded, for each fixup with a missing fixup_free
function fill the fixup_free function if known.
This way if a module uses one of the known standard fixups, the
core will fill the corresponding free fixup function even if it's
missing in the original module or the module uses a ser style
interface (that does not have a way to define free fixups).
---
sr_module.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/sr_module.c b/sr_module.c
index 2628226..04fb080 100644
--- a/sr_module.c
+++ b/sr_module.c
@@ -203,6 +203,9 @@ static sr31_cmd_export_t* sr_cmd_exports_convert(unsigned ver,
/* 3.1+ specific stuff */
ret[i].fixup_flags = 0;
ret[i].module_exports = mod;
+ /* fill known free fixups */
+ if (ret[i].fixup && ret[i].free_fixup == 0)
+ ret[i].free_fixup = get_fixup_free(ret[i].fixup);
}
return ret;
error:
Module: sip-router
Branch: andrei/rve_f_params
Commit: b4f455f834e621c58c0750660b9e63ccbb01f695
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b4f455f…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Aug 5 22:38:24 2010 +0200
core: pvapi: added pv_spec_free_contents()
Added pv_spec_free_contents() that behaves like pv_spec_free(),
but frees only the contents of the pv_spec and not the pv_spec
itself (good for cleaning up pv_specs that are part of other
structures).
---
pvapi.c | 16 +++++++++++++---
pvar.h | 1 +
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/pvapi.c b/pvapi.c
index 72024cd..7610534 100644
--- a/pvapi.c
+++ b/pvapi.c
@@ -1075,15 +1075,25 @@ error:
return NULL;
}
+
+
+/** frees only the contests of a pv_spec_t. */
+void pv_spec_free_contents(pv_spec_t *spec)
+{
+ /* TODO: free name if it is PV */
+ if(spec->trans)
+ tr_free((trans_t*)spec->trans);
+}
+
+
+
/**
*
*/
void pv_spec_free(pv_spec_t *spec)
{
if(spec==0) return;
- /* TODO: free name if it is PV */
- if(spec->trans)
- tr_free((trans_t*)spec->trans);
+ pv_spec_free_contents(spec);
pkg_free(spec);
}
diff --git a/pvar.h b/pvar.h
index 19b9310..b1a5cfa 100644
--- a/pvar.h
+++ b/pvar.h
@@ -175,6 +175,7 @@ int pv_printf(struct sip_msg* msg, pv_elem_p list, char *buf, int *len);
int pv_elem_free_all(pv_elem_p log);
void pv_value_destroy(pv_value_t *val);
void pv_spec_free(pv_spec_t *spec);
+void pv_spec_free_contents(pv_spec_t* spec);
int pv_spec_dbg(pv_spec_p sp);
int pv_get_spec_index(struct sip_msg* msg, pv_param_p ip, int *idx, int *flags);
int pv_get_avp_name(struct sip_msg* msg, pv_param_p ip, int_str *avp_name,
Module: sip-router
Branch: andrei/rve_f_params
Commit: 6a40b4bdc0c9a481276cfdbfde3a70f833b85836
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6a40b4b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Aug 5 22:47:29 2010 +0200
core: added generic fparam fixup_free functions
Added generic fparam fixup_free functions that can be used to
clean up after a fparam fixup:
void fparam_free_restore(void** param);
int fixup_free_fparam_all(void** param, int param_no);
int fixup_free_fparam_1(void** param, int param_no);
int fixup_free_fparam_2(void** param, int param_no);
They will free anything that was allocated by the fixup and
restore the parameter pointer to the saved original value.
---
mod_fix.c | 1 +
sr_module.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
sr_module.h | 9 ++++++++
3 files changed, 73 insertions(+), 4 deletions(-)
diff --git a/mod_fix.c b/mod_fix.c
index 2e5f076..69974b0 100644
--- a/mod_fix.c
+++ b/mod_fix.c
@@ -34,6 +34,7 @@
#include "mod_fix.h"
#include "mem/mem.h"
+#include "trim.h"
diff --git a/sr_module.c b/sr_module.c
index b729102..d552318 100644
--- a/sr_module.c
+++ b/sr_module.c
@@ -1169,6 +1169,7 @@ error:
/** fparam_t free function.
* Frees the "content" of a fparam, but not the fparam itself.
+ * Note: it doesn't free fp->orig!
* Assumes pkg_malloc'ed content.
* @param fp - fparam to be freed
*
@@ -1220,10 +1221,25 @@ void fparam_free_contents(fparam_t* fp)
}
break;
}
- if (fp->orig){
- pkg_free(fp->orig);
- fp->orig=0;
- }
+}
+
+
+
+/** generic free fixup type function for a fixed fparam.
+ * It will free whatever was allocated during the initial fparam fixup
+ * and restore the original param value.
+ */
+void fparam_free_restore(void** param)
+{
+ fparam_t *fp;
+ void *orig;
+
+ fp = *param;
+ orig = fp->orig;
+ fp->orig = 0;
+ fparam_free_contents(fp);
+ pkg_free(fp);
+ *param = orig;
}
@@ -1574,6 +1590,49 @@ int get_regex_fparam(regex_t *dst, struct sip_msg* msg, fparam_t* param)
+/** generic free fixup function for "pure" fparam type fixups.
+ * @param param - double pointer to param, as for normal fixup functions.
+ * @param param_no - parameter number, ignored.
+ * @return 0 on success (always).
+ */
+int fixup_free_fparam_all(void** param, int param_no)
+{
+ fparam_free_restore(param);
+ return 0;
+}
+
+
+
+/** generic free fixup function for "pure" first parameter fparam type fixups.
+ * @param param - double pointer to param, as for normal fixup functions.
+ * @param param_no - parameter number: the function will work only for
+ * param_no == 1 (first parameter).
+ * @return 0 on success (always).
+ */
+int fixup_free_fparam_1(void** param, int param_no)
+{
+ if (param_no == 1)
+ fparam_free_restore(param);
+ return 0;
+}
+
+
+
+/** generic free fixup function for "pure" 2nd parameter fparam type fixups.
+ * @param param - double pointer to param, as for normal fixup functions.
+ * @param param_no - parameter number: the function will work only for
+ * param_no == 2 (2nd parameter).
+ * @return 0 on success (always).
+ */
+int fixup_free_fparam_2(void** param, int param_no)
+{
+ if (param_no == 2)
+ fparam_free_restore(param);
+ return 0;
+}
+
+
+
/** returns true if a fixup is a fparam_t* one.
* Used to automatically detect fparam fixups that can be used with non
* contant RVEs.
diff --git a/sr_module.h b/sr_module.h
index 8048b6c..17606ab 100644
--- a/sr_module.h
+++ b/sr_module.h
@@ -591,4 +591,13 @@ int get_regex_fparam(regex_t *dst, struct sip_msg* msg, fparam_t* param);
int is_fparam_rve_fixup(fixup_function f);
+
+/** generic free fixup type function for a fixed fparam.
+ * It will free whatever was allocated during the initial fparam fixup
+ * and restore the original param value.
+ */
+void fparam_free_restore(void** param);
+int fixup_free_fparam_all(void** param, int param_no);
+int fixup_free_fparam_1(void** param, int param_no);
+int fixup_free_fparam_2(void** param, int param_no);
#endif /* sr_module_h */
Revision: 6040
http://openser.svn.sourceforge.net/openser/?rev=6040&view=rev
Author: timoreimann
Date: 2010-08-05 16:39:48 +0000 (Thu, 05 Aug 2010)
Log Message:
-----------
modules/dialog: Provide new fix to prevent "unable to find
dialog" WARN messages caused by accessing a dialog in the
"deleted" state (often happens with simultaneous BYE requests when
both UAs hang up at the same time).
This commit uses a different approach where a "deleted" flag is
set in get_dlg() and lookup_dlg() which callers may evaluate.
Callers who only care about existing dialogs can ignore the flag
by passing a NULL argument.
This revision "replaces" 6027.
Modified Paths:
--------------
branches/1.5/modules/dialog/dialog.c
branches/1.5/modules/dialog/dlg_handlers.c
branches/1.5/modules/dialog/dlg_hash.c
branches/1.5/modules/dialog/dlg_hash.h
branches/1.5/modules/dialog/dlg_req_within.c
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6039
http://openser.svn.sourceforge.net/openser/?rev=6039&view=rev
Author: timoreimann
Date: 2010-08-05 16:26:56 +0000 (Thu, 05 Aug 2010)
Log Message:
-----------
modules/dialog: Revert "Prevent 'unable to find dialog' WARN messages
caused by accessing a dialog in the "deleted" state".
The approach chosen was incomplete as it requires extending checks of
return values for all calls to get_dlg() and lookup_dlg() against
POINTER_CLOSED_MARKER. Otherwise, it may lead to server crashes when
code mistakes POINTER_CLOSED_MARKER for an existing dialog. However,
having to check against two return values requires a lot of logic
changes.
Therefore, a better approach will be taken in a follow-up commit.
This reverts release 6027.
Modified Paths:
--------------
branches/1.5/modules/dialog/dlg_cb.c
branches/1.5/modules/dialog/dlg_handlers.c
branches/1.5/modules/dialog/dlg_hash.c
branches/1.5/modules/dialog/dlg_hash.h
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Hello,
I was trying to write a small module using the pua api, unfortunatly I
have found that there is no callback on publish reply (struct publ_info
: publrpl_cb_t* cbrpl;) unlike what is described in the doc.
(http://kamailio.org/docs/modules/devel/modules_k/pua.html#id2556188).
Maybe I have missed an old thread ex plaining that issue ? I have found
that I can do something similar with register_puacb
(modules_k/pua/send_publish.c:341) but in the doc it's said that the
functio||n is for subscribe reply (it's why I was trying to add the
callback in struct publ_info).
If it's a bug, I have already a patch to add the publrpl_cb_t in
publ_info and I guess it's working but I have tested it only with my module.
Please, tell me if you want that I open a new ticket in the bug tracker
about it.
Thanks,
--
nikita