1
This commit is contained in:
parent
e04f8dd6ae
commit
558c4343d3
@ -254,4 +254,23 @@ namespace f8
|
||||
return sizeof(WSProxyPackHead_S) + packlen;
|
||||
}
|
||||
|
||||
MsgHdr* MsgHdr::Clone()
|
||||
{
|
||||
MsgHdr* hdr = (MsgHdr*)malloc(sizeof(MsgHdr));
|
||||
*hdr = *this;
|
||||
if (hdr->buflen > 0) {
|
||||
hdr->buf = (char*)malloc(hdr->buflen);
|
||||
memmove((void*)hdr->buf, (void*)buf, buflen);
|
||||
}
|
||||
return hdr;
|
||||
}
|
||||
|
||||
void MsgHdr::Destroy(MsgHdr* hdr)
|
||||
{
|
||||
if (hdr->buf) {
|
||||
free((void*)hdr->buf);
|
||||
}
|
||||
free((void*)hdr);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,23 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
class Player;
|
||||
namespace google
|
||||
{
|
||||
namespace protobuf
|
||||
{
|
||||
class Message;
|
||||
}
|
||||
}
|
||||
|
||||
namespace a8
|
||||
{
|
||||
class TcpClient;
|
||||
class TcpListener;
|
||||
}
|
||||
|
||||
class Player;
|
||||
namespace f8
|
||||
{
|
||||
|
||||
struct MsgHdr
|
||||
{
|
||||
unsigned int seqid;
|
||||
unsigned short msgid;
|
||||
int socket_handle;
|
||||
unsigned long ip_saddr;
|
||||
const char* buf;
|
||||
int buflen;
|
||||
int offset;
|
||||
Player *hum = nullptr;
|
||||
const void* user_data = nullptr;
|
||||
|
||||
MsgHdr* Clone();
|
||||
static void Destroy(MsgHdr* hdr);
|
||||
};
|
||||
|
||||
//普通消息头部
|
||||
struct PackHead
|
||||
{
|
||||
|
19
f8/types.cc
19
f8/types.cc
@ -27,23 +27,4 @@ namespace f8
|
||||
return a8::HttpResponse(response);
|
||||
}
|
||||
|
||||
MsgHdr* MsgHdr::Clone()
|
||||
{
|
||||
MsgHdr* hdr = (MsgHdr*)malloc(sizeof(MsgHdr));
|
||||
*hdr = *this;
|
||||
if (hdr->buflen > 0) {
|
||||
hdr->buf = (char*)malloc(hdr->buflen);
|
||||
memmove((void*)hdr->buf, (void*)buf, buflen);
|
||||
}
|
||||
return hdr;
|
||||
}
|
||||
|
||||
void MsgHdr::Destroy(MsgHdr* hdr)
|
||||
{
|
||||
if (hdr->buf) {
|
||||
free((void*)hdr->buf);
|
||||
}
|
||||
free((void*)hdr);
|
||||
}
|
||||
|
||||
}
|
||||
|
17
f8/types.h
17
f8/types.h
@ -5,7 +5,6 @@ namespace a8
|
||||
class MutableXObject;
|
||||
}
|
||||
|
||||
class Player;
|
||||
namespace f8
|
||||
{
|
||||
struct JsonHttpRequest
|
||||
@ -36,20 +35,6 @@ namespace f8
|
||||
IM_SysEnd = 99,
|
||||
};
|
||||
|
||||
struct MsgHdr
|
||||
{
|
||||
unsigned int seqid;
|
||||
unsigned short msgid;
|
||||
int socket_handle;
|
||||
unsigned long ip_saddr;
|
||||
const char* buf;
|
||||
int buflen;
|
||||
int offset;
|
||||
Player *hum = nullptr;
|
||||
const void* user_data = nullptr;
|
||||
|
||||
MsgHdr* Clone();
|
||||
static void Destroy(MsgHdr* hdr);
|
||||
};
|
||||
struct MsgHdr;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user