PWLib
1.10.10
|
00001 /* 00002 * ipxsock.h 00003 * 00004 * IPX protocol socket I/O 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: ipxsock.h,v $ 00030 * Revision 1.12 2005/11/25 03:43:47 csoutheren 00031 * Fixed function argument comments to be compatible with Doxygen 00032 * 00033 * Revision 1.11 2003/09/17 05:41:58 csoutheren 00034 * Removed recursive includes 00035 * 00036 * Revision 1.10 2003/09/17 01:18:02 csoutheren 00037 * Removed recursive include file system and removed all references 00038 * to deprecated coooperative threading support 00039 * 00040 * Revision 1.9 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.8 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.7 1999/03/09 02:59:50 robertj 00049 * Changed comments to doc++ compatible documentation. 00050 * 00051 * Revision 1.6 1999/02/16 08:12:00 robertj 00052 * MSVC 6.0 compatibility changes. 00053 * 00054 * Revision 1.5 1998/11/30 02:50:58 robertj 00055 * New directory structure 00056 * 00057 * Revision 1.4 1998/09/23 06:20:47 robertj 00058 * Added open source copyright license. 00059 * 00060 * Revision 1.3 1996/10/08 13:21:04 robertj 00061 * More IPX implementation. 00062 * 00063 * Revision 1.1 1996/09/14 13:00:56 robertj 00064 * Initial revision 00065 * 00066 */ 00067 00068 #ifndef _PIPXSOCKET 00069 #define _PIPXSOCKET 00070 00071 #ifdef P_USE_PRAGMA 00072 #pragma interface 00073 #endif 00074 00075 #include <ptlib/socket.h> 00076 00077 00081 class PIPXSocket : public PSocket 00082 { 00083 PCLASSINFO(PIPXSocket, PSocket); 00084 00085 public: 00088 PIPXSocket( 00089 WORD port = 0 00090 ); 00091 00092 00093 public: 00096 class Address { 00097 public: 00098 union { 00099 struct { 00100 BYTE b1,b2,b3,b4; 00101 } b; 00102 struct { 00103 WORD w1,s_w2; 00104 } w; 00105 DWORD dw; 00106 } network; 00107 BYTE node[6]; 00108 00110 Address(); 00112 Address(const Address & addr ); 00114 Address(const PString & str ); 00116 Address( 00117 DWORD netNum, 00118 const char * nodeNum 00119 ); 00121 Address & operator=(const Address & addr ); 00123 operator PString() const; 00128 BOOL IsValid() const; 00130 friend ostream & operator<<( 00131 ostream & strm, 00132 Address & addr 00133 ) { return strm << (PString)addr; } 00134 }; 00135 00146 virtual PString GetName() const; 00148 00149 00164 virtual BOOL Connect( 00165 const PString & address 00166 ); 00179 virtual BOOL Connect( 00180 const Address & address 00181 ); 00182 00198 virtual BOOL Listen( 00199 unsigned queueSize = 5, 00200 WORD port = 0, 00201 Reusability reuse = AddressIsExclusive 00202 ); 00204 00212 static PString GetHostName( 00213 const Address & addr 00214 ); 00215 00221 static BOOL GetHostAddress( 00222 Address & addr 00223 ); 00224 00230 static BOOL GetHostAddress( 00231 const PString & hostname, 00235 Address & addr 00236 ); 00237 00243 BOOL GetLocalAddress( 00244 Address & addr 00245 ); 00246 00252 BOOL GetLocalAddress( 00253 Address & addr, 00254 WORD & port 00255 ); 00256 00263 BOOL GetPeerAddress( 00264 Address & addr 00265 ); 00266 00273 BOOL GetPeerAddress( 00274 Address & addr, 00275 WORD & port 00276 ); 00278 00286 BOOL SetPacketType( 00287 int type 00288 ); 00289 00295 int GetPacketType(); 00296 00297 00303 virtual BOOL ReadFrom( 00304 void * buf, 00305 PINDEX len, 00306 Address & addr, 00307 WORD & port 00308 ); 00309 00315 virtual BOOL WriteTo( 00316 const void * buf, 00317 PINDEX len, 00318 const Address & addr, 00319 WORD port 00320 ); 00322 00323 00324 protected: 00325 virtual BOOL OpenSocket(); 00326 virtual const char * GetProtocolName() const; 00327 00328 00329 // Include platform dependent part of class 00330 #ifdef _WIN32 00331 #include "msos/ptlib/ipxsock.h" 00332 #else 00333 #include "unix/ptlib/ipxsock.h" 00334 #endif 00335 }; 00336 00337 #endif 00338 00339 // End Of File ///////////////////////////////////////////////////////////////