2018-02-04 03:22:01 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
2018-01-12 12:21:58 +01:00
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
2018-02-04 03:22:01 +01:00
|
|
|
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
2018-01-12 12:21:58 +01:00
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
2018-02-04 03:22:01 +01:00
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2017-08-23 22:45:14 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Standard includes
|
|
|
|
//
|
|
|
|
// This header includes almost everything we use out of the standard library.
|
|
|
|
// This is a pre-compiled header. Project build time is significantly reduced
|
|
|
|
// by doing things this way and C++ std headers have very little namespace
|
|
|
|
// pollution and risk of conflicts.
|
|
|
|
//
|
2017-09-21 04:31:54 +02:00
|
|
|
// * If any project header file requires standard library symbols we try to
|
|
|
|
// list it here, not in our header files.
|
2017-08-23 22:45:14 +02:00
|
|
|
//
|
|
|
|
// * Rare one-off's #includes isolated to a specific .cc file may not always be
|
|
|
|
// listed here but can be.
|
|
|
|
//
|
|
|
|
// * Third party / dependency / non-std includes, are NEVER listed here.
|
|
|
|
// Instead we include those in .cc files, and use forward declarations if
|
|
|
|
// we require a symbol in our API to them.
|
|
|
|
//
|
|
|
|
|
2017-09-21 04:31:54 +02:00
|
|
|
#define HAVE_IRCD_STDINC_H
|
|
|
|
|
2017-08-23 22:45:14 +02:00
|
|
|
// Generated by ./configure
|
2016-11-29 16:23:38 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2018-01-10 09:56:33 +01:00
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#include <RB_INC_ASSERT_H
|
|
|
|
#include <RB_INC_STDARG_H
|
|
|
|
#include <RB_INC_SYS_TIME_H
|
2018-01-21 11:09:13 +01:00
|
|
|
#include <RB_INC_SYS_UTSNAME_H
|
2018-01-10 09:56:33 +01:00
|
|
|
}
|
2016-11-29 16:23:38 +01:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
2018-01-10 09:56:33 +01:00
|
|
|
#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_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
|
2017-09-28 09:06:00 +02:00
|
|
|
#include <RB_INC_SHARED_MUTEX
|
2016-11-29 16:23:38 +01:00
|
|
|
#include <RB_INC_CONDITION_VARIABLE
|
2017-08-19 22:27:51 +02:00
|
|
|
#include <RB_INC_RANDOM
|
2017-12-05 22:42:21 +01:00
|
|
|
#include <RB_INC_BITSET
|
2017-12-28 21:54:54 +01:00
|
|
|
#include <RB_INC_OPTIONAL
|
2018-01-18 06:35:10 +01:00
|
|
|
#include <RB_INC_NEW
|
2017-12-28 21:54:54 +01:00
|
|
|
|
|
|
|
#include <RB_INC_EXPERIMENTAL_STRING_VIEW
|
|
|
|
#include <RB_INC_EXPERIMENTAL_OPTIONAL
|
2016-11-29 16:23:38 +01:00
|
|
|
|
2018-01-27 03:13:40 +01:00
|
|
|
//////////////////////////////////////////////////////////////////////////////>
|
2017-08-23 23:40:33 +02:00
|
|
|
//
|
|
|
|
// 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
|
2018-01-18 06:35:28 +01:00
|
|
|
#if !defined(__cpp_lib_string_view) && defined(__cpp_lib_experimental_string_view)
|
2017-08-28 23:51:22 +02:00
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
using experimental::string_view;
|
|
|
|
}
|
2017-11-30 20:27:00 +01:00
|
|
|
#endif
|
2016-11-29 16:23:38 +01:00
|
|
|
|
2017-12-28 21:54:54 +01:00
|
|
|
// Experimental std::optional
|
2018-01-18 06:35:28 +01:00
|
|
|
#if !defined(__cpp_lib_optional) && defined(__cpp_lib_experimental_optional)
|
2017-12-28 21:54:54 +01:00
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
using experimental::optional;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-12-23 01:48:15 +01:00
|
|
|
// OpenSSL
|
|
|
|
// Additional forward declarations in the extern namespace are introduced
|
|
|
|
// by ircd/openssl.h
|
|
|
|
|
2017-08-23 23:40:33 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-11-30 20:44:23 +01:00
|
|
|
// libircd API
|
2017-08-23 23:40:33 +02:00
|
|
|
//
|
2016-11-29 16:23:38 +01:00
|
|
|
|
2017-11-30 20:44:23 +01:00
|
|
|
// Some items imported into our namespace.
|
2017-08-28 23:51:22 +02:00
|
|
|
namespace ircd
|
|
|
|
{
|
2018-01-12 12:00:23 +01:00
|
|
|
using int128_t = signed __int128;
|
|
|
|
using uint128_t = unsigned __int128;
|
|
|
|
|
|
|
|
using std::get;
|
|
|
|
using std::end;
|
|
|
|
using std::begin;
|
|
|
|
|
2017-08-28 23:51:22 +02:00
|
|
|
using std::nullptr_t;
|
2018-01-10 09:57:43 +01:00
|
|
|
using std::nothrow_t;
|
2018-01-12 12:00:23 +01:00
|
|
|
|
|
|
|
using std::const_pointer_cast;
|
2017-08-28 23:51:22 +02:00
|
|
|
using std::static_pointer_cast;
|
|
|
|
using std::dynamic_pointer_cast;
|
2018-01-12 12:00:23 +01:00
|
|
|
|
|
|
|
using std::chrono::hours;
|
|
|
|
using std::chrono::seconds;
|
|
|
|
using std::chrono::milliseconds;
|
|
|
|
using std::chrono::microseconds;
|
|
|
|
using std::chrono::nanoseconds;
|
|
|
|
using std::chrono::duration_cast;
|
|
|
|
using std::chrono::system_clock;
|
|
|
|
using std::chrono::steady_clock;
|
|
|
|
using std::chrono::high_resolution_clock;
|
|
|
|
using std::chrono::time_point;
|
|
|
|
|
2017-08-28 23:51:22 +02:00
|
|
|
using namespace std::literals::chrono_literals;
|
2018-01-12 12:00:23 +01:00
|
|
|
using namespace std::string_literals;
|
2017-10-25 18:34:11 +02:00
|
|
|
|
2018-01-12 12:00:23 +01:00
|
|
|
namespace ph = std::placeholders;
|
|
|
|
|
|
|
|
template<class... T> using ilist = std::initializer_list<T...>;
|
2017-08-28 23:51:22 +02:00
|
|
|
}
|
2017-08-23 23:40:33 +02:00
|
|
|
|
2017-08-28 23:51:22 +02:00
|
|
|
namespace ircd
|
|
|
|
{
|
2017-11-30 20:44:23 +01:00
|
|
|
enum class runlevel :int;
|
2017-11-30 19:26:13 +01:00
|
|
|
|
|
|
|
constexpr size_t BUFSIZE { 512 };
|
|
|
|
extern const enum runlevel &runlevel;
|
2018-03-02 09:35:02 +01:00
|
|
|
extern const std::string &config;
|
2018-03-17 02:59:28 +01:00
|
|
|
extern bool debugmode; ///< Toggle; available only ifdef RB_DEBUG
|
|
|
|
extern bool nolisten; ///< Init option to not bind listener socks.
|
2018-03-17 03:03:09 +01:00
|
|
|
extern bool noautomod; ///< Option to not load modules on init.
|
2018-05-31 21:47:37 +02:00
|
|
|
extern bool checkdb; ///< Perform checks on database opens
|
2017-08-28 23:51:22 +02:00
|
|
|
}
|
2016-08-23 04:33:36 +02:00
|
|
|
|
2017-09-09 19:38:47 +02:00
|
|
|
#include "string_view.h"
|
2017-11-16 02:21:26 +01:00
|
|
|
#include "vector_view.h"
|
|
|
|
#include "byte_view.h"
|
2018-03-13 05:17:09 +01:00
|
|
|
#include "buffer/buffer.h"
|
2018-01-29 17:17:02 +01:00
|
|
|
#include "allocator.h"
|
|
|
|
#include "util/util.h"
|
|
|
|
#include "exception.h"
|
2018-03-23 19:47:23 +01:00
|
|
|
#include "demangle.h"
|
2018-01-29 17:17:02 +01:00
|
|
|
#include "localee.h"
|
2017-10-12 02:40:49 +02:00
|
|
|
#include "date.h"
|
|
|
|
#include "logger.h"
|
2018-02-11 20:51:46 +01:00
|
|
|
#include "info.h"
|
2017-10-01 12:05:09 +02:00
|
|
|
#include "nacl.h"
|
2017-09-22 21:35:01 +02:00
|
|
|
#include "rand.h"
|
|
|
|
#include "hash.h"
|
2017-10-01 12:05:09 +02:00
|
|
|
#include "ed25519.h"
|
2016-09-08 19:49:45 +02:00
|
|
|
#include "color.h"
|
2017-10-02 06:14:34 +02:00
|
|
|
#include "lex_cast.h"
|
2018-01-20 14:37:30 +01:00
|
|
|
#include "base.h"
|
2017-10-02 06:14:34 +02:00
|
|
|
#include "stringops.h"
|
|
|
|
#include "tokens.h"
|
2017-09-11 05:27:54 +02:00
|
|
|
#include "iov.h"
|
2016-11-29 16:23:38 +01:00
|
|
|
#include "parse.h"
|
2016-08-16 11:12:01 +02:00
|
|
|
#include "rfc1459.h"
|
2017-10-19 10:32:53 +02:00
|
|
|
#include "json/json.h"
|
2017-12-23 01:48:15 +01:00
|
|
|
#include "openssl.h"
|
2016-11-29 16:23:38 +01:00
|
|
|
#include "http.h"
|
2016-09-17 04:48:25 +02:00
|
|
|
#include "fmt.h"
|
2018-02-19 07:50:37 +01:00
|
|
|
#include "magics.h"
|
2018-03-02 09:35:02 +01:00
|
|
|
#include "conf.h"
|
2018-01-10 22:16:34 +01:00
|
|
|
#include "fs/fs.h"
|
2017-09-30 08:04:41 +02:00
|
|
|
#include "ios.h"
|
2017-10-19 10:32:53 +02:00
|
|
|
#include "ctx/ctx.h"
|
|
|
|
#include "db/db.h"
|
2016-10-11 06:28:16 +02:00
|
|
|
#include "js.h"
|
2018-03-24 05:40:20 +01:00
|
|
|
#include "mods/mods.h"
|
2017-12-12 21:14:47 +01:00
|
|
|
#include "rfc3986.h"
|
2018-01-15 05:06:49 +01:00
|
|
|
#include "rfc1035.h"
|
2017-10-19 10:30:19 +02:00
|
|
|
#include "net/net.h"
|
2018-01-18 15:09:02 +01:00
|
|
|
#include "server/server.h"
|
2018-04-23 01:22:02 +02:00
|
|
|
#include "m/m.h"
|
2017-11-30 20:44:23 +01:00
|
|
|
#include "resource.h"
|
2018-02-18 00:44:53 +01:00
|
|
|
#include "client.h"
|