1 | /**
|
---|
2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
3 | * This file is part of the mingw-w64 runtime package.
|
---|
4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
5 | */
|
---|
6 | #ifndef __TRAFFIC_H
|
---|
7 | #define __TRAFFIC_H
|
---|
8 |
|
---|
9 | #include <_mingw_unicode.h>
|
---|
10 | #include <ntddndis.h>
|
---|
11 |
|
---|
12 | #ifdef __cplusplus
|
---|
13 | extern "C" {
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #define CURRENT_TCI_VERSION 0x0002
|
---|
17 |
|
---|
18 | #define TC_NOTIFY_IFC_UP 1
|
---|
19 | #define TC_NOTIFY_IFC_CLOSE 2
|
---|
20 | #define TC_NOTIFY_IFC_CHANGE 3
|
---|
21 | #define TC_NOTIFY_PARAM_CHANGED 4
|
---|
22 | #define TC_NOTIFY_FLOW_CLOSE 5
|
---|
23 | #define TC_INVALID_HANDLE ((HANDLE)0)
|
---|
24 |
|
---|
25 | #define MAX_STRING_LENGTH 256
|
---|
26 |
|
---|
27 | #ifndef CALLBACK
|
---|
28 | #if defined(_ARM_)
|
---|
29 | #define CALLBACK
|
---|
30 | #else
|
---|
31 | #define CALLBACK __stdcall
|
---|
32 | #endif
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | #ifndef WINAPI
|
---|
36 | #if defined(_ARM_)
|
---|
37 | #define WINAPI
|
---|
38 | #else
|
---|
39 | #define WINAPI __stdcall
|
---|
40 | #endif
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #ifndef APIENTRY
|
---|
44 | #define APIENTRY WINAPI
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | typedef VOID (CALLBACK *TCI_NOTIFY_HANDLER)(HANDLE ClRegCtx,HANDLE ClIfcCtx,ULONG Event,HANDLE SubCode,ULONG BufSize,PVOID Buffer);
|
---|
48 | typedef VOID (CALLBACK *TCI_ADD_FLOW_COMPLETE_HANDLER)(HANDLE ClFlowCtx,ULONG Status);
|
---|
49 | typedef VOID (CALLBACK *TCI_MOD_FLOW_COMPLETE_HANDLER)(HANDLE ClFlowCtx,ULONG Status);
|
---|
50 | typedef VOID (CALLBACK *TCI_DEL_FLOW_COMPLETE_HANDLER)(HANDLE ClFlowCtx,ULONG Status);
|
---|
51 |
|
---|
52 | typedef struct _TCI_CLIENT_FUNC_LIST {
|
---|
53 | TCI_NOTIFY_HANDLER ClNotifyHandler;
|
---|
54 | TCI_ADD_FLOW_COMPLETE_HANDLER ClAddFlowCompleteHandler;
|
---|
55 | TCI_MOD_FLOW_COMPLETE_HANDLER ClModifyFlowCompleteHandler;
|
---|
56 | TCI_DEL_FLOW_COMPLETE_HANDLER ClDeleteFlowCompleteHandler;
|
---|
57 | } TCI_CLIENT_FUNC_LIST,*PTCI_CLIENT_FUNC_LIST;
|
---|
58 |
|
---|
59 | typedef struct _ADDRESS_LIST_DESCRIPTOR {
|
---|
60 | ULONG MediaType;
|
---|
61 | NETWORK_ADDRESS_LIST AddressList;
|
---|
62 | } ADDRESS_LIST_DESCRIPTOR,*PADDRESS_LIST_DESCRIPTOR;
|
---|
63 |
|
---|
64 | typedef struct _TC_IFC_DESCRIPTOR {
|
---|
65 | ULONG Length;
|
---|
66 | LPWSTR pInterfaceName;
|
---|
67 | LPWSTR pInterfaceID;
|
---|
68 | ADDRESS_LIST_DESCRIPTOR AddressListDesc;
|
---|
69 | } TC_IFC_DESCRIPTOR,*PTC_IFC_DESCRIPTOR;
|
---|
70 |
|
---|
71 | typedef struct _TC_SUPPORTED_INFO_BUFFER {
|
---|
72 | USHORT InstanceIDLength;
|
---|
73 | WCHAR InstanceID[MAX_STRING_LENGTH];
|
---|
74 | ADDRESS_LIST_DESCRIPTOR AddrListDesc;
|
---|
75 | } TC_SUPPORTED_INFO_BUFFER,*PTC_SUPPORTED_INFO_BUFFER;
|
---|
76 |
|
---|
77 | typedef struct _TC_GEN_FILTER {
|
---|
78 | USHORT AddressType;
|
---|
79 | ULONG PatternSize;
|
---|
80 | PVOID Pattern;
|
---|
81 | PVOID Mask;
|
---|
82 | } TC_GEN_FILTER,*PTC_GEN_FILTER;
|
---|
83 |
|
---|
84 | typedef struct _TC_GEN_FLOW {
|
---|
85 | FLOWSPEC SendingFlowspec;
|
---|
86 | FLOWSPEC ReceivingFlowspec;
|
---|
87 | ULONG TcObjectsLength;
|
---|
88 | QOS_OBJECT_HDR TcObjects[1];
|
---|
89 | } TC_GEN_FLOW,*PTC_GEN_FLOW;
|
---|
90 |
|
---|
91 | typedef struct _IP_PATTERN {
|
---|
92 | ULONG Reserved1;
|
---|
93 | ULONG Reserved2;
|
---|
94 | ULONG SrcAddr;
|
---|
95 | ULONG DstAddr;
|
---|
96 | union {
|
---|
97 | struct { USHORT s_srcport,s_dstport; } S_un_ports;
|
---|
98 | struct { UCHAR s_type,s_code; USHORT filler; } S_un_icmp;
|
---|
99 | ULONG S_Spi;
|
---|
100 | } S_un;
|
---|
101 | UCHAR ProtocolId;
|
---|
102 | UCHAR Reserved3[3];
|
---|
103 | } IP_PATTERN,*PIP_PATTERN;
|
---|
104 |
|
---|
105 | #define tcSrcPort S_un.S_un_ports.s_srcport
|
---|
106 | #define tcDstPort S_un.S_un_ports.s_dstport
|
---|
107 | #define tcIcmpType S_un.S_un_icmp.s_type
|
---|
108 | #define tcIcmpCode S_un.S_un_icmp.s_code
|
---|
109 | #define tcSpi S_un.S_Spi
|
---|
110 |
|
---|
111 | typedef struct _IPX_PATTERN {
|
---|
112 | struct {
|
---|
113 | ULONG NetworkAddress;
|
---|
114 | UCHAR NodeAddress[6];
|
---|
115 | USHORT Socket;
|
---|
116 | } Src,Dest;
|
---|
117 | } IPX_PATTERN,*PIPX_PATTERN;
|
---|
118 |
|
---|
119 | typedef struct _ENUMERATION_BUFFER {
|
---|
120 | ULONG Length;
|
---|
121 | ULONG OwnerProcessId;
|
---|
122 | USHORT FlowNameLength;
|
---|
123 | WCHAR FlowName[MAX_STRING_LENGTH];
|
---|
124 | PTC_GEN_FLOW pFlow;
|
---|
125 | ULONG NumberOfFilters;
|
---|
126 | TC_GEN_FILTER GenericFilter[1];
|
---|
127 | } ENUMERATION_BUFFER,*PENUMERATION_BUFFER;
|
---|
128 |
|
---|
129 | #define QOS_TRAFFIC_GENERAL_ID_BASE 4000
|
---|
130 | #define QOS_OBJECT_DS_CLASS (0x00000001 + QOS_TRAFFIC_GENERAL_ID_BASE)
|
---|
131 | #define QOS_OBJECT_TRAFFIC_CLASS (0x00000002 + QOS_TRAFFIC_GENERAL_ID_BASE)
|
---|
132 | #define QOS_OBJECT_DIFFSERV (0x00000003 + QOS_TRAFFIC_GENERAL_ID_BASE)
|
---|
133 | #define QOS_OBJECT_TCP_TRAFFIC (0x00000004 + QOS_TRAFFIC_GENERAL_ID_BASE)
|
---|
134 | #define QOS_OBJECT_FRIENDLY_NAME (0x00000005 + QOS_TRAFFIC_GENERAL_ID_BASE)
|
---|
135 |
|
---|
136 | typedef struct _QOS_FRIENDLY_NAME {
|
---|
137 | QOS_OBJECT_HDR ObjectHdr;
|
---|
138 | WCHAR FriendlyName[MAX_STRING_LENGTH];
|
---|
139 | } QOS_FRIENDLY_NAME,*LPQOS_FRIENDLY_NAME;
|
---|
140 |
|
---|
141 | typedef struct _QOS_TRAFFIC_CLASS {
|
---|
142 | QOS_OBJECT_HDR ObjectHdr;
|
---|
143 | ULONG TrafficClass;
|
---|
144 | } QOS_TRAFFIC_CLASS,*LPQOS_TRAFFIC_CLASS;
|
---|
145 |
|
---|
146 | typedef struct _QOS_DS_CLASS {
|
---|
147 | QOS_OBJECT_HDR ObjectHdr;
|
---|
148 | ULONG DSField;
|
---|
149 | } QOS_DS_CLASS,*LPQOS_DS_CLASS;
|
---|
150 |
|
---|
151 | typedef struct _QOS_DIFFSERV {
|
---|
152 | QOS_OBJECT_HDR ObjectHdr;
|
---|
153 | ULONG DSFieldCount;
|
---|
154 | UCHAR DiffservRule[1];
|
---|
155 | } QOS_DIFFSERV,*LPQOS_DIFFSERV;
|
---|
156 |
|
---|
157 | typedef struct _QOS_DIFFSERV_RULE {
|
---|
158 | UCHAR InboundDSField;
|
---|
159 | UCHAR ConformingOutboundDSField;
|
---|
160 | UCHAR NonConformingOutboundDSField;
|
---|
161 | UCHAR ConformingUserPriority;
|
---|
162 | UCHAR NonConformingUserPriority;
|
---|
163 | } QOS_DIFFSERV_RULE,*LPQOS_DIFFSERV_RULE;
|
---|
164 |
|
---|
165 | typedef struct _QOS_TCP_TRAFFIC {
|
---|
166 | QOS_OBJECT_HDR ObjectHdr;
|
---|
167 | } QOS_TCP_TRAFFIC,*LPQOS_TCP_TRAFFIC;
|
---|
168 |
|
---|
169 | #define TcOpenInterface __MINGW_NAME_AW(TcOpenInterface)
|
---|
170 | #define TcQueryFlow __MINGW_NAME_AW(TcQueryFlow)
|
---|
171 | #define TcSetFlow __MINGW_NAME_AW(TcSetFlow)
|
---|
172 | #define TcGetFlowName __MINGW_NAME_AW(TcGetFlowName)
|
---|
173 |
|
---|
174 | ULONG WINAPI TcRegisterClient(ULONG TciVersion,HANDLE ClRegCtx,PTCI_CLIENT_FUNC_LIST ClientHandlerList,PHANDLE pClientHandle);
|
---|
175 | ULONG WINAPI TcEnumerateInterfaces(HANDLE ClientHandle,PULONG pBufferSize,PTC_IFC_DESCRIPTOR InterfaceBuffer);
|
---|
176 | ULONG WINAPI TcOpenInterfaceA(LPSTR pInterfaceName,HANDLE ClientHandle,HANDLE ClIfcCtx,PHANDLE pIfcHandle);
|
---|
177 | ULONG WINAPI TcOpenInterfaceW(LPWSTR pInterfaceName,HANDLE ClientHandle,HANDLE ClIfcCtx,PHANDLE pIfcHandle);
|
---|
178 | ULONG WINAPI TcCloseInterface(HANDLE IfcHandle);
|
---|
179 | ULONG WINAPI TcQueryInterface(HANDLE IfcHandle,LPGUID pGuidParam,BOOLEAN NotifyChange,PULONG pBufferSize,PVOID Buffer);
|
---|
180 | ULONG WINAPI TcSetInterface(HANDLE IfcHandle,LPGUID pGuidParam,ULONG BufferSize,PVOID Buffer);
|
---|
181 | ULONG WINAPI TcQueryFlowA(LPSTR pFlowName,LPGUID pGuidParam,PULONG pBufferSize,PVOID Buffer);
|
---|
182 | ULONG WINAPI TcQueryFlowW(LPWSTR pFlowName,LPGUID pGuidParam,PULONG pBufferSize,PVOID Buffer);
|
---|
183 | ULONG WINAPI TcSetFlowA(LPSTR pFlowName,LPGUID pGuidParam,ULONG BufferSize,PVOID Buffer);
|
---|
184 | ULONG WINAPI TcSetFlowW(LPWSTR pFlowName,LPGUID pGuidParam,ULONG BufferSize,PVOID Buffer);
|
---|
185 | ULONG WINAPI TcAddFlow(HANDLE IfcHandle,HANDLE ClFlowCtx,ULONG Flags,PTC_GEN_FLOW pGenericFlow,PHANDLE pFlowHandle);
|
---|
186 | ULONG WINAPI TcGetFlowNameA(HANDLE FlowHandle,ULONG StrSize,LPSTR pFlowName);
|
---|
187 | ULONG WINAPI TcGetFlowNameW(HANDLE FlowHandle,ULONG StrSize,LPWSTR pFlowName);
|
---|
188 | ULONG WINAPI TcModifyFlow(HANDLE FlowHandle,PTC_GEN_FLOW pGenericFlow);
|
---|
189 | ULONG WINAPI TcAddFilter(HANDLE FlowHandle,PTC_GEN_FILTER pGenericFilter,PHANDLE pFilterHandle);
|
---|
190 | ULONG WINAPI TcDeregisterClient(HANDLE ClientHandle);
|
---|
191 | ULONG WINAPI TcDeleteFlow(HANDLE FlowHandle);
|
---|
192 | ULONG WINAPI TcDeleteFilter(HANDLE FilterHandle);
|
---|
193 | ULONG WINAPI TcEnumerateFlows(HANDLE IfcHandle,PHANDLE pEnumHandle,PULONG pFlowCount,PULONG pBufSize,PENUMERATION_BUFFER Buffer);
|
---|
194 |
|
---|
195 | #ifdef __cplusplus
|
---|
196 | }
|
---|
197 | #endif
|
---|
198 | #endif
|
---|