ros::TransportUDP Class Reference

UDPROS transport. More...

#include <transport_udp.h>

Inheritance diagram for ros::TransportUDP:
Inheritance graph
[legend]

List of all members.

Public Types

enum  Flags { SYNCHRONOUS = 1<<0 }

Public Member Functions

virtual void close ()
 Close this transport. Once this call has returned, writing on this transport should always return an error.
bool connect (const std::string &host, int port, int conn_id)
 Connect to a remote host.
bool createIncoming (int port, bool is_server)
 Start a server socket and listen on a port.
TransportUDPPtr createOutgoing (std::string host, int port, int conn_id, int max_datagram_size)
 Create a connection to a server socket.
virtual void disableRead ()
 Disable reading on this transport. Allows derived classes to, for example, disable read polling for asynchronous sockets.
virtual void disableWrite ()
 Disable writing on this transport. Allows derived classes to, for example, disable write polling for asynchronous sockets.
virtual void enableRead ()
 Enable reading on this transport. Allows derived classes to, for example, enable read polling for asynchronous sockets.
virtual void enableWrite ()
 Enable writing on this transport. Allows derived classes to, for example, enable write polling for asynchronous sockets.
std::string getClientURI ()
 Returns the URI of the remote host.
int getMaxDatagramSize () const
int getServerPort () const
 Returns the port this transport is listening on.
virtual std::string getTransportInfo ()
 Returns a string description of both the type of transport and who the transport is connected to.
virtual const char * getType ()
 Return a string that details the type of transport (Eg. TCPROS).
virtual int32_t read (uint8_t *buffer, uint32_t size)
 Read a number of bytes into the supplied buffer. Not guaranteed to actually read that number of bytes.
virtual bool requiresHeader ()
 Returns a boolean to indicate if the transport mechanism is reliable or not.
 TransportUDP (PollSet *poll_set, int flags=0, int max_datagram_size=0)
virtual int32_t write (uint8_t *buffer, uint32_t size)
 Write a number of bytes from the supplied buffer. Not guaranteed to actually write that number of bytes.
virtual ~TransportUDP ()

Private Member Functions

bool initializeSocket ()
 Initializes the assigned socket -- sets it to non-blocking and enables reading.
bool setSocket (int sock)
 Set the socket to be used by this transport.
void socketUpdate (int events)

Private Attributes

std::string cached_remote_host_
boost::mutex close_mutex_
bool closed_
uint32_t connection_id_
uint8_t current_message_id_
uint8_t * data_buffer_
uint32_t data_filled_
uint8_t * data_start_
bool expecting_read_
bool expecting_write_
int flags_
bool is_server_
uint16_t last_block_
uint32_t max_datagram_size_
PollSetpoll_set_
uint8_t * reorder_buffer_
uint32_t reorder_bytes_
TransportUDPHeader reorder_header_
uint8_t * reorder_start_
sockaddr_in server_address_
int server_port_
int sock_
uint16_t total_blocks_

Detailed Description

UDPROS transport.

Definition at line 67 of file transport_udp.h.


Member Enumeration Documentation

Enumerator:
SYNCHRONOUS 

Definition at line 70 of file transport_udp.h.


Constructor & Destructor Documentation

ros::TransportUDP::TransportUDP ( PollSet poll_set,
int  flags = 0,
int  max_datagram_size = 0 
)

Definition at line 53 of file transport_udp.cpp.

ros::TransportUDP::~TransportUDP (  )  [virtual]

Definition at line 80 of file transport_udp.cpp.


Member Function Documentation

void ros::TransportUDP::close (  )  [virtual]

Close this transport. Once this call has returned, writing on this transport should always return an error.

Implements ros::Transport.

Definition at line 271 of file transport_udp.cpp.

bool ros::TransportUDP::connect ( const std::string &  host,
int  port,
int  conn_id 
)

Connect to a remote host.

Parameters:
host The hostname/IP to connect to
port The port to connect to
Returns:
Whether or not the connection was successful

Definition at line 137 of file transport_udp.cpp.

bool ros::TransportUDP::createIncoming ( int  port,
bool  is_server 
)

Start a server socket and listen on a port.

Parameters:
port The port to listen on

Definition at line 210 of file transport_udp.cpp.

TransportUDPPtr ros::TransportUDP::createOutgoing ( std::string  host,
int  port,
int  conn_id,
int  max_datagram_size 
)

Create a connection to a server socket.

Definition at line 614 of file transport_udp.cpp.

void ros::TransportUDP::disableRead (  )  [virtual]

Disable reading on this transport. Allows derived classes to, for example, disable read polling for asynchronous sockets.

Implements ros::Transport.

Definition at line 558 of file transport_udp.cpp.

void ros::TransportUDP::disableWrite (  )  [virtual]

Disable writing on this transport. Allows derived classes to, for example, disable write polling for asynchronous sockets.

