Ignition Transport

API Reference

10.0.0
ignition::transport Namespace Reference

Namespaces

 log
 

Classes

class  AdvertiseMessageOptions
 A class for customizing the publication options for a topic advertised. E.g.: Set the rate of messages per second published. More...
 
class  AdvertiseOptions
 A class for customizing the publication options for a topic or service advertised. E.g.: Set the scope of a topic/service. More...
 
class  AdvertiseServiceOptions
 A class for customizing the publication options for a service advertised. More...
 
class  Clock
 A Clock interface for time tracking. More...
 
class  Discovery
 A discovery class that implements a distributed topic discovery protocol. It uses UDP multicast for sending/receiving messages and stores updated topic information. The discovery clients can request the discovery of a topic or the advertisement of a local topic. The discovery uses heartbeats to track the state of other peers in the network. The discovery clients can register callbacks to detect when new topics are discovered or topics are no longer available. More...
 
class  HandlerStorage
 Class to store and manage service call handlers. More...
 
class  IRepHandler
 Interface class used to manage a replier handler. More...
 
class  IReqHandler
 Interface class used to manage a request handler. More...
 
class  ISubscriptionHandler
 Interface class used to manage generic protobuf messages. More...
 
class  MessageInfo
 A class that provides information about the message received. More...
 
class  MessagePublisher
 This class stores all the information about a message publisher. More...
 
class  NetworkClock
 A Clock interface implementation that uses ignition::msgs::Clock messages distributed across the network. More...
 
class  Node
 A class that allows a client to communicate with other peers. There are two main communication modes: pub/sub messages and service calls. More...
 
class  NodeOptions
 A class for customizing the behavior of the Node. E.g.: Set a custom namespace or a partition name. More...
 
class  NodeShared
 Private data for the Node class. This class should not be directly used. You should use the Node class. More...
 
class  Publisher
 This class stores all the information about a publisher. It stores the topic name that publishes, addresses, UUIDs, scope, etc. More...
 
class  RawSubscriptionHandler
 
class  RepHandler
 with the service response. More...
 
class  ReqHandler
 It creates a reply handler for the specific protobuf messages used. 'Req' is a protobuf message type containing the input parameters of the service request. 'Rep' is a protobuf message type that will be filled with the service response. More...
 
class  ReqHandler< google::protobuf::Message, google::protobuf::Message >
 
class  ServicePublisher
 This class stores all the information about a service publisher. More...
 
class  Statistics
 Computes the rolling average, min, max, and standard deviation for a set of samples. More...
 
class  SubscribeOptions
 A class to provide different options for a subscription. More...
 
class  SubscriptionHandler
 It creates a subscription handler for a specific protobuf message. 'T' is the Protobuf message type that will be used for this particular handler. More...
 
class  SubscriptionHandler< ProtoMsg >
 Specialized template when the user prefers a callbacks that accepts a generic google::protobuf::message instead of a specific type. More...
 
class  SubscriptionHandlerBase
 SubscriptionHandlerBase contains functions and data which are common to all SubscriptionHandler types. More...
 
class  TopicStatistics
 Encapsulates statistics for a single topic. The set of statistics include: More...
 
class  TopicStorage
 Store address information about topics and provide convenient methods for adding new topics, removing them, etc. More...
 
class  TopicUtils
 This class provides different utilities related with topics. More...
 
class  Uuid
 A portable class for representing a Universally Unique Identifier. More...
 
class  WallClock
 A Clock implementation that leverages host OS time APIs. More...
 

Typedefs

template<typename T >
using Addresses_M = std::map< std::string, std::vector< T > >
 
using DeallocFunc = void(void *_data, void *_hint)
 
template<typename T >
using DiscoveryCallback = std::function< void(const T &_publisher)>
 
using IRepHandlerPtr = std::shared_ptr< IRepHandler >
 
using IReqHandler_M = std::map< std::string, std::map< std::string, IReqHandlerPtr > >
 
