OpenVPN
Macros | Functions | Variables
proxy.c File Reference
#include "syshead.h"
#include "common.h"
#include "misc.h"
#include "crypto.h"
#include "win32.h"
#include "socket.h"
#include "fdmisc.h"
#include "proxy.h"
#include "base64.h"
#include "httpdigest.h"
#include "ntlm.h"
#include "memdbg.h"
#include "forward.h"
Include dependency graph for proxy.c:

Go to the source code of this file.

Macros

#define UP_TYPE_PROXY   "HTTP Proxy"
 

Functions

struct http_proxy_optionsinit_http_proxy_options_once (struct http_proxy_options **hpo, struct gc_arena *gc)
 
static bool recv_line (socket_descriptor_t sd, char *buf, int len, const int timeout_sec, const bool verbose, struct buffer *lookahead, volatile int *signal_received)
 
static bool send_line (socket_descriptor_t sd, const char *buf)
 
static bool send_line_crlf (socket_descriptor_t sd, const char *src)
 
static bool send_crlf (socket_descriptor_t sd)
 
uint8_t * make_base64_string2 (const uint8_t *str, int src_len, struct gc_arena *gc)
 
uint8_t * make_base64_string (const uint8_t *str, struct gc_arena *gc)
 
static const char * username_password_as_base64 (const struct http_proxy_info *p, struct gc_arena *gc)
 
static void clear_user_pass_http (void)
 
static void get_user_pass_http (struct http_proxy_info *p, const bool force)
 
static int get_proxy_authenticate (socket_descriptor_t sd, int timeout, char **data, volatile int *signal_received)
 
static void store_proxy_authenticate (struct http_proxy_info *p, char *data)
 
static bool get_key_value (const char *str, char *key, char *value, int max_key_len, int max_value_len, const char **endptr)
 
static char * get_pa_var (const char *key, const char *pa, struct gc_arena *gc)
 
struct http_proxy_infohttp_proxy_new (const struct http_proxy_options *o)
 
void http_proxy_close (struct http_proxy_info *hp)
 
static bool add_proxy_headers (struct http_proxy_info *p, socket_descriptor_t sd, const char *host, const char *port)
 
bool establish_http_proxy_passthru (struct http_proxy_info *p, socket_descriptor_t sd, const char *host, const char *port, struct event_timeout *server_poll_timeout, struct buffer *lookahead, struct signal_info *sig_info)
 

Variables

static struct user_pass static_proxy_user_pass
 

Macro Definition Documentation

◆ UP_TYPE_PROXY

#define UP_TYPE_PROXY   "HTTP Proxy"

Definition at line 43 of file proxy.c.

Function Documentation

◆ add_proxy_headers()

static bool add_proxy_headers ( struct http_proxy_info p,
socket_descriptor_t  sd,
const char *  host,
const char *  port 
)
static

◆ clear_user_pass_http()

static void clear_user_pass_http ( void  )
static

Definition at line 254 of file proxy.c.

References purge_user_pass(), and static_proxy_user_pass.

Referenced by establish_http_proxy_passthru(), and get_user_pass_http().

◆ establish_http_proxy_passthru()

bool establish_http_proxy_passthru ( struct http_proxy_info p,
socket_descriptor_t  sd,
const char *  host,
const char *  port,
struct event_timeout server_poll_timeout,
struct buffer lookahead,
struct signal_info sig_info 
)

◆ get_key_value()

static bool get_key_value ( const char *  str,
char *  key,
char *  value,
int  max_key_len,
int  max_value_len,
const char **  endptr 
)
static

Definition at line 386 of file proxy.c.

Referenced by get_pa_var().

◆ get_pa_var()

static char* get_pa_var ( const char *  key,
const char *  pa,
struct gc_arena gc 
)
static

Definition at line 467 of file proxy.c.

References get_key_value(), status, and string_alloc().

Referenced by establish_http_proxy_passthru().

◆ get_proxy_authenticate()

static int get_proxy_authenticate ( socket_descriptor_t  sd,
int  timeout,
char **  data,
volatile int *  signal_received 
)
static

◆ get_user_pass_http()

static void get_user_pass_http ( struct http_proxy_info p,
const bool  force 
)
static

◆ http_proxy_close()

void http_proxy_close ( struct http_proxy_info hp)

Definition at line 565 of file proxy.c.

Referenced by uninit_proxy_dowork().

◆ http_proxy_new()

struct http_proxy_info* http_proxy_new ( const struct http_proxy_options o)

◆ init_http_proxy_options_once()

struct http_proxy_options* init_http_proxy_options_once ( struct http_proxy_options **  hpo,
struct gc_arena gc 
)

Definition at line 46 of file proxy.c.

References ALLOC_OBJ_CLEAR_GC.

Referenced by add_option(), and management_callback_proxy_cmd().

◆ make_base64_string()

uint8_t* make_base64_string ( const uint8_t *  str,
struct gc_arena gc 
)

Definition at line 238 of file proxy.c.

References make_base64_string2().

Referenced by username_password_as_base64().

◆ make_base64_string2()

uint8_t* make_base64_string2 ( const uint8_t *  str,
int  src_len,
struct gc_arena gc 
)

◆ recv_line()

static bool recv_line ( socket_descriptor_t  sd,
char *  buf,
int  len,
const int  timeout_sec,
const bool  verbose,
struct buffer lookahead,
volatile int *  signal_received 
)
static

◆ send_crlf()

static bool send_crlf ( socket_descriptor_t  sd)
static

Definition at line 221 of file proxy.c.

References send_line_crlf().

Referenced by establish_http_proxy_passthru().

◆ send_line()

static bool send_line ( socket_descriptor_t  sd,
const char *  buf 
)
static

Definition at line 194 of file proxy.c.

References D_LINK_ERRORS, M_ERRNO, msg, and MSG_NOSIGNAL.

Referenced by send_line_crlf().

◆ send_line_crlf()

static bool send_line_crlf ( socket_descriptor_t  sd,
const char *  src 
)
static

◆ store_proxy_authenticate()

static void store_proxy_authenticate ( struct http_proxy_info p,
char *  data 
)
static

Definition at line 375 of file proxy.c.

References buffer::data, and http_proxy_info::proxy_authenticate.

Referenced by establish_http_proxy_passthru().

◆ username_password_as_base64()

static const char* username_password_as_base64 ( const struct http_proxy_info p,
struct gc_arena gc 
)
static

Variable Documentation

◆ static_proxy_user_pass

struct user_pass static_proxy_user_pass
static

Definition at line 60 of file proxy.c.

Referenced by clear_user_pass_http(), and get_user_pass_http().