ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/ircd.c
(Generate patch)

Comparing:
ircd-hybrid-8/src/ircd.c (file contents), Revision 1357 by michael, Sat Apr 21 20:47:01 2012 UTC vs.
ircd-hybrid/trunk/src/ircd.c (file contents), Revision 2150 by michael, Fri May 31 18:39:43 2013 UTC

# Line 36 | Line 36
36   #include "ircd_signal.h"
37   #include "s_gline.h"
38   #include "motd.h"
39 + #include "conf.h"
40   #include "hostmask.h"
41   #include "numeric.h"
42   #include "packet.h"
# Line 45 | Line 46
46   #include "rng_mt.h"
47   #include "s_auth.h"
48   #include "s_bsd.h"
48 #include "conf.h"
49   #include "log.h"
50   #include "s_misc.h"
51   #include "s_serv.h"      /* try_connections */
# Line 53 | Line 53
53   #include "whowas.h"
54   #include "modules.h"
55   #include "memory.h"
56 + #include "mempool.h"
57   #include "hook.h"
58   #include "ircd_getopt.h"
59 < #include "balloc.h"
59 < #include "motd.h"
59 > #include "message.h"
60   #include "supported.h"
61   #include "watch.h"
62 + #include "conf_db.h"
63 + #include "conf_class.h"
64  
65  
66 + #ifdef HAVE_LIBGEOIP
67 + GeoIP *geoip_ctx;
68 + #endif
69   /* /quote set variables */
70   struct SetOptions GlobalSetOptions;
71  
# Line 82 | Line 87 | const char *logFileName = LPATH;
87   const char *pidFileName = PPATH;
88  
89   char **myargv;
85 char ircd_platform[PLATFORMLEN];
90  
91   int dorehash = 0;
92   int doremotd = 0;
# Line 143 | Line 147 | make_daemon(void)
147   static int printVersion = 0;
148  
149   static struct lgetopt myopts[] = {
146  {"dlinefile",  &ConfigFileEntry.dlinefile,
147   STRING, "File to use for dline.conf"},
150    {"configfile", &ConfigFileEntry.configfile,
151     STRING, "File to use for ircd.conf"},
152 +  {"glinefile",  &ConfigFileEntry.glinefile,
153 +   STRING, "File to use for gline database"},
154    {"klinefile",  &ConfigFileEntry.klinefile,
155 <   STRING, "File to use for kline.conf"},
155 >   STRING, "File to use for kline database"},
156 >  {"dlinefile",  &ConfigFileEntry.dlinefile,
157 >   STRING, "File to use for dline database"},
158    {"xlinefile",  &ConfigFileEntry.xlinefile,
159 <   STRING, "File to use for xline.conf"},
159 >   STRING, "File to use for xline database"},
160 >  {"resvfile",  &ConfigFileEntry.resvfile,
161 >   STRING, "File to use for resv database"},
162    {"logfile",    &logFileName,
163     STRING, "File to use for ircd.log"},
164    {"pidfile",    &pidFileName,
# Line 175 | Line 183 | set_time(void)
183    {
184      ilog(LOG_TYPE_IRCD, "Clock Failure (%s), TS can be corrupted",
185           strerror(errno));
186 <    sendto_realops_flags(UMODE_ALL, L_ALL,
186 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
187                           "Clock Failure (%s), TS can be corrupted",
188                           strerror(errno));
189      restart("Clock Failure");
# Line 243 | Line 251 | io_loop(void)
251      }
252      if (doremotd)
253      {
254 <      read_message_file(&ConfigFileEntry.motd);
255 <      sendto_realops_flags(UMODE_ALL, L_ALL,
256 <                           "Got signal SIGUSR1, reloading ircd motd file");
254 >      motd_recache();
255 >      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
256 >                           "Got signal SIGUSR1, reloading motd files");
257        doremotd = 0;
258      }
259    }
# Line 298 | Line 306 | initialize_global_set_options(void)
306   static void
307   initialize_message_files(void)
308   {
301  init_message_file(USER_MOTD, MPATH, &ConfigFileEntry.motd);
302  init_message_file(OPER_MOTD, OPATH, &ConfigFileEntry.opermotd);
309    init_message_file(USER_LINKS, LIPATH, &ConfigFileEntry.linksfile);
310  
305  read_message_file(&ConfigFileEntry.motd);
306  read_message_file(&ConfigFileEntry.opermotd);
311    read_message_file(&ConfigFileEntry.linksfile);
312  
313    init_isupport();
# Line 430 | Line 434 | setup_corefile(void)
434   * side effects - setups SSL context.
435   */
436   static void
437 < init_ssl(void)
437 > ssl_init(void)
438   {
439   #ifdef HAVE_LIBCRYPTO
440    SSL_load_error_strings();
# Line 464 | Line 468 | init_ssl(void)
468   #endif /* HAVE_LIBCRYPTO */
469   }
470  
467 /* init_callbacks()
468 *
469 * inputs       - nothing
470 * output       - nothing
471 * side effects - setups standard hook points
472 */
473 static void
474 init_callbacks(void)
475 {
476  iorecv_cb = register_callback("iorecv", iorecv_default);
477  iosend_cb = register_callback("iosend", iosend_default);
478 }
479
471   int
472   main(int argc, char *argv[])
473   {
# Line 505 | Line 496 | main(int argc, char *argv[])
496    init_chcap_usage_counts();
497  
498    ConfigFileEntry.dpath      = DPATH;
499 <  ConfigFileEntry.configfile = CPATH;  /* Server configuration file */
500 <  ConfigFileEntry.klinefile  = KPATH;  /* Server kline file         */
501 <  ConfigFileEntry.xlinefile  = XPATH;  /* Server xline file         */
502 <  ConfigFileEntry.rxlinefile = RXPATH; /* Server regex xline file   */
503 <  ConfigFileEntry.rklinefile = RKPATH; /* Server regex kline file   */
504 <  ConfigFileEntry.dlinefile  = DLPATH; /* dline file                */
505 <  ConfigFileEntry.glinefile  = GPATH;  /* gline log file            */
515 <  ConfigFileEntry.cresvfile  = CRESVPATH; /* channel resv file      */
516 <  ConfigFileEntry.nresvfile  = NRESVPATH; /* nick resv file         */
499 >  ConfigFileEntry.configfile = CPATH;    /* Server configuration file */
500 >  ConfigFileEntry.klinefile  = KPATH;    /* Server kline file         */
501 >  ConfigFileEntry.glinefile  = GPATH;    /* Server gline file         */
502 >  ConfigFileEntry.xlinefile  = XPATH;    /* Server xline file         */
503 >  ConfigFileEntry.dlinefile  = DLPATH;   /* dline file                */
504 >  ConfigFileEntry.resvfile   = RESVPATH; /* resv file                 */
505 >
506    myargv = argv;
507    umask(077);                /* better safe than sorry --SRB */
508  
# Line 531 | Line 520 | main(int argc, char *argv[])
520      exit(EXIT_FAILURE);
521    }
522  
523 <  init_ssl();
523 >  ssl_init();
524  
525    if (!server_state.foreground)
526    {
# Line 543 | Line 532 | main(int argc, char *argv[])
532  
533    setup_signals();
534  
546  get_ircd_platform(ircd_platform);
547
535    /* Init the event subsystem */
536    eventInit();
537    /* We need this to initialise the fd array before anything else */
538    fdlist_init();
539 <  log_add_file(LOG_TYPE_IRCD, 0, logFileName);
539 >  log_set_file(LOG_TYPE_IRCD, 0, logFileName);
540    check_can_use_v6();
541    init_comm();         /* This needs to be setup early ! -- adrian */
542    /* Check if there is pidfile and daemon already running */
543    check_pidfile(pidFileName);
544  
545 <  initBlockHeap();
545 >  mp_pool_init();
546    init_dlink_nodes();
560  init_callbacks();
547    initialize_message_files();
548    dbuf_init();
549 <  init_hash();
549 >  hash_init();
550    init_ip_hash_table();      /* client host ip hash table */
551    init_host_hash();          /* Host-hashtable. */
552 <  clear_tree_parse();
553 <  init_client();
554 <  init_class();
569 <  init_whowas();
552 >  client_init();
553 >  class_init();
554 >  whowas_init();
555    watch_init();
556 <  init_auth();          /* Initialise the auth code */
556 >  auth_init();          /* Initialise the auth code */
557    init_resolver();      /* Needs to be setup before the io loop */
558 +  modules_init();
559    read_conf_files(1);   /* cold start init conf files */
560    init_uid();
561    initialize_server_capabs();   /* Set up default_server_capabs */
562    initialize_global_set_options();
563 <  init_channels();
563 >  channel_init();
564 >  motd_init();
565 > #ifdef HAVE_LIBGEOIP
566 >  geoip_ctx = GeoIP_new(GEOIP_MEMORY_CACHE);
567 > #endif
568  
569    if (EmptyString(ServerInfo.sid))
570    {
# Line 616 | Line 606 | main(int argc, char *argv[])
606    /* add ourselves to global_serv_list */
607    dlinkAdd(&me, make_dlink_node(), &global_serv_list);
608  
609 +  load_kline_database();
610 +  load_dline_database();
611 +  load_gline_database();
612 +  load_xline_database();
613 +  load_resv_database();
614 +
615    if (chdir(MODPATH))
616    {
617      ilog(LOG_TYPE_IRCD, "Could not load core modules. Terminating!");
# Line 653 | Line 649 | main(int argc, char *argv[])
649    /* Setup the timeout check. I'll shift it later :)  -- adrian */
650    eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1);
651  
652 +  eventAddIsh("save_all_databases", save_all_databases, NULL, DATABASE_UPDATE_TIMEOUT);
653 +
654    if (ConfigServerHide.links_delay > 0)
655      eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay);
656    else

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)