<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>url.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.10 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>url.h</h1><a href="url_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">// Copyright (C) 2001 Open Source Telecom Corporation.</font> 00002 <font class="comment">// </font> 00003 <font class="comment">// This program is free software; you can redistribute it and/or modify</font> 00004 <font class="comment">// it under the terms of the GNU General Public License as published by</font> 00005 <font class="comment">// the Free Software Foundation; either version 2 of the License, or</font> 00006 <font class="comment">// (at your option) any later version.</font> 00007 <font class="comment">// </font> 00008 <font class="comment">// This program is distributed in the hope that it will be useful,</font> 00009 <font class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00010 <font class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00011 <font class="comment">// GNU General Public License for more details.</font> 00012 <font class="comment">// </font> 00013 <font class="comment">// You should have received a copy of the GNU General Public License</font> 00014 <font class="comment">// along with this program; if not, write to the Free Software </font> 00015 <font class="comment">// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.</font> 00016 <font class="comment">// </font> 00017 <font class="comment">// As a special exception to the GNU General Public License, permission is </font> 00018 <font class="comment">// granted for additional uses of the text contained in its release </font> 00019 <font class="comment">// of Common C++.</font> 00020 <font class="comment">// </font> 00021 <font class="comment">// The exception is that, if you link the Common C++ library with other files</font> 00022 <font class="comment">// to produce an executable, this does not by itself cause the</font> 00023 <font class="comment">// resulting executable to be covered by the GNU General Public License.</font> 00024 <font class="comment">// Your use of that executable is in no way restricted on account of</font> 00025 <font class="comment">// linking the Common C++ library code into it.</font> 00026 <font class="comment">//</font> 00027 <font class="comment">// This exception does not however invalidate any other reasons why</font> 00028 <font class="comment">// the executable file might be covered by the GNU General Public License.</font> 00029 <font class="comment">//</font> 00030 <font class="comment">// This exception applies only to the code released under the </font> 00031 <font class="comment">// name Common C++. If you copy code from other releases into a copy of</font> 00032 <font class="comment">// Common C++, as the General Public License permits, the exception does</font> 00033 <font class="comment">// not apply to the code that you add in this way. To avoid misleading</font> 00034 <font class="comment">// anyone as to the status of such modified files, you must delete</font> 00035 <font class="comment">// this exception notice from them.</font> 00036 <font class="comment">// </font> 00037 <font class="comment">// If you write modifications of your own for Common C++, it is your choice</font> 00038 <font class="comment">// whether to permit this exception to apply to your modifications.</font> 00039 <font class="comment">// If you do not wish that, delete this exception notice. </font> 00040 00041 <font class="preprocessor">#ifndef CCXX_URL_H_</font> 00042 <font class="preprocessor"></font><font class="preprocessor">#define CCXX_URL_H_</font> 00043 <font class="preprocessor"></font> 00044 <font class="preprocessor">#ifndef CCXX_CONFIG_H_</font> 00045 <font class="preprocessor"></font><font class="preprocessor">#include <cc++/config.h></font> 00046 <font class="preprocessor">#endif</font> 00047 <font class="preprocessor"></font> 00048 <font class="preprocessor">#ifndef CCXX_SOCKET_H_</font> 00049 <font class="preprocessor"></font><font class="preprocessor">#include <<a class="code" href="socket_8h.html">cc++/socket.h</a>></font> 00050 <font class="preprocessor">#endif</font> 00051 <font class="preprocessor"></font> 00052 <font class="preprocessor">#ifdef CCXX_NAMESPACES</font> 00053 <font class="preprocessor"></font><font class="keyword">namespace </font>ost { 00054 <font class="preprocessor">#endif</font> 00055 <font class="preprocessor"></font> <a name="l00056"></a><a class="code" href="namespaceost.html#a256">00056</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00057 { 00058 URL_SUCCESS = 0, 00059 URL_UNREACHABLE, 00060 URL_MISSING, 00061 URL_DENIED, 00062 URL_INVALID, 00063 URL_FORBIDDEN, 00064 URL_UNAUTHORIZED, 00065 URL_RELOCATED, 00066 URL_FAILURE, 00067 URL_TIMEOUT 00068 } urlerror_t; 00069 <a name="l00070"></a><a class="code" href="namespaceost.html#a257">00070</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00071 { 00072 URL_ANONYMOUS_AUTH = 0, 00073 URL_BASIC_AUTH 00074 } urlauth_t; 00075 <a name="l00076"></a><a class="code" href="namespaceost.html#a258">00076</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00077 { 00078 URL_BINARY_ENCODING = 0, 00079 URL_CHUNKED_ENCODING 00080 } urlencoding_t; 00081 <a name="l00082"></a><a class="code" href="namespaceost.html#a259">00082</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00083 { 00084 HTTP_GET_METHOD, 00085 HTTP_PUT_METHOD, 00086 HTTP_POST_METHOD, 00087 FTP_GET_METHOD, 00088 FTP_PUT_METHOD, 00089 FILE_GET_METHOD, 00090 FILE_PUT_METHOD 00091 } urlmethod_t; 00092 <a name="l00093"></a><a class="code" href="namespaceost.html#a260">00093</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00094 { 00095 HTTP_PROTOCOL_1_0, 00096 HTTP_PROTOCOL_1_1 00097 } urlprotocol_t; 00098 00099 <font class="keyword">class </font>CCXX_CLASS_EXPORT URLStream; 00100 <a name="l00107"></a><a class="code" href="classost_1_1_u_r_l_stream.html">00107</a> <font class="keyword">class </font>CCXX_CLASS_EXPORT URLStream : <font class="keyword">public</font> TCPStream 00108 { 00109 <font class="keyword">private</font>: 00110 <font class="keyword">const</font> <font class="keywordtype">char</font> *agent, *referer, *cookie, *pragma, *user, *password; 00111 InetHostAddress proxyHost, prevHost; 00112 tpport_t proxyPort, prevPort; 00113 InetHostAddress refhost; 00114 urlmethod_t urlmethod; 00115 urlencoding_t encoding; 00116 urlprotocol_t protocol; 00117 urlauth_t auth; 00118 timeout_t timeout; 00119 <font class="keywordtype">bool</font> persistent; 00120 <font class="keywordtype">bool</font> follow; 00121 <font class="keywordtype">unsigned</font> chunk; 00122 <font class="keywordtype">char</font> authbuf[128]; 00123 00124 urlerror_t getHTTPHeaders(<font class="keywordtype">char</font> *buffer, <font class="keywordtype">unsigned</font> bufsize); 00125 00126 <font class="keyword">protected</font>: 00127 urlerror_t <a class="code" href="classost_1_1_u_r_l_stream.html#b0">sendHTTPHeader</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *path, <font class="keyword">const</font> <font class="keywordtype">char</font> **vars, <font class="keywordtype">int</font> bufsize); 00128 <font class="keywordtype">int</font> <a class="code" href="classost_1_1_u_r_l_stream.html#b1">underflow</a>(<font class="keywordtype">void</font>); 00129 <a name="l00136"></a><a class="code" href="classost_1_1_u_r_l_stream.html#b2">00136</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#b2">httpHeader</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *header, <font class="keyword">const</font> <font class="keywordtype">char</font> *value)<font class="keyword"></font> 00137 <font class="keyword"> </font>{<font class="keywordflow">return</font>;}; 00138 <a name="l00144"></a><a class="code" href="classost_1_1_u_r_l_stream.html#b3">00144</a> <font class="keyword">virtual</font> <font class="keywordtype">char</font> **<a class="code" href="classost_1_1_u_r_l_stream.html#b3">extraHeader</a>(<font class="keywordtype">void</font>)<font class="keyword"></font> 00145 <font class="keyword"> </font>{<font class="keywordflow">return</font> NULL;}; 00146 00147 <font class="keyword">public</font>: 00151 <a class="code" href="classost_1_1_u_r_l_stream.html#a0">URLStream</a>(); 00152 00160 URLStream &<a class="code" href="classost_1_1_u_r_l_stream.html#a1">getline</a>(<font class="keywordtype">char</font> *buffer, size_t len); 00161 00169 urlerror_t <a class="code" href="classost_1_1_u_r_l_stream.html#a2">Get</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *path, <font class="keywordtype">int</font> buffer = 512); 00170 00180 urlerror_t <a class="code" href="classost_1_1_u_r_l_stream.html#a3">Submit</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *path, <font class="keyword">const</font> <font class="keywordtype">char</font> **vars, <font class="keywordtype">int</font> buffer = 512); 00181 00190 urlerror_t <a class="code" href="classost_1_1_u_r_l_stream.html#a4">Post</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *path, <font class="keyword">const</font> <font class="keywordtype">char</font> **vars, <font class="keywordtype">int</font> buffer = 512); 00191 00199 urlerror_t <a class="code" href="classost_1_1_u_r_l_stream.html#a5">Head</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *path, <font class="keywordtype">int</font> buffer = 512); 00200 00204 <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a6">Close</a>(); 00205 00211 <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a7">setReferer</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str); 00212 <a name="l00218"></a><a class="code" href="classost_1_1_u_r_l_stream.html#a8">00218</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a8">setCookie</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str)<font class="keyword"></font> 00219 <font class="keyword"> </font>{cookie = str;}; 00220 <a name="l00226"></a><a class="code" href="classost_1_1_u_r_l_stream.html#a9">00226</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a9">setUser</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str)<font class="keyword"></font> 00227 <font class="keyword"> </font>{user = str;}; 00228 <a name="l00234"></a><a class="code" href="classost_1_1_u_r_l_stream.html#a10">00234</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a10">setPassword</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str)<font class="keyword"></font> 00235 <font class="keyword"> </font>{password = str;}; 00236 00242 <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a11">setAuthentication</a>(urlauth_t a, <font class="keyword">const</font> <font class="keywordtype">char</font> *str = NULL); 00243 <a name="l00249"></a><a class="code" href="classost_1_1_u_r_l_stream.html#a12">00249</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a12">setPragma</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str)<font class="keyword"></font> 00250 <font class="keyword"> </font>{pragma = str;}; 00251 00258 <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a13">setProxy</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *host, tpport_t port); 00259 <a name="l00265"></a><a class="code" href="classost_1_1_u_r_l_stream.html#a14">00265</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a14">setAgent</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str)<font class="keyword"></font> 00266 <font class="keyword"> </font>{agent = str;}; 00267 <a name="l00273"></a><a class="code" href="classost_1_1_u_r_l_stream.html#a15">00273</a> <font class="keyword">inline</font> urlmethod_t <a class="code" href="classost_1_1_u_r_l_stream.html#a15">getMethod</a>(<font class="keywordtype">void</font>)<font class="keyword"></font> 00274 <font class="keyword"> </font>{<font class="keywordflow">return</font> urlmethod;}; 00275 <a name="l00282"></a><a class="code" href="classost_1_1_u_r_l_stream.html#a16">00282</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a16">setTimeout</a>(timeout_t to)<font class="keyword"></font> 00283 <font class="keyword"> </font>{timeout = to;}; 00284 <a name="l00291"></a><a class="code" href="classost_1_1_u_r_l_stream.html#a17">00291</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a17">setFollow</a>(<font class="keywordtype">bool</font> enable)<font class="keyword"></font> 00292 <font class="keyword"> </font>{follow = enable;}; 00293 <a name="l00299"></a><a class="code" href="classost_1_1_u_r_l_stream.html#a18">00299</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="classost_1_1_u_r_l_stream.html#a18">setProtocol</a>(urlprotocol_t pro)<font class="keyword"></font> 00300 <font class="keyword"> </font>{protocol = pro;}; 00301 }; 00302 00303 <font class="keyword">extern</font> CCXX_EXPORT(<font class="keywordtype">char</font>*) <a class="code" href="namespaceost.html#a231">urldecode</a>(<font class="keywordtype">char</font> *source, <font class="keywordtype">char</font> *dest = NULL); 00304 <font class="keyword">extern</font> CCXX_EXPORT(<font class="keywordtype">char</font>*) <a class="code" href="namespaceost.html#a232">urlencode</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *source, <font class="keywordtype">char</font> *dest, <font class="keywordtype">unsigned</font> size); 00305 <font class="keyword">extern</font> CCXX_EXPORT(<font class="keywordtype">char</font>*) <a class="code" href="namespaceost.html#a233">b64decode</a>(<font class="keywordtype">char</font> *source, <font class="keywordtype">char</font> *dest = NULL); 00306 <font class="keyword">extern</font> CCXX_EXPORT(<font class="keywordtype">char</font>*) <a class="code" href="namespaceost.html#a234">b64encode</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *source, <font class="keywordtype">char</font> *dest, <font class="keywordtype">unsigned</font> size); 00307 00308 <font class="preprocessor">#ifdef CCXX_NAMESPACES</font> 00309 <font class="preprocessor"></font>}; 00310 <font class="preprocessor">#endif</font> 00311 <font class="preprocessor"></font> 00312 <font class="preprocessor">#endif</font> 00313 <font class="preprocessor"></font> </pre></div><hr><address><small>Generated at Fri Jan 4 18:51:46 2002 for CommonC++ by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>