35 #ifndef ROSCPP_TRANSPORT_H 36 #define ROSCPP_TRANSPORT_H 38 #include <ros/common.h> 40 #include <boost/function.hpp> 41 #include <boost/shared_ptr.hpp> 42 #include <boost/enable_shared_from_this.hpp> 56 class ROSCPP_DECL
Transport :
public boost::enable_shared_from_this<Transport>
68 virtual int32_t read(uint8_t* buffer, uint32_t size) = 0;
75 virtual int32_t write(uint8_t* buffer, uint32_t size) = 0;
80 virtual void enableWrite() = 0;
84 virtual void disableWrite() = 0;
89 virtual void enableRead() = 0;
93 virtual void disableRead() = 0;
98 virtual void close() = 0;
104 virtual const char* getType() = 0;
106 typedef boost::function<void(const TransportPtr&)>
Callback;
123 virtual std::string getTransportInfo() = 0;
143 bool isHostAllowed(
const std::string &host)
const;
157 #endif // ROSCPP_TRANSPORT_H
Abstract base class that allows abstraction of the transport type, eg. TCP, shared memory...
void setReadCallback(const Callback &cb)
Set the function to call when there is data available to be read by this transport.
void setWriteCallback(const Callback &cb)
Set the function to call when there is space available to write on this transport.
boost::shared_ptr< Transport > TransportPtr
virtual bool requiresHeader()
Returns a boolean to indicate if the transport mechanism is reliable or not.
virtual void parseHeader(const Header &header)
Provides an opportunity for transport-specific options to come in through the header.
bool only_localhost_allowed_
void setDisconnectCallback(const Callback &cb)
Set the function to call when this transport has disconnected, either through a call to close()...
std::vector< std::string > allowed_hosts_
boost::function< void(const TransportPtr &)> Callback
bool isOnlyLocalhostAllowed() const
returns true if this transport is only allowed to talk to localhost