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.

61 lines
1.7 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // File: addrrefresh.hxx
  4. //
  5. // Contents: Defines classes for handling dynamic TCP/IP address
  6. // changes
  7. //
  8. // Classes: CAddrRefreshMgr
  9. //
  10. // History: 26-Oct-00 jsimmons Created
  11. //
  12. //--------------------------------------------------------------------
  13. #pragma once
  14. class CAddrRefreshMgr
  15. {
  16. public:
  17. CAddrRefreshMgr();
  18. void SetListenedOnTCP() { _bListenedOnTCP = TRUE; };
  19. void RegisterForAddressChanges();
  20. BOOL IsIPV6Installed();
  21. BOOL ListenedOnTCP() { return _bListenedOnTCP; };
  22. private:
  23. typedef struct _ADDRESS_CHANGE_DATA
  24. {
  25. DWORD dwSig; // see ADDRCHANGEDATA_SIG below
  26. HANDLE hAddressChangeEvent;
  27. HANDLE hWaitObject;
  28. SOCKET socket;
  29. int socket_af;
  30. BOOL bWaitRegistered;
  31. BOOL bRegisteredForNotifications;
  32. DWORD dwNotifications;
  33. WSAOVERLAPPED WSAOverlapped;
  34. CAddrRefreshMgr* pThis;
  35. } ADDRESS_CHANGE_DATA;
  36. // private functions
  37. static void CALLBACK TimerCallbackFn(void*,BOOLEAN);
  38. void TimerCallbackFnHelper(ADDRESS_CHANGE_DATA* paddrchangedata);
  39. void CheckForIPV6Installed();
  40. void RegisterForAddrChangesHelper(ADDRESS_CHANGE_DATA* pAddrChangeData);
  41. void InitACD(ADDRESS_CHANGE_DATA* paddrchangedata, int addrfamily);
  42. // private data
  43. BOOL _bListenedOnTCP;
  44. BOOL _bCheckedForIPV6;
  45. BOOL _bIPV6Installed;
  46. ADDRESS_CHANGE_DATA _IPV4AddrChangeData;
  47. ADDRESS_CHANGE_DATA _IPV6AddrChangeData;
  48. };
  49. const DWORD ADDRCHANGEDATA_SIG = 0xFEDCBA03;
  50. // References the single instance of this object
  51. extern CAddrRefreshMgr gAddrRefreshMgr;