modules_k/p_usrloc/udomain.h

Go to the documentation of this file.
00001 /*
00002  * $Id: udomain.h 5272 2008-11-27 12:32:26Z henningw $ 
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 /*
00023  * History:
00024  * --------
00025  *  2003-03-11  changed to new locking scheme: locking.h (andrei)
00026  */
00027 
00028 
00034 #ifndef UDOMAIN_H
00035 #define UDOMAIN_H
00036 
00037 
00038 #include <stdio.h>
00039 #include "../../lib/kcore/statistics.h"
00040 #include "../../locking.h"
00041 #include "../../str.h"
00042 #include "../../lib/srdb1/db.h"
00043 #include "../usrloc/usrloc.h"
00044 #include "urecord.h"
00045 #include "hslot.h"
00046 
00047 
00048 struct hslot;   
00049 struct urecord; 
00055 struct udomain {
00056         str* name;                 
00057         int size;                  
00058         struct hslot* table;       
00059         /* statistics */
00060         stat_var *users;           
00061         stat_var *contacts;        
00062         stat_var *expires;         
00063         /* for ul_db_layer */
00064         int dbt;                   /* type of the database */
00065         db1_con_t * dbh;            /* database handle */
00066 };
00067 
00068 
00077 int new_udomain(str* _n, int _s, udomain_t** _d);
00078 
00079 
00084 void free_udomain(udomain_t* _d);
00085 
00086 
00090 void print_udomain(FILE* _f, udomain_t* _d);
00091 
00092 
00098 int db_timer_udomain(udomain_t* _d);
00099 
00100 
00105 void mem_timer_udomain(udomain_t* _d);
00106 
00107 
00115 int mem_insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
00116 
00117 
00123 void mem_delete_urecord(udomain_t* _d, struct urecord* _r);
00124 
00125 
00126 
00132 void lock_ulslot(udomain_t* _d, int i);
00133 
00139 void unlock_ulslot(udomain_t* _d, int i);
00140 
00141 /* ===== module interface ======= */
00142 
00146 void lock_udomain(udomain_t* _d, str *_aor);
00147 
00148 
00154 void unlock_udomain(udomain_t* _d, str *_aor);
00155 
00156 
00157 
00165 int insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
00166 
00167 
00175 int get_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
00176 
00177 
00185 int delete_urecord(udomain_t* _d, str* _aor, struct urecord* _r);
00186 
00187 
00188 #endif