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
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
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