2007-08-27 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System / System.Net.NetworkInformation / IPGlobalStatistics.cs
1 //
2 // System.Net.NetworkInformation.IPGlobalProperties
3 //
4 // Authors:
5 //      Gonzalo Paniagua Javier (gonzalo@novell.com)
6 //      Atsushi Enomoto (atsushi@ximian.com)
7 //
8 // Copyright (c) 2006-2007 Novell, Inc. (http://www.novell.com)
9 //
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:
17 // 
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 // 
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.
28 //
29 #if NET_2_0
30 namespace System.Net.NetworkInformation {
31         public abstract class IPGlobalStatistics {
32                 protected IPGlobalStatistics ()
33                 {
34                 }
35
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; }
58         }
59
60         class Win32IPGlobalStatistics : IPGlobalStatistics 
61         {
62                 Win32_MIB_IPSTATS info;
63
64                 public Win32IPGlobalStatistics (Win32_MIB_IPSTATS info)
65                 {
66                         this.info = info;
67                 }
68
69                 public override int DefaultTtl {
70                         get { return info.DefaultTTL; }
71                 }
72                 public override bool ForwardingEnabled {
73                         get { return info.Forwarding != 0; }
74                 }
75                 public override int NumberOfInterfaces {
76                         get { return info.NumIf; }
77                 }
78                 public override int NumberOfIPAddresses {
79                         get { return info.NumAddr; }
80                 }
81                 public override int NumberOfRoutes {
82                         get { return info.NumRoutes; }
83                 }
84                 public override long OutputPacketRequests {
85                         get { return info.OutRequests; }
86                 }
87                 public override long OutputPacketRoutingDiscards {
88                         get { return info.RoutingDiscards; }
89                 }
90                 public override long OutputPacketsDiscarded {
91                         get { return info.OutDiscards; }
92                 }
93                 public override long OutputPacketsWithNoRoute {
94                         get { return info.OutNoRoutes; }
95                 }
96                 public override long PacketFragmentFailures {
97                         get { return info.FragFails; }
98                 }
99                 public override long PacketReassembliesRequired {
100                         get { return info.ReasmReqds; }
101                 }
102                 public override long PacketReassemblyFailures {
103                         get { return info.ReasmFails; }
104                 }
105                 public override long PacketReassemblyTimeout {
106                         get { return info.ReasmTimeout; }
107                 }
108                 public override long PacketsFragmented {
109                         get { return info.FragOks; }
110                 }
111                 public override long PacketsReassembled {
112                         get { return info.ReasmOks; }
113                 }
114                 public override long ReceivedPackets {
115                         get { return info.InReceives; }
116                 }
117                 public override long ReceivedPacketsDelivered {
118                         get { return info.InDelivers; }
119                 }
120                 public override long ReceivedPacketsDiscarded {
121                         get { return info.InDiscards; }
122                 }
123                 public override long ReceivedPacketsForwarded {
124                         get { return info.ForwDatagrams; }
125                 }
126                 public override long ReceivedPacketsWithAddressErrors {
127                         get { return info.InAddrErrors; }
128                 }
129                 public override long ReceivedPacketsWithHeadersErrors {
130                         get { return info.InHdrErrors; }
131                 }
132                 public override long ReceivedPacketsWithUnknownProtocol {
133                         get { return info.InUnknownProtos; }
134                 }
135         }
136
137         struct Win32_MIB_IPSTATS
138         {
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;
156                 public uint FragOks;
157                 public uint FragFails;
158                 public uint FragCreates;
159                 public int NumIf;
160                 public int NumAddr;
161                 public int NumRoutes;
162         }
163 }
164 #endif
165