NVIDIA DeepStream SDK API Reference

9.0 Release
9.0/sources/includes/nvds_utils.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: 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 #ifndef __NVDS_COMMON_UTILS_H__
14 #define __NVDS_COMMON_UTILS_H__
15 
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif
20 
21 /*
22  * Release memory allocated for gobjects
23  */
24 void free_gobjs(GKeyFile *gcfg_file, GError *error, gchar **keys, gchar *key_name);
25 
26 /*
27  * Internal function to verify if the config string value is a quoted string
28  * config key = "value"
29  * If so, strip beginning and ending quote
30  */
31 NvDsMsgApiErrorType strip_quote(char *cfg_value, const char *cfg_key, const char *log_cat);
32 
33 /*
34  *Function to open a file and search config value for a config key
35  *If found, place the result in cfg_val
36  */
37 NvDsMsgApiErrorType fetch_config_value(char *config_path, const char *cfg_key, char *cfg_val, int len, const char *log_category);
38 
39 /*
40  * Get hostname with IP address or Kubernetes pod information
41  * Returns a newly allocated string containing either:
42  * - Kubernetes: "pod-name (pod-dns)"
43  * - Regular: "hostname (IP)"
44  * Caller must free with g_free().
45  */
46 char* nvds_get_hostname_with_ip(void);
47 
48 #ifdef __cplusplus
49 }
50 
51 #include <string>
52 
53 /*
54  *Generate hash value of a string using SHA256
55  */
56 std::string generate_sha256_hash(std::string str);
57 
58 /*
59  * remove leading & trailing whitespaces from a string
60  */
61 std::string trim(std::string str);
62 
63 /*
64  * Sort string of format key=value;key1=value1
65  * ex: str = "pq=89;xyz=33;abc=123;"
66  * output = "abc=123;pq=89;xyz=33"
67  */
68 std::string sort_key_value_pairs(std::string str);
69 
70 #endif
71 
72 #endif
NvDsMsgApiErrorType
NvDsMsgApiErrorType
Defines completion codes for operations in the messaging API.
Definition: sources/includes/nvds_msgapi.h:57
fetch_config_value
NvDsMsgApiErrorType fetch_config_value(char *config_path, const char *cfg_key, char *cfg_val, int len, const char *log_category)
nvds_get_hostname_with_ip
char * nvds_get_hostname_with_ip(void)
strip_quote
NvDsMsgApiErrorType strip_quote(char *cfg_value, const char *cfg_key, const char *log_cat)
free_gobjs
void free_gobjs(GKeyFile *gcfg_file, GError *error, gchar **keys, gchar *key_name)