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


Public Methods | |
| SyncAck () | |
| SyncAck (const std::string &host_name, const vpr::Uint16 &port, const bool ack) | |
| Create a ApplicationDataAck packet to acknowledge a ApplicationDataRequest. More... | |
| void | serialize () |
| Serializes member variables into a data stream. More... | |
| virtual void | parse (vpr::BufferObjectReader *reader) |
| Parses the data stream into the local member variables. More... | |
| virtual void | printData (int debug_level) |
| Print the data to the screen in a readable form. More... | |
| std::string | getHostname () |
| Returns the hostname of the node acknowledging the SyncRequest. More... | |
| vpr::Uint16 | getPort () |
| Returns the port of the node acknowledging the SyncRequest. More... | |
| bool | getAck () |
| Returns a boolean determining if this is a positive(ACK) or a negative(NACK) responce. More... | |
Static Public Methods | |
| vpr::Uint16 | getPacketFactoryType () |
| Return the type of this packet. More... | |
|
|
Definition at line 52 of file SyncAck.h.
00053 {;}
|
|
||||||||||||||||
|
Create a ApplicationDataAck packet to acknowledge a ApplicationDataRequest.
Definition at line 44 of file SyncAck.cpp. References cluster::Packet::mHeader, and serialize.
00045 {
00046 // Set the local member variables using the given values.
00047 mHostname = host_name;
00048 mPort = port;
00049 mAck = ack;
00050
00051 // Create a Header for this packet with the correect type and size.
00052 mHeader = new Header(Header::RIM_PACKET,
00053 Header::RIM_SYNC_ACK,
00054 Header::RIM_PACKET_HEAD_SIZE
00055 + 2 /* data for length*/
00056 + mHostname.size()
00057 + 2 /*mPort*/
00058 + 1 /*mAck*/,
00059 0/*Field not curently used*/);
00060 // Serialize the given data.
00061 serialize();
00062 }
|
|
|
Serializes member variables into a data stream.
Definition at line 64 of file SyncAck.cpp. References cluster::Packet::mHeader, and cluster::Packet::mPacketWriter. Referenced by SyncAck.
00065 {
00066 // Clear the data stream.
00067 mPacketWriter->getData()->clear();
00068 mPacketWriter->setCurPos(0);
00069
00070 // Serialize the header.
00071 mHeader->serializeHeader();
00072
00073 // Serialize the hostname of the machine acknowledging the SyncRequest.
00074 mPacketWriter->writeString(mHostname);
00075
00076 // Serialize the listening port of the machine acknowledging the SyncRequest.
00077 mPacketWriter->writeUint16(mPort);
00078
00079 // Serialize the Ack boolean
00080 mPacketWriter->writeBool(mAck);
00081 }
|
|
|
Parses the data stream into the local member variables.
Implements cluster::Packet. Definition at line 83 of file SyncAck.cpp.
00084 {
00085 // De-Serialize the hostname of the machine acknowledging the SyncRequest.
00086 mHostname = reader->readString();
00087
00088 // De-Serialize the listening port of the machine acknowledging the SyncRequest.
00089 mPort = reader->readUint16();
00090
00091 // De-Serialize the Ack boolean
00092 mAck = reader->readBool();
00093 }
|
|
|
Print the data to the screen in a readable form.
Implements cluster::Packet. Definition at line 95 of file SyncAck.cpp. References gadgetDBG_RIM.
00096 {
00097 vprDEBUG_BEGIN(gadgetDBG_RIM,debug_level)
00098 << clrOutBOLD(clrYELLOW,"==== Sync Ack Packet Data ====\n") << vprDEBUG_FLUSH;
00099
00100 Packet::printData(debug_level);
00101
00102 vprDEBUG(gadgetDBG_RIM,debug_level)
00103 << clrOutBOLD(clrYELLOW, "Host Name: ") << mHostname
00104 << std::endl << vprDEBUG_FLUSH;
00105 vprDEBUG(gadgetDBG_RIM,debug_level)
00106 << clrOutBOLD(clrYELLOW, "Port: ") << mPort
00107 << std::endl << vprDEBUG_FLUSH;
00108 vprDEBUG(gadgetDBG_RIM,debug_level)
00109 << clrOutBOLD(clrYELLOW, "Ack or Nack: ") << (mAck ? "Ack" : "Nack")
00110 << std::endl << vprDEBUG_FLUSH;
00111
00112 vprDEBUG_END(gadgetDBG_RIM,debug_level)
00113 << clrOutBOLD(clrYELLOW,"====================================\n") << vprDEBUG_FLUSH;
00114 }
|
|
|
Return the type of this packet.
Definition at line 82 of file SyncAck.h.
00083 {
00084 return(Header::RIM_SYNC_ACK);
00085 }
|
|
|
Returns the hostname of the node acknowledging the SyncRequest.
Definition at line 90 of file SyncAck.h.
00090 { return mHostname; }
|
|
|
Returns the port of the node acknowledging the SyncRequest.
Definition at line 95 of file SyncAck.h.
00095 { return mPort; }
|
|
|
Returns a boolean determining if this is a positive(ACK) or a negative(NACK) responce.
Definition at line 100 of file SyncAck.h.
00100 { return mAck; }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002