Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.1 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1993 **/
  4. /**********************************************************************/
  5. /*
  6. cons.hxx
  7. This file contains the global constant definitions for the
  8. FTPD Service.
  9. FILE HISTORY:
  10. KeithMo 07-Mar-1993 Created.
  11. MuraliK 28-Mar-1995 Moved out the Behaviour flags to USER_DATA
  12. definition
  13. */
  14. #ifndef _CONS_HXX_
  15. #define _CONS_HXX_
  16. //
  17. // Maximum length of command from control socket.
  18. //
  19. #define MAX_COMMAND_LENGTH 512 // characters
  20. //
  21. // Maximum length of a reply sent to the FTP client.
  22. //
  23. #define MAX_REPLY_LENGTH 1024 // characters
  24. //
  25. // Maximum length of a user name. This must be long enough to
  26. // hold a name of the form domain\user, where "domain" is a maximum
  27. // length domain name, and "user" is a maximum length user name.
  28. //
  29. #define MAX_USERNAME_LENGTH (DNLEN+UNLEN+1) // characters
  30. //
  31. // timeout for sends
  32. //
  33. #define FTP_DEF_SEND_TIMEOUT 30
  34. #define FTP_DEF_RECV_TIMEOUT 600
  35. //
  36. // Valid bits for read/write access masks. There is
  37. // one bit per dos drive (A-Z).
  38. //
  39. #define VALID_DOS_DRIVE_MASK ((DWORD)( ( 1 << 26 ) - 1 ))
  40. //
  41. // Make statistics a little easier.
  42. //
  43. #define INCREMENT_COUNTER(name) \
  44. InterlockedIncrement((LPLONG)&name)
  45. #define INCR_STAT_COUNTER( name) \
  46. INCREMENT_COUNTER( g_FtpStatistics.name)
  47. #define DECREMENT_COUNTER(name) \
  48. InterlockedDecrement((LPLONG) &name)
  49. #define DECR_STAT_COUNTER( name) \
  50. DECREMENT_COUNTER( g_FtpStatistics.name)
  51. #define UPDATE_LARGE_COUNTER(name,increment) \
  52. if( 1 ) { \
  53. EnterCriticalSection( &g_StatisticsLock ); \
  54. g_FtpStatistics.name.QuadPart += (LONGLONG)(increment);\
  55. LeaveCriticalSection( &g_StatisticsLock ); \
  56. } else
  57. //
  58. // Make locking & unlocking the TSVC_INFO structure a bit prettier.
  59. //
  60. #define READ_LOCK_TSVC() g_pTsvcInfo->LockThisForRead()
  61. #define WRITE_LOCK_TSVC() g_pTsvcInfo->LockThisForWrite()
  62. #define UNLOCK_TSVC() g_pTsvcInfo->UnlockThis()
  63. #define READ_LOCK_INST() g_pInstance->LockThisForRead()
  64. #define WRITE_LOCK_INST() g_pInstance->LockThisForWrite()
  65. #define UNLOCK_INST() g_pInstance->UnlockThis()
  66. #define LockAdminForRead() READ_LOCK_TSVC()
  67. #define LockAdminForWrite() WRITE_LOCK_TSVC()
  68. #define UnlockAdmin() UNLOCK_TSVC()
  69. //
  70. // Map an FTP connection port number to the related data port number.
  71. //
  72. #define CONN_PORT_TO_DATA_PORT(port) \
  73. (PORT)htons( (u_short)( ( (u_short) ntohs(port) ) - 1 ) )
  74. #endif // _CONS_HXX_