Beispiel #1
0
bool ProtocolFileReq::decode_body(const char *buf, int size)
{
	////fid
	DECODE_STRING(m_file_req.fid);
	////index
	DECODE_INT(m_file_req.index);
	////offset
	DECODE_INT(m_file_req.offset);
	////size
	DECODE_INT(m_file_req.size);

	return true;
}
Beispiel #2
0
bool ProtocolFileSaveResult::decode_body(const char *buf, int size)
{
	int temp;
	//result
	DECODE_INT(temp);
	m_save_result.status = (FileSaveResult::Status)temp;
	////fid
	DECODE_STRING(m_save_result.fid);
	////seg index
	DECODE_INT(m_save_result.index);

	return true;
}
void RRGLevel::initWithDecoder(RRGCoding::Decoder* decoder)
{
    DECODE_OBJECT(RRGCharacter, _character1);
    CC_SAFE_RETAIN(_character1);
    
    DECODE_OBJECT(RRGCharacter, _character2);
    CC_SAFE_RETAIN(_character2);
    
    DECODE_OBJECT(RRGCharacter, _character3);
    CC_SAFE_RETAIN(_character3);
    
    DECODE_VECTOR_OBJECTS(RRGCharacter, _vectChara);
    DECODE_MAP_OBJECTS(RRGCharacter, _mapChara);
    
    DECODE_INT(_testInt);
    DECODE_FLOAT(_testFloat);
    DECODE_STRING(_testString);
    
    DECODE_ARRAY(int, _intArray);
    
    DECODE_VALUEVECTOR(_valueVector);
    DECODE_VALUEMAP(_valueMap);
    
    DECODE_VECTOR(int, _intVector);
    DECODE_VECTOR(Vec2, _pointVector);
    
    DECODE_MAP(double, _doubleMap);
    DECODE_MAP(Rect, _rectMap);
}
INT TSipBody::decode(CHAR* &buf)
{
	DECODE_INT( content_length, buf )
	content.decode(buf);

	return size();
}
INT TSipSubscriptionState::decode(CHAR* &buf)
{
	state.decode(buf);
	DECODE_INT( expires, buf )
	reason.decode(buf);

	return size();
}
////解码协议体数据io_buffer.成功返回true,失败返回false.
bool TemplateProtocol::decode_body(const char *buf, int size)
{
	////m_value
	DECODE_INT(m_value);
	////m_str
	DECODE_STRING(m_str);

	return true;
}
Beispiel #7
0
bool ProtocolChunkPingResp::decode_body(const char *buf, int size)
{
	int temp;
	////result
	DECODE_INT(temp);
	m_result = (bool)temp;
	////chunk id
	DECODE_STRING(m_chunk_id);

	return true;
}
Beispiel #8
0
bool ProtocolFileInfoSaveResult::decode_body(const char *buf, int size)
{
	int temp;
	////result
	DECODE_INT(temp);
	m_save_result.result = (FileInfoSaveResult::Result)temp;
	////fid
	DECODE_STRING(m_save_result.fid);

	return true;
}
//解码包体.成功返回0,否则返回-1;
bool RequestData::decode_body(const char* buf, int size)
{
	int len = 0;
	//file name
	DECODE_STRING(m_file_name);
	//start pos
	DECODE_INT64(m_start_pos);
	//size
	DECODE_INT(m_size);

	return true;
}
Beispiel #10
0
bool ProtocolFileInfo::decode_body(const char *buf, int size)
{
	int temp;
	////result
	DECODE_INT(temp);
	m_fileinfo.result = (FileInfo::Result)temp;
	////fid
	DECODE_STRING(m_fileinfo.fid);
	////file name
	DECODE_STRING(m_fileinfo.name);
	////file size
	DECODE_INT(m_fileinfo.size);
	////chunk info
	DECODE_INT(temp);
	while(temp-- > 0)
	{
		ChunkPath chunkpath;
		//chunk id
		DECODE_STRING(chunkpath.id);
		//chunk ip
		DECODE_STRING(chunkpath.ip);
		//chunk port
		DECODE_INT(chunkpath.port);
		//index
		DECODE_INT(chunkpath.index);
		//chunk offset
		DECODE_INT(chunkpath.offset);
		m_fileinfo.add_chunkpath(chunkpath);
	}

	return true;
}
Beispiel #11
0
bool ProtocolChunkPing::decode_body(const char *buf, int size)
{
	////chunk id
	DECODE_STRING(m_chunk_info.id);
	////chunk ip
	DECODE_STRING(m_chunk_info.ip);
	////chunk port
	DECODE_INT(m_chunk_info.port);
	////disk space
	DECODE_INT64(m_chunk_info.disk_space);
	////disk used
	DECODE_INT64(m_chunk_info.disk_used);

	return true;
}
Beispiel #12
0
bool ProtocolFile::decode_body(const char *buf, int size)
{
	int temp;
	////flag
	DECODE_INT(temp);
	m_file_seg.flag = (FileSeg::FileFlag)temp;
	////fid
	DECODE_STRING(m_file_seg.fid);
	////name
	DECODE_STRING(m_file_seg.name);
	////file size
	DECODE_INT(m_file_seg.filesize);
	////seg offset
	DECODE_INT(m_file_seg.offset);
	////seg index
	DECODE_INT(m_file_seg.index);
	////seg size
	DECODE_INT(m_file_seg.size);
	////data
	if(size<m_file_seg.size) return false;
	m_file_seg.data = buf;

	return true;
}