protocol: Add source files to CMakeLists.txt

also fix error in Packet.h
This commit is contained in:
Joshua Scott 2018-04-03 16:43:00 +01:00
parent bfe56f194a
commit 85361f0e40
12 changed files with 146 additions and 1 deletions

View File

@ -20,6 +20,7 @@ target_include_directories(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} RapidXML)
add_subdirectory("src/dml")
add_subdirectory("src/protocol")
option(KI_BUILD_EXAMPLES "Determines whether to build examples." ON)
if (KI_BUILD_EXAMPLES)

View File

@ -29,7 +29,8 @@ namespace protocol
std::ostringstream oss;
data.write_to(oss);
m_payload = std::vector<char>(oss.str().c_str(), data.get_size());
std::string data_string = oss.str();
m_payload.assign(data_string.begin(), data_string.end());
}
template <typename DataT>

View File

@ -0,0 +1,12 @@
target_sources(${PROJECT_NAME}
PRIVATE
${PROJECT_SOURCE_DIR}/src/protocol/Packet.cpp
${PROJECT_SOURCE_DIR}/src/protocol/control/ClientHello.cpp
${PROJECT_SOURCE_DIR}/src/protocol/control/ServerHello.cpp
${PROJECT_SOURCE_DIR}/src/protocol/control/Ping.cpp
${PROJECT_SOURCE_DIR}/src/protocol/dml/Message.cpp
${PROJECT_SOURCE_DIR}/src/protocol/dml/MessageBuilder.cpp
${PROJECT_SOURCE_DIR}/src/protocol/dml/MessageManager.cpp
${PROJECT_SOURCE_DIR}/src/protocol/dml/MessageModule.cpp
${PROJECT_SOURCE_DIR}/src/protocol/dml/MessageTemplate.cpp
)

9
src/protocol/Packet.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "ki/protocol/Packet.h"
namespace ki
{
namespace protocol
{
}
}

View File

@ -0,0 +1,12 @@
#include "ki/protocol/control/ClientHello.h"
namespace ki
{
namespace protocol
{
namespace control
{
}
}
}

View File

@ -0,0 +1,12 @@
#include "ki/protocol/control/Ping.h"
namespace ki
{
namespace protocol
{
namespace control
{
}
}
}

View File

@ -0,0 +1,12 @@
#include "ki/protocol/control/ServerHello.h"
namespace ki
{
namespace protocol
{
namespace control
{
}
}
}

View File

@ -0,0 +1,12 @@
#include "ki/protocol/dml/Message.h"
namespace ki
{
namespace protocol
{
namespace dml
{
}
}
}

View File

@ -0,0 +1,38 @@
#include "ki/protocol/dml/MessageBuilder.h"
namespace ki
{
namespace protocol
{
namespace dml
{
MessageBuilder::MessageBuilder(uint8_t service_id, uint8_t type)
{
m_message = new Message(service_id, type);
}
MessageBuilder &MessageBuilder::set_service_id(uint8_t service_id)
{
m_message->set_service_id(service_id);
return *this;
}
MessageBuilder &MessageBuilder::set_message_type(uint8_t type)
{
m_message->set_type(type);
return *this;
}
MessageBuilder &MessageBuilder::use_template_record(const ki::dml::Record& record)
{
m_message->set_record(record);
return *this;
}
Message *MessageBuilder::get_message() const
{
return m_message;
}
}
}
}

View File

@ -0,0 +1,12 @@
#include "ki/protocol/dml/MessageManager.h"
namespace ki
{
namespace protocol
{
namespace dml
{
}
}
}

View File

@ -0,0 +1,12 @@
#include "ki/protocol/dml/MessageModule.h"
namespace ki
{
namespace protocol
{
namespace dml
{
}
}
}

View File

@ -0,0 +1,12 @@
#include "ki/protocol/dml/MessageTemplate.h"
namespace ki
{
namespace protocol
{
namespace dml
{
}
}
}