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


Public Methods | |
| ConnectionAck () | |
| ConnectionAck (std::string host_name, vpr::Uint16 port, bool ack) | |
| Create a ConnectionAck packet to acknowledge a ConnectionRequest. 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 () |
| Return the hostname of the machine that is acknowledging the connection. More... | |
| vpr::Uint16 | getPort () |
| Return the port that the acknowledging machine is listening on. More... | |
| bool | getAck () |
| Return 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 51 of file ConnectionAck.h.
00052 {;}
|
|
||||||||||||||||
|
Create a ConnectionAck packet to acknowledge a ConnectionRequest.
Definition at line 41 of file ConnectionAck.cpp. References cluster::Packet::mHeader, and serialize.
00042 {
00043 // Set the local member variables using the given values.
00044 mHostname = host_name;
00045 mPort = port;
00046 mAck = ack;
00047
00048 // Create a Header for this packet with the correect type and size.
00049 mHeader = new Header(Header::RIM_PACKET,
00050 Header::RIM_CONNECTION_ACK,
00051 Header::RIM_PACKET_HEAD_SIZE
00052 + 2 /* Uint16 for length*/
00053 + mHostname.size()
00054 + 2 /*mPort*/
00055 + 1 /*mAck*/,
00056 0/*Field not curently used*/);
00057 // Serialize the given data.
00058 serialize();
00059 }
|
|
|
Serializes member variables into a data stream.
Definition at line 61 of file ConnectionAck.cpp. References cluster::Packet::mHeader, and cluster::Packet::mPacketWriter. Referenced by ConnectionAck.
00062 {
00063 // Clear the data stream.
00064 mPacketWriter->getData()->clear();
00065 mPacketWriter->setCurPos(0);
00066
00067 // Serialize the header.
00068 mHeader->serializeHeader();
00069
00070 // Serialize the hostname of the acknowledging node
00071 mPacketWriter->writeString(mHostname);
00072
00073 // Serialize the listening port of the acknowledging node
00074 mPacketWriter->writeUint16(mPort);
00075
00076 // Serialize the Ack boolean
00077 mPacketWriter->writeBool(mAck);
00078 }
|
|
|
Parses the data stream into the local member variables.
Implements cluster::Packet. Definition at line 80 of file ConnectionAck.cpp.
00081 {
00082 // De-Serialize the hostname of the acknowledging node
00083 mHostname = reader->readString();
00084
00085 // De-Serialize the listening port of the acknowledging node
00086 mPort = reader->readUint16();
00087
00088 // De-Serialize the Ack boolean
00089 mAck = reader->readBool();
00090 }
|
|
|
Print the data to the screen in a readable form.
Implements cluster::Packet. Definition at line 92 of file ConnectionAck.cpp. References gadgetDBG_RIM.
00093 {
00094 vprDEBUG_BEGIN(gadgetDBG_RIM,debug_level)
00095 << clrOutBOLD(clrYELLOW,"==== Connection Ack Packet Data ====\n") << vprDEBUG_FLUSH;
00096
00097 Packet::printData(debug_level);
00098
00099 vprDEBUG(gadgetDBG_RIM,debug_level)
00100 << clrOutBOLD(clrYELLOW, "Host Name: ") << mHostname
00101 << std::endl << vprDEBUG_FLUSH;
00102 vprDEBUG(gadgetDBG_RIM,debug_level)
00103 << clrOutBOLD(clrYELLOW, "Port: ") << mPort
00104 << std::endl << vprDEBUG_FLUSH;
00105 vprDEBUG(gadgetDBG_RIM,debug_level)
00106 << clrOutBOLD(clrYELLOW, "Ack or Nack: ") << (mAck ? "Ack" : "Nack")
00107 << std::endl << vprDEBUG_FLUSH;
00108
00109 vprDEBUG_END(gadgetDBG_RIM,debug_level)
00110 << clrOutBOLD(clrYELLOW,"====================================\n") << vprDEBUG_FLUSH;
00111 }
|
|
|
Return the type of this packet.
Definition at line 81 of file ConnectionAck.h.
00082 {
00083 return(Header::RIM_CONNECTION_ACK);
00084 }
|
|
|
Return the hostname of the machine that is acknowledging the connection.
Definition at line 89 of file ConnectionAck.h.
00089 { return mHostname;}
|
|
|
Return the port that the acknowledging machine is listening on.
Definition at line 94 of file ConnectionAck.h.
00094 { return mPort;}
|
|
|
Return a boolean determining if this is a positive(ACK) or a negative(NACK) responce.
Definition at line 99 of file ConnectionAck.h.
00099 { return mAck;}
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002