using IReqHandlerPtr = std::shared_ptr< IReqHandler >
 
using ISubscriptionHandler_M = std::map< std::string, ISubscriptionHandlerPtr >
 
using ISubscriptionHandlerPtr = std::shared_ptr< ISubscriptionHandler >
 
using MsgAddresses_M = Addresses_M< MessagePublisher >
 
template<typename T >
using MsgCallback = std::function< void(const T &_msg, const MessageInfo &_info)>
 
using MsgDiscovery = Discovery< MessagePublisher >
 
using MsgDiscoveryCallback = std::function< void(const MessagePublisher &_publisher)>
 
using ProtoMsg = google::protobuf::Message
 
using ProtoMsgPtr = std::shared_ptr< ProtoMsg >
 
using RawCallback = std::function< void(const char *_msgData, const size_t _size, const MessageInfo &_info)>
 
using RawSubscriptionHandler_M = std::map< std::string, RawSubscriptionHandlerPtr >
 
using RawSubscriptionHandlerPtr = std::shared_ptr< RawSubscriptionHandler >
 
using SrvAddresses_M = Addresses_M< ServicePublisher >
 
using SrvDiscovery = Discovery< ServicePublisher >
 
using SrvDiscoveryCallback = std::function< void(const ServicePublisher &_publisher)>
 
using Timestamp = std::chrono::steady_clock::time_point
 

Enumerations

enum  DestinationType { UNICAST, MULTICAST, ALL }
 Options for sending discovery messages. More...
 
enum  Scope_t { PROCESS, HOST, ALL }
 

Functions

std::string determineHost ()
 Determine IP or hostname. Reference: https://github.com/ros/ros_comm/blob/hydro-devel/clients/ roscpp/src/libros/network.cpp. More...
 
std::vector< std::stringdetermineInterfaces ()
 Determine the list of network interfaces for this machine. Reference: https://github.com/ros/ros_comm/blob/hydro-devel/clients/ roscpp/src/libros/network.cpp. More...
 
bool env (const std::string &_name, std::string &_value)
 Find the environment variable '_name' and return its value. More...
 
unsigned int getProcessId ()
 Portable function to get the id of the current process. More...
 
std::string hostname ()
 Determine the computer's hostname. More...
 
int hostnameToIp (char *_hostname, std::string &_ip)
 Determine if an IP is private. More...
 
bool isPrivateIP (const char *_ip)
 Determine if an IP is private. Reference: https://github.com/ros/ros_comm/blob/hydro-devel/clients/ roscpp/src/libros/network.cpp. More...
 
bool pollSockets (const std::vector< int > &_sockets, const int _timeout)
 
int rcvHwm ()
 Get the capacity of the buffer (High Water Mark) that stores incoming Ignition Transport messages. Note that this is a global queue shared by all subscribers within the same process. More...
 
int sndHwm ()
 Get the capacity of the buffer (High Water Mark) that stores outgoing Ignition Transport messages. Note that this is a global queue shared by all publishers within the same process. More...
 
std::vector< std::stringsplit (const std::string &_orig, char _delim)
 split at a one character delimiter to get a vector of something More...
 
std::string username ()
 Determine your login name. More...
 
void waitForShutdown ()
 Block the current thread until a SIGINT or SIGTERM is received. Note that this function registers a signal handler. Do not use this function if you want to manage yourself SIGINT/SIGTERM. More...
 

Variables

static const uint8_t AdvType = 1
 
static const uint8_t ByeType = 5
 
static const uint8_t EndConnection = 7
 
static const uint16_t FlagNoRelay = 0b000000000000'0010
 
static const uint16_t FlagRelay = 0b000000000000'0001
 
static const uint8_t HeartbeatType = 4
 
const int kDefaultRcvHwm = 1000
 The high water mark of the recieve message buffer. More...
 
const int kDefaultSndHwm = 1000
 The high water mark of the send message buffer. More...
 
