WSTransport.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef WSTRANSPORT_H
  18. #define WSTRANSPORT_H
  19. #include <kopano/zcdefs.h>
  20. #include <mapi.h>
  21. #include <mapispi.h>
  22. #include <map>
  23. #include <mutex>
  24. #include "kcore.hpp"
  25. #include "ECMAPIProp.h"
  26. #include "soapKCmdProxy.h"
  27. #include <kopano/kcodes.h>
  28. #include <kopano/Util.h>
  29. #include "WSStoreTableView.h"
  30. //#include "WSTableOutGoingQueue.h"
  31. #include "WSMAPIFolderOps.h"
  32. #include "WSMAPIPropStorage.h"
  33. #include "ECParentStorage.h"
  34. #include "ECABLogon.h"
  35. #include "ics_client.hpp"
  36. #include <ECCache.h>
  37. namespace KC {
  38. class utf8string;
  39. }
  40. class WSMessageStreamExporter;
  41. class WSMessageStreamImporter;
  42. typedef HRESULT (*SESSIONRELOADCALLBACK)(void *lpParam, ECSESSIONID newSessionId);
  43. typedef std::map<ULONG, std::pair<void *, SESSIONRELOADCALLBACK> > SESSIONRELOADLIST;
  44. class ECsResolveResult _kc_final : public ECsCacheEntry {
  45. public:
  46. HRESULT hr;
  47. std::string serverPath;
  48. bool isPeer;
  49. };
  50. typedef std::map<std::string, ECsResolveResult> ECMapResolveResults;
  51. // Array offsets for Receive folder table
  52. enum
  53. {
  54. RFT_ROWID,
  55. RFT_INST_KEY,
  56. RFT_ENTRYID,
  57. RFT_RECORD_KEY,
  58. RFT_MSG_CLASS,
  59. NUM_RFT_PROPS
  60. };
  61. class WSTransport _kc_final : public ECUnknown {
  62. protected:
  63. WSTransport(ULONG ulUIFlags);
  64. virtual ~WSTransport();
  65. public:
  66. static HRESULT Create(ULONG ulUIFlags, WSTransport **lppTransport);
  67. virtual HRESULT QueryInterface(REFIID refiid, void **lppInterface) _kc_override;
  68. static HRESULT HrOpenTransport(LPMAPISUP lpMAPISup, WSTransport **lppTransport, BOOL bOffline = FALSE);
  69. virtual HRESULT HrLogon2(const struct sGlobalProfileProps &);
  70. virtual HRESULT HrLogon(const struct sGlobalProfileProps &);
  71. virtual HRESULT HrReLogon();
  72. virtual HRESULT HrClone(WSTransport **lppTransport);
  73. virtual HRESULT HrLogOff();
  74. HRESULT logoff_nd(void);
  75. virtual HRESULT HrSetRecvTimeout(unsigned int ulSeconds);
  76. virtual HRESULT CreateAndLogonAlternate(LPCSTR szServer, WSTransport **lppTransport) const;
  77. virtual HRESULT CloneAndRelogon(WSTransport **lppTransport) const;
  78. virtual HRESULT HrGetStore(ULONG cbMasterID, LPENTRYID lpMasterID, ULONG* lppcbStoreID, LPENTRYID* lppStoreID, ULONG* lppcbRootID, LPENTRYID* lppRootID, std::string *lpstrRedirServer = NULL);
  79. virtual HRESULT HrGetStoreName(ULONG cbStoreID, LPENTRYID lpStoreID, ULONG ulFlags, LPTSTR *lppszStoreName);
  80. virtual HRESULT HrGetStoreType(ULONG cbStoreID, LPENTRYID lpStoreID, ULONG *lpulStoreType);
  81. virtual HRESULT HrGetPublicStore(ULONG ulFlags, ULONG* lpcbStoreID, LPENTRYID* lppStoreID, std::string *lpstrRedirServer = NULL);
  82. // Check item exist with flags
  83. virtual HRESULT HrCheckExistObject(ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulFlags);
  84. // Interface to get/set properties
  85. virtual HRESULT HrOpenPropStorage(ULONG cbParentEntryID, LPENTRYID lpParentEntryID, ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulFlags, IECPropStorage **lppPropStorage);
  86. virtual HRESULT HrOpenParentStorage(ECGenericProp *lpParentObject, ULONG ulUniqueId, ULONG ulObjId, IECPropStorage *lpServerStorage, IECPropStorage **lppPropStorage);
  87. virtual HRESULT HrOpenABPropStorage(ULONG cbEntryID, LPENTRYID lpEntryID, IECPropStorage **lppPropStorage);
  88. // Interface for folder operations (create/delete)
  89. virtual HRESULT HrOpenFolderOps(ULONG cbEntryID, LPENTRYID lpEntryID, WSMAPIFolderOps **lppFolderOps);
  90. virtual HRESULT HrExportMessageChangesAsStream(ULONG ulFlags, ULONG ulPropTag, const ICSCHANGE *lpChanges, ULONG ulStart, ULONG ulChanges, const SPropTagArray *lpsProps, WSMessageStreamExporter **lppsStreamExporter);
  91. virtual HRESULT HrGetMessageStreamImporter(ULONG ulFlags, ULONG ulSyncId, ULONG cbEntryID, LPENTRYID lpEntryID, ULONG cbFolderEntryID, LPENTRYID lpFolderEntryID, bool bNewMessage, LPSPropValue lpConflictItems, WSMessageStreamImporter **lppStreamImporter);
  92. // Interface for table operations
  93. virtual HRESULT HrOpenTableOps(ULONG ulType, ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID, ECMsgStore *lpMsgStore, WSTableView **lppTableOps);
  94. virtual HRESULT HrOpenABTableOps(ULONG ulType, ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID, ECABLogon* lpABLogon, WSTableView **lppTableOps);
  95. virtual HRESULT HrOpenMailBoxTableOps(ULONG ulFlags, ECMsgStore *lpMsgStore, WSTableView **lppTableOps);
  96. //Interface for outgoigqueue
  97. virtual HRESULT HrOpenTableOutGoingQueueOps(ULONG cbStoreEntryID, LPENTRYID lpStoreEntryID, ECMsgStore *lpMsgStore, WSTableOutGoingQueue **lppTableOutGoingQueueOps);
  98. // Delete objects
  99. virtual HRESULT HrDeleteObjects(ULONG ulFlags, LPENTRYLIST lpMsgList, ULONG ulSyncId);
  100. // Notification
  101. virtual HRESULT HrSubscribe(ULONG cbKey, LPBYTE lpKey, ULONG ulConnection, ULONG ulEventMask);
  102. virtual HRESULT HrSubscribe(ULONG ulSyncId, ULONG ulChangeId, ULONG ulConnection, ULONG ulEventMask);
  103. virtual HRESULT HrSubscribeMulti(const ECLISTSYNCADVISE &lstSyncAdvises, ULONG ulEventMask);
  104. virtual HRESULT HrUnSubscribe(ULONG ulConnection);
  105. virtual HRESULT HrUnSubscribeMulti(const ECLISTCONNECTION &lstConnections);
  106. virtual HRESULT HrNotify(LPNOTIFICATION lpNotification);
  107. // Named properties
  108. virtual HRESULT HrGetIDsFromNames(LPMAPINAMEID *lppPropNamesUnresolved, ULONG cUnresolved, ULONG ulFlags, ULONG **lpServerIDs);
  109. virtual HRESULT HrGetNamesFromIDs(LPSPropTagArray lpsPropTags, LPMAPINAMEID ** lpppNames, ULONG *cResolved);
  110. // ReceiveFolder
  111. virtual HRESULT HrGetReceiveFolder(ULONG cbStoreEntryID, LPENTRYID lpStoreEntryID, const utf8string &strMessageClass, ULONG* lpcbEntryID, LPENTRYID* lppEntryID, utf8string *lpstrExplicitClass);
  112. virtual HRESULT HrSetReceiveFolder(ULONG cbStoreEntryID, LPENTRYID lpStoreEntryID, const utf8string &strMessageClass, ULONG cbEntryID, LPENTRYID lpEntryID);
  113. virtual HRESULT HrGetReceiveFolderTable(ULONG ulFlags, ULONG cbStoreEntryID, LPENTRYID lpStoreEntryID, LPSRowSet* lppsRowSet);
  114. // Read / Unread
  115. virtual HRESULT HrSetReadFlag(ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulFlags, ULONG ulSyncId);
  116. // Add message into the Outgoing Queue
  117. virtual HRESULT HrSubmitMessage(ULONG cbMessageID, LPENTRYID lpMessageID, ULONG ulFlags);
  118. // Outgoing Queue Finished message
  119. virtual HRESULT HrFinishedMessage(ULONG cbEntryID, const ENTRYID *lpEntryID, ULONG ulFlags);
  120. virtual HRESULT HrAbortSubmit(ULONG cbEntryID, LPENTRYID lpEntryID);
  121. virtual HRESULT HrIsMessageInQueue(ULONG cbEntryID, LPENTRYID lpEntryID);
  122. // Get user information
  123. virtual HRESULT HrResolveStore(LPGUID lpGuid, ULONG *lpulUserID, ULONG* lpcbStoreID, LPENTRYID* lppStoreID);
  124. virtual HRESULT HrResolveUserStore(const utf8string &strUserName, ULONG ulFlags, ULONG *lpulUserID, ULONG* lpcbStoreID, LPENTRYID* lppStoreID, std::string *lpstrRedirServer = NULL);
  125. virtual HRESULT HrResolveTypedStore(const utf8string &strUserName, ULONG ulStoreType, ULONG* lpcbStoreID, LPENTRYID* lppStoreID);
  126. // IECServiceAdmin functions
  127. virtual HRESULT HrCreateUser(ECUSER *lpECUser, ULONG ulFlags, ULONG *lpcbUserId, LPENTRYID *lppUserId);
  128. virtual HRESULT HrDeleteUser(ULONG cbUserId, LPENTRYID lpUserId);
  129. virtual HRESULT HrSetUser(ECUSER *lpECUser, ULONG ulFlags);
  130. virtual HRESULT HrGetUser(ULONG cbUserID, LPENTRYID lpUserID, ULONG ulFlags, ECUSER **lpECUser);
  131. virtual HRESULT HrCreateStore(ULONG ulStoreType, ULONG cbUserId, LPENTRYID lpUserId, ULONG cbStoreID, LPENTRYID lpStoreID, ULONG cbRootID, LPENTRYID lpRootID, ULONG ulFLags);
  132. virtual HRESULT HrHookStore(ULONG ulStoreType, ULONG cbUserId, LPENTRYID lpUserId, LPGUID lpGuid, ULONG ulSyncId);
  133. virtual HRESULT HrUnhookStore(ULONG ulStoreType, ULONG cbUserId, LPENTRYID lpUserId, ULONG ulSyncId);
  134. virtual HRESULT HrRemoveStore(LPGUID lpGuid, ULONG ulSyncId);
  135. virtual HRESULT HrGetUserList(ULONG cbCompanyId, LPENTRYID lpCompanyId, ULONG ulFlags, ULONG *lpcUsers, ECUSER **lppsUsers);
  136. virtual HRESULT HrResolveUserName(LPCTSTR lpszUserName, ULONG ulFlags, ULONG *lpcbUserId, LPENTRYID *lppUserId);
  137. virtual HRESULT HrGetSendAsList(ULONG cbUserId, LPENTRYID lpUserId, ULONG ulFlags, ULONG *lpcSenders, ECUSER **lppSenders);
  138. virtual HRESULT HrAddSendAsUser(ULONG cbUserId, LPENTRYID lpUserId, ULONG cbSenderId, LPENTRYID lpSenderId);
  139. virtual HRESULT HrDelSendAsUser(ULONG cbUserId, LPENTRYID lpUserId, ULONG cbSenderId, LPENTRYID lpSenderId);
  140. virtual HRESULT HrRemoveAllObjects(ULONG cbUserId, LPENTRYID lpUserId);
  141. virtual HRESULT HrGetUserClientUpdateStatus(ULONG cbUserId, LPENTRYID lpUserId, ULONG ulFlags, ECUSERCLIENTUPDATESTATUS **lppECUCUS);
  142. // Quota
  143. virtual HRESULT GetQuota(ULONG cbUserId, LPENTRYID lpUserId, bool bGetUserDefault, ECQUOTA **lppsQuota);
  144. virtual HRESULT SetQuota(ULONG cbUserId, LPENTRYID lpUserId, ECQUOTA *lpsQuota);
  145. virtual HRESULT AddQuotaRecipient(ULONG cbCompanyId, LPENTRYID lpCompanyId, ULONG cbRecipientId, LPENTRYID lpRecipientId, ULONG ulType);
  146. virtual HRESULT DeleteQuotaRecipient(ULONG cbCompanyId, LPENTRYID lpCmopanyId, ULONG cbRecipientId, LPENTRYID lpRecipientId, ULONG ulType);
  147. virtual HRESULT GetQuotaRecipients(ULONG cbUserId, LPENTRYID lpUserId, ULONG ulFlags, ULONG *lpcUsers, ECUSER **lppsUsers);
  148. virtual HRESULT GetQuotaStatus(ULONG cbUserId, LPENTRYID lpUserId, ECQUOTASTATUS **lppsQuotaStatus);
  149. virtual HRESULT HrPurgeSoftDelete(ULONG ulDays);
  150. virtual HRESULT HrPurgeCache(ULONG ulFlags);
  151. virtual HRESULT HrPurgeDeferredUpdates(ULONG *lpulRemaining);
  152. // MultiServer
  153. virtual HRESULT HrResolvePseudoUrl(const char *lpszPseudoUrl, char **lppszServerPath, bool *lpbIsPeer);
  154. virtual HRESULT HrGetServerDetails(ECSVRNAMELIST *lpServerNameList, ULONG ulFlags, ECSERVERLIST **lppsServerList);
  155. // IECServiceAdmin group functions
  156. virtual HRESULT HrResolveGroupName(LPCTSTR lpszGroupName, ULONG ulFlags, ULONG *lpcbGroupId, LPENTRYID *lppGroupId);
  157. virtual HRESULT HrCreateGroup(ECGROUP *lpECGroup, ULONG ulFlags, ULONG *lpcbGroupId, LPENTRYID *lppGroupId);
  158. virtual HRESULT HrSetGroup(ECGROUP *lpECGroup, ULONG ulFlags);
  159. virtual HRESULT HrGetGroup(ULONG cbGroupID, LPENTRYID lpGroupID, ULONG ulFlags, ECGROUP **lppECGroup);
  160. virtual HRESULT HrDeleteGroup(ULONG cbGroupId, LPENTRYID lpGroupId);
  161. virtual HRESULT HrGetGroupList(ULONG cbCompanyId, LPENTRYID lpCompanyId, ULONG ulFlags, ULONG *lpcGroups, ECGROUP **lppsGroups);
  162. // IECServiceAdmin Group and user functions
  163. virtual HRESULT HrDeleteGroupUser(ULONG cbGroupId, LPENTRYID lpGroupId, ULONG cbUserId, LPENTRYID lpUserId);
  164. virtual HRESULT HrAddGroupUser(ULONG cbGroupId, LPENTRYID lpGroupId, ULONG cbUserId, LPENTRYID lpUserId);
  165. virtual HRESULT HrGetUserListOfGroup(ULONG cbGroupId, LPENTRYID lpGroupId, ULONG ulFlags, ULONG *lpcUsers, ECUSER **lppsUsers);
  166. virtual HRESULT HrGetGroupListOfUser(ULONG cbUserId, LPENTRYID lpUserId, ULONG ulFlags, ULONG *lpcGroups, ECGROUP **lppsGroups);
  167. // IECServiceAdmin company functions
  168. virtual HRESULT HrCreateCompany(ECCOMPANY *lpECCompany, ULONG ulFlags, ULONG *lpcbCompanyId, LPENTRYID *lppCompanyId);
  169. virtual HRESULT HrDeleteCompany(ULONG cbCompanyId, LPENTRYID lpCompanyId);
  170. virtual HRESULT HrSetCompany(ECCOMPANY *lpECCompany, ULONG ulFlags);
  171. virtual HRESULT HrGetCompany(ULONG cbCompanyId, LPENTRYID lpCompanyId, ULONG ulFlags, ECCOMPANY **lppECCompany);
  172. virtual HRESULT HrResolveCompanyName(LPCTSTR lpszCompanyName, ULONG ulFlags, ULONG *lpcbCompanyId, LPENTRYID *lppCompanyId);
  173. virtual HRESULT HrGetCompanyList(ULONG ulFlags, ULONG *lpcCompanies, ECCOMPANY **lppsCompanies);
  174. virtual HRESULT HrAddCompanyToRemoteViewList(ULONG cbSetCompanyId, LPENTRYID lpSetCompanyId, ULONG cbCompanyId, LPENTRYID lpCompanyId);
  175. virtual HRESULT HrDelCompanyFromRemoteViewList(ULONG cbSetCompanyId, LPENTRYID lpSetCompanyId, ULONG cbCompanyId, LPENTRYID lpCompanyId);
  176. virtual HRESULT HrGetRemoteViewList(ULONG cbCompanyId, LPENTRYID lpCompanyId, ULONG ulFlags, ULONG *lpcCompanies, ECCOMPANY **lppsCompanies);
  177. virtual HRESULT HrAddUserToRemoteAdminList(ULONG cbUserId, LPENTRYID lpUserId, ULONG cbCompanyId, LPENTRYID lpCompanyId);
  178. virtual HRESULT HrDelUserFromRemoteAdminList(ULONG cbUserId, LPENTRYID lpUserId, ULONG cbCompanyId, LPENTRYID lpCompanyId);
  179. virtual HRESULT HrGetRemoteAdminList(ULONG cbCompanyId, LPENTRYID lpCompanyId, ULONG ulFlags, ULONG *lpcUsers, ECUSER **lppsUsers);
  180. // IECServiceAdmin company and user functions
  181. // Get the object rights
  182. virtual HRESULT HrGetPermissionRules(int ulType, ULONG cbEntryID, LPENTRYID lpEntryID, ULONG* lpcPermissions, ECPERMISSION **lppECPermissions);
  183. // Set the object rights
  184. virtual HRESULT HrSetPermissionRules(ULONG cbEntryID, LPENTRYID lpEntryID, ULONG cPermissions, ECPERMISSION *lpECPermissions);
  185. // Get owner information
  186. virtual HRESULT HrGetOwner(ULONG cbEntryID, LPENTRYID lpEntryID, ULONG *lpcbOwnerId, LPENTRYID *lppOwnerId);
  187. //Addressbook function
  188. virtual HRESULT HrResolveNames(const SPropTagArray *lpPropTagArray, ULONG ulFlags, LPADRLIST lpAdrList, LPFlagList lpFlagList);
  189. virtual HRESULT HrSyncUsers(ULONG cbCompanyId, LPENTRYID lpCompanyId);
  190. // Incremental Change Synchronization
  191. virtual HRESULT HrGetChanges(const std::string& sourcekey, ULONG ulSyncId, ULONG ulChangeId, ULONG ulSyncType, ULONG ulFlags, LPSRestriction lpRestrict, ULONG *lpulMaxChangeId, ULONG* lpcChanges, ICSCHANGE **lpsChanges);
  192. virtual HRESULT HrSetSyncStatus(const std::string& sourcekey, ULONG ulSyncId, ULONG ulChangeId, ULONG ulSyncType, ULONG ulFlags, ULONG* lpulSyncId);
  193. virtual HRESULT HrEntryIDFromSourceKey(ULONG cbStoreID, LPENTRYID lpStoreID, ULONG ulFolderSourceKeySize, BYTE * lpFolderSourceKey, ULONG ulMessageSourceKeySize, BYTE * lpMessageSourceKey, ULONG * lpcbEntryID, LPENTRYID * lppEntryID);
  194. virtual HRESULT HrGetSyncStates(const ECLISTSYNCID &lstSyncId, ECLISTSYNCSTATE *lplstSyncState);
  195. virtual const char* GetServerName();
  196. virtual bool IsConnected();
  197. /* multi store table functions */
  198. virtual HRESULT HrOpenMultiStoreTable(LPENTRYLIST lpMsgList, ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID, ECMsgStore *lpMsgStore, WSTableView **lppTableOps);
  199. /* statistics tables (system, threads, users), ulTableType is proto.h TABLETYPE_STATS_... */
  200. /* userstores table TABLETYPE_USERSTORE */
  201. virtual HRESULT HrOpenMiscTable(ULONG ulTableType, ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID, ECMsgStore *lpMsgStore, WSTableView **lppTableView);
  202. /* Message locking */
  203. virtual HRESULT HrSetLockState(ULONG cbEntryID, LPENTRYID lpEntryID, bool bLocked);
  204. // License information
  205. virtual HRESULT HrLicenseAuth(unsigned char *lpData, unsigned int ulSize, unsigned char **lppResponseData, unsigned int *lpulSize);
  206. virtual HRESULT HrLicenseCapa(unsigned int ulServiceType, char ***lppszCapas, unsigned int *lpulSize);
  207. virtual HRESULT HrLicenseUsers(unsigned int ulServiceType, unsigned int *lpulUsers);
  208. /* expose capabilities */
  209. virtual HRESULT HrCheckCapabilityFlags(ULONG ulFlags, BOOL *lpbResult);
  210. /* Get flags received on logon */
  211. virtual HRESULT GetLicenseFlags(unsigned long long *lpllFlags);
  212. /* Test protocol */
  213. virtual HRESULT HrTestPerform(const char *cmd, unsigned int argc, char **args);
  214. virtual HRESULT HrTestSet(const char *szName, const char *szValue);
  215. virtual HRESULT HrTestGet(const char *szName, char **szValue);
  216. /* Return Session information */
  217. virtual HRESULT HrGetSessionId(ECSESSIONID *lpSessionId, ECSESSIONGROUPID *lpSessionGroupId);
  218. /* Get profile properties (connect info) */
  219. virtual sGlobalProfileProps GetProfileProps();
  220. /* Get the server GUID obtained at logon */
  221. virtual HRESULT GetServerGUID(LPGUID lpsServerGuid);
  222. /* These are called by other WS* classes to register themselves for session changes */
  223. virtual HRESULT AddSessionReloadCallback(void *lpParam, SESSIONRELOADCALLBACK callback, ULONG * lpulId);
  224. virtual HRESULT RemoveSessionReloadCallback(ULONG ulId);
  225. /* notifications */
  226. virtual HRESULT HrGetNotify(struct notificationArray **lppsArrayNotifications);
  227. virtual HRESULT HrCancelIO();
  228. /* Check session and relogon if needed */
  229. virtual HRESULT HrEnsureSession();
  230. virtual HRESULT HrResetFolderCount(ULONG cbEntryId, LPENTRYID lpEntryId, ULONG *lpulUpdates);
  231. private:
  232. static SOAP_SOCKET RefuseConnect(struct soap*, const char*, const char*, int);
  233. virtual HRESULT LockSoap();
  234. virtual HRESULT UnLockSoap();
  235. //TODO: Move this function to the right file
  236. static ECRESULT TrySSOLogon(KCmd* lpCmd, LPCSTR szServer, utf8string strUsername, utf8string strImpersonateUser, unsigned int ulCapabilities, ECSESSIONGROUPID ecSessionGroupId, char *szAppName, ECSESSIONID* lpSessionId, unsigned int* lpulServerCapabilities, unsigned long long *lpllFlags, LPGUID lpsServerGuid, const std::string strClientAppVersion, const std::string strClientAppMisc);
  237. // Returns name of calling application (eg 'program.exe' or 'httpd')
  238. std::string GetAppName();
  239. protected:
  240. KCmd *m_lpCmd = nullptr;
  241. std::recursive_mutex m_hDataLock;
  242. ECSESSIONID m_ecSessionId = 0;
  243. ECSESSIONGROUPID m_ecSessionGroupId = 0;
  244. SESSIONRELOADLIST m_mapSessionReload;
  245. std::recursive_mutex m_mutexSessionReload;
  246. unsigned int m_ulReloadId = 1;
  247. unsigned int m_ulServerCapabilities = 0;
  248. unsigned long long m_llFlags = 0; // license flags
  249. ULONG m_ulUIFlags; // UI flags for logon
  250. sGlobalProfileProps m_sProfileProps;
  251. std::string m_strAppName;
  252. GUID m_sServerGuid;
  253. private:
  254. std::recursive_mutex m_ResolveResultCacheMutex;
  255. ECCache<ECMapResolveResults> m_ResolveResultCache;
  256. bool m_has_session;
  257. friend class WSMessageStreamExporter;
  258. friend class WSMessageStreamImporter;
  259. ALLOC_WRAP_FRIEND;
  260. };
  261. #endif // WSTRANSPORT_H