modules_k/usrloc/usrloc.c

Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Copyright (C) 2001-2003 FhG Fokus
00005  *
00006  * This file is part of Kamailio, a free SIP server.
00007  *
00008  * Kamailio is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version
00012  *
00013  * Kamailio is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License 
00019  * along with this program; if not, write to the Free Software 
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  * History:
00023  * ========
00024  *
00025  * 2006-11-28 Added a new function to the usrloc_api, to retrieve the number
00026  *            of registered users.  (Jeffrey Magder - SOMA Networks)
00027  */
00028 
00036 #include "usrloc.h"
00037 #include "dlist.h"
00038 #include "urecord.h"
00039 #include "ucontact.h"
00040 #include "udomain.h"
00041 #include "../../sr_module.h"
00042 #include "ul_mod.h"
00043 
00045 extern unsigned int nat_bflag;
00047 extern unsigned int init_flag;
00048 
00049 
00055 int bind_usrloc(usrloc_api_t* api)
00056 {
00057         if (!api) {
00058                 LM_ERR("invalid parameter value\n");
00059                 return -1;
00060         }
00061         if (init_flag==0) {
00062                 LM_ERR("configuration error - trying to bind to usrloc module"
00063                                 " before being initialized\n");
00064                 return -1;
00065         }
00066 
00067         api->register_udomain   = register_udomain;
00068         api->get_udomain        = get_udomain;
00069         api->get_all_ucontacts  = get_all_ucontacts;
00070         api->insert_urecord     = insert_urecord;
00071         api->delete_urecord     = delete_urecord;
00072         api->get_urecord        = get_urecord;
00073         api->lock_udomain       = lock_udomain;
00074         api->unlock_udomain     = unlock_udomain;
00075         api->release_urecord    = release_urecord;
00076         api->insert_ucontact    = insert_ucontact;
00077         api->delete_ucontact    = delete_ucontact;
00078         api->get_ucontact       = get_ucontact;
00079         api->update_ucontact    = update_ucontact;
00080         api->register_ulcb      = register_ulcb;
00081         api->get_aorhash        = ul_get_aorhash;
00082 
00083         api->get_urecord_by_ruid      = get_urecord_by_ruid;
00084         api->get_ucontact_by_instance = get_ucontact_by_instance;
00085 
00086         api->use_domain = use_domain;
00087         api->db_mode    = db_mode;
00088         api->nat_flag   = nat_bflag;
00089 
00090         return 0;
00091 }