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

cluster::ConnectionAck Class Reference

#include <ConnectionAck.h>

Inheritance diagram for cluster::ConnectionAck:

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

Collaboration graph
[legend]
List of all members.

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


Constructor & Destructor Documentation

cluster::ConnectionAck::ConnectionAck   [inline]
 

Definition at line 51 of file ConnectionAck.h.

00052       {;}

cluster::ConnectionAck::ConnectionAck std::string    host_name,
vpr::Uint16    port,
bool    ack
 

Create a ConnectionAck packet to acknowledge a ConnectionRequest.

Parameters:
host_name  -The hostname of the machine that is acknowledging the connection.
port  -The port that the acknowledging machine is listening on.
ack  -Boolean determining if this is a positive(ACK) or a negative(NACK) responce.

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    }


Member Function Documentation

void cluster::ConnectionAck::serialize  
 

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    }

void cluster::ConnectionAck::parse vpr::BufferObjectReader *    reader [virtual]
 

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    }

void cluster::ConnectionAck::printData int    debug_level [virtual]
 

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    }

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

Return the type of this packet.

Definition at line 81 of file ConnectionAck.h.

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

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

Return the hostname of the machine that is acknowledging the connection.

Definition at line 89 of file ConnectionAck.h.

00089 { return mHostname;}

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

Return the port that the acknowledging machine is listening on.

Definition at line 94 of file ConnectionAck.h.

00094 { return mPort;}

bool cluster::ConnectionAck::getAck   [inline]
 

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;}


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