cosmetics
[tomato.git] / release / src / router / openvpn / proxy.h
blob3f30eefc14a43f159058ea2ceaf30e25442bc7c6
1 /*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
8 * Copyright (C) 2002-2009 OpenVPN Technologies, Inc. <sales@openvpn.net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program (see the file COPYING included with this
21 * distribution); if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef PROXY_H
26 #define PROXY_H
28 #include "buffer.h"
29 #include "misc.h"
31 #ifdef GENERAL_PROXY_SUPPORT
34 * Return value for get_proxy_settings to automatically
35 * determine proxy information.
37 struct auto_proxy_info_entry {
38 char *server;
39 int port;
42 struct auto_proxy_info {
43 struct auto_proxy_info_entry http;
44 struct auto_proxy_info_entry socks;
47 struct auto_proxy_info *get_proxy_settings (char **err, struct gc_arena *gc);
49 #ifdef WIN32
50 void show_win_proxy_settings (const int msglevel);
51 #endif /* WIN32 */
53 #endif /* GENERAL_PROXY_SUPPORT */
55 #ifdef ENABLE_HTTP_PROXY
57 /* HTTP CONNECT authentication methods */
58 #define HTTP_AUTH_NONE 0
59 #define HTTP_AUTH_BASIC 1
60 #define HTTP_AUTH_NTLM 2
61 #define HTTP_AUTH_N 3
62 #define HTTP_AUTH_NTLM2 4
64 struct http_proxy_options {
65 const char *server;
66 int port;
67 bool retry;
68 int timeout;
69 bool auth_retry;
70 const char *auth_method_string;
71 const char *auth_file;
72 const char *http_version;
73 const char *user_agent;
76 struct http_proxy_info {
77 bool defined;
78 int auth_method;
79 struct http_proxy_options options;
80 struct user_pass up;
83 struct http_proxy_info *http_proxy_new (const struct http_proxy_options *o,
84 struct auto_proxy_info *auto_proxy_info);
86 void http_proxy_close (struct http_proxy_info *hp);
88 bool establish_http_proxy_passthru (struct http_proxy_info *p,
89 socket_descriptor_t sd, /* already open to proxy */
90 const char *host, /* openvpn server remote */
91 const int port, /* openvpn server port */
92 struct buffer *lookahead,
93 volatile int *signal_received);
95 uint8_t *make_base64_string2 (const uint8_t *str, int str_len, struct gc_arena *gc);
96 uint8_t *make_base64_string (const uint8_t *str, struct gc_arena *gc);
98 #endif /* ENABLE_HTTP_PROXY */
100 #endif /* PROXY_H */