Build fix: workaround g++ 4.8 decltype handling bug
[lttng-tools.git] / src / common / uri.hpp
1 /*
2 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #ifndef URI_H
9 #define URI_H
10
11 #include <common/macros.hpp>
12
13 #include <lttng/lttng.h>
14
15 #include <netinet/in.h>
16
17 /* Destination type of lttng URI */
18 enum lttng_dst_type {
19 LTTNG_DST_IPV4 = 1,
20 LTTNG_DST_IPV6 = 2,
21 LTTNG_DST_PATH = 3,
22 };
23
24 /* Type of lttng URI where it is a final destination or a hop */
25 enum lttng_uri_type {
26 LTTNG_URI_DST, /* The URI is a final destination */
27 /*
28 * Hops are not supported yet but planned for a future release.
29 *
30 LTTNG_URI_HOP,
31 */
32 };
33
34 /* Communication stream type of a lttng URI */
35 enum lttng_stream_type {
36 LTTNG_STREAM_CONTROL,
37 LTTNG_STREAM_DATA,
38 };
39
40 /*
41 * Protocol type of a lttng URI. The value 0 indicate that the proto_type field
42 * should be ignored.
43 */
44 enum lttng_proto_type {
45 LTTNG_PROTO_TYPE_NONE = 0,
46 LTTNG_TCP = 1,
47 /*
48 * UDP protocol is not supported for now.
49 *
50 LTTNG_UDP = 2,
51 */
52 };
53
54 /*
55 * Structure representing an URI supported by lttng.
56 */
57 struct lttng_uri {
58 enum lttng_dst_type dtype;
59 enum lttng_uri_type utype;
60 enum lttng_stream_type stype;
61 enum lttng_proto_type proto;
62 uint16_t port;
63 char subdir[LTTNG_PATH_MAX];
64 union {
65 char ipv4[INET_ADDRSTRLEN];
66 char ipv6[INET6_ADDRSTRLEN];
67 char path[LTTNG_PATH_MAX];
68 } dst;
69 } LTTNG_PACKED;
70
71 int uri_compare(struct lttng_uri *uri1, struct lttng_uri *uri2);
72 void uri_free(struct lttng_uri *uri);
73 ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris);
74 ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, struct lttng_uri **uris);
75 int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size);
76
77 #endif /* _LTT_URI_H */
This page took 0.031166 seconds and 4 git commands to generate.