PacketFactory.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PROTOCOLS__GENERICS__PACKET_FACTORY_H
00024 #define PROTOCOLS__GENERICS__PACKET_FACTORY_H
00025
00026 #include "Imports.h"
00027 #include "Packet.h"
00028
00029 namespace Protocols {
00030 namespace Generics {
00031
00033
00051 class PacketFactory
00052 {
00053 public:
00054 PacketFactory();
00055 virtual ~PacketFactory();
00056
00057 bool extractPacket (const QByteArray &rawBytes,
00058 int &headerLength,
00059 int &payloadLength,
00060 int &trailerLength);
00061 Packet createPacket (const QByteArray &rawHeader,
00062 const QByteArray &rawPayload,
00063 const QByteArray &rawTrailer);
00064
00065 protected:
00066 virtual bool doExtractPacket (const QByteArray &rawBytes,
00067 int &headerLength,
00068 int &payloadLength,
00069 int &trailerLength) = 0;
00070 virtual Packet doCreatePacket (const QByteArray &rawHeader,
00071 const QByteArray &rawPayload,
00072 const QByteArray &rawTrailer
00073 ) = 0;
00074 };
00075
00076 }
00077 }
00078
00079 #endif // PROTOCOLS__GENERICS__PACKET_FACTORY_H