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 #ifndef _PUDPSOCKET
00035 #define _PUDPSOCKET
00036
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040
00041 #include <ptlib/ipdsock.h>
00042 #include <ptlib/qos.h>
00043
00047 class PUDPSocket : public PIPDatagramSocket
00048 {
00049 PCLASSINFO(PUDPSocket, PIPDatagramSocket);
00050
00051 public:
00057 PUDPSocket(
00058 WORD port = 0
00059 );
00060 PUDPSocket(
00061 PQoS * qos,
00062 WORD port = 0
00063 );
00064 PUDPSocket(
00065 const PString & service,
00066 PQoS * qos = NULL
00067 );
00068 PUDPSocket(
00069 const PString & address,
00070 WORD port
00071 );
00072 PUDPSocket(
00073 const PString & address,
00074 const PString & service
00075 );
00077
00082 PBoolean Read(
00083 void * buf,
00084 PINDEX len
00085 );
00086
00089 PBoolean Write(
00090 const void * buf,
00091 PINDEX len
00092 );
00093
00096 PBoolean Connect(
00097 const PString & address
00098 );
00100
00105 void SetSendAddress(
00106 const Address & address,
00107 WORD port
00108 );
00109
00112 void GetSendAddress(
00113 Address & address,
00114 WORD & port
00115 );
00116
00117
00120 virtual PBoolean ModifyQoSSpec(
00121 PQoS * qos
00122 );
00123
00124 #if P_QOS
00125
00127 virtual PQoS & GetQoSSpec();
00128 #endif
00129
00133 void GetLastReceiveAddress(
00134 Address & address,
00135 WORD & port
00136 );
00137
00140 static PBoolean SupportQoS(const PIPSocket::Address & address);
00141
00144 static void EnableGQoS();
00146
00147 protected:
00148
00149 virtual PBoolean OpenSocket();
00150
00151
00152 virtual PBoolean OpenSocket(
00153 int ipAdressFamily
00154 );
00155
00156
00157 virtual PBoolean OpenSocketGQOS(int af, int type, int proto);
00158
00159
00160 virtual PBoolean ApplyQoS();
00161
00162 virtual const char * GetProtocolName() const;
00163
00164 Address sendAddress;
00165 WORD sendPort;
00166
00167 Address lastReceiveAddress;
00168 WORD lastReceivePort;
00169
00170 PQoS qosSpec;
00171
00172
00173 #ifdef _WIN32
00174 #include "msos/ptlib/udpsock.h"
00175 #else
00176 #include "unix/ptlib/udpsock.h"
00177 #endif
00178 };
00179
00180 #if P_QOS
00181
00182 #ifdef _WIN32
00183 #include <winbase.h>
00184 #include <winreg.h>
00185
00186 #ifndef _WIN32_WCE
00187
00188 class PWinQoS : public PObject
00189 {
00190 PCLASSINFO(PWinQoS,PObject);
00191
00192 public:
00193 PWinQoS(PQoS & pqos, struct sockaddr * to, char * inBuf, DWORD & bufLen);
00194 ~PWinQoS();
00195
00196
00197
00198 protected:
00199 sockaddr * sa;
00200 };
00201
00202 #endif // _WIN32_WCE
00203 #endif // _WIN32
00204 #endif // P_QOS
00205
00206
00207 #endif
00208
00209
00210