37 lines
677 B
C++
37 lines
677 B
C++
#ifndef COMMUNICATE_H
|
|
#define COMMUNICATE_H
|
|
|
|
#include <Util.h>
|
|
#include <cstdint>
|
|
|
|
enum FrameBufferType : uint16_t {
|
|
FRAME_TYPE_MSG_FILEDATA,
|
|
FRAME_TYPE_INFO_COMMUNICATE,
|
|
FRAME_TYPE_INFO_CLIENT,
|
|
FRAME_TYPE_INFO_DIRFILE,
|
|
FRAME_TYPE_MSG_YOURID
|
|
};
|
|
|
|
struct FrameBuffer {
|
|
FrameBuffer();
|
|
~FrameBuffer();
|
|
|
|
int len{};
|
|
char* dataMut;
|
|
std::string fid;
|
|
std::string tid;
|
|
const char* dataConst;
|
|
FrameBufferType dataType{};
|
|
};
|
|
|
|
class Communicate
|
|
{
|
|
public:
|
|
Communicate();
|
|
|
|
public:
|
|
static FrameBuffer* ParseBuffer(MutBuffer& buffer);
|
|
static bool PackBuffer(FrameBuffer* frame, char** buf, int& len);
|
|
};
|
|
|
|
#endif // COMMUNICATE_H
|