Reactos
1/* ipstats.h
2 * Copyright (C) 2003 Juan Lang
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 * This module implements functions shared by DLLs that need to get network-
19 * related statistics. It's meant to hide some platform-specificisms, and
20 * share code that was previously duplicated.
21 */
22#ifndef WINE_IPSTATS_H_
23#define WINE_IPSTATS_H_
24
25//#include <stdarg.h>
26
27//#include "windef.h"
28//#include "winbase.h"
29//#include "iprtrmib.h"
30
31/* Fills in entry's interface stats, using name to find them.
32 * Returns ERROR_INVALID_PARAMETER if name or entry is NULL, NO_ERROR otherwise.
33 */
34DWORD getInterfaceStatsByName(const char *name, PMIB_IFROW entry);
35
36/* Ditto above by index. */
37DWORD getInterfaceStatsByIndex(DWORD index, PMIB_IFROW entry);
38
39/* Gets ICMP statistics into stats. Returns ERROR_INVALID_PARAMETER if stats is
40 * NULL, NO_ERROR otherwise.
41 */
42DWORD getICMPStats(MIB_ICMP *stats);
43
44/* Gets IP statistics into stats. Returns ERROR_INVALID_PARAMETER if stats is
45 * NULL, NO_ERROR otherwise.
46 */
47DWORD getIPStats(HANDLE tcpFile, PMIB_IPSTATS stats);
48
49/* Gets TCP statistics into stats. Returns ERROR_INVALID_PARAMETER if stats is
50 * NULL, NO_ERROR otherwise.
51 */
52DWORD getTCPStats(HANDLE tcpFile, MIB_TCPSTATS *stats);
53
54/* Gets UDP statistics into stats. Returns ERROR_INVALID_PARAMETER if stats is
55 * NULL, NO_ERROR otherwise.
56 */
57DWORD getUDPStats(HANDLE tcpFile, MIB_UDPSTATS *stats);
58
59/* Route table functions */
60
61DWORD getNumRoutes(void);
62
63/* Minimalist route entry, only has the fields I can actually fill in. How
64 * these map to the different windows route data structures is up to you.
65 */
66typedef struct _RouteEntry {
67 DWORD dest;
68 DWORD mask;
69 DWORD gateway;
70 DWORD ifIndex;
71 DWORD metric;
72} RouteEntry;
73
74typedef struct _RouteTable {
75 DWORD numRoutes;
76 RouteEntry routes[1];
77} RouteTable;
78
79typedef enum _CLASS_TABLE {
80 ClassBasic,
81 ClassModulePid,
82 ClassModule
83} CLASS_TABLE;
84
85/* Allocates and returns to you the route table, or NULL if it can't allocate
86 * enough memory. HeapFree() the returned table.
87 */
88RouteTable *getRouteTable(void);
89
90/* Returns the number of entries in the arp table. */
91DWORD getNumArpEntries(void);
92
93/* Allocates and returns to you the arp table, or NULL if it can't allocate
94 * enough memory. HeapFree() the returned table.
95 */
96PMIB_IPNETTABLE getArpTable(void);
97
98/* Returns the number of entries in the UDP state table. */
99DWORD getNumUdpEntries(void);
100
101/* Allocates and returns to you the UDP state table, or NULL if it can't
102 * allocate enough memory. HeapFree() the returned table.
103 */
104PVOID getUdpTable(CLASS_TABLE Class);
105
106/* Returns the number of entries in the TCP state table. */
107DWORD getNumTcpEntries(void);
108
109/* Allocates and returns to you the TCP state table, or NULL if it can't
110 * allocate enough memory. HeapFree() the returned table.
111 */
112PVOID getTcpTable(CLASS_TABLE Class);
113
114#endif /* ndef WINE_IPSTATS_H_ */