UDPROS transport. More...
#include <transport_udp.h>
Public Types | |
enum | Flags { SYNCHRONOUS = 1<<0 } |
Public Types inherited from ros::Transport | |
typedef boost::function< void(const TransportPtr &)> | Callback |
Public Member Functions | |
virtual void | close () |
Close this transport. Once this call has returned, writing on this transport should always return an error. More... | |
bool | connect (const std::string &host, int port, int conn_id) |
Connect to a remote host. More... | |
bool | createIncoming (int port, bool is_server) |
Start a server socket and listen on a port. More... | |
TransportUDPPtr | createOutgoing (std::string host, int port, int conn_id, int max_datagram_size) |
Create a connection to a server socket. More... | |
virtual void | disableRead () |
Disable reading on this transport. Allows derived classes to, for example, disable read polling for asynchronous sockets. More... | |
virtual void | disableWrite () |
Disable writing on this transport. Allows derived classes to, for example, disable write polling for asynchronous sockets. More... | |
virtual void | enableRead () |
Enable reading on this transport. Allows derived classes to, for example, enable read polling for asynchronous sockets. More... | |
virtual void | enableWrite () |
Enable writing on this transport. Allows derived classes to, for example, enable write polling for asynchronous sockets. More... | |
std::string | getClientURI () |
Returns the URI of the remote host. More... | |
int | getMaxDatagramSize () const |
int | getServerPort () const |
Returns the port this transport is listening on. More... | |
virtual std::string | getTransportInfo () |
Returns a string description of both the type of transport and who the transport is connected to. More... | |
virtual const char * | getType () |
Return a string that details the type of transport (Eg. TCPROS) More... | |
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. More... | |
virtual bool | requiresHeader () |
Returns a boolean to indicate if the transport mechanism is reliable or not. More... | |
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. More... | |
virtual | ~TransportUDP () |
Public Member Functions inherited from ros::Transport | |
virtual void | parseHeader (const Header &header) |
Provides an opportunity for transport-specific options to come in through the header. More... | |
void | setDisconnectCallback (const Callback &cb) |
Set the function to call when this transport has disconnected, either through a call to close(). Or a disconnect from the remote host. More... | |
void | setReadCallback (const Callback &cb) |
Set the function to call when there is data available to be read by this transport. More... | |
void | setWriteCallback (const Callback &cb) |
Set the function to call when there is space available to write on this transport. More... | |
Transport () | |
virtual | ~Transport () |
Private Member Functions | |
bool | initializeSocket () |
Initializes the assigned socket – sets it to non-blocking and enables reading. More... | |
bool | setSocket (int sock) |
Set the socket to be used by this transport. More... | |
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_ |
sockaddr_in | local_address_ |
int | local_port_ |
uint32_t | max_datagram_size_ |
PollSet * | poll_set_ |
uint8_t * | reorder_buffer_ |
uint32_t | reorder_bytes_ |
TransportUDPHeader | reorder_header_ |
uint8_t * | reorder_start_ |
sockaddr_in | server_address_ |
int | server_port_ |
socket_fd_t | sock_ |
uint16_t | total_blocks_ |
Additional Inherited Members | |
Protected Member Functions inherited from ros::Transport | |
bool | isHostAllowed (const std::string &host) const |
returns true if the transport is allowed to connect to the host passed to it. More... | |
bool | isOnlyLocalhostAllowed () const |
returns true if this transport is only allowed to talk to localhost More... | |
Protected Attributes inherited from ros::Transport | |
Callback | disconnect_cb_ |
Callback | read_cb_ |
Callback | write_cb_ |
UDPROS transport.
Definition at line 67 of file transport_udp.h.
Enumerator | |
---|---|
SYNCHRONOUS |
Definition at line 70 of file transport_udp.h.
ros::TransportUDP::TransportUDP | ( | PollSet * | poll_set, |
int | flags = 0 , |
||
int | max_datagram_size = 0 |
||
) |
Definition at line 62 of file transport_udp.cpp.
|
virtual |
Definition at line 92 of file transport_udp.cpp.
|
virtual |
Close this transport. Once this call has returned, writing on this transport should always return an error.
Implements ros::Transport.
Definition at line 307 of file transport_udp.cpp.
bool ros::TransportUDP::connect | ( | const std::string & | host, |
int | port, | ||
int | conn_id | ||
) |
Connect to a remote host.
host | The hostname/IP to connect to |
port | The port to connect to |
Definition at line 151 of file transport_udp.cpp.
bool ros::TransportUDP::createIncoming | ( | int | port, |
bool | is_server | ||
) |
Start a server socket and listen on a port.
port | The port to listen on |
Definition at line 242 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 694 of file transport_udp.cpp.
|
virtual |
Disable reading on this transport. Allows derived classes to, for example, disable read polling for asynchronous sockets.
Implements ros::Transport.
Definition at line 638 of file transport_udp.cpp.
|
virtual |
Disable writing on this transport. Allows derived classes to, for example, disable write polling for asynchronous sockets.
Implements ros::Transport.
Definition at line 676 of file transport_udp.cpp.
|
virtual |
Enable reading on this transport. Allows derived classes to, for example, enable read polling for asynchronous sockets.
Implements ros::Transport.
Definition at line 620 of file transport_udp.cpp.
|
virtual |
Enable writing on this transport. Allows derived classes to, for example, enable write polling for asynchronous sockets.
Implements ros::Transport.
Definition at line 658 of file transport_udp.cpp.
std::string ros::TransportUDP::getClientURI | ( | ) |
Returns the URI of the remote host.
Definition at line 708 of file transport_udp.cpp.
|
inline |
Definition at line 122 of file transport_udp.h.
|
inline |
Returns the port this transport is listening on.
Definition at line 103 of file transport_udp.h.
|
virtual |
Returns a string description of both the type of transport and who the transport is connected to.
Implements ros::Transport.
Definition at line 144 of file transport_udp.cpp.
|
inlinevirtual |
Return a string that details the type of transport (Eg. TCPROS)
Implements ros::Transport.
Definition at line 120 of file transport_udp.h.
|
private |
Initializes the assigned socket – sets it to non-blocking and enables reading.
Definition at line 280 of file transport_udp.cpp.
|
virtual |
Read a number of bytes into the supplied buffer. Not guaranteed to actually read that number of bytes.
buffer | Buffer to read from |
size | Size, in bytes, to read |
Implements ros::Transport.
Definition at line 351 of file transport_udp.cpp.
|
inlinevirtual |
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.
|
private |
Set the socket to be used by this transport.
sock | A valid UDP socket |
Definition at line 99 of file transport_udp.cpp.
|
private |
Definition at line 105 of file transport_udp.cpp.
|
virtual |
Write a number of bytes from the supplied buffer. Not guaranteed to actually write that number of bytes.
buffer | Buffer to write from |
size | Size, in bytes, to write |
Implements ros::Transport.
Definition at line 530 of file transport_udp.cpp.
|
private |
Definition at line 152 of file transport_udp.h.
|
private |
Definition at line 141 of file transport_udp.h.
|
private |
Definition at line 140 of file transport_udp.h.
|
private |
Definition at line 157 of file transport_udp.h.
|
private |
Definition at line 158 of file transport_udp.h.
|
private |
Definition at line 164 of file transport_udp.h.
|
private |
Definition at line 166 of file transport_udp.h.
|
private |
Definition at line 165 of file transport_udp.h.
|
private |
Definition at line 143 of file transport_udp.h.
|
private |
Definition at line 144 of file transport_udp.h.
|
private |
Definition at line 155 of file transport_udp.h.
|
private |
Definition at line 146 of file transport_udp.h.
|
private |
Definition at line 160 of file transport_udp.h.
|
private |
Definition at line 148 of file transport_udp.h.
|
private |
Definition at line 150 of file transport_udp.h.
|
private |
Definition at line 162 of file transport_udp.h.
|
private |
Definition at line 154 of file transport_udp.h.
|
private |
Definition at line 168 of file transport_udp.h.
|
private |
Definition at line 171 of file transport_udp.h.
|
private |
Definition at line 170 of file transport_udp.h.
|
private |
Definition at line 169 of file transport_udp.h.
|
private |
Definition at line 147 of file transport_udp.h.
|
private |
Definition at line 149 of file transport_udp.h.
|
private |
Definition at line 139 of file transport_udp.h.
|
private |
Definition at line 159 of file transport_udp.h.