CatapultServer  v0.5.0.1 (Elephant)
PacketIo.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "Packet.h"
23 #include "PacketPayload.h"
24 #include "SocketOperationCode.h"
25 #include "catapult/functions.h"
26 #include <memory>
27 
28 namespace catapult { namespace ionet {
29 
31  class PacketIo {
32  public:
35 
36  public:
37  virtual ~PacketIo() = default;
38 
39  public:
42  virtual void read(const ReadCallback& callback) = 0;
43 
45  virtual void write(const PacketPayload& payload, const WriteCallback& callback) = 0;
46  };
47 }}
catapult::ionet::PacketIo::read
virtual void read(const ReadCallback &callback)=0
functions.h
Packet.h
catapult::ionet::PacketIo::WriteCallback
consumer< SocketOperationCode > WriteCallback
Definition: PacketIo.h:34
catapult::ionet::PacketIo
An interface for reading and writing packets.
Definition: PacketIo.h:31
catapult::ionet::PacketIo::ReadCallback
consumer< SocketOperationCode, const Packet * > ReadCallback
Definition: PacketIo.h:33
PacketPayload.h
catapult::ionet::PacketIo::write
virtual void write(const PacketPayload &payload, const WriteCallback &callback)=0
Writes payload and calls callback on completion.
catapult::ionet::PacketPayload
A packet payload that can be written.
Definition: PacketPayload.h:29
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::ionet::PacketIo::~PacketIo
virtual ~PacketIo()=default
catapult::consumer
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
SocketOperationCode.h