save:保存提交。

This commit is contained in:
taynpg 2024-12-11 17:00:59 +08:00
parent 684c670195
commit 506ea67d3e
4 changed files with 66 additions and 2 deletions

2
ofen

@ -1 +1 @@
Subproject commit 76c702cea8f4aa572d9c4319a5bb41d2ea969680
Subproject commit 79e086bae5509753eff4dce5669b3a7f5eac525f

View File

@ -11,4 +11,5 @@ set(SOURCES
util.h util.cpp
)
add_library(trans_util STATIC ${SOURCES})
target_link_libraries(trans_util PUBLIC Ofen)
target_include_directories(trans_util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -11,4 +11,42 @@ std::shared_ptr<spdlog::logger> get_logger(const std::string& mark, const std::s
logger->set_level(spdlog::level::info);
spdlog::register_logger(logger);
return logger;
}
}
CTransProtocal::CTransProtocal()
{
}
CTransProtocal::~CTransProtocal()
{
}
/*
transm TCP
header 2 char: 0xFF 0xFE
type 2 char:
len 4 char:
data xxxxx:
tail 2 char: 0xFF 0xFF
*/
CFrameBuffer* CTransProtocal::parse(CMutBuffer& buffer)
{
CFrameBuffer* result = nullptr;
char header[] = {0xFF, 0xFE};
char tail[] = {0xFF, 0xFF};
int find = buffer.index_of(header, sizeof(header));
if (find < 0) {
return result;
}
short int type = *(reinterpret_cast<const short int*>(buffer.get_data() + find));
return result;
}
CFrameBuffer::CFrameBuffer()
{
}
CFrameBuffer::~CFrameBuffer()
{
}

View File

@ -3,6 +3,31 @@
#include <spdlog/sinks/rotating_file_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
#include "of_util.h"
using namespace ofen;
std::shared_ptr<spdlog::logger> get_logger(const std::string& mark, const std::string& log_file);
class CFrameBuffer
{
public:
CFrameBuffer();
~CFrameBuffer();
};
/*
transm TCP
header 2 char: 0xFF 0xFE
type 2 char:
len 4 char:
data xxxxx:
tail 2 char: 0xFF 0xFF
*/
class CTransProtocal
{
public:
CTransProtocal();
~CTransProtocal();
public:
CFrameBuffer* parse(CMutBuffer& buffer);
};
#endif