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

Comparing:
ircd-hybrid-8/src/ircd.c (file contents), Revision 1361 by michael, Sun Apr 22 19:01:51 2012 UTC vs.
ircd-hybrid/trunk/src/ircd.c (file contents), Revision 1858 by michael, Thu Apr 25 15:00:52 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"
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 244 | Line 252 | io_loop(void)
252      if (doremotd)
253      {
254        read_message_file(&ConfigFileEntry.motd);
255 <      sendto_realops_flags(UMODE_ALL, L_ALL,
255 >      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
256                             "Got signal SIGUSR1, reloading ircd motd file");
257        doremotd = 0;
258      }
# Line 299 | Line 307 | static void
307   initialize_message_files(void)
308   {
309    init_message_file(USER_MOTD, MPATH, &ConfigFileEntry.motd);
302  init_message_file(OPER_MOTD, OPATH, &ConfigFileEntry.opermotd);
310    init_message_file(USER_LINKS, LIPATH, &ConfigFileEntry.linksfile);
311  
312    read_message_file(&ConfigFileEntry.motd);
306  read_message_file(&ConfigFileEntry.opermotd);
313    read_message_file(&ConfigFileEntry.linksfile);
314  
315    init_isupport();
# Line 430 | Line 436 | setup_corefile(void)
436   * side effects - setups SSL context.
437   */
438   static void
439 < init_ssl(void)
439 > ssl_init(void)
440   {
441   #ifdef HAVE_LIBCRYPTO
442    SSL_load_error_strings();
# Line 464 | Line 470 | init_ssl(void)
470   #endif /* HAVE_LIBCRYPTO */
471   }
472  
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
473   int
474   main(int argc, char *argv[])
475   {
# Line 505 | Line 498 | main(int argc, char *argv[])
498    init_chcap_usage_counts();
499  
500    ConfigFileEntry.dpath      = DPATH;
501 <  ConfigFileEntry.configfile = CPATH;  /* Server configuration file */
502 <  ConfigFileEntry.klinefile  = KPATH;  /* Server kline file         */
503 <  ConfigFileEntry.xlinefile  = XPATH;  /* Server xline file         */
504 <  ConfigFileEntry.rxlinefile = RXPATH; /* Server regex xline file   */
505 <  ConfigFileEntry.rklinefile = RKPATH; /* Server regex kline file   */
506 <  ConfigFileEntry.dlinefile  = DLPATH; /* dline file                */
507 <  ConfigFileEntry.glinefile  = GPATH;  /* gline log file            */
515 <  ConfigFileEntry.cresvfile  = CRESVPATH; /* channel resv file      */
516 <  ConfigFileEntry.nresvfile  = NRESVPATH; /* nick resv file         */
501 >  ConfigFileEntry.configfile = CPATH;    /* Server configuration file */
502 >  ConfigFileEntry.klinefile  = KPATH;    /* Server kline file         */
503 >  ConfigFileEntry.glinefile  = GPATH;    /* Server gline file         */
504 >  ConfigFileEntry.xlinefile  = XPATH;    /* Server xline file         */
505 >  ConfigFileEntry.dlinefile  = DLPATH;   /* dline file                */
506 >  ConfigFileEntry.resvfile   = RESVPATH; /* resv file                 */
507 >
508    myargv = argv;
509    umask(077);                /* better safe than sorry --SRB */
510  
# Line 531 | Line 522 | main(int argc, char *argv[])
522      exit(EXIT_FAILURE);
523    }
524  
525 <  init_ssl();
525 >  ssl_init();
526  
527    if (!server_state.foreground)
528    {
# Line 543 | Line 534 | main(int argc, char *argv[])
534  
535    setup_signals();
536  
546  get_ircd_platform(ircd_platform);
547
537    /* Init the event subsystem */
538    eventInit();
539    /* We need this to initialise the fd array before anything else */
540    fdlist_init();
541 <  log_add_file(LOG_TYPE_IRCD, 0, logFileName);
541 >  log_set_file(LOG_TYPE_IRCD, 0, logFileName);
542    check_can_use_v6();
543    init_comm();         /* This needs to be setup early ! -- adrian */
544    /* Check if there is pidfile and daemon already running */
545    check_pidfile(pidFileName);
546  
547 <  initBlockHeap();
547 >  mp_pool_init();
548    init_dlink_nodes();
560  init_callbacks();
549    initialize_message_files();
550    dbuf_init();
551 <  init_hash();
551 >  hash_init();
552    init_ip_hash_table();      /* client host ip hash table */
553    init_host_hash();          /* Host-hashtable. */
554 <  init_client();
555 <  init_class();
554 >  client_init();
555 >  class_init();
556    whowas_init();
557    watch_init();
558 <  init_auth();          /* Initialise the auth code */
558 >  auth_init();          /* Initialise the auth code */
559    init_resolver();      /* Needs to be setup before the io loop */
560 +  modules_init();
561    read_conf_files(1);   /* cold start init conf files */
562    init_uid();
563    initialize_server_capabs();   /* Set up default_server_capabs */
564    initialize_global_set_options();
565 <  init_channels();
565 >  channel_init();
566 > #ifdef HAVE_LIBGEOIP
567 >  geoip_ctx = GeoIP_new(GEOIP_MEMORY_CACHE);
568 > #endif
569  
570    if (EmptyString(ServerInfo.sid))
571    {
# Line 615 | Line 607 | main(int argc, char *argv[])
607    /* add ourselves to global_serv_list */
608    dlinkAdd(&me, make_dlink_node(), &global_serv_list);
609  
610 +  load_kline_database();
611 +  load_dline_database();
612 +  load_gline_database();
613 +  load_xline_database();
614 +  load_resv_database();
615 +
616    if (chdir(MODPATH))
617    {
618      ilog(LOG_TYPE_IRCD, "Could not load core modules. Terminating!");
# Line 652 | Line 650 | main(int argc, char *argv[])
650    /* Setup the timeout check. I'll shift it later :)  -- adrian */
651    eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1);
652  
653 +  eventAddIsh("save_all_databases", save_all_databases, NULL, DATABASE_UPDATE_TIMEOUT);
654 +
655    if (ConfigServerHide.links_delay > 0)
656      eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay);
657    else

Diff Legend

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