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

JAUS::JUDP Class Reference

Transport is an interface class for sending/receiving UDP packets. This interface coforms to the SAE-JAUS AS5669 Standard. More...

#include <judp.h>

Inheritance diagram for JAUS::JUDP:
JAUS::Transport JAUS::Service

List of all members.

Public Member Functions

 JUDP ()
 Constructor.
 ~JUDP ()
 Destructor.
virtual void SetPacketPollingDelayMs (const unsigned int delayTimeMs=0)
 Sets the delay time between checks for new packets to process by each message processing thread.
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 (const Address &componentID)
 Initializes the Transport Service based on configuration values set.
virtual bool IsInitialized () const
virtual void Shutdown ()
 Shutsdown the Transport.
virtual Address::List GetConnections () const
 Returns a list of connections to other components.
virtual bool HaveConnection (const Address &id) const
virtual bool SendPacket (const Packet &packet, const Header &header, const int broadcastFlags=Service::NoBroadcast) const
 Sends a serialized JAUS packet that has the correct JUDP header setup. If the destination is a local broadcast, then it is sent using multicast, if destination is global, then it is sent using a broadcast socket.
virtual bool SerializeMessage (const Message *message, Packet::List &stream, Header::List &streamHeaders, const UShort startingSequenceNumber, const int broadcastFlags) const
 Converts the message data into JUDP packets for transmission.
virtual Packet GetTransportHeader () const
virtual Address::List GetManualConnections () const
void SetMaxPacketSize (const unsigned int maxSizeBytes=1500)
 Sets the maximum packet size value to use for UDP packets. This value should match the MTU of your network interface. The default value is 1500.
void SetDisconnectTimeMs (const unsigned int timeMs)
 Sets the time in milliseconds used to determine if a connection should be closed. Only closes connection if no data has been received for this time value set.
void SetTTL (const unsigned char ttl=16)
 Sets the TTL for multicast. Only set if Transport is not initialized.
void SetMulticastIP (const CxUtils::IP4Address &multicastIP)
 Sets the address to use for multicast data. Only set if Transport is not initialized.
void EnableBroadcasting (const bool enabled)
 Enable/Disable broadcasting over multicast. Only set if Transport is not initialized.
CxUtils::IP4Address GetMulticastIP () const
void SetInterfaceIP (const CxUtils::IP4Address &networkIP=CxUtils::IP4Address())
 Sets the IP address of the network interface on the host machine to use. Set to blank if any address is fine.
bool AddConnection (const CxUtils::IP4Address &networkIP, const Address &jausID, const unsigned short port=Port)
 Method to add a new connection manually to a component at an IP address.
virtual bool CloseConnection (const Address &jausID)
 Method to disconnect from a component.

Static Public Member Functions

static bool ListenForSubsystems (Address::Set &discovered, const unsigned int waitTimeMs=5000, const CxUtils::IP4Address &multicastIP="239.255.0.1")
 Creates a multicast listening socket to try and discover subsystems on the network for dynamic selection of a component ID.

Static Public Attributes

static const unsigned short Port = 3794
 JAUS UDP/TCP Port Number == "jaus".
static const unsigned int OverheadSizeBytes = 61
 JUDP Overhead in bytes.
static const Byte Version = 0x02
 JUDP Header Version.

Detailed Description

Transport is an interface class for sending/receiving UDP packets. This interface coforms to the SAE-JAUS AS5669 Standard.

Definition at line 56 of file judp.h.


Constructor & Destructor Documentation

JUDP::JUDP (  )

Constructor.

Definition at line 54 of file judp.cpp.

JUDP::~JUDP (  )

Destructor.

Definition at line 72 of file judp.cpp.


Member Function Documentation

bool JUDP::AddConnection ( const CxUtils::IP4Address &  networkIP,
const Address jausID,
const unsigned short  port = Port 
)

Method to add a new connection manually to a component at an IP address.

Parameters:
[in]networkIPIP Address of component.
[in]jausIDJAUS ID of component.
[in]portNetwork port to use (default is 3794).
Returns:
True on success, false on failure.

Definition at line 638 of file judp.cpp.

bool JUDP::CloseConnection ( const Address jausID ) [virtual]

Method to disconnect from a component.

Parameters:
[in]jausIDJAUS ID of component.
Returns:
True on success, false on failure.

Reimplemented from JAUS::Transport.

Definition at line 684 of file judp.cpp.

void JUDP::EnableBroadcasting ( const bool  enabled )

Enable/Disable broadcasting over multicast. Only set if Transport is not initialized.

Parameters:
[in]enabledIf true, broadcasting is turned on.

Definition at line 603 of file judp.cpp.

Address::List JUDP::GetConnections (  ) const [virtual]

Returns a list of connections to other components.

Implements JAUS::Transport.

Definition at line 329 of file judp.cpp.

Address::List JUDP::GetManualConnections (  ) const [virtual]
Returns:
List of manually created connections to JAUS components. These are connections not made through the discovery process and cannot be closed through discovery either (only manually).

Implements JAUS::Transport.

Definition at line 503 of file judp.cpp.

CxUtils::IP4Address JAUS::JUDP::GetMulticastIP (  ) const [inline]

Definition at line 104 of file judp.h.

virtual Packet JAUS::JUDP::GetTransportHeader (  ) const [inline, virtual]

Implements JAUS::Transport.

Definition at line 90 of file judp.h.

bool JUDP::HaveConnection ( const Address id ) const [virtual]
Parameters:
[in]idComponent ID to check connection for.
Returns:
True if a connection to the component exists.

