#define _LGPL_SOURCE
#include <arpa/inet.h>
-#include <common/compat/netdb.h>
+#include <common/compat/netdb.hpp>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
-#include <common/common.h>
-#include <common/defaults.h>
-#include <common/utils.h>
+#include <common/common.hpp>
+#include <common/defaults.hpp>
+#include <common/utils.hpp>
-#include "uri.h"
+#include "uri.hpp"
#define LOOPBACK_ADDR_IPV4 "127.0.0.1"
#define LOOPBACK_ADDR_IPV6 "::1"
P_NET, P_NET6, P_FILE, P_TCP, P_TCP6,
};
+namespace {
struct uri_proto {
const char *name;
const char *leading_string;
};
/* Supported protocols */
-static const struct uri_proto proto_uri[] = {
+const struct uri_proto proto_uri[] = {
{ .name = "file", .leading_string = "file://", .code = P_FILE, .type = LTTNG_PROTO_TYPE_NONE, .dtype = LTTNG_DST_PATH },
{ .name = "net", .leading_string = "net://", .code = P_NET, .type = LTTNG_TCP, .dtype = LTTNG_DST_IPV4 },
{ .name = "net4", .leading_string = "net4://", .code = P_NET, .type = LTTNG_TCP, .dtype = LTTNG_DST_IPV4 },
/* Invalid proto marking the end of the array. */
{}
};
+} /* namespace */
/*
* Return pointer to the character in s matching one of the characters in
}
/* Allocate URI array */
- tmp_uris = (lttng_uri *) zmalloc(sizeof(struct lttng_uri) * size);
+ tmp_uris = calloc<lttng_uri>(size);
if (tmp_uris == NULL) {
PERROR("zmalloc uri");
goto error;
goto error;
}
- tmp_uris = (lttng_uri *) zmalloc(sizeof(struct lttng_uri) * uri_count);
+ tmp_uris = calloc<lttng_uri>(uri_count);
if (tmp_uris == NULL) {
PERROR("zmalloc uris");
goto error;