Module: sip-router
Branch: master
Commit: db188fbcf4d752a2afab2e298a2f081f836d7e92
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=db188fb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Jul 28 13:18:11 2011 +0200
textops(k): internal API bind function exported via module interface
- internal API was defined but no function to bind it was available in
the module interface, reported by Timo Klecker
- rename of functions and typedef'ed struct to match the patterns of
exporting modules internal API
---
modules_k/textops/api.c | 2 +-
modules_k/textops/api.h | 18 +++++++++---------
modules_k/textops/textops.c | 3 +++
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/modules_k/textops/api.c b/modules_k/textops/api.c
index aad62e1..3180d09 100644
--- a/modules_k/textops/api.c
+++ b/modules_k/textops/api.c
@@ -103,7 +103,7 @@ int search_api(struct sip_msg *msg, str *regex){
/*
* Function to load the textops api.
*/
-int load_textops(struct textops_binds *tob){
+int bind_textops(textops_api_t *tob){
if(tob==NULL){
LM_WARN("textops_binds: Cannot load textops API into a NULL pointer\n");
return -1;
diff --git a/modules_k/textops/api.h b/modules_k/textops/api.h
index fbad481..a2b72c4 100644
--- a/modules_k/textops/api.h
+++ b/modules_k/textops/api.h
@@ -37,31 +37,31 @@ typedef int (*search_t)(struct sip_msg*, str*);
/*
* Struct with the textops api.
*/
-struct textops_binds{
+typedef struct textops_binds {
append_hf_t append_hf; // Append a header to the message.
remove_hf_t remove_hf; // Remove a header with the specified name from the message.
search_append_t search_append; // Append a str after a match of the specified regex.
search_t search; // Check if the regex matches a part of the message.
-};
+} textops_api_t;
-typedef int (*load_textops_f)(struct textops_binds*);
+typedef int (*bind_textops_f)(textops_api_t*);
/*
* function exported by module - it will load the other functions
*/
-int load_textops(struct textops_binds*);
+int bind_textops(textops_api_t*);
/*
* Function to be called direclty from other modules to load
* the textops API.
*/
-inline static int load_textops_api(struct textops_binds *tob){
- load_textops_f load_textops_exports;
- if(!(load_textops_exports=(load_textops_f)find_export("load_textops",0,0))){
- LM_ERR("Failed to import load_textops\n");
+inline static int load_textops_api(textops_api_t *tob){
+ bind_textops_f bind_textops_exports;
+ if(!(bind_textops_exports=(bind_textops_f)find_export("bind_textops",0,0))){
+ LM_ERR("Failed to import bind_textops\n");
return -1;
}
- return load_textops_exports(tob);
+ return bind_textops_exports(tob);
}
#endif /*TEXT_OPS_API_H_*/
diff --git a/modules_k/textops/textops.c b/modules_k/textops/textops.c
index 6b8fa42..7c62e2e 100644
--- a/modules_k/textops/textops.c
+++ b/modules_k/textops/textops.c
@@ -254,6 +254,9 @@ static cmd_export_t cmds[]={
0, 0,
REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE},
+ {"bind_textops", (cmd_function)bind_textops, 0, 0, 0,
+ 0},
+
{0,0,0,0,0,0}
};