diff options
Diffstat (limited to 'src/gns/gnocksy/protocol.h')
-rw-r--r-- | src/gns/gnocksy/protocol.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/gns/gnocksy/protocol.h b/src/gns/gnocksy/protocol.h new file mode 100644 index 000000000..ea076ad1a --- /dev/null +++ b/src/gns/gnocksy/protocol.h | |||
@@ -0,0 +1,57 @@ | |||
1 | |||
2 | |||
3 | /* The socks phases */ | ||
4 | enum | ||
5 | { | ||
6 | SOCKS5_INIT, | ||
7 | SOCKS5_REQUEST, | ||
8 | SOCKS5_DATA_TRANSFER | ||
9 | }; | ||
10 | |||
11 | /* Client hello */ | ||
12 | struct socks5_client_hello | ||
13 | { | ||
14 | uint8_t version; | ||
15 | uint8_t num_auth_methods; | ||
16 | char* auth_methods; | ||
17 | }; | ||
18 | |||
19 | /* Client socks request */ | ||
20 | struct socks5_client_request | ||
21 | { | ||
22 | uint8_t version; | ||
23 | uint8_t command; | ||
24 | uint8_t resvd; | ||
25 | uint8_t addr_type; | ||
26 | /* | ||
27 | * followed by either an ip4/ipv6 address | ||
28 | * or a domain name with a length field in front | ||
29 | */ | ||
30 | }; | ||
31 | |||
32 | /* Server hello */ | ||
33 | struct socks5_server_hello | ||
34 | { | ||
35 | uint8_t version; | ||
36 | uint8_t auth_method; | ||
37 | }; | ||
38 | |||
39 | /* Struct used to store connection | ||
40 | * information | ||
41 | */ | ||
42 | struct socks5_bridge | ||
43 | { | ||
44 | int fd; | ||
45 | struct socks5_bridge* remote_end; | ||
46 | int status; | ||
47 | }; | ||
48 | |||
49 | /* Server response to client requests */ | ||
50 | struct socks5_server_response | ||
51 | { | ||
52 | uint8_t version; | ||
53 | uint8_t reply; | ||
54 | uint8_t reserved; | ||
55 | uint8_t addr_type; | ||
56 | uint8_t add_port[18]; | ||
57 | }; | ||