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.

273 lines
11 KiB

  1. /*++
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name :
  4. route.h
  5. Abstract:
  6. This file defines functions and types required for
  7. routing interface library.
  8. Revision History:
  9. --*/
  10. #ifndef _ROUTE_H_
  11. #define _ROUTE_H_
  12. #define ROUTING_DLL_NAME "abookdb.dll"
  13. #define ROUTING_FUN_INIT "AbInitialize"
  14. #define ROUTING_FUN_TERM "AbTerminate"
  15. #define ROUTING_FUN_GETMAILROOT "AbGetUserMailRoot"
  16. #define ROUTING_FUN_RESOLVEADDRESS "AbResolveAddress"
  17. #define ROUTING_FUN_GET_RESOLVE_ADDRESS "AbGetResolveAddress"
  18. #define ROUTING_FUN_END_RESOLVE_ADDRESS "AbEndResolveAddress"
  19. #define ROUTING_FUN_GETNEXTENUM "AbGetNextEnumResult"
  20. #define ROUTING_FUN_ENDENUMRESULT "AbEndEnumResult"
  21. #define ROUTING_FUN_SETDOMAIN_MAPPING "AbSetDomainMapping"
  22. #define ROUTING_FUN_GET_ROUTING_DIRECTORY "AbGetRoutingDirectory"
  23. #define ROUTING_FUN_SET_SOURCES "AbSetSources"
  24. #define ROUTING_FUN_VALIDATE_SOURCE "AbValidateSource"
  25. #define ROUTING_FUN_VALIDATE_NUM_SOURCES "AbValidateNumSources"
  26. #define ROUTING_FUN_SET_LOCAL_DOMAINS "AbSetLocalDomains"
  27. #define ROUTING_FUN_CREATE_USER "AbCreateUser"
  28. #define ROUTING_FUN_DELETE_USER "AbDeleteUser"
  29. #define ROUTING_FUN_SET_FORWARD "AbSetForward"
  30. #define ROUTING_FUN_SET_MAILROOT "AbSetMailRoot"
  31. #define ROUTING_FUN_SET_MAILBOX_SIZE "AbSetMailboxSize"
  32. #define ROUTING_FUN_SET_MAILBOX_MESSAGE_SIZE "AbSetMailboxMessageSize"
  33. #define ROUTING_FUN_GET_USER_PROPS "AbGetUserProps"
  34. #define ROUTING_FUN_CREATE_DL "AbCreateDL"
  35. #define ROUTING_FUN_DELETE_DL "AbDeleteDL"
  36. #define ROUTING_FUN_CREATE_DL_MEMBER "AbCreateDLMember"
  37. #define ROUTING_FUN_DELETE_DL_MEMBER "AbDeleteDLMember"
  38. #define ROUTING_FUN_ENUM_NAME_LIST "AbEnumNameList"
  39. #define ROUTING_FUN_ENUM_NAME_LIST_FROM_DL "AbEnumNameListFromDL"
  40. #define ROUTING_FUN_GET_NEXT_EMAIL "AbGetNextEmail"
  41. #define ROUTING_FUN_END_ENUM_RESULT "AbEndEnumResult"
  42. #define ROUTING_FUN_GETERRORSTRING "AbGetErrorString"
  43. #define ROUTING_FUN_ADD_LOCAL_DOMAIN "AbAddLocalDomain"
  44. #define ROUTING_FUN_ADD_ALIAS_DOMAIN "AbAddAliasDomain"
  45. #define ROUTING_FUN_DELETE_LOCAL_DOMAIN "AbDeleteLocalDomain"
  46. #define ROUTING_FUN_DELETE_ALL_LOCAL_DOMAINS "AbDeleteAllLocalDomains"
  47. #define ROUTING_FUN_ABCANCEL "AbCancel"
  48. #define ROUTING_FUN_MAKE_BACKUP "AbMakeBackup"
  49. #define ROUTING_FUN_GET_TYPE "AbGetType"
  50. #if defined(TDC)
  51. #define ROUTING_FUN_FREE_MEMORY "AbFreeMemory"
  52. #define ROUTING_FUN_GET_DL_PROPS "AbGetDLProps"
  53. #define ROUTING_FUN_GET_NEXT_ENUM_RESULT "AbGetNextEnumResult"
  54. #endif
  55. #define RtxFlag(i) ((0x1) << (i))
  56. #define IsRtxFlagSet(rtxflag, rtxmask) (((rtxflag) & (rtxmask)) != 0)
  57. #define cbEmailNameMax (316)
  58. #define cbVRootMax (250)
  59. #define cbDomainMax (250)
  60. #define cbSourceMax (512)
  61. #define rtxnameUser RtxFlag(0)
  62. #define rtxnameDistListNormal RtxFlag(1)
  63. #define rtxnameDistListExtended RtxFlag(2)
  64. #define rtxnameDistListSite RtxFlag(3)
  65. #define rtxnameDistListDomain RtxFlag(4)
  66. #define rtxnameDistListAll ( \
  67. rtxnameDistListNormal | \
  68. rtxnameDistListExtended | \
  69. rtxnameDistListSite | \
  70. rtxnameDistListDomain \
  71. )
  72. #define rtxnameAll ( \
  73. rtxnameUser | \
  74. rtxnameDistListAll \
  75. )
  76. #define ROUTING_INIT_MAIL_ROOT (RtxFlag(1))
  77. #define ROUTING_INIT_USER_CONFIG (RtxFlag(2))
  78. #define ROUTING_INIT_DL_CONFIG (RtxFlag(3))
  79. #define ROUTING_INIT_RESOLVE (RtxFlag(4))
  80. #define ROUTING_INIT_SOURCES (RtxFlag(5))
  81. #define ROUTING_INIT_DOMAIN (RtxFlag(6))
  82. #define ROUTING_INIT_PERF (RtxFlag(7))
  83. #define ROUTING_INIT_ENUM (RtxFlag(8))
  84. #define ROUTING_INIT_LIST (RtxFlag(9))
  85. #define ROUTING_INIT_UTIL (RtxFlag(10))
  86. #define ROUTING_INIT_BACKUP (RtxFlag(11))
  87. #define ROUTING_INIT_ALL ( \
  88. ROUTING_INIT_MAIL_ROOT | \
  89. ROUTING_INIT_USER_CONFIG | \
  90. ROUTING_INIT_DL_CONFIG | \
  91. ROUTING_INIT_RESOLVE | \
  92. ROUTING_INIT_SOURCES | \
  93. ROUTING_INIT_DOMAIN | \
  94. ROUTING_INIT_PERF | \
  95. ROUTING_INIT_ENUM | \
  96. ROUTING_INIT_LIST | \
  97. ROUTING_INIT_UTIL \
  98. )
  99. enum RTTYPE {rttypeNone, rttypeSQL, rttypeFF, rttypeLDAP};
  100. typedef HANDLE HRTXENUM, *PHRTXENUM;
  101. typedef struct _RTX_DOMAIN_ENTRY
  102. {
  103. LIST_ENTRY m_list;
  104. char m_szDomain[cbDomainMax];
  105. } RTX_DOMAIN_ENTRY, *PRTX_DOMAIN_ENTRY;
  106. typedef struct _RTX_USER_PROPS
  107. {
  108. CHAR szEmail[cbEmailNameMax];
  109. CHAR szForward[cbEmailNameMax];
  110. BOOL fLocal;
  111. DWORD cbMailBoxSize;
  112. DWORD cbMailboxMessageSize;
  113. CHAR szVRoot[cbVRootMax];
  114. } RTX_USER_PROPS, *LPRTX_USER_PROPS;
  115. /*
  116. typedef struct _RTX_DIST_LIST_PROPS
  117. {
  118. CHAR szEmail[cbEmailNameMax];
  119. DWORD dwToken;
  120. } RTX_DIST_LIST_PROPS, *LPRTX_DIST_LIST_PROPS;
  121. */
  122. class CRtx
  123. {
  124. private:
  125. HINSTANCE m_hDll;
  126. HANDLE m_hContext;
  127. RTTYPE m_rttype;
  128. struct __ROUTINGVTBL__ {
  129. LPFNAB_INIT pfnInit;
  130. LPFNAB_TERM pfnTerm;
  131. LPFNAB_GET_MAILROOT pfnGetMailRoot;
  132. LPFNAB_CREATE_USER pfnCreateUser;
  133. LPFNAB_DELETE_USER pfnDeleteUser;
  134. LPFNAB_SET_FORWARD pfnSetForward;
  135. LPFNAB_SET_MAILROOT pfnSetVRoot;
  136. LPFNAB_SET_MAILBOX_SIZE pfnSetMailboxSize;
  137. LPFNAB_SET_MAILBOX_MESSAGE_SIZE pfnSetMailboxMessageSize;
  138. LPFNAB_CREATE_DL pfnCreateDL;
  139. LPFNAB_DELETE_DL pfnDeleteDL;
  140. LPFNAB_CREATE_DL_MEMBER pfnCreateDLMember;
  141. LPFNAB_DELETE_DL_MEMBER pfnDeleteDLMember;
  142. LPFNAB_GET_ROUTING_DIRECTORY pfnGetRoutingDirectory;
  143. LPFNAB_SET_SOURCES pfnSetSources;
  144. LPFNAB_GET_USER_PROPS pfnGetUserProps;
  145. #if defined(TDC)
  146. LPFNAB_GET_DL_PROPS pfnGetDLProps;
  147. #endif
  148. LPFNAB_ADD_LOCAL_DOMAIN pfnAddLocalDomain;
  149. LPFNAB_ADD_ALIAS_DOMAIN pfnAddAliasDomain;
  150. LPFNAB_DELETE_LOCAL_DOMAIN pfnDeleteLocalDomain;
  151. LPFNAB_DELETE_ALL_LOCAL_DOMAINS pfnDeleteAllLocalDomains;
  152. #if defined(TDC)
  153. LPFNAB_GET_NEXT_ENUM_RESULT pfnGetNextEnumResult;
  154. #endif
  155. LPFNAB_END_ENUM_RESULT pfnEndEnumResult;
  156. LPFNAB_ENUM_NAME_LIST pfnEnumNameList;
  157. LPFNAB_ENUM_NAME_LIST_FROM_DL pfnEnumNameListFromDL;
  158. LPFNAB_GET_NEXT_EMAIL pfnGetNextEmail;
  159. LPFNAB_RES_ADDR pfnResolveAddress;
  160. LPFNAB_GET_RES_ADDR pfnGetResolveAddress;
  161. LPFNAB_END_RES_ADDR pfnEndResolveAddress;
  162. #if defined(TDC)
  163. LPFNAB_FREE_MEMORY pfnFreeMemory;
  164. #endif
  165. LPFNAB_GET_ERROR_STRING pfnGetErrorString;
  166. LPFNAB_CANCEL pfnCancel;
  167. LPFNAB_MAKE_BACKUP pfnMakeBackup;
  168. LPFNAB_GET_TYPE pfnGetType;
  169. LPFNAB_VALIDATE_SOURCE pfnValidateSource;
  170. LPFNAB_VALIDATE_NUM_SOURCES pfnValidateNumSources;
  171. } m_routingvtbl;
  172. public:
  173. CRtx() : m_hDll(NULL), m_hContext(NULL), m_rttype(rttypeNone)
  174. {
  175. FillMemory(&m_routingvtbl, sizeof(m_routingvtbl), 0xFF);
  176. }
  177. ~CRtx() {};
  178. BOOL Initialize(LPSTR szDll, LPSTR szDisplayName, LPFNLOGTRANX pfnlogtranx, DWORD dwFlags, PLIST_ENTRY pleDbConfig);
  179. void Terminate();
  180. RTTYPE GetRtType() { return m_rttype; }
  181. BOOL AddOptionalEntryPoints(DWORD dwFlags);
  182. BOOL GetMailRoot(LPSTR szUser, LPSTR szMoniker, DWORD *pcbMoniker);
  183. BOOL CreateUser(LPSTR szEmail, LPSTR szForward, BOOL fLocalUser, LPSTR szVRoot, DWORD cbMailboxMax, DWORD cbMailboxMessageMax);
  184. BOOL DeleteUser(LPSTR szEmail);
  185. BOOL GetUserProps(LPSTR szEmail, RTX_USER_PROPS *pUserProps);
  186. BOOL SetForward(LPSTR szEmail, LPSTR szForward);
  187. BOOL SetMailboxSize(LPSTR szEmail, DWORD cbMailboxMax);
  188. BOOL SetMailboxMessageSize(LPSTR szEmail, DWORD cbMailboxMessageMax);
  189. BOOL SetVRoot(LPSTR szEmail, LPSTR szVRoot);
  190. BOOL CreateDistList(LPSTR szEmail, DWORD dwType);
  191. BOOL DeleteDistList(LPSTR szEmail);
  192. BOOL CreateDistListMember(LPSTR szEmail, LPSTR szMember);
  193. BOOL DeleteDistListMember(LPSTR szEmail, LPSTR szMember);
  194. BOOL GetRoutingDirectory(LPSTR szDll, PLIST_ENTRY pleSources, LPSTR szDirectory);
  195. BOOL SetSources(PLIST_ENTRY pHead);
  196. BOOL ValidateSource(LPSTR szSource);
  197. BOOL ValidateNumSources(DWORD dwNumSources);
  198. BOOL AddLocalDomain(LPSTR szName);
  199. BOOL AddAliasDomain(LPSTR szName, LPSTR szAlias);
  200. BOOL DeleteLocalDomain(LPSTR szName);
  201. BOOL DeleteAllLocalDomains();
  202. BOOL EnumNameList(LPSTR szEmail, BOOL fForward, DWORD crowsReq, DWORD dwFlags, PHRTXENUM phrtxenum);
  203. BOOL EnumNameListFromDL(LPSTR szEmailDL, LPSTR szEmail, BOOL fForward, DWORD crowsReq, DWORD dwFlags, PHRTXENUM phrtxenum);
  204. BOOL GetNextEmail(HRTXENUM hrtxenum, DWORD *pdwType, LPSTR szEmail);
  205. #if defined(TDC)
  206. BOOL GetNextEnumResult(HRTXENUM hrtxenum, LPVOID pvBuf, LPDWORD pcbBuf);
  207. #endif
  208. BOOL EndEnumResult(HRTXENUM hrtxenum);
  209. DWORD EnumRowsReturned(HRTXENUM hrtxenum);
  210. BOOL FreeHrtxenum(HRTXENUM hrtxtenum);
  211. #if defined(TDC)
  212. BOOL FreeMemory(PABROUTING pabrouting);
  213. #endif
  214. BOOL GetErrorString(DWORD dwErr, LPSTR lpBuf, DWORD cbBufSize);
  215. BOOL ResolveAddress(PLIST_ENTRY HeadOfList, PABADDRSTAT pabAddrStat, PABROUTING pabrouting, PABRESOLVE pabresolve);
  216. BOOL GetResolveAddress(PABRESOLVE pabresolve, PABROUTING pabrouting);
  217. BOOL EndResolveAddress(PABRESOLVE pabresolve);
  218. BOOL Cancel(void);
  219. BOOL MakeBackup(LPSTR szDirectory);
  220. #if defined(TDC)
  221. LPFNAB_FREE_MEMORY PfnFreeMemory() { return m_routingvtbl.pfnFreeMemory; }
  222. #endif
  223. };
  224. #endif