Tor
0.4.7.0-alpha-dev
|
Header for proto_socks.c. More...
Go to the source code of this file.
Macros | |
#define | socks_request_free(req) FREE_AND_NULL(socks_request_t, socks_request_free_, (req)) |
Functions | |
struct socks_request_t * | socks_request_new (void) |
void | socks_request_free_ (struct socks_request_t *req) |
int | fetch_from_buf_socks (struct buf_t *buf, socks_request_t *req, int log_sockstype, int safe_socks) |
int | fetch_from_buf_socks_client (buf_t *buf, int state, char **reason) |
Header for proto_socks.c.
Definition in file proto_socks.h.
int fetch_from_buf_socks | ( | buf_t * | buf, |
socks_request_t * | req, | ||
int | log_sockstype, | ||
int | safe_socks | ||
) |
There is a (possibly incomplete) socks handshake on buf, of one of the forms
If it's invalid or too big, return -1.
Else it's not all there yet, leave buf alone and return 0.
If you want to specify the socks reply, write it into req->reply and set req->replylen, else leave req->replylen alone.
If log_sockstype is non-zero, then do a notice-level log of whether the connection is possibly leaking DNS requests locally or not.
If safe_socks is true, then reject unsafe socks protocols.
If returning 0 or -1, req->address and req->port are undefined.
Definition at line 829 of file proto_socks.c.
int fetch_from_buf_socks_client | ( | buf_t * | buf, |
int | state, | ||
char ** | reason | ||
) |
Inspect a reply from SOCKS server stored in buf according to state, removing the protocol data upon success. Return 0 on incomplete response, 1 on success and -1 on error, in which case reason is set to a descriptive message (free() when finished with it).
As a special case, 2 is returned when user/pass is required during SOCKS5 handshake and user/pass is configured.
Definition at line 1005 of file proto_socks.c.
Referenced by connection_fetch_from_buf_socks_client().
void socks_request_free_ | ( | socks_request_t * | req | ) |
Free all storage held in the socks_request_t req.
Definition at line 94 of file proto_socks.c.
struct socks_request_t* socks_request_new | ( | void | ) |
Return a new socks_request_t.
Definition at line 87 of file proto_socks.c.