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


Public Member Functions | |
| ConnectionRequest () | |
| ConnectionRequest (std::string host_name, vpr::Uint16 port) | |
| Create a ConnectionRequest packet to request a remote connection. | |
| void | serialize () |
| Serializes member variables into a data stream. | |
| virtual void | parse (vpr::BufferObjectReader *reader) |
| Parses the data stream into the local member variables. | |
| virtual void | printData (int debug_level) |
| Print the data to the screen in a readable form. | |
| std::string | getHostname () |
| Return the hostname of the machine requesting the connection. | |
| vpr::Uint16 | getPort () |
| Return the port that the requesting machine is listening on. | |
Static Public Member Functions | |
| static vpr::Uint16 | getPacketFactoryType () |
| Return the type of this packet. | |
Definition at line 53 of file ConnectionRequest.h.
| cluster::ConnectionRequest::ConnectionRequest | ( | ) | [inline] |
| cluster::ConnectionRequest::ConnectionRequest | ( | std::string | host_name, | |
| vpr::Uint16 | port | |||
| ) |
Create a ConnectionRequest packet to request a remote connection.
| host_name | Hostname of the machine requesting the connection. | |
| port | Port that the requesting machine is listening on. |
Definition at line 41 of file ConnectionRequest.cpp.
References cluster::Packet::mHeader, cluster::Header::RIM_CONNECTION_REQ, cluster::Header::RIM_PACKET, cluster::Header::RIM_PACKET_HEAD_SIZE, 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 + vpr::BufferObjectReader::STRING_LENGTH_SIZE 00052 + mHostname.size() 00053 + 2 /*mPort*/ 00054 ,0/*Field not curently used*/); 00055 // Serialize the given data. 00056 serialize(); 00057 }
| void cluster::ConnectionRequest::serialize | ( | ) |
Serializes member variables into a data stream.
Definition at line 59 of file ConnectionRequest.cpp.
References cluster::Packet::mHeader, cluster::Packet::mPacketWriter, and cluster::Header::serializeHeader().
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 }
| void cluster::ConnectionRequest::parse | ( | vpr::BufferObjectReader * | reader | ) | [virtual] |
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 }
| void cluster::ConnectionRequest::printData | ( | int | debug_level | ) | [virtual] |
Print the data to the screen in a readable form.
Implements cluster::Packet.
Definition at line 84 of file ConnectionRequest.cpp.
References gadgetDBG_RIM(), and cluster::Packet::printData().
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 }
| static vpr::Uint16 cluster::ConnectionRequest::getPacketFactoryType | ( | ) | [inline, static] |
Return the type of this packet.
Definition at line 85 of file ConnectionRequest.h.
References cluster::Header::RIM_CONNECTION_REQ.
00086 { 00087 return(Header::RIM_CONNECTION_REQ); 00088 }
| std::string cluster::ConnectionRequest::getHostname | ( | ) | [inline] |
Return the hostname of the machine requesting the connection.
Definition at line 93 of file ConnectionRequest.h.
| vpr::Uint16 cluster::ConnectionRequest::getPort | ( | ) | [inline] |
Return the port that the requesting machine is listening on.
Definition at line 101 of file ConnectionRequest.h.
1.5.1