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-04-03 11:10:48 +02:00
|
|
|
/// The interface for when IRCd plays the role of client to other servers
|
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-11-09 06:18:39 +01:00
|
|
|
extern log::log log;
|
2018-04-03 11:10:48 +02:00
|
|
|
}
|
2018-01-14 03:03:04 +01:00
|
|
|
|
2018-04-03 11:10:48 +02:00
|
|
|
#include "tag.h"
|
|
|
|
#include "request.h"
|
|
|
|
#include "link.h"
|
|
|
|
#include "peer.h"
|
|
|
|
|
|
|
|
namespace ircd::server
|
|
|
|
{
|
2019-04-12 06:40:59 +02:00
|
|
|
// const utils
|
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-03-10 16:50:19 +01:00
|
|
|
size_t peer_unfinished();
|
2018-01-16 03:04:23 +01:00
|
|
|
|
2019-04-12 06:40:59 +02:00
|
|
|
// iteration of all requests.
|
|
|
|
bool for_each(const link &, const request::each_closure &);
|
|
|
|
bool for_each(const peer &, const request::each_closure &);
|
|
|
|
bool for_each(const request::each_closure &);
|
|
|
|
|
|
|
|
// const utils
|
2019-09-11 01:49:56 +02:00
|
|
|
string_view errmsg(const net::hostport &) noexcept;
|
|
|
|
bool exists(const net::hostport &) noexcept;
|
2018-03-05 15:59:10 +01:00
|
|
|
peer &find(const net::hostport &);
|
2018-09-18 01:47:36 +02:00
|
|
|
|
2019-04-12 06:40:59 +02:00
|
|
|
// mutable utils
|
|
|
|
bool errclear(const net::hostport &);
|
|
|
|
peer &get(const net::hostport &); // creates the peer if not found.
|
2018-01-14 03:03:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Subsystem initialization / destruction from ircd::main
|
|
|
|
///
|
|
|
|
struct ircd::server::init
|
|
|
|
{
|
2019-10-06 01:21:06 +02:00
|
|
|
// manual control panel
|
|
|
|
void interrupt();
|
|
|
|
void close();
|
|
|
|
void wait();
|
|
|
|
|
|
|
|
init() noexcept,
|
2018-01-14 03:03:04 +01:00
|
|
|
~init() noexcept;
|
|
|
|
};
|