<> <> <> <> DIRECTORY Driver USING [GetNetworkChain, Network, Type], EthernetDriverStats USING [EtherStats]; EthernetDriverStatsImpl: CEDAR PROGRAM IMPORTS Driver EXPORTS EthernetDriverStats = { Network: TYPE = Driver.Network; GetEthernetConfig: PUBLIC PROC RETURNS [instances: NAT _ 0] = { <> FOR network: Network _ Driver.GetNetworkChain[], network.next UNTIL network = NIL DO IF network.type = ethernet THEN instances _ instances + 1; ENDLOOP; }; GetEthernetOneConfig: PUBLIC PROC RETURNS [instances: NAT _ 0] = { <> FOR network: Network _ Driver.GetNetworkChain[], network.next UNTIL network = NIL DO IF network.type = ethernetOne THEN instances _ instances + 1; ENDLOOP; }; GetEthernetStats: PUBLIC PROC [instance: NAT] RETURNS [stats: EthernetDriverStats.EtherStats _ NIL] = { <<... returns the EtherStats object for the given instance of the Xerox research Ethernet driver. Note that these numbers are not monitor protected, so be prepared for strange results every so often. NIL will be returned for invalid instances.>> network: Network _ GetNthDeviceLikeMe[ethernet, instance]; IF network # NIL THEN stats _ NARROW[network.stats]; }; <<>> GetEthernetOneStats: PUBLIC PROC [instance: NAT] RETURNS [stats: EthernetDriverStats.EtherStats _ NIL] = { <<... returns the EtherStats object for the given instance of the Xerox research Ethernet driver. Note that these numbers are not monitor protected, so be prepared for strange results every so often. NIL will be returned for invalid instances.>> network: Network _ GetNthDeviceLikeMe[ethernetOne, instance]; IF network # NIL THEN stats _ NARROW[network.stats]; }; <<>> GetNthDeviceLikeMe: PROC [type: Driver.Type, physicalOrder: NAT] RETURNS [Network] = { i: NAT _ 0; FOR network: Network _ Driver.GetNetworkChain[], network.next UNTIL network = NIL DO IF network.type = type THEN { IF i = physicalOrder THEN RETURN[network]; i _ i + 1; } ENDLOOP; RETURN[NIL]; }; }.