00001 /* 00002 * $Id$ 00003 * 00004 * Flatstore module connection structure 00005 * 00006 * Copyright (C) 2004 FhG Fokus 00007 * 00008 * This file is part of Kamailio, a free SIP server. 00009 * 00010 * Kamailio is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version 00014 * 00015 * Kamailio is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 00025 #ifndef _KM_FLAT_CON_H 00026 #define _KM_FLAT_CON_H 00027 00028 #include <stdio.h> 00029 #include <time.h> 00030 #include "km_flat_id.h" 00031 00032 struct flat_con { 00033 struct flat_id* id; /* Connection identifier */ 00034 int ref; /* Reference count */ 00035 FILE* file; /* File descriptor structure */ 00036 struct flat_con* next; /* Next connection in the pool */ 00037 }; 00038 00039 00040 /* 00041 * Some convenience wrappers 00042 */ 00043 #define CON_FILE(db_con) (((struct flat_con*)((db_con)->tail))->file) 00044 00045 00046 /* 00047 * Create a new connection structure, 00048 * open the MySQL connection and set reference count to 1 00049 */ 00050 struct flat_con* flat_new_connection(struct flat_id* id); 00051 00052 00053 /* 00054 * Close the connection and release memory 00055 */ 00056 void flat_free_connection(struct flat_con* con); 00057 00058 00059 /* 00060 * Reopen a connection 00061 */ 00062 int flat_reopen_connection(struct flat_con* con); 00063 00064 00065 #endif /* _KM_FLAT_CON_H */
1.7.1