modules_k/usrloc/udomain.h

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 /*
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 "urecord.h"
00044 #include "hslot.h"
00045 #include "usrloc.h"
00046 
00047 struct hslot;   
00048 struct urecord; 
00054 struct udomain {
00055         str* name;                 
00056         int size;                  
00057         struct hslot* table;       
00058         /* statistics */
00059         stat_var *users;           
00060         stat_var *contacts;        
00061         stat_var *expires;         
00062 };
00063 
00064 
00073 int new_udomain(str* _n, int _s, udomain_t** _d);
00074 
00075 
00080 void free_udomain(udomain_t* _d);
00081 
00082 
00086 void print_udomain(FILE* _f, udomain_t* _d);
00087 
00088 
00098 int preload_udomain(db1_con_t* _c, udomain_t* _d);
00099 
00100 
00106 int testdb_udomain(db1_con_t* con, udomain_t* d);
00107 
00108 
00114 int db_timer_udomain(udomain_t* _d);
00115 
00116 
00123 void mem_timer_udomain(udomain_t* _d, int istart, int istep);
00124 
00125 
00133 int mem_insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
00134 
00135 
00141 void mem_delete_urecord(udomain_t* _d, struct urecord* _r);
00142 
00143 
00147 void lock_udomain(udomain_t* _d, str *_aor);
00148 
00149 
00155 void unlock_udomain(udomain_t* _d, str *_aor);
00156 
00157 
00163 void lock_ulslot(udomain_t* _d, int i);
00164 
00170 void unlock_ulslot(udomain_t* _d, int i);
00171 
00172 /* ===== module interface ======= */
00173 
00174 
00182 int insert_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
00183 
00184 
00192 int get_urecord(udomain_t* _d, str* _aor, struct urecord** _r);
00193 
00203 int get_urecord_by_ruid(udomain_t* _d, unsigned int _aorhash,
00204                 str *_ruid, struct urecord** _r, struct ucontact** _c);
00205 
00213 int delete_urecord(udomain_t* _d, str* _aor, struct urecord* _r);
00214 
00215 
00216 #endif