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.

217 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1998-2002 Microsoft Corporation
  3. Module Name:
  4. C14np.h
  5. Abstract:
  6. URL canonicalization (c14n) routines
  7. Author:
  8. George V. Reilly (GeorgeRe) 10-Apr-2002
  9. Revision History:
  10. --*/
  11. #ifndef _C14NP_H_
  12. #define _C14NP_H_
  13. typedef
  14. NTSTATUS
  15. (*PFN_POPCHAR_HOSTNAME)(
  16. IN PCUCHAR pSourceChar,
  17. IN ULONG SourceLength,
  18. OUT PULONG pUnicodeChar,
  19. OUT PULONG pBytesToSkip
  20. );
  21. NTSTATUS
  22. HttppPopCharHostNameUtf8(
  23. IN PCUCHAR pSourceChar,
  24. IN ULONG SourceLength,
  25. OUT PULONG pUnicodeChar,
  26. OUT PULONG pBytesToSkip
  27. );
  28. NTSTATUS
  29. HttppPopCharHostNameDbcs(
  30. IN PCUCHAR pSourceChar,
  31. IN ULONG SourceLength,
  32. OUT PULONG pUnicodeChar,
  33. OUT PULONG pBytesToSkip
  34. );
  35. NTSTATUS
  36. HttppPopCharHostNameAnsi(
  37. IN PCUCHAR pSourceChar,
  38. IN ULONG SourceLength,
  39. OUT PULONG pUnicodeChar,
  40. OUT PULONG pBytesToSkip
  41. );
  42. typedef
  43. NTSTATUS
  44. (*PFN_POPCHAR_ABSPATH)(
  45. IN PCUCHAR pSourceChar,
  46. IN ULONG SourceLength,
  47. IN BOOLEAN PercentUAllowed,
  48. IN BOOLEAN AllowRestrictedChars,
  49. OUT PULONG pUnicodeChar,
  50. OUT PULONG pBytesToSkip
  51. );
  52. NTSTATUS
  53. HttppPopCharAbsPathUtf8(
  54. IN PCUCHAR pSourceChar,
  55. IN ULONG SourceLength,
  56. IN BOOLEAN PercentUAllowed,
  57. IN BOOLEAN AllowRestrictedChars,
  58. OUT PULONG pUnicodeChar,
  59. OUT PULONG pBytesToSkip
  60. );
  61. NTSTATUS
  62. HttppPopCharAbsPathDbcs(
  63. IN PCUCHAR pSourceChar,
  64. IN ULONG SourceLength,
  65. IN BOOLEAN PercentUAllowed,
  66. IN BOOLEAN AllowRestrictedChars,
  67. OUT PULONG pUnicodeChar,
  68. OUT PULONG pBytesToSkip
  69. );
  70. NTSTATUS
  71. HttppPopCharAbsPathAnsi(
  72. IN PCUCHAR pSourceChar,
  73. IN ULONG SourceLength,
  74. IN BOOLEAN PercentUAllowed,
  75. IN BOOLEAN AllowRestrictedChars,
  76. OUT PULONG pUnicodeChar,
  77. OUT PULONG pBytesToSkip
  78. );
  79. NTSTATUS
  80. HttppPopCharQueryString(
  81. IN PCUCHAR pSourceChar,
  82. IN ULONG SourceLength,
  83. IN BOOLEAN PercentUAllowed,
  84. IN BOOLEAN AllowRestrictedChars,
  85. OUT PULONG pUnicodeChar,
  86. OUT PULONG pBytesToSkip
  87. );
  88. NTSTATUS
  89. HttppCopyHostByType(
  90. IN URL_ENCODING_TYPE UrlEncoding,
  91. OUT PWSTR pDestination,
  92. IN PCUCHAR pSource,
  93. IN ULONG SourceLength,
  94. OUT PULONG pBytesCopied
  95. );
  96. NTSTATUS
  97. HttppCopyUrlByType(
  98. IN PURL_C14N_CONFIG pCfg,
  99. IN URL_ENCODING_TYPE UrlEncoding,
  100. OUT PWSTR pDestination,
  101. IN PCUCHAR pSource,
  102. IN ULONG SourceLength,
  103. OUT PULONG pBytesCopied
  104. );
  105. NTSTATUS
  106. HttppCleanAndCopyUrlByType(
  107. IN PURL_C14N_CONFIG pCfg,
  108. IN URL_ENCODING_TYPE UrlEncoding,
  109. IN URL_PART UrlPart,
  110. OUT PWSTR pDestination,
  111. IN PCUCHAR pSource,
  112. IN ULONG SourceLength,
  113. OUT PULONG pBytesCopied,
  114. OUT PWSTR * ppQueryString OPTIONAL
  115. );
  116. NTSTATUS
  117. HttppParseIPv6Address(
  118. IN PCWSTR pBuffer,
  119. IN ULONG BufferLength,
  120. IN BOOLEAN ScopeIdAllowed,
  121. OUT PSOCKADDR_IN6 pSockAddr6,
  122. OUT PCWSTR* ppEnd
  123. );
  124. ULONG
  125. HttppPrintIpAddressW(
  126. IN PSOCKADDR pSockAddr,
  127. OUT PWSTR pBuffer
  128. );
  129. //
  130. // Enumerations for the state machines in HttppCleanAndCopyUrlByType()
  131. // and HttpParseUrl() that handle directory-relative processing for
  132. // "//", "/./", and "/../".
  133. //
  134. typedef enum
  135. {
  136. ACTION_NOTHING, // eat the character
  137. ACTION_EMIT_CH, // emit the character
  138. ACTION_EMIT_DOT_CH, // emit "." and the character
  139. ACTION_EMIT_DOT_DOT_CH, // emit ".." and the character
  140. ACTION_BACKUP, // backup to previous segment:
  141. // "/x/y/../z" -> "/x/z"
  142. ACTION_MAX
  143. } URL_ACTION;
  144. typedef enum
  145. {
  146. URL_STATE_START, // default state
  147. URL_STATE_SLASH, // seen "/"
  148. URL_STATE_SLASH_DOT, // seen "/."
  149. URL_STATE_SLASH_DOT_DOT, // seen "/.."
  150. URL_STATE_END, // end state
  151. URL_STATE_ERROR, // error state
  152. URL_STATE_MAX
  153. } URL_STATE;
  154. typedef enum
  155. {
  156. URL_TOKEN_OTHER, // everything else
  157. URL_TOKEN_DOT, // got a '.'
  158. URL_TOKEN_EOS, // End of String
  159. URL_TOKEN_SLASH, // got a '/'
  160. URL_TOKEN_MAX
  161. } URL_STATE_TOKEN;
  162. #if DBG
  163. PCSTR
  164. HttppUrlActionToString(
  165. URL_ACTION Action);
  166. PCSTR
  167. HttppUrlStateToString(
  168. URL_STATE UrlState);
  169. PCSTR
  170. HttppUrlTokenToString(
  171. URL_STATE_TOKEN UrlToken);
  172. #endif // DBG
  173. #endif // _C14NP_H_