diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-06-17 18:49:55 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-06-17 18:49:55 +0000 |
commit | f9f09f1c5e69fcbd9a1c840c1b86854dfee3af6a (patch) | |
tree | be08d99134fa5d6e5c61db0eea34a479ba7db470 /src/or/or.h | |
parent | 946892ab68bfeab4aa503d673adaa8374f778c55 (diff) | |
download | tor-f9f09f1c5e69fcbd9a1c840c1b86854dfee3af6a.tar.gz tor-f9f09f1c5e69fcbd9a1c840c1b86854dfee3af6a.zip |
Start implementing framework for revised control spec.
svn:r4447
Diffstat (limited to 'src/or/or.h')
-rw-r--r-- | src/or/or.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/or/or.h b/src/or/or.h index 650484b21b..29ba3bbe83 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -286,9 +286,11 @@ typedef enum { #define _DIR_CONN_STATE_MAX 5 #define _CONTROL_CONN_STATE_MIN 1 -#define CONTROL_CONN_STATE_OPEN 1 -#define CONTROL_CONN_STATE_NEEDAUTH 2 -#define _CONTROL_CONN_STATE_MAX 2 +#define CONTROL_CONN_STATE_OPEN_V0 1 +#define CONTROL_CONN_STATE_OPEN_V1 2 +#define CONTROL_CONN_STATE_NEEDAUTH_V0 3 +#define CONTROL_CONN_STATE_NEEDAUTH_V1 4 +#define _CONTROL_CONN_STATE_MAX 4 #define _DIR_PURPOSE_MIN 1 /** Purpose for connection to directory server: download a directory. */ @@ -655,10 +657,12 @@ struct connection_t { /* Used only by control connections */ uint32_t event_mask; - uint16_t incoming_cmd_type; uint32_t incoming_cmd_len; uint32_t incoming_cmd_cur_len; char *incoming_cmd; + + /* Used only by control v0 connections */ + uint16_t incoming_cmd_type; }; typedef struct connection_t connection_t; @@ -1181,8 +1185,9 @@ int fetch_from_buf_http(buf_t *buf, char **headers_out, size_t max_headerlen, char **body_out, size_t *body_used, size_t max_bodylen); int fetch_from_buf_socks(buf_t *buf, socks_request_t *req); -int fetch_from_buf_control(buf_t *buf, uint32_t *len_out, uint16_t *type_out, - char **body_out); +int fetch_from_buf_control0(buf_t *buf, uint32_t *len_out, uint16_t *type_out, + char **body_out, int check_for_v1); +int fetch_from_buf_line(buf_t *buf, char *data_out, size_t *data_len); void assert_buf_ok(buf_t *buf); |