Module: sip-router
Branch: admorten/sca
Commit: 959b2c423a70395c97437d0bcef7950762c4a9b5
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=959b2c4…
Author: Andrew Mortensen <admorten(a)isc.upenn.edu>
Committer: Andrew Mortensen <admorten(a)isc.upenn.edu>
Date: Tue Nov 27 00:09:06 2012 -0500
sca: remove dependency on usrloc.
- usrloc callbacks in practice were only useful for expired
registrations, and even in that case our expired subscription
timer is likely to have purged the stale subscription.
---
modules_s/sca/sca.c | 64 -------------------------------
modules_s/sca/sca_common.h | 1 -
modules_s/sca/sca_usrloc_cb.c | 84 -----------------------------------------
modules_s/sca/sca_usrloc_cb.h | 26 -------------
4 files changed, 0 insertions(+), 175 deletions(-)
diff --git a/modules_s/sca/sca.c b/modules_s/sca/sca.c
index c002241..b2a912d 100644
--- a/modules_s/sca/sca.c
+++ b/modules_s/sca/sca.c
@@ -26,7 +26,6 @@
#include <sys/types.h>
#include <stdlib.h>
-#include "../usrloc/usrloc.h"
#include "../../timer.h"
#include "../../timer_proc.h"
@@ -35,7 +34,6 @@
#include "sca_call_info.h"
#include "sca_rpc.h"
#include "sca_subscribe.h"
-#include "sca_usrloc_cb.h"
MODULE_VERSION
@@ -46,7 +44,6 @@ sca_mod *sca;
/* EXTERNAL API */
db_func_t dbf; /* db api */
-usrloc_api_t ul; /* usrloc callbacks */
struct tm_binds tmb; /* tm functions for sending messages */
sl_api_t slb; /* sl callback, function for getting to-tag */
@@ -54,7 +51,6 @@ sl_api_t slb; /* sl callback, function for getting to-tag */
static int sca_mod_init( void );
static int sca_child_init( int );
static void sca_mod_destroy( void );
-static int sca_bind_usrloc( usrloc_api_t *, sca_mod ** );
static int sca_set_config( sca_mod * );
/* EXPORTED COMMANDS */
@@ -127,61 +123,6 @@ struct module_exports exports = {
sca_child_init, /* per-child initialization function */
};
-/*
- * bind usrloc API and register callbacks for events we care about.
- */
- static int
-sca_bind_usrloc( usrloc_api_t *ul_api, sca_mod **scam )
-{
- bind_usrloc_t bind_usrloc;
-
- assert( scam != NULL );
-
- bind_usrloc = (bind_usrloc_t)find_export( "ul_bind_usrloc", 1, 0 );
- if ( !bind_usrloc ) {
- LM_ERR( "Can't find exported usrloc functions" );
- return( -1 );
- }
-
- if ( bind_usrloc( ul_api ) < 0 ) {
- LM_ERR( "Can't bind exported usrloc functions" );
- return( -1 );
- }
- if ( ul_api->register_ulcb == NULL ) {
- LM_ERR( "Failed to import usrloc register callback function" );
- return( -1 );
- }
-
- /*
- * register callback functions for:
- * 1. contact insertion (new REGISTER for an AoR);
- * 2. contact expiration (registration expired);
- * 3. contact re-registration;
- * 4. contact deletion (REGISTER with Expires: 0)
- */
- if ( ul_api->register_ulcb( UL_CONTACT_INSERT,
- sca_contact_change_cb, NULL ) < 0 ) {
- LM_ERR( "Failed to register for usrloc contact insert callback" );
- return( -1 );
- }
- if ( ul_api->register_ulcb( UL_CONTACT_EXPIRE,
- sca_contact_change_cb, NULL ) < 0 ) {
- LM_ERR( "Failed to register for usrloc contact expire callback" );
- return( -1 );
- }
- if ( ul_api->register_ulcb( UL_CONTACT_UPDATE,
- sca_contact_change_cb, NULL ) < 0 ) {
- LM_ERR( "Failed to register for usrloc contact update callback" );
- return( -1 );
- }
- if ( ul_api->register_ulcb( UL_CONTACT_DELETE,
- sca_contact_change_cb, NULL ) < 0 ) {
- LM_ERR( "Failed to register for usrloc contact update callback" );
- return( -1 );
- }
-
- return( 0 );
-}
static int
sca_bind_sl( sca_mod *scam, sl_api_t *sl_api )
@@ -359,11 +300,6 @@ sca_mod_init( void )
return( -1 );
}
- if ( sca_bind_usrloc( &ul, &sca ) != 0 ) {
- LM_ERR( "Failed to initialize required usrloc API" );
- return( -1 );
- }
-
if ( load_tm_api( &tmb ) != 0 ) {
LM_ERR( "Failed to initialize required tm API" );
return( -1 );
diff --git a/modules_s/sca/sca_common.h b/modules_s/sca/sca_common.h
index 0ddff4d..d613773 100644
--- a/modules_s/sca/sca_common.h
+++ b/modules_s/sca/sca_common.h
@@ -49,7 +49,6 @@
#include "../../mem/shm_mem.h"
/* bound API headers */
-#include "../usrloc/usrloc.h"
#include "../../modules/sl/sl.h"
#include "../../modules/tm/tm_load.h"
diff --git a/modules_s/sca/sca_usrloc_cb.c b/modules_s/sca/sca_usrloc_cb.c
deleted file mode 100644
index ae76ec2..0000000
--- a/modules_s/sca/sca_usrloc_cb.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2012 Andrew Mortensen
- *
- * This file is part of the sca module for sip-router, a free SIP server.
- *
- * The sca module is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version
- *
- * The sca module is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- */
-#include <sys/types.h>
-#include <stdlib.h>
-
-#include "sca_common.h"
-
-#include "sca.h"
-#include "sca_appearance.h"
-#include "sca_event.h"
-#include "sca_subscribe.h"
-#include "sca_usrloc_cb.h"
-
- static const char *
-sca_name_from_contact_event_type( int type )
-{
- static const char *name = "unknown contact change event";
-
- switch ( type ) {
- case UL_CONTACT_INSERT:
- name = "insert";
- break;
-
- case UL_CONTACT_UPDATE:
- name = "update";
- break;
-
- case UL_CONTACT_EXPIRE:
- name = "expire";
- break;
-
- case UL_CONTACT_DELETE:
- name = "delete";
- break;
-
- default:
- break;
- }
-
- return( name );
-}
-
- void
-sca_contact_change_cb( ucontact_t *c, int type, void *param )
-{
- const char *event_name = sca_name_from_contact_event_type( type );
-
- if ( type == UL_CONTACT_INSERT || type == UL_CONTACT_UPDATE ) {
- return;
- }
-
- if ( !sca_uri_is_shared_appearance( sca, &c->aor )) {
- LM_DBG( "%.*s is not a shared appearance line", STR_FMT( &c->aor ));
- return;
- }
-
- if ( sca_subscription_delete_subscriber_for_event( sca, &c->c,
- &SCA_EVENT_NAME_CALL_INFO, &c->aor ) < 0 ) {
- LM_ERR( "Failed to delete %.*s %.*s subscription on %s",
- STR_FMT( &c->c ), STR_FMT( &SCA_EVENT_NAME_CALL_INFO ),
- event_name );
- }
-}
diff --git a/modules_s/sca/sca_usrloc_cb.h b/modules_s/sca/sca_usrloc_cb.h
deleted file mode 100644
index a74cdc7..0000000
--- a/modules_s/sca/sca_usrloc_cb.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2012 Andrew Mortensen
- *
- * This file is part of the sca module for sip-router, a free SIP server.
- *
- * The sca module is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version
- *
- * The sca module is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- */
-#include "sca_common.h"
-
-void sca_contact_change_cb( ucontact_t *, int, void * );