#include <Packet.h>
Inheritance diagram for cluster::Packet:


Public Methods | |
| Packet () | |
| Create a new empty packet. More... | |
| Packet (std::vector< vpr::Uint8 > *data) | |
| Copy the given data, and parse the header. More... | |
| virtual | ~Packet () |
| Free all memory used by internal data. More... | |
| void | recv (Header *packet_head, ClusterNode *node) throw (cluster::ClusterException) |
| Construct a packet using the given packet header and socketstream. More... | |
| void | dump () |
| Dump all internal data to the screen. More... | |
| vpr::Uint16 | getPacketType () |
| Get the type of this packet. More... | |
| virtual void | printData (int debug_level)=0 |
| Print the internal data in a readable format. More... | |
| vpr::ObjectReader * | getPacketReader () |
| Return the vpr::PacketReader object used to retrieve data from the packet. More... | |
| vpr::GUID | getPluginId () |
| Get the GUID of the Plugin that should handle this packet. More... | |
| Header * | getHeader () |
| Get the header for this packet. More... | |
| std::vector< vpr::Uint8 > * | getData () |
| Get a std::vector containing all internal data. More... | |
| void | setHeader (Header *head) |
| virtual void | parse (vpr::BufferObjectReader *reader)=0 |
Protected Attributes | |
| Header * | mHeader |
| Header used to specify the type/size of this packet. More... | |
| vpr::BufferObjectReader * | mPacketReader |
| ObjectReader that is used to parse all data. More... | |
| vpr::BufferObjectWriter * | mPacketWriter |
| ObjectWriter that is used to serialize all data. More... | |
| std::vector< vpr::Uint8 > | mData |
| std::vector which contains all internal data. More... | |
| vpr::GUID | mPluginId |
| GUID that specifies which plugin is responcsible for this packet. More... | |
|
|
Create a new empty packet.
Definition at line 47 of file Packet.cpp. References mData, mPacketReader, and mPacketWriter.
00047 : mPluginId() 00048 { 00049 //mData = new std::vector<vpr::Uint8>(RIM_PACKET_HEAD_SIZE); 00050 mPacketReader = new vpr::BufferObjectReader(&mData); 00051 mPacketWriter= new vpr::BufferObjectWriter(&mData); 00052 } |
|
|
Copy the given data, and parse the header.
Definition at line 53 of file Packet.cpp. References mData, mPacketReader, and mPacketWriter.
00053 : mPluginId() 00054 { 00055 //We must Copy 00056 mData = *(data); 00057 mPacketReader = new vpr::BufferObjectReader(&mData); 00058 mPacketWriter= new vpr::BufferObjectWriter(&mData); 00059 00060 //parseHeader(); 00061 } |
|
|
Free all memory used by internal data.
Definition at line 63 of file Packet.cpp. References mHeader, mPacketReader, and mPacketWriter.
00064 {
00065 delete mHeader;
00066 delete mPacketReader;
00067 delete mPacketWriter;
00068 //delete mData;
00069 }
|
|
||||||||||||
|
Construct a packet using the given packet header and socketstream.
|
|
|
Dump all internal data to the screen.
Definition at line 71 of file Packet.cpp. References mData, and mHeader.
00072 {
00073 if (mHeader != NULL)
00074 {
00075 mHeader->dump();
00076 }
00077 else
00078 {
00079 std::cout << "Could not dump Header since it is NULL!" << std::endl;
00080 }
00081 std::cout << "Dumping Packet(" << mData.size() << " bytes): ";
00082 for ( std::vector<vpr::Uint8>::iterator i = mData.begin();
00083 i!= mData.end(); i++ )
00084 {
00085 std::cout << (int)*i << " ";
00086 }
00087 std::cout << std::endl;
00088 }
|
|
|
Get the type of this packet.
Definition at line 90 of file Packet.cpp. References mHeader.
00091 {
00092 return mHeader->getPacketType();
00093 }
|
|
|
Print the internal data in a readable format.
Implemented in cluster::ApplicationDataAck. Definition at line 95 of file Packet.cpp. References gadgetDBG_RIM, and mHeader.
00096 {
00097 if (mHeader != NULL)
00098 {
00099 mHeader->printData(debug_level);
00100 /*
00101 vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL)
00102 << clrOutBOLD(clrCYAN,"\n====== Packet Header ======")
00103 << "\nRIMCode: " << mHeader->getRIMCode()
00104 << "\nPacketType: " << mHeader->getPacketType()
00105 << "\nFrame #: " << mHeader->getFrame()
00106 << "\nLength: " << mHeader->getPacketLength() << std::endl
00107 << vprDEBUG_FLUSH;
00108 */
00109 }
00110 else
00111 {
00112 vprDEBUG(gadgetDBG_RIM,vprDBG_CONFIG_LVL)
00113 << clrOutBOLD(clrRED,"[Packet::printData] Header is still NULL, can not print data!")
00114 << vprDEBUG_FLUSH;
00115 }
00116 }
|
|
|
Return the vpr::PacketReader object used to retrieve data from the packet.
Definition at line 93 of file Packet.h.
00094 {
00095 return mPacketReader;
00096 }
|
|
|
Get the GUID of the Plugin that should handle this packet.
Definition at line 101 of file Packet.h.
00101 { return mPluginId; }
|
|
|
Get the header for this packet.
Definition at line 106 of file Packet.h.
00107 {
00108 return mHeader;
00109 }
|
|
|
Get a std::vector containing all internal data.
Definition at line 114 of file Packet.h.
00115 {
00116 return &mData;
00117 }
|
|
|
Definition at line 119 of file Packet.h.
00120 {
00121 mHeader = head;
00122 }
|
|
|
Implemented in cluster::ApplicationDataAck. |
|
|
|
ObjectReader that is used to parse all data.
|
|
|
ObjectWriter that is used to serialize all data.
Definition at line 128 of file Packet.h. Referenced by Packet, cluster::SyncRequest::serialize, cluster::SyncAck::serialize, cluster::StartBlock::serialize, cluster::EndBlock::serialize, cluster::DeviceRequest::serialize, cluster::DeviceAck::serialize, cluster::DataPacket::serialize, cluster::ConnectionRequest::serialize, cluster::ConnectionAck::serialize, cluster::ApplicationDataRequest::serialize, cluster::ApplicationDataAck::serialize, and ~Packet. |
|
|
std::vector which contains all internal data.
|
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002