OpenVPN
probe.h
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
7 *
8 * Copyright (C) 2002-2026 OpenVPN Inc <sales@openvpn.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
37
38#ifndef PROBE_H
39#define PROBE_H
40
41#include "buffer.h"
42#include "control_msg.h"
43
46#define PROBE_REQUEST_FLAG_PROBE_ONLY 0x00000001
47
48/* probe reply flags */
50#define PROBE_REPLY_FLAG_RESEND_WKC 0x0001
52#define PROBE_REPLY_FLAG_ADDRS_EQUAL 0x0002
56#define PROBE_REPLY_FLAG_LIFETIME_SHARED 0x0004
58#define PROBE_REPLY_FLAG_PROBE_MORE 0x0008
59
62{
63 uint64_t request_id;
68 uint64_t timestamp;
69 uint32_t flags;
70};
71
74{
75 uint64_t request_id;
76 uint16_t priority;
77 uint16_t weight;
85 uint16_t flags;
86};
87
88/* Smallest on-wire value length (the TLV header not counted) of each TLV: the
89 * sizes of the fixed fields above, in wire order. A value may be longer, which
90 * is how the TLVs are extended; trailing bytes that are not understood are
91 * ignored on read. */
92
94#define PROBE_REQUEST_LEN ((uint16_t)(2 * sizeof(uint64_t) + sizeof(uint32_t)))
95
98#define PROBE_REPLY_LEN ((uint16_t)(sizeof(uint64_t) + 5 * sizeof(uint16_t)))
99
105bool probe_request_write(struct buffer *buf, const struct probe_request *r);
106
117bool probe_request_read(struct buffer *buf, struct probe_request *r);
118
124bool probe_reply_write(struct buffer *buf, const struct probe_reply *r);
125
139bool probe_reply_read(struct buffer *buf, struct probe_reply *r);
140
141#endif /* ifndef PROBE_H */
Buffer management functions and garbage collection.
TLV framing shared by the TLV-based control messages of the wire protocol.
bool probe_reply_write(struct buffer *buf, const struct probe_reply *r)
Write a complete probe reply TLV, header and value, to buf.
Definition probe.c:58
bool probe_request_read(struct buffer *buf, struct probe_request *r)
Read a probe request TLV value from buf.
Definition probe.c:41
bool probe_request_write(struct buffer *buf, const struct probe_request *r)
Write a complete probe request TLV, header and value, to buf.
Definition probe.c:33
bool probe_reply_read(struct buffer *buf, struct probe_reply *r)
Read a probe reply TLV value from buf.
Definition probe.c:67
Wrapper structure for dynamically allocated memory.
Definition buffer.h:71
probe reply TLV, a server's answer to a probe request
Definition probe.h:74
uint16_t priority
DNS SRV style priority, lower is preferred.
Definition probe.h:76
uint16_t connect_lifetime
For how many seconds, counted from the moment the client sent its own probe request,...
Definition probe.h:84
uint16_t weight
DNS SRV style weight.
Definition probe.h:77
uint64_t request_id
echoes the request_id of the request
Definition probe.h:75
uint16_t max_latency_diff
candidate band in ms around the fastest server
Definition probe.h:78
uint16_t flags
PROBE_REPLY_FLAG_*.
Definition probe.h:85
probe request TLV, sent by a client to probe a server
Definition probe.h:62
uint32_t flags
PROBE_REQUEST_FLAG_*.
Definition probe.h:69
uint64_t timestamp
The client clock as a UNIX timestamp in seconds.
Definition probe.h:68
uint64_t request_id
identifies this probe, echoed in the reply
Definition probe.h:63