Go to the source code of this file.
Data Structures | |
struct | proxy_config_t |
Defines | |
#define | http_owner proxy_LTX_http_owner |
#define | socks5_owner proxy_LTX_socks5_owner |
Functions | |
int | http_reconnect (int idx, const char *host, int port) |
int | socks5_reconnect (int idx, const char *host, int port) |
Variables | |
proxy_config_t | proxy_config |
event_owner_t | http_owner |
event_owner_t | socks5_owner |
#define http_owner proxy_LTX_http_owner |
#define socks5_owner proxy_LTX_socks5_owner |
int http_reconnect | ( | int | idx, | |
const char * | host, | |||
int | port | |||
) |
Definition at line 147 of file http.c.
References egg_client(), proxy_info_t::host, proxy_config_t::host, proxy_info_t::http_host, linemode_on(), NULL, proxy_info_t::our_idx, proxy_info_t::password, proxy_config_t::password, proxy_info_t::port, proxy_config_t::port, proxy_config, sockbuf_attach_filter(), sockbuf_new(), sockbuf_set_handler(), proxy_info_t::status, proxy_info_t::their_idx, proxy_info_t::username, and proxy_config_t::username.
00148 { 00149 int our_idx; 00150 proxy_info_t *info; 00151 00152 if (!proxy_config.host) return(-1); 00153 00154 our_idx = egg_client(-1, proxy_config.host, proxy_config.port, NULL, 0, -1); 00155 if (our_idx < 0) return(-1); 00156 00157 /* Save our destination. */ 00158 info = (proxy_info_t *)calloc(1, sizeof(*info)); 00159 info->host = strdup(host); 00160 info->port = port; 00161 /* Also save the proxy info, in case the config changes while we're 00162 * connecting. */ 00163 info->http_host = strdup(proxy_config.host); 00164 if (proxy_config.username) info->username = strdup(proxy_config.username); 00165 if (proxy_config.password) info->password = strdup(proxy_config.password); 00166 00167 info->our_idx = our_idx; 00168 linemode_on(info->our_idx); 00169 00170 if (idx >= 0) info->their_idx = idx; 00171 else info->their_idx = sockbuf_new(); 00172 00173 info->status = 0; 00174 00175 sockbuf_set_handler(info->our_idx, &http_events, info, &http_owner); 00176 sockbuf_attach_filter(info->their_idx, &delete_listener, info); 00177 00178 return(info->their_idx); 00179 }
int socks5_reconnect | ( | int | idx, | |
const char * | host, | |||
int | port | |||
) |
Definition at line 314 of file socks5.c.
References egg_client(), proxy_info_t::host, proxy_config_t::host, NULL, proxy_info_t::our_idx, proxy_config_t::password, proxy_info_t::password, proxy_info_t::port, proxy_config_t::port, sockbuf_attach_filter(), sockbuf_new(), sockbuf_set_handler(), proxy_info_t::status, str_redup(), proxy_info_t::their_idx, proxy_config_t::username, and proxy_info_t::username.
00315 { 00316 proxy_info_t *info; 00317 int our_idx; 00318 00319 if (!proxy_config.host) return(-1); 00320 00321 our_idx = egg_client(-1, proxy_config.host, proxy_config.port, NULL, 0, -1); 00322 00323 if (our_idx < 0) return(-1); 00324 00325 info = (proxy_info_t *)calloc(1, sizeof(*info)); 00326 info->host = strdup(host); 00327 info->port = port; 00328 str_redup(&info->username, proxy_config.username); 00329 str_redup(&info->password, proxy_config.password); 00330 info->status = 0; 00331 00332 info->our_idx = our_idx; 00333 if (idx >= 0) info->their_idx = idx; 00334 else info->their_idx = sockbuf_new(); 00335 00336 sockbuf_set_handler(info->our_idx, &socks5_events, info, &socks5_owner); 00337 sockbuf_attach_filter(info->their_idx, &delete_listener, info); 00338 00339 return(info->their_idx); 00340 }