8 PACKED(struct socks4_request_t {
16 PACKED(struct socks4_response_t {
23 typedef struct socks4_request_t socks4_request_t;
24 typedef struct socks4_response_t socks4_response_t;
26 PACKED(struct socks5_greet_t {
32 typedef struct socks5_greet_t socks5_greet_t;
34 PACKED(struct socks5_conn_hdr_t {
41 PACKED(struct socks5_ipv4_t {
46 PACKED(struct socks5_ipv6_t {
51 typedef struct socks5_conn_hdr_t socks5_conn_hdr_t;
52 typedef struct socks5_ipv4_t socks5_ipv4_t;
53 typedef struct socks5_ipv6_t socks5_ipv6_t;
55 PACKED(struct socks5_conn_req_t {
56 socks5_conn_hdr_t header;
63 PACKED(struct socks5_server_choice_t {
64 uint8_t socks_version;
68 PACKED(struct socks5_auth_status_t {
73 typedef struct socks5_auth_status_t socks5_auth_status_t;
75 PACKED(struct socks5_conn_resp_t {
76 uint8_t socks_version;
82 typedef struct socks5_conn_req_t socks5_conn_req_t;
83 typedef struct socks5_server_choice_t socks5_server_choice_t;
84 typedef struct socks5_conn_resp_t socks5_conn_resp_t;
86 PACKED(struct socks5_resp_t {
87 socks5_server_choice_t choice;
90 // if choice == password
92 socks5_auth_status_t status;
93 socks5_conn_resp_t resp;
96 // if choice == anonymous
97 socks5_conn_resp_t anon;
101 typedef struct socks5_resp_t socks5_resp_t;
103 // Get the length of a connection request to a SOCKS 4 or 5 proxy
104 extern size_t socks_req_len(proxytype_t type, const sockaddr_t *sa);
106 // Create a request to connect to a SOCKS 4 or 5 proxy.
107 // Returns the expected response length, or zero on error.
108 extern size_t create_socks_req(proxytype_t type, void *req, const sockaddr_t *sa);
110 // Check that SOCKS server provided a valid response and permitted further requests
111 extern bool check_socks_resp(proxytype_t type, const void *buf, size_t len);
113 #endif // TINC_PROXY_H