2 // System.Net.NetworkInformation.IPGlobalProperties
5 // Gonzalo Paniagua Javier (gonzalo@novell.com)
6 // Atsushi Enomoto (atsushi@ximian.com)
8 // Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 namespace System.Net.NetworkInformation {
31 public abstract class IPGlobalStatistics {
32 protected IPGlobalStatistics ()
36 public abstract int DefaultTtl { get; }
37 public abstract bool ForwardingEnabled { get; }
38 public abstract int NumberOfInterfaces { get; }
39 public abstract int NumberOfIPAddresses { get; }
40 public abstract int NumberOfRoutes { get; }
41 public abstract long OutputPacketRequests { get; }
42 public abstract long OutputPacketRoutingDiscards { get; }
43 public abstract long OutputPacketsDiscarded { get; }
44 public abstract long OutputPacketsWithNoRoute { get; }
45 public abstract long PacketFragmentFailures { get; }
46 public abstract long PacketReassembliesRequired { get; }
47 public abstract long PacketReassemblyFailures { get; }
48 public abstract long PacketReassemblyTimeout { get; }
49 public abstract long PacketsFragmented { get; }
50 public abstract long PacketsReassembled { get; }
51 public abstract long ReceivedPackets { get; }
52 public abstract long ReceivedPacketsDelivered { get; }
53 public abstract long ReceivedPacketsDiscarded { get; }
54 public abstract long ReceivedPacketsForwarded { get; }
55 public abstract long ReceivedPacketsWithAddressErrors { get; }
56 public abstract long ReceivedPacketsWithHeadersErrors { get; }
57 public abstract long ReceivedPacketsWithUnknownProtocol { get; }
60 class Win32IPGlobalStatistics : IPGlobalStatistics
62 Win32_MIB_IPSTATS info;
64 public Win32IPGlobalStatistics (Win32_MIB_IPSTATS info)
69 public override int DefaultTtl {
70 get { return info.DefaultTTL; }
72 public override bool ForwardingEnabled {
73 get { return info.Forwarding != 0; }
75 public override int NumberOfInterfaces {
76 get { return info.NumIf; }
78 public override int NumberOfIPAddresses {
79 get { return info.NumAddr; }
81 public override int NumberOfRoutes {
82 get { return info.NumRoutes; }
84 public override long OutputPacketRequests {
85 get { return info.OutRequests; }
87 public override long OutputPacketRoutingDiscards {
88 get { return info.RoutingDiscards; }
90 public override long OutputPacketsDiscarded {
91 get { return info.OutDiscards; }
93 public override long OutputPacketsWithNoRoute {
94 get { return info.OutNoRoutes; }
96 public override long PacketFragmentFailures {
97 get { return info.FragFails; }
99 public override long PacketReassembliesRequired {
100 get { return info.ReasmReqds; }
102 public override long PacketReassemblyFailures {
103 get { return info.ReasmFails; }
105 public override long PacketReassemblyTimeout {
106 get { return info.ReasmTimeout; }
108 public override long PacketsFragmented {
109 get { return info.FragOks; }
111 public override long PacketsReassembled {
112 get { return info.ReasmOks; }
114 public override long ReceivedPackets {
115 get { return info.InReceives; }
117 public override long ReceivedPacketsDelivered {
118 get { return info.InDelivers; }
120 public override long ReceivedPacketsDiscarded {
121 get { return info.InDiscards; }
123 public override long ReceivedPacketsForwarded {
124 get { return info.ForwDatagrams; }
126 public override long ReceivedPacketsWithAddressErrors {
127 get { return info.InAddrErrors; }
129 public override long ReceivedPacketsWithHeadersErrors {
130 get { return info.InHdrErrors; }
132 public override long ReceivedPacketsWithUnknownProtocol {
133 get { return info.InUnknownProtos; }
137 struct Win32_MIB_IPSTATS
139 public int Forwarding;
140 public int DefaultTTL;
141 public uint InReceives;
142 public uint InHdrErrors;
143 public uint InAddrErrors;
144 public uint ForwDatagrams;
145 public uint InUnknownProtos;
146 public uint InDiscards;
147 public uint InDelivers;
148 public uint OutRequests;
149 public uint RoutingDiscards;
150 public uint OutDiscards;
151 public uint OutNoRoutes;
152 public uint ReasmTimeout;
153 public uint ReasmReqds;
154 public uint ReasmOks;
155 public uint ReasmFails;
157 public uint FragFails;
158 public uint FragCreates;
161 public int NumRoutes;