Implements JAUS::Transport.

Definition at line 351 of file judp.cpp.

bool JUDP::Initialize ( const Address componentID ) [virtual]

Initializes the Transport Service based on configuration values set.

Parameters:
[in]componentIDID of the component using the Transport Service.
Returns:
True on success, false on failure.

Implements JAUS::Transport.

Definition at line 183 of file judp.cpp.

bool JUDP::IsInitialized (  ) const [virtual]
Returns:
True if Transport is initialized, otherwise false.

Implements JAUS::Transport.

Definition at line 264 of file judp.cpp.

bool JUDP::ListenForSubsystems ( Address::Set discovered,
const unsigned int  waitTimeMs = 5000,
const CxUtils::IP4Address &  multicastGroup = "239.255.0.1" 
) [static]

Creates a multicast listening socket to try and discover subsystems on the network for dynamic selection of a component ID.

Parameters:
[in]discoveredList of discovered components performing Discovery.
[in]waitTimeMsHow long to listen for.
[in]multicastGroupMulticast group to listen on.
Returns:
True if was able to listen, false on failure to listen.

Definition at line 729 of file judp.cpp.

bool JUDP::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.

Reimplemented from JAUS::Service.

Definition at line 114 of file judp.cpp.

bool JUDP::SendPacket ( const Packet packet,
const Header header,
const int  broadcastFlags = Service::NoBroadcast 
) const [virtual]

Sends a serialized JAUS packet that has the correct JUDP header setup. If the destination is a local broadcast, then it is sent using multicast, if destination is global, then it is sent using a broadcast socket.

Parameters:
[in]packetJUDP Packet to send.
[in]headerJAUS Transport header information.
[in]broadcastFlagsValues to use to signify if message should be sent using any broadcast options (e.g. multicast). 0 = no options, 1/2 = multicast.
Returns:
True on success, false on failure.

Implements JAUS::Transport.

Definition at line 381 of file judp.cpp.

bool JUDP::SerializeMessage ( const Message message,
Packet::List &  stream,
Header::List streamHeaders,
const UShort  startingSequenceNumber,
const int  broadcastFlags 
) const [virtual]

Converts the message data into JUDP packets for transmission.

Parameters:
[in]messageMessage to convert/serialize.
[out]streamPackets to send.
[out]streamHeadersHeader info for packets.
[in]startingSequenceNumberSequence number to use for packets.
[in]broadcastFlagsValues to use to signify if message should be sent using any broadcast options (e.g. multicast). 0 = no options, 1 = local broadcast, 2 = global broadcast.
Returns:
True on success, false on failure.

Implements JAUS::Transport.

Definition at line 460 of file judp.cpp.

void JUDP::SetDisconnectTimeMs ( const unsigned int  timeMs )

Sets the time in milliseconds used to determine if a connection should be closed. Only closes connection if no data has been received for this time value set.

Parameters:
[in]timeMsIf a connection has not updated in this amount of time it is closed.

Definition at line 550 of file judp.cpp.

void JUDP::SetInterfaceIP ( const CxUtils::IP4Address &  networkIP = CxUtils::IP4Address() )

Sets the IP address of the network interface on the host machine to use. Set to blank if any address is fine.

Parameters:
[in]networkIPThe broadcast group to connect to.

Definition at line 617 of file judp.cpp.

void JUDP::SetMaxPacketSize ( const unsigned int  maxSizeBytes = 1500 )

Sets the maximum packet size value to use for UDP packets. This value should match the MTU of your network interface. The default value is 1500.

Parameters:
[in]maxSizeBytesThe maximum packet size for sending over UDP. This should match the MTU of your network interface. Must be greater than OverheadSizeBytes.

Definition at line 531 of file judp.cpp.

void JUDP::SetMulticastIP ( const CxUtils::IP4Address &  multicastIP )

Sets the address to use for multicast data. Only set if Transport is not initialized.

Parameters:
[in]multicastIPThe multicast group to connect to. This is an IP address in the range of "224.0.0.0-239.255.255.255"

Definition at line 586 of file judp.cpp.

void JUDP::SetPacketPollingDelayMs ( const unsigned int  delayTimeMs = 0 ) [virtual]

Sets the delay time between checks for new packets to process by each message processing thread.

The default value is 1 ms, but can be set to 0 for no delay, or larger for less frequent checking of messages (use larger numbers on slower hardware).

Parameters:
[in]delayTimeMsDelay time between checks in milliseconds.

Definition at line 95 of file judp.cpp.

void JUDP::SetTTL ( const unsigned char  ttl = 16 )

Sets the TTL for multicast. Only set if Transport is not initialized.

Parameters:
[in]ttlTime To Live (TTL). Default value is 1, meaning the data only goes as far as the local network, increase to go further out.

Definition at line 568 of file judp.cpp.

void JUDP::Shutdown (  ) [virtual]

Shutsdown the Transport.

Implements JAUS::Transport.

Definition at line 275 of file judp.cpp.


Member Data Documentation

const unsigned int JAUS::JUDP::OverheadSizeBytes = 61 [static]

JUDP Overhead in bytes.

Definition at line 61 of file judp.h.

const unsigned short JAUS::JUDP::Port = 3794 [static]

JAUS UDP/TCP Port Number == "jaus".

Definition at line 60 of file judp.h.

const Byte JAUS::JUDP::Version = 0x02 [static]

JUDP Header Version.

Definition at line 62 of file judp.h.


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