CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
29 namespace catapult {
namespace ionet {
42 const std::string&
host()
const;
uint32_t m_maxPacketDataSize
Definition: PacketHandlers.h:99
std::string m_host
Definition: PacketSocket.cpp:477
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
const std::string & host() const
Gets the host associated with the client.
Definition: PacketHandlers.cpp:38
A packet header with a data payload.
Definition: Packet.h:32
size_t m_maxPacketDataSize
Definition: PacketSocket.cpp:243
def warning(*args)
Definition: colorPrint.py:10
const Key & m_key
Definition: PacketHandlers.h:55
bool hasResponse() const
Returns true if a response has been associated with this context.
Definition: PacketHandlers.cpp:42
constexpr std::underlying_type_t< TEnum > to_underlying_type(TEnum value)
Converts a strongly typed enumeration value to its underlying integral value.
Definition: Casting.h:37
const Key & key() const
Gets the public key associated with the client.
Definition: PacketHandlers.cpp:34
bool process(const Packet &packet, ContextType &context) const
Definition: PacketHandlers.cpp:90
ServerPacketHandlers(uint32_t maxPacketDataSize=std::numeric_limits< uint32_t >::max())
Creates packet handlers with a max packet data size (maxPacketDataSize).
Definition: PacketHandlers.cpp:65
void registerHandler(PacketType type, const PacketHandler &handler)
Registers a handler for the specified packet type.
Definition: PacketHandlers.cpp:100
PacketType
An enumeration of known packet types.
Definition: PacketType.h:171
#define CATAPULT_THROW_RUNTIME_ERROR_1(MESSAGE, PARAM1)
Macro used to throw a catapult runtime error with a single parameter.
Definition: exceptions.h:171
const PacketPayload & response() const
Gets the response associated with this context.
Definition: PacketHandlers.cpp:46
const std::string & m_host
Definition: PacketHandlers.h:56
consumer< const Packet &, ContextType & > PacketHandler
Packet handler function.
Definition: PacketHandlers.h:68
ServerPacketHandlerContext(const Key &key, const std::string &host)
Creates a context around key and \ host.
Definition: PacketHandlers.cpp:28
bool m_hasResponse
Definition: PacketHandlers.h:57
A class that can be moved but not copied.
Definition: NonCopyable.h:43
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
A packet payload that can be written.
Definition: PacketPayload.h:29
Definition: AddressExtractionExtension.cpp:28
PacketPayload m_payload
Definition: PacketHandlers.h:58
std::vector< PacketHandler > m_handlers
Definition: PacketHandlers.h:100
const PacketHandler * findHandler(const Packet &packet) const
Definition: PacketHandlers.cpp:111
uint32_t maxPacketDataSize() const
Gets the max packet data size.
Definition: PacketHandlers.cpp:76
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
size_t size() const
Gets the number of registered handlers.
Definition: PacketHandlers.cpp:68
A collection of packet handlers where there is at most one handler per packet type.
Definition: PacketHandlers.h:62
bool canProcess(PacketType type) const
Determines if type can be processed by a registered handler.
Definition: PacketHandlers.cpp:80
Context passed to a server packet handler function.
Definition: PacketHandlers.h:32