* Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
-#include "or/or.h"
-#include "or/addressmap.h"
-#include "common/buffers.h"
-#include "or/control.h"
-#include "or/config.h"
+#include "core/or/or.h"
+#include "feature/client/addressmap.h"
+#include "lib/container/buffers.h"
+#include "core/mainloop/connection.h"
+#include "feature/control/control.h"
+#include "app/config/config.h"
#include "lib/crypt_ops/crypto_util.h"
-#include "or/ext_orport.h"
-#include "or/proto_socks.h"
-#include "or/reasons.h"
+#include "feature/relay/ext_orport.h"
+#include "core/proto/proto_socks.h"
+#include "core/or/reasons.h"
+
+#include "core/or/socks_request_st.h"
-#include "or/socks_request_st.h"
+ #include "trunnel/socks5.h"
+
+ #define SOCKS_VER_5 0x05 /* First octet of non-auth SOCKS5 messages */
+ #define SOCKS_VER_4 0x04 /* SOCKS4 messages */
+ #define SOCKS_AUTH 0x01 /* SOCKS5 auth messages */
+
+ typedef enum {
+ SOCKS_RESULT_INVALID = -1, /* Message invalid. */
+ SOCKS_RESULT_TRUNCATED = 0, /* Message incomplete/truncated. */
+ SOCKS_RESULT_DONE = 1, /* OK, we're done. */
+ SOCKS_RESULT_MORE_EXPECTED = 2, /* OK, more messages expected. */
+ } socks_result_t;
+
static void socks_request_set_socks5_error(socks_request_t *req,
socks5_reply_status_t reason);