Sync with trunk head
[reactos.git] / dll / win32 / iphlpapi / ipstats.h
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 */
34 DWORD getInterfaceStatsByName(const char *name, PMIB_IFROW entry);
35
36 /* Ditto above by index. */
37 DWORD 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 */
42 DWORD getICMPStats(MIB_ICMP *stats);
43
44 /* Gets IP statistics into stats. Returns ERROR_INVALID_PARAMETER if stats is
45 * NULL, NO_ERROR otherwise.
46 */
47 DWORD getIPStats(PMIB_IPSTATS stats, DWORD family);
48
49 /* Gets TCP statistics into stats. Returns ERROR_INVALID_PARAMETER if stats is
50 * NULL, NO_ERROR otherwise.
51 */
52 DWORD getTCPStats(MIB_TCPSTATS *stats, DWORD family);
53
54 /* Gets UDP statistics into stats. Returns ERROR_INVALID_PARAMETER if stats is
55 * NULL, NO_ERROR otherwise.
56 */
57 DWORD getUDPStats(MIB_UDPSTATS *stats, DWORD family);
58
59 /* Route table functions */
60
61 DWORD 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 */
66 typedef struct _RouteEntry {
67 DWORD dest;
68 DWORD mask;
69 DWORD gateway;
70 DWORD ifIndex;
71 DWORD metric;
72 } RouteEntry;
73
74 typedef struct _RouteTable {
75 DWORD numRoutes;
76 RouteEntry routes[1];
77 } RouteTable;
78
79 /* Allocates and returns to you the route table, or NULL if it can't allocate
80 * enough memory. free() the returned table.
81 */
82 RouteTable *getRouteTable(void);
83
84 /* Returns the number of entries in the arp table. */
85 DWORD getNumArpEntries(void);
86
87 /* Allocates and returns to you the arp table, or NULL if it can't allocate
88 * enough memory. free() the returned table.
89 */
90 PMIB_IPNETTABLE getArpTable(void);
91
92 /* Returns the number of entries in the UDP state table. */
93 DWORD getNumUdpEntries(void);
94
95 /* Allocates and returns to you the UDP state table, or NULL if it can't
96 * allocate enough memory. free() the returned table.
97 */
98 PMIB_UDPTABLE getUdpTable(void);
99
100 /* Returns the number of entries in the TCP state table. */
101 DWORD getNumTcpEntries(void);
102
103 /* Allocates and returns to you the TCP state table, or NULL if it can't
104 * allocate enough memory. free() the returned table.
105 */
106 PMIB_TCPTABLE getTcpTable(void);
107
108 #endif /* ndef WINE_IPSTATS_H_ */