1 /********************************************************************** 2 * perditiondb_mysql.h December 1999 3 * Horms horms@verge.net.au. 4 * 5 * Access a MySQL database 6 * 7 * Adapted from code contributed by: 8 * Frederic Delchambre October 1999 9 * N.T.S. / Freegates dedel@freegates.be 10 * http://www.freegates.be/ 11 * http://www.nts.be/ 12 * perdition 13 * Mail retrieval proxy server, MySQL support 14 * Copyright (C) 1999-2005 Horms, Frederic Delchambre 15 * 16 * This program is free software; you can redistribute it and/or 17 * modify it under the terms of the GNU General Public License as 18 * published by the Free Software Foundation; either version 2 of the 19 * License, or (at your option) any later version. 20 * 21 * This program is distributed in the hope that it will be useful, but 22 * WITHOUT ANY WARRANTY; without even the implied warranty of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 * General Public License for more details. 25 * 26 * You should have received a copy of the GNU General Public License 27 * along with this program; if not, write to the Free Software Foundation, 28 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 29 * 30 **********************************************************************/ 31 32 #ifndef PERDITIONDB_MYSQ_H 33 #define PERDITIONDB_MYSQ_H 34 35 #include "log.h" 36 #include <string.h> 37 #include <unistd.h> 38 #include <stdlib.h> 39 #include <ctype.h> 40 #include <stdio.h> 41 #include <mysql.h> 42 #include <vanessa_adt.h> 43 44 #define PERDITIONDB_MYSQL_FIELD_DELIMITER ':' 45 #define PERDITIONDB_MYSQL_HOSTS_DELIMITER ',' 46 #define PERDITIONDB_MYSQL_MAX_SLEEP 1800 47 #define PERDITIONDB_MYSQL_DEFAULT_DBHOSTS "localhost" 48 #define PERDITIONDB_MYSQL_DEFAULT_DBPORT 0 49 #define PERDITIONDB_MYSQL_DEFAULT_DBNAME "dbPerdition" 50 #define PERDITIONDB_MYSQL_DEFAULT_DBTABLE "tblPerdition" 51 #define PERDITIONDB_MYSQL_DEFAULT_DBUSER "perdition" 52 #define PERDITIONDB_MYSQL_DEFAULT_DBPWD "perdition" 53 #define PERDITIONDB_MYSQL_DEFAULT_DBUSERCOL "user" 54 #define PERDITIONDB_MYSQL_DEFAULT_DBSRVCOL "servername" 55 #define PERDITIONDB_MYSQL_DEFAULT_DBPORTCOL "port" 56 57 #define PERDITIONDB_MYSQL_DBHOSTS 0 58 #define PERDITIONDB_MYSQL_DBPORT 1 59 #define PERDITIONDB_MYSQL_DBNAME 2 60 #define PERDITIONDB_MYSQL_DBTABLE 3 61 #define PERDITIONDB_MYSQL_DBUSER 4 62 #define PERDITIONDB_MYSQL_DBPWD 5 63 #define PERDITIONDB_MYSQL_DBSRVCOL 6 64 #define PERDITIONDB_MYSQL_DBUSERCOL 7 65 #define PERDITIONDB_MYSQL_DBPORTCOL 8 66 67 #define PERDITIONDB_MYSQL_QUERY_LENGTH 256 68 69 int dbserver_fini(void); 70 71 int dbserver_init(char *options_str); 72 73 int dbserver_get( 74 const char * key_str, 75 const char * options_str, 76 char **str_return, 77 size_t *len_return 78 ); 79 80 #endif 81