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.

383 lines
14 KiB

  1. //+---------------------------------------------------------------
  2. //
  3. // File: Abook.h
  4. //
  5. // Synopsis: Prove Server level api for MSN Servers to access addres book
  6. //
  7. // Copyright (C) 1995 Microsoft Corporation
  8. // All rights reserved.
  9. //
  10. // History: SunShaw Created 30 Jan 1996
  11. //
  12. //----------------------------------------------------------------
  13. #ifndef _ABOOK_H_
  14. #define _ABOOK_H_
  15. #include <abtype.h>
  16. #if defined(__cplusplus)
  17. extern "C" {
  18. #if !defined(DllExport)
  19. #define DllExport __declspec( dllexport )
  20. #endif
  21. #if !defined(DllImport)
  22. #define DllImport __declspec( dllimport )
  23. #endif
  24. #if !defined(_ABOOK_DLL_DEFINED)
  25. #define _ABOOK_DLL_DEFINED
  26. #if defined(WIN32)
  27. #if defined(_ABOOK_DLL)
  28. #define AbookDll DllExport
  29. #else
  30. #define AbookDll DllImport
  31. #endif
  32. #else
  33. #define _ABOOK_DLL
  34. #endif
  35. #endif
  36. #define ABCALLCONV __stdcall
  37. #define ABEXPDLLCPP extern "C" AbookDll
  38. //+---------------------------------------------------------------
  39. //
  40. // All Function Prototype used by SMTP, POP3 or AbSysAdmin
  41. //
  42. //----------------------------------------------------------------
  43. typedef ABRETC (ABCALLCONV *LPFNAB_INIT)(LPSTR, LPFNLOGTRANX, PLIST_ENTRY, HANDLE*);
  44. typedef ABRETC (ABCALLCONV *LPFNAB_TERM)(HANDLE);
  45. typedef ABRETC (ABCALLCONV *LPFNAB_CANCEL)(HANDLE);
  46. typedef ABRETC (ABCALLCONV *LPFNAB_GET_ERROR_STRING)(ABRETC, LPSTR, DWORD);
  47. typedef ABRETC (ABCALLCONV *LPFNAB_GET_ROUTING_DIRECTORY)(PLIST_ENTRY pleSources, LPSTR szDirectory);
  48. typedef ABRETC (ABCALLCONV *LPFNAB_SET_SOURCES)(HANDLE, PLIST_ENTRY);
  49. typedef ABRETC (ABCALLCONV *LPFNAB_VALIDATE_SOURCE)(HANDLE hAbook, LPSTR szSource);
  50. typedef ABRETC (ABCALLCONV *LPFNAB_VALIDATE_NUM_SOURCES)(HANDLE hAbook, DWORD dwNumSources);
  51. typedef ABRETC (ABCALLCONV *LPFNAB_RES_ADDR)(HANDLE, PLIST_ENTRY, PABADDRSTAT pabAddrStat, PABROUTING pabroutingCheckPoint, ABRESOLVE *pabresolve);
  52. typedef ABRETC (ABCALLCONV *LPFNAB_GET_RES_ADDR)(HANDLE, PABRESOLVE pabresolve, PABROUTING pabrouting);
  53. typedef ABRETC (ABCALLCONV *LPFNAB_END_RES_ADDR)(HANDLE, PABRESOLVE pabresolve);
  54. typedef ABRETC (ABCALLCONV *LPFNAB_RES_ADDR_ASYNC)(HANDLE, PLIST_ENTRY, PABADDRSTAT pabAddrStat, PABROUTING pabroutingCheckPoint, ABRESOLVE *pabresolve, LPVOID pContext);
  55. typedef ABRETC (ABCALLCONV *LPFNAB_GET_MAILROOT)(HANDLE, PCHAR, LPSTR, LPDWORD);
  56. typedef ABRETC (ABCALLCONV *LPFNAB_GET_PERFMON_BLK)(HANDLE, PABOOKDB_STATISTICS_0);
  57. typedef ABRETC (ABCALLCONV *LPFNAB_END_ENUM_RESULT)(HANDLE, PABENUM);
  58. typedef ABRETC (ABCALLCONV *LPFNAB_ENUM_NAME_LIST)(HANDLE, LPSTR, BOOL, DWORD, PABENUM);
  59. typedef ABRETC (ABCALLCONV *LPFNAB_ENUM_NAME_LIST_FROM_DL)(HANDLE, LPSTR, LPSTR, BOOL, DWORD, PABENUM);
  60. typedef ABRETC (ABCALLCONV *LPFNAB_GET_NEXT_EMAIL)(HANDLE, PABENUM, DWORD*, LPSTR);
  61. typedef ABRETC (ABCALLCONV *LPFNAB_ADD_LOCAL_DOMAIN)(HANDLE, LPSTR);
  62. typedef ABRETC (ABCALLCONV *LPFNAB_ADD_ALIAS_DOMAIN)(HANDLE, LPSTR, LPSTR);
  63. typedef ABRETC (ABCALLCONV *LPFNAB_DELETE_LOCAL_DOMAIN)(HANDLE, LPSTR);
  64. typedef ABRETC (ABCALLCONV *LPFNAB_DELETE_ALL_LOCAL_DOMAINS)(HANDLE);
  65. typedef ABRETC (ABCALLCONV *LPFNAB_CREATE_USER)(HANDLE hAbook, LPSTR szEmail, LPSTR szForward, BOOL fLocalUser, LPSTR szVRoot, DWORD cbMailboxMax, DWORD cbMailboxMessageMax);
  66. typedef ABRETC (ABCALLCONV *LPFNAB_DELETE_USER)(HANDLE hAbook, LPSTR szEmail);
  67. typedef ABRETC (ABCALLCONV *LPFNAB_SET_FORWARD)(HANDLE hAbook, LPSTR szEmail, LPSTR szForward);
  68. typedef ABRETC (ABCALLCONV *LPFNAB_SET_MAILROOT)(HANDLE hAbook, LPSTR szEmail, LPSTR szVRoot);
  69. typedef ABRETC (ABCALLCONV *LPFNAB_SET_MAILBOX_SIZE)(HANDLE hAbook, LPSTR szEmail, DWORD cbMailboxMax);
  70. typedef ABRETC (ABCALLCONV *LPFNAB_SET_MAILBOX_MESSAGE_SIZE)(HANDLE hAbook, LPSTR szEmail, DWORD cbMailboxMessageMax);
  71. typedef ABRETC (ABCALLCONV *LPFNAB_CREATE_DL)(HANDLE hAbook, LPSTR szEmail, DWORD dwType);
  72. typedef ABRETC (ABCALLCONV *LPFNAB_DELETE_DL)(HANDLE hAbook, LPSTR szEmail);
  73. typedef ABRETC (ABCALLCONV *LPFNAB_CREATE_DL_MEMBER)(HANDLE hAbook, LPSTR szEmail, LPSTR szMember);
  74. typedef ABRETC (ABCALLCONV *LPFNAB_DELETE_DL_MEMBER)(HANDLE hAbook, LPSTR szEmail, LPSTR szMember);
  75. typedef ABRETC (ABCALLCONV *LPFNAB_GET_USER_PROPS)(HANDLE hAbook, LPSTR lpszEmail, ABUSER *pABUSER);
  76. typedef ABRETC (ABCALLCONV *LPFNAB_MAKE_BACKUP)(HANDLE hAbook, LPSTR szConfig);
  77. typedef DWORD (ABCALLCONV *LPFNAB_GET_TYPE)(void);
  78. // Get user or DL's properties
  79. ABEXPDLLCPP ABRETC ABCALLCONV AbGetUserProps(HANDLE hAbook, LPSTR lpszEmail, ABUSER *pABUSER);
  80. ABEXPDLLCPP ABRETC ABCALLCONV AbGetDLProps(HANDLE hAbook, LPSTR lpszEmail, ABDL *pABDL);
  81. // Given beginning chars, match user names
  82. ABEXPDLLCPP ABRETC ABCALLCONV AbEnumNameList(HANDLE hAbook, LPSTR lpszEmail, BOOL f ,
  83. DWORD dwType, PABENUM pabenum);
  84. // Match user names only in the given DL
  85. ABEXPDLLCPP ABRETC ABCALLCONV AbEnumNameListFromDL(HANDLE hAbook, LPSTR lpszDLName, LPSTR lpszEmail,
  86. BOOL f , DWORD dwType, PABENUM pabenum);
  87. // Get back all the matching names
  88. ABEXPDLLCPP ABRETC ABCALLCONV AbGetNextEmail(HANDLE hAbook, PABENUM pabenum, DWORD *pdwType, LPSTR lpszEmail);
  89. //+---------------------------------------------------------------
  90. //
  91. // Function: AbGetType
  92. //
  93. // Synopsis: returns the routing type number
  94. //
  95. // Arguments:
  96. //
  97. // Returns: DWORD Routing type number defined above
  98. //
  99. //----------------------------------------------------------------
  100. #define ROUTING_TYPE_SQL 1
  101. #define ROUTING_TYPE_FF 2
  102. #define ROUTING_TYPE_LDAP 3
  103. ABEXPDLLCPP DWORD ABCALLCONV AbGetType
  104. ();
  105. //+---------------------------------------------------------------
  106. //
  107. // Function: AbInitialize
  108. //
  109. // Synopsis: Must be the first call to abookdb.dll (except AbGetType)
  110. //
  111. // Arguments:
  112. // LPSTR [in] Display name for abookdb users/context,
  113. // i.e. SMTP, POP3 or NULL if don't care.
  114. // LPFNLOGTRANX [in] Transaction Logging callback.
  115. // NULL if don't care about transaction logging.
  116. // PHANDLE [out] Return buffer for context handle,
  117. //
  118. // Returns: ABRETC AddressBook Return code details in <abtype.h>
  119. //
  120. //----------------------------------------------------------------
  121. ABEXPDLLCPP ABRETC ABCALLCONV AbInitialize
  122. (LPSTR pszDisplayName, LPFNLOGTRANX pfnTranx, PLIST_ENTRY pHead, HANDLE* phAbook);
  123. //+---------------------------------------------------------------
  124. //
  125. // Function: AbSetSources
  126. //
  127. // Synopsis: Called to update available data sources at any time
  128. //
  129. // Arguments: LPSTR it's the command line and should have the following form:
  130. // [server=ayin][,][MaxCnx=100]
  131. //
  132. // Returns: ABRETC AddressBook Return code details in <abtype.h>
  133. //
  134. //----------------------------------------------------------------
  135. ABEXPDLLCPP ABRETC ABCALLCONV AbSetSources(HANDLE hAbook, PLIST_ENTRY pHead);
  136. //+---------------------------------------------------------------
  137. //
  138. // Function: AbGetErrorString
  139. //
  140. // Synopsis: To translate ABRETC to an error string
  141. //
  142. // Arguments: ABRETC [in] The return code from abook API
  143. // LPSTR [out] Buffer for the error string to copy into
  144. // DWORD [in] The size of the buffer supplized
  145. //
  146. // Returns: ABRETC AddressBook Return code details in <abtype.h>
  147. //
  148. //----------------------------------------------------------------
  149. ABEXPDLLCPP ABRETC ABCALLCONV AbGetErrorString(ABRETC abrc, LPSTR lpBuf, DWORD cbBufSize);
  150. //+---------------------------------------------------------------
  151. //
  152. // Function: AbTerminate
  153. //
  154. // Synopsis: User must call this when done with abook.dll
  155. //
  156. // Arguments:
  157. // HANDLE [in] Context Handle returned from AbInitialize.
  158. //
  159. // Returns: NONE
  160. //
  161. //----------------------------------------------------------------
  162. ABEXPDLLCPP VOID ABCALLCONV AbTerminate(HANDLE hAbook);
  163. //+---------------------------------------------------------------
  164. //
  165. // Function: AbCancel
  166. //
  167. // Synopsis: This function will cancel all resolve address calls
  168. // to DB so that SMTP can shut down cleanly without waiting
  169. // too long.
  170. //
  171. // Arguments:
  172. // HANDLE [in] Context Handle returned from AbInitialize.
  173. //
  174. // Returns: ABRETC
  175. //
  176. //----------------------------------------------------------------
  177. ABEXPDLLCPP ABRETC ABCALLCONV AbCancel(HANDLE hAbook);
  178. //+---------------------------------------------------------------
  179. //
  180. // Function: AbResolveAddress
  181. //
  182. // Synopsis: Resolves email address to minimum routing info.
  183. //
  184. // Arguments:
  185. // HANDLE [in] Context Handle returned from AbInitialize.
  186. // HACCT [in] HACCT for sender, 0 for non-MSN account
  187. // PQUEUE_ENTRY [in|out] List of CAddr/Recipients
  188. // LPFNCREATEADDR [in] Callback constructor of CAddr
  189. // BOOL* [out] Pointer to buffer to indicate at least 1
  190. // recipient is encrypted and needs verification
  191. // could be NULL in 2.0
  192. //
  193. //
  194. // Returns: ABRETC AddressBook Return code details in <abtype.h>
  195. //
  196. //----------------------------------------------------------------
  197. ABEXPDLLCPP ABRETC ABCALLCONV AbResolveAddress
  198. (
  199. HANDLE hAbook,
  200. PLIST_ENTRY pltInput,
  201. PABADDRSTAT pabAddrStat,
  202. PABROUTING pabroutingCheckPoint,
  203. ABRESOLVE *pabresolve
  204. );
  205. ABEXPDLLCPP ABRETC ABCALLCONV AbAsyncResolveAddress
  206. (
  207. HANDLE hAbook,
  208. PLIST_ENTRY pltInput,
  209. PABADDRSTAT pabAddrStat,
  210. PABROUTING pabroutingCheckPoint,
  211. ABRESOLVE *pabresolve,
  212. LPFNRESOLVECOMPLETE pfnCompletion,
  213. LPVOID pContext
  214. );
  215. ABEXPDLLCPP ABRETC ABCALLCONV AbGetResolveAddress
  216. (
  217. HANDLE hAbook,
  218. ABRESOLVE *pabresolve,
  219. ABROUTING *pabrouting
  220. );
  221. ABEXPDLLCPP ABRETC ABCALLCONV AbEndResolveAddress
  222. (
  223. HANDLE hAbook,
  224. ABRESOLVE *pabresolve
  225. );
  226. ABEXPDLLCPP ABRETC ABCALLCONV AbEndEnumResult
  227. (HANDLE hAbook, PABENUM pabEnum);
  228. //+---------------------------------------------------------------
  229. //
  230. // Function: AbAddLocalDomain AbDeleteLocalDomain
  231. //
  232. // Synopsis: add and delete Local domain to the database
  233. //
  234. // Arguments:
  235. // HANDLE [in] Context Handle returned from AbInitialize.
  236. // HACCT [in] Currently ignored
  237. // PABPDI [in] Pointer to the Local domain structure
  238. //
  239. // Returns: ABRETC AddressBook Return code details in <abtype.h>
  240. //
  241. //----------------------------------------------------------------
  242. ABEXPDLLCPP ABRETC ABCALLCONV AbAddLocalDomain(HANDLE hAbook, LPSTR szDomainName);
  243. ABEXPDLLCPP ABRETC ABCALLCONV AbAddAliasDomain(HANDLE hAbook, LPSTR szDomainName, LPSTR szAliasName);
  244. ABEXPDLLCPP ABRETC ABCALLCONV AbDeleteLocalDomain(HANDLE hAbook, LPSTR szDomainName);
  245. ABEXPDLLCPP ABRETC ABCALLCONV AbDeleteAllLocalDomains(HANDLE hAbook);
  246. //+---------------------------------------------------------------
  247. //
  248. // Function: AbGetUserMailRoot
  249. //
  250. // Synopsis: Gets the Virtual Mail Root for the specified users
  251. //
  252. // Arguments:
  253. // HANDLE [in] Context Handle returned from AbInitialize.
  254. // PCHAR [in] ASCII user name
  255. // LPCHAR [in] ASCII Virtual Mail Root
  256. // LPDWORD [in|out] (in) size of buffer, (out) string length
  257. //
  258. // Returns: ABRETC AddressBook Return code details in <abtype.h>
  259. //
  260. //----------------------------------------------------------------
  261. ABEXPDLLCPP ABRETC ABCALLCONV AbGetUserMailRoot
  262. (HANDLE hAbook, PCHAR pszUser, LPSTR pszVRoot, LPDWORD pcbVRootSize);
  263. //+---------------------------------------------------------------
  264. //
  265. // Function: AbGetPerfmonBlock
  266. //
  267. // Synopsis: Gets the Pointer to the Perfmon Statistic block
  268. // associated with hAbook. The pointer is guaranteed
  269. // to be valid before the AbTerminate call.
  270. //
  271. // Arguments:
  272. // HANDLE [in] Context Handle returned from AbInitialize.
  273. // PABOOKDB_STATISTICS_0*
  274. // [out] Buffer is receive the pointer to stat
  275. // block.
  276. //
  277. // Returns: ABRETC AddressBook Return code details in <abtype.h>
  278. //
  279. //----------------------------------------------------------------
  280. ABEXPDLLCPP ABRETC ABCALLCONV AbGetPerfmonBlock
  281. (HANDLE hAbook, PABOOKDB_STATISTICS_0* ppabStat);
  282. //+---------------------------------------------------------------
  283. //
  284. // Function: AbMakeBackup
  285. //
  286. // Synopsis: Triggers the routing table to make a backup of the
  287. // data associated with hAbook.
  288. //
  289. // Arguments:
  290. // HANDLE [in] Context Handle returned from AbInitialize.
  291. // LPSTR [in] configuration string
  292. //
  293. // Returns: ABRETC AddressBook Return code details in <abtype.h>
  294. //
  295. //----------------------------------------------------------------
  296. ABEXPDLLCPP ABRETC ABCALLCONV AbMakeBackup
  297. (HANDLE hAbook, LPSTR szConfig);
  298. //+---------------------------------------------------------------
  299. //
  300. // Function: AbValidateSource
  301. //
  302. // Synopsis: Validates a single source for accuracy before
  303. // saving into the registry
  304. //
  305. // Arguments:
  306. // HANDLE [in] Context Handle returned from AbInitialize.
  307. // LPSTR [in] source string
  308. //
  309. // Returns: ABRETC AddressBook Return code details in <abtype.h>
  310. //
  311. //----------------------------------------------------------------
  312. ABEXPDLLCPP ABRETC ABCALLCONV AbValidateSource
  313. (HANDLE hAbook, LPSTR szSource);
  314. }
  315. #endif
  316. #endif