Fix: parse_prob_opts return the actual success of the function
[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
24 /* Destination type of lttng URI */
25 enum lttng_dst_type {
26 LTTNG_DST_IPV4 = 1,
27 LTTNG_DST_IPV6 = 2,
28 LTTNG_DST_PATH = 3,
29 };
30
31 /* Type of lttng URI where it is a final destination or a hop */
32 enum lttng_uri_type {
33 LTTNG_URI_DST, /* The URI is a final destination */
34 /*
35 * Hops are not supported yet but planned for a future release.
36 *
37 LTTNG_URI_HOP,
38 */
39 };
40
41 /* Communication stream type of a lttng URI */
42 enum lttng_stream_type {
43 LTTNG_STREAM_CONTROL,
44 LTTNG_STREAM_DATA,
45 };
46
47 /*
48 * Protocol type of a lttng URI. The value 0 indicate that the proto_type field
49 * should be ignored.
50 */
51 enum lttng_proto_type {
52 LTTNG_TCP = 1,
53 /*
54 * UDP protocol is not supported for now.
55 *
56 LTTNG_UDP = 2,
57 */
58 };
59
60 /*
61 * Structure representing an URI supported by lttng.
62 */
63 struct lttng_uri {
64 enum lttng_dst_type dtype;
65 enum lttng_uri_type utype;
66 enum lttng_stream_type stype;
67 enum lttng_proto_type proto;
68 in_port_t port;
69 char subdir[PATH_MAX];
70 union {
71 char ipv4[INET_ADDRSTRLEN];
72 char ipv6[INET6_ADDRSTRLEN];
73 char path[PATH_MAX];
74 } dst;
75 };
76
77 int uri_compare(struct lttng_uri *uri1, struct lttng_uri *uri2);
78 void uri_free(struct lttng_uri *uri);
79 ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris);
80 ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
81 struct lttng_uri **uris);
82 int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size);
83
84 #endif /* _LTT_URI_H */
This page took 0.032856 seconds and 5 git commands to generate.