Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

cluster::ConnectionRequest Class Reference

#include <ConnectionRequest.h>

Inheritance diagram for cluster::ConnectionRequest:

Inheritance graph
[legend]
Collaboration diagram for cluster::ConnectionRequest:

Collaboration graph
[legend]
List of all members.

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...


Constructor & Destructor Documentation

cluster::ConnectionRequest::ConnectionRequest   [inline]
 

Definition at line 52 of file ConnectionRequest.h.

00053    {;}

cluster::ConnectionRequest::ConnectionRequest std::string    host_name,
vpr::Uint16    port
 

Create a ConnectionRequest packet to request a remote connection.

Parameters:
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, 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    }


Member Function Documentation

void cluster::ConnectionRequest::serialize  
 

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    }

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.

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    }

vpr::Uint16 cluster::ConnectionRequest::getPacketFactoryType   [inline, static]
 

Return the type of this packet.

Definition at line 81 of file ConnectionRequest.h.

00082    {
00083        return(Header::RIM_CONNECTION_REQ);
00084    }

std::string cluster::ConnectionRequest::getHostname   [inline]
 

Return the hostname of the machine requesting the connection.

Definition at line 89 of file ConnectionRequest.h.

00089 { return mHostname; }

vpr::Uint16 cluster::ConnectionRequest::getPort   [inline]
 

Return the port that the requesting machine is listening on.

Definition at line 94 of file ConnectionRequest.h.

00094 { return mPort; }


The documentation for this class was generated from the following files:
Generated on Sun May 2 14:26:45 2004 for Gadgeteer by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002