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


Public Methods | |
| ConnectionRequest () | |
| ConnectionRequest (std::string host_name, vpr::Uint16 port) | |
| Create a ConnectionRequest packet to request a remote connection. 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 requesting the connection. More... | |
| vpr::Uint16 | getPort () |
| Return the port that the requesting machine is listening on. More... | |
Static Public Methods | |
| vpr::Uint16 | getPacketFactoryType () |
| Return the type of this packet. More... | |
|
|
Definition at line 52 of file ConnectionRequest.h.
00053 {;}
|
|
||||||||||||
|
Create a ConnectionRequest packet to request a remote connection.
Definition at line 41 of file ConnectionRequest.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
00047 // Create a Header for this packet with the correect type and size.
00048 mHeader = new Header(Header::RIM_PACKET,
00049 Header::RIM_CONNECTION_REQ,
00050 Header::RIM_PACKET_HEAD_SIZE
00051 + 2
00052 + mHostname.size()
00053 + 2 /*mPort*/
00054 ,0/*Field not curently used*/);
00055 // Serialize the given data.
00056 serialize();
00057 }
|
|
|
Serializes member variables into a data stream.
Definition at line 59 of file ConnectionRequest.cpp. References cluster::Packet::mHeader, and cluster::Packet::mPacketWriter. Referenced by ConnectionRequest.
00060 {
00061 // Clear the data stream.
00062 mPacketWriter->getData()->clear();
00063 mPacketWriter->setCurPos(0);
00064
00065 // Serialize the header.
00066 mHeader->serializeHeader();
00067
00068 // Serialize the hostname of the requesting machine.
00069 mPacketWriter->writeString(mHostname);
00070
00071 // Serialize the listening port of the requesting machine
00072 mPacketWriter->writeUint16(mPort);
00073 }
|
|
|
Parses the data stream into the local member variables.
Implements cluster::Packet. Definition at line 75 of file ConnectionRequest.cpp.
00076 {
00077 // De-Serialize the hostname of the requesting machine.
00078 mHostname = reader->readString();
00079
00080 // De-Serialize the listening port of the requesting machine
00081 mPort = reader->readUint16();
00082 }
|
|
|
Print the data to the screen in a readable form.
Implements cluster::Packet. Definition at line 84 of file ConnectionRequest.cpp. References gadgetDBG_RIM.
00085 {
00086 vprDEBUG_BEGIN(gadgetDBG_RIM,debug_level)
00087 << clrOutBOLD(clrYELLOW,"==== Connection Request Packet Data ====\n") << vprDEBUG_FLUSH;
00088
00089 Packet::printData(debug_level);
00090
00091 vprDEBUG(gadgetDBG_RIM,debug_level)
00092 << clrOutBOLD(clrYELLOW, "Host Name: ") << mHostname
00093 << std::endl << vprDEBUG_FLUSH;
00094 vprDEBUG(gadgetDBG_RIM,debug_level)
00095 << clrOutBOLD(clrYELLOW, "Port: ") << mPort
00096 << std::endl << vprDEBUG_FLUSH;
00097
00098 vprDEBUG_END(gadgetDBG_RIM,debug_level)
00099 << clrOutBOLD(clrYELLOW,"========================================\n") << vprDEBUG_FLUSH;
00100 }
|
|
|
Return the type of this packet.
Definition at line 81 of file ConnectionRequest.h.
00082 {
00083 return(Header::RIM_CONNECTION_REQ);
00084 }
|
|
|
Return the hostname of the machine requesting the connection.
Definition at line 89 of file ConnectionRequest.h.
00089 { return mHostname; }
|
|
|
Return the port that the requesting machine is listening on.
Definition at line 94 of file ConnectionRequest.h.
00094 { return mPort; }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002