A controller for an individual connection. More...
#include <yarp/os/Connection.h>
Public Member Functions | |
virtual | ~Connection () |
Destructor. | |
virtual bool | isValid () const |
Check if this object is really a connection, or just an empty placeholder. | |
virtual bool | isTextMode () const =0 |
Check if carrier is textual in nature. | |
virtual bool | isBareMode () const |
Check if carrier excludes type information from payload. | |
virtual void | handleEnvelope (const std::string &envelope)=0 |
Carriers that do not distinguish data from administrative headers (i.e. | |
virtual bool | canEscape () const =0 |
Check if carrier can encode administrative messages, as opposed to just user data. | |
virtual bool | requireAck () const =0 |
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient. | |
virtual bool | supportReply () const =0 |
This flag is used by YARP to determine whether the connection can carry RPC traffic, that is, messages with replies. | |
virtual bool | isLocal () const =0 |
Check if carrier operates within a single process. | |
virtual bool | isPush () const =0 |
Check if carrier is "push" or "pull" style. | |
virtual bool | isConnectionless () const =0 |
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp). | |
virtual bool | isBroadcast () const =0 |
Check if this carrier uses a broadcast mechanism. | |
virtual bool | isActive () const =0 |
Check if carrier is alive and error free. | |
virtual bool | modifiesIncomingData () const =0 |
Check if this carrier modifies incoming data through the Carrier::modifyIncomingData method. | |
virtual yarp::os::ConnectionReader & | modifyIncomingData (yarp::os::ConnectionReader &reader)=0 |
Modify incoming payload data, if appropriate. | |
virtual bool | acceptIncomingData (yarp::os::ConnectionReader &reader)=0 |
Determine whether incoming data should be accepted. | |
virtual bool | modifiesOutgoingData () const =0 |
Check if this carrier modifies outgoing data through the Carrier::modifyOutgoingData method. | |
virtual const PortWriter & | modifyOutgoingData (const PortWriter &writer)=0 |
Modify outgoing payload data, if appropriate. | |
virtual bool | acceptOutgoingData (const PortWriter &writer)=0 |
Determine whether outgoing data should be accepted. | |
virtual bool | modifiesReply () const =0 |
Check if this carrier modifies outgoing data through the Carrier::modifyReply method. | |
virtual PortReader & | modifyReply (PortReader &reader)=0 |
Modify reply payload data, if appropriate. | |
virtual void | setCarrierParams (const yarp::os::Property ¶ms)=0 |
Configure carrier from port administrative commands. | |
virtual void | getCarrierParams (yarp::os::Property ¶ms) const =0 |
Get carrier configuration and deliver it by port administrative commands. | |
virtual void | getHeader (yarp::os::Bytes &header) const =0 |
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to select it. | |
virtual void | prepareDisconnect ()=0 |
Do cleanup and preparation for the coming disconnect, if necessary. | |
virtual std::string | getName () const =0 |
Get the name of this connection type ("tcp", "mcast", "shmem", ...) | |
A controller for an individual connection.
A bundle of callbacks that defines how the connection behaves.
Definition at line 25 of file Connection.h.
|
virtualdefault |
Destructor.
|
pure virtual |
Determine whether incoming data should be accepted.
reader | for incoming data. |
Implemented in yarp::os::Carrier, ForwardingCarrier, PortMonitor, PriorityCarrier, and yarp::os::NullConnection.
|
pure virtual |
Determine whether outgoing data should be accepted.
writer | for outgoing data. |
Implemented in yarp::os::Carrier, ForwardingCarrier, yarp::os::NullConnection, and PortMonitor.
Check if carrier can encode administrative messages, as opposed to just user data.
The word escape is used in the sense of escape character or escape sequence here.
Implemented in GstreamerCarrier, HumanCarrier, MjpegCarrier, MpiCarrier, yarp::os::AbstractCarrier, yarp::os::impl::LocalCarrier, yarp::os::impl::NameserCarrier, ForwardingCarrier, yarp::os::NullConnection, and yarp::os::Carrier.
|
pure virtual |
Get carrier configuration and deliver it by port administrative commands.
params | output carrier properties |
Implemented in yarp::os::Carrier, ForwardingCarrier, PortMonitor, PriorityCarrier, yarp::os::AbstractCarrier, yarp::os::ModifyingCarrier, and yarp::os::NullConnection.
|
pure virtual |
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to select it.
[out] | header | a buffer to hold the first 8 bytes to send on a connection |
Implemented in HumanCarrier, WebSocketCarrier, yarp::os::impl::HttpCarrier, yarp::os::impl::LocalCarrier, yarp::os::impl::NameserCarrier, yarp::os::impl::TextCarrier, yarp::os::impl::UdpCarrier, yarp::os::Carrier, GstreamerCarrier, MjpegCarrier, MpiCarrier, ShmemCarrier, UnixSocketCarrier, yarp::os::impl::TcpCarrier, yarp::os::ModifyingCarrier, ForwardingCarrier, yarp::os::NullConnection, and yarp::os::AbstractCarrier.
|
pure virtual |
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
Implemented in BayerCarrier, GstreamerCarrier, HumanCarrier, MjpegCarrier, MpiBcastCarrier, MpiP2PCarrier, PortMonitor, PriorityCarrier, ShmemCarrier, UnixSocketCarrier, WebSocketCarrier, yarp::os::impl::HttpCarrier, yarp::os::impl::LocalCarrier, yarp::os::impl::McastCarrier, yarp::os::impl::NameserCarrier, yarp::os::impl::TcpCarrier, yarp::os::impl::TextCarrier, yarp::os::impl::UdpCarrier, ForwardingCarrier, yarp::os::NullConnection, MpiCarrier, yarp::os::AbstractCarrier, and yarp::os::ModifyingCarrier.
Carriers that do not distinguish data from administrative headers (i.e.
canEscape returns false), can overload this method to handle the envelope inside the stream. On the receiving side, the InputStream will have to overload the yarp::os::InputStream::setReadEnvelopeCallback method, and execute the callback as soon as the envelope is ready.
envelope | the envelope to transmit bundled with data. |
Implemented in MjpegCarrier, yarp::os::Carrier, ForwardingCarrier, and yarp::os::NullConnection.
Check if carrier is alive and error free.
Implemented in BayerCarrier, GstreamerCarrier, HumanCarrier, MjpegCarrier, MpiBcastCarrier, yarp::os::AbstractCarrier, yarp::os::impl::McastCarrier, ForwardingCarrier, yarp::os::NullConnection, and yarp::os::Carrier.
|
virtual |
Check if carrier excludes type information from payload.
Reimplemented in BayerCarrier, and ForwardingCarrier.
Definition at line 17 of file Connection.cpp.
Check if this carrier uses a broadcast mechanism.
This flag is used to determine whether it is appropriate to send "kill" messages using a carrier or whether they should be sent "out-of-band"
Implemented in MpiBcastCarrier, yarp::os::Carrier, yarp::os::impl::McastCarrier, ForwardingCarrier, and yarp::os::NullConnection.
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).
This flag is used by YARP to determine whether the connection can carry RPC traffic, that is, messages with replies. Replies are not supported by YARP on connectionless carriers.
Implemented in GstreamerCarrier, HumanCarrier, MjpegCarrier, MpiCarrier, ShmemCarrier, UnixSocketCarrier, yarp::os::AbstractCarrier, yarp::os::impl::LocalCarrier, yarp::os::impl::TcpCarrier, yarp::os::impl::UdpCarrier, ForwardingCarrier, yarp::os::NullConnection, and yarp::os::Carrier.
Check if carrier operates within a single process.
In such a case, YARP connections may get completely reorganized in order to optimize them.
Implemented in GstreamerCarrier, HumanCarrier, MjpegCarrier, yarp::os::AbstractCarrier, yarp::os::impl::LocalCarrier, ForwardingCarrier, yarp::os::NullConnection, and yarp::os::Carrier.
Check if carrier is "push" or "pull" style.
Push means that the side that initiates a connection is also the one that will sending of data or commands. All native YARP connections are like this. A "pull" style is equivalent to automatically sending a "reverse connection" port command at the start of the connection.
Implemented in GstreamerCarrier, MjpegCarrier, yarp::os::Carrier, ForwardingCarrier, and yarp::os::NullConnection.
Check if carrier is textual in nature.
Implemented in BayerCarrier, GstreamerCarrier, HumanCarrier, MjpegCarrier, WebSocketCarrier, yarp::os::AbstractCarrier, yarp::os::impl::HttpCarrier, yarp::os::impl::NameserCarrier, yarp::os::impl::TextCarrier, ForwardingCarrier, yarp::os::NullConnection, and yarp::os::Carrier.
|
virtual |
Check if this object is really a connection, or just an empty placeholder.
Reimplemented in BayerCarrier, ForwardingCarrier, and yarp::os::NullConnection.
Definition at line 12 of file Connection.cpp.
Check if this carrier modifies incoming data through the Carrier::modifyIncomingData method.
Implemented in yarp::os::Carrier, yarp::os::ModifyingCarrier, ForwardingCarrier, and yarp::os::NullConnection.
Check if this carrier modifies outgoing data through the Carrier::modifyOutgoingData method.
Implemented in yarp::os::Carrier, yarp::os::ModifyingCarrier, ForwardingCarrier, and yarp::os::NullConnection.
Check if this carrier modifies outgoing data through the Carrier::modifyReply method.
Implemented in yarp::os::Carrier, yarp::os::ModifyingCarrier, ForwardingCarrier, and yarp::os::NullConnection.
|
pure virtual |
Modify incoming payload data, if appropriate.
Doesn't need to be done immediately, it is fine to hold onto a reference to the incoming data reader and use it on demand. This can be handy in order to avoid unnecessary copies.
reader | for incoming data. |
Implemented in yarp::os::Carrier, ForwardingCarrier, BayerCarrier, PortMonitor, and yarp::os::NullConnection.
|
pure virtual |
Modify outgoing payload data, if appropriate.
Doesn't need to be done immediately, it is fine to hold onto a reference to the outgoing data reader and use it on demand. This can be handy in order to avoid unnecessary copies.
writer | for outgoing data. |
Implemented in yarp::os::Carrier, ForwardingCarrier, yarp::os::NullConnection, and PortMonitor.
|
pure virtual |
Modify reply payload data, if appropriate.
reader | for the replied message. |
Implemented in yarp::os::Carrier, ForwardingCarrier, yarp::os::NullConnection, and PortMonitor.
Do cleanup and preparation for the coming disconnect, if necessary.
Implemented in MpiBcastCarrier, yarp::os::Carrier, ForwardingCarrier, and yarp::os::NullConnection.
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
Implemented in GstreamerCarrier, HumanCarrier, MjpegCarrier, ShmemCarrier, UnixSocketCarrier, WebSocketCarrier, yarp::os::AbstractCarrier, yarp::os::impl::HttpCarrier, yarp::os::impl::LocalCarrier, yarp::os::impl::NameserCarrier, yarp::os::impl::TcpCarrier, yarp::os::impl::TextCarrier, yarp::os::impl::UdpCarrier, ForwardingCarrier, yarp::os::NullConnection, and yarp::os::Carrier.
|
pure virtual |
Configure carrier from port administrative commands.
params | carrier properties |
Implemented in yarp::os::Carrier, ForwardingCarrier, PortMonitor, PriorityCarrier, yarp::os::AbstractCarrier, yarp::os::ModifyingCarrier, and yarp::os::NullConnection.
This flag is used by YARP to determine whether the connection can carry RPC traffic, that is, messages with replies.
Implemented in GstreamerCarrier, HumanCarrier, MjpegCarrier, MpiBcastCarrier, MpiP2PCarrier, WebSocketCarrier, yarp::os::AbstractCarrier, yarp::os::impl::HttpCarrier, yarp::os::impl::NameserCarrier, yarp::os::impl::TextCarrier, ForwardingCarrier, yarp::os::NullConnection, MpiCarrier, and yarp::os::Carrier.