This file contains PROXY protocol structs and functions. More...
#include "sldns/sbuffer.h"
Data Structures | |
struct | pp2_header |
PROXYv2 header. More... | |
Macros | |
#define | PP2_HEADER_SIZE 16 |
PROXYv2 minimum header size. | |
#define | PP2_SIG "\x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A" |
PROXYv2 header signature. | |
#define | PP2_SIG_LEN 12 |
#define | PP2_VERSION 0x2 |
PROXYv2 version. | |
Enumerations | |
enum | pp2_command { PP2_CMD_LOCAL = 0x0 , PP2_CMD_PROXY = 0x1 } |
PROXYv2 command. | |
enum | pp2_af { PP2_AF_UNSPEC = 0x0 , PP2_AF_INET = 0x1 , PP2_AF_INET6 = 0x2 , PP2_AF_UNIX = 0x3 } |
PROXYv2 address family. | |
enum | pp2_protocol { PP2_PROT_UNSPEC = 0x0 , PP2_PROT_STREAM = 0x1 , PP2_PROT_DGRAM = 0x2 } |
PROXYv2 protocol. | |
Functions | |
int | pp2_write_to_buf (struct sldns_buffer *buf, struct sockaddr_storage *src, int stream) |
Write a PROXYv2 header at the current position of the buffer. More... | |
struct pp2_header * | pp2_read_header (struct sldns_buffer *buf) |
Read a PROXYv2 header from the current position of the buffer. More... | |
This file contains PROXY protocol structs and functions.
Only v2 is supported. TLVs are not currently supported.
int pp2_write_to_buf | ( | struct sldns_buffer * | buf, |
struct sockaddr_storage * | src, | ||
int | stream | ||
) |
Write a PROXYv2 header at the current position of the buffer.
buf | the buffer to write to. |
src | the source address. |
stream | if the protocol is stream or datagram. |
References PP2_HEADER_SIZE, PP2_SIG, sldns_buffer_remaining(), and sldns_buffer_write().
struct pp2_header* pp2_read_header | ( | struct sldns_buffer * | buf | ) |
Read a PROXYv2 header from the current position of the buffer.
It does initial validation and returns a pointer to the buffer position on success.
buf | the buffer to read from. |
References log_err(), PP2_HEADER_SIZE, PP2_SIG, sldns_buffer_begin(), and sldns_buffer_remaining().
Referenced by comm_point_tcp_handle_read(), consume_pp2_header(), and ssl_handle_read().