Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

DCDT_Finder Class Reference

This is the system member that discover and talk with others Agora. More...

#include <DCDT_Finder.h>

Inheritance diagram for DCDT_Finder:

DCDT_Member List of all members.

Public Member Functions

 DCDT_Finder (DCDT_Agora *agora, FinderData *fd)
 ~DCDT_Finder ()
void Init ()
 Initialize dynamic and static channels data structures.
CommDataCreateLink (int r_id, int status, CommData *l_cd, CommData *r_cd, unsigned int profile)
 Create a new LinkRx system member and active it.
void SetLinkStatus (int LinkID, int LinkStatus)
void SetLinkRemoteAgoraID (int LinkID, int id)
int IsPresent (int id)
 Check if there is link to the 'id' agora.
int GetFirstFreeLinkTableSlot ()
void DeleteLinkTableSlot (int LinkID)
int ActivateLink (DCDT_LinkRx *)
void CloseLink (int id)
void DoYourJob (int par=0)

Private Member Functions

void StaticLinks ()
 Initialize data structures for static channels and open the communications channels needed.
.

Private Attributes

FinderDatafinder_data
DCDT_LinkTableElem LinkTable [MAXLINKS]
DCDT_TIME old_ts
DCDT_TIME passed
DCDT_TIME start_ts
 Finder start time.
DCDT_TIME new_ts
 Finder actual time.
DCDT_TIME notify_ts
 When the last notify ( HS ) message was sent.
bool starting_timer
bool linked
bool received
 Flag: true -> something was received in the current Finder cycle.
short port
int remote_AgoraID
char from [INET_ADDRSTRLEN]
CommDatalocalCD
 Interface via which the messages was received.
CommDataremoteCD
 Source address informations for the received message.
HSMsgHeaderhs_header
 Header of the message that the Finder is processing.
int linknum
int i
ChannelTableElem dynamic_channels [MAXCHANNELS]

Detailed Description

This is the system member that discover and talk with others Agora.

The finder is responsable of the communications links with the external world, outside the local machine. It tries to establish static communications links with external agora defined in the configuration file and waits for communications on the multicast port to find others agora on the local network.

Definition at line 53 of file DCDT_Finder.h.


Constructor & Destructor Documentation

DCDT_Finder::DCDT_Finder DCDT_Agora agora,
FinderData fd
 

Definition at line 35 of file DCDT_Finder.cpp.

References _ChannelTableElem::active, _ChannelTableElem::channel, DeleteLinkTableSlot(), dynamic_channels, finder_data, FinderData, GetTime(), hs_header, i, localCD, passed, remoteCD, and starting_timer.

DCDT_Finder::~DCDT_Finder  ) 
 

Definition at line 54 of file DCDT_Finder.cpp.

References _ChannelTableElem::channel, dynamic_channels, finder_data, and _FinderData::fp.


Member Function Documentation

int DCDT_Finder::ActivateLink DCDT_LinkRx  ) 
 

void DCDT_Finder::CloseLink int  id  ) 
 

Definition at line 315 of file DCDT_Finder.cpp.

References DCDT_TRC_COMM, DeleteLinkTableSlot(), LinkTable, DCDT_Agora::RemoveMember(), and TRC_PRINT.

Referenced by DCDT_LinkRx::DoYourJob().

CommData * DCDT_Finder::CreateLink int  r_id,
int  status,
CommData l_cd,
CommData r_cd,
unsigned int  profile
 

Create a new LinkRx system member and active it.

Definition at line 287 of file DCDT_Finder.cpp.

References DCDT_Agora::ActivateMember(), DCDT_Agora::AddSysMember(), DCDT_TRC_COMM, GetFirstFreeLinkTableSlot(), _DCDT_LinkTableElem::LinkPtr, LinkTable, DCDT_LinkRx::Prepare(), and TRC_PRINT.

Referenced by DoYourJob().

void DCDT_Finder::DeleteLinkTableSlot int  LinkID  )  [inline]
 

Definition at line 138 of file DCDT_Finder.h.

