#include <PollApplLayer.h>
Inherits ClientApplLayer.
Inheritance diagram for PollApplLayer:
Public Member Functions | |
Module_Class_Members (PollApplLayer, ClientApplLayer, 0) | |
virtual void | initialize (int) |
Initialite module parameters. | |
virtual void | finish () |
Protected Types | |
typedef std::map< int, bool > | cAliveMap |
typedef std::map< int, int > | cNetwAddrMap |
typedef cAliveMap::iterator | cAliveMapIterator |
Protected Member Functions | |
virtual void | handleLowerMsg (cMessage *) |
Handle messages from lower layer... | |
virtual void | handleSelfMsg (cMessage *) |
Handle self messages such as timer... | |
void | sendBroadcast () |
Send a broadcast packet to all connected neighbors. | |
void | sendPoll (int) |
Send a poll message to 'addr'. | |
void | pollNext () |
Poll next client in the list. | |
Protected Attributes | |
int | numClients |
Number of clients in the network. | |
int | aliveClients |
Number of alive clients in the network. | |
double | broadcastInterval |
Time between broadcasts in seconds. | |
double | pollTimeout |
Timeout for poll messages in seconds. | |
cAliveMap | clients |
Map to store all reachable clients. | |
cNetwAddrMap | clientAddrs |
Map to store the netw addresses o fthe clients. | |
cAliveMapIterator | it |
Iterator for the clients map. | |
cMessage * | pollTimer |
Timer message for polling. |
Application layer for a base station in a centralized WLAN-like network. Every 'broadcastInterval' it broadcasts a ping message to determine the reachable clients. Afterwards it polls all reachable clients in a round-robin manner, where 'pollTimeout' is the reply timeout for the clients.
|
Handle messages from lower layer... There are two kinds of messages that can arrive at this module: The first (kind = BROADCAST_REPLY_MESSAGE) is a reply to a broadcast packet that we have sent and results in an update of the clients list. The second (kind = POLL_REPLY) is a reply to a poll packet that we have sent. The pollTimer has to be deleted and the next client can be polled. Reimplemented from ClientApplLayer. |
|
Handle self messages such as timer... A timer with kind = SEND_BROADCAST_TIMER indicates that a new broadcast has to be send (sendBroadcast). kind = POLL_REPLY_TIMEOUT invalidates the client entry, and for now just prints debug output and calls pollNext to poll the next client in the list. kind = BROADCAST_REPLY_TIMEOUT indicates the end of the broadcast period and starts the polling period.
Reimplemented from BasicApplLayer. |
|
Initialite module parameters. Read ned parameters and schedule first broadcast timer Reimplemented from BasicApplLayer. |
|
Poll next client in the list. Poll the next reachable client in the list. If there are no more clients, just return. |
|
Send a broadcast packet to all connected neighbors. This function creates a new broadcast message and sends it down to the network layer |
|
Send a poll message to 'addr'. This function creates a new poll message to poll 'addr' and sends it down to the network layer
|