using System; using System.Collections.Generic; sealed class Recurse_Exception : Exception {} struct Sampler // For BadID count, which affects Cache.RequiredBits { private const int N = 10; private int [] A; private int Ix; private int OldClock; public int Rate; // Number in last N seconds public Sampler(int Dummy) { A = new int[N]; Ix = 0; OldClock = 0; Rate = 0; } public void Add() { int CatchUp = Cache.Clock - OldClock; if ( CatchUp > N ) CatchUp = N; while ( CatchUp-- > 0 ) { Rate -= A[ Ix ]; Ix += 1; if ( Ix == N ) Ix = 0; A[ Ix ] = 0; } OldClock = Cache.Clock; A[ Ix ] += 1; Rate += 1; int bits = Config.ConfidenceMin + 2*Log2(Rate); Cache.RequiredBits = bits; } private static int Log2( int N ) { int Result = 0; while ( N > 0 ) { Result += 1; N = N / 2; } return Result; } } class ZoneInfo { public List SecDomainList; }