socks.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Constants used in the SOCKS protocols.
  3. */
  4. /* Command codes common to both versions */
  5. #define SOCKS_CMD_CONNECT 1
  6. #define SOCKS_CMD_BIND 2
  7. /* SOCKS 4 definitions */
  8. #define SOCKS4_REQUEST_VERSION 4
  9. #define SOCKS4_REPLY_VERSION 0
  10. #define SOCKS4_RESP_SUCCESS 90
  11. #define SOCKS4_RESP_FAILURE 91
  12. #define SOCKS4_RESP_WANT_IDENTD 92
  13. #define SOCKS4_RESP_IDENTD_MISMATCH 93
  14. /*
  15. * Special nonsense IP address range, used as a signal to indicate
  16. * that an ASCIZ hostname follows the user id field.
  17. *
  18. * Strictly speaking, the use of this extension indicates that we're
  19. * speaking SOCKS 4A rather than vanilla SOCKS 4, although we don't
  20. * bother to draw the distinction.
  21. */
  22. #define SOCKS4A_NAME_FOLLOWS_BASE 0x00000001 /* inclusive */
  23. #define SOCKS4A_NAME_FOLLOWS_LIMIT 0x00000100 /* exclusive */
  24. /* SOCKS 5 definitions */
  25. #define SOCKS5_REQUEST_VERSION 5
  26. #define SOCKS5_REPLY_VERSION 5
  27. /* Extra command codes extending the SOCKS_CMD_* list above */
  28. #define SOCKS5_CMD_UDP_ASSOCIATE 3
  29. #define SOCKS5_AUTH_NONE 0
  30. #define SOCKS5_AUTH_GSSAPI 1
  31. #define SOCKS5_AUTH_PASSWORD 2
  32. #define SOCKS5_AUTH_CHAP 3
  33. #define SOCKS5_AUTH_REJECTED 0xFF /* used in reply to indicate 'no
  34. * acceptable method offered' */
  35. #define SOCKS5_AUTH_PASSWORD_VERSION 1
  36. #define SOCKS5_AUTH_CHAP_VERSION 1
  37. #define SOCKS5_AUTH_CHAP_ATTR_STATUS 0x00
  38. #define SOCKS5_AUTH_CHAP_ATTR_INFO 0x01
  39. #define SOCKS5_AUTH_CHAP_ATTR_USERNAME 0x02
  40. #define SOCKS5_AUTH_CHAP_ATTR_CHALLENGE 0x03
  41. #define SOCKS5_AUTH_CHAP_ATTR_RESPONSE 0x04
  42. #define SOCKS5_AUTH_CHAP_ATTR_CHARSET 0x05
  43. #define SOCKS5_AUTH_CHAP_ATTR_IDENTIFIER 0x10
  44. #define SOCKS5_AUTH_CHAP_ATTR_ALGLIST 0x11
  45. #define SOCKS5_AUTH_CHAP_ALG_HMACMD5 0x85
  46. #define SOCKS5_ADDR_IPV4 1
  47. #define SOCKS5_ADDR_IPV6 4
  48. #define SOCKS5_ADDR_HOSTNAME 3
  49. #define SOCKS5_RESP_SUCCESS 0
  50. #define SOCKS5_RESP_FAILURE 1
  51. #define SOCKS5_RESP_CONNECTION_NOT_ALLOWED_BY_RULESET 2
  52. #define SOCKS5_RESP_NETWORK_UNREACHABLE 3
  53. #define SOCKS5_RESP_HOST_UNREACHABLE 4
  54. #define SOCKS5_RESP_CONNECTION_REFUSED 5
  55. #define SOCKS5_RESP_TTL_EXPIRED 6
  56. #define SOCKS5_RESP_COMMAND_NOT_SUPPORTED 7
  57. #define SOCKS5_RESP_ADDRTYPE_NOT_SUPPORTED 8