Author: atsushi
Date: 2007-08-27 09:19:41 -0400 (Mon, 27 Aug 2007)
New Revision: 84875
Modified:
trunk/mcs/class/System/System.Net.NetworkInformation/ChangeLog
trunk/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs
trunk/mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs
trunk/mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs
trunk/mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs
trunk/mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs
trunk/mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs
Log:
2007-08-27 Atsushi Enomoto <[EMAIL PROTECTED]>
* IPGlobalProperties.cs, TcpStatistics.cs,
IPGlobalStatistics.cs, IcmpV4Statistics.cs,
IcmpV6Statistics.cs, UdpStatistics.cs :
and here is non-Windows version, based on /proc/net/snmp(6).
Modified: trunk/mcs/class/System/System.Net.NetworkInformation/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net.NetworkInformation/ChangeLog
2007-08-27 13:15:51 UTC (rev 84874)
+++ trunk/mcs/class/System/System.Net.NetworkInformation/ChangeLog
2007-08-27 13:19:41 UTC (rev 84875)
@@ -1,5 +1,12 @@
2007-08-27 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * IPGlobalProperties.cs, TcpStatistics.cs,
+ IPGlobalStatistics.cs, IcmpV4Statistics.cs,
+ IcmpV6Statistics.cs, UdpStatistics.cs :
+ and here is non-Windows version, based on /proc/net/snmp(6).
+
+2007-08-27 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* IPGlobalProperties.cs, TcpConnectionInformation.cs,
TcpStatistics.cs, IPGlobalStatistics.cs, IcmpV4Statistics.cs,
IcmpV6Statistics.cs, UdpStatistics.cs :
Modified:
trunk/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs
===================================================================
--- trunk/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs
2007-08-27 13:15:51 UTC (rev 84874)
+++ trunk/mcs/class/System/System.Net.NetworkInformation/IPGlobalProperties.cs
2007-08-27 13:19:41 UTC (rev 84875)
@@ -27,8 +27,11 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
+using System.Collections.Specialized;
+using System.IO;
using System.Net.Sockets;
using System.Runtime.InteropServices;
+using System.Text;
namespace System.Net.NetworkInformation {
public abstract class IPGlobalProperties {
@@ -41,7 +44,9 @@
{
switch (Environment.OSVersion.Platform) {
case PlatformID.Unix:
- throw new NotImplementedException ();
+ if (File.Exists
(MibIPGlobalProperties.StatisticsFile))
+ return new MibIPGlobalProperties ();
+ throw new NotSupportedException ("This platform
is not supported");
default:
return new Win32IPGlobalProperties ();
}
@@ -66,6 +71,162 @@
public abstract NetBiosNodeType NodeType { get; }
}
+ // It expects /proc/net/snmp file formattes as:
+ // http://www.linuxdevcenter.com/linux/2000/11/16/example5.html
+ class MibIPGlobalProperties : IPGlobalProperties
+ {
+ public const string StatisticsFile = "/proc/net/snmp";
+ public const string StatisticsFileIPv6 = "/proc/net/snmp6";
+
+ StringDictionary GetProperties4 (string item)
+ {
+ string file = StatisticsFile;
+
+ string head = item + ": ";
+ using (StreamReader sr = new StreamReader (file,
Encoding.ASCII)) {
+ string [] keys = null;
+ string [] values = null;
+ string s = String.Empty;
+ do {
+ s = sr.ReadLine ();
+ if (String.IsNullOrEmpty (s))
+ continue;
+ if (s.Length <= head.Length ||
String.CompareOrdinal (s, 0, head, 0, head.Length) != 0)
+ continue;
+ if (keys == null)
+ keys = s.Substring
(head.Length).Split (' ');
+ else if (values != null)
+ // hmm, there may be better
error type...
+ throw CreateException (file,
String.Format ("Found duplicate line for values for the same item '{0}'",
item));
+ else {
+ values = s.Substring
(head.Length).Split (' ');
+ break;
+ }
+ } while (!sr.EndOfStream);
+
+ if (values == null)
+ throw CreateException (file,
String.Format ("No corresponding line was not found for '{0}'", item));
+ if (keys.Length != values.Length)
+ throw CreateException (file,
String.Format ("The counts in the header line and the value line do not match
for '{0}'", item));
+ StringDictionary dic = new StringDictionary ();
+ for (int i = 0; i < keys.Length; i++)
+ dic [keys [i]] = values [i];
+ return dic;
+ }
+ }
+
+ StringDictionary GetProperties6 (string item)
+ {
+ if (!File.Exists (StatisticsFileIPv6))
+ throw new NetworkInformationException ();
+
+ string file = StatisticsFileIPv6;
+
+ string head = item;
+ using (StreamReader sr = new StreamReader (file,
Encoding.ASCII)) {
+ StringDictionary dic = new StringDictionary ();
+ string s = String.Empty;
+ do {
+ s = sr.ReadLine ();
+ if (String.IsNullOrEmpty (s))
+ continue;
+ if (s.Length <= head.Length ||
String.CompareOrdinal (s, 0, head, 0, head.Length) != 0)
+ continue;
+ int idx = s.IndexOfAny (wsChars,
head.Length);
+ if (idx < 0)
+ throw CreateException (file,
null);
+ dic [s.Substring (head.Length, idx -
head.Length)] = s.Substring (idx + 1).Trim (wsChars);
+ } while (!sr.EndOfStream);
+
+ return dic;
+ }
+ }
+
+ static readonly char [] wsChars = new char [] {' ', '\t'};
+
+ Exception CreateException (string file, string msg)
+ {
+ return new InvalidOperationException (String.Format
("Unsupported (unexpected) '{0}' file format. ", file) + msg);
+ }
+
+ public override TcpConnectionInformation []
GetActiveTcpConnections ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override IPEndPoint [] GetActiveTcpListeners ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override IPEndPoint [] GetActiveUdpListeners ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override IcmpV4Statistics GetIcmpV4Statistics ()
+ {
+ return new MibIcmpV4Statistics (GetProperties4
("Icmp"));
+ }
+
+ public override IcmpV6Statistics GetIcmpV6Statistics ()
+ {
+ return new MibIcmpV6Statistics (GetProperties6
("Icmp6"));
+ }
+
+ public override IPGlobalStatistics GetIPv4GlobalStatistics ()
+ {
+ return new MibIPGlobalStatistics (GetProperties4
("Ip"));
+ }
+
+ public override IPGlobalStatistics GetIPv6GlobalStatistics ()
+ {
+ return new MibIPGlobalStatistics (GetProperties6
("Ip6"));
+ }
+
+ public override TcpStatistics GetTcpIPv4Statistics ()
+ {
+ return new MibTcpStatistics (GetProperties4 ("Tcp"));
+ }
+
+ public override TcpStatistics GetTcpIPv6Statistics ()
+ {
+ // There is no TCP info in /proc/net/snmp,
+ // so it is shared with IPv4 info.
+ return new MibTcpStatistics (GetProperties4 ("Tcp"));
+ }
+
+ public override UdpStatistics GetUdpIPv4Statistics ()
+ {
+ return new MibUdpStatistics (GetProperties4 ("Udp"));
+ }
+
+ public override UdpStatistics GetUdpIPv6Statistics ()
+ {
+ return new MibUdpStatistics (GetProperties6 ("Udp6"));
+ }
+
+ public override string DhcpScopeName {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string DomainName {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override string HostName {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override bool IsWinsProxy {
+ get { throw new NotImplementedException (); }
+ }
+
+ public override NetBiosNodeType NodeType {
+ get { throw new NotImplementedException (); }
+ }
+ }
+
class Win32IPGlobalProperties : IPGlobalProperties
{
public const int AF_INET = 2;
@@ -404,7 +565,6 @@
get { return new IPEndPoint (new IPAddress
(LocalAddr.Bytes, LocalScopeId), LocalPort); }
}
}
-
}
}
#endif
Modified:
trunk/mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs
===================================================================
--- trunk/mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs
2007-08-27 13:15:51 UTC (rev 84874)
+++ trunk/mcs/class/System/System.Net.NetworkInformation/IPGlobalStatistics.cs
2007-08-27 13:19:41 UTC (rev 84875)
@@ -27,6 +27,9 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
+using System.Collections.Specialized;
+using System.Globalization;
+
namespace System.Net.NetworkInformation {
public abstract class IPGlobalStatistics {
protected IPGlobalStatistics ()
@@ -57,6 +60,88 @@
public abstract long ReceivedPacketsWithUnknownProtocol { get; }
}
+ public class MibIPGlobalStatistics : IPGlobalStatistics
+ {
+ StringDictionary dic;
+
+ public MibIPGlobalStatistics (StringDictionary dic)
+ {
+ this.dic = dic;
+ }
+
+ long Get (string name)
+ {
+ return dic [name] != null ? long.Parse (dic [name],
NumberFormatInfo.InvariantInfo) : 0;
+ }
+
+ public override int DefaultTtl {
+ get { return (int) Get ("DefaultTTL"); }
+ }
+ public override bool ForwardingEnabled {
+ get { return Get ("Forwarding") != 0; }
+ }
+ public override int NumberOfInterfaces {
+ get { return (int) Get ("NumIf"); }
+ }
+ public override int NumberOfIPAddresses {
+ get { return (int) Get ("NumAddr"); }
+ }
+ public override int NumberOfRoutes {
+ get { return (int) Get ("NumRoutes"); }
+ }
+ public override long OutputPacketRequests {
+ get { return Get ("OutRequests"); }
+ }
+ public override long OutputPacketRoutingDiscards {
+ get { return Get ("RoutingDiscards"); }
+ }
+ public override long OutputPacketsDiscarded {
+ get { return Get ("OutDiscards"); }
+ }
+ public override long OutputPacketsWithNoRoute {
+ get { return Get ("OutNoRoutes"); }
+ }
+ public override long PacketFragmentFailures {
+ get { return Get ("FragFails"); }
+ }
+ public override long PacketReassembliesRequired {
+ get { return Get ("ReasmReqds"); }
+ }
+ public override long PacketReassemblyFailures {
+ get { return Get ("ReasmFails"); }
+ }
+ public override long PacketReassemblyTimeout {
+ get { return Get ("ReasmTimeout"); }
+ }
+ public override long PacketsFragmented {
+ get { return Get ("FragOks"); }
+ }
+ public override long PacketsReassembled {
+ get { return Get ("ReasmOks"); }
+ }
+ public override long ReceivedPackets {
+ get { return Get ("InReceives"); }
+ }
+ public override long ReceivedPacketsDelivered {
+ get { return Get ("InDelivers"); }
+ }
+ public override long ReceivedPacketsDiscarded {
+ get { return Get ("InDiscards"); }
+ }
+ public override long ReceivedPacketsForwarded {
+ get { return Get ("ForwDatagrams"); }
+ }
+ public override long ReceivedPacketsWithAddressErrors {
+ get { return Get ("InAddrErrors"); }
+ }
+ public override long ReceivedPacketsWithHeadersErrors {
+ get { return Get ("InHdrErrors"); }
+ }
+ public override long ReceivedPacketsWithUnknownProtocol {
+ get { return Get ("InUnknownProtos"); }
+ }
+ }
+
class Win32IPGlobalStatistics : IPGlobalStatistics
{
Win32_MIB_IPSTATS info;
Modified:
trunk/mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs
===================================================================
--- trunk/mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs
2007-08-27 13:15:51 UTC (rev 84874)
+++ trunk/mcs/class/System/System.Net.NetworkInformation/IcmpV4Statistics.cs
2007-08-27 13:19:41 UTC (rev 84875)
@@ -27,6 +27,9 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
+using System.Collections.Specialized;
+using System.Globalization;
+
namespace System.Net.NetworkInformation {
public abstract class IcmpV4Statistics {
protected IcmpV4Statistics ()
@@ -61,6 +64,100 @@
public abstract long TimestampRequestsSent { get; }
}
+ class MibIcmpV4Statistics : IcmpV4Statistics
+ {
+ StringDictionary dic;
+
+ public MibIcmpV4Statistics (StringDictionary dic)
+ {
+ this.dic = dic;
+ }
+
+ long Get (string name)
+ {
+ return dic [name] != null ? long.Parse (dic [name],
NumberFormatInfo.InvariantInfo) : 0;
+ }
+
+ public override long AddressMaskRepliesReceived {
+ get { return Get ("InAddrMaskReps"); }
+ }
+ public override long AddressMaskRepliesSent {
+ get { return Get ("OutAddrMaskReps"); }
+ }
+ public override long AddressMaskRequestsReceived {
+ get { return Get ("InAddrMasks"); }
+ }
+ public override long AddressMaskRequestsSent {
+ get { return Get ("OutAddrMasks"); }
+ }
+ public override long DestinationUnreachableMessagesReceived {
+ get { return Get ("InDestUnreachs"); }
+ }
+ public override long DestinationUnreachableMessagesSent {
+ get { return Get ("OutDestUnreachs"); }
+ }
+ public override long EchoRepliesReceived {
+ get { return Get ("InEchoReps"); }
+ }
+ public override long EchoRepliesSent {
+ get { return Get ("OutEchoReps"); }
+ }
+ public override long EchoRequestsReceived {
+ get { return Get ("InEchos"); }
+ }
+ public override long EchoRequestsSent {
+ get { return Get ("OutEchos"); }
+ }
+ public override long ErrorsReceived {
+ get { return Get ("InErrors"); }
+ }
+ public override long ErrorsSent {
+ get { return Get ("OutErrors"); }
+ }
+ public override long MessagesReceived {
+ get { return Get ("InMsgs"); }
+ }
+ public override long MessagesSent {
+ get { return Get ("OutMsgs"); }
+ }
+ public override long ParameterProblemsReceived {
+ get { return Get ("InParmProbs"); }
+ }
+ public override long ParameterProblemsSent {
+ get { return Get ("OutParmProbs"); }
+ }
+ public override long RedirectsReceived {
+ get { return Get ("InRedirects"); }
+ }
+ public override long RedirectsSent {
+ get { return Get ("OutRedirects"); }
+ }
+ public override long SourceQuenchesReceived {
+ get { return Get ("InSrcQuenchs"); }
+ }
+ public override long SourceQuenchesSent {
+ get { return Get ("OutSrcQuenchs"); }
+ }
+ public override long TimeExceededMessagesReceived {
+ get { return Get ("InTimeExcds"); }
+ }
+ public override long TimeExceededMessagesSent {
+ get { return Get ("OutTimeExcds"); }
+ }
+ public override long TimestampRepliesReceived {
+ get { return Get ("InTimestampReps"); }
+ }
+ public override long TimestampRepliesSent {
+ get { return Get ("OutTimestampReps"); }
+ }
+ public override long TimestampRequestsReceived {
+ get { return Get ("InTimestamps"); }
+ }
+ public override long TimestampRequestsSent {
+ get { return Get ("OutTimestamps"); }
+ }
+ }
+
class Win32IcmpV4Statistics : IcmpV4Statistics
{
Win32_MIBICMPSTATS iin, iout;
Modified:
trunk/mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs
===================================================================
--- trunk/mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs
2007-08-27 13:15:51 UTC (rev 84874)
+++ trunk/mcs/class/System/System.Net.NetworkInformation/IcmpV6Statistics.cs
2007-08-27 13:19:41 UTC (rev 84875)
@@ -27,6 +27,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
+using System.Collections.Specialized;
+using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
@@ -69,6 +71,118 @@
public abstract long TimeExceededMessagesSent { get; }
}
+ class MibIcmpV6Statistics : IcmpV6Statistics
+ {
+ StringDictionary dic;
+
+ public MibIcmpV6Statistics (StringDictionary dic)
+ {
+ this.dic = dic;
+ }
+
+ long Get (string name)
+ {
+ return dic [name] != null ? long.Parse (dic [name],
NumberFormatInfo.InvariantInfo) : 0;
+ }
+
+ public override long DestinationUnreachableMessagesReceived {
+ get { return Get ("InDestUnreachs"); }
+ }
+ public override long DestinationUnreachableMessagesSent {
+ get { return Get ("OutDestUnreachs"); }
+ }
+ public override long EchoRepliesReceived {
+ get { return Get ("InEchoReplies"); }
+ }
+ public override long EchoRepliesSent {
+ get { return Get ("OutEchoReplies"); }
+ }
+ public override long EchoRequestsReceived {
+ get { return Get ("InEchos"); }
+ }
+ public override long EchoRequestsSent {
+ get { return Get ("OutEchos"); }
+ }
+ public override long ErrorsReceived {
+ get { return Get ("InErrors"); }
+ }
+ public override long ErrorsSent {
+ get { return Get ("OutErrors"); }
+ }
+ public override long MembershipQueriesReceived {
+ get { return Get ("InGroupMembQueries"); }
+ }
+ public override long MembershipQueriesSent {
+ get { return Get ("OutGroupMembQueries"); }
+ }
+ public override long MembershipReductionsReceived {
+ get { return Get ("InGroupMembReductiions"); }
+ }
+ public override long MembershipReductionsSent {
+ get { return Get ("OutGroupMembReductiions"); }
+ }
+ public override long MembershipReportsReceived {
+ get { return Get ("InGroupMembRespons"); }
+ }
+ public override long MembershipReportsSent {
+ get { return Get ("OutGroupMembRespons"); }
+ }
+ public override long MessagesReceived {
+ get { return Get ("InMsgs"); }
+ }
+ public override long MessagesSent {
+ get { return Get ("OutMsgs"); }
+ }
+ public override long NeighborAdvertisementsReceived {
+ get { return Get ("InNeighborAdvertisements"); }
+ }
+ public override long NeighborAdvertisementsSent {
+ get { return Get ("OutNeighborAdvertisements"); }
+ }
+ public override long NeighborSolicitsReceived {
+ get { return Get ("InNeighborSolicits"); }
+ }
+ public override long NeighborSolicitsSent {
+ get { return Get ("OutNeighborSolicits"); }
+ }
+ public override long PacketTooBigMessagesReceived {
+ get { return Get ("InPktTooBigs"); }
+ }
+ public override long PacketTooBigMessagesSent {
+ get { return Get ("OutPktTooBigs"); }
+ }
+ public override long ParameterProblemsReceived {
+ get { return Get ("InParmProblems"); }
+ }
+ public override long ParameterProblemsSent {
+ get { return Get ("OutParmProblems"); }
+ }
+ public override long RedirectsReceived {
+ get { return Get ("InRedirects"); }
+ }
+ public override long RedirectsSent {
+ get { return Get ("OutRedirects"); }
+ }
+ public override long RouterAdvertisementsReceived {
+ get { return Get ("InRouterAdvertisements"); }
+ }
+ public override long RouterAdvertisementsSent {
+ get { return Get ("OutRouterAdvertisements"); }
+ }
+ public override long RouterSolicitsReceived {
+ get { return Get ("InRouterSolicits"); }
+ }
+ public override long RouterSolicitsSent {
+ get { return Get ("OutRouterSolicits"); }
+ }
+ public override long TimeExceededMessagesReceived {
+ get { return Get ("InTimeExcds"); }
+ }
+ public override long TimeExceededMessagesSent {
+ get { return Get ("OutTimeExcds"); }
+ }
+ }
+
class IcmpV6MessageTypes
{
public const int DestinationUnreachable = 1;
Modified: trunk/mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs
===================================================================
--- trunk/mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs
2007-08-27 13:15:51 UTC (rev 84874)
+++ trunk/mcs/class/System/System.Net.NetworkInformation/TcpStatistics.cs
2007-08-27 13:19:41 UTC (rev 84875)
@@ -27,6 +27,9 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
+using System.Collections.Specialized;
+using System.Globalization;
+
namespace System.Net.NetworkInformation {
public abstract class TcpStatistics {
protected TcpStatistics ()
@@ -49,6 +52,64 @@
public abstract long SegmentsSent { get; }
}
+ class MibTcpStatistics : TcpStatistics
+ {
+ StringDictionary dic;
+
+ public MibTcpStatistics (StringDictionary dic)
+ {
+ this.dic = dic;
+ }
+
+ long Get (string name)
+ {
+ return dic [name] != null ? long.Parse (dic [name],
NumberFormatInfo.InvariantInfo) : 0;
+ }
+
+ public override long ConnectionsAccepted {
+ get { return Get ("PassiveOpens"); }
+ }
+ public override long ConnectionsInitiated {
+ get { return Get ("ActiveOpens"); }
+ }
+ public override long CumulativeConnections {
+ get { return Get ("NumConns"); }
+ }
+ public override long CurrentConnections {
+ get { return Get ("CurrEstab"); }
+ }
+ public override long ErrorsReceived {
+ get { return Get ("InErrs"); }
+ }
+ public override long FailedConnectionAttempts {
+ get { return Get ("AttemptFails"); }
+ }
+ public override long MaximumConnections {
+ get { return Get ("MaxConn"); }
+ }
+ public override long MaximumTransmissionTimeout {
+ get { return Get ("RtoMax"); }
+ }
+ public override long MinimumTransmissionTimeout {
+ get { return Get ("RtoMin"); }
+ }
+ public override long ResetConnections {
+ get { return Get ("EstabResets"); }
+ }
+ public override long ResetsSent {
+ get { return Get ("OutRsts"); }
+ }
+ public override long SegmentsReceived {
+ get { return Get ("InSegs"); }
+ }
+ public override long SegmentsResent {
+ get { return Get ("RetransSegs"); }
+ }
+ public override long SegmentsSent {
+ get { return Get ("OutSegs"); }
+ }
+ }
+
class Win32TcpStatistics : TcpStatistics
{
Win32_MIB_TCPSTATS info;
Modified: trunk/mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs
===================================================================
--- trunk/mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs
2007-08-27 13:15:51 UTC (rev 84874)
+++ trunk/mcs/class/System/System.Net.NetworkInformation/UdpStatistics.cs
2007-08-27 13:19:41 UTC (rev 84875)
@@ -27,6 +27,9 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
+using System.Collections.Specialized;
+using System.Globalization;
+
namespace System.Net.NetworkInformation {
public abstract class UdpStatistics {
protected UdpStatistics ()
@@ -40,6 +43,37 @@
public abstract int UdpListeners { get; }
}
+ class MibUdpStatistics : UdpStatistics
+ {
+ StringDictionary dic;
+
+ public MibUdpStatistics (StringDictionary dic)
+ {
+ this.dic = dic;
+ }
+
+ long Get (string name)
+ {
+ return dic [name] != null ? long.Parse (dic [name],
NumberFormatInfo.InvariantInfo) : 0;
+ }
+
+ public override long DatagramsReceived {
+ get { return Get ("InDatagrams"); }
+ }
+ public override long DatagramsSent {
+ get { return Get ("OutDatagrams"); }
+ }
+ public override long IncomingDatagramsDiscarded {
+ get { return Get ("NoPorts"); }
+ }
+ public override long IncomingDatagramsWithErrors {
+ get { return Get ("InErrors"); }
+ }
+ public override int UdpListeners {
+ get { return (int) Get ("NumAddrs"); }
+ }
+ }
+
class Win32UdpStatistics : UdpStatistics
{
Win32_MIB_UDPSTATS info;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches