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 PTLIB_UDPSOCKET_H
00035 #define PTLIB_UDPSOCKET_H
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 int iAddressFamily = AF_INET
00060 );
00061 PUDPSocket(
00062 PQoS * qos,
00063 WORD port = 0,
00064 int iAddressFamily = AF_INET
00065 );
00066 PUDPSocket(
00067 const PString & service,
00068 PQoS * qos = NULL,
00069 int iAddressFamily = AF_INET
00070 );
00071 PUDPSocket(
00072 const PString & address,
00073 WORD port
00074 );
00075 PUDPSocket(
00076 const PString & address,
00077 const PString & service
00078 );
00080
00085 PBoolean Read(
00086 void * buf,
00087 PINDEX len
00088 );
00089
00092 PBoolean Write(
00093 const void * buf,
00094 PINDEX len
00095 );
00096
00099 PBoolean Connect(
00100 const PString & address
00101 );
00103
00108 void SetSendAddress(
00109 const Address & address,
00110 WORD port
00111 );
00112
00115 void GetSendAddress(
00116 Address & address,
00117 WORD & port
00118 );
00119
00120
00123 virtual PBoolean ModifyQoSSpec(
00124 PQoS * qos
00125 );
00126
00127 #if P_QOS
00128
00130 virtual PQoS & GetQoSSpec();
00131 #endif
00132
00136 void GetLastReceiveAddress(
00137 Address & address,
00138 WORD & port
00139 );
00140
00143 static PBoolean SupportQoS(const PIPSocket::Address & address);
00144
00147 static void EnableGQoS();
00149
00150 protected:
00151
00152 virtual PBoolean OpenSocket();
00153
00154
00155 virtual PBoolean OpenSocket(
00156 int ipAdressFamily
00157 );
00158
00159
00160 virtual PBoolean OpenSocketGQOS(int af, int type, int proto);
00161
00162
00163 virtual PBoolean ApplyQoS();
00164
00165 virtual const char * GetProtocolName() const;
00166
00167 Address sendAddress;
00168 WORD sendPort;
00169
00170 Address lastReceiveAddress;
00171 WORD lastReceivePort;
00172
00173 PQoS qosSpec;
00174
00175
00176 #ifdef _WIN32
00177 #include "msos/ptlib/udpsock.h"
00178 #else
00179 #include "unix/ptlib/udpsock.h"
00180 #endif
00181 };
00182
00183 #if P_QOS
00184
00185 #ifdef _WIN32
00186 #include <winbase.h>
00187 #include <winreg.h>
00188
00189 #ifndef _WIN32_WCE
00190
00191 class PWinQoS : public PObject
00192 {
00193 PCLASSINFO(PWinQoS,PObject);
00194
00195 public:
00196 PWinQoS(PQoS & pqos, struct sockaddr * to, char * inBuf, DWORD & bufLen);
00197 ~PWinQoS();
00198
00199
00200
00201 protected:
00202 sockaddr * sa;
00203 };
00204
00205 #endif // _WIN32_WCE
00206 #endif // _WIN32
00207 #endif // P_QOS
00208
00209
00210 #endif // PTLIB_UDPSOCKET_H
00211
00212
00213