⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 socks_8h-source.html

📁 pwlib开发文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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>socks.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>socks.h</h1><a href="socks_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * socks.h</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * SOCKS protocol</span>00005 <span class="comment"> *</span>00006 <span class="comment"> * Portable Windows Library</span>00007 <span class="comment"> *</span>00008 <span class="comment"> * Copyright (c) 1993-2001 Equivalence Pty. Ltd.</span>00009 <span class="comment"> *</span>00010 <span class="comment"> * The contents of this file are subject to the Mozilla Public License</span>00011 <span class="comment"> * Version 1.0 (the "License"); you may not use this file except in</span>00012 <span class="comment"> * compliance with the License. You may obtain a copy of the License at</span>00013 <span class="comment"> * http://www.mozilla.org/MPL/</span>00014 <span class="comment"> *</span>00015 <span class="comment"> * Software distributed under the License is distributed on an "AS IS"</span>00016 <span class="comment"> * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See</span>00017 <span class="comment"> * the License for the specific language governing rights and limitations</span>00018 <span class="comment"> * under the License.</span>00019 <span class="comment"> *</span>00020 <span class="comment"> * The Original Code is Portable Windows Library.</span>00021 <span class="comment"> *</span>00022 <span class="comment"> * The Initial Developer of the Original Code is Equivalence Pty. Ltd.</span>00023 <span class="comment"> *</span>00024 <span class="comment"> * Contributor(s): ______________________________________.</span>00025 <span class="comment"> *</span>00026 <span class="comment"> * $Log: socks.h,v $</span>00027 <span class="comment"> * Revision 1.7  2002/11/06 22:47:24  robertj</span>00028 <span class="comment"> * Fixed header comment (copyright etc)</span>00029 <span class="comment"> *</span>00030 <span class="comment"> * Revision 1.6  2002/09/16 01:08:59  robertj</span>00031 <span class="comment"> * Added #define so can select if #pragma interface/implementation is used on</span>00032 <span class="comment"> *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.</span>00033 <span class="comment"> *</span>00034 <span class="comment"> * Revision 1.5  2002/08/05 05:40:45  robertj</span>00035 <span class="comment"> * Fixed missing pragma interface/implementation</span>00036 <span class="comment"> *</span>00037 <span class="comment"> * Revision 1.4  1999/05/01 03:52:20  robertj</span>00038 <span class="comment"> * Fixed various egcs warnings.</span>00039 <span class="comment"> *</span>00040 <span class="comment"> * Revision 1.3  1999/03/09 08:01:47  robertj</span>00041 <span class="comment"> * Changed comments for doc++ support (more to come).</span>00042 <span class="comment"> *</span>00043 <span class="comment"> * Revision 1.2  1998/12/23 00:33:05  robertj</span>00044 <span class="comment"> * UDP support</span>00045 <span class="comment"> *</span>00046 <span class="comment"> * Revision 1.1  1998/12/22 10:34:17  robertj</span>00047 <span class="comment"> * Initial revision</span>00048 <span class="comment"> *</span>00049 <span class="comment"> */</span>00050 00051 <span class="preprocessor">#ifndef _SOCKS_H</span>00052 <span class="preprocessor"></span><span class="preprocessor">#define _SOCKS_H</span>00053 <span class="preprocessor"></span>00054 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00055 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00056 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00057 <span class="preprocessor"></span>00058 00059 <span class="preprocessor">#include &lt;<a class="code" href="sockets_8h.html">ptlib/sockets.h</a>&gt;</span>00060 00061 <a name="l00067"></a><a class="code" href="classPSocksProtocol.html">00067</a> <span class="keyword">class </span><a class="code" href="classPSocksProtocol.html">PSocksProtocol</a>00068 {00069   <span class="keyword">public</span>:00070     <a class="code" href="classPSocksProtocol.html#a0">PSocksProtocol</a>(WORD port);<a name="l00071"></a><a class="code" href="classPSocksProtocol.html#a1">00071</a>     <span class="keyword">virtual</span> <a class="code" href="classPSocksProtocol.html#a1">~PSocksProtocol</a>() { }00072 00073   <span class="comment">// New functions for class</span>00074     <span class="keyword">enum</span> {00075       <a class="code" href="classPSocksProtocol.html#s1s0">DefaultServerPort</a> = 108000076     };00077     BOOL <a class="code" href="classPSocksProtocol.html#a2">SetServer</a>(00078       <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> &amp; hostname,00079       <span class="keyword">const</span> <span class="keywordtype">char</span> * service = <span class="stringliteral">"socks 1080"</span>00080     );00081     BOOL <a class="code" href="classPSocksProtocol.html#a2">SetServer</a>(00082       <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> &amp; hostname,00083       WORD port00084     );00085 00090     <span class="keywordtype">void</span> <a class="code" href="classPSocksProtocol.html#a4">SetAuthentication</a>(00091       <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> &amp; username,00092       <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> &amp; password00093     );00094 00095   <span class="keyword">protected</span>:00096     BOOL <a class="code" href="classPSocksProtocol.html#b0">ConnectSocksServer</a>(<a class="code" href="classPTCPSocket.html">PTCPSocket</a> &amp; thisSocket);00097 00098     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPSocksProtocol.html#b1">SetErrorCodes</a>(<a class="code" href="classPChannel.html#z55_0">PChannel::Errors</a> errCode, <span class="keywordtype">int</span> osErr) = 0;00099 00100     <span class="keyword">virtual</span> BOOL <a class="code" href="classPSocksProtocol.html#b2">SendSocksCommand</a>(<a class="code" href="classPTCPSocket.html">PTCPSocket</a> &amp; socket,00101                                   BYTE command,00102                                   <span class="keyword">const</span> <span class="keywordtype">char</span> * hostname,00103                                   <a class="code" href="classPIPSocket_1_1Address.html">PIPSocket::Address</a> addr);00104     <span class="keyword">virtual</span> BOOL <a class="code" href="classPSocksProtocol.html#b3">ReceiveSocksResponse</a>(<a class="code" href="classPTCPSocket.html">PTCPSocket</a> &amp; socket,00105                                       <a class="code" href="classPIPSocket_1_1Address.html">PIPSocket::Address</a> &amp; addr,00106                                       WORD &amp; port);00107 00108 <a name="l00109"></a><a class="code" href="classPSocksProtocol.html#n0">00109</a>     <a class="code" href="classPString.html">PString</a>            <a class="code" href="classPSocksProtocol.html#n0">serverHost</a>;<a name="l00110"></a><a class="code" href="classPSocksProtocol.html#n1">00110</a>     WORD               <a class="code" href="classPSocksProtocol.html#n1">serverPort</a>;<a name="l00111"></a><a class="code" href="classPSocksProtocol.html#n2">00111</a>     <a class="code" href="classPString.html">PString</a>            <a class="code" href="classPSocksProtocol.html#n2">authenticationUsername</a>;<a name="l00112"></a><a class="code" href="classPSocksProtocol.html#n3">00112</a>     <a class="code" href="classPString.html">PString</a>            <a class="code" href="classPSocksProtocol.html#n3">authenticationPassword</a>;<a name="l00113"></a><a class="code" href="classPSocksProtocol.html#n4">00113</a>     <a class="code" href="classPIPSocket_1_1Address.html">PIPSocket::Address</a> <a class="code" href="classPSocksProtocol.html#n4">remoteAddress</a>;<a name="l00114"></a><a class="code" href="classPSocksProtocol.html#n5">00114</a>     WORD               <a class="code" href="classPSocksProtocol.html#n5">remotePort</a>;<a name="l00115"></a><a class="code" href="classPSocksProtocol.html#n6">00115</a>     <a class="code" href="classPIPSocket_1_1Address.html">PIPSocket::Address</a> <a class="code" href="classPSocksProtocol.html#n6">localAddress</a>;<a name="l00116"></a><a class="code" href="classPSocksProtocol.html#n7">00116</a>     WORD               <a class="code" href="classPSocksProtocol.html#n7">localPort</a>;00117 };00118 00119 <a name="l00122"></a><a class="code" href="classPSocksSocket.html">00122</a> <span class="keyword">class </span><a class="code" href="classPSocksSocket.html">PSocksSocket</a> : <span class="keyword">public</span> <a class="code" href="classPTCPSocket.html">PTCPSocket</a>, <span class="keyword">public</span> <a class="code" href="classPSocksProtocol.html">PSocksProtocol</a>00123 {00124   <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPSocksSocket.html">PSocksSocket</a>, <a class="code" href="classPTCPSocket.html">PTCPSocket</a>)00125 00126   <span class="keyword">public</span>:00127     <a class="code" href="classPSocksSocket.html#a0">PSocksSocket</a>(00128       WORD <a class="code" href="classPSocket.html#n0">port</a> = 000129     );00130 00131   <span class="comment">// Overrides from class PSocket.</span>00143 <span class="comment"></span>    <span class="keyword">virtual</span> BOOL <a class="code" href="classPSocksSocket.html#a1">Connect</a>(00144       <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> &amp; address   <span class="comment">// Address of remote machine to connect to.</span>00145     );00146     <span class="keyword">virtual</span> BOOL <a class="code" href="classPSocksSocket.html#a1">Connect</a>(00147       <span class="keyword">const</span> Address &amp; addr      <span class="comment">// Address of remote machine to connect to.</span>00148     );00149 00165     <span class="keyword">virtual</span> BOOL <a class="code" href="classPSocksSocket.html#a3">Listen</a>(00166       <span class="keywordtype">unsigned</span> queueSize = 5,  <span class="comment">// Number of pending accepts that may be queued.</span>00167       WORD <a class="code" href="classPSocket.html#n0">port</a> = 0,           <span class="comment">// Port number to use for the connection.</span>00168       <a class="code" href="classPSocket.html#z369_0">Reusability</a> reuse = <a class="code" href="classPSocket.html#z369_0s1">AddressIsExclusive</a> <span class="comment">// Can/Cant listen more than once.</span>00169     );00170 00190     BOOL <a class="code" href="classPSocksSocket.html#a4">Accept</a>();00191     <span class="keyword">virtual</span> BOOL <a class="code" href="classPSocksSocket.html#a4">Accept</a>(00192       <a class="code" href="classPSocket.html">PSocket</a> &amp; socket          <span class="comment">// Listening socket making the connection.</span>00193     );00194 00195 00196   <span class="comment">// Overrides from class PIPSocket.</span>00202 <span class="comment"></span>    <span class="keyword">virtual</span> BOOL <a class="code" href="classPSocksSocket.html#a6">GetLocalAddress</a>(00203       Address &amp; addr    <span class="comment">// Variable to receive hosts IP address</span>00204     );00205     <span class="keyword">virtual</span> BOOL <a class="code" href="classPSocksSocket.html#a6">GetLocalAddress</a>(00206       Address &amp; addr,    <span class="comment">// Variable to receive peer hosts IP address</span>00207       WORD &amp; <a class="code" href="classPSocket.html#n0">port</a>        <span class="comment">// Variable to receive peer hosts port number</span>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -