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.

229 lines
8.3 KiB

  1. //****************************************************************************
  2. //
  3. // Module: ULS.DLL
  4. // File: culs.h
  5. // Content: This file contains the ULS object definition.
  6. // History:
  7. // Wed 17-Apr-1996 11:18:47 -by- Viroon Touranachun [viroont]
  8. //
  9. // Copyright (c) Microsoft Corporation 1996-1997
  10. //
  11. //****************************************************************************
  12. #ifndef _CILS_H_
  13. #define _CILS_H_
  14. #include "connpt.h"
  15. #include "spserver.h"
  16. class CIlsServer;
  17. //****************************************************************************
  18. // CIls definition
  19. //****************************************************************************
  20. //
  21. class CIlsMain : public IIlsMain,
  22. public IConnectionPointContainer
  23. {
  24. private:
  25. LONG m_cRef;
  26. BOOL fInit;
  27. HWND hwndCallback;
  28. CConnectionPoint *pConnPt;
  29. BOOL IsInitialized (void) {return fInit;}
  30. STDMETHODIMP NotifySink (void *pv, CONN_NOTIFYPROC pfn);
  31. HRESULT StringToFilter (TCHAR *pszFilter ,CFilter **ppFilter);
  32. HRESULT EnumUsersEx (
  33. BOOL fNameOnly,
  34. CIlsServer *pServer,
  35. IIlsFilter *pFilter,
  36. CAttributes *pAttrib,
  37. ULONG *puReqID );
  38. HRESULT EnumMeetingPlacesEx (
  39. BOOL fNameOnly,
  40. CIlsServer *pServer,
  41. IIlsFilter *pFilter,
  42. CAttributes *pAttrib,
  43. ULONG *puReqID);
  44. public:
  45. // Constructor and destructor
  46. CIlsMain (void);
  47. ~CIlsMain (void);
  48. STDMETHODIMP Init (void);
  49. // Internal methods
  50. HWND GetNotifyWindow(void) {return hwndCallback;}
  51. void LocalAsyncRespond (ULONG msg, ULONG uReqID, LPARAM lParam)
  52. {PostMessage(hwndCallback, msg, uReqID, lParam); return;}
  53. // Asynchronous response handler
  54. //
  55. STDMETHODIMP GetUserResult (ULONG uReqID, PLDAP_CLIENTINFO_RES puir, CIlsServer *pIlsServer);
  56. STDMETHODIMP EnumUserNamesResult (ULONG uReqID, PLDAP_ENUM ple);
  57. STDMETHODIMP EnumUsersResult (ULONG uReqID, PLDAP_ENUM ple, CIlsServer *pIlsServer);
  58. #ifdef ENABLE_MEETING_PLACE
  59. HRESULT GetMeetingPlaceResult (ULONG uReqID, PLDAP_MEETINFO_RES pmir, CIlsServer *pIlsServer);
  60. HRESULT EnumMeetingPlacesResult(ULONG ulReqID, PLDAP_ENUM ple, CIlsServer *pIlsServer);
  61. HRESULT EnumMeetingPlaceNamesResult( ULONG ulReqID, PLDAP_ENUM ple);
  62. #endif // ENABLE_MEETING_PLACE
  63. // IUnknown
  64. STDMETHODIMP QueryInterface (REFIID iid, void **ppv);
  65. STDMETHODIMP_(ULONG) AddRef (void);
  66. STDMETHODIMP_(ULONG) Release (void);
  67. // IIls
  68. STDMETHODIMP Initialize (VOID);
  69. STDMETHODIMP CreateServer ( BSTR bstrServerName, IIlsServer **ppServer );
  70. STDMETHODIMP CreateUser( BSTR bstrUserID, BSTR bstrAppName, IIlsUser **ppUser);
  71. STDMETHODIMP CreateAttributes ( ILS_ATTR_TYPE AttrType, IIlsAttributes **ppAttributes );
  72. STDMETHODIMP EnumUserNames ( IIlsServer *pServer,
  73. IIlsFilter *pFilter,
  74. IEnumIlsNames **ppEnumUserNames,
  75. ULONG *puReqID);
  76. STDMETHODIMP GetUser ( IIlsServer *pServer,
  77. BSTR bstrUserName,
  78. BSTR bstrAppName,
  79. BSTR bstrProtName,
  80. IIlsAttributes *pAttrib,
  81. IIlsUser **ppUser,
  82. ULONG *puReqID);
  83. STDMETHODIMP EnumUsers ( IIlsServer *pServer,
  84. IIlsFilter *pFilter,
  85. IIlsAttributes *pAttrib,
  86. IEnumIlsUsers **ppEnumUser,
  87. ULONG *puReqID);
  88. #ifdef ENABLE_MEETING_PLACE
  89. STDMETHODIMP CreateMeetingPlace(
  90. BSTR bstrMeetingPlaceID,
  91. LONG lMeetingPlaceType, // set to default
  92. LONG lAttendeeType, // set to default
  93. IIlsMeetingPlace **ppMeetingPlace
  94. );
  95. // Lightweight enumerator of MeetingPlaces for a given server
  96. // This returns only the names. If a caller wants more info than
  97. // the names he can get the name from here, and call the
  98. // heavyweight enumerator (see below) with the filter specifying
  99. // the name.
  100. STDMETHODIMP EnumMeetingPlaceNames(
  101. IIlsServer *pServer,
  102. IIlsFilter *pFilter,
  103. IEnumIlsNames **ppEnumMeetingPlaceNames,
  104. ULONG *pulID
  105. );
  106. // Slightly heavier enumerator. Returns the MeetingPlaces and
  107. // associated default attributes
  108. STDMETHODIMP EnumMeetingPlaces(
  109. IIlsServer *pServer,
  110. IIlsFilter *pFilter,
  111. IIlsAttributes *pAttributes,
  112. IEnumIlsMeetingPlaces **ppEnumMeetingPlace,
  113. ULONG *pulID
  114. );
  115. STDMETHODIMP GetMeetingPlace( IIlsServer *pServer,
  116. BSTR bstrMeetingPlaceID,
  117. IIlsAttributes *pAttrib,
  118. IIlsMeetingPlace **ppMtg,
  119. ULONG *pulID);
  120. #endif // ENABLE_MEETING_PLACE
  121. STDMETHODIMP Abort (ULONG uReqID);
  122. STDMETHODIMP Uninitialize (void);
  123. // Filter methods
  124. STDMETHODIMP CreateFilter ( ILS_FILTER_TYPE FilterType,
  125. ILS_FILTER_OP FilterOp,
  126. IIlsFilter **ppFilter );
  127. STDMETHODIMP StringToFilter (BSTR bstrFilterString, IIlsFilter **ppFilter);
  128. // IConnectionPointContainer
  129. STDMETHODIMP EnumConnectionPoints(IEnumConnectionPoints **ppEnum);
  130. STDMETHODIMP FindConnectionPoint(REFIID riid,
  131. IConnectionPoint **ppcp);
  132. };
  133. class CIlsServer : public IIlsServer
  134. {
  135. private:
  136. LONG m_cRefs;
  137. LONG m_dwSignature;
  138. SERVER_INFO m_ServerInfo;
  139. public:
  140. CIlsServer ( VOID );
  141. ~CIlsServer ( VOID );
  142. // IUnknown
  143. STDMETHODIMP QueryInterface (REFIID iid, void **ppv);
  144. STDMETHODIMP_(ULONG) AddRef (void);
  145. STDMETHODIMP_(ULONG) Release (void);
  146. // IIlsServer
  147. STDMETHODIMP SetAuthenticationMethod ( ILS_ENUM_AUTH_METHOD enumAuthMethod );
  148. STDMETHODIMP SetLogonName ( BSTR bstrLogonName );
  149. STDMETHODIMP SetLogonPassword ( BSTR bstrLogonPassword );
  150. STDMETHODIMP SetDomain ( BSTR bstrDomain );
  151. STDMETHODIMP SetCredential ( BSTR bstrCredential );
  152. STDMETHODIMP SetTimeout ( ULONG uTimeoutInSecond );
  153. STDMETHODIMP SetBaseDN ( BSTR bstrBaseDN );
  154. CIlsServer *Clone ( VOID );
  155. HRESULT SetServerName ( TCHAR *pszServerName );
  156. HRESULT SetServerName ( BSTR bstrServerName );
  157. TCHAR *DuplicateServerName ( VOID );
  158. BSTR DuplicateServerNameBSTR ( VOID );
  159. SERVER_INFO *GetServerInfo ( VOID ) { return &m_ServerInfo; }
  160. TCHAR *GetServerName ( VOID ) { return m_ServerInfo.pszServerName; }
  161. BOOL IsGoodServerName ( VOID ) { return ::MyIsGoodString (m_ServerInfo.pszServerName); }
  162. BOOL IsBadServerName ( VOID ) { return ::MyIsBadString (m_ServerInfo.pszServerName); }
  163. enum { ILS_SERVER_SIGNATURE = 0x12abcdef };
  164. BOOL IsGoodIlsServer ( VOID ) { return (m_dwSignature == ILS_SERVER_SIGNATURE); }
  165. BOOL IsBadIlsServer ( VOID ) { return (m_dwSignature != ILS_SERVER_SIGNATURE); }
  166. };
  167. inline BOOL MyIsBadServer ( CIlsServer *p )
  168. {
  169. return (p == NULL || p->IsBadIlsServer () || p->IsBadServerName ());
  170. }
  171. inline BOOL MyIsBadServer ( IIlsServer *p )
  172. {
  173. return MyIsBadServer ((CIlsServer *) p);
  174. }
  175. //****************************************************************************
  176. // Global Parameters
  177. //****************************************************************************
  178. //
  179. LRESULT CALLBACK ULSNotifyProc(HWND hwnd, UINT message, WPARAM wParam,
  180. LPARAM lParam);
  181. #endif //_CONFMGR_H_