Fix: consumerd: crash occurs when taking snapshot of ust channel
[lttng-tools.git] / src / common / uri.h
1 /*
2 * Copyright (C) 2012 - David Goulet <dgoulet@efficios.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18 #ifndef URI_H
19 #define URI_H
20
21 #include <netinet/in.h>
22 #include <lttng/lttng.h>
23 #include <common/macros.h>
24
25 /* Destination type of lttng URI */
26 enum lttng_dst_type {
27 LTTNG_DST_IPV4 = 1,
28 LTTNG_DST_IPV6 = 2,
29 LTTNG_DST_PATH = 3,
30 };
31
32 /* Type of lttng URI where it is a final destination or a hop */
33 enum lttng_uri_type {
34 LTTNG_URI_DST, /* The URI is a final destination */
35 /*
36 * Hops are not supported yet but planned for a future release.
37 *
38 LTTNG_URI_HOP,
39 */
40 };
41
42 /* Communication stream type of a lttng URI */
43 enum lttng_stream_type {
44 LTTNG_STREAM_CONTROL,
45 LTTNG_STREAM_DATA,
46 };
47
48 /*
49 * Protocol type of a lttng URI. The value 0 indicate that the proto_type field
50 * should be ignored.
51 */
52 enum lttng_proto_type {
53 LTTNG_TCP = 1,
54 /*
55 * UDP protocol is not supported for now.
56 *
57 LTTNG_UDP = 2,
58 */
59 };
60
61 /*
62 * Structure representing an URI supported by lttng.
63 */
64 struct lttng_uri {
65 enum lttng_dst_type dtype;
66 enum lttng_uri_type utype;
67 enum lttng_stream_type stype;
68 enum lttng_proto_type proto;
69 uint16_t port;
70 char subdir[LTTNG_PATH_MAX];
71 union {
72 char ipv4[INET_ADDRSTRLEN];
73 char ipv6[INET6_ADDRSTRLEN];
74 char path[LTTNG_PATH_MAX];
75 } dst;
76 } LTTNG_PACKED;
77
78 int uri_compare(struct lttng_uri *uri1, struct lttng_uri *uri2);
79 void uri_free(struct lttng_uri *uri);
80 ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris);
81 ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
82 struct lttng_uri **uris);
83 int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size);
84
85 #endif /* _LTT_URI_H */
This page took 0.032909 seconds and 4 git commands to generate.