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.

202 lines
4.6 KiB

  1. /*
  2. * X L O C K . H
  3. *
  4. * XML push-model parsing for the LOCK method
  5. *
  6. * Copyright 1986-1997 Microsoft Corporation, All Rights Reserved
  7. */
  8. #ifndef _XLOCK_H_
  9. #define _XLOCK_H_
  10. #include <buffer.h>
  11. #include <xprs.h>
  12. extern const WCHAR gc_wszLockActive[];
  13. extern const WCHAR gc_wszLockDepth[];
  14. extern const WCHAR gc_wszLockDiscovery[];
  15. extern const WCHAR gc_wszLockEntry[];
  16. extern const WCHAR gc_wszLockInfo[];
  17. extern const WCHAR gc_wszLockOwner[];
  18. extern const WCHAR gc_wszLockScope[];
  19. extern const WCHAR gc_wszLockScopeExclusive[];
  20. extern const WCHAR gc_wszLockScopeShared[];
  21. extern const WCHAR gc_wszLockSupportedlock[];
  22. extern const WCHAR gc_wszLockTimeout[];
  23. extern const WCHAR gc_wszLockToken[];
  24. extern const WCHAR gc_wszLockType[];
  25. extern const WCHAR gc_wszLockTypeWrite[];
  26. extern const WCHAR gc_wszLockTypeCheckout[];
  27. extern const WCHAR gc_wszLockTypeTransaction[];
  28. extern const WCHAR gc_wszLockTypeTransactionGOP[];
  29. extern const WCHAR gc_wszLockScopeLocal[];
  30. extern const WCHAR gc_wszLockRollback[];
  31. // class CNFLock -------------------------------------------------------------
  32. //
  33. class CNFLock : public CNodeFactory
  34. {
  35. // Parsed bits
  36. //
  37. DWORD m_dwLockType;
  38. DWORD m_dwScope;
  39. DWORD m_dwRollback;
  40. // Lock owner
  41. //
  42. UINT m_lOwnerDepth;
  43. BOOL m_fAddNamespaceDecl;
  44. StringBuffer<WCHAR> m_sbOwner;
  45. CXMLOut m_xo;
  46. // State tracking
  47. //
  48. typedef enum {
  49. ST_NODOC,
  50. ST_LOCKINFO,
  51. ST_OWNER,
  52. ST_TYPE,
  53. ST_SCOPE,
  54. ST_ROLLBACK,
  55. ST_INTYPE,
  56. ST_INSCOPE,
  57. ST_INTYPE_TRANS,
  58. } LOCK_PARSE_STATE;
  59. LOCK_PARSE_STATE m_state;
  60. // non-implemented
  61. //
  62. CNFLock(const CNFLock& p);
  63. CNFLock& operator=(const CNFLock& p);
  64. public:
  65. virtual ~CNFLock() {};
  66. CNFLock() :
  67. m_dwLockType(0),
  68. m_dwScope(0),
  69. m_dwRollback(0),
  70. m_lOwnerDepth(0),
  71. m_fAddNamespaceDecl(FALSE),
  72. m_xo(m_sbOwner),
  73. m_state(ST_NODOC)
  74. {
  75. }
  76. // CNodeFactory specific methods
  77. //
  78. virtual SCODE ScCompleteAttribute (void);
  79. virtual SCODE ScCompleteChildren (
  80. /* [in] */ BOOL fEmptyNode,
  81. /* [in] */ DWORD dwType,
  82. /* [in] */ const WCHAR __RPC_FAR *pwcText,
  83. /* [in] */ ULONG ulLen);
  84. virtual SCODE ScHandleNode (
  85. /* [in] */ DWORD dwType,
  86. /* [in] */ DWORD dwSubType,
  87. /* [in] */ BOOL fTerminal,
  88. /* [in] */ const WCHAR __RPC_FAR *pwcText,
  89. /* [in] */ ULONG ulLen,
  90. /* [in] */ ULONG ulNamespaceLen,
  91. /* [in] */ const WCHAR __RPC_FAR *pwcNamespace,
  92. /* [in] */ const ULONG ulNsPrefixLen);
  93. virtual SCODE ScCompleteCreateNode (
  94. /* [in] */ DWORD dwType);
  95. // LockMgr Accessors
  96. //
  97. DWORD DwGetLockType() const { return m_dwLockType; }
  98. DWORD DwGetLockScope() const { return m_dwScope; }
  99. DWORD DwGetLockRollback() const { return m_dwRollback; }
  100. DWORD DwGetLockFlags() const
  101. {
  102. return m_dwLockType |
  103. m_dwRollback |
  104. m_dwScope;
  105. }
  106. // Owner data access
  107. //
  108. LPCWSTR PwszLockOwner() const
  109. {
  110. return m_sbOwner.CbSize()
  111. ? m_sbOwner.PContents()
  112. : NULL;
  113. }
  114. };
  115. // class CNFUnlock -------------------------------------------------------------
  116. //
  117. class CNFUnlock : public CNodeFactory
  118. {
  119. auto_heap_ptr<WCHAR> m_wszComment;
  120. BOOL m_fCancelCheckout;
  121. BOOL m_fAbortTransaction;
  122. BOOL m_fCommitTransaction;
  123. // State tracking
  124. //
  125. typedef enum {
  126. ST_NODOC,
  127. ST_UNLOCKINFO,
  128. ST_COMMENT,
  129. ST_CANCELCHECKOUT,
  130. ST_TRANSACTIONINFO,
  131. ST_TRANSACTIONSTATUS,
  132. ST_TRANSACTIONSTATUS_COMMIT,
  133. ST_TRANSACTIONSTATUS_ABORT
  134. } LOCK_PARSE_STATE;
  135. LOCK_PARSE_STATE m_state;
  136. // non-implemented
  137. //
  138. CNFUnlock(const CNFUnlock& p);
  139. CNFUnlock& operator=(const CNFUnlock& p);
  140. public:
  141. virtual ~CNFUnlock() {};
  142. CNFUnlock() :
  143. m_fCancelCheckout(FALSE),
  144. m_state(ST_NODOC),
  145. m_fAbortTransaction(FALSE),
  146. m_fCommitTransaction(FALSE)
  147. {
  148. }
  149. // CNodeFactory specific methods
  150. //
  151. virtual SCODE ScCompleteAttribute (void);
  152. virtual SCODE ScCompleteChildren (
  153. /* [in] */ BOOL fEmptyNode,
  154. /* [in] */ DWORD dwType,
  155. /* [in] */ const WCHAR __RPC_FAR *pwcText,
  156. /* [in] */ ULONG ulLen);
  157. virtual SCODE ScHandleNode (
  158. /* [in] */ DWORD dwType,
  159. /* [in] */ DWORD dwSubType,
  160. /* [in] */ BOOL fTerminal,
  161. /* [in] */ const WCHAR __RPC_FAR *pwcText,
  162. /* [in] */ ULONG ulLen,
  163. /* [in] */ ULONG ulNamespaceLen,
  164. /* [in] */ const WCHAR __RPC_FAR *pwcNamespace,
  165. /* [in] */ const ULONG ulNsPrefixLen);
  166. // Accessors
  167. //
  168. BOOL FCancelCheckout() const { return m_fCancelCheckout; }
  169. LPCWSTR PwszUnlockComment() const { return m_wszComment.get(); }
  170. BOOL FAbortTransaction() const { return m_fAbortTransaction; }
  171. BOOL FCommitTransaction() const { return m_fCommitTransaction; }
  172. };
  173. #endif // _XLOCK_H_