本文整理汇总了C++中PacketWriter::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ PacketWriter::begin方法的具体用法?C++ PacketWriter::begin怎么用?C++ PacketWriter::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketWriter
的用法示例。
在下文中一共展示了PacketWriter::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: flush
void FlowWriter::flush(PacketWriter& writer,UInt64 stage,UInt8 flags,bool header,BinaryReader& reader,UInt16 size) {
if(_stageAck==0 && header)
flags |= MESSAGE_HEADER;
if(size==0)
flags |= MESSAGE_ABANDONMENT;
if(_closed && _messages.size()==1) // On LAST message
flags |= MESSAGE_END;
// TRACE("FlowWriter %u stage %u",id,stage);
writer.write8(flags);
if(header) {
writer.write7BitLongValue(id);
writer.write7BitLongValue(stage);
writer.write7BitLongValue(stage-_stageAck);
// signature
if(_stageAck==0) {
writer.writeString8(signature);
// No write this in the case where it's a new flow!
if(flowId>0) {
writer.write8(1+Util::Get7BitValueSize(flowId)); // following size
writer.write8(0x0a); // Unknown!
writer.write7BitLongValue(flowId);
}
writer.write8(0); // marker of end for this part
}
}
if(size>0) {
reader.readRaw(writer.begin()+writer.position(),size);
writer.next(size);
}
}
示例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);
}