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.

212 lines
4.1 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. parseurl.h
  5. Abstract:
  6. Header for parseurl.c and protocol-specific parsers
  7. Author:
  8. Richard L Firth (rfirth) 26-Apr-1995
  9. Revision History:
  10. 26-Apr-1995
  11. Created
  12. --*/
  13. #if defined(__cplusplus)
  14. extern "C" {
  15. #endif
  16. //
  17. // manifests
  18. //
  19. #define SAFE 0x00 // character is safe in all schemes
  20. #define SCHEME_FTP 0x01 // character is unsafe in FTP scheme
  21. #define SCHEME_GOPHER 0x02 // character is unsafe in gopher scheme
  22. #define SCHEME_HTTP 0x04 // character is unsafe in HTTP scheme
  23. #define UNSAFE 0x80 // character is unsafe in all schemes
  24. #define HOSTNAME 0x08
  25. #define SCHEME_ANY (SCHEME_FTP | SCHEME_GOPHER | SCHEME_HTTP)
  26. //
  27. // types
  28. //
  29. typedef
  30. DWORD
  31. (*LPFN_URL_PARSER)(
  32. LPHINTERNET,
  33. LPSTR,
  34. DWORD,
  35. LPSTR,
  36. DWORD,
  37. DWORD,
  38. DWORD_PTR
  39. );
  40. //
  41. // prototypes
  42. //
  43. BOOL
  44. IsValidUrl(
  45. IN LPCSTR lpszUrl
  46. );
  47. BOOL
  48. DoesSchemeRequireSlashes(
  49. IN LPSTR lpszScheme,
  50. IN DWORD dwSchemeLength,
  51. IN BOOL bHasHostName
  52. );
  53. DWORD
  54. ParseUrl(
  55. IN OUT LPHINTERNET hInternet,
  56. IN LPVOID hMapped,
  57. IN LPCSTR Url,
  58. IN LPCSTR Headers,
  59. IN DWORD HeadersLength,
  60. IN DWORD OpenFlags,
  61. IN DWORD_PTR Context
  62. );
  63. DWORD
  64. CrackUrl(
  65. IN OUT LPSTR lpszUrl,
  66. IN DWORD dwUrlLength,
  67. IN BOOL bEscape,
  68. OUT LPINTERNET_SCHEME lpSchemeType OPTIONAL,
  69. OUT LPSTR* lpszSchemeName OPTIONAL,
  70. OUT LPDWORD lpdwSchemeNameLength OPTIONAL,
  71. OUT LPSTR* lpszHostName OPTIONAL,
  72. OUT LPDWORD lpdwHostNameLength OPTIONAL,
  73. OUT LPINTERNET_PORT lpServerPort OPTIONAL,
  74. OUT LPSTR* lpszUserName OPTIONAL,
  75. OUT LPDWORD lpdwUserNameLength OPTIONAL,
  76. OUT LPSTR* lpszPassword OPTIONAL,
  77. OUT LPDWORD lpdwPasswordLength OPTIONAL,
  78. OUT LPSTR* UrlPath OPTIONAL,
  79. OUT LPDWORD lpdwUrlPathLength OPTIONAL,
  80. OUT LPSTR* lpszExtraInfo OPTIONAL,
  81. OUT LPDWORD lpdwExtraInfoLength OPTIONAL,
  82. OUT LPBOOL pHavePort
  83. );
  84. DWORD
  85. EncodeUrlPath(
  86. IN DWORD Flags,
  87. IN DWORD SchemeFlags,
  88. IN LPSTR UrlPath,
  89. IN DWORD UrlPathLength,
  90. OUT LPSTR* EncodedUrlPath,
  91. IN OUT LPDWORD EncodedUrlPathLength
  92. );
  93. class MEMORYPACKET;
  94. DWORD
  95. ConvertUnicodeToMultiByte(
  96. IN LPCWSTR lpszObjectName,
  97. IN DWORD dwCodePage,
  98. OUT MEMORYPACKET* pmpObjectName,
  99. IN DWORD dwFlags);
  100. //
  101. // flags for EncodeUrlPath
  102. //
  103. #define NO_ENCODE_PATH_SEP 0x00000001
  104. DWORD
  105. DecodeUrl(
  106. IN LPSTR Url,
  107. IN DWORD UrlLength,
  108. OUT LPSTR UnescapedString,
  109. IN OUT LPDWORD UnescapedLength
  110. );
  111. DWORD
  112. DecodeUrlInSitu(
  113. IN LPSTR BufferAddress,
  114. IN OUT LPDWORD BufferLength
  115. );
  116. DWORD
  117. DecodeUrlStringInSitu(
  118. IN LPSTR BufferAddress,
  119. IN OUT LPDWORD BufferLength
  120. );
  121. DWORD
  122. GetUrlAddressInfo(
  123. IN OUT LPSTR* Url,
  124. IN OUT LPDWORD UrlLength,
  125. OUT LPSTR* PartOne,
  126. OUT LPDWORD PartOneLength,
  127. OUT LPBOOL PartOneEscape,
  128. OUT LPSTR* PartTwo,
  129. OUT LPDWORD PartTwoLength,
  130. OUT LPBOOL PartTwoEscape
  131. );
  132. DWORD
  133. GetUrlAddress(
  134. IN OUT LPSTR* lpszUrl,
  135. OUT LPDWORD lpdwUrlLength,
  136. OUT LPSTR* lpszUserName OPTIONAL,
  137. OUT LPDWORD lpdwUserNameLength OPTIONAL,
  138. OUT LPSTR* lpszPassword OPTIONAL,
  139. OUT LPDWORD lpdwPasswordLength OPTIONAL,
  140. OUT LPSTR* lpszHostName OPTIONAL,
  141. OUT LPDWORD lpdwHostNameLength OPTIONAL,
  142. OUT INTERNET_PORT* lpPort OPTIONAL,
  143. OUT LPBOOL pHavePort
  144. );
  145. INTERNET_SCHEME
  146. MapUrlSchemeName(
  147. IN LPSTR lpszSchemeName,
  148. IN DWORD dwSchemeNameLength
  149. );
  150. LPSTR
  151. MapUrlScheme(
  152. IN INTERNET_SCHEME Scheme,
  153. OUT LPDWORD lpdwSchemeNameLength
  154. );
  155. LPSTR
  156. MapUrlSchemeToName(
  157. IN INTERNET_SCHEME Scheme
  158. );
  159. //
  160. // protocol-specific URL parsers
  161. //
  162. DWORD
  163. ParseHttpUrl(
  164. IN OUT LPHINTERNET hInternet,
  165. IN LPSTR Url,
  166. IN DWORD SchemeLength,
  167. IN LPSTR Headers,
  168. IN DWORD HeadersLength,
  169. IN DWORD OpenFlags,
  170. IN DWORD_PTR Context
  171. );
  172. #if defined(__cplusplus)
  173. }
  174. #endif