YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Network.cpp File Reference
+ Include dependency graph for Network.cpp:

Go to the source code of this file.

Classes

class  YarpAutoInit
 A single-use class to shut down the yarp library if it was initialized automatically. More...
 
class  ForwardingCarrier
 
class  StubCarrier
 

Functions

static MultiNameSpace & getNameSpace ()
 
static bool needsLookup (const Contact &contact)
 
static int noteDud (const Contact &src)
 Notify the name server that a port did not respond (i.e.
 
static int enactConnection (const Contact &src, const Contact &dest, const ContactStyle &style, int mode, bool reversed)
 Connect, disconnect, or check the connection between two ports, by sending administrative commands to the port src, which is the one in charge of the connection (it is called by metaConnect()).
 
static std::string collectParams (Contact &c)
 
static std::string extractCarrierNameOnly (const std::string &carrier_name_with_params)
 
static bool is_log_port (const std::string &src, const std::string &dest)
 Check if the given source and destination ports are log ports.
 
static bool is_stats_port (const std::string &src, const std::string &dest)
 Check if the given source and destination ports are stats ports.
 
static void addStatsMonitorIfNeeded (const std::string &src, const std::string &dest, ContactStyle &style, int mode)
 
static int metaConnect (const std::string &src, const std::string &dest, ContactStyle style, int mode)
 
static bool setPortQos (const std::string &port, const std::string &other, bool isOutput, const QosStyle &style, bool quiet)
 
static bool getPortQos (const std::string &port, const std::string &other, bool isOutput, QosStyle &style, bool quiet)
 

Variables

static int __yarp_is_initialized = 0
 
static bool __yarp_auto_init_active = false
 
static YarpAutoInit yarp_auto_init
 destructor is called on shutdown.
 

Function Documentation

◆ addStatsMonitorIfNeeded()

static void addStatsMonitorIfNeeded ( const std::string &  src,
const std::string &  dest,
ContactStyle &  style,
int  mode 
)
static

Definition at line 337 of file Network.cpp.

◆ collectParams()

static std::string collectParams ( Contact &  c)
static

Definition at line 280 of file Network.cpp.

◆ enactConnection()

static int enactConnection ( const Contact &  src,
const Contact &  dest,
const ContactStyle &  style,
int  mode,
bool  reversed 
)
static

Connect, disconnect, or check the connection between two ports, by sending administrative commands to the port src, which is the one in charge of the connection (it is called by metaConnect()).

The steps are:

  • for persistent connections, the request is forwarded to the name server and the ports are not contacted at all;
  • otherwise src is asked (getConnectionInfoOut/getConnectionInfoIn, see PortCoreMsgs.thrift) about the current connection with dest. If src does not respond, it is reported to the name server as dead (noteDud());
  • in YARP_ENACT_EXISTS mode, the result depends only on the existence of the connection and on its carrier (which must match style.carrier);
  • an existing connectionless connection is explicitly disconnected also from the other side, since the other side would not notice it otherwise;
  • finally, src is asked to add (addConnection) or to remove (delConnection) the connection.
Parameters
srcthe port which is asked to make/break/check the connection
destthe port at the other end of the connection
stylethe options of the connection (carrier, timeout, quiet, ...)
modeone of YARP_ENACT_CONNECT, YARP_ENACT_DISCONNECT, YARP_ENACT_EXISTS
reversedfalse if src is the sender of the data (push connection), true if src is the receiver of the data (pull connection)
Returns
0 on success, 1 on failure

Definition at line 161 of file Network.cpp.

◆ extractCarrierNameOnly()

static std::string extractCarrierNameOnly ( const std::string &  carrier_name_with_params)
static

Definition at line 290 of file Network.cpp.

◆ getNameSpace()

static MultiNameSpace & getNameSpace ( )
static

Definition at line 87 of file Network.cpp.

◆ getPortQos()

static bool getPortQos ( const std::string &  port,
const std::string &  other,
bool  isOutput,
QosStyle &  style,
bool  quiet 
)
static

Definition at line 1259 of file Network.cpp.

◆ is_log_port()

static bool is_log_port ( const std::string &  src,
const std::string &  dest 
)
static

Check if the given source and destination ports are log ports.

Note: /log/... ports are used by clients (the application which send the log) /logger/... ports are used by the log server (the application which receives the log)

Parameters
srcthe source port
destthe destination port
Returns
true if both ports are log ports, false otherwise

Definition at line 303 of file Network.cpp.

◆ is_stats_port()

static bool is_stats_port ( const std::string &  src,
const std::string &  dest 
)
static

Check if the given source and destination ports are stats ports.

# Note: /stats_monitor/... ports are used by clients (the application which send the stats) /yarpConnectionsStats/... ports are used by the stats server (the application which receives the stats)

Parameters
srcthe source port
destthe destination port
Returns
true if both ports are stats ports, false otherwise

Definition at line 324 of file Network.cpp.

◆ metaConnect()

static int metaConnect ( const std::string &  src,
const std::string &  dest,
ContactStyle  style,
int  mode 
)
static

Definition at line 400 of file Network.cpp.

◆ needsLookup()

static bool needsLookup ( const Contact &  contact)
static

Definition at line 93 of file Network.cpp.

◆ noteDud()

static int noteDud ( const Contact &  src)
static

Notify the name server that a port did not respond (i.e.

it is probably dead), by announcing it with activity 0. The name server can use this information to mark the port as non-live and to clean up its registration.

If a local name store is available (query bypass), it is notified directly, otherwise an "announce <port> 0" message is sent to the name server.

Parameters
srcthe port which did not respond
Returns
the result of the announcement (it is not used by the callers)

Definition at line 116 of file Network.cpp.

◆ setPortQos()

static bool setPortQos ( const std::string &  port,
const std::string &  other,
bool  isOutput,
const QosStyle &  style,
bool  quiet 
)
static

Definition at line 1163 of file Network.cpp.

Variable Documentation

◆ __yarp_auto_init_active

bool __yarp_auto_init_active = false
static

Definition at line 58 of file Network.cpp.

◆ __yarp_is_initialized

int __yarp_is_initialized = 0
static

Definition at line 57 of file Network.cpp.

◆ yarp_auto_init

YarpAutoInit yarp_auto_init
static

destructor is called on shutdown.

Definition at line 85 of file Network.cpp.