OpenVPN 3 Core Library
Loading...
Searching...
No Matches
openvpn::oob Namespace Reference

Classes

struct  ProbeParameter
 probe parameter TLV (sent by the client in a SERVER_PROBE). More...
 
struct  ProbeReply
 probe reply TLV (sent by the server in a PROBE_REPLY). More...
 
struct  TlvHeader
 A decoded TLV header. More...
 

Enumerations

enum  : std::uint16_t { MSG_SERVER_PROBE = 0x100 , MSG_PROBE_REPLY = 0x101 }
 OOB message types: the 16-bit value at the start of an OOB payload. More...
 
enum  : std::uint16_t { TLV_OPTIONAL_FLAG = 0x8000 , TLV_TYPE_MASK = 0x7fff , TLV_PROBE_PARAMETER = 0x200 , TLV_PROBE_REPLY = 0x201 }
 TLV header bit layout of the first 16-bit field, and the TLV type space (0x2xx). More...
 
enum  : std::uint32_t { REPLY_FLAG_RESEND_WKC = 0x1 }
 

Functions

bool msg_write_header (Buffer &buf, std::uint16_t msg_type)
 Write an OOB message-type header (the 16-bit type preceding the TLVs).
 
bool msg_read_header (Buffer &buf, std::uint16_t expected_msg_type)
 
bool tlv_write_header (Buffer &buf, std::uint16_t type, bool optional, std::uint16_t value_len)
 Write a TLV header (type + optional flag + value length) to buf.
 
std::optional< TlvHeadertlv_read_header (Buffer &buf)
 
bool skip_trailing (Buffer &buf, std::uint16_t value_len, std::size_t consumed)
 
std::optional< std::uint16_t > find_tlv (Buffer &buf, std::uint16_t wanted_type)
 
bool server_probe_write (Buffer &buf, const ProbeParameter &param)
 Write a complete SERVER_PROBE (message header + probe_parameter TLV). Client.
 
std::optional< ProbeParameterserver_probe_read (Buffer &buf)
 
bool client_reply_write (Buffer &buf, const ProbeReply &reply)
 Write a complete PROBE_REPLY (message header + probe_reply TLV). Server.
 
std::optional< ProbeReplyclient_reply_read (Buffer &buf)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : std::uint16_t

OOB message types: the 16-bit value at the start of an OOB payload.

Enumerator
MSG_SERVER_PROBE 
MSG_PROBE_REPLY 

Definition at line 53 of file oob_probe.hpp.

◆ anonymous enum

anonymous enum : std::uint16_t

TLV header bit layout of the first 16-bit field, and the TLV type space (0x2xx).

Enumerator
TLV_OPTIONAL_FLAG 
TLV_TYPE_MASK 
TLV_PROBE_PARAMETER 
TLV_PROBE_REPLY 

Definition at line 60 of file oob_probe.hpp.

◆ anonymous enum

anonymous enum : std::uint32_t

probe_reply flags (the reply TLV's 32-bit flags field).

bit 0 (RESEND_WKC): the client must resend the wrapped client key (via CONTROL_WKC_V1) when it completes the handshake using this reply as a shortcut. Set by a tls-crypt-v2 server, which is stateless and discarded the WKc.

Enumerator
REPLY_FLAG_RESEND_WKC 

Definition at line 75 of file oob_probe.hpp.

Function Documentation

◆ client_reply_read()

std::optional< ProbeReply > openvpn::oob::client_reply_read ( Buffer buf)
inline

Read a received PROBE_REPLY: the client-side counterpart of server_probe_read().

Returns
the reply if the header matched and a well-formed probe_reply was found, std::nullopt otherwise

Definition at line 298 of file oob_probe.hpp.

Here is the caller graph for this function:

◆ client_reply_write()

bool openvpn::oob::client_reply_write ( Buffer buf,
const ProbeReply reply 
)
inline

Write a complete PROBE_REPLY (message header + probe_reply TLV). Server.

Definition at line 288 of file oob_probe.hpp.

Here is the caller graph for this function:

◆ find_tlv()

std::optional< std::uint16_t > openvpn::oob::find_tlv ( Buffer buf,
std::uint16_t  wanted_type 
)
inline

Scan for the first TLV of type wanted_type, skipping optional other/future types. On success buf is left positioned at that TLV's value.

Parameters
bufbuffer positioned at a TLV header
wanted_typethe TLV type to find
Returns
the found TLV's declared value length, or std::nullopt if the type is not present, a header/length is malformed, or a TLV we do not understand is not marked optional

Definition at line 157 of file oob_probe.hpp.

Here is the caller graph for this function:

◆ msg_read_header()

bool openvpn::oob::msg_read_header ( Buffer buf,
std::uint16_t  expected_msg_type 
)
inline

Read and verify an OOB message-type header, advancing past it.

Parameters
bufbuffer positioned at the OOB message payload
expected_msg_typethe message type the payload must carry
Returns
true if a message type was read and equals expected_msg_type

Definition at line 94 of file oob_probe.hpp.

Here is the caller graph for this function:

◆ msg_write_header()

bool openvpn::oob::msg_write_header ( Buffer buf,
std::uint16_t  msg_type 
)
inline

Write an OOB message-type header (the 16-bit type preceding the TLVs).

Definition at line 83 of file oob_probe.hpp.

Here is the caller graph for this function:

◆ server_probe_read()

std::optional< ProbeParameter > openvpn::oob::server_probe_read ( Buffer buf)
inline

Read a received SERVER_PROBE: verify the message header, then scan for the probe_parameter TLV (tolerating other/future TLVs). Consumes buf as it reads.

Returns
the parameter if the header matched and a well-formed probe_parameter was found, std::nullopt otherwise

Definition at line 277 of file oob_probe.hpp.

Here is the caller graph for this function:

◆ server_probe_write()

bool openvpn::oob::server_probe_write ( Buffer buf,
const ProbeParameter param 
)
inline

Write a complete SERVER_PROBE (message header + probe_parameter TLV). Client.

Definition at line 266 of file oob_probe.hpp.

Here is the caller graph for this function:

◆ skip_trailing()

bool openvpn::oob::skip_trailing ( Buffer buf,
std::uint16_t  value_len,
std::size_t  consumed 
)
inline

Consume a TLV value of value_len bytes, of which consumed have already been read, skipping any trailing bytes this version does not understand.

Returns
false if fewer than consumed bytes were declared, or the buffer is too short for the remainder

Definition at line 137 of file oob_probe.hpp.

Here is the caller graph for this function:

◆ tlv_read_header()

std::optional< TlvHeader > openvpn::oob::tlv_read_header ( Buffer buf)
inline

Read a TLV header from buf, advancing past it.

Returns
the decoded header, or std::nullopt if there are not enough bytes

Definition at line 121 of file oob_probe.hpp.

Here is the caller graph for this function:

◆ tlv_write_header()

bool openvpn::oob::tlv_write_header ( Buffer buf,
std::uint16_t  type,
bool  optional,
std::uint16_t  value_len 
)
inline

Write a TLV header (type + optional flag + value length) to buf.

Definition at line 109 of file oob_probe.hpp.

Here is the caller graph for this function: