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.

113 lines
2.2 KiB

  1. #ifndef _RESPONSE_HEADERHASH_HXX_
  2. #define _RESPONSE_HEADERHASH_HXX_
  3. class RESPONSE_HEADER_HASH
  4. : public CTypedHashTable< RESPONSE_HEADER_HASH,
  5. HEADER_RECORD,
  6. CHAR * >
  7. {
  8. public:
  9. RESPONSE_HEADER_HASH()
  10. : CTypedHashTable< RESPONSE_HEADER_HASH,
  11. HEADER_RECORD,
  12. CHAR * >
  13. ("RESPONSE_HEADER_HASH")
  14. {
  15. }
  16. static
  17. CHAR *
  18. ExtractKey(
  19. const HEADER_RECORD * pRecord
  20. )
  21. {
  22. DBG_ASSERT( pRecord != NULL );
  23. return pRecord->_pszName;
  24. }
  25. static
  26. DWORD
  27. CalcKeyHash(
  28. CHAR * pszKey
  29. )
  30. {
  31. return HashStringNoCase( pszKey );
  32. }
  33. static
  34. bool
  35. EqualKeys(
  36. CHAR * pszKey1,
  37. CHAR * pszKey2
  38. )
  39. {
  40. return _stricmp( pszKey1, pszKey2 ) == 0;
  41. }
  42. static
  43. void
  44. AddRefRecord(
  45. HEADER_RECORD * pEntry,
  46. int nIncr
  47. )
  48. {
  49. }
  50. static
  51. HRESULT
  52. Initialize(
  53. VOID
  54. );
  55. static
  56. VOID
  57. Terminate(
  58. VOID
  59. );
  60. static
  61. ULONG
  62. GetIndex(
  63. CHAR * pszName
  64. )
  65. {
  66. HEADER_RECORD * pRecord = NULL;
  67. LK_RETCODE retCode;
  68. HRESULT hr;
  69. retCode = sm_pResponseHash->FindKey( pszName,
  70. &pRecord );
  71. if ( retCode == LK_SUCCESS )
  72. {
  73. DBG_ASSERT( pRecord != NULL );
  74. return pRecord->_ulHeaderIndex;
  75. }
  76. else
  77. {
  78. return UNKNOWN_INDEX;
  79. }
  80. }
  81. static
  82. CHAR *
  83. GetString(
  84. ULONG ulIndex,
  85. DWORD * pcchLength
  86. )
  87. {
  88. if ( ulIndex < HttpHeaderResponseMaximum )
  89. {
  90. *pcchLength = sm_rgHeaders[ ulIndex ]._cchName;
  91. return sm_rgHeaders[ ulIndex ]._pszName;
  92. }
  93. return NULL;
  94. }
  95. private:
  96. static RESPONSE_HEADER_HASH *sm_pResponseHash;
  97. static HEADER_RECORD sm_rgHeaders[];
  98. };
  99. #endif