Implements ros::Transport.

Definition at line 596 of file transport_udp.cpp.

void ros::TransportUDP::enableRead (  )  [virtual]

Enable reading on this transport. Allows derived classes to, for example, enable read polling for asynchronous sockets.

Implements ros::Transport.

Definition at line 540 of file transport_udp.cpp.

void ros::TransportUDP::enableWrite (  )  [virtual]

Enable writing on this transport. Allows derived classes to, for example, enable write polling for asynchronous sockets.

Implements ros::Transport.

Definition at line 578 of file transport_udp.cpp.

std::string ros::TransportUDP::getClientURI (  ) 

Returns the URI of the remote host.

int ros::TransportUDP::getMaxDatagramSize (  )  const [inline]

Definition at line 122 of file transport_udp.h.

int ros::TransportUDP::getServerPort (  )  const [inline]

Returns the port this transport is listening on.

Definition at line 103 of file transport_udp.h.

std::string ros::TransportUDP::getTransportInfo (  )  [virtual]

Returns a string description of both the type of transport and who the transport is connected to.

Implements ros::Transport.

Definition at line 132 of file transport_udp.cpp.

virtual const char* ros::TransportUDP::getType (  )  [inline, virtual]

Return a string that details the type of transport (Eg. TCPROS).

Returns:
The stringified transport type

Implements ros::Transport.

Definition at line 120 of file transport_udp.h.

bool ros::TransportUDP::initializeSocket (  )  [private]

Initializes the assigned socket -- sets it to non-blocking and enables reading.

Definition at line 246 of file transport_udp.cpp.

int32_t ros::TransportUDP::read ( uint8_t *  buffer,
uint32_t  size 
) [virtual]

Read a number of bytes into the supplied buffer. Not guaranteed to actually read that number of bytes.

Parameters:
buffer Buffer to read from
size Size, in bytes, to read
Returns:
The number of bytes actually read, or -1 if there was an error

Implements ros::Transport.

Definition at line 315 of file transport_udp.cpp.

virtual bool ros::TransportUDP::requiresHeader (  )  [inline, virtual]

Returns a boolean to indicate if the transport mechanism is reliable or not.

Reimplemented from ros::Transport.

Definition at line 118 of file transport_udp.h.

bool ros::TransportUDP::setSocket ( int  sock  )  [private]

Set the socket to be used by this transport.

Parameters:
sock A valid UDP socket
Returns:
Whether setting the socket was successful

Definition at line 87 of file transport_udp.cpp.

void ros::TransportUDP::socketUpdate ( int  events  )  [private]

Definition at line 93 of file transport_udp.cpp.

int32_t ros::TransportUDP::write ( uint8_t *  buffer,
uint32_t  size 
) [virtual]

Write a number of bytes from the supplied buffer. Not guaranteed to actually write that number of bytes.

Parameters:
buffer Buffer to write from
size Size, in bytes, to write
Returns:
The number of bytes actually written, or -1 if there was an error

Implements ros::Transport.

Definition at line 468 of file transport_udp.cpp.


Member Data Documentation

Definition at line 150 of file transport_udp.h.

boost::mutex ros::TransportUDP::close_mutex_ [private]

Definition at line 141 of file transport_udp.h.

Definition at line 140 of file transport_udp.h.

Definition at line 155 of file transport_udp.h.

Definition at line 156 of file transport_udp.h.

uint8_t* ros::TransportUDP::data_buffer_ [private]

Definition at line 162 of file transport_udp.h.

uint32_t ros::TransportUDP::data_filled_ [private]

Definition at line 164 of file transport_udp.h.

uint8_t* ros::TransportUDP::data_start_ [private]

Definition at line 163 of file transport_udp.h.

Definition at line 143 of file transport_udp.h.

Definition at line 144 of file transport_udp.h.

Definition at line 153 of file transport_udp.h.

Definition at line 146 of file transport_udp.h.

uint16_t ros::TransportUDP::last_block_ [private]

Definition at line 158 of file transport_udp.h.

Definition at line 160 of file transport_udp.h.

Definition at line 152 of file transport_udp.h.

Definition at line 166 of file transport_udp.h.

Definition at line 169 of file transport_udp.h.

Definition at line 168 of file transport_udp.h.

Definition at line 167 of file transport_udp.h.

sockaddr_in ros::TransportUDP::server_address_ [private]

Definition at line 147 of file transport_udp.h.

Definition at line 148 of file transport_udp.h.

int ros::TransportUDP::sock_ [private]

Definition at line 139 of file transport_udp.h.

Definition at line 157 of file transport_udp.h.


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


roscpp
Author(s): Morgan Quigley mquigley@cs.stanford.edu, Josh Faust jfaust@willowgarage.com, Brian Gerkey gerkey@willowgarage.com
autogenerated on Fri Jan 11 10:08:42 2013