1af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org/*
2af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *
4af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  Use of this source code is governed by a BSD-style license
5af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  that can be found in the LICENSE file in the root of the source
6af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  tree. An additional intellectual property rights grant can be found
7af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  in the file PATENTS.  All contributing project authors may
8af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
9af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org */
10af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
11af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#include "webrtc/test/channel_transport/traffic_control_win.h"
12af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
13af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#include <assert.h>
14af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
15af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org#include "webrtc/system_wrappers/interface/trace.h"
16af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
17af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgnamespace webrtc {
18af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgnamespace test {
19af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
20af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgTrafficControlWindows* TrafficControlWindows::instance = NULL;
2191cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.orguint32_t TrafficControlWindows::refCounter = 0;
22af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
2391cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.orgTrafficControlWindows::TrafficControlWindows(const int32_t id) : _id(id)
24af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
25af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
26af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
27af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgTrafficControlWindows* TrafficControlWindows::GetInstance(
2891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.org    const int32_t id)
29af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
30af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    if(instance != NULL)
31af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    {
32af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        WEBRTC_TRACE(
33af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            kTraceDebug,
34af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            kTraceTransport,
35af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            id,
36af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            "TrafficControlWindows - Returning already created object");
37af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        refCounter++;
38af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        return instance;
39af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    }
40af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
41af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    WEBRTC_TRACE(kTraceMemory, kTraceTransport, id,
42af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                 "TrafficControlWindows - Creating new object");
43af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance = new TrafficControlWindows(id);
44af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    if(instance == NULL)
45af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    {
46af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        WEBRTC_TRACE(kTraceMemory, kTraceTransport, id,
47af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                     "TrafficControlWindows - Error allocating memory");
48af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        return NULL;
49af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    }
50af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
51af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcRegister = NULL;
52af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcDeregister = NULL;
53af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
54af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcEnumerate = NULL;
55af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcOpenInterface = NULL;
56af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcCloseInterface = NULL;
57af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
58af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcAddFlow = NULL;
59af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcDeleteFlow = NULL;
60af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
61af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcAddFilter = NULL;
62af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcDeleteFilter = NULL;
63af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
64af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    HMODULE trafficLib = LoadLibrary(TEXT("traffic.dll"));
65af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    if(trafficLib == NULL)
66af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    {
67af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        WEBRTC_TRACE(
68af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            kTraceWarning,
69af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            kTraceTransport,
70af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            id,
71af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            "TrafficControlWindows - No QOS support, LoadLibrary returned NULL,\
72af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org last error: %d\n",
73af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            GetLastError());
74af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        delete instance;
75af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        instance = NULL;
76af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        return NULL;
77af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    }
78af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
79af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcRegister = (registerFn)GetProcAddress(trafficLib,
80af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                                      "TcRegisterClient");
81af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcDeregister = (deregisterFn)GetProcAddress(trafficLib,
82af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                                          "TcDeregisterClient");
83af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcEnumerate = (enumerateFn)GetProcAddress(
84af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        trafficLib,
85af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        "TcEnumerateInterfaces");
86af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcOpenInterface = (openInterfaceFn)GetProcAddress(
87af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        trafficLib,
88af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        "TcOpenInterfaceW");
89af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcCloseInterface = (closeInterfaceFn)GetProcAddress(
90af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        trafficLib,
91af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        "TcCloseInterface");
92af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcAddFlow = (flowAddFn)GetProcAddress(trafficLib,
93af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                                    "TcAddFlow");
94af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcDeleteFlow = (flowDeleteFn)GetProcAddress(trafficLib,
95af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                                          "TcDeleteFlow");
96af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
97af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcAddFilter = (filterAddFn)GetProcAddress(trafficLib,
98af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                                        "TcAddFilter");
99af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    instance->tcDeleteFilter = (filterDeleteFn)GetProcAddress(trafficLib,
100af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                                              "TcDeleteFilter");
101af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
102af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    if(instance->tcRegister       == NULL ||
103af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org       instance->tcDeregister     == NULL ||
104af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org       instance->tcEnumerate      == NULL ||
105af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org       instance->tcOpenInterface  == NULL ||
106af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org       instance->tcCloseInterface == NULL ||
107af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org       instance->tcAddFlow        == NULL ||
108af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org       instance->tcAddFilter      == NULL ||
109af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org       instance->tcDeleteFlow     == NULL ||
110af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org       instance->tcDeleteFilter   == NULL)
111af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    {
112af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        delete instance;
113af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        instance = NULL;
114af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        WEBRTC_TRACE(
115af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            kTraceError,
116af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            kTraceTransport,
117af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            id,
118af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            "TrafficControlWindows - Could not find function pointer for\
119af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org traffic control functions");
120af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        WEBRTC_TRACE(
121af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            kTraceError,
122af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            kTraceTransport,
123af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            id,
124af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            "Tcregister    : %x, tcDeregister: %x, tcEnumerate: %x,\
125af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org tcOpenInterface: %x, tcCloseInterface: %x, tcAddFlow: %x, tcAddFilter: %x,\
126af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org tcDeleteFlow: %x, tcDeleteFilter: %x",
127af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            instance->tcRegister,
128af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            instance->tcDeregister,
129af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            instance->tcEnumerate,
130af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            instance->tcOpenInterface,
131af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            instance->tcCloseInterface,
132af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            instance->tcAddFlow,
133af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            instance->tcAddFilter,
134af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            instance->tcDeleteFlow,
135af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org            instance->tcDeleteFilter );
136af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        return NULL;
137af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    }
138af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    refCounter++;
139af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return instance;
140af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
141af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
142af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgvoid TrafficControlWindows::Release(TrafficControlWindows* gtc)
143af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
144af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    if (0 == refCounter)
145af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    {
146af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        WEBRTC_TRACE(kTraceError, kTraceTransport, -1,
147af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                     "TrafficControlWindows - Cannot release, refCounter is 0");
148af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        return;
149af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    }
150af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    if (NULL == gtc)
151af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    {
152af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        WEBRTC_TRACE(kTraceDebug, kTraceTransport, -1,
153af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                     "TrafficControlWindows - Not releasing, gtc is NULL");
154af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        return;
155af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    }
156af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
157af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    WEBRTC_TRACE(kTraceDebug, kTraceTransport, gtc->_id,
158af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                 "TrafficControlWindows - Releasing object");
159af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    refCounter--;
160af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    if ((0 == refCounter) && instance)
161af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    {
162af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        WEBRTC_TRACE(kTraceMemory, kTraceTransport, gtc->_id,
163af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                     "TrafficControlWindows - Deleting object");
164af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        delete instance;
165af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org        instance = NULL;
166af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    }
167af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
16891cab7186d535be98c837285ce24918188e9c8c3pbos@webrtc.orgint32_t TrafficControlWindows::ChangeUniqueId(const int32_t id)
169af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
170af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    _id = id;
171af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return 0;
172af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
173af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
174af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgULONG TrafficControlWindows::TcRegisterClient(
175af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    ULONG TciVersion,
176af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    HANDLE ClRegCtx,
177af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    PTCI_CLIENT_FUNC_LIST ClientHandlerList,
178af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    PHANDLE pClientHandle)
179af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
180af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    assert(tcRegister != NULL);
181af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
182af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return tcRegister(TciVersion, ClRegCtx, ClientHandlerList, pClientHandle);
183af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
184af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
185af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgULONG TrafficControlWindows::TcDeregisterClient(HANDLE clientHandle)
186af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
187af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    assert(tcDeregister != NULL);
188af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
189af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return tcDeregister(clientHandle);
190af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
191af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
192af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
193af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgULONG TrafficControlWindows::TcEnumerateInterfaces(
194af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    HANDLE ClientHandle,
195af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    PULONG pBufferSize,
196af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    PTC_IFC_DESCRIPTOR interfaceBuffer)
197af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
198af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    assert(tcEnumerate != NULL);
199af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
200af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return tcEnumerate(ClientHandle, pBufferSize, interfaceBuffer);
201af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
202af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
203af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
204af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgULONG TrafficControlWindows::TcOpenInterfaceW(LPWSTR pInterfaceName,
205af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                              HANDLE ClientHandle,
206af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                              HANDLE ClIfcCtx,
207af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                              PHANDLE pIfcHandle)
208af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
209af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    assert(tcOpenInterface != NULL);
210af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
211af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return tcOpenInterface(pInterfaceName, ClientHandle, ClIfcCtx, pIfcHandle);
212af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
213af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
214af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
215af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgULONG TrafficControlWindows::TcCloseInterface(HANDLE IfcHandle)
216af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
217af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    assert(tcCloseInterface != NULL);
218af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
219af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return tcCloseInterface(IfcHandle);
220af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
221af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
222af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgULONG TrafficControlWindows::TcAddFlow(HANDLE IfcHandle, HANDLE ClFlowCtx,
223af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                       ULONG  Flags, PTC_GEN_FLOW pGenericFlow,
224af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                       PHANDLE pFlowHandle)
225af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
226af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    assert(tcAddFlow != NULL);
227af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return tcAddFlow(IfcHandle, ClFlowCtx, Flags, pGenericFlow, pFlowHandle);
228af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
229af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
230af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgULONG TrafficControlWindows::TcAddFilter(HANDLE FlowHandle,
231af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                         PTC_GEN_FILTER pGenericFilter,
232af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                                         PHANDLE pFilterHandle)
233af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
234af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    assert(tcAddFilter != NULL);
235af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return tcAddFilter(FlowHandle, pGenericFilter, pFilterHandle);
236af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
237af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
238af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgULONG TrafficControlWindows::TcDeleteFlow(HANDLE FlowHandle)
239af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
240af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    assert(tcDeleteFlow != NULL);
241af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return tcDeleteFlow(FlowHandle);
242af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
243af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
244af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
245af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgULONG TrafficControlWindows::TcDeleteFilter(HANDLE FilterHandle)
246af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
247af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    assert(tcDeleteFilter != NULL);
248af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org    return tcDeleteFilter(FilterHandle);
249af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
250af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
251af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.orgvoid MyClNotifyHandler(HANDLE ClRegCtx, HANDLE ClIfcCtx, ULONG Event,
252af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org                       HANDLE SubCode, ULONG BufSize, PVOID Buffer)
253af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org{
254af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}
255af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org
256af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}  // namespace test
257af6aa7b49ba5fbfd09f901ae15b5278121d10f6fpwestin@webrtc.org}  // namespace webrtc
258