const std::string kGenericMessageType = "google.protobuf.Message"
 The string type used for generic messages. More...
 
static const uint64_t kUnthrottled = std::numeric_limits<uint64_t>::max()
 Constant used when not interested in throttling. More...
 
static const std::vector< std::stringMsgTypesStr
 Used for debugging the message type received/send. More...
 
static const uint8_t NewConnection = 6
 
static const uint8_t SubType = 2
 
static const uint8_t UnadvType = 3
 
static const uint8_t Uninitialized = 0
 

Typedef Documentation

◆ Addresses_M

◆ DeallocFunc

using DeallocFunc = void(void *_data, void *_hint)

◆ DiscoveryCallback

using DiscoveryCallback = std::function<void(const T &_publisher)>

◆ IRepHandlerPtr

◆ IReqHandler_M

◆ IReqHandlerPtr

◆ ISubscriptionHandler_M

◆ ISubscriptionHandlerPtr

◆ MsgAddresses_M

◆ MsgCallback

using MsgCallback = std::function<void(const T &_msg, const MessageInfo &_info)>

◆ MsgDiscovery

◆ MsgDiscoveryCallback

using MsgDiscoveryCallback = std::function<void(const MessagePublisher &_publisher)>

◆ ProtoMsg

using ProtoMsg = google::protobuf::Message

◆ ProtoMsgPtr

◆ RawCallback

using RawCallback = std::function<void(const char *_msgData, const size_t _size, const MessageInfo &_info)>

◆ RawSubscriptionHandler_M

◆ RawSubscriptionHandlerPtr

◆ SrvAddresses_M

◆ SrvDiscovery

◆ SrvDiscoveryCallback

using SrvDiscoveryCallback = std::function<void(const ServicePublisher &_publisher)>

◆ Timestamp

using Timestamp = std::chrono::steady_clock::time_point

Enumeration Type Documentation

◆ DestinationType

enum DestinationType
strong

Options for sending discovery messages.

Enumerator
UNICAST 

Send data via unicast only.

MULTICAST 

Send data via multicast only.

ALL 

Send data via unicast and multicast.

◆ Scope_t

enum Scope_t
strong
Enumerator
PROCESS 

Topic/service only available to subscribers in the same process as the publisher.

HOST 

Topic/service only available to subscribers in the same machine as the publisher.

ALL 

Topic/service available to any subscriber (default scope).

Function Documentation

◆ determineHost()

std::string ignition::transport::determineHost ( )

Determine IP or hostname. Reference: https://github.com/ros/ros_comm/blob/hydro-devel/clients/ roscpp/src/libros/network.cpp.

Returns
The IP or hostname of this host.

◆ determineInterfaces()

std::vector<std::string> ignition::transport::determineInterfaces ( )

Determine the list of network interfaces for this machine. Reference: https://github.com/ros/ros_comm/blob/hydro-devel/clients/ roscpp/src/libros/network.cpp.

Returns
The list of network interfaces.

Referenced by Discovery< Pub >::Discovery().

◆ env()

bool ignition::transport::env ( const std::string _name,
std::string _value 
)

Find the environment variable '_name' and return its value.

Parameters
[in]_nameName of the environment variable.
[out]_valueValue if the variable was found.
Returns
True if the variable was found or false otherwise.

Referenced by Discovery< Pub >::Discovery(), and Discovery< Pub >::WaitForInit().

◆ getProcessId()

unsigned int ignition::transport::getProcessId ( )

Portable function to get the id of the current process.

Returns
id of current process

◆ hostname()

std::string ignition::transport::hostname ( )

Determine the computer's hostname.

Returns
The computer's hostname.

◆ hostnameToIp()

int ignition::transport::hostnameToIp ( char *  _hostname,
std::string _ip 
)

Determine if an IP is private.

Parameters
[in]_hostnameHostname
[out]_ipIP associated to the input hostname.
Returns
0 when success.

◆ isPrivateIP()

