Made some subtle changes to the way the static variables are instantiated in
[pwlib.git] / include / ptlib / qos.h
blob7d7b0a68fe5749c602955a9693f973347cf155b7
1 /*
2 * qos.h
4 * QOS class used by PWLIB dscp or Windows GQOS implementation.
6 * Copyright (c) 2003 AliceStreet Ltd
8 * The contents of this file are subject to the Mozilla Public License
9 * Version 1.0 (the "License"); you may not use this file except in
10 * compliance with the License. You may obtain a copy of the License at
11 * http://www.mozilla.org/MPL/
13 * Software distributed under the License is distributed on an "AS IS"
14 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 * the License for the specific language governing rights and limitations
16 * under the License.
18 * Contributor(s): ______________________________________.
20 * $Log$
21 * Revision 1.2 2003/10/27 03:51:38 csoutheren
22 * Added ifdef to disable QoS code on systems that do not support it
24 * Revision 1.1 2003/10/27 03:20:10 csoutheren
25 * Initial version of QoS implementation
26 * Thanks to Henry Harrison of AliceStreet
31 #ifndef _PQOS
32 #define _PQOS
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
38 #if P_HAS_QOS
39 #ifdef _WIN32
40 #include <winsock2.h>
41 #include <Ws2tcpip.h>
42 #include <qossp.h>
43 #endif // _WIN32
44 #endif // P_HAS_QOS
46 #ifndef QOS_NOT_SPECIFIED
47 #define QOS_NOT_SPECIFIED 0xFFFFFFFF
48 #endif
50 #ifndef SERVICETYPE
51 #define SERVICETYPE DWORD
52 #endif
54 #ifndef SERVICETYPE_GUARANTEED
55 #define SERVICETYPE_GUARANTEED 0x00000003
56 #endif
58 #ifndef SERVICETYPE_CONTROLLEDLOAD
59 #define SERVICETYPE_CONTROLLEDLOAD 0x00000002
60 #endif
62 #ifndef SERVICETYPE_BESTEFFORT
63 #define SERVICETYPE_BESTEFFORT 0x00000001
64 #endif
66 #define SERVICETYPE_PNOTDEFINED 0xFFFFFFFF
68 class PQoS : public PObject
70 PCLASSINFO(PQoS, PObject);
72 public:
73 PQoS();
74 PQoS(DWORD avgBytesPerSec,
75 DWORD winServiceType,
76 int DSCPalternative = -1,
77 DWORD maxFrameBytes = 1500,
78 DWORD peakBytesPerSec = QOS_NOT_SPECIFIED);
79 PQoS(int DSCPvalue);
81 void SetAvgBytesPerSec(DWORD avgBytesPerSec);
82 void SetWinServiceType(DWORD winServiceType);
83 void SetDSCP(int DSCPvalue);
84 void SetMaxFrameBytes(DWORD maxFrameBytes);
85 void SetPeakBytesPerSec(DWORD peakBytesPerSec);
87 DWORD GetTokenRate() const { return tokenRate;}
88 DWORD GetTokenBucketSize() const { return tokenBucketSize;}
89 DWORD GetPeakBandwidth() const { return peakBandwidth;}
90 DWORD GetServiceType() const { return serviceType;}
91 int GetDSCP() const { return dscp;}
93 static void SetDSCPAlternative(DWORD winServiceType,
94 UINT dscp);
95 static char bestEffortDSCP;
96 static char controlledLoadDSCP;
97 static char guaranteedDSCP;
99 protected:
100 int dscp;
101 DWORD tokenRate;
102 DWORD tokenBucketSize;
103 DWORD peakBandwidth;
104 DWORD serviceType;
108 #endif // _PQOS