Nyx Node
Toggle main menu visibility
Loading...
Searching...
No Matches
indi_del_property.c
1
/* NyxNode
2
* Author: Jérôme ODIER <jerome.odier@lpsc.in2p3.fr>
3
* SPDX-License-Identifier: GPL-2.0-only (Mongoose backend) or GPL-3.0+
4
*/
5
6
/*--------------------------------------------------------------------------------------------------------------------*/
7
8
#include "../nyx_node_internal.h"
9
10
/*--------------------------------------------------------------------------------------------------------------------*/
11
12
nyx_dict_t
*nyx_del_property_new(
13
STR_t
device,
14
STR_t
name,
15
STR_t
message
16
) {
17
nyx_dict_t
*result = nyx_dict_new();
18
19
/*----------------------------------------------------------------------------------------------------------------*/
20
21
char
timestamp[32];
22
23
internal_get_timestamp(
sizeof
(timestamp), timestamp);
24
25
/*----------------------------------------------------------------------------------------------------------------*/
26
27
nyx_dict_set_string_unref(result,
"<>"
,
"delProperty"
,
false
);
28
29
/*----------------------------------------------------------------------------------------------------------------*/
30
31
nyx_dict_set_string_unref(result,
"@client"
,
"unknown"
,
false
);
32
nyx_dict_set_string_unref(result,
"@device"
,
nyx_string_dup
(device),
true
);
33
nyx_dict_set_string_unref(result,
"@timestamp"
,
nyx_string_dup
(timestamp),
true
);
34
35
/*----------------------------------------------------------------------------------------------------------------*/
36
37
if
(name != NULL) {
38
nyx_dict_set_string_unref(result,
"@name"
,
nyx_string_dup
(name),
true
);
39
}
40
41
if
(message != NULL) {
42
nyx_dict_set_string_unref(result,
"@message"
,
nyx_string_dup
(message),
true
);
43
}
44
45
/*----------------------------------------------------------------------------------------------------------------*/
46
47
return
result;
48
}
49
50
/*--------------------------------------------------------------------------------------------------------------------*/
nyx_dict_t
Struct describing a JSON dict object.
STR_t
#define STR_t
Alias for const char *.
Definition
nyx_node.h:71
nyx_string_dup
__NYX_NULLABLE__ str_t nyx_string_dup(__NYX_NULLABLE__ STR_t s)
Similar to libc strdup.
Author:
Jérôme ODIER
License:
LGPL-3.0-or-later
Copyright:
LPSC / CNRS