align.h: Implement ALIGN_FLOOR macro
[lttng-tools.git] / src / common / uri.h
CommitLineData
3a5713da
DG
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
a4b92340
DG
18#ifndef URI_H
19#define URI_H
3a5713da 20
a4b92340 21#include <netinet/in.h>
3a5713da 22#include <lttng/lttng.h>
7f23e028 23#include <common/macros.h>
3a5713da 24
a4b92340
DG
25/* Destination type of lttng URI */
26enum 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 */
33enum 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 */
43enum 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 */
52enum 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 */
64struct 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;
7f23e028
JG
69 uint16_t port;
70 char subdir[LTTNG_PATH_MAX];
a4b92340
DG
71 union {
72 char ipv4[INET_ADDRSTRLEN];
73 char ipv6[INET6_ADDRSTRLEN];
7f23e028 74 char path[LTTNG_PATH_MAX];
a4b92340 75 } dst;
7f23e028 76} LTTNG_PACKED;
a4b92340 77
3a5713da
DG
78int uri_compare(struct lttng_uri *uri1, struct lttng_uri *uri2);
79void uri_free(struct lttng_uri *uri);
80ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris);
bc894455
DG
81ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
82 struct lttng_uri **uris);
ad20f474 83int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size);
3a5713da
DG
84
85#endif /* _LTT_URI_H */
This page took 0.068259 seconds and 5 git commands to generate.