#include "collectd/lcc_features.h"
#include "collectd/network_parse.h"
+#include "globals.h"
#include <errno.h>
#include <math.h>
#include <pthread.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <endian.h>
#elif HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
+#else /* fallback */
+#include "collectd/stdendian.h"
#endif
#if HAVE_GCRYPT_H
lcc_network_parse_options_t const *opts);
#if HAVE_GCRYPT_H
-static int init_gcrypt() {
+static int init_gcrypt(void) {
/* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
* Because you can't know in a library whether another library has
* already initialized the library */
static double ntohd(double val) /* {{{ */
{
- static int config = 0;
+ static int config;
union {
uint8_t byte[8];
state->values = calloc(sizeof(*state->values), state->values_len);
state->values_types = calloc(sizeof(*state->values_types), state->values_len);
if ((state->values == NULL) || (state->values_types == NULL)) {
- free(state->values);
- free(state->values_types);
return ENOMEM;
}
uint8_t pwhash[32] = {0};
gcry_md_hash_buffer(GCRY_MD_SHA256, pwhash, password, strlen(password));
- fprintf(stderr, "sizeof(iv) = %zu\n", sizeof(iv));
+ fprintf(stderr, "sizeof(iv) = %" PRIsz "\n", sizeof(iv));
if (gcry_cipher_setkey(cipher, pwhash, sizeof(pwhash)) ||
gcry_cipher_setiv(cipher, iv, iv_size) ||
gcry_cipher_decrypt(cipher, b->data, b->len, /* in = */ NULL,
if ((sz < 5) || (((size_t)sz - 4) > b->len)) {
DEBUG("lcc_network_parse(): invalid 'sz' field: sz = %" PRIu16
- ", b->len = %zu\n",
+ ", b->len = %" PRIsz "\n",
sz, b->len);
return EINVAL;
}
case TYPE_VALUES: {
lcc_value_list_t vl = state;
if (parse_values(payload, sizeof(payload), &vl)) {
+ free(vl.values);
+ free(vl.values_types);
DEBUG("lcc_network_parse(): parse_values failed.\n");
return EINVAL;
}