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