In file /home/eternity/Source/Common/Receiver/H/receiver.h:

class Receiver : public Runable, public Shutdownable

Message receiver

Inheritance:

Receiver < Runable < Debugable

Receiver < Shutdownable


Public Methods

Receiver::Receiver ( ConfigFile * receiverConfigFile, LogFile * receiverLogFile, Killer * killer, MessageQueue * fromReceiver, string origin, u_short portWhereToListen)
Generic receiver constructor
void Receiver::RequestServant (int sockIn)
Receive one message from network
void* Receiver::Run ( void *)
Main receiver method
void Receiver::Shutdown ()
Prepare for clean shut down
Receiver::~Receiver ()
Generic receiver destructor

Public

methods
Receiver (ConfigFile * receiverConfigFile, LogFile * receiverLogFile, Killer * killer, MessageQueue * fromReceiver, string origin, u_short port)
Constructor
~Receiver ()
Destructor
void* Run ( void *info)
Thread method
void RequestServant (int sockIn)
Handles one message
virtual void Shutdown ()
Prepare for shutdown

Protected

attributes
string origin
What to insert into message
ConfigFile* configFile
Configuration file
MessageQueue* fromReceiverQueue
Outgoing message queue
u_short port
Port where to listen
int receiverType
Type of receiver

Inherited from Runable:

Public Methods

void Runable::MaskAllSignals()
Runable::Runable(LogFile * logFile)

Inherited from Debugable:

Public Methods

string* Debugable::CreateString(char *firstStr, int firstInt, int secondInt)
Debugable::Debugable(LogFile * debugLogFile)
int Debugable::SetDebugOptions(int newLogOptions)
void Debugable::SetLogFile(LogFile *aLogFile)
void Debugable::WriteString(LogLevel debugLevel, char * format, ...)
Debugable::~Debugable()

Inherited from Shutdownable:

Public Methods

Shutdownable::Shutdownable(Killer * killer)

Documentation

Message receiver. a class for receiver, it is a object that is responsible for accepting messages from the Net and passing it to Translator.
In:
byte stream from network
Out:
GMessage containing
GM_DEBUG
GM_PROTOCOL_VERSION
GM_REST_OF_PATH
GM_DATA
GM_RECIPIENT
attributes

string origin
What to insert into message

ConfigFile* configFile
Configuration file

MessageQueue* fromReceiverQueue
Outgoing message queue

u_short port
Port where to listen

int receiverType
Type of receiver

methods

Receiver(ConfigFile * receiverConfigFile, LogFile * receiverLogFile, Killer * killer, MessageQueue * fromReceiver, string origin, u_short port)
Constructor

~Receiver()
Destructor

void* Run( void *info)
Thread method

void RequestServant(int sockIn)
Handles one message

virtual void Shutdown()
Prepare for shutdown

Receiver::Receiver( ConfigFile * receiverConfigFile, LogFile * receiverLogFile, Killer * killer, MessageQueue * fromReceiver, string origin, u_short portWhereToListen)
Generic receiver constructor. Remembers all the attributes. must get pointer to rcvToTran queue, because this queue is declared in Mix class so Receiver can't see it as we want to be generic.
Parameters:
receiverConfigFile - Configuration file.
receiverLogFile - Log file for debug messages.
killer - Killer objectthat will call us when shutdown occurs.
fromReceiver - Output queue into which to insert received messages.
origin - GM_ORIGIN is set to origin unless it is empty string.
portWhereToListen - Port on which the receiver shoul listen to incomming messages.
Author:
Pechy
See Also:
Sender()

void Receiver::RequestServant(int sockIn)
Receive one message from network. Reads data from the specified socket and allocates memory for it. After this is done it makes a GMessage from it and inserts a field called GM_ORIGIN with value specified in constructor. Then the message is passed to the outgoing queue.
Returns:
void
Parameters:
sockIn - Socket from which we can read tha incoming data.
Author:
Pechy
See Also:
Receiver

void* Receiver::Run( void *)
Main receiver method. this function is the function that is run in thread. It listens on some port and whenever there comes a connection it disptches a new thread that takes care of receiving the whole message and passing it to the next object.
Returns:
(void *)NULL
Author:
Pechy
See Also:
Sender

void Receiver::Shutdown()
Prepare for clean shut down. This method should implement all the tasks necessary for preparation for a clean shutdown like saving inconsistent data to disk etc.
Returns:
void
Author:
Venca
See Also:
Shutdownable, Killer

Receiver::~Receiver()
Generic receiver destructor. Empty for now.
Author:
Pechy
See Also:
Receiver()


This class has no child classes.
Author:
Pechy
See Also:
Sender

alphabetic index hierarchy of classes


generated by doc++