00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
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
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