#include <cstddef>
#include "gz/transport/Export.hh"
Go to the source code of this file.
|
| int | gzTransportAdvertise (GzTransportNode *_node, const char *_topic, const char *_msgType) |
| | Advertise a topic.
|
| |
| GzTransportNode * | gzTransportNodeCreate (const char *_partition) |
| | Create a transport node.
|
| |
| void | gzTransportNodeDestroy (GzTransportNode **_node) |
| | Destroy a transport node.
|
| |
| int | gzTransportPublish (GzTransportNode *_node, const char *_topic, const void *_data, const char *_msgType) |
| | Publishes a message on a topic.
|
| |
| int | 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.
|
| |
| int | gzTransportSubscribeNonConst (GzTransportNode *_node, char *_topic, void(*_callback)(char *, size_t, char *, void *), void *_userData) |
| | Subscribe to a topic, and register a callback.
|
| |
| int | 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.
|
| |
| int | gzTransportUnsubscribe (GzTransportNode *_node, const char *_topic) |
| | Unsubscribe from a topic.
|
| |
| void | 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.
|
| |
◆ GzTransportNode
◆ SubscribeOpts
◆ gzTransportAdvertise()
| int 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()
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()
Destroy a transport node.
- Parameters
-
| [in,out] | _node | The transport node to destroy. |
◆ gzTransportPublish()
| int 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 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 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 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 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 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.