mirror of
https://github.com/EQEmu/Server.git
synced 2026-07-06 13:07:17 +00:00
Integrating protobuffers
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
|
||||
SET(service_sources
|
||||
test1_service.cpp
|
||||
)
|
||||
|
||||
SET(service_headers
|
||||
test1_service.h
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(test1_service ${service_sources} ${service_headers})
|
||||
|
||||
INSTALL(TARGETS test1_service RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
TARGET_LINK_LIBRARIES(test1_service ${SERVER_LIBS})
|
||||
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
@@ -0,0 +1,61 @@
|
||||
#include "test1_service.h"
|
||||
#include "../../common/eqemu_logsys.h"
|
||||
#include "../../common/eqemu_config.h"
|
||||
|
||||
EQ::Test1Service::Test1Service()
|
||||
: EQ::Service("Test1", 1, 1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
struct TestPacket
|
||||
{
|
||||
int64_t f1;
|
||||
int64_t f2;
|
||||
int64_t f3;
|
||||
int64_t f4;
|
||||
int64_t f5;
|
||||
int64_t f6;
|
||||
int64_t f7;
|
||||
char f8[4092];
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive &ar)
|
||||
{
|
||||
ar(f1, f2, f3, f4, f5, f6, f7, f8);
|
||||
}
|
||||
};
|
||||
|
||||
EQ::Test1Service::~Test1Service() {
|
||||
|
||||
}
|
||||
|
||||
void EQ::Test1Service::OnStart() {
|
||||
|
||||
}
|
||||
|
||||
void EQ::Test1Service::OnStop() {
|
||||
}
|
||||
|
||||
void EQ::Test1Service::OnHeartbeat(double time_since_last) {
|
||||
TestPacket p;
|
||||
p.f1 = 33;
|
||||
p.f2 = 43;
|
||||
p.f3 = 56;
|
||||
p.f4 = 90;
|
||||
|
||||
EQ::Net::DynamicPacket out;
|
||||
out.PutInt32(0, 1234);
|
||||
out.PutSerialize(4, p);
|
||||
|
||||
for (int i = 0; i < 250; ++i) {
|
||||
RouteMessage("Test2", "", out);
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Test1Service::OnRoutedMessage(const std::string& filter, const std::string& identifier, const std::string& id, const EQ::Net::Packet& payload)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
EQRegisterService(EQ::Test1Service);
|
||||
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../common/service.h"
|
||||
|
||||
namespace EQ
|
||||
{
|
||||
class Test1Service : public EQ::Service
|
||||
{
|
||||
public:
|
||||
Test1Service();
|
||||
virtual ~Test1Service();
|
||||
|
||||
protected:
|
||||
virtual void OnStart();
|
||||
virtual void OnStop();
|
||||
virtual void OnHeartbeat(double time_since_last);
|
||||
virtual void OnRoutedMessage(const std::string& filter, const std::string& identifier, const std::string& id, const EQ::Net::Packet& payload);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user