References _DCDT_LinkTableElem::freeSlot, LinkTable, DCDT_Mutex::lock(), _DCDT_LinkTableElem::mtx, and DCDT_Mutex::unlock().

Referenced by CloseLink(), and DCDT_Finder().

void DCDT_Finder::DoYourJob int  par = 0  )  [virtual]
 

Implements DCDT_Member.

Definition at line 124 of file DCDT_Finder.cpp.

References _ChannelTableElem::active, _HSMsgHeader::AgoraID, _HSMsgHeader::channel, _ChannelTableElem::channel, ChannelTableElem, DCDT_Channel::ChooseChannel(), CreateLink(), DCDT_TRC_COMM, Delay(), dynamic_channels, FINDER_PERIOD, DCDT_Channel::GetStartingCD(), GetTime(), HS_ANSWER, hs_header, HS_NOTIFY, i, IsPresent(), L_CONNECTING, L_LOST, L_RESETTOCONN, L_WAITING, linked, linknum, _DCDT_LinkTableElem::LinkPtr, LinkTable, localCD, new_ts, notify_ts, old_ts, passed, DCDT_Channel::ReadStartingProfile(), DCDT_LinkRx::ReadStatus(), received, DCDT_Channel::ReceiveHS(), remoteCD, DCDT_LinkRx::ResetToConnecting(), DCDT_LinkRx::Restart(), DCDT_Channel::SendAnswer(), DCDT_Channel::SendNotify(), starting_timer, TRC_PRINT, and _HSMsgHeader::type.

int DCDT_Finder::GetFirstFreeLinkTableSlot  )  [inline]
 

Definition at line 124 of file DCDT_Finder.h.

References _DCDT_LinkTableElem::freeSlot, i, LinkTable, DCDT_Mutex::lock(), _DCDT_LinkTableElem::mtx, and DCDT_Mutex::unlock().

Referenced by CreateLink().

void DCDT_Finder::Init  )  [virtual]
 

Initialize dynamic and static channels data structures.

The dynamic channel ( channel 0 ) is the multicast channel used to talk with others Agora connected to the local network.
If there are static links delay the initialization of the dynamic channel of STARTING_TIMER_VAL microseconds; the last action is to send an HS_NOTIFY message throught all the active channels.

Reimplemented from DCDT_Member.

Definition at line 76 of file DCDT_Finder.cpp.

References _ChannelTableElem::active, _ChannelTableElem::channel, _ChannelTableElem::dynamic, dynamic_channels, finder_data, GetTime(), i, _FinderData::IfNumAddr, _FinderData::McNumAddr, _FinderData::McPort, notify_ts, old_ts, DCDT_Channel::SendNotify(), start_ts, and StaticLinks().

int DCDT_Finder::IsPresent int  id  ) 
 

Check if there is link to the 'id' agora.

Definition at line 305 of file DCDT_Finder.cpp.

References _DCDT_LinkTableElem::freeSlot, i, _DCDT_LinkTableElem::LinkPtr, LinkTable, and DCDT_LinkRx::ReadRemoteID().

Referenced by DoYourJob().

void DCDT_Finder::SetLinkRemoteAgoraID int  LinkID,
int  id
[inline]
 

Definition at line 119 of file DCDT_Finder.h.

References LinkTable, and _DCDT_LinkTableElem::remoteID.

void DCDT_Finder::SetLinkStatus int  LinkID,
int  LinkStatus
[inline]
 

Definition at line 114 of file DCDT_Finder.h.

References LinkTable, and _DCDT_LinkTableElem::status.

void DCDT_Finder::StaticLinks  )  [private]
 

Initialize data structures for static channels and open the communications channels needed.
.

For IP channel open a socket and bind it to the address written in the configuration file.
Set starting_timer to true if at least a static channel was successfully opened.

Exceptions:
Exception Error reding the configuration file

Definition at line 330 of file DCDT_Finder.cpp.

