30 lines
536 B
C
Raw Normal View History

2014-09-17 16:43:05 +03:00
#include "interface/event.h"
namespace network
{
struct PeerInfo
{
typedef size_t Id;
Id id = 0;
ss_ address;
};
struct Packet: public interface::Event::Private
{
typedef size_t Type;
Type type;
ss_ data;
Packet(const Type &type, const ss_ &data): type(type), data(data){}
};
inline void send(interface::Server *server,
2014-09-17 18:27:30 +03:00
const Packet::Type &type, const ss_ &data)
2014-09-17 16:43:05 +03:00
{
interface::Event event("network:send");
event.p.reset(new network::Packet(type, data));
server->emit_event(event);
}
}