2007-01-24 22:40:21 -08:00
|
|
|
/*
|
|
|
|
* ircd-ratbox: A slightly useful ircd.
|
|
|
|
* ircd.h: A header for the ircd startup routines.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
|
|
|
|
* Copyright (C) 1996-2002 Hybrid Development Team
|
|
|
|
* Copyright (C) 2002-2004 ircd-ratbox 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
|
|
|
|
*/
|
|
|
|
|
2016-07-25 19:06:31 -07:00
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_H
|
2007-01-24 22:40:21 -08:00
|
|
|
|
2016-08-14 19:44:16 -07:00
|
|
|
#if defined(PIC) && defined(PCH)
|
|
|
|
#include "stdinc.pic.h"
|
|
|
|
#else
|
2016-07-25 19:06:31 -07:00
|
|
|
#include "stdinc.h"
|
2016-08-14 19:44:16 -07:00
|
|
|
#endif
|
2016-07-25 19:06:31 -07:00
|
|
|
|
2016-09-05 16:05:16 -07:00
|
|
|
#ifdef __cplusplus
|
2016-08-12 20:05:54 -07:00
|
|
|
namespace ircd {
|
2007-01-24 22:40:21 -08:00
|
|
|
|
2016-10-26 02:39:28 -07:00
|
|
|
extern bool debugmode; // Set by command line to indicate debug behavior
|
|
|
|
extern bool main_exited; // Set when main context has finished.
|
2016-09-05 16:05:16 -07:00
|
|
|
|
2016-09-09 10:48:33 -07:00
|
|
|
// Set callback for when IRCd's main context has completed.
|
|
|
|
using main_exit_cb = std::function<void ()>;
|
|
|
|
void at_main_exit(main_exit_cb);
|
2016-09-05 16:05:16 -07:00
|
|
|
|
2016-10-25 23:25:04 -07:00
|
|
|
//
|
|
|
|
// Sets up the IRCd, handlers (main context), and then returns without blocking.
|
|
|
|
// Pass your io_service instance, it will share it with the rest of your program.
|
|
|
|
// An exception will be thrown on error.
|
|
|
|
//
|
2016-09-09 10:48:33 -07:00
|
|
|
void init(boost::asio::io_service &ios, const std::string &newconf_path, main_exit_cb = nullptr);
|
2016-09-05 16:05:16 -07:00
|
|
|
|
2016-10-25 23:25:04 -07:00
|
|
|
//
|
|
|
|
// Notifies IRCd to shutdown. A shutdown will occur asynchronously and this function will return
|
|
|
|
// immediately. main_exit_cb will be called when IRCd has no more work for the ios (main_exit_cb
|
|
|
|
// will be the last operation from IRCd posted to the ios).
|
|
|
|
//
|
|
|
|
void stop();
|
|
|
|
|
2016-09-05 16:05:16 -07:00
|
|
|
} // namespace ircd
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-10-26 02:39:28 -07:00
|
|
|
/*
|
2016-09-05 16:05:16 -07:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
namespace ircd {
|
|
|
|
|
2016-08-31 01:03:12 -07:00
|
|
|
|
2007-01-24 22:40:21 -08:00
|
|
|
struct SetOptions
|
|
|
|
{
|
2016-10-26 02:39:28 -07:00
|
|
|
int maxclients; // max clients allowed
|
|
|
|
int autoconn; // autoconn enabled for all servers?
|
2007-01-24 22:40:21 -08:00
|
|
|
|
2016-10-26 02:39:28 -07:00
|
|
|
int floodcount; // Number of messages in 1 second
|
|
|
|
int ident_timeout; // timeout for identd lookups
|
2007-01-24 22:40:21 -08:00
|
|
|
|
|
|
|
int spam_num;
|
|
|
|
int spam_time;
|
|
|
|
|
|
|
|
char operstring[REALLEN];
|
|
|
|
char adminstring[REALLEN];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Counter
|
|
|
|
{
|
2016-10-26 02:39:28 -07:00
|
|
|
int oper; // Opers
|
|
|
|
int total; // total clients
|
|
|
|
int invisi; // invisible clients
|
|
|
|
int max_loc; // MAX local clients
|
|
|
|
int max_tot; // MAX global clients
|
|
|
|
unsigned long totalrestartcount; // Total client count ever
|
2007-01-24 22:40:21 -08:00
|
|
|
};
|
|
|
|
|
2016-09-10 23:05:38 -07:00
|
|
|
extern struct SetOptions GlobalSetOptions;
|
2007-01-24 22:40:21 -08:00
|
|
|
|
2016-03-27 20:05:38 -04:00
|
|
|
extern volatile sig_atomic_t dorehash;
|
|
|
|
extern volatile sig_atomic_t dorehashbans;
|
|
|
|
extern volatile sig_atomic_t doremotd;
|
2016-03-09 02:00:40 -06:00
|
|
|
extern bool kline_queued;
|
2016-03-09 02:19:31 -06:00
|
|
|
extern bool server_state_foreground;
|
2016-09-10 23:05:38 -07:00
|
|
|
extern bool opers_see_all_users; // sno_farconnect.so loaded, operspy without accountability, etc
|
2007-01-24 22:40:21 -08:00
|
|
|
|
2008-04-01 15:18:48 -05:00
|
|
|
extern rb_dlink_list global_client_list;
|
2016-08-21 18:57:43 -07:00
|
|
|
extern client::client *local[];
|
2007-01-24 22:40:21 -08:00
|
|
|
extern struct Counter Count;
|
|
|
|
extern int default_server_capabs;
|
|
|
|
|
|
|
|
extern int splitmode;
|
|
|
|
extern int splitchecking;
|
|
|
|
extern int split_users;
|
|
|
|
extern int split_servers;
|
2008-04-11 11:30:07 +02:00
|
|
|
extern int eob_count;
|
2007-01-24 22:40:21 -08:00
|
|
|
|
2008-04-01 15:18:48 -05:00
|
|
|
extern rb_dlink_list unknown_list;
|
|
|
|
extern rb_dlink_list lclient_list;
|
|
|
|
extern rb_dlink_list serv_list;
|
|
|
|
extern rb_dlink_list global_serv_list;
|
|
|
|
extern rb_dlink_list local_oper_list;
|
|
|
|
extern rb_dlink_list oper_list;
|
|
|
|
extern rb_dlink_list dead_list;
|
2007-01-24 22:40:21 -08:00
|
|
|
|
|
|
|
extern int testing_conf;
|
|
|
|
|
2008-04-01 16:25:22 -05:00
|
|
|
extern struct ev_entry *check_splitmode_ev;
|
|
|
|
|
2016-03-19 00:57:32 -05:00
|
|
|
extern bool ircd_ssl_ok;
|
|
|
|
extern bool ircd_zlib_ok;
|
2008-04-02 20:06:11 +04:00
|
|
|
extern int maxconnections;
|
|
|
|
|
2016-08-25 06:26:24 -07:00
|
|
|
void restart(const char *) __attribute__((noreturn));
|
2016-08-31 03:55:27 -07:00
|
|
|
void ircd_shutdown() __attribute__((noreturn));
|
2016-08-25 06:26:24 -07:00
|
|
|
void server_reboot(void) __attribute__((noreturn));
|
|
|
|
|
2016-08-12 20:05:54 -07:00
|
|
|
} // namespace ircd
|
2016-07-25 19:06:31 -07:00
|
|
|
#endif // __cplusplus
|
2016-10-26 02:39:28 -07:00
|
|
|
|
|
|
|
*/
|