📄 ethsock_8h-source.html
字号:
<!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>ethsock.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> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</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>ethsock.h</h1><a href="ethsock_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * ethsock.h</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * Direct Ethernet socket I/O channel class.</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-1998 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"> * Portions are Copyright (C) 1993 Free Software Foundation, Inc.</span>00025 <span class="comment"> * All Rights Reserved.</span>00026 <span class="comment"> *</span>00027 <span class="comment"> * Contributor(s): ______________________________________.</span>00028 <span class="comment"> *</span>00029 <span class="comment"> * $Log: ethsock.h,v $</span>00030 <span class="comment"> * Revision 1.17 2004/04/18 04:33:36 rjongbloed</span>00031 <span class="comment"> * Changed all operators that return BOOL to return standard type bool. This is primarily</span>00032 <span class="comment"> * for improved compatibility with std STL usage removing many warnings.</span>00033 <span class="comment"> *</span>00034 <span class="comment"> * Revision 1.16 2003/09/17 05:41:58 csoutheren</span>00035 <span class="comment"> * Removed recursive includes</span>00036 <span class="comment"> *</span>00037 <span class="comment"> * Revision 1.15 2003/09/17 01:18:02 csoutheren</span>00038 <span class="comment"> * Removed recursive include file system and removed all references</span>00039 <span class="comment"> * to deprecated coooperative threading support</span>00040 <span class="comment"> *</span>00041 <span class="comment"> * Revision 1.14 2002/09/16 01:08:59 robertj</span>00042 <span class="comment"> * Added #define so can select if #pragma interface/implementation is used on</span>00043 <span class="comment"> * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.</span>00044 <span class="comment"> *</span>00045 <span class="comment"> * Revision 1.13 2001/10/03 03:15:05 robertj</span>00046 <span class="comment"> * Changed to allow use of NULL pointer to indicate address of all zeros.</span>00047 <span class="comment"> *</span>00048 <span class="comment"> * Revision 1.12 2001/05/22 12:49:32 robertj</span>00049 <span class="comment"> * Did some seriously wierd rewrite of platform headers to eliminate the</span>00050 <span class="comment"> * stupid GNU compiler warning about braces not matching.</span>00051 <span class="comment"> *</span>00052 <span class="comment"> * Revision 1.11 1999/03/09 02:59:49 robertj</span>00053 <span class="comment"> * Changed comments to doc++ compatible documentation.</span>00054 <span class="comment"> *</span>00055 <span class="comment"> * Revision 1.10 1999/02/16 08:07:11 robertj</span>00056 <span class="comment"> * MSVC 6.0 compatibility changes.</span>00057 <span class="comment"> *</span>00058 <span class="comment"> * Revision 1.9 1998/11/20 03:18:24 robertj</span>00059 <span class="comment"> * Split rad and write buffers to separate pools.</span>00060 <span class="comment"> *</span>00061 <span class="comment"> * Revision 1.8 1998/11/19 05:18:21 robertj</span>00062 <span class="comment"> * Added route table manipulation functions to PIPSocket class.</span>00063 <span class="comment"> *</span>00064 <span class="comment"> * Revision 1.7 1998/10/12 09:34:40 robertj</span>00065 <span class="comment"> * New method for getting IP addresses of interfaces.</span>00066 <span class="comment"> *</span>00067 <span class="comment"> * Revision 1.6 1998/09/23 06:20:31 robertj</span>00068 <span class="comment"> * Added open source copyright license.</span>00069 <span class="comment"> *</span>00070 <span class="comment"> * Revision 1.5 1998/09/14 12:27:21 robertj</span>00071 <span class="comment"> * Added function to parse type out of ethernet/802.2 frame.</span>00072 <span class="comment"> *</span>00073 <span class="comment"> * Revision 1.4 1998/08/25 11:06:34 robertj</span>00074 <span class="comment"> * Fixed output of PEthSocket::Address variables to streams.</span>00075 <span class="comment"> *</span>00076 <span class="comment"> * Revision 1.3 1998/08/22 04:07:42 robertj</span>00077 <span class="comment"> * Fixed GNU problem with structure packing</span>00078 <span class="comment"> *</span>00079 <span class="comment"> * Revision 1.2 1998/08/21 05:26:34 robertj</span>00080 <span class="comment"> * Fine tuning of interface.</span>00081 <span class="comment"> *</span>00082 <span class="comment"> * Revision 1.1 1998/08/20 05:46:45 robertj</span>00083 <span class="comment"> * Initial revision</span>00084 <span class="comment"> *</span>00085 <span class="comment"> */</span>00086 00087 <span class="preprocessor">#ifndef _PETHSOCKET</span>00088 <span class="preprocessor"></span><span class="preprocessor">#define _PETHSOCKET</span>00089 <span class="preprocessor"></span>00090 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00091 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00092 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00093 <span class="preprocessor"></span>00094 <span class="preprocessor">#include <<a class="code" href="socket_8h.html">ptlib/socket.h</a>></span>00095 00096 <span class="preprocessor">#ifdef _WIN32</span>00097 <span class="preprocessor"></span><span class="keyword">class </span>PWin32PacketDriver;00098 <span class="keyword">class </span>PWin32SnmpLibrary;00099 <span class="keyword">class </span>PWin32PacketBuffer;00100 00101 PARRAY(PWin32PackBufArray, PWin32PacketBuffer);00102 <span class="preprocessor">#endif</span>00103 <span class="preprocessor"></span><a name="l00107"></a><a class="code" href="classPEthSocket.html">00107</a> <span class="keyword">class </span><a class="code" href="classPEthSocket.html">PEthSocket</a> : <span class="keyword">public</span> <a class="code" href="classPSocket.html">PSocket</a>00108 {00109 <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPEthSocket.html">PEthSocket</a>, <a class="code" href="classPSocket.html">PSocket</a>);00110 00111 <span class="keyword">public</span>:00117 <a class="code" href="classPEthSocket.html#z113_0">PEthSocket</a>(00118 PINDEX nReadBuffers = 8, 00119 PINDEX nWriteBuffers = 1, 00120 PINDEX size = 1514 00121 );00122 00124 <a class="code" href="classPEthSocket.html#z113_1">~PEthSocket</a>();00126 00127 00128 <span class="keyword">public</span>:00129 <span class="preprocessor">#pragma pack(1)</span>00130 <span class="preprocessor"></span><a name="l00132"></a><a class="code" href="unionPEthSocket_1_1Address.html">00132</a> <span class="keyword">union </span><a class="code" href="unionPEthSocket_1_1Address.html">Address</a> {<a name="l00133"></a><a class="code" href="unionPEthSocket_1_1Address.html#m0">00133</a> BYTE <a class="code" href="unionPEthSocket_1_1Address.html#m0">b</a>[6];<a name="l00134"></a><a class="code" href="unionPEthSocket_1_1Address.html#m1">00134</a> WORD <a class="code" href="unionPEthSocket_1_1Address.html#m1">w</a>[3];00135 <span class="keyword">struct </span>{<a name="l00136"></a><a class="code" href="unionPEthSocket_1_1Address.html#m2">00136</a> DWORD <a class="code" href="unionPEthSocket_1_1Address.html#m2">l</a>;<a name="l00137"></a><a class="code" href="unionPEthSocket_1_1Address.html#m3">00137</a> WORD <a class="code" href="unionPEthSocket_1_1Address.html#m3">s</a>;00138 } <a class="code" href="unionPEthSocket_1_1Address.html#m4">ls</a>;00139 00140 <a class="code" href="unionPEthSocket_1_1Address.html#a0">Address</a>();00141 <a class="code" href="unionPEthSocket_1_1Address.html#a0">Address</a>(<span class="keyword">const</span> BYTE * addr);00142 <a class="code" href="unionPEthSocket_1_1Address.html#a0">Address</a>(<span class="keyword">const</span> <a class="code" href="unionPEthSocket_1_1Address.html#a0">Address</a> & addr);00143 <a class="code" href="unionPEthSocket_1_1Address.html#a0">Address</a>(<span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & str);00144 <a class="code" href="unionPEthSocket_1_1Address.html#a0">Address</a> & <a class="code" href="unionPEthSocket_1_1Address.html#a4">operator=</a>(<span class="keyword">const</span> <a class="code" href="unionPEthSocket_1_1Address.html#a0">Address</a> & addr);00145 <a class="code" href="unionPEthSocket_1_1Address.html#a0">Address</a> & <a class="code" href="unionPEthSocket_1_1Address.html#a4">operator=</a>(<span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & str);00146 00147 <span class="keywordtype">bool</span> <a class="code" href="unionPEthSocket_1_1Address.html#a6">operator==</a>(<span class="keyword">const</span> BYTE * eth) <span class="keyword">const</span>;00148 <span class="keywordtype">bool</span> <a class="code" href="unionPEthSocket_1_1Address.html#a7">operator!=</a>(<span class="keyword">const</span> BYTE * eth) <span class="keyword">const</span>;<a name="l00149"></a><a class="code" href="unionPEthSocket_1_1Address.html#a8">00149</a> <span class="keywordtype">bool</span> <a class="code" href="unionPEthSocket_1_1Address.html#a6">operator==</a>(<span class="keyword">const</span> <a class="code" href="unionPEthSocket_1_1Address.html">Address</a> & eth)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="unionPEthSocket_1_1Address.html#m4">ls</a>.l == eth.<a class="code" href="unionPEthSocket_1_1Address.html#m4">ls</a>.l && <a class="code" href="unionPEthSocket_1_1Address.html#m4">ls</a>.s == eth.<a class="code" href="unionPEthSocket_1_1Address.html#m4">ls</a>.s; }<a name="l00150"></a><a class="code" href="unionPEthSocket_1_1Address.html#a9">00150</a> <span class="keywordtype">bool</span> <a class="code" href="unionPEthSocket_1_1Address.html#a7">operator!=</a>(<span class="keyword">const</span> <a class="code" href="unionPEthSocket_1_1Address.html">Address</a> & eth)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="code" href="unionPEthSocket_1_1Address.html#m4">ls</a>.l != eth.<a class="code" href="unionPEthSocket_1_1Address.html#m4">ls</a>.l || <a class="code" href="unionPEthSocket_1_1Address.html#m4">ls</a>.s != eth.<a class="code" href="unionPEthSocket_1_1Address.html#m4">ls</a>.s; }00151 00152 <a class="code" href="unionPEthSocket_1_1Address.html#a10">operator PString</a>() <span class="keyword">const</span>;00153 <a name="l00154"></a><a class="code" href="unionPEthSocket_1_1Address.html#l0">00154</a> <span class="keyword">friend</span> ostream & <a class="code" href="unionPEthSocket_1_1Address.html#l0">operator<<</a>(ostream & <a class="code" href="unionPEthSocket_1_1Address.html#m3">s</a>, <span class="keyword">const</span> <a class="code" href="unionPEthSocket_1_1Address.html">Address</a> & a)00155 { <span class="keywordflow">return</span> <a class="code" href="unionPEthSocket_1_1Address.html#m3">s</a> << (PString)a; }00156 };00157
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -