Public Member Functions | Static Public Attributes | Static Protected Member Functions | Protected Attributes

JAUS::TransportManager Class Reference

The TransportManager manages all JAUS transport layer communications (JUDP/JTCP) so that multiple components can communicate on the same host PC without needing to reserve the JAUS port. More...

#include <transportmanager.h>

List of all members.

Public Member Functions

 TransportManager ()
 Constructor.
virtual ~TransportManager ()
 Destructor.
bool IsInitialized () const
virtual bool LoadSettings (const std::string &filename)
 Loads UDP configuration values from an XML file. Only loads values if transport has not been initialized.
virtual bool Initialize ()
 Initializes the transport manager.
virtual void Shutdown ()
 Shutsdown the transport manager.
virtual void CheckServiceStatus (const unsigned int timeSinceLastCheckMs)
 Checks to see if any connections need to be closed out.
void ProcessPacket (Packet &packet, Header &header, const IP4Address &ipAddress, const unsigned short sourcePort, const int transport)
 Process a packet received by a transport medium. This will route the packet to the appropriate destination.
virtual void EnableDebugMessages (const bool on)
bool AddConnection (const IP4Address &networkIP, const Address &jausID)
 Adds to the list of JAUS and network address to try and create connections to using UDP or TCP. Method can only be called before initialization, and will only have an affect if this transport manager is active.
unsigned int GetNumLocalClients () const

Static Public Attributes

static const int TCP = 0
static const int UDP = 1
static const int Serial = 2

Static Protected Member Functions

static void TcpListenThread (void *args)
 Listens for TCP connections.
static void UdpReceiveThread (void *args)
 Thread for UDP receiving.

Protected Attributes

bool mUseTcpFlag
 If true, TCP is chosen over UDP for making connections.
IP4Address mHostIP
 Host IP Address to use.
Mutex mDebugMessagesMutex
 Mutex to lock console for message display.
volatile bool mDebugMessagesFlag
 If true, show debugging messages.
unsigned int mDelayTimeMs
 Delay time in polling for network/message data.
CxUtils::Mutex mUdpMutex
 Mutex for UDP data.
CxUtils::UdpClient mUdpSocket
 UDP server and multicast/broadcast socket.
unsigned int mMaxPayloadSize
 Maximum payload size.
unsigned char mTimeToLive
 Time to Live TTL for UDP.
CxUtils::IP4Address mMulticastIP
 IP Address for local multicast group.
bool mUseBroadcastingFlag
 If true, broadcasting is enabled over multicast.
Time::Stamp mDisconnectTimeMs
 How long to wait in ms before a connection is closed.
CxUtils::Thread mUdpReceiveThread
 UDP Receving thread.
std::map< Address,
CxUtils::UdpClient * > 
mUdpConnections
 UDP Socket connections made by TransportManager.
std::map< Address, Time::StampmUpdateTimes
 Times when connections were last updated.
Mutex mTcpMutex
 Mutex for thread protection of sockets.
CxUtils::TcpListenSocket mListenSocket
 TCP Listening socket for incomming connections.
CxUtils::Thread mTcpListenThread
 TCP Listening thread.
std::map< Address, JTCP * > mTcpConnections
 TCP connections made from external sources.
std::vector< JTCP * > mUnknownConnections
 Temporary TCP connections.
std::map< Address, IP4AddressmPermanentConnections
 Permanent connections added manually.

Detailed Description

The TransportManager manages all JAUS transport layer communications (JUDP/JTCP) so that multiple components can communicate on the same host PC without needing to reserve the JAUS port.

Definition at line 61 of file transportmanager.h.


Constructor & Destructor Documentation

TransportManager::TransportManager (  )

Constructor.

Definition at line 55 of file transportmanager.cpp.

TransportManager::~TransportManager (  ) [virtual]

Destructor.

Definition at line 73 of file transportmanager.cpp.


Member Function Documentation

bool TransportManager::AddConnection ( const IP4Address networkIP,
const Address jausID 
)

Adds to the list of JAUS and network address to try and create connections to using UDP or TCP. Method can only be called before initialization, and will only have an affect if this transport manager is active.

Parameters:
[in]networkIPNetwork IP address.
[in]jausIDJAUS ID.
Returns:
True if added to list, false otherwise. True does not mean the mean the connection has actually been made.

Definition at line 624 of file transportmanager.cpp.

void TransportManager::CheckServiceStatus ( const unsigned int  timeSinceLastCheckMs ) [virtual]

Checks to see if any connections need to be closed out.

Parameters:
[in]timeSinceLastCheckMsHow many milliseconds that have past since the last time the CheckServiceStatus method was called.

Definition at line 307 of file transportmanager.cpp.

virtual void JAUS::TransportManager::EnableDebugMessages ( const bool  on ) [inline, virtual]

Definition at line 86 of file transportmanager.h.

