0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 18:18:56 +02:00

Preliminary new client. Reorg/renames for ircd::client struct symbol.

This commit is contained in:
Jason Volk 2016-09-10 23:05:38 -07:00
parent a4e810d1c8
commit 26a3cd8441
15 changed files with 393 additions and 283 deletions

View file

@ -28,30 +28,28 @@
#define HAVE_IRCD_CLIENT_H
#ifdef __cplusplus
namespace ircd {
namespace client {
namespace ircd {
enum class state
{
CONNECTING,
};
struct sock;
struct client;
using clist = std::list<std::shared_ptr<client>>;
enum flags
{
// Client socket addressing
using ip_port_pair = std::pair<std::string, uint16_t>;
using ip_port = IRCD_WEAK_T(ip_port_pair);
ip_port remote_address(const client &);
ip_port local_address(const client &);
std::string string(const ip_port &);
};
std::shared_ptr<client> shared_from(client &);
std::weak_ptr<client> weak_from(client &);
struct client
{
std::unique_ptr<struct sock> sock;
// Makes a client
std::shared_ptr<client> add_client();
std::shared_ptr<client> add_client(std::unique_ptr<struct sock>);
client(boost::asio::io_service *const &ios = ircd::ios);
client(const client &) = delete;
client &operator=(const client &) = delete;
~client();
};
const clist &clients();
} // namespace client
} // namespace ircd
#endif // __cplusplus

View file

@ -1,52 +0,0 @@
/*
* Copyright (C) 2016 Charybdis Development Team
* Copyright (C) 2016 Jason Volk <jason@zemos.net>
*
* 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.
*/
#pragma once
#define HAVE_IRCD_CLIENT_SERV_H
#ifdef __cplusplus
namespace ircd {
namespace client {
namespace serv
{
using list = std::list<client *>;
using user::user;
struct serv;
list &users(serv &);
list &servers(serv &);
// who activated this connection
std::shared_ptr<struct user> &user(serv &);
std::string &by(serv &);
// capabilities bit-field
int &caps(serv &);
std::string &fullcaps(serv &);
using entry = cache::serv::entry;
const std::shared_ptr<entry> &nameinfo(const serv &);
std::shared_ptr<entry> &nameinfo(serv &);
}
} // namespace client
} // namespace ircd
#endif // __cplusplus

View file

@ -1,61 +0,0 @@
/*
* Copyright (C) 2016 Charybdis Development Team
* Copyright (C) 2016 Jason Volk <jason@zemos.net>
*
* 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.
*/
#pragma once
#define HAVE_IRCD_CLIENT_SOCK_H
#ifdef __cplusplus
#include <boost/asio.hpp>
#include <boost/asio/steady_timer.hpp>
namespace ircd {
namespace client {
namespace ip = boost::asio::ip;
using boost::asio::steady_timer;
struct sock
{
ip::tcp::socket sd;
steady_timer timer;
operator const ip::tcp::socket &() const;
operator ip::tcp::socket &();
sock(boost::asio::io_service *const &ios = ircd::ios);
};
inline
sock::operator ip::tcp::socket &()
{
return sd;
}
inline
sock::operator const ip::tcp::socket &()
const
{
return sd;
}
} // namespace client
} // namespace ircd
#endif // __cplusplus

View file

@ -1,49 +0,0 @@
/*
* Copyright (C) 2016 Charybdis Development Team
* Copyright (C) 2016 Jason Volk <jason@zemos.net>
*
* 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.
*/
#pragma once
#define HAVE_IRCD_CLIENT_USER_H
#ifdef __cplusplus
namespace ircd {
namespace client {
namespace user
{
using invites_t = std::set<chan::chan *>;
using chans_t = std::map<chan::chan *, chan::membership *>;
struct user;
const std::string &away(const user &);
std::string &away(user &);
const std::string &suser(const user &);
std::string &suser(user &);
const invites_t &invites(const user &);
invites_t &invites(user &);
const chans_t &chans(const user &);
chans_t &chans(user &);
}
} // namespace client
} // namespace ircd
#endif // __cplusplus

View file

@ -26,8 +26,6 @@
namespace ircd {
namespace cmds {
using client::client;
IRCD_EXCEPTION(ircd::error, error)
IRCD_EXCEPTION(error, not_found) // Really should be throwing err::421 directly but..
IRCD_EXCEPTION(error, already_exists)

View file

@ -54,19 +54,19 @@ struct top
virtual void assign(item &item, std::string val) const;
// Override to provide operations on singleton blocks
virtual const uint8_t *get(client::client &, const std::string &key) const;
virtual void set(client::client &, std::string key, std::string val);
virtual void del(client::client &, const std::string &key);
virtual void enu(client::client &, const std::string &key);
virtual const uint8_t *get(client &, const std::string &key) const;
virtual void set(client &, std::string key, std::string val);
virtual void del(client &, const std::string &key);
virtual void enu(client &, const std::string &key);
// Override to provide operations on named blocks
virtual const uint8_t *get(client::client &, const std::string &label, const std::string &key) const;
virtual void set(client::client &, std::string label, std::string key, std::string val);
virtual void del(client::client &, const std::string &label, const std::string &key);
virtual void enu(client::client &, const std::string &label, const std::string &key);
virtual const uint8_t *get(client &, const std::string &label, const std::string &key) const;
virtual void set(client &, std::string label, std::string key, std::string val);
virtual void del(client &, const std::string &label, const std::string &key);
virtual void enu(client &, const std::string &label, const std::string &key);
// Override to handle the raw line
virtual void operator()(client::client &, line) override;
virtual void operator()(client &, line) override;
top(const char &letter, const std::string &name, const items & = {});
~top() noexcept;
@ -86,8 +86,8 @@ using type_handler = std::function<void (uint8_t *const &ptr, std::string text)>
extern std::map<std::type_index, type_handler> type_handlers;
template<class T> std::type_index make_index();
template<class T = std::string> const T &get(client::client &, const char &, const std::string &label, const std::string &key);
template<class T = std::string> const T &get(client::client &, const char &, const std::string &key);
template<class T = std::string> const T &get(client &, const char &, const std::string &label, const std::string &key);
template<class T = std::string> const T &get(client &, const char &, const std::string &key);
void execute();
void parse(const std::string &path);
@ -95,7 +95,7 @@ void parse(const std::string &path);
template<class T>
const T &
get(client::client &client,
get(client &client,
const char &letter,
const std::string &key)
{
@ -109,7 +109,7 @@ get(client::client &client,
template<class T>
const T &
get(client::client &client,
get(client &client,
const char &letter,
const std::string &label,
const std::string &key)
@ -432,17 +432,17 @@ void replace_old_ban(struct ConfItem *);
void read_conf_files(bool cold);
int attach_conf(client::client *, struct ConfItem *);
int check_client(client::client *client_p, client::client *source_p, const char *);
int attach_conf(client *, struct ConfItem *);
int check_client(client *client_p, client *source_p, const char *);
int detach_conf(client::client *);
int detach_conf(client *);
struct ConfItem *find_tkline(const char *, const char *, struct sockaddr *);
char *show_iline_prefix(client::client *, struct ConfItem *, char *);
char *show_iline_prefix(client *, struct ConfItem *, char *);
void get_printable_conf(struct ConfItem *,
char **, char **, const char **, char **, int *, char **);
char *get_user_ban_reason(struct ConfItem *aconf);
void get_printable_kline(client::client *, struct ConfItem *,
void get_printable_kline(client *, struct ConfItem *,
char **, char **, char **, char **);
int conf_yy_fatal_error(const char *);
@ -451,8 +451,8 @@ int conf_fgets(char *, int, FILE *);
int valid_wild_card(const char *, const char *);
void add_temp_kline(struct ConfItem *);
void add_temp_dline(struct ConfItem *);
void report_temp_klines(client::client *);
void show_temp_klines(client::client *, rb_dlink_list *);
void report_temp_klines(client *);
void show_temp_klines(client *, rb_dlink_list *);
bool rehash(bool);
void rehash_bans(void);
@ -464,7 +464,7 @@ void conf_add_class(struct ConfItem *, int);
void conf_add_d_conf(struct ConfItem *);
void flush_expired_ips(void *);
char *get_oper_name(client::client *client_p);
char *get_oper_name(client *client_p);
} // namespace conf
} // namespace ircd

View file

@ -35,7 +35,7 @@
namespace ircd {
extern bool debugmode;
extern client::client *me;
extern std::shared_ptr<client> me;
// Set callback for when IRCd's main context has completed.
using main_exit_cb = std::function<void ()>;
@ -80,15 +80,15 @@ struct Counter
unsigned long totalrestartcount; /* Total client count ever */
};
extern struct SetOptions GlobalSetOptions; /* defined in ircd.c */
/*
extern struct SetOptions GlobalSetOptions;
extern volatile sig_atomic_t dorehash;
extern volatile sig_atomic_t dorehashbans;
extern volatile sig_atomic_t doremotd;
extern bool kline_queued;
extern bool server_state_foreground;
extern bool opers_see_all_users; /* sno_farconnect.so loaded, operspy without
accountability, etc */
extern bool opers_see_all_users; // sno_farconnect.so loaded, operspy without accountability, etc
extern rb_dlink_list global_client_list;
extern client::client *local[];
@ -120,6 +120,7 @@ extern int maxconnections;
void restart(const char *) __attribute__((noreturn));
void ircd_shutdown() __attribute__((noreturn));
void server_reboot(void) __attribute__((noreturn));
*/
} // namespace ircd
#endif // __cplusplus

105
include/ircd/sock.h Normal file
View file

@ -0,0 +1,105 @@
/*
* Copyright (C) 2016 Charybdis Development Team
* Copyright (C) 2016 Jason Volk <jason@zemos.net>
*
* 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.
*/
#pragma once
#define HAVE_IRCD_CLIENT_SOCK_H
#ifdef __cplusplus
#include <boost/asio.hpp>
#include <boost/asio/steady_timer.hpp>
#include "bufs.h"
namespace ircd {
namespace ip = boost::asio::ip;
using boost::system::error_code;
using boost::asio::steady_timer;
struct sock
{
ip::tcp::socket sd;
steady_timer timer;
std::exception_ptr eptr;
std::array<char, BUFSIZE> rbuf alignas(16);
uint16_t checked;
uint16_t length;
tape reel;
operator const ip::tcp::socket &() const { return sd; }
operator ip::tcp::socket &() { return sd; }
ip::tcp::endpoint remote() const { return sd.remote_endpoint(); }
ip::tcp::endpoint local() const { return sd.local_endpoint(); }
bool terminated() const;
uint16_t remaining() const;
size_t handle_pck(const error_code &, const size_t) noexcept;
sock(boost::asio::io_service *const &ios = ircd::ios);
};
ip::address remote_address(const sock &);
std::string remote_ip(const sock &);
uint16_t remote_port(const sock &);
ip::address local_address(const sock &);
std::string local_ip(const sock &);
uint16_t local_port(const sock &);
inline uint16_t
local_port(const sock &sock)
{
return sock.local().port();
}
inline std::string
local_ip(const sock &sock)
{
return local_address(sock).to_string();
}
inline ip::address
local_address(const sock &sock)
{
return sock.local().address();
}
inline uint16_t
remote_port(const sock &sock)
{
return sock.remote().port();
}
inline std::string
remote_ip(const sock &sock)
{
return remote_address(sock).to_string();
}
inline ip::address
remote_address(const sock &sock)
{
return sock.remote().address();
}
static_assert(BUFSIZE == 512, "");
} // namespace ircd
#endif // __cplusplus

View file

@ -55,13 +55,7 @@ namespace ircd
{
extern boost::asio::io_service *ios;
namespace client
{
struct client;
struct LocalUser;
struct PreClient;
struct ListClient;
}
struct client;
namespace chan
{
@ -84,6 +78,7 @@ namespace ircd
#include "util_timer.h"
#include "defaults.h"
#include "exception.h"
#include "ircd_getopt.h"
#include "numeric.h"
#include "color.h"
#include "messages.h"
@ -98,23 +93,34 @@ namespace ircd
#include "ctx.h"
#include "ctx_dock.h"
#include "line.h"
#include "tape.h"
#include "cmds.h"
#include "u_id.h"
#include "client.h"
#include "logger.h"
#include "newconf.h"
#include "conf.h"
#include "modules.h"
#include "info.h"
#include "stringops.h"
/*
#include "cache.h"
#include "whowas.h"
#include "tgchange.h"
#include "msgbuf.h"
#include "line.h"
#include "tape.h"
#include "cmds.h"
#include "client.h"
#include "mask.h"
#include "chmode.h"
#include "channel.h"
#include "logger.h"
#include "newconf.h"
#include "conf.h"
#include "authproc.h"
#include "bandbi.h"
#include "capability.h"
@ -123,10 +129,7 @@ namespace ircd
#include "dns.h"
#include "hash.h"
#include "hook.h"
#include "ircd_getopt.h"
#include "listener.h"
#include "info.h"
#include "modules.h"
#include "monitor.h"
#include "operhash.h"
#include "packet.h"
@ -142,4 +145,4 @@ namespace ircd
#include "supported.h"
#include "s_user.h"
#include "wsproc.h"
#include "stringops.h"
*/

View file

@ -26,47 +26,213 @@
*/
#include <boost/asio.hpp>
#include <ircd/client_sock.h>
#include <ircd/sock.h>
namespace ircd
{
struct client
:std::enable_shared_from_this<client>
{
clist::const_iterator clit;
std::unique_ptr<struct sock> sock;
client();
client(const client &) = delete;
client &operator=(const client &) = delete;
~client() noexcept;
};
clist clients_list;
bool handle_error(client &, const error_code &);
void handle_recv(client &, const error_code &, const size_t);
void set_recv(client &);
}
using namespace ircd;
namespace ircd {
namespace client {
} // namespace client
} // namespace ircd
///////////////////////////////////////////////////////////////////////////////
//
// client.h
//
client::client::client(boost::asio::io_service *const &ios)
:sock
{
std::make_unique<struct sock>(ios)
}
client::client()
{
}
client::client::~client()
client::~client()
noexcept
{
}
const clist &
ircd::clients()
{
return clients_list;
}
std::shared_ptr<client>
ircd::add_client(std::unique_ptr<struct sock> sock)
{
auto client(add_client());
client->sock = std::move(sock);
log::info("New client[%s] on local[%s]",
string(remote_address(*client)).c_str(),
string(local_address(*client)).c_str());
set_recv(*client);
return client;
}
std::shared_ptr<client>
ircd::add_client()
{
auto client(std::make_shared<client>());
client->clit = clients_list.emplace(end(clients_list), client);
return client;
}
std::weak_ptr<client>
ircd::weak_from(client &client)
{
return shared_from(client);
}
std::shared_ptr<client>
ircd::shared_from(client &client)
{
return client.shared_from_this();
}
void
ircd::set_recv(client &client)
{
using boost::asio::async_read;
auto &sock(*client.sock);
sock.checked = 0;
sock.length = 0;
async_read(sock.sd, mutable_buffers_1(sock.rbuf.data(), sock.rbuf.size()),
std::bind(&sock::handle_pck, &sock, ph::_1, ph::_2),
std::bind(&ircd::handle_recv, std::ref(client), ph::_1, ph::_2));
}
void
ircd::handle_recv(client &client,
const error_code &ec,
const size_t bytes)
try
{
if(!handle_error(client, ec))
return;
auto &reel(client.sock->reel);
for(const auto &line : reel)
std::cout << line << std::endl;
reel.clear();
set_recv(client);
}
catch(const rfc1459::syntax_error &e)
{
std::cerr << e.what() << std::endl;
}
catch(const std::exception &e)
{
std::cerr << "errored: " << e.what() << std::endl;
}
bool
ircd::handle_error(client &client,
const error_code &ec)
{
using namespace boost::system::errc;
using boost::asio::error::eof;
if(client.sock && client.sock->eptr)
std::rethrow_exception(client.sock->eptr);
switch(ec.value())
{
case success: return true;
default: throw boost::system::system_error(ec);
}
}
std::string
ircd::string(const ip_port &pair)
{
std::string ret(64, '\0');
ret.resize(snprintf(&ret.front(), ret.size(), "%s:%u",
pair.first.c_str(),
pair.second));
return ret;
}
ircd::ip_port
ircd::local_address(const client &client)
{
if(!client.sock)
return { "0.0.0.0"s, 0 };
return { local_ip(*client.sock), local_port(*client.sock) };
}
ircd::ip_port
ircd::remote_address(const client &client)
{
if(!client.sock)
return { "0.0.0.0"s, 0 };
return { remote_ip(*client.sock), remote_port(*client.sock) };
}
///////////////////////////////////////////////////////////////////////////////
//
// client_sock.h
//
client::sock::sock(boost::asio::io_service *const &ios)
:sd
{
*ios
}
,timer
{
*ios
}
ircd::sock::sock(boost::asio::io_service *const &ios)
:sd{*ios}
,timer{*ios}
,checked{0}
,length{0}
{
}
size_t
ircd::sock::handle_pck(const error_code &ec,
const size_t bytes)
noexcept try
{
if(ec)
return 0;
length += bytes;
if(reel.append(rbuf.data(), length))
return 0;
if(terminated())
throw rfc1459::syntax_error("invalid syntax"); //TODO: eps + ERR_
checked = length;
return remaining()?: throw rfc1459::syntax_error("message length exceeded"); //TODO: ERR_
}
catch(...)
{
eptr = std::current_exception();
return 0;
}
uint16_t
ircd::sock::remaining()
const
{
return sizeof(rbuf) - length;
}
bool
ircd::sock::terminated()
const
{
const auto b(std::next(rbuf.rbegin(), remaining()));
const auto e(std::next(rbuf.rbegin(), sizeof(rbuf) - checked));
return std::find(b, e, '\n') != e;
}

View file

@ -135,7 +135,7 @@ noexcept
}
void
conf::top::operator()(client::client &client,
conf::top::operator()(client &client,
line line)
try
{
@ -156,7 +156,7 @@ catch(const boost::bad_lexical_cast &e)
__attribute__((noreturn))
void
conf::top::enu(client::client &client,
conf::top::enu(client &client,
const std::string &label,
const std::string &key)
{
@ -165,7 +165,7 @@ conf::top::enu(client::client &client,
__attribute__((noreturn))
void
conf::top::del(client::client &client,
conf::top::del(client &client,
const std::string &label,
const std::string &key)
{
@ -173,7 +173,7 @@ conf::top::del(client::client &client,
}
void
conf::top::set(client::client &client,
conf::top::set(client &client,
std::string label,
std::string key,
std::string val)
@ -183,7 +183,7 @@ conf::top::set(client::client &client,
__attribute__((noreturn))
const uint8_t *
conf::top::get(client::client &client,
conf::top::get(client &client,
const std::string &label,
const std::string &key)
const
@ -192,14 +192,14 @@ const
}
void
conf::top::enu(client::client &client,
conf::top::enu(client &client,
const std::string &key)
{
}
void
conf::top::del(client::client &client,
conf::top::del(client &client,
const std::string &key)
{
if(!map.erase(key))
@ -209,7 +209,7 @@ conf::top::del(client::client &client,
}
void
conf::top::set(client::client &client,
conf::top::set(client &client,
std::string key,
std::string val)
try
@ -230,7 +230,7 @@ catch(const boost::bad_lexical_cast &e)
}
const uint8_t *
conf::top::get(client::client &client,
conf::top::get(client &client,
const std::string &key)
const
try

View file

@ -31,7 +31,7 @@ namespace ircd
bool debugmode; // set by command line
boost::asio::io_service *ios; // user's io service
main_exit_cb main_exit_func; // Called when main context exits
client::client *me; // That's me
std::shared_ptr<client> me; // That's me
void seed_random();
void init_system();
@ -81,8 +81,7 @@ noexcept try
const scope main_exit(&main_exiting);
log::debug("IRCd entered main context.");
// Establish me here after we have an ios
me = new client::client;
ircd::me = add_client();
log::info("executing configuration");
conf::execute();
@ -149,7 +148,6 @@ ircd::main_exiting()
noexcept try
{
mods::unload();
delete me;
if(main_exit_func)
{
@ -252,9 +250,10 @@ ircd::seed_random()
namespace ircd {
// namespace ircd {
/* /quote set variables */
/*
struct SetOptions GlobalSetOptions;
struct Counter Count;
@ -266,6 +265,7 @@ int maxconnections;
//struct LocalUser meLocalUser; // That's also part of me
rb_dlink_list global_client_list;
*/
/* unknown/client pointer lists */
rb_dlink_list unknown_list; /* unknown clients ON this server only */
@ -275,6 +275,7 @@ rb_dlink_list global_serv_list; /* global servers on the network */
rb_dlink_list local_oper_list; /* our opers, duplicated in lclient_list */
rb_dlink_list oper_list; /* network opers */
/*
char * const *myargv;
volatile sig_atomic_t dorehash = false;
volatile sig_atomic_t dorehashbans = false;
@ -295,8 +296,9 @@ int splitchecking;
int split_users;
int split_servers;
int eob_count;
*/
}
// }
/*
static void

View file

@ -22,9 +22,8 @@
#include <boost/asio.hpp>
#include <ircd/ctx_ctx.h>
#include <ircd/lex_cast.h>
#include <ircd/client_sock.h>
#include <ircd/sock.h>
namespace ip = boost::asio::ip;
using namespace ircd;
const size_t STACK_SIZE
@ -121,9 +120,9 @@ bool
listener::accept()
try
{
auto client(std::make_unique<client::client>());
acceptor.async_accept(client->sock->sd, yield(continuation()));
auto sock(std::make_unique<sock>());
acceptor.async_accept(sock->sd, yield(continuation()));
add_client(std::move(sock));
return true;
}
catch(const boost::system::system_error &e)
@ -155,8 +154,8 @@ struct P
void set_host(listener &, std::string);
void set_port(listener &, std::string);
void set(client::client &, std::string label, std::string key, std::string val) override;
void del(client::client &, const std::string &label, const std::string &key) override;
void set(client &, std::string label, std::string key, std::string val) override;
void del(client &, const std::string &label, const std::string &key) override;
using conf::top::top;
}
@ -172,7 +171,7 @@ mapi::header IRCD_MODULE
};
void
P::del(client::client &,
P::del(client &,
const std::string &label,
const std::string &key)
{
@ -180,7 +179,7 @@ P::del(client::client &,
}
void
P::set(client::client &,
P::set(client &,
std::string label,
std::string key,
std::string val)

View file

@ -29,8 +29,8 @@ mapi::header IRCD_MODULE
struct L
:conf::top
{
void set(client::client &, std::string label, std::string key, std::string val) override;
void del(client::client &, const std::string &label, const std::string &key) override;
void set(client &, std::string label, std::string key, std::string val) override;
void del(client &, const std::string &label, const std::string &key) override;
using conf::top::top;
}
@ -41,7 +41,7 @@ static L
};
void
L::set(client::client &client,
L::set(client &client,
std::string label,
std::string key,
std::string val)
@ -59,7 +59,7 @@ catch(const std::exception &e)
}
void
L::del(client::client &client,
L::del(client &client,
const std::string &label,
const std::string &key)
try

View file

@ -28,7 +28,7 @@ using namespace ircd;
struct m_host
:cmd
{
void operator()(client::client &, line) override;
void operator()(client &, line) override;
using cmd::cmd;
}
@ -56,7 +56,7 @@ mapi::header IRCD_MODULE
};
void
m_host::operator()(client::client &client,
m_host::operator()(client &client,
line line)
try
{