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.

80 lines
3.3 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: ConnObj.h
  7. //
  8. // Contents: ConnectionObject Implementation
  9. //
  10. // Classes: CCConnectObj
  11. //
  12. // Notes:
  13. //
  14. // History: 10-Feb-98 rogerg Created.
  15. //
  16. //--------------------------------------------------------------------------
  17. #ifndef _SYNCMGRCONNECTIONOBJ_
  18. #define SYNCMGRCONNECTIONOBJ_
  19. class CBaseDlg;
  20. typedef struct _CONNECTIONOBJ {
  21. struct _CONNECTIONOBJ *pNextConnectionObj;
  22. DWORD cRefs;
  23. LPWSTR pwszConnectionName; // pointer to the connection name.
  24. DWORD dwConnectionType; // connection type as defined by CNetApi class
  25. BOOL fConnectionOpen; // flag set when connection has been established.
  26. DWORD dwConnectionId; // Connection Id returned from InternetDial.
  27. HANDLE hCompletionEvent; // set by clients who want to be informed when connection
  28. // has been closed.
  29. } CONNECTIONOBJ;
  30. class CConnectionObj : CLockHandler
  31. {
  32. public:
  33. CConnectionObj();
  34. HRESULT OpenConnection(CONNECTIONOBJ *pConnectionObj,BOOL fMakeConnection,CBaseDlg *pDlg);
  35. HRESULT AutoDial(DWORD dwFlags,CBaseDlg *pDlg); // same flags as InternetAutoDial takes
  36. HRESULT SetWorkOffline(BOOL fWorkOffline);
  37. HRESULT CloseConnections();
  38. HRESULT CloseConnection(CONNECTIONOBJ *pConnectionObj);
  39. HRESULT FindConnectionObj(LPCWSTR pszConnectionName,BOOL fCreate,CONNECTIONOBJ **pConnectionObj);
  40. DWORD ReleaseConnectionObj(CONNECTIONOBJ *pConnectionObj);
  41. DWORD AddRefConnectionObj(CONNECTIONOBJ *pConnectionObj);
  42. HRESULT GetConnectionObjCompletionEvent(CONNECTIONOBJ *pConnectionObj,HANDLE *phRasPendingEvent);
  43. HRESULT IsConnectionAvailable(LPCWSTR pszConnectionName);
  44. private:
  45. void LogError(LPNETAPI pNetApi,DWORD dwErr,CBaseDlg *pDlg);
  46. void RemoveConnectionObj(CONNECTIONOBJ *pConnectionObj);
  47. void FreeConnectionObj(CONNECTIONOBJ *pConnectionObj);
  48. void TurnOffWorkOffline(LPNETAPI pNetApi);
  49. void RestoreWorkOffline(LPNETAPI pNetApi);
  50. CONNECTIONOBJ *m_pFirstConnectionObj; // pointer to first connection object in list.
  51. BOOL m_fAutoDialConn; // Was an auto dial connection set up ?
  52. DWORD m_dwAutoConnID;
  53. BOOL m_fForcedOnline; // set to true if had to transition from WorkOffline to dial
  54. };
  55. HRESULT InitConnectionObjects();
  56. HRESULT ReleaseConnectionObjects();
  57. // wrapper functions for class
  58. HRESULT ConnectObj_OpenConnection(CONNECTIONOBJ *pConnectionObj,BOOL fMakeConnection,CBaseDlg *pDlg);
  59. HRESULT ConnectObj_CloseConnection(CONNECTIONOBJ *pConnectionObj);
  60. HRESULT ConnectObj_CloseConnections();
  61. HRESULT ConnectObj_FindConnectionObj(LPCWSTR pszConnectionName,BOOL fCreate,CONNECTIONOBJ **pConnectionObj);
  62. DWORD ConnectObj_ReleaseConnectionObj(CONNECTIONOBJ *pConnectionObj);
  63. DWORD ConnectObj_AddRefConnectionObj(CONNECTIONOBJ *pConnectionObj);
  64. HRESULT ConnectObj_GetConnectionObjCompletionEvent(CONNECTIONOBJ *pConnectionObj,HANDLE *phRasPendingEvent);
  65. HRESULT ConnectObj_AutoDial(DWORD dwFlags,CBaseDlg *pDlg);
  66. HRESULT ConnectObj_IsConnectionAvailable(LPCWSTR pszConnectionName);
  67. HRESULT ConnectObj_SetWorkOffline(BOOL fWorkOffline);
  68. #endif // SYNCMGRCONNECTIONOBJ_