Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

tcpsock.h

Go to the documentation of this file.
00001 /*
00002  * tcpsock.h
00003  *
00004  * Transmission Control Protocol socket channel class.
00005  *
00006  * Portable Windows Library
00007  *
00008  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Portable Windows Library.
00021  *
00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00023  *
00024  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
00025  * All Rights Reserved.
00026  *
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Log: tcpsock.h,v $
00030  * Revision 1.30  2003/09/17 05:41:59  csoutheren
00031  * Removed recursive includes
00032  *
00033  * Revision 1.29  2003/09/17 01:18:02  csoutheren
00034  * Removed recursive include file system and removed all references
00035  * to deprecated coooperative threading support
00036  *
00037  * Revision 1.28  2002/10/08 12:41:51  robertj
00038  * Changed for IPv6 support, thanks Sébastien Josset.
00039  *
00040  * Revision 1.27  2002/09/16 01:08:59  robertj
00041  * Added #define so can select if #pragma interface/implementation is used on
00042  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00043  *
00044  * Revision 1.26  2001/05/22 12:49:32  robertj
00045  * Did some seriously wierd rewrite of platform headers to eliminate the
00046  *   stupid GNU compiler warning about braces not matching.
00047  *
00048  * Revision 1.25  1999/09/28 00:08:59  robertj
00049  * Fixed some comment typoes
00050  *
00051  * Revision 1.24  1999/09/28 00:07:54  robertj
00052  * Fixed some comment typoes
00053  *
00054  * Revision 1.23  1999/08/30 02:21:03  robertj
00055  * Added ability to listen to specific interfaces for IP sockets.
00056  *
00057  * Revision 1.22  1999/03/09 02:59:51  robertj
00058  * Changed comments to doc++ compatible documentation.
00059  *
00060  * Revision 1.21  1999/02/16 08:11:17  robertj
00061  * MSVC 6.0 compatibility changes.
00062  *
00063  * Revision 1.20  1998/12/22 10:23:08  robertj
00064  * Added clone() function to support SOCKS in FTP style protocols.
00065  *
00066  * Revision 1.19  1998/09/23 06:21:37  robertj
00067  * Added open source copyright license.
00068  *
00069  * Revision 1.18  1998/08/21 05:24:46  robertj
00070  * Fixed bug where write streams out to non-stream socket.
00071  *
00072  * Revision 1.17  1996/09/14 13:09:42  robertj
00073  * Major upgrade:
00074  *   rearranged sockets to help support IPX.
00075  *   added indirect channel class and moved all protocols to descend from it,
00076  *   separating the protocol from the low level byte transport.
00077  *
00078  * Revision 1.16  1996/03/26 00:57:15  robertj
00079  * Added contructor that takes PTCPSocket so avoid copy constructor being used instead of accept.
00080  *
00081  * Revision 1.15  1996/03/03 07:37:59  robertj
00082  * Added Reusability clause to the Listen() function on sockets.
00083  *
00084  * Revision 1.14  1996/02/25 03:01:27  robertj
00085  * Moved some socket functions to platform dependent code.
00086  *
00087  * Revision 1.13  1995/12/10 11:43:34  robertj
00088  * Numerous fixes for sockets.
00089  *
00090  * Revision 1.12  1995/06/17 11:13:31  robertj
00091  * Documentation update.
00092  *
00093  * Revision 1.11  1995/06/17 00:47:31  robertj
00094  * Changed overloaded Open() calls to 3 separate function names.
00095  * More logical design of port numbers and service names.
00096  *
00097  * Revision 1.10  1995/06/04 12:46:25  robertj
00098  * Slight redesign of port numbers on sockets.
00099  *
00100  * Revision 1.9  1995/03/14 12:42:46  robertj
00101  * Updated documentation to use HTML codes.
00102  *
00103  * Revision 1.8  1995/03/12  04:46:40  robertj
00104  * Added more functionality.
00105  *
00106  * Revision 1.7  1995/01/03  09:36:22  robertj
00107  * Documentation.
00108  *
00109  * Revision 1.6  1995/01/01  01:07:33  robertj
00110  * More implementation.
00111  *
00112  * Revision 1.5  1994/08/23  11:32:52  robertj
00113  * Oops
00114  *
00115  * Revision 1.4  1994/08/22  00:46:48  robertj
00116  * Added pragma fro GNU C++ compiler.
00117  *
00118  * Revision 1.3  1994/08/21  23:43:02  robertj
00119  * Changed type of socket port number for better portability.
00120  * Added Out of Band data functions.
00121  *
00122  * Revision 1.2  1994/07/25  03:36:03  robertj
00123  * Added sockets to common, normalising to same comment standard.
00124  *
00125  */
00126 
00127 #ifndef _PTCPSOCKET
00128 #define _PTCPSOCKET
00129 
00130 #ifdef P_USE_PRAGMA
00131 #pragma interface
00132 #endif
00133 
00134 
00137 class PTCPSocket : public PIPSocket
00138 {
00139   PCLASSINFO(PTCPSocket, PIPSocket);
00140   public:
00150     PTCPSocket(
00151       WORD port = 0             
00152     );
00153     PTCPSocket(
00154       const PString & service   
00155     );
00156     PTCPSocket(
00157       const PString & address,  
00158       WORD port                 
00159     );
00160     PTCPSocket(
00161       const PString & address,  
00162       const PString & service   
00163     );
00164     PTCPSocket(
00165       PSocket & socket          
00166     );
00167     PTCPSocket(
00168       PTCPSocket & tcpSocket    
00169     );
00171 
00186     virtual PObject * Clone() const;
00188 
00205     virtual BOOL Write(
00206       const void * buf, 
00207       PINDEX len        
00208     );
00210 
00226     virtual BOOL Listen(
00227       unsigned queueSize = 5,  
00228       WORD port = 0,           
00229       Reusability reuse = AddressIsExclusive 
00230     );
00231     virtual BOOL Listen(
00232       const Address & bind,     
00233       unsigned queueSize = 5,   
00234       WORD port = 0,            
00235       Reusability reuse = AddressIsExclusive 
00236     );
00237 
00252     virtual BOOL Accept(
00253       PSocket & socket          
00254     );
00256 
00270     virtual BOOL WriteOutOfBand(
00271       const void * buf,   
00272       PINDEX len          
00273     );
00274 
00281     virtual void OnOutOfBand(
00282       const void * buf,   
00283       PINDEX len          
00284     );
00286 
00287 
00288   protected:
00289     // Open an IPv4 socket (for backward compatibility)
00290     virtual BOOL OpenSocket();
00291 
00292     // Open an IPv4 or IPv6 socket
00293     virtual BOOL OpenSocket(
00294       int ipAdressFamily
00295     );
00296 
00297     virtual const char * GetProtocolName() const;
00298 
00299 
00300 // Include platform dependent part of class
00301 #ifdef _WIN32
00302 #include "msos/ptlib/tcpsock.h"
00303 #else
00304 #include "unix/ptlib/tcpsock.h"
00305 #endif
00306 };
00307 
00308 #endif
00309 
00310 // End Of File ///////////////////////////////////////////////////////////////

Generated on Mon Feb 21 20:43:10 2005 for PWLib by  doxygen 1.4.1