Go to the documentation of this file.
35 #ifndef ROSCPP_CONNECTION_H
36 #define ROSCPP_CONNECTION_H
41 #include <boost/signals2.hpp>
43 #include <boost/function.hpp>
44 #include <boost/shared_ptr.hpp>
45 #include <boost/shared_array.hpp>
46 #include <boost/enable_shared_from_this.hpp>
47 #include <boost/thread/mutex.hpp>
48 #include <boost/thread/recursive_mutex.hpp>
50 #define READ_BUFFER_SIZE (1024*64)
70 class ROSCPP_DECL
Connection :
public boost::enable_shared_from_this<Connection>
91 void drop(DropReason reason);
107 void sendHeaderError(
const std::string& error_message);
152 boost::signals2::connection addDropListener(
const DropFunc& slot);
153 void removeDropListener(
const boost::signals2::connection& c);
175 std::string getCallerId();
176 std::string getRemoteString();
203 void readTransport();
207 void writeTransport();
271 #endif // ROSCPP_CONNECTION_H
const TransportPtr & getTransport()
Get the Transport associated with this connection.
uint32_t read_size_
Size of the read buffer, in bytes.
boost::function< void(const ConnectionPtr &)> WriteFinishedFunc
boost::shared_array< uint8_t > read_buffer_
Read buffer that ends up being passed to the read callback.
void setHeader(const Header &header)
Set the Header associated with this connection (used with UDPROS, which receives the connection durin...
volatile uint32_t has_write_callback_
boost::function< void(const ConnectionPtr &, const boost::shared_array< uint8_t > &, uint32_t, bool)> ReadFinishedFunc
bool reading_
Flag telling us if we're in the middle of a read (mostly to avoid recursive deadlocking)
DropSignal drop_signal_
Signal raised when this connection is dropped.
boost::mutex write_callback_mutex_
boost::signals2::signal< void(const ConnectionPtr &, DropReason reason)> DropSignal
uint32_t write_sent_
Amount of data we've written from the write buffer.
bool is_server_
Are we a server? Servers wait for clients to send a header and then send a header in response.
Abstract base class that allows abstraction of the transport type, eg. TCP, shared memory,...
ReadFinishedFunc read_callback_
Function to call when the read is finished.
uint32_t read_filled_
Amount of data currently in the read buffer, in bytes.
boost::function< void(const ConnectionPtr &, DropReason reason)> DropFunc
uint32_t write_size_
Size of the write buffer.
bool sending_header_error_
If we're sending a header error we disable most other calls.
Encapsulates a connection to a remote host, independent of the transport type.
bool writing_
Flag telling us if we're in the middle of a write (mostly used to avoid recursive deadlocking)
bool dropped_
Have we dropped?
boost::recursive_mutex drop_mutex_
Synchronizes drop() calls.
HeaderReceivedFunc header_func_
Function that handles the incoming header.
boost::recursive_mutex read_mutex_
Mutex used for protecting reading. Recursive because a read can immediately cause another read throug...
boost::shared_ptr< Connection > ConnectionPtr
boost::shared_array< uint8_t > write_buffer_
Buffer to write from.
bool isSendingHeaderError()
Returns true if we're currently sending a header error (and will be automatically dropped when it's f...
volatile uint32_t has_read_callback_
WriteFinishedFunc write_callback_
Function to call when the current write is finished.
TransportPtr transport_
Transport associated with us.
WriteFinishedFunc header_written_callback_
Function to call when the outgoing header has finished writing.
Header & getHeader()
Get the Header associated with this connection.
boost::function< bool(const ConnectionPtr &, const Header &)> HeaderReceivedFunc
ROSCONSOLE_DECL void initialize()
boost::shared_ptr< Transport > TransportPtr
Header header_
Incoming header.
boost::recursive_mutex write_mutex_
Mutex used for protecting writing. Recursive because a write can immediately cause another write thro...
std::map< std::string, std::string > M_string
roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
, Jacob Perron
autogenerated on Sat Sep 14 2024 02:59:35