tor  0.4.1.0-alpha-dev
socks_request_st.h
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 #ifndef SOCKS_REQUEST_ST_H
8 #define SOCKS_REQUEST_ST_H
9 
10 #define MAX_SOCKS_REPLY_LEN 1024
11 
12 #define SOCKS_NO_AUTH 0x00
13 #define SOCKS_USER_PASS 0x02
14 
16 #define SOCKS_COMMAND_CONNECT 0x01
17 
18 #define SOCKS_COMMAND_RESOLVE 0xF0
19 
20 #define SOCKS_COMMAND_RESOLVE_PTR 0xF1
21 
22 /* || 0 is for -Wparentheses-equality (-Wall?) appeasement under clang */
23 #define SOCKS_COMMAND_IS_CONNECT(c) (((c)==SOCKS_COMMAND_CONNECT) || 0)
24 #define SOCKS_COMMAND_IS_RESOLVE(c) ((c)==SOCKS_COMMAND_RESOLVE || \
25  (c)==SOCKS_COMMAND_RESOLVE_PTR)
26 
34  uint8_t socks_version;
38  uint8_t auth_type;
40  uint8_t command;
42  uint8_t listener_type;
43  size_t replylen;
44  uint8_t reply[MAX_SOCKS_REPLY_LEN];
50  char address[MAX_SOCKS_ADDR_LEN];
52  uint16_t port;
53  unsigned int has_finished : 1;
56  unsigned int got_auth : 1;
60  unsigned int socks_prefer_no_auth : 1;
61 
63  size_t usernamelen;
65  uint8_t passwordlen;
69  char *username;
72  char *password;
73 
74  uint8_t socks5_atyp; /* SOCKS5 address type */
75 };
76 
77 #endif
unsigned int has_finished
uint8_t reply[MAX_SOCKS_REPLY_LEN]
char address[MAX_SOCKS_ADDR_LEN]
unsigned int got_auth
unsigned int socks_prefer_no_auth