References _ChannelTableElem::active, _ChannelTableElem::channel, DCDT_TRC_COMM, _ChannelTableElem::dynamic, dynamic_channels, finder_data, _FinderData::fp, starting_timer, and TRC_PRINT.

Referenced by Init().


Member Data Documentation

ChannelTableElem DCDT_Finder::dynamic_channels[MAXCHANNELS] [private]
 

Definition at line 110 of file DCDT_Finder.h.

Referenced by DCDT_Finder(), DoYourJob(), Init(), StaticLinks(), and ~DCDT_Finder().

FinderData* DCDT_Finder::finder_data [private]
 

Definition at line 77 of file DCDT_Finder.h.

Referenced by DCDT_Finder(), Init(), StaticLinks(), and ~DCDT_Finder().

char DCDT_Finder::from[INET_ADDRSTRLEN] [private]
 

Definition at line 98 of file DCDT_Finder.h.

HSMsgHeader* DCDT_Finder::hs_header [private]
 

Header of the message that the Finder is processing.

Definition at line 108 of file DCDT_Finder.h.

Referenced by DCDT_Finder(), and DoYourJob().

int DCDT_Finder::i [private]
 

Definition at line 109 of file DCDT_Finder.h.

Referenced by DCDT_Finder(), DoYourJob(), GetFirstFreeLinkTableSlot(), Init(), and IsPresent().

bool DCDT_Finder::linked [private]
 

Definition at line 93 of file DCDT_Finder.h.

Referenced by DoYourJob().

int DCDT_Finder::linknum [private]
 

Definition at line 109 of file DCDT_Finder.h.

Referenced by DoYourJob().

DCDT_LinkTableElem DCDT_Finder::LinkTable[MAXLINKS] [private]
 

Definition at line 78 of file DCDT_Finder.h.

Referenced by CloseLink(), CreateLink(), DeleteLinkTableSlot(), DoYourJob(), GetFirstFreeLinkTableSlot(), IsPresent(), SetLinkRemoteAgoraID(), and SetLinkStatus().

CommData* DCDT_Finder::localCD [private]
 

Interface via which the messages was received.

Definition at line 103 of file DCDT_Finder.h.

Referenced by DCDT_Finder(), and DoYourJob().

DCDT_TIME DCDT_Finder::new_ts [private]
 

Finder actual time.

Definition at line 86 of file DCDT_Finder.h.

Referenced by DoYourJob().

DCDT_TIME DCDT_Finder::notify_ts [private]
 

When the last notify ( HS ) message was sent.

Definition at line 86 of file DCDT_Finder.h.

Referenced by DoYourJob(), and Init().

DCDT_TIME DCDT_Finder::old_ts [private]
 

Definition at line 82 of file DCDT_Finder.h.

Referenced by DoYourJob(), and Init().

DCDT_TIME DCDT_Finder::passed [private]
 

Definition at line 82 of file DCDT_Finder.h.

Referenced by DCDT_Finder(), and DoYourJob().

short DCDT_Finder::port [private]
 

Definition at line 96 of file DCDT_Finder.h.

bool DCDT_Finder::received [private]
 

Flag: true -> something was received in the current Finder cycle.

Definition at line 93 of file DCDT_Finder.h.

Referenced by DoYourJob().

int DCDT_Finder::remote_AgoraID [private]
 

Definition at line 97 of file DCDT_Finder.h.

CommData * DCDT_Finder::remoteCD [private]
 

Source address informations for the received message.

Definition at line 103 of file DCDT_Finder.h.

Referenced by DCDT_Finder(), and DoYourJob().

DCDT_TIME DCDT_Finder::start_ts [private]
 

Finder start time.

Definition at line 86 of file DCDT_Finder.h.

Referenced by Init().

bool DCDT_Finder::starting_timer [private]
 

Definition at line 92 of file DCDT_Finder.h.

Referenced by DCDT_Finder(), DoYourJob(), and StaticLinks().


The documentation for this class was generated from the following files:
Generated on Sun Jun 19 10:35:51 2005 for dcdt by  doxygen 1.3.9.1