common: compile libcommon as C++
[lttng-tools.git] / src / common / uri.h
CommitLineData
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
48a40005
SM
15#if defined(__cplusplus)
16extern "C" {
17#endif
18
a4b92340
DG
19/* Destination type of lttng URI */
20enum lttng_dst_type {
21 LTTNG_DST_IPV4 = 1,
22 LTTNG_DST_IPV6 = 2,
23 LTTNG_DST_PATH = 3,
24};
25
26/* Type of lttng URI where it is a final destination or a hop */
27enum lttng_uri_type {
28 LTTNG_URI_DST, /* The URI is a final destination */
29 /*
30 * Hops are not supported yet but planned for a future release.
31 *
32 LTTNG_URI_HOP,
33 */
34};
35
36/* Communication stream type of a lttng URI */
37enum lttng_stream_type {
38 LTTNG_STREAM_CONTROL,
39 LTTNG_STREAM_DATA,
40};
41
42/*
43 * Protocol type of a lttng URI. The value 0 indicate that the proto_type field
44 * should be ignored.
45 */
46enum lttng_proto_type {
a6bc4ca9 47 LTTNG_PROTO_TYPE_NONE = 0,
a4b92340
DG
48 LTTNG_TCP = 1,
49 /*
50 * UDP protocol is not supported for now.
51 *
52 LTTNG_UDP = 2,
53 */
54};
55
56/*
57 * Structure representing an URI supported by lttng.
58 */
59struct lttng_uri {
60 enum lttng_dst_type dtype;
61 enum lttng_uri_type utype;
62 enum lttng_stream_type stype;
63 enum lttng_proto_type proto;
7f23e028
JG
64 uint16_t port;
65 char subdir[LTTNG_PATH_MAX];
a4b92340
DG
66 union {
67 char ipv4[INET_ADDRSTRLEN];
68 char ipv6[INET6_ADDRSTRLEN];
7f23e028 69 char path[LTTNG_PATH_MAX];
a4b92340 70 } dst;
7f23e028 71} LTTNG_PACKED;
a4b92340 72
3a5713da
DG
73int uri_compare(struct lttng_uri *uri1, struct lttng_uri *uri2);
74void uri_free(struct lttng_uri *uri);
75ssize_t uri_parse(const char *str_uri, struct lttng_uri **uris);
bc894455
DG
76ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
77 struct lttng_uri **uris);
ad20f474 78int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size);
3a5713da 79
48a40005
SM
80#if defined(__cplusplus)
81}
82#endif
83
3a5713da 84#endif /* _LTT_URI_H */
This page took 0.05806 seconds and 4 git commands to generate.