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  * $Revision: 20385 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-06-04 10:40:38 +0000 (Wed, 04 Jun 2008) $
00032  */
00033 
00034 #ifndef _PIPXSOCKET
00035 #define _PIPXSOCKET
00036 
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040 
00041 #include <ptlib/socket.h>
00042 
00043 
00047 class PIPXSocket : public PSocket
00048 {
00049   PCLASSINFO(PIPXSocket, PSocket);
00050 
00051   public:
00054     PIPXSocket(
00055       WORD port = 0       
00056     );
00057 
00058 
00059   public:
00062     class Address {
00063       public:
00064         union {
00065           struct {
00066             BYTE b1,b2,b3,b4;
00067           } b;
00068           struct {
00069             WORD w1,s_w2;
00070           } w;
00071           DWORD dw;
00072         } network;
00073         BYTE node[6];
00074 
00076         Address();
00078         Address(const Address & addr );
00080         Address(const PString & str );
00082         Address(
00083           DWORD netNum, 
00084           const char * nodeNum  
00085         );
00087         Address & operator=(const Address & addr );
00089         operator PString() const;
00094         PBoolean IsValid() const;
00096       friend ostream & operator<<(
00097         ostream & strm, 
00098         Address & addr  
00099       ) { return strm << (PString)addr; }
00100     };
00101 
00112     virtual PString GetName() const;
00114 
00115 
00130     virtual PBoolean Connect(
00131       const PString & address   
00132     );
00145     virtual PBoolean Connect(
00146       const Address & address   
00147     );
00148 
00164     virtual PBoolean Listen(
00165       unsigned queueSize = 5,  
00166       WORD port = 0,           
00167       Reusability reuse = AddressIsExclusive 
00168     );
00170 
00178     static PString GetHostName(
00179       const Address & addr    
00180     );
00181 
00187     static PBoolean GetHostAddress(
00188       Address & addr    
00189     );
00190 
00196     static PBoolean GetHostAddress(
00197       const PString & hostname,
00201       Address & addr    
00202     );
00203 
00209     PBoolean GetLocalAddress(
00210       Address & addr    
00211     );
00212 
00218     PBoolean GetLocalAddress(
00219       Address & addr,    
00220       WORD & port        
00221     );
00222 
00229     PBoolean GetPeerAddress(
00230       Address & addr    
00231     );
00232 
00239     PBoolean GetPeerAddress(
00240       Address & addr,    
00241       WORD & port        
00242     );
00244 
00252     PBoolean SetPacketType(
00253       int type    
00254     );
00255 
00261     int GetPacketType();
00262 
00263 
00269     virtual PBoolean ReadFrom(
00270       void * buf,     
00271       PINDEX len,     
00272       Address & addr, 
00273       WORD & port     
00274     );
00275 
00281     virtual PBoolean WriteTo(
00282       const void * buf,   
00283       PINDEX len,         
00284       const Address & addr, 
00285       WORD port           
00286     );
00288 
00289 
00290   protected:
00291     virtual PBoolean OpenSocket();
00292     virtual const char * GetProtocolName() const;
00293 
00294 
00295 // Include platform dependent part of class
00296 #ifdef _WIN32
00297 #include "msos/ptlib/ipxsock.h"
00298 #else
00299 #include "unix/ptlib/ipxsock.h"
00300 #endif
00301 };
00302 
00303 #endif
00304 
00305 // End Of File ///////////////////////////////////////////////////////////////

Generated on Mon Feb 23 01:57:54 2009 for PTLib by  doxygen 1.5.1