socks.h (1578B)
1 2 #define SOCKS_RESERVED 0x00 3 #define SOCKS_VERSION_4 0x04 4 #define SOCKS_VERSION_5 0x05 5 6 typedef unsigned char socks5_auth_mode_t; 7 #define SOCKS5_AUTH_METHOD_NOAUTH 0x00 8 #define SOCKS5_AUTH_METHOD_USERPASS 0x02 9 #define SOCKS5_AUTH_METHOD_NOMETHOD 0xff 10 11 #define SOCKS5_AUTH_OK 0x00 12 #define SOCKS5_AUTH_VERSION 0x01 13 #define SOCKS5_AUTH_FAIL 0xff 14 15 typedef unsigned char socks5_command_t; 16 #define SOCKS5_CMD_CONNECT 0x01 17 #define SOCKS5_BIND 0x02 18 #define SOCKS5_UDP_ASSOCIATE 0x03 19 20 typedef unsigned char socks5_addr_type_t; 21 #define SOCKS5_ADDR_TYPE_IP4 0x01 22 #define SOCKS5_ADDR_TYPE_DOMAIN 0x03 23 #define SOCKS5_ADDR_TYPE_IP6 0x04 24 25 typedef unsigned char socks5_reply_t; 26 #define SOCKS5_REPLY_OK 0x00 // succeeded 27 #define SOCKS5_REPLY_ERR_GENERAL 0x01 // general SOCKS server failure 28 #define SOCKS5_REPLY_ERR_FORBIDDEN 0x02 // connection not allowed by ruleset 29 #define SOCKS5_REPLY_ERR_NET_UNREACH 0x03 // Network unreachable 30 #define SOCKS5_REPLY_ERR_HOST_UNREACH 0x04 // Host unreachable 31 #define SOCKS5_REPLY_ERR_CONN_REFUSED 0x05 // Connection refused 32 #define SOCKS5_REPLY_ERR_TTL 0x06 // TTL expired 33 #define SOCKS5_REPLY_ERR_CMD 0x07 // Command not supported 34 #define SOCKS5_REPLY_ERR_ATYPE 0x08 // Address type not supported 35 36 #define SOCKS4_STATUS_OK 0x5a 37 #define SOCKS4_STATUS_FAILED 0x5b 38 39 typedef struct socks_header_s { 40 unsigned char version; 41 unsigned char methods; 42 } socks_header; 43 44 45 typedef struct socks5_request_header_s { 46 unsigned char version; 47 socks5_command_t cmd; 48 unsigned char reserved; 49 socks5_addr_type_t atyp; 50 } socks5_request_header; 51 52 /* vim: sw=4 sts=4 et 53 */