2018-01-22 12:32:15 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 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. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
|
|
|
|
|
|
|
#pragma once
|
2020-03-06 04:35:20 +01:00
|
|
|
#define HAVE_IRCD_M_FED_EVENT_H
|
2018-01-22 12:32:15 +01:00
|
|
|
|
2020-03-06 04:35:20 +01:00
|
|
|
namespace ircd::m::fed
|
2018-01-22 12:32:15 +01:00
|
|
|
{
|
|
|
|
struct event;
|
|
|
|
};
|
|
|
|
|
2020-03-06 04:35:20 +01:00
|
|
|
struct ircd::m::fed::event
|
2018-01-22 12:32:15 +01:00
|
|
|
:server::request
|
|
|
|
{
|
|
|
|
struct opts;
|
|
|
|
|
2019-08-30 03:27:08 +02:00
|
|
|
explicit operator json::object() const;
|
|
|
|
explicit operator m::event() const;
|
2018-01-22 12:32:15 +01:00
|
|
|
|
|
|
|
event(const m::event::id &, const mutable_buffer &, opts);
|
2018-03-06 13:28:17 +01:00
|
|
|
event() = default;
|
2018-01-22 12:32:15 +01:00
|
|
|
};
|
|
|
|
|
2020-03-06 04:35:20 +01:00
|
|
|
struct ircd::m::fed::event::opts
|
2018-01-22 12:32:15 +01:00
|
|
|
{
|
|
|
|
net::hostport remote;
|
|
|
|
m::request request;
|
|
|
|
server::out out;
|
|
|
|
server::in in;
|
|
|
|
const struct server::request::opts *sopts {nullptr};
|
2018-04-06 09:21:32 +02:00
|
|
|
bool dynamic {false};
|
2018-01-22 12:32:15 +01:00
|
|
|
};
|
2019-08-30 03:27:08 +02:00
|
|
|
|
|
|
|
inline
|
2020-03-06 04:35:20 +01:00
|
|
|
ircd::m::fed::event::operator
|
2019-08-30 03:27:08 +02:00
|
|
|
ircd::m::event()
|
|
|
|
const
|
|
|
|
{
|
|
|
|
return json::object{*this};
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
2020-03-06 04:35:20 +01:00
|
|
|
ircd::m::fed::event::operator
|
2019-08-30 03:27:08 +02:00
|
|
|
ircd::json::object()
|
|
|
|
const
|
|
|
|
{
|
|
|
|
const json::object object
|
|
|
|
{
|
|
|
|
in.content
|
|
|
|
};
|
|
|
|
|
|
|
|
const json::array pdus
|
|
|
|
{
|
|
|
|
object.at("pdus")
|
|
|
|
};
|
|
|
|
|
|
|
|
return pdus.at(0);
|
|
|
|
}
|