void Battlenet::Session::SendResponse(uint32 token, uint32 status) { Header header; header.set_token(token); header.set_status(status); header.set_service_id(0xFE); uint16 headerSize = header.ByteSize(); EndianConvertReverse(headerSize); MessageBuffer packet; packet.Write(&headerSize, sizeof(headerSize)); uint8* ptr = packet.GetWritePointer(); packet.WriteCompleted(header.ByteSize()); header.SerializeToArray(ptr, header.ByteSize()); AsyncWrite(&packet); }
void Battlenet::Session::SendRequest(uint32 serviceHash, uint32 methodId, pb::Message const* request) { Header header; header.set_service_id(0); header.set_service_hash(serviceHash); header.set_method_id(methodId); header.set_size(request->ByteSize()); header.set_token(_requestToken++); uint16 headerSize = header.ByteSize(); EndianConvertReverse(headerSize); MessageBuffer packet; packet.Write(&headerSize, sizeof(headerSize)); uint8* ptr = packet.GetWritePointer(); packet.WriteCompleted(header.ByteSize()); header.SerializeToArray(ptr, header.ByteSize()); ptr = packet.GetWritePointer(); packet.WriteCompleted(request->ByteSize()); request->SerializeToArray(ptr, request->ByteSize()); AsyncWrite(&packet); }