bool ignition::transport::isPrivateIP ( const char *  _ip)

Determine if an IP is private. Reference: https://github.com/ros/ros_comm/blob/hydro-devel/clients/ roscpp/src/libros/network.cpp.

Parameters
[in]_ipInput IP address.
Returns
true if the IP address is private.

◆ pollSockets()

bool ignition::transport::pollSockets ( const std::vector< int > &  _sockets,
const int  _timeout 
)

◆ rcvHwm()

int ignition::transport::rcvHwm ( )

Get the capacity of the buffer (High Water Mark) that stores incoming Ignition Transport messages. Note that this is a global queue shared by all subscribers within the same process.

Returns
The capacity of the buffer storing incoming messages (units are messages). A value of 0 indicates an unlimited buffer and -1 that the socket cannot be queried. The default buffer size is contained in the kDefaultRcvHwm variable. If the buffer is set to unlimited, then your buffer will grow until you run out of memory (and probably crash). If your buffer reaches the maximum capacity data will be dropped.

◆ sndHwm()

int ignition::transport::sndHwm ( )

Get the capacity of the buffer (High Water Mark) that stores outgoing Ignition Transport messages. Note that this is a global queue shared by all publishers within the same process.

Returns
The capacity of the buffer storing outgoing messages (units are messages). A value of 0 indicates an unlimited buffer and -1 that the socket cannot be queried. The default buffer size is contained in the kDefaultSndHwm variable. If the buffer is set to unlimited, then your buffer will grow until you run out of memory (and probably crash). If your buffer reaches the maximum capacity data will be dropped.

◆ split()

std::vector<std::string> ignition::transport::split ( const std::string _orig,
char  _delim 
)

split at a one character delimiter to get a vector of something

Parameters
[in]_origThe string to split
[in]_delima character to split the string at
Returns
vector of split pieces of the string excluding the delimiter

Referenced by Discovery< Pub >::Discovery().

◆ username()

std::string ignition::transport::username ( )

Determine your login name.

Returns
Name used to gain access to the computer. On linux and Mac only, if determination of your login name failes then a string of the form "error-UUID" is returned where UUID is a universally unique identifier.

◆ waitForShutdown()

void ignition::transport::waitForShutdown ( )

Block the current thread until a SIGINT or SIGTERM is received. Note that this function registers a signal handler. Do not use this function if you want to manage yourself SIGINT/SIGTERM.

Variable Documentation

◆ AdvType

const uint8_t AdvType = 1
static

◆ ByeType

const uint8_t ByeType = 5
static

◆ EndConnection

const uint8_t EndConnection = 7
static

◆ FlagNoRelay

const uint16_t FlagNoRelay = 0b000000000000'0010
static

◆ FlagRelay

const uint16_t FlagRelay = 0b000000000000'0001
static

◆ HeartbeatType

const uint8_t HeartbeatType = 4
static

◆ kDefaultRcvHwm

const int kDefaultRcvHwm = 1000

The high water mark of the recieve message buffer.

See also
NodeShared::RcvHwm

◆ kDefaultSndHwm

const int kDefaultSndHwm = 1000

The high water mark of the send message buffer.

See also
NodeShared::SndHwm

◆ kGenericMessageType

◆ kUnthrottled

const uint64_t kUnthrottled = std::numeric_limits<uint64_t>::max()
static

Constant used when not interested in throttling.

◆ MsgTypesStr

const std::vector<std::string> MsgTypesStr
static
Initial value:
=
{
"UNINITIALIZED", "ADVERTISE", "SUBSCRIBE", "UNADVERTISE", "HEARTBEAT",
"BYE", "NEW_CONNECTION", "END_CONNECTION"
}

Used for debugging the message type received/send.

◆ NewConnection

const uint8_t NewConnection = 6
static

◆ SubType

const uint8_t SubType = 2
static

◆ UnadvType

const uint8_t UnadvType = 3
static

◆ Uninitialized

const uint8_t Uninitialized = 0
static