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 1503 by michael, Tue Aug 14 09:05:58 2012 UTC vs.
ircd-hybrid/trunk/src/ircd.c (file contents), Revision 2216 by michael, Thu Jun 6 17:35:45 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"
58 #include "balloc.h"
59 #include "motd.h"
59   #include "supported.h"
60   #include "watch.h"
61 + #include "conf_db.h"
62 + #include "conf_class.h"
63  
64  
65 + #ifdef HAVE_LIBGEOIP
66 + GeoIP *geoip_ctx;
67 + #endif
68   /* /quote set variables */
69   struct SetOptions GlobalSetOptions;
70  
# Line 142 | Line 146 | make_daemon(void)
146   static int printVersion = 0;
147  
148   static struct lgetopt myopts[] = {
145  {"dlinefile",  &ConfigFileEntry.dlinefile,
146   STRING, "File to use for dline.conf"},
149    {"configfile", &ConfigFileEntry.configfile,
150     STRING, "File to use for ircd.conf"},
151 +  {"glinefile",  &ConfigFileEntry.glinefile,
152 +   STRING, "File to use for gline database"},
153    {"klinefile",  &ConfigFileEntry.klinefile,
154 <   STRING, "File to use for kline.conf"},
154 >   STRING, "File to use for kline database"},
155 >  {"dlinefile",  &ConfigFileEntry.dlinefile,
156 >   STRING, "File to use for dline database"},
157    {"xlinefile",  &ConfigFileEntry.xlinefile,
158 <   STRING, "File to use for xline.conf"},
158 >   STRING, "File to use for xline database"},
159 >  {"resvfile",  &ConfigFileEntry.resvfile,
160 >   STRING, "File to use for resv database"},
161    {"logfile",    &logFileName,
162     STRING, "File to use for ircd.log"},
163    {"pidfile",    &pidFileName,
# Line 174 | Line 182 | set_time(void)
182    {
183      ilog(LOG_TYPE_IRCD, "Clock Failure (%s), TS can be corrupted",
184           strerror(errno));
185 <    sendto_realops_flags(UMODE_ALL, L_ALL,
185 >    sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
186                           "Clock Failure (%s), TS can be corrupted",
187                           strerror(errno));
188      restart("Clock Failure");
# Line 242 | Line 250 | io_loop(void)
250      }
251      if (doremotd)
252      {
253 <      read_message_file(&ConfigFileEntry.motd);
254 <      sendto_realops_flags(UMODE_ALL, L_ALL,
255 <                           "Got signal SIGUSR1, reloading ircd motd file");
253 >      motd_recache();
254 >      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
255 >                           "Got signal SIGUSR1, reloading motd files");
256        doremotd = 0;
257      }
258    }
# Line 288 | Line 296 | initialize_global_set_options(void)
296    /* End of global set options */
297   }
298  
291 /* initialize_message_files()
292 *
293 * inputs       - none
294 * output       - none
295 * side effects - Set up all message files needed, motd etc.
296 */
297 static void
298 initialize_message_files(void)
299 {
300  init_message_file(USER_MOTD, MPATH, &ConfigFileEntry.motd);
301  init_message_file(USER_LINKS, LIPATH, &ConfigFileEntry.linksfile);
302
303  read_message_file(&ConfigFileEntry.motd);
304  read_message_file(&ConfigFileEntry.linksfile);
305
306  init_isupport();
307 }
308
299   /* initialize_server_capabs()
300   *
301   * inputs       - none
# Line 427 | Line 417 | setup_corefile(void)
417   * side effects - setups SSL context.
418   */
419   static void
420 < init_ssl(void)
420 > ssl_init(void)
421   {
422   #ifdef HAVE_LIBCRYPTO
423    SSL_load_error_strings();
# Line 461 | Line 451 | init_ssl(void)
451   #endif /* HAVE_LIBCRYPTO */
452   }
453  
464 /* init_callbacks()
465 *
466 * inputs       - nothing
467 * output       - nothing
468 * side effects - setups standard hook points
469 */
470 static void
471 init_callbacks(void)
472 {
473  iorecv_cb = register_callback("iorecv", iorecv_default);
474  iosend_cb = register_callback("iosend", iosend_default);
475 }
476
454   int
455   main(int argc, char *argv[])
456   {
# Line 502 | Line 479 | main(int argc, char *argv[])
479    init_chcap_usage_counts();
480  
481    ConfigFileEntry.dpath      = DPATH;
482 <  ConfigFileEntry.configfile = CPATH;  /* Server configuration file */
483 <  ConfigFileEntry.klinefile  = KPATH;  /* Server kline file         */
484 <  ConfigFileEntry.xlinefile  = XPATH;  /* Server xline file         */
485 <  ConfigFileEntry.rxlinefile = RXPATH; /* Server regex xline file   */
486 <  ConfigFileEntry.rklinefile = RKPATH; /* Server regex kline file   */
487 <  ConfigFileEntry.dlinefile  = DLPATH; /* dline file                */
488 <  ConfigFileEntry.cresvfile  = CRESVPATH; /* channel resv file      */
512 <  ConfigFileEntry.nresvfile  = NRESVPATH; /* nick resv file         */
482 >  ConfigFileEntry.configfile = CPATH;    /* Server configuration file */
483 >  ConfigFileEntry.klinefile  = KPATH;    /* Server kline file         */
484 >  ConfigFileEntry.glinefile  = GPATH;    /* Server gline file         */
485 >  ConfigFileEntry.xlinefile  = XPATH;    /* Server xline file         */
486 >  ConfigFileEntry.dlinefile  = DLPATH;   /* dline file                */
487 >  ConfigFileEntry.resvfile   = RESVPATH; /* resv file                 */
488 >
489    myargv = argv;
490    umask(077);                /* better safe than sorry --SRB */
491  
# Line 527 | Line 503 | main(int argc, char *argv[])
503      exit(EXIT_FAILURE);
504    }
505  
506 <  init_ssl();
506 >  ssl_init();
507  
508    if (!server_state.foreground)
509    {
# Line 543 | Line 519 | main(int argc, char *argv[])
519    eventInit();
520    /* We need this to initialise the fd array before anything else */
521    fdlist_init();
522 <  log_add_file(LOG_TYPE_IRCD, 0, logFileName);
522 >  log_set_file(LOG_TYPE_IRCD, 0, logFileName);
523    check_can_use_v6();
524    init_comm();         /* This needs to be setup early ! -- adrian */
525    /* Check if there is pidfile and daemon already running */
526    check_pidfile(pidFileName);
527  
528 <  initBlockHeap();
528 >  mp_pool_init();
529    init_dlink_nodes();
530 <  init_callbacks();
555 <  initialize_message_files();
530 >  init_isupport();
531    dbuf_init();
532 <  init_hash();
532 >  hash_init();
533    init_ip_hash_table();      /* client host ip hash table */
534    init_host_hash();          /* Host-hashtable. */
535 <  init_client();
536 <  init_class();
535 >  client_init();
536 >  class_init();
537    whowas_init();
538    watch_init();
539 <  init_auth();          /* Initialise the auth code */
539 >  auth_init();          /* Initialise the auth code */
540    init_resolver();      /* Needs to be setup before the io loop */
541    modules_init();
542    read_conf_files(1);   /* cold start init conf files */
543    init_uid();
544    initialize_server_capabs();   /* Set up default_server_capabs */
545    initialize_global_set_options();
546 <  init_channels();
546 >  channel_init();
547 >  read_links_file();
548 >  motd_init();
549 > #ifdef HAVE_LIBGEOIP
550 >  geoip_ctx = GeoIP_new(GEOIP_MEMORY_CACHE);
551 > #endif
552  
553    if (EmptyString(ServerInfo.sid))
554    {
# Line 610 | Line 590 | main(int argc, char *argv[])
590    /* add ourselves to global_serv_list */
591    dlinkAdd(&me, make_dlink_node(), &global_serv_list);
592  
593 +  load_kline_database();
594 +  load_dline_database();
595 +  load_gline_database();
596 +  load_xline_database();
597 +  load_resv_database();
598 +
599    if (chdir(MODPATH))
600    {
601      ilog(LOG_TYPE_IRCD, "Could not load core modules. Terminating!");
# Line 647 | Line 633 | main(int argc, char *argv[])
633    /* Setup the timeout check. I'll shift it later :)  -- adrian */
634    eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1);
635  
636 +  eventAddIsh("save_all_databases", save_all_databases, NULL, DATABASE_UPDATE_TIMEOUT);
637 +
638    if (ConfigServerHide.links_delay > 0)
639      eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay);
640    else

Diff Legend

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