aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnocksy/protocol.h
blob: ea076ad1a003646ff78ca629d415c4d6ee84df32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* The socks phases */
enum
{
  SOCKS5_INIT,
  SOCKS5_REQUEST,
  SOCKS5_DATA_TRANSFER
};

/* Client hello */
struct socks5_client_hello
{
  uint8_t version;
  uint8_t num_auth_methods;
  char* auth_methods;
};

/* Client socks request */
struct socks5_client_request
{
  uint8_t version;
  uint8_t command;
  uint8_t resvd;
  uint8_t addr_type;
  /* 
   * followed by either an ip4/ipv6 address
   * or a domain name with a length field in front
   */
};

/* Server hello */
struct socks5_server_hello
{
  uint8_t version;
  uint8_t auth_method;
};

/* Struct used to store connection
 * information
 */
struct socks5_bridge
{
  int fd;
  struct socks5_bridge* remote_end;
  int status;
};

/* Server response to client requests */
struct socks5_server_response
{
  uint8_t version;
  uint8_t reply;
  uint8_t reserved;
  uint8_t addr_type;
  uint8_t add_port[18];
};