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.

239 lines
4.6 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 SCHEME_ANY (SCHEME_FTP | SCHEME_GOPHER | SCHEME_HTTP)
  25. //
  26. // types
  27. //
  28. typedef
  29. DWORD
  30. (*LPFN_URL_PARSER)(
  31. LPHINTERNET,
  32. LPSTR,
  33. DWORD,
  34. LPSTR,
  35. DWORD,
  36. DWORD,
  37. DWORD_PTR
  38. );
  39. //
  40. // prototypes
  41. //
  42. BOOL
  43. IsValidUrl(
  44. IN LPCSTR lpszUrl
  45. );
  46. BOOL
  47. DoesSchemeRequireSlashes(
  48. IN LPSTR lpszScheme,
  49. IN DWORD dwSchemeLength,
  50. IN BOOL bHasHostName
  51. );
  52. DWORD
  53. ParseUrl(
  54. IN OUT LPHINTERNET hInternet,
  55. IN LPVOID hMapped,
  56. IN LPCSTR Url,
  57. IN LPCSTR Headers,
  58. IN DWORD HeadersLength,
  59. IN DWORD OpenFlags,
  60. IN DWORD_PTR Context
  61. );
  62. DWORD
  63. CrackUrl(
  64. IN OUT LPSTR lpszUrl,
  65. IN DWORD dwUrlLength,
  66. IN BOOL bEscape,
  67. OUT LPINTERNET_SCHEME lpSchemeType OPTIONAL,
  68. OUT LPSTR* lpszSchemeName OPTIONAL,
  69. OUT LPDWORD lpdwSchemeNameLength OPTIONAL,
  70. OUT LPSTR* lpszHostName OPTIONAL,
  71. OUT LPDWORD lpdwHostNameLength OPTIONAL,
  72. OUT LPINTERNET_PORT lpServerPort OPTIONAL,
  73. OUT LPSTR* lpszUserName OPTIONAL,
  74. OUT LPDWORD lpdwUserNameLength OPTIONAL,
  75. OUT LPSTR* lpszPassword OPTIONAL,
  76. OUT LPDWORD lpdwPasswordLength OPTIONAL,
  77. OUT LPSTR* UrlPath OPTIONAL,
  78. OUT LPDWORD lpdwUrlPathLength OPTIONAL,
  79. OUT LPSTR* lpszExtraInfo OPTIONAL,
  80. OUT LPDWORD lpdwExtraInfoLength OPTIONAL,
  81. OUT LPBOOL pHavePort
  82. );
  83. DWORD
  84. EncodeAuthorityComponent(
  85. IN LPSTR Component,
  86. IN DWORD ComponentLength,
  87. OUT LPSTR EncodedComponent,
  88. IN OUT LPDWORD EncodedComponentLength
  89. );
  90. DWORD
  91. EncodeUrlPath(
  92. IN DWORD Flags,
  93. IN DWORD SchemeFlags,
  94. IN LPSTR UrlPath,
  95. IN DWORD UrlPathLength,
  96. OUT LPSTR EncodedUrlPath,
  97. IN OUT LPDWORD EncodedUrlPathLength
  98. );
  99. //
  100. // flags for EncodeUrlPath
  101. //
  102. #define NO_ENCODE_PATH_SEP 0x00000001
  103. DWORD
  104. DecodeUrl(
  105. IN LPSTR Url,
  106. IN DWORD UrlLength,
  107. OUT LPSTR UnescapedString,
  108. IN OUT LPDWORD UnescapedLength
  109. );
  110. DWORD
  111. DecodeUrlInSitu(
  112. IN LPSTR BufferAddress,
  113. IN OUT LPDWORD BufferLength
  114. );
  115. DWORD
  116. DecodeUrlStringInSitu(
  117. IN LPSTR BufferAddress,
  118. IN OUT LPDWORD BufferLength
  119. );
  120. DWORD
  121. GetUrlAddressInfo(
  122. IN OUT LPSTR* Url,
  123. IN OUT LPDWORD UrlLength,
  124. OUT LPSTR* PartOne,
  125. OUT LPDWORD PartOneLength,
  126. OUT LPBOOL PartOneEscape,
  127. OUT LPSTR* PartTwo,
  128. OUT LPDWORD PartTwoLength,
  129. OUT LPBOOL PartTwoEscape
  130. );
  131. DWORD
  132. GetUrlAddress(
  133. IN OUT LPSTR* lpszUrl,
  134. OUT LPDWORD lpdwUrlLength,
  135. OUT LPSTR* lpszUserName OPTIONAL,
  136. OUT LPDWORD lpdwUserNameLength OPTIONAL,
  137. OUT LPSTR* lpszPassword OPTIONAL,
  138. OUT LPDWORD lpdwPasswordLength OPTIONAL,
  139. OUT LPSTR* lpszHostName OPTIONAL,
  140. OUT LPDWORD lpdwHostNameLength OPTIONAL,
  141. OUT INTERNET_PORT* lpPort OPTIONAL,
  142. OUT LPBOOL pHavePort
  143. );
  144. INTERNET_SCHEME
  145. MapUrlSchemeName(
  146. IN LPSTR lpszSchemeName,
  147. IN DWORD dwSchemeNameLength
  148. );
  149. LPSTR
  150. MapUrlScheme(
  151. IN INTERNET_SCHEME Scheme,
  152. OUT LPDWORD lpdwSchemeNameLength
  153. );
  154. LPSTR
  155. MapUrlSchemeToName(
  156. IN INTERNET_SCHEME Scheme
  157. );
  158. //
  159. // protocol-specific URL parsers
  160. //
  161. DWORD
  162. ParseFtpUrl(
  163. IN OUT LPHINTERNET hInternet,
  164. IN LPSTR Url,
  165. IN DWORD SchemeLength,
  166. IN LPSTR Headers,
  167. IN DWORD HeadersLength,
  168. IN DWORD OpenFlags,
  169. IN DWORD_PTR Context
  170. );
  171. DWORD
  172. ParseGopherUrl(
  173. IN OUT LPHINTERNET hInternet,
  174. IN LPSTR Url,
  175. IN DWORD SchemeLength,
  176. IN LPSTR Headers,
  177. IN DWORD HeadersLength,
  178. IN DWORD OpenFlags,
  179. IN DWORD_PTR Context
  180. );
  181. DWORD
  182. GopherLocatorToUrl(
  183. IN LPSTR Locator,
  184. OUT LPSTR Buffer,
  185. IN DWORD BufferLength,
  186. OUT LPDWORD UrlLength
  187. );
  188. DWORD
  189. ParseHttpUrl(
  190. IN OUT LPHINTERNET hInternet,
  191. IN LPSTR Url,
  192. IN DWORD SchemeLength,
  193. IN LPSTR Headers,
  194. IN DWORD HeadersLength,
  195. IN DWORD OpenFlags,
  196. IN DWORD_PTR Context
  197. );
  198. #if defined(__cplusplus)
  199. }
  200. #endif