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.

182 lines
5.2 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. PassProvider.h
  5. Abstract:
  6. Header file for Provider implementations
  7. Author:
  8. Max Metral (mmetral) 12-Aug-1998
  9. Revision History:
  10. 12-Aug-1998 mmetral
  11. Created.
  12. --*/
  13. #ifndef _HUBAPI_H_
  14. #define _HUBAPI_H_
  15. #include "PassportTypes.h"
  16. /**
  17. * We use fixed size structure members here for efficiency.
  18. * If you don't want to write your own "AsciiToUniCpyN", here's an example
  19. * w/no error checking or null appending
  20. *
  21. * AsciiToUniCpyN(WCHAR* dest, CHAR* src, DWORD n)
  22. * {
  23. * while ((n-- > 0) && (*(dest++)=(WCHAR) *(src++)))
  24. * ;
  25. * }
  26. */
  27. typedef struct _UserEntry
  28. {
  29. CHAR achMemberName[MAX_MEMBERNAME_LEN];
  30. CHAR achContactEmail[MAX_CONTACTEMAIL_LEN];
  31. CHAR achPassword[MAX_PASSWORD_LEN];
  32. char achCountry [2]; // ISO
  33. CHAR achPostalCode[MAX_POSTALCODE_LEN];
  34. DATE dtBirthdate;
  35. GENDER Gender;
  36. CHAR achMemberID[MAX_MEMBERID_LEN];
  37. CHAR achAlias[MAX_ALIAS_LEN];
  38. ULONG ulLanguagePreference;
  39. CHAR achMSNGUID[MAX_MSNGUID_LEN];
  40. ULONG ulProfileVersion;
  41. ULONG ulFlags;
  42. BYTE* pProviderInfo; // Pointer for provider's use
  43. }
  44. UserEntry;
  45. /**
  46. * Here are the function prototypes for providers.
  47. *
  48. * The function prototypes YOU (the provider implementor) must implement
  49. * are here too. If you are an implementor, define _PROVIDER_IMPLEMENTATION_,
  50. * and the exports will be handled correctly
  51. */
  52. #ifdef _PROVIDER_IMPLEMENTATION_
  53. #define PROVEXPORT __declspec(dllexport)
  54. #else
  55. #define PROVEXPORT __declspec(dllimport)
  56. #endif
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif
  60. /**
  61. * Initializes provider. Returns either:
  62. * S_OK - Initialization succeeded, the hub should begin processing requests
  63. * E_FAIL - Initialization failed, the hub should generate the appropriate
  64. * diagnostic events and abort startup
  65. */
  66. PROVEXPORT HRESULT WINAPI Init();
  67. /**
  68. * Gets a member entry.
  69. *
  70. * pachRequestingDN
  71. *
  72. * The hub passes in the "distinguished name" of the requesting party.
  73. * In most cases this corresponds to the subject dn from the X.509
  74. * certificate used in the connection to the hub. This can be useful for
  75. * filling in the pDomainReserved portion of the UserEntry.
  76. *
  77. * pachMemberName
  78. *
  79. * The Passport Id (including domain name) of the user to be retrieved.
  80. * For example, max@hotmail.com.
  81. *
  82. * pExistingEntry
  83. *
  84. * The hub passes in the existing cached UserEntry record (if any) for
  85. * examination by the provider. The definition of the UserEntry
  86. * structure follows this function declaration. pExistingEntry can be
  87. * NULL.
  88. *
  89. * ppNewEntry
  90. *
  91. * The provider should return the UserEntry to be used in authenticating
  92. * the user. If the same, the provider should return pExistingEntry
  93. * here. If there is no valid entry for the user, the Get function
  94. * should use the E_NO_USER return code.
  95. *
  96. * ppachDomainReserved
  97. *
  98. * The provider can pass back a value to be used for the pDomainReserved field
  99. * of the returned profile. The caller does NO management of this memory. The
  100. * likely solution is to place all possible values in the structure stored in
  101. * pProviderInfo, and free them on Release. This field is broken out to allow
  102. * different values to be delivered to different brokers without causing locking
  103. * problems.
  104. *
  105. * Returns:
  106. * S_OK - A valid user entry was placed in ppNewEntry
  107. * E_NO_USER - There is no valid user entry for the user named by bstrMemberName
  108. * Other E_* code - A system failure has occurred, and should be logged accordingly
  109. *
  110. */
  111. PROVEXPORT HRESULT WINAPI Get(LPSTR pachRequestingDN, LPSTR pachMemberName,
  112. ULONG* pulSchemaVersionRequest,
  113. ULONG* pulSchemaVersionResponse,
  114. LPSTR* pachSchemaDefinition,
  115. UserEntry *pExistingEntry, UserEntry **ppNewEntry,
  116. LPSTR *ppachDomainReserved);
  117. /**
  118. * Checks to see whether a member exists. This can be implemented as a call
  119. * to Get, but to allow maximum performance, we push that decision down to the
  120. * individual provider.
  121. *
  122. * in parameters (dn and memberName) are same as Get
  123. *
  124. * Returns:
  125. * S_OK - A valid user entry was placed in ppNewEntry
  126. * E_NO_USER - There is no valid user entry for the user named by bstrMemberName
  127. * Other E_* code - A system failure has occurred, and should be logged accordingly
  128. *
  129. */
  130. PROVEXPORT HRESULT WINAPI MemberExists(LPSTR pwchRequestingDN, LPSTR pachMemberName);
  131. /**
  132. * Release gives the provider an opportunity to clean up UserEntry-s.
  133. */
  134. PROVEXPORT void WINAPI Release(UserEntry *pUserEntry);
  135. /**
  136. * This code number is arbitrary. Should probably be more carefully
  137. * chosen at some point.
  138. */
  139. #define E_NO_USER 0x80ff0001
  140. #define E_NO_SCHEMA 0x80ff0002
  141. /**
  142. * INVALID_SCHEMA is used to terminate the list of desired schemas.
  143. */
  144. #define INVALID_SCHEMA 0xffffffff
  145. /**
  146. * ANY_SCHEMA is used as a wild card in the list of desired schemas
  147. */
  148. #define ANY_SCHEMA 0x00000000
  149. typedef HRESULT (CALLBACK* LPPROVINIT)();
  150. typedef HRESULT
  151. (CALLBACK* LPPROVGET)(LPSTR,LPSTR,ULONG*,ULONG*,LPSTR*,UserEntry*,UserEntry**,LPSTR*);
  152. typedef HRESULT (CALLBACK* LPPROVMEXIST)(LPSTR,LPSTR);
  153. typedef void (CALLBACK* LPPROVRELEASE)(UserEntry*);
  154. #ifdef __cplusplus
  155. } /* Extern C */
  156. #endif
  157. #endif