2018-02-04 03:22:01 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
2018-01-14 03:03:04 +01:00
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
2018-02-04 03:22:01 +01:00
|
|
|
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
2018-01-14 03:03:04 +01:00
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
2018-02-04 03:22:01 +01:00
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
2018-01-14 03:03:04 +01:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_SERVER_H
|
|
|
|
|
2018-03-05 15:59:10 +01:00
|
|
|
/// The interface for when IRCd plays the role of client to other peers
|
2018-01-14 03:03:04 +01:00
|
|
|
///
|
|
|
|
namespace ircd::server
|
|
|
|
{
|
|
|
|
struct init;
|
|
|
|
struct link;
|
2018-03-05 15:59:10 +01:00
|
|
|
struct peer;
|
2018-01-15 09:11:32 +01:00
|
|
|
struct request;
|
|
|
|
struct tag;
|
2018-01-14 03:03:04 +01:00
|
|
|
|
|
|
|
IRCD_EXCEPTION(ircd::error, error);
|
2018-01-16 09:45:51 +01:00
|
|
|
IRCD_EXCEPTION(error, buffer_overrun);
|
2018-01-16 13:01:26 +01:00
|
|
|
IRCD_EXCEPTION(error, unavailable);
|
|
|
|
IRCD_EXCEPTION(error, canceled);
|
2018-01-14 03:03:04 +01:00
|
|
|
|
2018-03-08 18:27:32 +01:00
|
|
|
using error_code = boost::system::error_code;
|
|
|
|
|
2018-01-14 03:03:04 +01:00
|
|
|
extern ircd::log::log log;
|
2018-03-05 15:59:10 +01:00
|
|
|
extern std::map<string_view, std::shared_ptr<peer>> peers;
|
2018-01-14 03:03:04 +01:00
|
|
|
|
2018-01-16 05:04:45 +01:00
|
|
|
size_t tag_count();
|
|
|
|
size_t link_count();
|
2018-03-05 15:59:10 +01:00
|
|
|
size_t peer_count();
|
2018-01-16 03:04:23 +01:00
|
|
|
|
2018-03-03 07:37:52 +01:00
|
|
|
string_view errmsg(const net::hostport &);
|
2018-01-14 03:03:04 +01:00
|
|
|
bool exists(const net::hostport &);
|
2018-03-05 15:59:10 +01:00
|
|
|
peer &find(const net::hostport &);
|
|
|
|
peer &get(const net::hostport &);
|
2018-01-14 03:03:04 +01:00
|
|
|
}
|
|
|
|
|
2018-01-15 06:09:35 +01:00
|
|
|
#include "tag.h"
|
2018-01-15 09:11:32 +01:00
|
|
|
#include "request.h"
|
2018-01-14 03:03:04 +01:00
|
|
|
#include "link.h"
|
2018-03-05 15:59:10 +01:00
|
|
|
#include "peer.h"
|
2018-01-14 03:03:04 +01:00
|
|
|
|
|
|
|
/// Subsystem initialization / destruction from ircd::main
|
|
|
|
///
|
|
|
|
struct ircd::server::init
|
|
|
|
{
|
|
|
|
void interrupt();
|
2018-03-09 17:01:21 +01:00
|
|
|
void close();
|
|
|
|
void wait();
|
2018-01-14 03:03:04 +01:00
|
|
|
|
|
|
|
init();
|
|
|
|
~init() noexcept;
|
|
|
|
};
|