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.

88 lines
2.3 KiB

  1. /********
  2. * Ics APIs
  3. */
  4. #ifndef _ICSMGR_H_
  5. #define _ICSMGR_H_
  6. #include <windows.h>
  7. #include "icsapi.h"
  8. // for IsIcsAvailable()
  9. #define ICSMGR_ICSBOT_CREATED 0x0L
  10. #define ICSMGR_ICSBOT_ALREADY_CREATED 0x1L
  11. #define ICSMGR_ICSBOT_CREATION_FAILED 0x2L
  12. /*
  13. * ICSLAP_DIAL_STATE - copied from ICS API - error states for ICS connectivity
  14. */
  15. typedef enum {
  16. ICSLAP_STARTING = 1,
  17. ICSLAP_CONNECTING = 2,
  18. ICSLAP_CONNECTED = 3,
  19. ICSLAP_DISCONNECTING = 4,
  20. ICSLAP_DISCONNECTED = 5,
  21. ICSLAP_STOPPED = 6,
  22. ICSLAP_PERMANENT = 7,
  23. ICSLAP_UNK_DIAL_STATE = 8,
  24. ICSLAP_CALLWAITING = 9, /* may want to pass back other caller's telno */
  25. ICS_HOMENET_UNAVAILABLE = 1000, /* added by thomasje */
  26. ICS_TIMEOUT = 5000 /* added by thomasje */
  27. } ICS_DIAL_STATE;
  28. // callback function prototype used to report connections in ICS
  29. typedef VOID (CALLBACK*PFN_ICS_CONN_CALLBACK)(ICS_DIAL_STATE);
  30. static BOOL bIsDialThreadAlive = FALSE;
  31. static BOOL bReducedCallback = TRUE;
  32. static ICS_DIAL_STATE eIcsDialState = ICS_HOMENET_UNAVAILABLE;
  33. static BOOL bIsBroadbandIcsAvailable = FALSE;
  34. // thread functions to look for ICS and monitor incoming
  35. // connection broadcast packets.
  36. DWORD IcsEngine(LPVOID lpParam);
  37. DWORD WINAPI IcsDialStatusProc(LPVOID lpParam);
  38. enum ICSSTATUS { ICS_IS_NOT_AVAILABLE = 0,
  39. ICS_IS_AVAILABLE = 1,
  40. ICS_ENGINE_NOT_COMPLETE = 1000,
  41. ICS_ENGINE_FAILED = 1001
  42. };
  43. // callback routine used to notify MSOBMAIN about ICS connection changes
  44. VOID CALLBACK OnIcsConnectionStatus(ICS_DIAL_STATE dwIcsConnectionStatus);
  45. class CIcsMgr {
  46. public:
  47. CIcsMgr();
  48. ~CIcsMgr();
  49. DWORD CreateIcsBot();
  50. DWORD CreateIcsDialMgr();
  51. BOOL IsIcsAvailable();
  52. BOOL IsCallbackUsed();
  53. VOID TriggerIcsCallback(BOOL bStatus);
  54. ICS_DIAL_STATE GetIcsDialState () { return eIcsDialState; }
  55. VOID NotifyIcsMgr(UINT msg, WPARAM wparam, LPARAM lparam);
  56. BOOL IsIcsHostReachable();
  57. DWORD RefreshIcsDialStatus();
  58. private:
  59. // these variables are presently unused.
  60. // the handles are cleared in the class' destructor.
  61. HANDLE m_hBotThread;
  62. DWORD m_dwBotThreadId;
  63. HANDLE m_hDialThread;
  64. DWORD m_dwDialThreadId;
  65. PFN_ICS_CONN_CALLBACK m_pfnIcsConn;
  66. };
  67. #endif