Explorar o código

modules_k/registrar: Extended C-API to include a URI lookup

- Enhancement added by Hugh Waite @ Crocodile RCS
Peter Dunkley %!s(int64=12) %!d(string=hai) anos
pai
achega
18a4a8a339
Modificáronse 2 ficheiros con 20 adicións e 0 borrados
  1. 16 0
      modules_k/registrar/api.c
  2. 4 0
      modules_k/registrar/api.h

+ 16 - 0
modules_k/registrar/api.c

@@ -78,6 +78,21 @@ int regapi_lookup(struct sip_msg *msg, char *table)
 	return lookup(msg, d, NULL);
 }
 
+/**
+ *
+ */
+int regapi_lookup_uri(struct sip_msg *msg, char *table, str * uri)
+{
+	udomain_t* d;
+
+	if(ul.get_udomain(table, &d)<0)
+	{
+		LM_ERR("usrloc domain [%s] not found\n", table);
+		return -1;
+	}
+	return lookup(msg, d, uri);
+}
+
 /**
  *
  */
@@ -105,6 +120,7 @@ int bind_registrar(registrar_api_t* api)
 	api->save       = regapi_save;
 	api->save_uri   = regapi_save_uri;
 	api->lookup     = regapi_lookup;
+	api->lookup_uri = regapi_lookup_uri;
 	api->registered = regapi_registered;
 
 	return 0;

+ 4 - 0
modules_k/registrar/api.h

@@ -40,6 +40,9 @@ int regapi_save_uri(struct sip_msg *msg, char *table, int flags, str *uri);
 typedef int (*regapi_lookup_f)(struct sip_msg *msg, char *table);
 int regapi_lookup(struct sip_msg *msg, char *table);
 
+typedef int (*regapi_lookup_uri_f)(struct sip_msg *msg, char *table, str *uri);
+int regapi_lookup_uri(struct sip_msg *msg, char *table, str *uri);
+
 /**
  * @brief REGISTRAR API structure
  */
@@ -47,6 +50,7 @@ typedef struct registrar_api {
 	regapi_save_f       save;
 	regapi_save_uri_f   save_uri;
 	regapi_lookup_f     lookup;
+	regapi_lookup_uri_f lookup_uri;
 	regapi_lookup_f     registered;
 } registrar_api_t;