NVIDIA DeepStream SDK API Reference

9.1 Release
9.1/sources/includes/nvmsgbroker.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /*
19  * This file defines the NvMsgBroker interface.
20  * The interfaces is used by applications to send and receive
21  * messages from remote entities and services to deliver events, allow
22  * configuration of settings etc.
23  */
24 
25 #ifndef __NV_MSGBROKER_H__
26 #define __NV_MSGBROKER_H__
27 
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32 
33 #define NV_MSGBROKER_VERSION "2.0"
34 #define LOG_CAT "DSLOG:NV_MSGBROKER"
35 
36 /*
37  * Defines status for operations in the NvMsgBroker interface
38  */
39 typedef enum {
45 
46 /*
47  * Defines structure of a client message packet
48  */
49 
50 typedef struct {
51  char *topic;
52  void *payload;
53  size_t payload_len;
55 
56 /*
57  * Handle to be used in NvMsgBroker API interface
58  */
60 
61 
68 
73 typedef void (*nv_msgbroker_send_cb_t)(void *user_ptr, NvMsgBrokerErrorType status);
74 
75 
83 typedef void (*nv_msgbroker_subscribe_cb_t)(NvMsgBrokerErrorType status, void *msg, int msglen, char *topic, void *user_ptr);
84 
85 
95 NvMsgBrokerClientHandle nv_msgbroker_connect(char *broker_conn_str, char *broker_proto_lib, nv_msgbroker_connect_cb_t connect_cb, char *cfg);
96 
97  /* Send a message asynchronously based on non-blocking semantics
98  * @param[in] h_ptr connection handle to Message Broker library
99  * @param[in] message Message packet which has details of message, topic, priority ..etc
100  * @param[in] cb callback to be invoked to notify status of send
101  * @param[in] user_ctx pointer to pass to callback for context
102  *
103  * @return Completion status of send operation */
105 
114 NvMsgBrokerErrorType nv_msgbroker_subscribe(NvMsgBrokerClientHandle h_ptr, char ** topics, int num_topics, nv_msgbroker_subscribe_cb_t cb, void *user_ctx);
115 
116 
117  /* Disconnect call to notify msgbroker library for connection termination
118  * @param[in] h_ptr Connection handle
119  *
120  * @return status of disconnect
121  */
123 
124 /* Version of Nvmsgbroker interface
125  *
126  * @return [out] version of Nvmsgbroker interface supported by msgbroker library in MAJOR.MINOR format
127  */
128 char *nv_msgbroker_version(void);
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif
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_API_NOT_SUPPORTED
@ NV_MSGBROKER_API_NOT_SUPPORTED
Definition: 9.1/sources/includes/nvmsgbroker.h:43
NvMsgBrokerClientHandle
void * NvMsgBrokerClientHandle
Definition: sources/includes/nvmsgbroker.h:59
NV_MSGBROKER_API_ERR
@ NV_MSGBROKER_API_ERR
Definition: 9.1/sources/includes/nvmsgbroker.h:41
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_API_RECONNECTING
@ NV_MSGBROKER_API_RECONNECTING
Definition: 9.1/sources/includes/nvmsgbroker.h:42
NV_MSGBROKER_API_OK
@ NV_MSGBROKER_API_OK
Definition: 9.1/sources/includes/nvmsgbroker.h:40
nv_msgbroker_send_cb_t
void(* nv_msgbroker_send_cb_t)(void *user_ptr, NvMsgBrokerErrorType status)
Send callback method registered during send_async.
Definition: 9.1/sources/includes/nvmsgbroker.h:73
nv_msgbroker_version
char * nv_msgbroker_version(void)
NvMsgBrokerErrorType
NvMsgBrokerErrorType
Definition: 9.1/sources/includes/nvmsgbroker.h:39
nv_msgbroker_disconnect
NvMsgBrokerErrorType nv_msgbroker_disconnect(NvMsgBrokerClientHandle h_ptr)
NvMsgBrokerErrorType
NvMsgBrokerErrorType
Definition: sources/includes/nvmsgbroker.h:39
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_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: 9.1/sources/includes/nvmsgbroker.h:83
nv_msgbroker_connect_cb_t
void(* nv_msgbroker_connect_cb_t)(NvMsgBrokerClientHandle h_ptr, NvMsgBrokerErrorType status)
Connect callback method registered during connect.
Definition: 9.1/sources/includes/nvmsgbroker.h:67
NvMsgBrokerClientHandle
void * NvMsgBrokerClientHandle
Definition: 9.1/sources/includes/nvmsgbroker.h:59
NvMsgBrokerClientMsg
Definition: sources/includes/nvmsgbroker.h:50