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