Sfoglia il codice sorgente

registrar(s): updated to use common sl module

Daniel-Constantin Mierla 15 anni fa
parent
commit
7cccff46f7

+ 4 - 10
modules_s/registrar/reg_mod.c

@@ -88,7 +88,7 @@ avp_ident_t avpid_code, avpid_reason, avpid_contact;
 /*
  * sl module api
  */
-sl_api_t sl;
+sl_api_t slb;
 
 
 /*
@@ -209,21 +209,15 @@ static int parse_attr_params(void)
  */
 static int mod_init(void)
 {
-	bind_sl_t bind_sl;
 	bind_usrloc_t bind_usrloc;
 
 	DBG("registrar - initializing\n");
 
-             /*
-              * We will need sl_send_reply from stateless
-	      * module for sending replies
-	      */
-        bind_sl = (bind_sl_t)find_export("bind_sl", 0, 0);
-	if (!bind_sl) {
-		ERR("This module requires sl module\n");
+	/* bind the SL API */
+	if (sl_load_api(&slb)!=0) {
+		LM_ERR("cannot bind to SL API\n");
 		return -1;
 	}
-	if (bind_sl(&sl) < 0) return -1;
 
 	bind_usrloc = (bind_usrloc_t)find_export("ul_bind_usrloc", 1, 0);
 	if (!bind_usrloc) {

+ 2 - 2
modules_s/registrar/reg_mod.h

@@ -35,7 +35,7 @@
 #include "../../qvalue.h"
 #include "../../usr_avp.h"
 #include "../usrloc/usrloc.h"
-#include "../sl/sl.h"
+#include "../../modules/sl/sl.h"
 
 extern int default_expires;
 extern qvalue_t default_q;
@@ -54,7 +54,7 @@ extern int max_contacts;
 
 extern usrloc_api_t ul;  /* Structure containing pointers to usrloc functions */
 
-extern sl_api_t sl;
+extern sl_api_t slb;
 
 extern avp_ident_t avpid_code, avpid_reason, avpid_contact;
 

+ 5 - 3
modules_s/registrar/reply.c

@@ -294,7 +294,8 @@ int send_reply(struct sip_msg* _m)
 	char* buf;
 
 	if (contact.data_len > 0) {
-		add_lump_rpl( _m, contact.buf, contact.data_len, LUMP_RPL_HDR|LUMP_RPL_NODUP|LUMP_RPL_NOFREE);
+		add_lump_rpl( _m, contact.buf, contact.data_len,
+				LUMP_RPL_HDR|LUMP_RPL_NODUP|LUMP_RPL_NOFREE);
 		contact.data_len = 0;
 	}
 
@@ -307,7 +308,8 @@ int send_reply(struct sip_msg* _m)
 	}
 	
 	if (code != 200) {
-		buf = (char*)pkg_malloc(E_INFO_LEN + error_info[rerrno].len + CRLF_LEN + 1);
+		buf = (char*)pkg_malloc(E_INFO_LEN + error_info[rerrno].len
+				+ CRLF_LEN + 1);
 		if (!buf) {
 			LOG(L_ERR, "send_reply(): No memory left\n");
 			return -1;
@@ -320,7 +322,7 @@ int send_reply(struct sip_msg* _m)
 
 	}
 
-	if (sl.reply(_m, code, msg) == -1) {
+	if (slb.zreply(_m, code, msg) == -1) {
 		ERR("Error while sending %ld %s\n", code, msg);
 		return -1;
 	} else return 0;