This file contains PROXY protocol functions. More...
#include "util/proxy_protocol.h"
Data Structures | |
struct | proxy_protocol_data |
Internal struct initialized with function pointers for writing uint16 and uint32. More... | |
struct | proxy_protocol_lookup_table |
Internal lookup table; could be further generic like sldns_lookup_table for all the future generic stuff. More... | |
Functions | |
void | pp_init (void(*write_uint16)(void *buf, uint16_t data), void(*write_uint32)(void *buf, uint32_t data)) |
Initialize the internal proxy structure. More... | |
const char * | pp_lookup_error (enum pp_parse_errors error) |
Lookup the parsing error description. More... | |
size_t | pp2_write_to_buf (uint8_t *buf, size_t buflen, struct sockaddr_in *src, int stream) |
Write a PROXYv2 header at the current position of the buffer. More... | |
int | pp2_read_header (uint8_t *buf, size_t buflen) |
Read a PROXYv2 header from the current position of the buffer. More... | |
Variables | |
struct proxy_protocol_data | pp_data |
static struct proxy_protocol_lookup_table | pp_parse_errors_data [] |
Internal parsing error text; could be exposed with pp_lookup_error. More... | |
This file contains PROXY protocol functions.
void pp_init | ( | void(*)(void *buf, uint16_t data) | write_uint16, |
void(*)(void *buf, uint32_t data) | write_uint32 | ||
) |
Initialize the internal proxy structure.
write_uint16 | pointer to a function that can write uint16. |
write_uint32 | pointer to a function that can write uint32. |
Referenced by main().
const char* pp_lookup_error | ( | enum pp_parse_errors | error | ) |
Lookup the parsing error description.
error | parsing error from pp2_read_header. |
References error(), and pp_parse_errors_data.
Referenced by comm_point_tcp_handle_read(), and ssl_handle_read().
size_t pp2_write_to_buf | ( | uint8_t * | buf, |
size_t | buflen, | ||
struct sockaddr_in * | src, | ||
int | stream | ||
) |
Write a PROXYv2 header at the current position of the buffer.
buf | pointer to the buffer to write data to. |
buflen | available size on the buffer. |
src | the source address. |
stream | if the protocol is stream or datagram. |
References PP2_HEADER_SIZE, and PP2_SIG.
int pp2_read_header | ( | uint8_t * | buf, |
size_t | buflen | ||
) |
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 | pointer to the buffer data to read from. |
buflen | available size on the buffer. |
References PP2_HEADER_SIZE.
Referenced by comm_point_tcp_handle_read(), consume_pp2_header(), and ssl_handle_read().
|
static |
Internal parsing error text; could be exposed with pp_lookup_error.
Referenced by pp_lookup_error().