OpenVPN
probe.c File Reference
#include "syshead.h"
#include "probe.h"
#include "control_msg.h"
Include dependency graph for probe.c:

Go to the source code of this file.

Functions

bool probe_request_write (struct buffer *buf, const struct probe_request *r)
 Write a complete probe request TLV, header and value, to buf.
bool probe_request_read (struct buffer *buf, struct probe_request *r)
 Read a probe request TLV value from buf.
bool probe_reply_write (struct buffer *buf, const struct probe_reply *r)
 Write a complete probe reply TLV, header and value, to buf.
bool probe_reply_read (struct buffer *buf, struct probe_reply *r)
 Read a probe reply TLV value from buf.

Function Documentation

◆ probe_reply_read()

bool probe_reply_read ( struct buffer * buf,
struct probe_reply * r )

Read a probe reply TLV value from buf.

The calling convention is that of probe_request_read().

The two flag combinations the protocol rules out are rejected here, since neither can be acted on: a reply must not call the other addresses of the remote both the same server and distinct ones, and it must not extend the connect_lifetime to those addresses without first calling them the same server.

Returns
true on success, false if buf is shorter than the mandatory fields or the flags contradict each other.

Definition at line 67 of file probe.c.

References buf_len(), buf_read_u16(), buf_read_u64(), probe_reply::connect_lifetime, probe_reply::flags, probe_reply::max_latency_diff, probe_reply::priority, PROBE_REPLY_FLAG_ADDRS_EQUAL, PROBE_REPLY_FLAG_LIFETIME_SHARED, PROBE_REPLY_FLAG_PROBE_MORE, PROBE_REPLY_LEN, probe_reply::request_id, and probe_reply::weight.

Referenced by test_probe_reply_flags_contradict(), test_probe_reply_roundtrip(), and test_probe_reply_too_short().

◆ probe_reply_write()

bool probe_reply_write ( struct buffer * buf,
const struct probe_reply * r )

◆ probe_request_read()

bool probe_request_read ( struct buffer * buf,
struct probe_request * r )

Read a probe request TLV value from buf.

buf must cover exactly the TLV's value, as ctrl_msg_find_tlv() returns it. Bytes beyond the fields understood here are ignored, so a longer value from a future version still parses. Flag bits that are not known are kept in flags rather than rejected, for the same reason.

Returns
true on success, false if buf is shorter than the mandatory fields.

Definition at line 41 of file probe.c.

References buf_len(), buf_read_u32(), buf_read_u64(), probe_request::flags, PROBE_REQUEST_LEN, probe_request::request_id, and probe_request::timestamp.

Referenced by test_find_tlv_skips_optional_after_wanted(), test_probe_request_forward_compat(), test_probe_request_roundtrip(), and test_probe_request_too_short().

◆ probe_request_write()

bool probe_request_write ( struct buffer * buf,
const struct probe_request * r )