NVIDIA DeepStream SDK API Reference

7.0 Release
nvmsgbroker.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
13 /*
14  * This file defines the NvMsgBroker interface.
15  * The interfaces is used by applications to send and receive
16  * messages from remote entities and services to deliver events, allow
17  * configuration of settings etc.
18  */
19 
20 #ifndef __NV_MSGBROKER_H__
21 #define __NV_MSGBROKER_H__
22 
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27 
28 #define NV_MSGBROKER_VERSION "2.0"
29 #define LOG_CAT "DSLOG:NV_MSGBROKER"
30 /*
31  * Defines status for operations in the NvMsgBroker interface
32  */
33 typedef enum {
39 
40 /*
41  * Defines structure of a client message packet
42  */
43 
44 typedef struct {
45  char *topic;
46  void *payload;
47  size_t payload_len;
49 
50 /*
51  * Handle to be used in NvMsgBroker API interface
52  */
54 
55 
62 
67 typedef void (*nv_msgbroker_send_cb_t)(void *user_ptr, NvMsgBrokerErrorType status);
68 
69 
77 typedef void (*nv_msgbroker_subscribe_cb_t)(NvMsgBrokerErrorType status, void *msg, int msglen, char *topic, void *user_ptr);
78 
79 
89 NvMsgBrokerClientHandle nv_msgbroker_connect(char *broker_conn_str, char *broker_proto_lib, nv_msgbroker_connect_cb_t connect_cb, char *cfg);
90 
91  /* Send a message asynchronously based on non-blocking semantics
92  * @param[in] h_ptr connection handle to Message Broker library
93  * @param[in] message Message packet which has details of message, topic, priority ..etc
94  * @param[in] cb callback to be invoked to notify status of send
95  * @param[in] user_ctx pointer to pass to callback for context
96  *
97  * @return Completion status of send operation */
99 
108 NvMsgBrokerErrorType nv_msgbroker_subscribe(NvMsgBrokerClientHandle h_ptr, char ** topics, int num_topics, nv_msgbroker_subscribe_cb_t cb, void *user_ctx);
109 
110 
111  /* Disconnect call to notify msgbroker library for connection termination
112  * @param[in] h_ptr Connection handle
113  *
114  * @return status of disconnect
115  */
117 
118 /* Version of Nvmsgbroker interface
119  *
120  * @return [out] version of Nvmsgbroker interface supported by msgbroker library in MAJOR.MINOR format
121  */
122 char *nv_msgbroker_version(void);
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif
NvMsgBrokerClientHandle
void * NvMsgBrokerClientHandle
Definition: nvmsgbroker.h:53
NvMsgBrokerClientMsg::payload_len
size_t payload_len
Definition: nvmsgbroker.h:47
nv_msgbroker_subscribe
NvMsgBrokerErrorType nv_msgbroker_subscribe(NvMsgBrokerClientHandle h_ptr, char **topics, int num_topics, nv_msgbroker_subscribe_cb_t cb, void *user_ctx)
Subscribe to a remote entity for receiving messages on particular topic(s)
nv_msgbroker_connect_cb_t
void(* nv_msgbroker_connect_cb_t)(NvMsgBrokerClientHandle h_ptr, NvMsgBrokerErrorType status)
Connect callback method registered during connect.
Definition: nvmsgbroker.h:61
NvMsgBrokerClientMsg::topic
char * topic
Definition: nvmsgbroker.h:45
NvMsgBrokerClientMsg::payload
void * payload
Definition: nvmsgbroker.h:46
nv_msgbroker_subscribe_cb_t
void(* nv_msgbroker_subscribe_cb_t)(NvMsgBrokerErrorType status, void *msg, int msglen, char *topic, void *user_ptr)
subscribe callback method registered during subscribe
Definition: nvmsgbroker.h:77
NV_MSGBROKER_API_NOT_SUPPORTED
@ NV_MSGBROKER_API_NOT_SUPPORTED
Definition: nvmsgbroker.h:37
NV_MSGBROKER_API_RECONNECTING
@ NV_MSGBROKER_API_RECONNECTING
Definition: nvmsgbroker.h:36
NV_MSGBROKER_API_ERR
@ NV_MSGBROKER_API_ERR
Definition: nvmsgbroker.h:35
NV_MSGBROKER_API_OK
@ NV_MSGBROKER_API_OK
Definition: nvmsgbroker.h:34
nv_msgbroker_connect
NvMsgBrokerClientHandle nv_msgbroker_connect(char *broker_conn_str, char *broker_proto_lib, nv_msgbroker_connect_cb_t connect_cb, char *cfg)
Connect to a remote entity by calling into msgbroker library.
nv_msgbroker_disconnect
NvMsgBrokerErrorType nv_msgbroker_disconnect(NvMsgBrokerClientHandle h_ptr)
NvMsgBrokerErrorType
NvMsgBrokerErrorType
Definition: nvmsgbroker.h:33
nv_msgbroker_version
char * nv_msgbroker_version(void)
NvMsgBrokerClientMsg
Definition: nvmsgbroker.h:44
nv_msgbroker_send_async
NvMsgBrokerErrorType nv_msgbroker_send_async(NvMsgBrokerClientHandle h_ptr, NvMsgBrokerClientMsg message, nv_msgbroker_send_cb_t cb, void *user_ctx)
nv_msgbroker_send_cb_t
void(* nv_msgbroker_send_cb_t)(void *user_ptr, NvMsgBrokerErrorType status)
Send callback method registered during send_async.
Definition: nvmsgbroker.h:67