home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / WEBSERVE / PI3 / PI3WEB.EXE / DEVEL / INCLUDE / HTTPUtil.h < prev    next >
C/C++ Source or Header  |  1997-10-19  |  10KB  |  360 lines

  1. /*____________________________________________________________________________*\
  2.  *
  3.  
  4.  Copyright (c) 1997 John Roy. All rights reserved.
  5.  
  6.  These sources, libraries and applications are
  7.  FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
  8.  as long as the following conditions are adhered to.
  9.  
  10.  Redistribution and use in source and binary forms, with or without
  11.  modification, are permitted provided that the following conditions
  12.  are met:
  13.  
  14.  1. Redistributions of source code must retain the above copyright
  15.     notice, this list of conditions and the following disclaimer. 
  16.  
  17.  2. Redistributions in binary form must reproduce the above copyright
  18.     notice, this list of conditions and the following disclaimer in
  19.     the documentation and/or other materials provided with the
  20.     distribution.
  21.  
  22.  3. Redistributions of any form whatsoever and all advertising materials 
  23.     mentioning features must contain the following
  24.     acknowledgment:
  25.     "This product includes software developed by John Roy
  26.     (http://www.johnroy.com/pi3/)."
  27.  
  28.  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  29.  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30.  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  31.  IN NO EVENT SHALL THE AUTHORS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  32.  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33.  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34.  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35.  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  36.  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  37.  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  38.  OF THE POSSIBILITY OF SUCH DAMAGE.
  39.  
  40.  *____________________________________________________________________________*|
  41.  *
  42.  * $Source: HTTPUtil.h$
  43.  * $Date: Sun Aug 10 06:36:31 1997$
  44.  *
  45.  Description:
  46.     HTTP utilities which require no context other than thier parameters.
  47.  
  48. \*____________________________________________________________________________*/
  49. /* $SourceTop:$ */
  50.  
  51. #ifndef HTTPUTIL_H_
  52. #define HTTPUTIL_H_
  53.  
  54. #include <time.h>
  55.  
  56. #include "Pi3API.h"
  57.  
  58. /*____________________________________________________________________________*\
  59.  *
  60.  Name:
  61.     HTTPUtil_contractPath
  62.  
  63.  Synopsis:
  64.     int HTTPUtil_contractPath( char *pPath )
  65.  
  66.  Description:
  67.     Contract the directory path <B>pPath</B> in place by removing directories
  68.     with the name '..'. 
  69.  
  70.  Notes:
  71.  Return Values:
  72.     Returns the number of directories above the root pPath which should be
  73.     discarded. Typically a value of 0 is the desired result.
  74.  
  75.  Errors:
  76.  See Also:
  77. \*____________________________________________________________________________*/
  78. PUBLIC_PIAPI int HTTPUtil_contractPath( char *pPath );
  79.  
  80. /*____________________________________________________________________________*\
  81.  *
  82.  Name:
  83.     HTTPUtil_rFC822Time
  84.  
  85.  Synopsis:
  86.     int HTTPUtil_rFC822Time( struct tm *pT, Pi3String *pResult )
  87.  
  88.  Description:
  89.     This function is not yet documented.
  90.  
  91.  Notes:
  92.  Return Values:
  93.  Errors:
  94.  See Also:
  95. \*____________________________________________________________________________*/
  96. PUBLIC_PIAPI int HTTPUtil_rFC822Time( struct tm *pT, Pi3String *pResult );
  97.  
  98. /*____________________________________________________________________________*\
  99.  *
  100.  Name:
  101.     HTTPUtil_rcNumberToName
  102.  
  103.  Synopsis:
  104.     const char *HTTPUtil_rcNumberToName( int iRC )
  105.  
  106.  Description:
  107.     This function is not yet documented.
  108.  
  109.  Notes:
  110.  Return Values:
  111.  Errors:
  112.  See Also:
  113. \*____________________________________________________________________________*/
  114. PUBLIC_PIAPI const char *HTTPUtil_rcNumberToName( int iRC );
  115.  
  116. /*____________________________________________________________________________*\
  117.  *
  118.  Name:
  119.     HTTPUtil_rcNameToNumber
  120.  
  121.  Synopsis:
  122.     int HTTPUtil_rcNameToNumber( const char *pName )
  123.  
  124.  Description:
  125.     This function is not yet documented.
  126.  
  127.  Notes:
  128.  Return Values:
  129.  Errors:
  130.  See Also:
  131. \*____________________________________________________________________________*/
  132. PUBLIC_PIAPI int HTTPUtil_rcNameToNumber( const char *pName );
  133.  
  134. /*____________________________________________________________________________*\
  135.  *
  136.  Name:
  137.     HTTPUtil_phaseNumberToName
  138.  
  139.  Synopsis:
  140.     const char *HTTPUtil_phaseNumberToName( int iPhaseNumber )
  141.  
  142.  Description:
  143.     This function is not yet documented.
  144.  
  145.  Notes:
  146.  Return Values:
  147.  Errors:
  148.  See Also:
  149. \*____________________________________________________________________________*/
  150. PUBLIC_PIAPI const char *HTTPUtil_phaseNumberToName( int iPhaseNumber );
  151.  
  152. /*____________________________________________________________________________*\
  153.  *
  154.  Name:
  155.     HTTPUtil_phaseNameToNumber
  156.  
  157.  Synopsis:
  158.     int HTTPUtil_phaseNameToNumber( const char *pPhaseName )
  159.  
  160.  Description:
  161.     This function is not yet documented.
  162.  
  163.  Notes:
  164.  Return Values:
  165.  Errors:
  166.  See Also:
  167. \*____________________________________________________________________________*/
  168. PUBLIC_PIAPI int HTTPUtil_phaseNameToNumber( const char *pPhaseName );
  169.  
  170. /*____________________________________________________________________________*\
  171.  *
  172.  Name:
  173.     HTTPUtil_getHostName
  174.  
  175.  Synopsis:
  176.     const char *HTTPUtil_getHostName( PIHTTP *pPIHTTP )
  177.  
  178.  Description:
  179.     This function is not yet documented.
  180.  
  181.  Notes:
  182.  Return Values:
  183.  Errors:
  184.  See Also:
  185. \*____________________________________________________________________________*/
  186. PUBLIC_PIAPI const char *HTTPUtil_getHostName( PIHTTP *pPIHTTP );    
  187.  
  188. /*____________________________________________________________________________*\
  189.  *
  190.  Name:
  191.     HTTPUtil_getHostPort
  192.  
  193.  Synopsis:
  194.     const char *HTTPUtil_getHostPort( PIHTTP *pPIHTTP )
  195.  
  196.  Description:
  197.     This function is not yet documented.
  198.  
  199.  Notes:
  200.  Return Values:
  201.  Errors:
  202.  See Also:
  203. \*____________________________________________________________________________*/
  204. PUBLIC_PIAPI const char *HTTPUtil_getHostPort( PIHTTP *pPIHTTP );
  205.  
  206. /*____________________________________________________________________________*\
  207.  *
  208.  Name:
  209.     HTTPUtil_protocolNumberToName
  210.  
  211.  Synopsis:
  212.     const char *HTTPUtil_protocolNumberToName( int iProtocol )
  213.  
  214.  Description:
  215.     This function is not yet documented.
  216.  
  217.  Notes:
  218.  Return Values:
  219.  Errors:
  220.  See Also:
  221. \*____________________________________________________________________________*/
  222. PUBLIC_PIAPI const char *HTTPUtil_protocolNumberToName( int iProtocol );
  223.  
  224. /*____________________________________________________________________________*\
  225.  *
  226.  Name:
  227.     HTTPUtil_readTime
  228.  
  229.  Synopsis:
  230.     HTTPUtil_readTime( const char *pLine, struct tm *pT )
  231.  
  232.  Description:
  233.     This function is not yet documented.
  234.  
  235.  Notes:
  236.  Return Values:
  237.  Errors:
  238.  See Also:
  239. \*____________________________________________________________________________*/
  240. PUBLIC_PIAPI int HTTPUtil_readTime( const char *pLine, struct tm *pT );
  241.  
  242. /*____________________________________________________________________________*\
  243.  *
  244.  Name:
  245.     HTTPUtil_regexMatch
  246.  
  247.  Synopsis:
  248.     HTTPUtil_regexMatch( const char *pRegex, int iRegex, const char *pString,
  249.         int iStringLen )
  250.  
  251.  Description:
  252.     This function is not yet documented.
  253.  
  254.  Notes:
  255.  Return Values:
  256.  Errors:
  257.  See Also:
  258. \*____________________________________________________________________________*/
  259. PUBLIC_PIAPI int HTTPUtil_regexMatch( const char *pRegex, int iRegex,
  260.         const char *pString, int iStringLen );
  261.  
  262. /*____________________________________________________________________________*\
  263.  *
  264.  Name:
  265.     HTTPUtil_regexMatchPi3String
  266.  
  267.  Synopsis:
  268.     HTTPUtil_regexMatchPi3String( const Pi3String *pRegexPattern,
  269.         const Pi3String *pString )
  270.  
  271.  Description:
  272.     This function is not yet documented.
  273.  
  274.  Notes:
  275.  Return Values:
  276.  Errors:
  277.  See Also:
  278. \*____________________________________________________________________________*/
  279. PUBLIC_PIAPI int HTTPUtil_regexMatchPi3String( const Pi3String *pRegexPattern,
  280.         const Pi3String *pString ); 
  281.  
  282. /*____________________________________________________________________________*\
  283.  *
  284.  Name:
  285.     HTTPUtil_urlEncode
  286.  
  287.  Synopsis:
  288.     HTTPUtil_urlEncode( const Pi3String *pToEncode, Pi3String *pResult )
  289.  
  290.  Description:
  291.     This function is not yet documented.
  292.  
  293.  Notes:
  294.  Return Values:
  295.  Errors:
  296.  See Also:
  297. \*____________________________________________________________________________*/
  298. PUBLIC_PIAPI void HTTPUtil_urlEncode( const Pi3String *pToEncode,
  299.         Pi3String *pResult );
  300.  
  301. /*____________________________________________________________________________*\
  302.  *
  303.  Name:
  304.     HTTPUtil_urlDecode
  305.  
  306.  Synopsis:
  307.     HTTPUtil_urlDecode( const Pi3String *pToDecode, Pi3String *pResult )
  308.  
  309.  Description:
  310.     This function is not yet documented.
  311.  
  312.  Notes:
  313.  Return Values:
  314.  Errors:
  315.  See Also:
  316. \*____________________________________________________________________________*/
  317. PUBLIC_PIAPI void HTTPUtil_urlDecode( const Pi3String *pToDecode,
  318.         Pi3String *pResult );
  319.  
  320. /*____________________________________________________________________________*\
  321.  *
  322.  Name:
  323.     HTTPUtil_doHTTPError
  324.  
  325.  Synopsis:
  326.     HTTPUtil_doHTTPError( PIHTTP *pPIHTTP, int iError )
  327.  
  328.  Description:
  329.     This function is not yet documented.
  330.  
  331.  Notes:
  332.  Return Values:
  333.  Errors:
  334.  See Also:
  335. \*____________________________________________________________________________*/
  336. PUBLIC_PIAPI int HTTPUtil_doHTTPError( PIHTTP *pPIHTTP, int iError );
  337.  
  338. /*____________________________________________________________________________*\
  339.  *
  340.  Name:
  341.     HTTPUtil_sendFile
  342.  
  343.  Synopsis:
  344.     HTTPUtil_sendFile( PIIOBuffer *pBuffer, PIFInfo *pFInfo,
  345.         int iBufferingFlags, int iSendFlags )
  346.  
  347.  Description:
  348.     This function is not yet documented.
  349.  
  350.  Notes:
  351.  Return Values:
  352.  Errors:
  353.  See Also:
  354. \*____________________________________________________________________________*/
  355. PUBLIC_PIAPI int HTTPUtil_sendFile( PIIOBuffer *pBuffer, PIFInfo *pFInfo,
  356.         int iBufferingFlags, int iSendFlags );
  357.  
  358. #endif /* HTTPUTIL_H_ */
  359.  
  360.