<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <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.5 on Thu Oct 4 15:32:58 2001 --> <center> <a class="qindex" href="index.html">Main Page</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="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>url.h</h1><a href="url_h.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_SOCKET_H__</font> 00045 <font class="preprocessor"></font><font class="preprocessor">#include <cc++/<a class="code" href="socket_h.html">socket.h</a>></font> 00046 <font class="preprocessor">#endif</font> 00047 <font class="preprocessor"></font> <a name="l00048"></a><a class="code" href="url_h.html#a26">00048</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00049 { 00050 URL_SUCCESS = 0, 00051 URL_UNREACHABLE, 00052 URL_MISSING, 00053 URL_DENIED, 00054 URL_INVALID, 00055 URL_FORBIDDEN, 00056 URL_UNAUTHORIZED, 00057 URL_RELOCATED, 00058 URL_FAILURE, 00059 URL_TIMEOUT 00060 } urlerror_t; 00061 <a name="l00062"></a><a class="code" href="url_h.html#a27">00062</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00063 { 00064 URL_ANONYMOUS_AUTH = 0, 00065 URL_BASIC_AUTH 00066 } urlauth_t; 00067 <a name="l00068"></a><a class="code" href="url_h.html#a28">00068</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00069 { 00070 URL_BINARY_ENCODING = 0, 00071 URL_CHUNKED_ENCODING 00072 } urlencoding_t; 00073 <a name="l00074"></a><a class="code" href="url_h.html#a29">00074</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00075 { 00076 HTTP_GET_METHOD, 00077 HTTP_PUT_METHOD, 00078 HTTP_POST_METHOD, 00079 FTP_GET_METHOD, 00080 FTP_PUT_METHOD, 00081 FILE_GET_METHOD, 00082 FILE_PUT_METHOD 00083 } urlmethod_t; 00084 <a name="l00085"></a><a class="code" href="url_h.html#a30">00085</a> <font class="keyword">typedef</font> <font class="keyword">enum</font> 00086 { 00087 HTTP_PROTOCOL_1_0, 00088 HTTP_PROTOCOL_1_1 00089 } urlprotocol_t; 00090 <a name="l00091"></a><a class="code" href="url_h.html#a0">00091</a> <font class="keyword">class </font>__EXPORT <a class="code" href="class_urlstream.html">URLStream</a>; 00092 <a name="l00099"></a><a class="code" href="class_urlstream.html">00099</a> <font class="keyword">class </font><a class="code" href="class_urlstream.html">URLStream</a> : <font class="keyword">public</font> <a class="code" href="class_tcpstream.html">TCPStream</a> 00100 { 00101 <font class="keyword">private</font>: 00102 <font class="keyword">const</font> <font class="keywordtype">char</font> *agent, *referer, *cookie, *pragma, *user, *password; 00103 <a class="code" href="class_inethostaddress.html">InetHostAddress</a> proxyHost, prevHost; 00104 tpport_t proxyPort, prevPort; 00105 <a class="code" href="class_inethostaddress.html">InetHostAddress</a> refhost; 00106 urlmethod_t urlmethod; 00107 urlencoding_t encoding; 00108 urlprotocol_t protocol; 00109 urlauth_t auth; 00110 timeout_t timeout; 00111 <font class="keywordtype">bool</font> persistent; 00112 <font class="keywordtype">bool</font> follow; 00113 <font class="keywordtype">unsigned</font> chunk; 00114 <font class="keywordtype">char</font> authbuf[128]; 00115 00116 urlerror_t getHTTPHeaders(<font class="keywordtype">char</font> *buffer, <font class="keywordtype">unsigned</font> bufsize); 00117 00118 <font class="keyword">protected</font>: 00119 urlerror_t <a class="code" href="class_urlstream.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); 00120 <font class="keywordtype">int</font> <a class="code" href="class_tcpstream.html#b3">underflow</a>(<font class="keywordtype">void</font>); 00121 <a name="l00128"></a><a class="code" href="class_urlstream.html#b2">00128</a> <font class="keyword">virtual</font> <font class="keywordtype">void</font> <a class="code" href="class_urlstream.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> 00129 <font class="keyword"> </font>{<font class="keywordflow">return</font>;}; 00130 00131 <font class="keyword">public</font>: 00135 <a class="code" href="url_h.html#a0">URLStream</a>(); 00136 00144 <a class="code" href="class_urlstream.html">URLStream</a> &<a class="code" href="class_urlstream.html#a1">getline</a>(<font class="keywordtype">char</font> *buffer, size_t len); 00145 00153 urlerror_t <a class="code" href="class_urlstream.html#a2">Get</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *path, <font class="keywordtype">int</font> buffer = 512); 00154 00164 urlerror_t <a class="code" href="class_urlstream.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); 00165 00174 urlerror_t <a class="code" href="class_urlstream.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); 00175 00183 urlerror_t <a class="code" href="class_urlstream.html#a5">Head</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *path, <font class="keywordtype">int</font> buffer = 512); 00184 00188 <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a6">Close</a>(); 00189 00195 <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a7">setReferer</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str); 00196 <a name="l00202"></a><a class="code" href="class_urlstream.html#a8">00202</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a8">setCookie</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str)<font class="keyword"></font> 00203 <font class="keyword"> </font>{cookie = str;}; 00204 <a name="l00210"></a><a class="code" href="class_urlstream.html#a9">00210</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a9">setUser</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str)<font class="keyword"></font> 00211 <font class="keyword"> </font>{user = str;}; 00212 <a name="l00218"></a><a class="code" href="class_urlstream.html#a10">00218</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a10">setPassword</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str)<font class="keyword"></font> 00219 <font class="keyword"> </font>{password = str;}; 00220 00226 <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a11">setAuthentication</a>(urlauth_t a, <font class="keyword">const</font> <font class="keywordtype">char</font> *str = NULL); 00227 <a name="l00233"></a><a class="code" href="class_urlstream.html#a12">00233</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a12">setPragma</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str)<font class="keyword"></font> 00234 <font class="keyword"> </font>{pragma = str;}; 00235 00242 <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a13">setProxy</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *host, tpport_t port); 00243 <a name="l00249"></a><a class="code" href="class_urlstream.html#a14">00249</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a14">setAgent</a>(<font class="keyword">const</font> <font class="keywordtype">char</font> *str)<font class="keyword"></font> 00250 <font class="keyword"> </font>{agent = str;}; 00251 <a name="l00257"></a><a class="code" href="class_urlstream.html#a15">00257</a> <font class="keyword">inline</font> urlmethod_t <a class="code" href="class_urlstream.html#a15">getMethod</a>(<font class="keywordtype">void</font>)<font class="keyword"></font> 00258 <font class="keyword"> </font>{<font class="keywordflow">return</font> urlmethod;}; 00259 <a name="l00266"></a><a class="code" href="class_urlstream.html#a16">00266</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="class_tcpstream.html#a2">setTimeout</a>(timeout_t to)<font class="keyword"></font> 00267 <font class="keyword"> </font>{timeout = to;}; 00268 <a name="l00275"></a><a class="code" href="class_urlstream.html#a17">00275</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a17">setFollow</a>(<font class="keywordtype">bool</font> enable)<font class="keyword"></font> 00276 <font class="keyword"> </font>{follow = enable;}; 00277 <a name="l00283"></a><a class="code" href="class_urlstream.html#a18">00283</a> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="class_urlstream.html#a18">setProtocol</a>(urlprotocol_t pro)<font class="keyword"></font> 00284 <font class="keyword"> </font>{protocol = pro;}; 00285 }; 00286 00287 <font class="keyword">extern</font> __EXPORT <font class="keywordtype">char</font> *<a class="code" href="url_h.html#a24">urldecode</a>(<font class="keywordtype">char</font> *source, <font class="keywordtype">char</font> *dest = NULL); 00288 <font class="keyword">extern</font> __EXPORT <font class="keywordtype">char</font> *<a class="code" href="url_h.html#a25">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); 00289 00290 <font class="preprocessor">#ifdef __CCXX_NAMESPACE_H__</font> 00291 <font class="preprocessor"></font><font class="preprocessor">#undef __CCXX_NAMESPACE_H__</font> 00292 <font class="preprocessor"></font><font class="preprocessor">#include <cc++/<a class="code" href="namespace_h.html">namespace.h</a>></font> 00293 <font class="preprocessor">#endif</font> 00294 <font class="preprocessor"></font> 00295 <font class="preprocessor">#endif</font> 00296 <font class="preprocessor"></font> </div></pre><hr><address><small>Generated at Thu Oct 4 15:32:58 2001 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.5 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>