#include "gz/transport/Export.hh"
Go to the source code of this file.
Classes | |
struct | SubscribeOpts |
Typedefs | |
typedef struct GzTransportNode | GzTransportNode |
A transport node. More... | |
typedef struct SubscribeOpts | SubscribeOpts |
Functions | |
const auto | GZ_DEPRECATED (12) ignTransportNodeCreate = gzTransportNodeDestroy |
int GZ_TRANSPORT_VISIBLE | gzTransportAdvertise (GzTransportNode *_node, const char *_topic, const char *_msgType) |
Advertise a topic. More... | |
GzTransportNode GZ_TRANSPORT_VISIBLE * | gzTransportNodeCreate (const char *_partition) |
Create a transport node. More... | |
void GZ_TRANSPORT_VISIBLE | gzTransportNodeDestroy (GzTransportNode **_node) |
Destroy a transport node. More... | |
int GZ_TRANSPORT_VISIBLE | gzTransportPublish (GzTransportNode *_node, const char *_topic, const void *_data, const char *_msgType) |
Publishes a message on a topic. More... | |
int GZ_TRANSPORT_VISIBLE | gzTransportSubscribe (GzTransportNode *_node, const char *_topic, void(*_callback)(const char *, size_t, const char *, void *), void *_userData) |
Subscribe to a topic, and register a callback. More... | |
int GZ_TRANSPORT_VISIBLE | gzTransportSubscribeNonConst (GzTransportNode *_node, char *_topic, void(*_callback)(char *, size_t, char *, void *), void *_userData) |
Subscribe to a topic, and register a callback. More... | |
int GZ_TRANSPORT_VISIBLE | gzTransportSubscribeOptions (GzTransportNode *_node, const char *_topic, SubscribeOpts _opts, void(*_callback)(const char *, size_t, const char *, void *), void *_userData) |
Subscribe to a topic, and register a callback. More... | |
int GZ_TRANSPORT_VISIBLE | gzTransportUnsubscribe (GzTransportNode *_node, const char *_topic) |
Unsubscribe from a topic. More... | |
void GZ_TRANSPORT_VISIBLE | gzTransportWaitForShutdown () |
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... | |
Typedef Documentation
◆ GzTransportNode
typedef struct GzTransportNode GzTransportNode |
A transport node.
◆ SubscribeOpts
typedef struct SubscribeOpts SubscribeOpts |
Function Documentation
◆ GZ_DEPRECATED()
const auto GZ_DEPRECATED | ( | 12 | ) | = gzTransportNodeDestroy |
◆ gzTransportAdvertise()
int GZ_TRANSPORT_VISIBLE gzTransportAdvertise | ( | GzTransportNode * | _node, |
const char * | _topic, | ||
const char * | _msgType | ||
) |
Advertise a topic.
- Parameters
-
[in] _node Pointer to a node. [in] _topic Topic on which to publish the message. [in] _msgType Name of the message type.
- Returns
- 0 on success.
◆ gzTransportNodeCreate()
GzTransportNode GZ_TRANSPORT_VISIBLE* gzTransportNodeCreate | ( | const char * | _partition | ) |
Create a transport node.
- Parameters
-
[in] _partition Optional name of the partition to use. Use nullptr to use the default value, which is specified via the GZ_PARTITION environment variable.
- Returns
- A pointer to a new transport node. Do not manually delete this pointer, instead use gzTransportNodeDestroy.
◆ gzTransportNodeDestroy()
void GZ_TRANSPORT_VISIBLE gzTransportNodeDestroy | ( | GzTransportNode ** | _node | ) |
Destroy a transport node.
- Parameters
-
[in,out] _node The transport node to destroy.
◆ gzTransportPublish()
int GZ_TRANSPORT_VISIBLE gzTransportPublish | ( | GzTransportNode * | _node, |
const char * | _topic, | ||
const void * | _data, | ||
const char * | _msgType | ||
) |
Publishes a message on a topic.
- Parameters
-
[in] _node Pointer to a node. [in] _topic Topic on which to publish the message. [in] _data Byte array of serialized data to publish. [in] _msgType Name of the message type.
- Returns
- 0 on success.
◆ gzTransportSubscribe()
int GZ_TRANSPORT_VISIBLE gzTransportSubscribe | ( | GzTransportNode * | _node, |
const char * | _topic, | ||
void(*)(const char *, size_t, const char *, void *) | _callback, | ||
void * | _userData | ||
) |
Subscribe to a topic, and register a callback.
- Parameters
-
[in] _node Pointer to a node. [in] _topic Name of the topic. [in] _callback The function to call when a message is received. [in] _userData Arbitrary user data pointer.
- Returns
- 0 on success.
◆ gzTransportSubscribeNonConst()
int GZ_TRANSPORT_VISIBLE gzTransportSubscribeNonConst | ( | GzTransportNode * | _node, |
char * | _topic, | ||
void(*)(char *, size_t, char *, void *) | _callback, | ||
void * | _userData | ||
) |
Subscribe to a topic, and register a callback.
- Parameters
-
[in] _node Pointer to a node. [in] _topic Name of the topic. [in] _callback The function to call when a message is received. [in] _userData Arbitrary user data pointer.
- Returns
- 0 on success.
◆ gzTransportSubscribeOptions()
int GZ_TRANSPORT_VISIBLE gzTransportSubscribeOptions | ( | GzTransportNode * | _node, |
const char * | _topic, | ||
SubscribeOpts | _opts, | ||
void(*)(const char *, size_t, const char *, void *) | _callback, | ||
void * | _userData | ||
) |
Subscribe to a topic, and register a callback.
- Parameters
-
[in] _node Pointer to a node. [in] _topic Name of the topic. [in] _opts Subscriber options. [in] _callback The function to call when a message is received. [in] _userData Arbitrary user data pointer.
- Returns
- 0 on success.
◆ gzTransportUnsubscribe()
int GZ_TRANSPORT_VISIBLE gzTransportUnsubscribe | ( | GzTransportNode * | _node, |
const char * | _topic | ||
) |
Unsubscribe from a topic.
- Parameters
-
[in] _node Pointer to a node. [in] _topic Name of the topic.
- Returns
- 0 on success.
◆ gzTransportWaitForShutdown()
void GZ_TRANSPORT_VISIBLE gzTransportWaitForShutdown | ( | ) |
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.