2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* ircd-ratbox: A slightly useful ircd.
|
|
|
|
* stdinc.h: Pull in all of the necessary system headers
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Aaron Sethman <androsyn@ratbox.org>
|
|
|
|
*
|
|
|
|
* 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-11-29 16:23:38 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
#include <RB_INC_ASSERT_H
|
|
|
|
#include <RB_INC_STDARG_H
|
|
|
|
#include <RB_INC_SYS_TIME_H
|
|
|
|
#include <RB_INC_SYS_RESOURCE_H
|
|
|
|
|
|
|
|
} // extern "C"
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define WIN32_LEAN_AND_MEAN 1
|
|
|
|
#include <RB_INC_WINDOWS_H
|
|
|
|
#include <RB_INC_WINSOCK2_H
|
|
|
|
#include <RB_INC_WS2TCPIP_H
|
|
|
|
#include <RB_INC_IPHLPAPI_H
|
2016-08-13 04:41:59 +02:00
|
|
|
#endif
|
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
#include <RB_INC_CSTDDEF
|
|
|
|
#include <RB_INC_CSTDINT
|
|
|
|
#include <RB_INC_LIMITS
|
|
|
|
#include <RB_INC_TYPE_TRAITS
|
|
|
|
#include <RB_INC_TYPEINDEX
|
|
|
|
#include <RB_INC_VARIANT
|
|
|
|
#include <RB_INC_CERRNO
|
|
|
|
#include <RB_INC_UTILITY
|
|
|
|
#include <RB_INC_FUNCTIONAL
|
|
|
|
#include <RB_INC_ALGORITHM
|
|
|
|
#include <RB_INC_NUMERIC
|
|
|
|
#include <RB_INC_CMATH
|
|
|
|
#include <RB_INC_MEMORY
|
|
|
|
#include <RB_INC_EXCEPTION
|
|
|
|
#include <RB_INC_SYSTEM_ERROR
|
|
|
|
#include <RB_INC_ARRAY
|
|
|
|
#include <RB_INC_VECTOR
|
|
|
|
#include <RB_INC_STACK
|
|
|
|
#include <RB_INC_STRING
|
|
|
|
#include <RB_INC_CSTRING
|
|
|
|
#include <RB_INC_STRING_VIEW
|
|
|
|
#include <RB_INC_EXPERIMENTAL_STRING_VIEW
|
|
|
|
#include <RB_INC_LOCALE
|
|
|
|
#include <RB_INC_CODECVT
|
|
|
|
#include <RB_INC_MAP
|
|
|
|
#include <RB_INC_SET
|
|
|
|
#include <RB_INC_LIST
|
|
|
|
#include <RB_INC_FORWARD_LIST
|
|
|
|
#include <RB_INC_UNORDERED_MAP
|
|
|
|
#include <RB_INC_DEQUE
|
|
|
|
#include <RB_INC_QUEUE
|
|
|
|
#include <RB_INC_SSTREAM
|
|
|
|
#include <RB_INC_FSTREAM
|
|
|
|
#include <RB_INC_IOSTREAM
|
|
|
|
#include <RB_INC_IOMANIP
|
|
|
|
#include <RB_INC_CSTDIO
|
|
|
|
#include <RB_INC_CHRONO
|
|
|
|
#include <RB_INC_CTIME
|
|
|
|
#include <RB_INC_ATOMIC
|
|
|
|
#include <RB_INC_THREAD
|
|
|
|
#include <RB_INC_MUTEX
|
|
|
|
#include <RB_INC_CONDITION_VARIABLE
|
|
|
|
|
2017-08-23 23:40:33 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// IRCd's namespacing is as follows:
|
|
|
|
//
|
|
|
|
// IRCD_ #define and macro namespace
|
|
|
|
// ircd_ C namespace and demangled bindings
|
|
|
|
// ircd:: C++ namespace
|
|
|
|
//
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Pollution
|
|
|
|
//
|
|
|
|
// This section lists all of the items introduced outside of our namespace
|
|
|
|
// which may conflict with your project.
|
|
|
|
//
|
|
|
|
|
|
|
|
// Common branch prediction macros
|
|
|
|
#define likely(x) __builtin_expect(!!(x), 1)
|
|
|
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
|
|
|
|
|
|
|
// Legacy attribute format printf macros
|
|
|
|
#define AFP(a, b) __attribute__((format(printf, a, b)))
|
|
|
|
#define AFGP(a, b) __attribute__((format(gnu_printf, a, b)))
|
|
|
|
|
|
|
|
// Experimental std::string_view
|
2016-11-29 16:23:38 +01:00
|
|
|
namespace std {
|
|
|
|
|
|
|
|
using experimental::string_view;
|
|
|
|
|
|
|
|
} // namespace std
|
|
|
|
|
2017-08-23 23:40:33 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Forward declarations from third party namespaces not included here
|
|
|
|
//
|
|
|
|
|
|
|
|
// Boost is not exposed unless explicitly included by a definition file. This
|
|
|
|
// is a major improvement of project compile time.
|
2016-09-10 21:57:33 +02:00
|
|
|
namespace boost {
|
|
|
|
namespace asio {
|
|
|
|
|
2017-08-23 23:40:33 +02:00
|
|
|
struct io_service; // Allow a reference to an ios to be passed to ircd
|
|
|
|
struct const_buffer; // ircd/buffer.h
|
|
|
|
struct mutable_buffer; // ircd/buffer.h
|
2016-09-10 21:57:33 +02:00
|
|
|
|
|
|
|
} // namespace asio
|
|
|
|
} // namespace boost
|
|
|
|
|
2017-08-23 23:40:33 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Items imported into our namespace.
|
|
|
|
//
|
2016-11-29 16:23:38 +01:00
|
|
|
|
|
|
|
namespace ircd {
|
|
|
|
|
|
|
|
using std::nullptr_t;
|
|
|
|
using std::begin;
|
|
|
|
using std::end;
|
|
|
|
using std::get;
|
|
|
|
using std::chrono::seconds;
|
|
|
|
using std::chrono::milliseconds;
|
|
|
|
using std::chrono::microseconds;
|
|
|
|
using std::chrono::nanoseconds;
|
|
|
|
using std::chrono::duration_cast;
|
|
|
|
using std::static_pointer_cast;
|
|
|
|
using std::dynamic_pointer_cast;
|
|
|
|
using std::const_pointer_cast;
|
|
|
|
using ostream = std::ostream;
|
|
|
|
namespace ph = std::placeholders;
|
|
|
|
namespace asio = boost::asio;
|
|
|
|
using namespace std::string_literals;
|
|
|
|
using namespace std::literals::chrono_literals;
|
|
|
|
|
2017-08-23 23:40:33 +02:00
|
|
|
} // namespace ircd
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// libircd API
|
|
|
|
//
|
|
|
|
|
|
|
|
// Unsorted section
|
|
|
|
namespace ircd {
|
|
|
|
|
2016-11-29 16:23:38 +01:00
|
|
|
extern boost::asio::io_service *ios;
|
|
|
|
constexpr size_t BUFSIZE { 512 };
|
|
|
|
|
|
|
|
struct socket;
|
|
|
|
struct client;
|
|
|
|
|
|
|
|
} // namespace ircd
|
2016-08-23 04:33:36 +02:00
|
|
|
|
2016-08-13 00:21:10 +02:00
|
|
|
#include "util.h"
|
2017-03-14 19:39:26 +01:00
|
|
|
#include "timer.h"
|
2016-11-29 16:23:38 +01:00
|
|
|
#include "allocator.h"
|
|
|
|
#include "info.h"
|
|
|
|
#include "localee.h"
|
2016-09-13 21:39:13 +02:00
|
|
|
#include "life_guard.h"
|
2016-08-15 04:44:16 +02:00
|
|
|
#include "exception.h"
|
2016-09-08 19:49:45 +02:00
|
|
|
#include "color.h"
|
2017-03-14 19:39:26 +01:00
|
|
|
#include "lexical.h"
|
2017-03-20 12:31:58 +01:00
|
|
|
#include "params.h"
|
2016-11-29 16:23:38 +01:00
|
|
|
#include "buffer.h"
|
|
|
|
#include "parse.h"
|
2016-08-16 11:12:01 +02:00
|
|
|
#include "rfc1459.h"
|
2016-11-29 16:23:38 +01:00
|
|
|
#include "json.h"
|
|
|
|
#include "http.h"
|
2016-09-17 04:48:25 +02:00
|
|
|
#include "fmt.h"
|
2017-03-31 00:46:01 +02:00
|
|
|
#include "fs.h"
|
2016-09-05 17:53:36 +02:00
|
|
|
#include "ctx.h"
|
2016-11-29 16:23:38 +01:00
|
|
|
#include "resource.h"
|
2016-09-25 03:25:57 +02:00
|
|
|
#include "logger.h"
|
|
|
|
#include "db.h"
|
2016-10-11 06:28:16 +02:00
|
|
|
#include "js.h"
|
2016-09-11 08:05:38 +02:00
|
|
|
#include "client.h"
|
2016-11-16 03:41:12 +01:00
|
|
|
#include "mods.h"
|
2017-08-23 23:42:19 +02:00
|
|
|
#include "listen.h"
|