+++ /dev/null
-/*\r
- * Network proxy abstraction in PuTTY\r
- *\r
- * A proxy layer, if necessary, wedges itself between the\r
- * network code and the higher level backend.\r
- *\r
- * Supported proxies: HTTP CONNECT, generic telnet, SOCKS 4 & 5\r
- */\r
-\r
-#ifndef PUTTY_PROXY_H\r
-#define PUTTY_PROXY_H\r
-\r
-#define PROXY_ERROR_GENERAL 8000\r
-#define PROXY_ERROR_UNEXPECTED 8001\r
-\r
-typedef struct Socket_proxy_tag * Proxy_Socket;\r
-\r
-struct Socket_proxy_tag {\r
- const struct socket_function_table *fn;\r
- /* the above variable absolutely *must* be the first in this structure */\r
-\r
- char * error;\r
-\r
- Socket sub_socket;\r
- Plug plug;\r
- SockAddr remote_addr;\r
- int remote_port;\r
-\r
- bufchain pending_output_data;\r
- bufchain pending_oob_output_data;\r
- int pending_flush;\r
- bufchain pending_input_data;\r
-\r
-#define PROXY_STATE_NEW -1\r
-#define PROXY_STATE_ACTIVE 0\r
-\r
- int state; /* proxy states greater than 0 are implementation\r
- * dependent, but represent various stages/states\r
- * of the initialization/setup/negotiation with the\r
- * proxy server.\r
- */\r
- int freeze; /* should we freeze the underlying socket when\r
- * we are done with the proxy negotiation? this\r
- * simply caches the value of sk_set_frozen calls.\r
- */\r
-\r
-#define PROXY_CHANGE_NEW -1\r
-#define PROXY_CHANGE_CLOSING 0\r
-#define PROXY_CHANGE_SENT 1\r
-#define PROXY_CHANGE_RECEIVE 2\r
-#define PROXY_CHANGE_ACCEPTING 3\r
-\r
- /* something has changed (a call from the sub socket\r
- * layer into our Proxy Plug layer, or we were just\r
- * created, etc), so the proxy layer needs to handle\r
- * this change (the type of which is the second argument)\r
- * and further the proxy negotiation process.\r
- */\r
-\r
- int (*negotiate) (Proxy_Socket /* this */, int /* change type */);\r
-\r
- /* current arguments of plug handlers\r
- * (for use by proxy's negotiate function)\r
- */\r
-\r
- /* closing */\r
- const char *closing_error_msg;\r
- int closing_error_code;\r
- int closing_calling_back;\r
-\r
- /* receive */\r
- int receive_urgent;\r
- char *receive_data;\r
- int receive_len;\r
-\r
- /* sent */\r
- int sent_bufsize;\r
-\r
- /* accepting */\r
- OSSocket accepting_sock;\r
-\r
- /* configuration, used to look up proxy settings */\r
- Config cfg;\r
-\r
- /* CHAP transient data */\r
- int chap_num_attributes;\r
- int chap_num_attributes_processed;\r
- int chap_current_attribute;\r
- int chap_current_datalen;\r
-};\r
-\r
-typedef struct Plug_proxy_tag * Proxy_Plug;\r
-\r
-struct Plug_proxy_tag {\r
- const struct plug_function_table *fn;\r
- /* the above variable absolutely *must* be the first in this structure */\r
-\r
- Proxy_Socket proxy_socket;\r
-\r
-};\r
-\r
-extern void proxy_activate (Proxy_Socket);\r
-\r
-extern int proxy_http_negotiate (Proxy_Socket, int);\r
-extern int proxy_telnet_negotiate (Proxy_Socket, int);\r
-extern int proxy_socks4_negotiate (Proxy_Socket, int);\r
-extern int proxy_socks5_negotiate (Proxy_Socket, int);\r
-\r
-/*\r
- * This may be reused by local-command proxies on individual\r
- * platforms.\r
- */\r
-char *format_telnet_command(SockAddr addr, int port, const Config *cfg);\r
-\r
-/*\r
- * These are implemented in cproxy.c or nocproxy.c, depending on\r
- * whether encrypted proxy authentication is available.\r
- */\r
-extern void proxy_socks5_offerencryptedauth(char *command, int *len);\r
-extern int proxy_socks5_handlechap (Proxy_Socket p);\r
-extern int proxy_socks5_selectchap(Proxy_Socket p);\r
-\r
-#endif\r