本文整理汇总了C++中PacketWriter::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ PacketWriter::reset方法的具体用法?C++ PacketWriter::reset怎么用?C++ PacketWriter::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketWriter
的用法示例。
在下文中一共展示了PacketWriter::reset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteCRC
void RTMFP::WriteCRC(PacketWriter& packet) {
// Compute the CRC and add it at the beginning of the request
PacketReader reader(packet.begin(),packet.length());
reader.next(6);
UInt16 sum = CheckSum(reader);
packet.reset(4);packet << sum;
}
示例2: Encode
void RTMFP::Encode(AESEngine& aesEncrypt,PacketWriter packet) {
// paddingBytesLength=(0xffffffff-plainRequestLength+5)&0x0F
int paddingBytesLength = (0xFFFFFFFF-packet.length()+5)&0x0F;
// Padd the plain request with paddingBytesLength of value 0xff at the end
packet.reset(packet.length());
string end(paddingBytesLength,(UInt8)0xFF);
packet.writeRaw(end);
// Compute the CRC and add it at the beginning of the request
PacketReader reader(packet);
reader.next(6);
UInt16 sum = CheckSum(reader);
packet.reset(4);packet << sum;
// Encrypt the resulted request
reader.reset(4);
aesEncrypt.process(reader.current(),reader.current(),reader.available());
}
示例3: Encode
void RTMFP::Encode(AESEngine& aesEncrypt,PacketWriter& packet) {
if(aesEncrypt.type != AESEngine::EMPTY) {
// paddingBytesLength=(0xffffffff-plainRequestLength+5)&0x0F
int paddingBytesLength = (0xFFFFFFFF-packet.length()+5)&0x0F;
// Padd the plain request with paddingBytesLength of value 0xff at the end
packet.reset(packet.length());
string end(paddingBytesLength,(UInt8)0xFF);
packet.writeRaw(end);
}
WriteCRC(packet);
// Encrypt the resulted request
aesEncrypt.process(packet.begin()+4,packet.begin()+4,packet.length()-4);
}
示例4: Pack
void RTMFP::Pack(PacketWriter& packet,UInt32 farId) {
PacketReader reader(packet.begin(),packet.length());
reader.next(4);
packet.reset(0);
packet.write32(reader.read32()^reader.read32()^farId);
}
示例5: Pack
void RTMFP::Pack(PacketWriter packet,UInt32 farId) {
packet.reset();
PacketReader reader(packet);
reader.read32();
packet.write32(reader.read32()^reader.read32()^farId);
}