46 lines
984 B
C++
46 lines
984 B
C++
#pragma once
|
|
#include "of_util.h"
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#include <spdlog/sinks/rotating_file_sink.h>
|
|
#include <spdlog/sinks/stdout_color_sinks.h>
|
|
#include <spdlog/spdlog.h>
|
|
|
|
constexpr auto gGetTaskList = "GetTaskList";
|
|
|
|
using namespace ofen;
|
|
std::shared_ptr<spdlog::logger> get_logger(const std::string& mark, const std::string& log_file);
|
|
class CFrameBuffer
|
|
{
|
|
public:
|
|
CFrameBuffer();
|
|
~CFrameBuffer();
|
|
public:
|
|
std::string id_{};
|
|
|
|
public:
|
|
int16_t type_{};
|
|
char* data_{};
|
|
int len_{};
|
|
char mark_{};
|
|
};
|
|
using ExFun_t = std::function<void(CFrameBuffer* buf)>;
|
|
/*
|
|
【 transm TCP 数据协议 】
|
|
header 2 char: 0xFF 0xFE
|
|
type 2 char:
|
|
mark 1 char:
|
|
len 4 char:
|
|
data xxxxx:
|
|
tail 2 char: 0xFF 0xFF
|
|
*/
|
|
class CTransProtocal
|
|
{
|
|
public:
|
|
CTransProtocal();
|
|
~CTransProtocal();
|
|
|
|
public:
|
|
static CFrameBuffer* parse(CMutBuffer& buffer);
|
|
static bool pack(CFrameBuffer* buf, char** out_buf, int& len);
|
|
}; |