NVIDIA DeepStream SDK API Reference

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