📄 udpsock_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>udpsock.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>udpsock.h</h1><a href="udpsock_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * udpsock.h</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * User Datagram Protocol 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: udpsock.h,v $</span>00030 <span class="comment"> * Revision 1.23 2003/10/27 04:06:13 csoutheren</span>00031 <span class="comment"> * Added code to allow compilation of new QoS code on Unix</span>00032 <span class="comment"> *</span>00033 <span class="comment"> * Revision 1.22 2003/10/27 03:22:44 csoutheren</span>00034 <span class="comment"> * Added handling for QoS</span>00035 <span class="comment"> * Thanks to Henry Harrison of AliceStreet</span>00036 <span class="comment"> *</span>00037 <span class="comment"> * Revision 1.21 2003/09/17 05:41:59 csoutheren</span>00038 <span class="comment"> * Removed recursive includes</span>00039 <span class="comment"> *</span>00040 <span class="comment"> * Revision 1.20 2003/09/17 01:18:02 csoutheren</span>00041 <span class="comment"> * Removed recursive include file system and removed all references</span>00042 <span class="comment"> * to deprecated coooperative threading support</span>00043 <span class="comment"> *</span>00044 <span class="comment"> * Revision 1.19 2002/10/08 12:41:51 robertj</span>00045 <span class="comment"> * Changed for IPv6 support, thanks S閎astien Josset.</span>00046 <span class="comment"> *</span>00047 <span class="comment"> * Revision 1.18 2002/09/16 01:08:59 robertj</span>00048 <span class="comment"> * Added #define so can select if #pragma interface/implementation is used on</span>00049 <span class="comment"> * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.</span>00050 <span class="comment"> *</span>00051 <span class="comment"> * Revision 1.17 2001/05/22 12:49:32 robertj</span>00052 <span class="comment"> * Did some seriously wierd rewrite of platform headers to eliminate the</span>00053 <span class="comment"> * stupid GNU compiler warning about braces not matching.</span>00054 <span class="comment"> *</span>00055 <span class="comment"> * Revision 1.16 1999/08/27 08:18:52 robertj</span>00056 <span class="comment"> * Added ability to get the host/port of the the last packet read/written to UDP socket.</span>00057 <span class="comment"> *</span>00058 <span class="comment"> * Revision 1.15 1999/03/09 02:59:51 robertj</span>00059 <span class="comment"> * Changed comments to doc++ compatible documentation.</span>00060 <span class="comment"> *</span>00061 <span class="comment"> * Revision 1.14 1999/02/16 08:11:17 robertj</span>00062 <span class="comment"> * MSVC 6.0 compatibility changes.</span>00063 <span class="comment"> *</span>00064 <span class="comment"> * Revision 1.13 1998/09/23 06:21:47 robertj</span>00065 <span class="comment"> * Added open source copyright license.</span>00066 <span class="comment"> *</span>00067 <span class="comment"> * Revision 1.12 1997/06/06 10:54:11 craigs</span>00068 <span class="comment"> * Added overrides and new functions for connectionless Writes</span>00069 <span class="comment"> *</span>00070 <span class="comment"> * Revision 1.11 1996/09/14 13:09:43 robertj</span>00071 <span class="comment"> * Major upgrade:</span>00072 <span class="comment"> * rearranged sockets to help support IPX.</span>00073 <span class="comment"> * added indirect channel class and moved all protocols to descend from it,</span>00074 <span class="comment"> * separating the protocol from the low level byte transport.</span>00075 <span class="comment"> *</span>00076 <span class="comment"> * Revision 1.10 1996/05/15 10:19:15 robertj</span>00077 <span class="comment"> * Added ICMP protocol socket, getting common ancestor to UDP.</span>00078 <span class="comment"> *</span>00079 <span class="comment"> * Revision 1.9 1996/03/03 07:38:00 robertj</span>00080 <span class="comment"> * Added Reusability clause to the Listen() function on sockets.</span>00081 <span class="comment"> *</span>00082 <span class="comment"> * Revision 1.8 1995/12/10 11:44:45 robertj</span>00083 <span class="comment"> * Numerous fixes for sockets.</span>00084 <span class="comment"> *</span>00085 <span class="comment"> * Revision 1.7 1995/06/17 11:13:41 robertj</span>00086 <span class="comment"> * Documentation update.</span>00087 <span class="comment"> *</span>00088 <span class="comment"> * Revision 1.6 1995/06/17 00:48:01 robertj</span>00089 <span class="comment"> * Implementation.</span>00090 <span class="comment"> *</span>00091 <span class="comment"> * Revision 1.5 1995/01/03 09:36:24 robertj</span>00092 <span class="comment"> * Documentation.</span>00093 <span class="comment"> *</span>00094 <span class="comment"> * Revision 1.4 1994/08/23 11:32:52 robertj</span>00095 <span class="comment"> * Oops</span>00096 <span class="comment"> *</span>00097 <span class="comment"> * Revision 1.3 1994/08/22 00:46:48 robertj</span>00098 <span class="comment"> * Added pragma fro GNU C++ compiler.</span>00099 <span class="comment"> *</span>00100 <span class="comment"> * Revision 1.2 1994/07/25 03:36:03 robertj</span>00101 <span class="comment"> * Added sockets to common, normalising to same comment standard.</span>00102 <span class="comment"> *</span>00103 <span class="comment"> */</span>00104 00105 <span class="preprocessor">#ifndef _PUDPSOCKET</span>00106 <span class="preprocessor"></span><span class="preprocessor">#define _PUDPSOCKET</span>00107 <span class="preprocessor"></span>00108 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00109 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00110 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00111 <span class="preprocessor"></span>00112 <span class="preprocessor">#include <<a class="code" href="qos_8h.html">ptlib/qos.h</a>></span>00113 <a name="l00117"></a><a class="code" href="classPUDPSocket.html">00117</a> <span class="keyword">class </span><a class="code" href="classPUDPSocket.html">PUDPSocket</a> : <span class="keyword">public</span> <a class="code" href="classPIPDatagramSocket.html">PIPDatagramSocket</a>00118 {00119 <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPUDPSocket.html">PUDPSocket</a>, <a class="code" href="classPIPDatagramSocket.html">PIPDatagramSocket</a>);00120 00121 <span class="keyword">public</span>:00127 <a class="code" href="classPUDPSocket.html#z465_0">PUDPSocket</a>(00128 WORD <a class="code" href="classPSocket.html#n0">port</a> = 0 00129 );00130 <a class="code" href="classPUDPSocket.html#z465_0">PUDPSocket</a>(00131 <a class="code" href="classPQoS.html">PQoS</a> * qos, 00132 WORD <a class="code" href="classPSocket.html#n0">port</a> = 0 00133 );00134 <a class="code" href="classPUDPSocket.html#z465_0">PUDPSocket</a>(00135 <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & service, 00136 <a class="code" href="classPQoS.html">PQoS</a> * qos = NULL 00137 );00138 <a class="code" href="classPUDPSocket.html#z465_0">PUDPSocket</a>(00139 <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & address, 00140 WORD <a class="code" href="classPSocket.html#n0">port</a> 00141 );00142 <a class="code" href="classPUDPSocket.html#z465_0">PUDPSocket</a>(00143 <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & address, 00144 <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & service 00145 );00147 00152 BOOL <a class="code" href="classPUDPSocket.html#z467_0">Read</a>(00153 <span class="keywordtype">void</span> * buf, 00154 PINDEX len 00155 );00156 00159 BOOL <a class="code" href="classPUDPSocket.html#z467_1">Write</a>(00160 <span class="keyword">const</span> <span class="keywordtype">void</span> * buf, 00161 PINDEX len 00162 );00163 00166 BOOL <a class="code" href="classPUDPSocket.html#z467_2">Connect</a>(00167 <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & address 00168 );00170 00175 <span class="keywordtype">void</span> <a class="code" href="classPUDPSocket.html#z469_0">SetSendAddress</a>(00176 <span class="keyword">const</span> Address & address, 00177 WORD <a class="code" href="classPSocket.html#n0">port</a> 00178 );00179 00182 <span class="keywordtype">void</span> <a class="code" href="classPUDPSocket.html#z469_1">GetSendAddress</a>(00183 Address & address, 00184 WORD & <a class="code" href="classPSocket.html#n0">port</a> 00185 );00186 00187 00190 <span class="keyword">virtual</span> BOOL <a class="code" href="classPUDPSocket.html#z469_2">ModifyQoSSpec</a>(00191 <a class="code" href="classPQoS.html">PQoS</a> * qos 00192 );00193 00198 <span class="keywordtype">void</span> <a class="code" href="classPUDPSocket.html#z469_3">GetLastReceiveAddress</a>(00199 Address & address, 00200 WORD & <a class="code" href="classPSocket.html#n0">port</a> 00201 );00203 00204 <span class="keyword">protected</span>:00205 <span class="comment">// Open an IPv4 socket (for backward compatibility)</span>00206 <span class="keyword">virtual</span> BOOL <a class="code" href="classPUDPSocket.html#b0">OpenSocket</a>();00207 00208 <span class="comment">// Open an IPv4 or IPv6 socket</span>00209 <span class="keyword">virtual</span> BOOL <a class="code" href="classPUDPSocket.html#b0">OpenSocket</a>(00210 <span class="keywordtype">int</span> ipAdressFamily00211 );00212 00213 <span class="comment">// Create a QOS-enabled socket</span>00214 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classPUDPSocket.html#b2">OpenSocketGQOS</a>(<span class="keywordtype">int</span> af, <span class="keywordtype">int</span> type, <span class="keywordtype">int</span> proto);00215 00216 <span class="comment">// Modify the QOS settings</span>00217 <span class="keyword">virtual</span> BOOL <a class="code" href="classPUDPSocket.html#b3">ApplyQoS</a>();00218 00219 <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="classPUDPSocket.html#b4">GetProtocolName</a>() <span class="keyword">const</span>;00220 <a name="l00221"></a><a class="code" href="classPUDPSocket.html#n0">00221</a> Address <a class="code" href="classPUDPSocket.html#n0">sendAddress</a>;<a name="l00222"></a><a class="code" href="classPUDPSocket.html#n1">00222</a> WORD <a class="code" href="classPUDPSocket.html#n1">sendPort</a>;00223 <a name="l00224"></a><a class="code" href="classPUDPSocket.html#n2">00224</a> Address <a class="code" href="classPUDPSocket.html#n2">lastReceiveAddress</a>;<a name="l00225"></a><a class="code" href="classPUDPSocket.html#n3">00225</a> WORD <a class="code" href="classPUDPSocket.html#n3">lastReceivePort</a>;00226 <a name="l00227"></a><a class="code" href="classPUDPSocket.html#n4">00227</a> <a class="code" href="classPQoS.html">PQoS</a> <a class="code" href="classPUDPSocket.html#n4">qosSpec</a>;00228 00229 <span class="comment">// Include platform dependent part of class</span>00230 <span class="preprocessor">#ifdef _WIN32</span>00231 <span class="preprocessor"></span><span class="preprocessor">#include "msos/ptlib/udpsock.h"</span>00232 <span class="preprocessor">#else</span>00233 <span class="preprocessor"></span><span class="preprocessor">#include "unix/ptlib/udpsock.h"</span>00234 <span class="preprocessor">#endif</span>00235 <span class="preprocessor"></span>};00236 00237 <span class="preprocessor">#endif</span>00238 <span class="preprocessor"></span>00239 00240 <span class="comment">// End Of File ///////////////////////////////////////////////////////////////</span></pre></div><hr><address style="align: right;"><small>Generated on Wed Sep 29 22:44:12 2004 for PWLib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -