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.

55 lines
1.7 KiB

  1. /*****************************************************************************
  2. *
  3. * $Workfile: IPAddr.h $
  4. *
  5. * Copyright (C) 1997 Hewlett-Packard Company.
  6. * All rights reserved.
  7. *
  8. * 11311 Chinden Blvd.
  9. * Boise, Idaho 83714
  10. *
  11. *****************************************************************************/
  12. #ifndef INC_IPADDR_H
  13. #define INC_IPADDR_H
  14. class CMemoryDebug;
  15. #define MAX_IPCOMPONENT_STRLEN 3 + 1
  16. #define STORAGE_STRING_LEN 64
  17. class CIPAddress
  18. {
  19. public:
  20. CIPAddress();
  21. CIPAddress(LPTSTR psztIPAddr);
  22. ~CIPAddress();
  23. // the string passed in to IsValid in AddressString param is _one_ of the 4
  24. // bytes. The caller is responsible for breaking apart the IP Address into
  25. // its 4 (or 6) components.
  26. // if the string passed in to IsValid in AddressString param is not a valid
  27. // IP Address then the returnVal is filled with the last valid IP Address from
  28. // the previous time this method was called. This facilitates validation for
  29. // each keystroke the user makes.
  30. BOOL IsValid(BYTE Address[4]);
  31. BOOL IsValid() { return IsValid(m_bAddress); }
  32. BOOL IsValid(TCHAR *psztStringAddress,
  33. TCHAR *psztReturnVal = NULL,
  34. DWORD CRtnValSize = 0);
  35. void SetAddress(TCHAR *AddressString);
  36. void SetAddress(TCHAR *psztAddr1, TCHAR *psztAddr2, TCHAR *psztAddr3, TCHAR *psztAddr4);
  37. void ToString(TCHAR *psztBuffer, int iSize);
  38. void ToComponentStrings(TCHAR *str1, TCHAR *str2, TCHAR *str3, TCHAR *str4, size_t cchStr);
  39. private:
  40. BYTE m_bAddress[4];
  41. TCHAR m_psztStorageString[STORAGE_STRING_LEN];
  42. TCHAR m_psztStorageStringComponent[STORAGE_STRING_LEN]; // last valid string entered in the text entry box.
  43. };
  44. #endif // INC_IPADDR_H