Loading ChangeLog +8 −0 Original line number Diff line number Diff line 2013-09-17 Andrea Bulgarelli <bulgarelli@iasfbo.inaf.it> * include/InputPacketStream.h (InputPacketStream): ** dword getPacketDimension(byte* stream); ** int detPacketType(byte* packet); * include/Packet.h (Packet): bool verifyPacketValue(byte* stream); 2013-09-13 Andrea Bulgarelli <bulgarelli@iasfbo.inaf.it> TAG v2.0.7 * src/PartOfPacket.cpp (PartOfPacket::setByteStream): Loading include/InputPacketStream.h +11 −2 Original line number Diff line number Diff line Loading @@ -36,17 +36,26 @@ public: ~InputPacketStream(); /// \return The index of packet type if it's recognized. 0 if packet isn't recogniezed. /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. /// \param prefix A ByteStream that contains the prefix of packet (if present). /// \param packetHeader A ByteStream that contains the packet header. /// \param packetDataField A ByteStream that contains the packet data field. int detPacketType(ByteStream* prefix, ByteStream* packetHeader, ByteStream* packetDataField); /// \return The index of packet type if it's recognized. 0 if packet isn't recogniezed. /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. /// \param prefix A ByteStream that contains the prefix of packet (if present). /// \param packet A ByteStream that contains the packet. int detPacketType(ByteStream* prefix, ByteStream* packet); ///It returns the index of the packet type contained in the stream. The stream* contains also the prefix (if present) /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. /// \param packet A byte* that contains the packet. int detPacketType(byte* packet); ///It returns the total dimension of the packet contained in the stream (without prefix). The stream* contains also the prefix (if present) ///\param The stream with the prefix (if present) dword getPacketDimension(byte* stream); /// This method sets the generic input of the stream /// \param in An input. void setInput(Input* in); Loading include/Packet.h +4 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,10 @@ public: /// \return True if the ByteStream contains a packet bool verifyPacketValue(ByteStream* prefix, ByteStream* packet); /// Verifies if within the byte* stream passed with arguments it's present a correct packet. The stream* contains also the prefix (if present) /// \param stream A pointer to the stream of byte, with prefix and packet bool verifyPacketValue(byte* stream); /// Verifies if within the ByteStream passed with arguments it's present a correct packet. /// \pre The structure of the stream must be loaded. /// \param prefix This is the prefix of the packet. Loading src/InputPacketStream.cpp +29 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,18 @@ int InputPacketStream::detPacketType(ByteStream* prefix, ByteStream* packet) } int InputPacketStream::detPacketType(byte* packet) { /// Iterate through list and output each element. /// The packetType 0 is the packet not recognized for (dword i = 1; i<numberOfPacketType; i++) { Packet* p = getPacketType(i); if(p->verifyPacketValue(packet)) return i; } return 0; } void InputPacketStream::setInput(Input* in) { Loading Loading @@ -145,3 +157,20 @@ Packet* InputPacketStream::readPacket() throw(PacketExceptionIO*) throw e; } } dword InputPacketStream::getPacketDimension(byte* stream) { dword dimPre = 0; if(prefix) dimPre += dimPrefix; //ByteStream* prefix = new ByteStream(stream, dimPre, bigendian); dword dim = 0; dword dimHeader = headerReference->getDimension(); dim += dimHeader; ByteStream* tempHeader = new ByteStream(); tempHeader->setStream(stream+dimPre, dimHeader, bigendian); headerReference->setByteStream(tempHeader); dim += headerReference->getPacketLength(); delete tempHeader; return dim; } src/Packet.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -835,3 +835,22 @@ char* Packet::printPacketOutputStream() char* c = b.printStreamInHexadecimal(); return c; } bool Packet::verifyPacketValue(byte* stream) { dword dimPre = 0; if(thereisprefix) dimPre += dimPrefix; ByteStream* prefix = new ByteStream(stream, dimPre, bigendian); dword dim = 0; dword dimHeader = header->getDimension(); dim += dimHeader; tempHeader->setStream(stream+dimPre, dimHeader, bigendian); header->setByteStream(tempHeader); dim += header->getDimensionOfPacketLenght() + 1; ByteStream* packet = new ByteStream(stream+dimPre, dim, bigendian); return verifyPacketValue(prefix, packet); } Loading
ChangeLog +8 −0 Original line number Diff line number Diff line 2013-09-17 Andrea Bulgarelli <bulgarelli@iasfbo.inaf.it> * include/InputPacketStream.h (InputPacketStream): ** dword getPacketDimension(byte* stream); ** int detPacketType(byte* packet); * include/Packet.h (Packet): bool verifyPacketValue(byte* stream); 2013-09-13 Andrea Bulgarelli <bulgarelli@iasfbo.inaf.it> TAG v2.0.7 * src/PartOfPacket.cpp (PartOfPacket::setByteStream): Loading
include/InputPacketStream.h +11 −2 Original line number Diff line number Diff line Loading @@ -36,17 +36,26 @@ public: ~InputPacketStream(); /// \return The index of packet type if it's recognized. 0 if packet isn't recogniezed. /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. /// \param prefix A ByteStream that contains the prefix of packet (if present). /// \param packetHeader A ByteStream that contains the packet header. /// \param packetDataField A ByteStream that contains the packet data field. int detPacketType(ByteStream* prefix, ByteStream* packetHeader, ByteStream* packetDataField); /// \return The index of packet type if it's recognized. 0 if packet isn't recogniezed. /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. /// \param prefix A ByteStream that contains the prefix of packet (if present). /// \param packet A ByteStream that contains the packet. int detPacketType(ByteStream* prefix, ByteStream* packet); ///It returns the index of the packet type contained in the stream. The stream* contains also the prefix (if present) /// \return The index of packet type if it's recognized. 0 if packet isn't recognized. /// \param packet A byte* that contains the packet. int detPacketType(byte* packet); ///It returns the total dimension of the packet contained in the stream (without prefix). The stream* contains also the prefix (if present) ///\param The stream with the prefix (if present) dword getPacketDimension(byte* stream); /// This method sets the generic input of the stream /// \param in An input. void setInput(Input* in); Loading
include/Packet.h +4 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,10 @@ public: /// \return True if the ByteStream contains a packet bool verifyPacketValue(ByteStream* prefix, ByteStream* packet); /// Verifies if within the byte* stream passed with arguments it's present a correct packet. The stream* contains also the prefix (if present) /// \param stream A pointer to the stream of byte, with prefix and packet bool verifyPacketValue(byte* stream); /// Verifies if within the ByteStream passed with arguments it's present a correct packet. /// \pre The structure of the stream must be loaded. /// \param prefix This is the prefix of the packet. Loading
src/InputPacketStream.cpp +29 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,18 @@ int InputPacketStream::detPacketType(ByteStream* prefix, ByteStream* packet) } int InputPacketStream::detPacketType(byte* packet) { /// Iterate through list and output each element. /// The packetType 0 is the packet not recognized for (dword i = 1; i<numberOfPacketType; i++) { Packet* p = getPacketType(i); if(p->verifyPacketValue(packet)) return i; } return 0; } void InputPacketStream::setInput(Input* in) { Loading Loading @@ -145,3 +157,20 @@ Packet* InputPacketStream::readPacket() throw(PacketExceptionIO*) throw e; } } dword InputPacketStream::getPacketDimension(byte* stream) { dword dimPre = 0; if(prefix) dimPre += dimPrefix; //ByteStream* prefix = new ByteStream(stream, dimPre, bigendian); dword dim = 0; dword dimHeader = headerReference->getDimension(); dim += dimHeader; ByteStream* tempHeader = new ByteStream(); tempHeader->setStream(stream+dimPre, dimHeader, bigendian); headerReference->setByteStream(tempHeader); dim += headerReference->getPacketLength(); delete tempHeader; return dim; }
src/Packet.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -835,3 +835,22 @@ char* Packet::printPacketOutputStream() char* c = b.printStreamInHexadecimal(); return c; } bool Packet::verifyPacketValue(byte* stream) { dword dimPre = 0; if(thereisprefix) dimPre += dimPrefix; ByteStream* prefix = new ByteStream(stream, dimPre, bigendian); dword dim = 0; dword dimHeader = header->getDimension(); dim += dimHeader; tempHeader->setStream(stream+dimPre, dimHeader, bigendian); header->setByteStream(tempHeader); dim += header->getDimensionOfPacketLenght() + 1; ByteStream* packet = new ByteStream(stream+dimPre, dim, bigendian); return verifyPacketValue(prefix, packet); }