diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-08-08 12:23:39 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-09-05 13:57:51 -0400 |
commit | 5921b465e7764d35b3f128cf0cf096eca3226688 (patch) | |
tree | 51f77fb0284b14bad8121043b00582e050b581c0 /src/or/proto_socks.c | |
parent | f28e314b0d5a6d4c677b87378cea70dc6524546b (diff) | |
download | tor-5921b465e7764d35b3f128cf0cf096eca3226688.tar.gz tor-5921b465e7764d35b3f128cf0cf096eca3226688.zip |
Make buffers.c independent of or.h
Also, put ext_or function in new module; it had accidentally gotten
into proto_socks.c
Diffstat (limited to 'src/or/proto_socks.c')
-rw-r--r-- | src/or/proto_socks.c | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/or/proto_socks.c b/src/or/proto_socks.c index 7c7431caea..f153658bb0 100644 --- a/src/or/proto_socks.c +++ b/src/or/proto_socks.c @@ -140,35 +140,6 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, return res; } -/** The size of the header of an Extended ORPort message: 2 bytes for - * COMMAND, 2 bytes for BODYLEN */ -#define EXT_OR_CMD_HEADER_SIZE 4 - -/** Read <b>buf</b>, which should contain an Extended ORPort message - * from a transport proxy. If well-formed, create and populate - * <b>out</b> with the Extended ORport message. Return 0 if the - * buffer was incomplete, 1 if it was well-formed and -1 if we - * encountered an error while parsing it. */ -int -fetch_ext_or_command_from_buf(buf_t *buf, ext_or_cmd_t **out) -{ - char hdr[EXT_OR_CMD_HEADER_SIZE]; - uint16_t len; - - if (buf_datalen(buf) < EXT_OR_CMD_HEADER_SIZE) - return 0; - peek_from_buf(hdr, sizeof(hdr), buf); - len = ntohs(get_uint16(hdr+2)); - if (buf_datalen(buf) < (unsigned)len + EXT_OR_CMD_HEADER_SIZE) - return 0; - *out = ext_or_cmd_new(len); - (*out)->cmd = ntohs(get_uint16(hdr)); - (*out)->len = len; - buf_remove_from_front(buf, EXT_OR_CMD_HEADER_SIZE); - fetch_from_buf((*out)->body, len, buf); - return 1; -} - /** Create a SOCKS5 reply message with <b>reason</b> in its REP field and * have Tor send it as error response to <b>req</b>. */ |