00001 /* 00002 * qos.h 00003 * 00004 * QOS class used by PWLIB dscp or Windows GQOS implementation. 00005 * 00006 * Copyright (c) 2003 AliceStreet Ltd 00007 * 00008 * The contents of this file are subject to the Mozilla Public License 00009 * Version 1.0 (the "License"); you may not use this file except in 00010 * compliance with the License. You may obtain a copy of the License at 00011 * http://www.mozilla.org/MPL/ 00012 * 00013 * Software distributed under the License is distributed on an "AS IS" 00014 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00015 * the License for the specific language governing rights and limitations 00016 * under the License. 00017 * 00018 * Contributor(s): ______________________________________. 00019 * 00020 * $Log: qos.h,v $ 00021 * Revision 1.2 2003/10/27 03:51:38 csoutheren 00022 * Added ifdef to disable QoS code on systems that do not support it 00023 * 00024 * Revision 1.1 2003/10/27 03:20:10 csoutheren 00025 * Initial version of QoS implementation 00026 * Thanks to Henry Harrison of AliceStreet 00027 * 00028 * 00029 */ 00030 00031 #ifndef _PQOS 00032 #define _PQOS 00033 00034 #ifdef P_USE_PRAGMA 00035 #pragma interface 00036 #endif 00037 00038 #if P_HAS_QOS 00039 #ifdef _WIN32 00040 #include <winsock2.h> 00041 #include <Ws2tcpip.h> 00042 #include <qossp.h> 00043 #endif // _WIN32 00044 #endif // P_HAS_QOS 00045 00046 #ifndef QOS_NOT_SPECIFIED 00047 #define QOS_NOT_SPECIFIED 0xFFFFFFFF 00048 #endif 00049 00050 #ifndef SERVICETYPE 00051 #define SERVICETYPE DWORD 00052 #endif 00053 00054 #ifndef SERVICETYPE_GUARANTEED 00055 #define SERVICETYPE_GUARANTEED 0x00000003 00056 #endif 00057 00058 #ifndef SERVICETYPE_CONTROLLEDLOAD 00059 #define SERVICETYPE_CONTROLLEDLOAD 0x00000002 00060 #endif 00061 00062 #ifndef SERVICETYPE_BESTEFFORT 00063 #define SERVICETYPE_BESTEFFORT 0x00000001 00064 #endif 00065 00066 #define SERVICETYPE_PNOTDEFINED 0xFFFFFFFF 00067 00068 class PQoS : public PObject 00069 { 00070 PCLASSINFO(PQoS, PObject); 00071 00072 public: 00073 PQoS(); 00074 PQoS(DWORD avgBytesPerSec, 00075 DWORD winServiceType, 00076 int DSCPalternative = -1, 00077 DWORD maxFrameBytes = 1500, 00078 DWORD peakBytesPerSec = QOS_NOT_SPECIFIED); 00079 PQoS(int DSCPvalue); 00080 00081 void SetAvgBytesPerSec(DWORD avgBytesPerSec); 00082 void SetWinServiceType(DWORD winServiceType); 00083 void SetDSCP(int DSCPvalue); 00084 void SetMaxFrameBytes(DWORD maxFrameBytes); 00085 void SetPeakBytesPerSec(DWORD peakBytesPerSec); 00086 00087 DWORD GetTokenRate() const { return tokenRate;} 00088 DWORD GetTokenBucketSize() const { return tokenBucketSize;} 00089 DWORD GetPeakBandwidth() const { return peakBandwidth;} 00090 DWORD GetServiceType() const { return serviceType;} 00091 int GetDSCP() const { return dscp;} 00092 00093 static void SetDSCPAlternative(DWORD winServiceType, 00094 UINT dscp); 00095 static char bestEffortDSCP; 00096 static char controlledLoadDSCP; 00097 static char guaranteedDSCP; 00098 00099 protected: 00100 int dscp; 00101 DWORD tokenRate; 00102 DWORD tokenBucketSize; 00103 DWORD peakBandwidth; 00104 DWORD serviceType; 00105 00106 }; 00107 00108 #endif // _PQOS