home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / socks / include / socks.h next >
Encoding:
C/C++ Source or Header  |  1992-09-19  |  1.5 KB  |  72 lines

  1. /*
  2. **  Define this if you want socks to support a default port,
  3. **    (ie. socks/tcp is missing from /etc/services )
  4. */
  5. #define SOCKS_DEF_PORT    1080
  6.  
  7. /*
  8. **  If your local nameserver doesn't support lookups to the
  9. **    root domain.
  10. */
  11. #define NEED_REMOTE_NAMESERVER
  12.  
  13. /*
  14. **  How long to keep a connection around one it is idle
  15. */
  16. #define SOCKS_TIMEOUT    2*60*60    /* 2hr in minutes */
  17.  
  18. /*
  19. **  Set both of these to something useful
  20. */
  21. #if defined(NEED_REMOTE_NAMESERVER) && !defined(SOCKS_DEFAULT_NS)
  22. #define SOCKS_DEFAULT_NS    "InvalidHostNameHere"
  23. #endif
  24.  
  25. #if !defined(SOCKS_DEFAULT_HOST)
  26. #define SOCKS_DEFAULT_HOST    SOCKS_DEFAULT_NS
  27. #endif
  28.  
  29. /*
  30. **  Where the config file lives for the daemon
  31. */
  32. #define SOCKS_CONF    "/etc/sockd.conf"
  33.  
  34. /*
  35. **  Response commands/codes
  36. */
  37. #define SOCKS_CONNECT    1
  38. #define SOCKS_BIND    2
  39. #define SOCKS_RESULT    90
  40. #define SOCKS_FAIL    91
  41.  
  42. typedef struct {
  43.     unsigned char        version;
  44.     unsigned char        cmd;
  45.     unsigned long        port;
  46.     unsigned long        host;
  47. } Socks_t;
  48.  
  49. #define SOCKS_VERSION    3
  50.  
  51. /*
  52. **  Simple macros that alow reading and writing of network bytes
  53. */
  54. #define Write8(f, v) \
  55.     { unsigned char _xx_ = htonb(v);  write(f, &_xx_, sizeof(_xx_)); }
  56. #define Write32(f, v) \
  57.     { unsigned long _xx_ = htonl(v);  write(f, &_xx_, sizeof(_xx_)); }
  58. #define Read8(f, v) \
  59.     { unsigned char _xx_; read(f, &_xx_, sizeof(_xx_)); v = ntohb(_xx_); }
  60. #define Read32(f, v) \
  61.     { unsigned long _xx_; read(f, &_xx_, sizeof(_xx_)); v = ntohl(_xx_); }
  62.  
  63. /*
  64. **  Bold assumption that these are needed
  65. */
  66. #ifndef ntohb
  67. #define ntohb(x) x
  68. #endif
  69. #ifndef htonb
  70. #define htonb(x) x
  71. #endif
  72.