[IRC-Dev CVS] [CVS] Module ircd-ircdev: Change committed
Brought to you by:
zolty
From: Toni G. <zo...@us...> - 2005-05-01 12:59:58
|
CVSROOT : /cvsroot/irc-dev Module : ircd-ircdev Commit time: 2005-05-01 12:59:50 UTC Modified files: ChangeLog ChangeLog.es include/patchlevel.h ircd/Makefile.in ircd/s_conf.c Added files: ircd/ddb_db_native.c Log message: Author: zoltan <zo...@ir...> Log message: 2005-05-01 Toni García <zo...@ir...> 1.0.alpha30 * DB nativo: Lectura y escritura de hashes ---------------------- diff included ---------------------- Index: ircd-ircdev/ChangeLog diff -u ircd-ircdev/ChangeLog:1.31 ircd-ircdev/ChangeLog:1.32 --- ircd-ircdev/ChangeLog:1.31 Thu Apr 28 14:59:58 2005 +++ ircd-ircdev/ChangeLog Sun May 1 05:59:37 2005 @@ -1,10 +1,13 @@ # # ChangeLog for ircd-ircdev # -# $Id: ChangeLog,v 1.31 2005/04/28 21:59:58 zolty Exp $ +# $Id: ChangeLog,v 1.32 2005/05/01 12:59:37 zolty Exp $ # # Insert new changes at beginning of the change list. # +2005-05-01 Toni García <zo...@ir...> 1.0.alpha30 + * Native DB: Hashes read and save + 2005-04-29 Toni García <zo...@ir...> 1.0.alpha29 * Table i (ilines) * Table z (config) Index: ircd-ircdev/ChangeLog.es diff -u ircd-ircdev/ChangeLog.es:1.31 ircd-ircdev/ChangeLog.es:1.32 --- ircd-ircdev/ChangeLog.es:1.31 Thu Apr 28 15:00:05 2005 +++ ircd-ircdev/ChangeLog.es Sun May 1 05:59:39 2005 @@ -1,10 +1,13 @@ # # Log de Cambios para ircd-ircdev # -# $Id: ChangeLog.es,v 1.31 2005/04/28 22:00:05 zolty Exp $ +# $Id: ChangeLog.es,v 1.32 2005/05/01 12:59:39 zolty Exp $ # # Insertar los nuevos cambios al principio de esta lista de cambios. # +2005-05-01 Toni García <zo...@ir...> 1.0.alpha30 + * DB nativo: Lectura y escritura de hashes + 2005-04-29 Toni García <zo...@ir...> 1.0.alpha29 * Tabla i de ilines * Tabla z de Config Index: ircd-ircdev/include/patchlevel.h diff -u ircd-ircdev/include/patchlevel.h:1.30 ircd-ircdev/include/patchlevel.h:1.31 --- ircd-ircdev/include/patchlevel.h:1.30 Thu Apr 28 15:00:08 2005 +++ ircd-ircdev/include/patchlevel.h Sun May 1 05:59:39 2005 @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: patchlevel.h,v 1.30 2005/04/28 22:00:08 zolty Exp $ + * $Id: patchlevel.h,v 1.31 2005/05/01 12:59:39 zolty Exp $ * */ -#define PATCHLEVEL ".alpha29" +#define PATCHLEVEL ".alpha30" #define RELEASE "1.0" Index: ircd-ircdev/ircd/Makefile.in diff -u ircd-ircdev/ircd/Makefile.in:1.23 ircd-ircdev/ircd/Makefile.in:1.24 --- ircd-ircdev/ircd/Makefile.in:1.23 Thu Apr 14 03:28:06 2005 +++ ircd-ircdev/ircd/Makefile.in Sun May 1 05:59:39 2005 @@ -18,7 +18,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA -# $Id: Makefile.in,v 1.23 2005/04/14 10:28:06 zolty Exp $ +# $Id: Makefile.in,v 1.24 2005/05/01 12:59:39 zolty Exp $ #### Start of system configuration section. #### @@ -93,7 +93,7 @@ DDB_SRC = \ ddb.c \ - ddb_db_template.c \ + ddb_db_native.c \ ddb_events.c\ m_db.c \ m_dbq.c \ Index: ircd-ircdev/ircd/ddb_db_native.c diff -u /dev/null ircd-ircdev/ircd/ddb_db_native.c:1.1 --- /dev/null Sun May 1 05:59:50 2005 +++ ircd-ircdev/ircd/ddb_db_native.c Sun May 1 05:59:40 2005 @@ -0,0 +1,142 @@ +/* + * IRC-Dev IRCD - An advanced and innovative IRC Daemon, ircd/ddb_db_native.c + * + * Copyright (C) 2002-2005 IRC-Dev Development Team <de...@ir...> + * Copyright (C) 2004-2005 Toni Garcia (zoltan) <zo...@ir...> + * Copyright (C) 1999-2003 Jesus Cea Avion <jc...@ar...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +/** @file + * @brief Native DataBase implementation of Distributed DataBase. + * @version $Id: ddb_db_native.c,v 1.1 2005/05/01 12:59:40 zolty Exp $ + */ +#include "config.h" + +#include "ddb.h" +#include "ircd_features.h" +#include "numnicks.h" + +#include <fcntl.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +/* +#include <stdlib.h> +#include <sys/mman.h> +#include <sys/stat.h> +*/ + + +int +ddb_db_open(unsigned char table, unsigned int id, struct ddb_memory_table *mt) +{ + return 1; +} + + +void ddb_db_close(struct ddb_memory_table *mt) +{ +} + +int ddb_db_read(struct ddb_memory_table *mt, char *mask, char *id, char *key, char *content) +{ + return 1; +} + +void ddb_db_write(unsigned char table, char *mask, unsigned int id, char *key, char *content) +{ +} + +void ddb_db_drop(unsigned char table) +{ +} + +void +ddb_db_compact(unsigned char table, char *mask, unsigned int id, char *comment) +{ + +} + + + +void +ddb_hash_read(unsigned char table, unsigned int *hi, unsigned int *lo) +{ + char path[1024]; + char c; + int handle; + + sprintf(path, "%s/hashes", feature_str(FEAT_DDBPATH)); + + handle = open(path, O_RDONLY, S_IRUSR | S_IWUSR); + if (handle == -1) + { + *hi = *lo = 0; + return; + } + + if (lseek(handle, (15 * (table - DDB_INIT)) + 2, SEEK_SET) == -1) + ddb_die("Error when reading table %c hashes (LSEEK)", table); + + read(handle, path, 12); + close(handle); + alarm(0); + + path[12] = '\0'; + c = path[6]; + path[6] = '\0'; + *hi = base64toint(path); + path[6] = c; + *lo = base64toint(path + 6); +} + +void +ddb_hash_write(unsigned char table) +{ + char path[1024]; + char hash[20]; + int handle; + + sprintf(path, "%s/hashes", feature_str(FEAT_DDBPATH)); + alarm(3); + handle = open(path, O_WRONLY, S_IRUSR | S_IWUSR); + if (handle == -1) + { + unsigned char tabletemp; + handle = open(path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); + if (handle == -1) + ddb_die("Error when saving table %c hashes (OPEN)", table); + + for (tabletemp = DDB_INIT; tabletemp <= DDB_END; tabletemp++) + { + sprintf(hash, "%c AAAAAAAAAAAA\n", tabletemp); + write(handle, hash, 15); + } + } + + if (lseek(handle, (15 * (table - DDB_INIT)), SEEK_SET) == -1) + ddb_die("Error when saving table %c hashes (LSEEK)", table); + + inttobase64(hash, ddb_hashtable_hi[table], 6); + inttobase64(hash + 6, ddb_hashtable_lo[table], 6); + sprintf(path, "%c %s\n", table, hash); + if (write(handle, path, strlen(path)) == -1) + ddb_die("Error when saving table %c hashes (WRITE)", table); + close(handle); + alarm(0); +} + Index: ircd-ircdev/ircd/s_conf.c diff -u ircd-ircdev/ircd/s_conf.c:1.14 ircd-ircdev/ircd/s_conf.c:1.15 --- ircd-ircdev/ircd/s_conf.c:1.14 Thu Apr 28 15:00:09 2005 +++ ircd-ircdev/ircd/s_conf.c Sun May 1 05:59:40 2005 @@ -21,7 +21,7 @@ */ /** @file * @brief ircd configuration file driver - * @version $Id: s_conf.c,v 1.14 2005/04/28 22:00:09 zolty Exp $ + * @version $Id: s_conf.c,v 1.15 2005/05/01 12:59:40 zolty Exp $ */ #include "config.h" @@ -390,8 +390,8 @@ ddb = ddb_find_key(DDB_CONFIGDB, (char *)DDB_CONFIGDB_MSG_TOO_MANY_FROM_IP); sendcmdto_one(&me, CMD_NOTICE, cptr, - "In %s IRC Network only allows %d clones for your IP (%s)%s%s", - feature_str(FEAT_NETWORK), maxclones, ircd_ntoa(&cli_ip(cptr)), + "%C :In the %s IRC Network only allows %d clones for your IP (%s)%s%s", + cptr, feature_str(FEAT_NETWORK), maxclones, ircd_ntoa(&cli_ip(cptr)), ddb ? ". " : "", ddb ? ddb->content : ""); return ACR_TOO_MANY_FROM_IP; } ----------------------- End of diff ----------------------- |