Commit 42b981ae authored by Andrea Bulgarelli's avatar Andrea Bulgarelli
Browse files

added void Packet::copyBSSourceDataField(byte* bytestream, dword size)

parent a0504f8c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@ public:
	///Get the the source data field as a ByteStream
	ByteStreamPtr getBSSourceDataField();
	
	void copyBSSourceDataField(byte* bytestream, dword size);
	
	///Get the tail as a ByteStream
	ByteStreamPtr getBSTail();
	
+8 −0
Original line number Diff line number Diff line
@@ -821,6 +821,14 @@ ByteStreamPtr Packet::getBSSourceDataField() {
	return sdff;
}

void Packet::copyBSSourceDataField(byte* bytestream, dword size) {
	ByteStreamPtr sdfbs = getBSSourceDataField();
	if(sdfbs->size() != size)
		throw new PacketException("Packet::copyBSSourceDataField(): size of the data is wrong");
	byte* sdfbsp = sdfbs->getStream();
	memcpy(sdfbsp, bytestream, size*sizeof(byte));
}

ByteStreamPtr Packet::getBSTail() {
	//dword dimvariablepart = packet->size() - dimPrefix - dimPacketStartingFixedPart - dimPacketTail;
	ByteStreamPtr tail = ByteStreamPtr(new ByteStream(packet->stream + packet->size() - dimPacketTail, dimPacketTail, bigendian));