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.

243 lines
6.7 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989-1999 Microsoft Corporation
  3. Module Name:
  4. paddict.hxx
  5. Abstract:
  6. Implements a dictionary for handling padding expressions for unknown
  7. represent as data types.
  8. Notes:
  9. History:
  10. Jan 25, 1994 RyszardK Created
  11. ----------------------------------------------------------------------------*/
  12. #ifndef __PADDICT_HXX__
  13. #define __PADDICT_HXX__
  14. #include "nulldefs.h"
  15. extern "C"
  16. {
  17. #include <stdio.h>
  18. #include <string.h>
  19. }
  20. #include "cgcommon.hxx"
  21. #include "dict.hxx"
  22. /////////////////////////////////////////////////////////////////////////////
  23. //
  24. // This class defines a dictionary with members for counting and traversing.
  25. //
  26. /////////////////////////////////////////////////////////////////////////////
  27. class CountedDictionary : public Dictionary
  28. {
  29. private:
  30. unsigned short CurrentIndex;
  31. public:
  32. CountedDictionary() : Dictionary()
  33. {
  34. CurrentIndex = 0;
  35. }
  36. ~CountedDictionary() {}
  37. unsigned short GetCount()
  38. {
  39. return CurrentIndex;
  40. }
  41. void IncrementCount()
  42. {
  43. CurrentIndex++;
  44. }
  45. unsigned short GetListOfItems( ITERATOR& ListIter );
  46. void * GetFirst();
  47. void * GetNext();
  48. virtual
  49. SSIZE_T Compare( pUserType pL, pUserType pR );
  50. };
  51. /////////////////////////////////////////////////////////////////////////////
  52. //
  53. // This class defines a dictionary for handling padding related to
  54. // unknown represent as types.
  55. //
  56. /////////////////////////////////////////////////////////////////////////////
  57. typedef struct _RepAsPadDictElem
  58. {
  59. unsigned long KeyOffset;
  60. node_skl * pStructType;
  61. char * pFieldName;
  62. node_skl * pPrevFieldType;
  63. } REP_AS_PAD_EXPR_DESC;
  64. class RepAsPadExprDict : public Dictionary
  65. {
  66. private:
  67. unsigned short EntryCount;
  68. public:
  69. RepAsPadExprDict() : Dictionary()
  70. {
  71. EntryCount = 0;
  72. }
  73. ~RepAsPadExprDict() {}
  74. // Register an entry.
  75. void Register( unsigned long Offset,
  76. node_skl * pStructType,
  77. char * pFieldName,
  78. node_skl * pPrevFieldType );
  79. unsigned short GetCount()
  80. {
  81. return EntryCount;
  82. }
  83. REP_AS_PAD_EXPR_DESC * GetFirst();
  84. REP_AS_PAD_EXPR_DESC * GetNext();
  85. void WriteCurrentPadDesc( ISTREAM * pStream );
  86. SSIZE_T Compare( pUserType pL, pUserType pR );
  87. };
  88. /////////////////////////////////////////////////////////////////////////////
  89. //
  90. // This class defines a dictionary for handling padding related to
  91. // unknown represent as types.
  92. //
  93. /////////////////////////////////////////////////////////////////////////////
  94. typedef struct _RepAsSizeDictElem
  95. {
  96. unsigned long KeyOffset;
  97. char * pTypeName;
  98. } REP_AS_SIZE_DESC;
  99. class RepAsSizeDict : public Dictionary
  100. {
  101. private:
  102. unsigned short EntryCount;
  103. public:
  104. RepAsSizeDict() : Dictionary()
  105. {
  106. EntryCount = 0;
  107. }
  108. ~RepAsSizeDict() {}
  109. // Register an entry.
  110. void Register( unsigned long Offset,
  111. char * pTypeName );
  112. unsigned short GetCount()
  113. {
  114. return EntryCount;
  115. }
  116. REP_AS_SIZE_DESC * GetFirst();
  117. REP_AS_SIZE_DESC * GetNext();
  118. void WriteCurrentSizeDesc( ISTREAM * pStream );
  119. SSIZE_T Compare( pUserType pL, pUserType pR );
  120. };
  121. /////////////////////////////////////////////////////////////////////////////
  122. //
  123. // This class defines a dictionary for handling quintuple routines.
  124. // I.e. this is a support needed for transmit_as represent_as table,
  125. // that is called the Quintuple table for historical reasons.
  126. //
  127. /////////////////////////////////////////////////////////////////////////////
  128. class QuintupleDict : public Dictionary
  129. {
  130. private:
  131. unsigned short CurrentIndex;
  132. public:
  133. QuintupleDict() : Dictionary()
  134. {
  135. CurrentIndex = 0;
  136. }
  137. ~QuintupleDict() {}
  138. // Register an entry.
  139. BOOL Add( void * pContext );
  140. unsigned short GetCount()
  141. {
  142. return CurrentIndex;
  143. }
  144. void * GetFirst();
  145. void * GetNext();
  146. SSIZE_T Compare( pUserType pL, pUserType pR );
  147. };
  148. /////////////////////////////////////////////////////////////////////////////
  149. //
  150. // This class defines a dictionary for Quadruples (usr_marshall support).
  151. //
  152. /////////////////////////////////////////////////////////////////////////////
  153. class QuadrupleDict : public CountedDictionary
  154. {
  155. public:
  156. QuadrupleDict() : CountedDictionary()
  157. {}
  158. ~QuadrupleDict() {}
  159. //
  160. // Try to Add an entry.
  161. //
  162. BOOL Add( void * pContext );
  163. SSIZE_T Compare( pUserType pL, pUserType pR );
  164. };
  165. #endif // __PADDICT_HXX__