Commit | Line | Data |
---|---|---|
3a5713da | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2012 David Goulet <dgoulet@efficios.com> |
3a5713da | 3 | * |
c922647d | 4 | * SPDX-License-Identifier: LGPL-2.1-only |
3a5713da | 5 | * |
3a5713da DG |
6 | */ |
7 | ||
a4b92340 DG |
8 | #ifndef URI_H |
9 | #define URI_H | |
3a5713da | 10 | |
c9e313bc | 11 | #include <common/macros.hpp> |
3a5713da | 12 | |
28f23191 JG |
13 | #include <lttng/lttng.h> |
14 | ||
15 | #include <netinet/in.h> | |
16 | ||
a4b92340 DG |
17 | /* Destination type of lttng URI */ |
18 | enum lttng_dst_type { | |
28f23191 JG |
19 | LTTNG_DST_IPV4 = 1, |
20 | LTTNG_DST_IPV6 = 2, | |
21 | LTTNG_DST_PATH = 3, | |
a4b92340 DG |
22 | }; |
23 | ||
24 | /* Type of lttng URI where it is a final destination or a hop */ | |
25 | enum lttng_uri_type { | |
28f23191 | 26 | LTTNG_URI_DST, /* The URI is a final destination */ |
a4b92340 DG |
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 { | |
28f23191 JG |
45 | LTTNG_PROTO_TYPE_NONE = 0, |
46 | LTTNG_TCP = 1, | |
a4b92340 DG |
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; | |
7f23e028 JG |
62 | uint16_t port; |
63 | char subdir[LTTNG_PATH_MAX]; | |
a4b92340 DG |
64 | union { |
65 | char ipv4[INET_ADDRSTRLEN]; | |
66 | char ipv6[INET6_ADDRSTRLEN]; | |
7f23e028 | 67 | char path[LTTNG_PATH_MAX]; |
a4b92340 | 68 | } dst; |
7f23e028 | 69 | } LTTNG_PACKED; |
a4b92340 | 70 | |
3a5713da DG |
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); | |
28f23191 | 74 | ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url, struct lttng_uri **uris); |
ad20f474 | 75 | int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size); |
3a5713da DG |
76 | |
77 | #endif /* _LTT_URI_H */ |