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; }
//解码大小为size的协议体数据buf.成功返回true,失败返回false. bool RespondSize::decode_body(const char* buf, int size) { int len = 0; //file size DECODE_INT64(m_file_size); //file name DECODE_STRING(m_file_name); 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; }