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.

350 lines
8.7 KiB

  1. /*
  2. * stub.h - Stub ADT description.
  3. */
  4. /* Types
  5. ********/
  6. /* stub types */
  7. typedef enum _stubtype
  8. {
  9. ST_OBJECTTWIN,
  10. ST_TWINFAMILY,
  11. ST_FOLDERPAIR
  12. }
  13. STUBTYPE;
  14. DECLARE_STANDARD_TYPES(STUBTYPE);
  15. /* stub flags */
  16. typedef enum _stubflags
  17. {
  18. /* This stub was marked for deletion while it was locked. */
  19. STUB_FL_UNLINKED = 0x0001,
  20. /* This stub has already been used for some operation. */
  21. STUB_FL_USED = 0x0002,
  22. /*
  23. * The file stamp of this object twin stub is valid. (Only used for object
  24. * twins to cache file stamp from folder twin expansion for RECNODE
  25. * creation.)
  26. */
  27. STUB_FL_FILE_STAMP_VALID = 0x0004,
  28. /*
  29. * This twin family stub or folder twin stub is in the process of being
  30. * deleted. (Only used for twin families and folder twins.)
  31. */
  32. STUB_FL_BEING_DELETED = 0x0008,
  33. /*
  34. * This folder twin stub is in the process of being translated. (Only used
  35. * for folder twins.)
  36. */
  37. STUB_FL_BEING_TRANSLATED = 0x0010,
  38. /*
  39. * This object twin stub was explicitly added a an object twin through
  40. * AddObjectTwin(). (Only used for object twins.)
  41. */
  42. STUB_FL_FROM_OBJECT_TWIN = 0x0100,
  43. /*
  44. * This object twin stub was not reconciled the last time its twin family
  45. * was reconciled, and some members of the twin family were known to have
  46. * changed. (Only used for object twins.)
  47. */
  48. STUB_FL_NOT_RECONCILED = 0x0200,
  49. /*
  50. * The subtree of the root folder of this folder twin stub is to be included
  51. * in reconciliation. (Only used for folder twins.)
  52. */
  53. STUB_FL_SUBTREE = 0x0400,
  54. /*
  55. * The object twins in this twin family are pending deletion because an
  56. * object twin was deleted, and no object twins have changed since that
  57. * object twins was deleted. This folder twin is pending deletion because
  58. * its folder root is last known deleted. (Only used for twin families and
  59. * folder twins.)
  60. */
  61. STUB_FL_DELETION_PENDING = 0x0800,
  62. /*
  63. * The client indicated that this object twin should not be deleted. (Only
  64. * used for object twins.)
  65. */
  66. STUB_FL_KEEP = 0x1000,
  67. /* stub flag combinations */
  68. ALL_STUB_FLAGS = (STUB_FL_UNLINKED |
  69. STUB_FL_USED |
  70. STUB_FL_FILE_STAMP_VALID |
  71. STUB_FL_BEING_DELETED |
  72. STUB_FL_BEING_TRANSLATED |
  73. STUB_FL_FROM_OBJECT_TWIN |
  74. STUB_FL_NOT_RECONCILED |
  75. STUB_FL_SUBTREE |
  76. STUB_FL_DELETION_PENDING |
  77. STUB_FL_KEEP),
  78. ALL_OBJECT_TWIN_FLAGS = (STUB_FL_UNLINKED |
  79. STUB_FL_USED |
  80. STUB_FL_FILE_STAMP_VALID |
  81. STUB_FL_NOT_RECONCILED |
  82. STUB_FL_FROM_OBJECT_TWIN |
  83. STUB_FL_KEEP),
  84. ALL_TWIN_FAMILY_FLAGS = (STUB_FL_UNLINKED |
  85. STUB_FL_USED |
  86. STUB_FL_BEING_DELETED |
  87. STUB_FL_DELETION_PENDING),
  88. ALL_FOLDER_TWIN_FLAGS = (STUB_FL_UNLINKED |
  89. STUB_FL_USED |
  90. STUB_FL_BEING_DELETED |
  91. STUB_FL_BEING_TRANSLATED |
  92. STUB_FL_SUBTREE |
  93. STUB_FL_DELETION_PENDING),
  94. /* bit mask used to save stub flags in briefcase database */
  95. DB_STUB_FLAGS_MASK = 0xff00
  96. }
  97. STUBFLAGS;
  98. /*
  99. * common stub - These fields must appear at the start of TWINFAMILY,
  100. * OBJECTTWIN, and FOLDERPAIR in the same order.
  101. */
  102. typedef struct _stub
  103. {
  104. /* structure tag */
  105. STUBTYPE st;
  106. /* lock count */
  107. ULONG ulcLock;
  108. /* flags */
  109. DWORD dwFlags;
  110. }
  111. STUB;
  112. DECLARE_STANDARD_TYPES(STUB);
  113. /* object twin family */
  114. typedef struct _twinfamily
  115. {
  116. /* common stub */
  117. STUB stub;
  118. /* handle to name string */
  119. HSTRING hsName;
  120. /* handle to list of object twins */
  121. HLIST hlistObjectTwins;
  122. /* handle to parent briefcase */
  123. HBRFCASE hbr;
  124. }
  125. TWINFAMILY;
  126. DECLARE_STANDARD_TYPES(TWINFAMILY);
  127. /* object twin */
  128. typedef struct _objecttwin
  129. {
  130. /* common stub */
  131. STUB stub;
  132. /* handle to folder path */
  133. HPATH hpath;
  134. /* file stamp at last reconciliation time */
  135. FILESTAMP fsLastRec;
  136. /* pointer to parent twin family */
  137. PTWINFAMILY ptfParent;
  138. /* source folder twins count */
  139. ULONG ulcSrcFolderTwins;
  140. /*
  141. * current file stamp, only valid if STUB_FL_FILE_STAMP_VALID is set in
  142. * stub's flags
  143. */
  144. FILESTAMP fsCurrent;
  145. }
  146. OBJECTTWIN;
  147. DECLARE_STANDARD_TYPES(OBJECTTWIN);
  148. /* folder pair data */
  149. typedef struct _folderpairdata
  150. {
  151. /* handle to name of included objects - may contain wildcards */
  152. HSTRING hsName;
  153. /* attributes to match */
  154. DWORD dwAttributes;
  155. /* handle to parent briefcase */
  156. HBRFCASE hbr;
  157. }
  158. FOLDERPAIRDATA;
  159. DECLARE_STANDARD_TYPES(FOLDERPAIRDATA);
  160. /* folder pair */
  161. typedef struct _folderpair
  162. {
  163. /* common stub */
  164. STUB stub;
  165. /* handle to folder path */
  166. HPATH hpath;
  167. /* pointer to folder pair data */
  168. PFOLDERPAIRDATA pfpd;
  169. /* pointer to other half of folder pair */
  170. struct _folderpair *pfpOther;
  171. }
  172. FOLDERPAIR;
  173. DECLARE_STANDARD_TYPES(FOLDERPAIR);
  174. /*
  175. * EnumGeneratedObjectTwins() callback function
  176. *
  177. * Called as:
  178. *
  179. * bContinue = EnumGeneratedObjectTwinsProc(pot, pvRefData);
  180. */
  181. typedef BOOL (*ENUMGENERATEDOBJECTTWINSPROC)(POBJECTTWIN, PVOID);
  182. /*
  183. * EnumGeneratingFolderTwins() callback function
  184. *
  185. * Called as:
  186. *
  187. * bContinue = EnumGeneratingFolderTwinsProc(pfp, pvRefData);
  188. */
  189. typedef BOOL (*ENUMGENERATINGFOLDERTWINSPROC)(PFOLDERPAIR, PVOID);
  190. /* Prototypes
  191. *************/
  192. /* stub.c */
  193. extern void InitStub(PSTUB, STUBTYPE);
  194. extern TWINRESULT DestroyStub(PSTUB);
  195. extern void LockStub(PSTUB);
  196. extern void UnlockStub(PSTUB);
  197. extern DWORD GetStubFlags(PCSTUB);
  198. extern void SetStubFlag(PSTUB, DWORD);
  199. extern void ClearStubFlag(PSTUB, DWORD);
  200. extern BOOL IsStubFlagSet(PCSTUB, DWORD);
  201. extern BOOL IsStubFlagClear(PCSTUB, DWORD);
  202. #ifdef VSTF
  203. extern BOOL IsValidPCSTUB(PCSTUB);
  204. #endif
  205. /* twin.c */
  206. extern BOOL FindObjectTwin(HBRFCASE, HPATH, LPCTSTR, PHNODE);
  207. extern TWINRESULT TwinObjects(HBRFCASE, HCLSIFACECACHE, HPATH, HPATH, LPCTSTR, POBJECTTWIN *, POBJECTTWIN *);
  208. extern BOOL CreateObjectTwin(PTWINFAMILY, HPATH, POBJECTTWIN *);
  209. extern TWINRESULT UnlinkObjectTwin(POBJECTTWIN);
  210. extern void DestroyObjectTwin(POBJECTTWIN);
  211. extern TWINRESULT UnlinkTwinFamily(PTWINFAMILY);
  212. extern void MarkTwinFamilyNeverReconciled(PTWINFAMILY);
  213. extern void MarkObjectTwinNeverReconciled(PVOID);
  214. extern void DestroyTwinFamily(PTWINFAMILY);
  215. extern void MarkTwinFamilyDeletionPending(PTWINFAMILY);
  216. extern void UnmarkTwinFamilyDeletionPending(PTWINFAMILY);
  217. extern BOOL IsTwinFamilyDeletionPending(PCTWINFAMILY);
  218. extern void ClearTwinFamilySrcFolderTwinCount(PTWINFAMILY);
  219. extern BOOL EnumObjectTwins(HBRFCASE, ENUMGENERATEDOBJECTTWINSPROC, PVOID);
  220. extern BOOL ApplyNewFolderTwinsToTwinFamilies(PCFOLDERPAIR);
  221. extern TWINRESULT TransplantObjectTwin(POBJECTTWIN, HPATH, HPATH);
  222. extern BOOL IsFolderObjectTwinName(LPCTSTR);
  223. #ifdef VSTF
  224. extern BOOL IsValidPCTWINFAMILY(PCTWINFAMILY);
  225. extern BOOL IsValidPCOBJECTTWIN(PCOBJECTTWIN);
  226. #endif
  227. /* foldtwin.c */
  228. extern void LockFolderPair(PFOLDERPAIR);
  229. extern void UnlockFolderPair(PFOLDERPAIR);
  230. extern TWINRESULT UnlinkFolderPair(PFOLDERPAIR);
  231. extern void DestroyFolderPair(PFOLDERPAIR);
  232. extern BOOL ApplyNewObjectTwinsToFolderTwins(HLIST);
  233. extern BOOL BuildPathForMatchingObjectTwin(PCFOLDERPAIR, PCOBJECTTWIN, HPATHLIST, PHPATH);
  234. extern BOOL EnumGeneratedObjectTwins(PCFOLDERPAIR, ENUMGENERATEDOBJECTTWINSPROC, PVOID);
  235. extern BOOL EnumGeneratingFolderTwins(PCOBJECTTWIN, ENUMGENERATINGFOLDERTWINSPROC, PVOID, PULONG);
  236. extern BOOL FolderTwinGeneratesObjectTwin(PCFOLDERPAIR, HPATH, LPCTSTR);
  237. #ifdef VSTF
  238. extern BOOL IsValidPCFOLDERPAIR(PCFOLDERPAIR);
  239. #endif
  240. extern void RemoveObjectTwinFromAllFolderPairs(POBJECTTWIN);
  241. /* expandft.c */
  242. extern BOOL ClearStubFlagWrapper(PSTUB, PVOID);
  243. extern BOOL SetStubFlagWrapper(PSTUB, PVOID);
  244. extern TWINRESULT ExpandIntersectingFolderTwins(PFOLDERPAIR, CREATERECLISTPROC, LPARAM);
  245. extern TWINRESULT TryToGenerateObjectTwin(HBRFCASE, HPATH, LPCTSTR, PBOOL, POBJECTTWIN *);