Compare commits

..
Author SHA1 Message Date
Brett T. Warden b84ef8e50b Publish a JSON message to telemetry server
Replace the custom HTTP headers and plain text payload with a JSON
object. This is the new v3 API implementation.
2023-03-21 17:22:14 -07:00
Brett T. Warden 4482392f02 Link telemetry post daemon against json-c
also link its test
2023-03-21 17:21:55 -07:00
Brett T. Warden 059b785b39 Check for json-c
json-c is now required, in order to construct the JSON payload.
2023-03-21 16:11:02 -07:00
Brett T. Warden e525725723 Update default URL API to v3
Updating the HTTP API from v2 to v3 to support JSON message
encapsulation instead of custom HTTP headers with a single-field POST
field for the payload.
2023-03-21 16:07:13 -07:00
2 changed files with 6 additions and 7 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([telemetrics-client], [2.4.0], [https://clearlinux.org/])
AC_INIT([telemetrics-client], [2.3.5], [https://clearlinux.org/])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.14 -Wall -Werror -Wno-extra-portability foreign subdir-objects])
AM_SILENT_RULES([yes])
+5 -6
View File
@@ -977,18 +977,17 @@ int tm_set_payload(struct telem_ref *t_ref, char *payload)
size_t payload_len;
int ret = 0;
if (payload == NULL) {
telem_log(LOG_WARNING, "payload pointer is NULL\n");
payload_len = strlen((char *)payload);
if (payload_len > MAX_PAYLOAD_LENGTH) {
return -EINVAL;
}
payload_len = strnlen(payload, MAX_PAYLOAD_LENGTH);
if (payload_is_ascii(payload, payload_len) != 0) {
return -EINVAL;
}
t_ref->record->payload = strndup(payload, payload_len);
t_ref->record->payload = strdup(payload);
if (!t_ref->record->payload) {
telem_log(LOG_CRIT, "CRIT: Out of memory\n");
@@ -1274,7 +1273,7 @@ int tm_send_record(struct telem_ref *t_ref)
*/
record_size = (2 * sizeof(uint32_t)) + total_size + 1;
data = (char *)calloc(sizeof(char), record_size);
data = calloc(sizeof(char), record_size);
if (!data) {
telem_log(LOG_CRIT, "CRIT: Out of memory\n");
close(sfd);