Thread: [srvx-commits] CVS: services/src proto.def,NONE,1.1 uplink.c,1.9,1.10 proto_ircu_p10.c,1.23,1.24 pro
Brought to you by:
entrope
From: Entrope <en...@us...> - 2001-09-28 15:21:32
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv16243/src Modified Files: uplink.c proto_ircu_p10.c proto_bahamut.c proto.h proto.c hash.c Makefile.am Added Files: proto.def Removed Files: proto_ircu_p10.h proto_bahamut.h Log Message: refine protocol modularization ***** Error reading new file: [Errno 2] No such file or directory: 'proto.def' Index: uplink.c =================================================================== RCS file: /cvsroot/srvx/services/src/uplink.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** uplink.c 2001/08/19 03:06:09 1.9 --- uplink.c 2001/09/28 15:21:29 1.10 *************** *** 1,2 **** --- 1,22 ---- + /* uplink.c - Network uplink management and state + * Copyright 2000-2001 srvx Development Team + * + * 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 + * + * $Id$ + */ + #include "config.h" #include <errno.h> *************** *** 4,7 **** --- 24,28 ---- #include <stdarg.h> #include <stdlib.h> + #include <sys/socket.h> #include <unistd.h> Index: proto_ircu_p10.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto_ircu_p10.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** proto_ircu_p10.c 2001/09/27 21:58:07 1.23 --- proto_ircu_p10.c 2001/09/28 15:21:29 1.24 *************** *** 54,60 **** #include "hash.h" #include "log.h" ! #define PROTO_FUNC_TYPE 1 #include "proto.h" - #include "proto_ircu_p10.h" #include "timeq.h" #include "tools.h" --- 54,60 ---- #include "hash.h" #include "log.h" ! #define PROTO_FUNC(retval, name, arglist) retval name arglist; ! #define PROTO_VARIABLE(type, name) extern type name; #include "proto.h" #include "timeq.h" #include "tools.h" *************** *** 65,70 **** --- 65,81 ---- /************************************/ + #define SERVER_NUMERIC_LEN 1 + #define USER_NUMERIC_LEN 2 + #define COMBO_NUMERIC_LEN (SERVER_NUMERIC_LEN+USER_NUMERIC_LEN) + #define USERARRAYSIZE (1 << (USER_NUMERIC_LEN * 6)) + extern int ping_freq, ping_timeout; + const char *proto_user_modes = "dkgh"; + const char *proto_channel_modes = ""; + int proto_chanserv_joins_channels = 1; + unsigned int proto_max_mode_args = 6; + unsigned int proto_max_channel_bans = 30; + static void timed_send_ping(void *data); static void timed_ping_timeout(void *data); *************** *** 612,616 **** for (i=0; i<count; i++) { here_len = strlen(list[i]); ! if ((start < queued+here_len+3) || (queued >= MAXMODEPARAMS)) { while (queued) { buffer[--start] = what[1]; --- 623,627 ---- for (i=0; i<count; i++) { here_len = strlen(list[i]); ! if ((start < queued+here_len+3) || (queued >= proto_max_mode_args)) { while (queued) { buffer[--start] = what[1]; *************** *** 648,652 **** for (i=0; i<count; i++) { len = strlen(UPROTO(list[i])->numeric); ! if ((start < queued+3+len) || (queued >= MAXMODEPARAMS)) { while (queued) { buffer[--start] = what[1]; --- 659,663 ---- for (i=0; i<count; i++) { len = strlen(UPROTO(list[i])->numeric); ! if ((start < queued+3+len) || (queued >= proto_max_mode_args)) { while (queued) { buffer[--start] = what[1]; Index: proto_bahamut.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto_bahamut.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** proto_bahamut.c 2001/09/27 21:58:07 1.13 --- proto_bahamut.c 2001/09/28 15:21:29 1.14 *************** *** 55,64 **** #include "log.h" #include "modules.h" ! #define PROTO_FUNC_TYPE 1 #include "proto.h" #include "timeq.h" #include "tools.h" #include "uplink.h" - #include "proto_bahamut.h" /************************************/ --- 55,64 ---- #include "log.h" #include "modules.h" ! #define PROTO_FUNC(retval, name, arglist) retval name arglist; ! #define PROTO_VARIABLE(type, name) extern type name; #include "proto.h" #include "timeq.h" #include "tools.h" #include "uplink.h" /************************************/ *************** *** 73,76 **** --- 73,83 ---- extern int ping_freq, ping_timeout; + const char *proto_user_modes = " h"; + const char *proto_channel_modes = " rRcO"; + int proto_chanserv_joins_channels = 0; + unsigned int proto_max_mode_args = MAXNUMPARAMS; + unsigned int proto_max_channel_bans = 30; + + static void timed_send_ping(void *data); static void timed_ping_timeout(void *data); *************** *** 436,440 **** for (i=0; i<count; i++) { here_len = strlen(list[i]); ! if ((start < queued+here_len+3) || (queued >= MAXMODEPARAMS)) { while (queued) { buffer[--start] = what[1]; --- 443,447 ---- for (i=0; i<count; i++) { here_len = strlen(list[i]); ! if ((start < queued+here_len+3) || (queued >= proto_max_mode_args)) { while (queued) { buffer[--start] = what[1]; *************** *** 472,476 **** for (i=0; i<count; i++) { len = strlen(list[i]->nick); ! if ((start < queued+3+len) || (queued >= MAXMODEPARAMS)) { while (queued) { buffer[--start] = what[1]; --- 479,483 ---- for (i=0; i<count; i++) { len = strlen(list[i]->nick); ! if ((start < queued+3+len) || (queued >= proto_max_mode_args)) { while (queued) { buffer[--start] = what[1]; *************** *** 1406,1410 **** /* Register things with module registry */ ! proto_module = module_register("proto", MAKE_VERSION(0, 0, 0), NULL, lib); uproto_note_id = note_register_module("struct userNode", proto_module); sproto_note_id = note_register_module("struct server", proto_module); --- 1413,1417 ---- /* Register things with module registry */ ! proto_module = module_register("proto", MAKE_VERSION(PROTO_INTERFACE_MAJOR, PROTO_INTERFACE_MINOR, 0), NULL, lib); uproto_note_id = note_register_module("struct userNode", proto_module); sproto_note_id = note_register_module("struct server", proto_module); Index: proto.h =================================================================== RCS file: /cvsroot/srvx/services/src/proto.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -r1.43 -r1.44 *** proto.h 2001/09/27 21:58:07 1.43 --- proto.h 2001/09/28 15:21:29 1.44 *************** *** 24,33 **** #include <stdarg.h> #include <sys/types.h> - #ifdef HAVE_NETINET_IN_H - #include <netinet/in.h> - #endif - #ifdef HAVE_SYS_SOCKET_H - #include <sys/socket.h> - #endif struct server; --- 24,27 ---- *************** *** 46,51 **** #define MAXLEN 512 #define MAXNUMPARAMS 200 ! #define MAXBANS 30 ! #define MAXMODEPARAMS 6 #define MIN_LINE_SIZE 40 #define MAX_LINE_SIZE 450 --- 40,44 ---- #define MAXLEN 512 #define MAXNUMPARAMS 200 ! #define MIN_LINE_SIZE 40 #define MAX_LINE_SIZE 450 *************** *** 59,122 **** /********************/ ! #if PROTO_FUNC_TYPE == 1 ! /* For protocol modules */ ! #define PROTO_FUNC(retval, name) retval name ! #elif PROTO_FUNC_TYPE == 2 ! /* For proto.c, the generic binder */ ! #define PROTO_FUNC(retval, name) retval (*name) ! #else ! /* For other files */ ! #define PROTO_FUNC(retval, name) extern retval (*name) #endif - - /* connection maintenance */ - PROTO_FUNC(void, irc_server)(struct server *srv); - PROTO_FUNC(void, irc_user)(struct userNode *user); - PROTO_FUNC(void, irc_nick)(struct userNode *user); - PROTO_FUNC(void, irc_introduce)(const char *passwd); - PROTO_FUNC(void, irc_quit)(struct userNode *user, const char *message); - PROTO_FUNC(void, irc_squit)(struct server *srv, const char *message); - - /* messages */ - PROTO_FUNC(void, irc_privmsg)(struct userNode *from, const char *to, const char *message); - PROTO_FUNC(void, irc_notice)(struct userNode *from, const char *to, const char *message); - - /* channel maintenance */ - PROTO_FUNC(void, irc_join)(struct userNode *who, struct chanNode *what); - PROTO_FUNC(void, irc_invite)(struct userNode *from, struct userNode *who, struct chanNode *to); - PROTO_FUNC(void, irc_mode)(struct userNode *from, struct chanNode *target, const char *modes); - PROTO_FUNC(void, irc_kick)(struct userNode *actor, struct userNode *who, struct chanNode *from, const char *msg); - PROTO_FUNC(void, irc_part)(struct userNode *who, struct chanNode *what, const char *reason); - PROTO_FUNC(void, irc_topic)(struct userNode *who, struct chanNode *what, const char *topic); - PROTO_FUNC(void, irc_fetchtopic)(struct userNode *from, struct chanNode *what); - - /* network maintenance */ - PROTO_FUNC(void, irc_gline)(const char *host, unsigned long duration, const char *message); - PROTO_FUNC(void, irc_ungline)(const char *mask); - PROTO_FUNC(void, irc_error)(const char *to, const char *message); - PROTO_FUNC(void, irc_kill)(struct userNode *from, struct userNode *target, const char *message); - PROTO_FUNC(void, irc_raw)(const char *what); - PROTO_FUNC(void, irc_stats)(struct userNode *from, struct server *target, char type); ! /********************/ ! /* PROTOCOL PARSING */ ! /********************/ ! PROTO_FUNC(void, reg_chanmsg_func)(unsigned char prefix, struct userNode *service, chanmsg_func_t handler); ! PROTO_FUNC(void, reg_privmsg_func)(struct userNode *user, privmsg_func_t handler); ! PROTO_FUNC(void, reg_notice_func)(struct userNode *user, privmsg_func_t handler); ! PROTO_FUNC(void, reg_mode_change_func)(mode_change_func_t handler); ! PROTO_FUNC(int, parse_line)(unsigned char *line); ! ! /**********************/ ! /* MISCELLANEOUS GUNK */ ! /**********************/ ! ! PROTO_FUNC(struct userNode*, add_local_user)(const char *nick, const char *ident, const char *hostname, const char *modes, const char *userinfo, time_t timestamp); ! PROTO_FUNC(void, chan_apply_bans)(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, char **list); ! PROTO_FUNC(void, chan_apply_mode)(struct userNode *who, struct chanNode *channel, char *what, unsigned int count, struct userNode **list); ! PROTO_FUNC(void, irc_change_channel_modes)(struct chanNode *channel, struct userNode *source, const unsigned char *modes, va_list args); #undef PROTO_FUNC #endif /* !defined(PROTO_H) */ --- 52,67 ---- /********************/ ! #ifndef PROTO_FUNC ! #define PROTO_FUNC(retval, name, arglist) extern retval (*name) arglist; #endif ! #ifndef PROTO_VARIABLE ! #define PROTO_VARIABLE(type, name) extern type name; ! #endif ! #include "proto.def" #undef PROTO_FUNC + #undef PROTO_VARIABLE #endif /* !defined(PROTO_H) */ Index: proto.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto.c,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -r1.73 -r1.74 *** proto.c 2001/09/27 21:58:07 1.73 --- proto.c 2001/09/28 15:21:29 1.74 *************** *** 24,28 **** #include "common.h" #include "log.h" ! #define PROTO_FUNC_TYPE 2 #include "proto.h" --- 24,29 ---- #include "common.h" #include "log.h" ! #define PROTO_FUNC(retval, name, arglist) retval (*name) arglist; ! #define PROTO_VARIABLE(type, name) type name; #include "proto.h" *************** *** 32,35 **** --- 33,37 ---- struct module *pmod; int failed = 0; + void *addr; pmod = module_find_loaded("proto"); *************** *** 38,42 **** return; } ! #define BIND_PROTO(name) if (!(name = get_module_symbol(pmod, #name))) { log(MAIN_LOG, LOG_ERROR, "Protocol module does not export symbol %s\n", #name); failed++; } if (failed) { log(MAIN_LOG, LOG_ERROR, "%d unresolved protocol functions\n", failed); --- 40,48 ---- return; } ! #define PROTO_FUNC(rettype, name, arglist) if (!(name = get_module_symbol(pmod, #name))) { log(MAIN_LOG, LOG_ERROR, "Protocol module does not export symbol %s\n", #name); failed++; } ! #define PROTO_VARIABLE(type, name) if ((addr = get_module_symbol(pmod, #name))) { name = *(type*)addr; } else { log(MAIN_LOG, LOG_ERROR, "Protocol module does not export symbol %s\n", #name); failed++; } ! #include "proto.def" ! #undef PROTO_FUNC ! #undef PROTO_VARIABLE if (failed) { log(MAIN_LOG, LOG_ERROR, "%d unresolved protocol functions\n", failed); Index: hash.c =================================================================== RCS file: /cvsroot/srvx/services/src/hash.c,v retrieving revision 1.145 retrieving revision 1.146 diff -C2 -r1.145 -r1.146 *** hash.c 2001/09/27 21:58:07 1.145 --- hash.c 2001/09/28 15:21:29 1.146 *************** *** 766,770 **** */ for (n=0; n<num; n++) { ! if (channel->banlist.used >= MAXBANS) break; bNode = malloc(sizeof(struct banNode)); --- 766,770 ---- */ for (n=0; n<num; n++) { ! if (channel->banlist.used >= proto_max_channel_bans) break; bNode = malloc(sizeof(struct banNode)); Index: Makefile.am =================================================================== RCS file: /cvsroot/srvx/services/src/Makefile.am,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -r1.39 -r1.40 *** Makefile.am 2001/09/27 21:58:08 1.39 --- Makefile.am 2001/09/28 15:21:29 1.40 *************** *** 1,3 **** - AM_CPPFLAGS = -DTRY_SAXDB LIBS = @INTLLIBS@ @LIBS@ --- 1,2 ---- *************** *** 23,27 **** modules.c modules.h \ policer.c policer.h \ ! proto.c proto.h \ recdb.c recdb.h \ rules.c rules.h \ --- 22,26 ---- modules.c modules.h \ policer.c policer.h \ ! proto.c proto.h proto.def \ recdb.c recdb.h \ rules.c rules.h \ *************** *** 38,45 **** libproto_bahamut_la_SOURCES = \ ! proto_bahamut.c proto_bahamut.h libproto_ircu_p10_la_SOURCES = \ ! proto_ircu_p10.c proto_ircu_p10.h checkdb_SOURCES = checkdb.c recdb.c recdb.h dict-hash.c dict.h log.h saxdb.c saxdb.h --- 37,46 ---- libproto_bahamut_la_SOURCES = \ ! proto.h proto.def \ ! proto_bahamut.c libproto_ircu_p10_la_SOURCES = \ ! proto.h proto.def \ ! proto_ircu_p10.c checkdb_SOURCES = checkdb.c recdb.c recdb.h dict-hash.c dict.h log.h saxdb.c saxdb.h --- proto_ircu_p10.h DELETED --- --- proto_bahamut.h DELETED --- |