Leaked source code of windows server 2003
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.

83 lines
3.1 KiB

  1. /*****************************************************************************
  2. *
  3. * $Workfile: InptChkr.h $
  4. *
  5. * Copyright (C) 1997 Hewlett-Packard Company.
  6. * Copyright (c) 1997 Microsoft Corporation.
  7. * All rights reserved.
  8. *
  9. * 11311 Chinden Blvd.
  10. * Boise, Idaho 83714
  11. *
  12. *
  13. *****************************************************************************/
  14. #ifndef INC_INPUTCHECKER_H
  15. #define INC_INPUTCHECKER_H
  16. typedef enum _tagAddressType
  17. {
  18. Undefined,
  19. IPAddress,
  20. HostName
  21. } AddressType;
  22. class CInputChecker
  23. {
  24. public:
  25. CInputChecker();
  26. ~CInputChecker();
  27. public:
  28. void LinkPortNameAndAddressInput() { m_bLinked = TRUE; }
  29. void UnlinkPortNameAndAddressInput() { m_bLinked = FALSE; }
  30. BOOL AddressIsLegal(TCHAR *ptcsAddress);
  31. BOOL PortNameIsLegal(TCHAR *ptcsPortName);
  32. BOOL PortNameIsUnique(TCHAR *ptcsPortName, LPTSTR psztServerName);
  33. BOOL PortNumberIsLegal(TCHAR *ptcsPortNumber);
  34. BOOL QueueNameIsLegal(TCHAR *ptcsQueueName);
  35. BOOL CommunityNameIsLegal(TCHAR *ptcsCommunityName);
  36. BOOL SNMPDevIndexIsLegal(TCHAR *psztSNMPDevIndex);
  37. void OnUpdatePortName(int idEditCtrl, HWND hwndEditCtrl);
  38. void OnUpdateAddress(HWND hDlg, int idEditCtrl, HWND hwndEditCtrl, LPTSTR psztServerName);
  39. void OnUpdatePortNumber(int idEditCtrl, HWND hwndEditCtrl);
  40. void OnUpdateDeviceIndex(int idEditCtrl, HWND hwndEditCtrl);
  41. void OnUpdateQueueName(int idEditCtrl, HWND hwndEditCtrl);
  42. void MakePortName(TCHAR *strAddr, size_t cchAddr);
  43. protected:
  44. BOOL IsValidAddressInput(TCHAR *ptcsAddressInput,
  45. TCHAR *ptcsReturnLastValid,
  46. DWORD CRtnValSize);
  47. BOOL IsValidPortNameInput(TCHAR *ptcsPortNameInput,
  48. TCHAR *ptcsReturnLastValid,
  49. DWORD CRtnValSize);
  50. BOOL IsValidPortNumberInput(TCHAR *ptcsPortNumInput,
  51. TCHAR *ptcsReturnLastValid = NULL ,
  52. DWORD cRtnVal = 0);
  53. BOOL IsValidDeviceIndexInput(TCHAR *ptcsDeviceIndexInput,
  54. TCHAR *ptcsReturnLastValid = NULL,
  55. DWORD CRtnValSize = 0);
  56. BOOL IsValidQueueNameInput(TCHAR *ptcsQueueNameInput,
  57. TCHAR *ptcsReturnLastValid = NULL,
  58. DWORD CRtnValSize = 0);
  59. BOOL IsValidCommunityNameInput(TCHAR *ptcsCommunityNameInput,
  60. TCHAR *ptcsReturnLastValid = NULL,
  61. DWORD CRtnValSize = 0);
  62. BOOL PortExists(LPTSTR psztPortName, LPTSTR psztServerName);
  63. AddressType GetAddressType(TCHAR *ptcsAddress);
  64. private:
  65. BOOL m_bLinked; // Is the port name linked to the Address input?
  66. TCHAR m_InputStorageStringAddress[MAX_ADDRESS_LENGTH];
  67. TCHAR m_InputStorageStringPortNumber[MAX_PORTNUM_STRING_LENGTH];
  68. TCHAR m_InputStorageStringDeviceIndex[MAX_SNMP_DEVICENUM_STRING_LENGTH];
  69. TCHAR m_InputStorageStringQueueName[MAX_QUEUENAME_LEN];
  70. }; // CGetAddrDlg
  71. #endif // INC_INPUTCHECKER_H