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

ipxsock.h

Go to the documentation of this file.
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.11  2003/09/17 05:41:58  csoutheren
00031  * Removed recursive includes
00032  *
00033  * Revision 1.10  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.9  2002/09/16 01:08:59  robertj
00038  * Added #define so can select if #pragma interface/implementation is used on
00039  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00040  *
00041  * Revision 1.8  2001/05/22 12:49:32  robertj
00042  * Did some seriously wierd rewrite of platform headers to eliminate the
00043  *   stupid GNU compiler warning about braces not matching.
00044  *
00045  * Revision 1.7  1999/03/09 02:59:50  robertj
00046  * Changed comments to doc++ compatible documentation.
00047  *
00048  * Revision 1.6  1999/02/16 08:12:00  robertj
00049  * MSVC 6.0 compatibility changes.
00050  *
00051  * Revision 1.5  1998/11/30 02:50:58  robertj
00052  * New directory structure
00053  *
00054  * Revision 1.4  1998/09/23 06:20:47  robertj
00055  * Added open source copyright license.
00056  *
00057  * Revision 1.3  1996/10/08 13:21:04  robertj
00058  * More IPX implementation.
00059  *
00060  * Revision 1.1  1996/09/14 13:00:56  robertj
00061  * Initial revision
00062  *
00063  */
00064 
00065 #ifndef _PIPXSOCKET
00066 #define _PIPXSOCKET
00067 
00068 #ifdef P_USE_PRAGMA
00069 #pragma interface
00070 #endif
00071 
00072 #include <ptlib/socket.h>
00073 
00074 
00078 class PIPXSocket : public PSocket
00079 {
00080   PCLASSINFO(PIPXSocket, PSocket);
00081 
00082   public:
00085     PIPXSocket(
00086       WORD port = 0       
00087     );
00088 
00089 
00090   public:
00093     class Address {
00094       public:
00095         union {
00096           struct {
00097             BYTE b1,b2,b3,b4;
00098           } b;
00099           struct {
00100             WORD w1,s_w2;
00101           } w;
00102           DWORD dw;
00103         } network;
00104         BYTE node[6];
00105 
00107         Address();
00109         Address(const Address & addr );
00111         Address(const PString & str );
00113         Address(
00114           DWORD netNum, 
00115           const char * nodeNum  
00116         );
00118         Address & operator=(const Address & addr );
00120         operator PString() const;
00125         BOOL IsValid() const;
00127       friend ostream & operator<<(
00128         ostream & strm, 
00129         Address & addr  
00130       ) { return strm << (PString)addr; }
00131     };
00132 
00143     virtual PString GetName() const;
00145 
00146 
00161     virtual BOOL Connect(
00162       const PString & address   
00163     );
00176     virtual BOOL Connect(
00177       const Address & address   
00178     );
00179 
00195     virtual BOOL Listen(
00196       unsigned queueSize = 5,  
00197       WORD port = 0,           
00198       Reusability reuse = AddressIsExclusive 
00199     );
00201 
00209     static PString GetHostName(
00210       const Address & addr    
00211     );
00212 
00218     static BOOL GetHostAddress(
00219       Address & addr    
00220     );
00221 
00227     static BOOL GetHostAddress(
00228       const PString & hostname,
00232       Address & addr    
00233     );
00234 
00240     BOOL GetLocalAddress(
00241       Address & addr    
00242     );
00243 
00249     BOOL GetLocalAddress(
00250       Address & addr,    
00251       WORD & port        
00252     );
00253 
00260     BOOL GetPeerAddress(
00261       Address & addr    
00262     );
00263 
00270     BOOL GetPeerAddress(
00271       Address & addr,    
00272       WORD & port        
00273     );
00275 
00283     BOOL SetPacketType(
00284       int type    
00285     );
00286 
00292     int GetPacketType();
00293 
00294 
00300     virtual BOOL ReadFrom(
00301       void * buf,     
00302       PINDEX len,     
00303       Address & addr, 
00304       WORD & port     
00305     );
00306 
00312     virtual BOOL WriteTo(
00313       const void * buf,   
00314       PINDEX len,         
00315       const Address & addr, 
00316       WORD port           
00317     );
00319 
00320 
00321   protected:
00322     virtual BOOL OpenSocket();
00323     virtual const char * GetProtocolName() const;
00324 
00325 
00326 // Include platform dependent part of class
00327 #ifdef _WIN32
00328 #include "msos/ptlib/ipxsock.h"
00329 #else
00330 #include "unix/ptlib/ipxsock.h"
00331 #endif
00332 };
00333 
00334 #endif
00335 
00336 // End Of File ///////////////////////////////////////////////////////////////

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