unsigned int TransportManager::GetNumLocalClients (  ) const
Returns:
Number of local TCP client connections.

Definition at line 641 of file transportmanager.cpp.

bool TransportManager::Initialize (  ) [virtual]

Initializes the transport manager.

Returns:
False on failure, true on success.

Definition at line 179 of file transportmanager.cpp.

bool JAUS::TransportManager::IsInitialized (  ) const [inline]

Definition at line 70 of file transportmanager.h.

bool TransportManager::LoadSettings ( const std::string &  filename ) [virtual]

Loads UDP configuration values from an XML file. Only loads values if transport has not been initialized.

Parameters:
[in]filenameFile containing UDP settings data.
Returns:
True on success, false on failure.

Definition at line 89 of file transportmanager.cpp.

void TransportManager::ProcessPacket ( Packet packet,
Header header,
const IP4Address ipAddress,
const unsigned short  sourcePort,
const int  transport 
)

Process a packet received by a transport medium. This will route the packet to the appropriate destination.

Parameters:
[in]packetJAUS formatted packket which includes transport header and general header data.
[in]headerJAUS general header data for message.
[in]ipAddressIP address of the source of the message.
[in]sourcePortThe source port the data arrived from.
[in]transportThe transport medium the data arrived on.

Definition at line 497 of file transportmanager.cpp.

void TransportManager::Shutdown (  ) [virtual]

Shutsdown the transport manager.

Definition at line 250 of file transportmanager.cpp.

void TransportManager::TcpListenThread ( void *  args ) [static, protected]

Listens for TCP connections.

TCP Listening thread which creates connections to TCP clients.

Definition at line 667 of file transportmanager.cpp.

void TransportManager::UdpReceiveThread ( void *  args ) [static, protected]

Thread for UDP receiving.

UDP Receiving Thread.

Definition at line 721 of file transportmanager.cpp.


Member Data Documentation

volatile bool JAUS::TransportManager::mDebugMessagesFlag [protected]

If true, show debugging messages.

Definition at line 98 of file transportmanager.h.

Mutex to lock console for message display.

Definition at line 97 of file transportmanager.h.

unsigned int JAUS::TransportManager::mDelayTimeMs [protected]

Delay time in polling for network/message data.

Definition at line 99 of file transportmanager.h.

How long to wait in ms before a connection is closed.

Definition at line 107 of file transportmanager.h.

Host IP Address to use.

Definition at line 96 of file transportmanager.h.

CxUtils::TcpListenSocket JAUS::TransportManager::mListenSocket [protected]

TCP Listening socket for incomming connections.

Definition at line 113 of file transportmanager.h.

unsigned int JAUS::TransportManager::mMaxPayloadSize [protected]

Maximum payload size.

Definition at line 103 of file transportmanager.h.

CxUtils::IP4Address JAUS::TransportManager::mMulticastIP [protected]

IP Address for local multicast group.

Definition at line 105 of file transportmanager.h.

Permanent connections added manually.

Definition at line 118 of file transportmanager.h.

TCP connections made from external sources.

Definition at line 115 of file transportmanager.h.

CxUtils::Thread JAUS::TransportManager::mTcpListenThread [protected]

TCP Listening thread.

Definition at line 114 of file transportmanager.h.

Mutex for thread protection of sockets.

Definition at line 112 of file transportmanager.h.

unsigned char JAUS::TransportManager::mTimeToLive [protected]

Time to Live TTL for UDP.

Definition at line 104 of file transportmanager.h.

std::map<Address, CxUtils::UdpClient*> JAUS::TransportManager::mUdpConnections [protected]

UDP Socket connections made by TransportManager.

Definition at line 109 of file transportmanager.h.

CxUtils::Mutex JAUS::TransportManager::mUdpMutex [protected]

Mutex for UDP data.

Definition at line 101 of file transportmanager.h.

CxUtils::Thread JAUS::TransportManager::mUdpReceiveThread [protected]

UDP Receving thread.

Definition at line 108 of file transportmanager.h.

CxUtils::UdpClient JAUS::TransportManager::mUdpSocket [protected]

UDP server and multicast/broadcast socket.

Definition at line 102 of file transportmanager.h.

Temporary TCP connections.

Definition at line 116 of file transportmanager.h.

Times when connections were last updated.

Definition at line 110 of file transportmanager.h.

If true, broadcasting is enabled over multicast.

Definition at line 106 of file transportmanager.h.

If true, TCP is chosen over UDP for making connections.

Definition at line 95 of file transportmanager.h.

const int JAUS::TransportManager::Serial = 2 [static]

Definition at line 66 of file transportmanager.h.

const int JAUS::TransportManager::TCP = 0 [static]

Definition at line 64 of file transportmanager.h.

const int JAUS::TransportManager::UDP = 1 [static]

Definition at line 65 of file transportmanager.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines