Module: sip-router
Branch: master
Commit: bb21bd2e4699b7a5f15a91ee779ddd6174df307a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bb21bd2…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Tue Mar 3 01:04:36 2009 +0100
Function load_tm_api added
There are many modules that need to access the API of tm module and they all
have to go through the same step of commands to bind the API exported by
the tm module. It makes more sense to create one function which does it all
and make that function available to all other modules using tm.
Signed-off-by: Jan Janak <jan(a)iptel.org>
---
modules/tm/tm_load.h | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/modules/tm/tm_load.h b/modules/tm/tm_load.h
index 8e67dcc..dc00a91 100644
--- a/modules/tm/tm_load.h
+++ b/modules/tm/tm_load.h
@@ -140,4 +140,23 @@ typedef int(*load_tm_f)( struct tm_binds *tmb );
int load_tm( struct tm_binds *tmb);
+static inline int load_tm_api(struct tm_binds* tmb)
+{
+ load_tm_f load_tm;
+
+ /* import the TM auto-loading function */
+ load_tm = (load_tm_f)find_export("load_tm", NO_SCRIPT, 0);
+
+ if (load_tm == NULL) {
+ LOG(L_ERR, "Cannot import load_tm function from tm module\n");
+ return -1;
+ }
+
+ /* let the auto-loading function load all TM stuff */
+ if (load_tm(tmb) == -1) {
+ return -1;
+ }
+ return 0;
+}
+
#endif