protected override void _Initialize(OCurrentPacketList list) { // Find fastest time from the packet int nCount = list.GetCount(); for (int i = 0; i < nCount; i++) { OPacket packet = list.GetAt(i); if (0 == _basetime || _basetime > packet.GetTimeCollected()) { _basetime = packet.GetTimeCollected(); } } }
public OStatisticsResult CalculateStatistics(OCurrentPacketList list, OStatistics.StatisticsType type) { OStatisticsResult res = new OStatisticsResult(); _Initialize(list); // for all packets int nPacketCount = list.GetCount(); for (int i=0; i<nPacketCount; i++) { OPacket packet = list.GetAt(i); string n = _GetNameForPacket(packet); res.IncrementResult(n); } return res; }
// Initialize code if needed protected virtual void _Initialize(OCurrentPacketList list) { }
public void SetCurrentPacketList(OCurrentPacketList list) { _list = list; }
public bool QueryPackets(ulong startTime, ulong endTime, List<int> protocolList, OCurrentPacketList curPackets) { if (null == _dbConnection) { return false; } // Build Query statement string sql = BuildSQLStatement(startTime, endTime, protocolList); SQLiteCommand command = new SQLiteCommand(sql, _dbConnection); SQLiteDataReader reader = command.ExecuteReader(); while (reader.Read()) { OPacket pac = new OPacket(); pac.SetTimeCollected((ulong)(Int64)reader[0]); pac.SetSourceIP((string)reader[1]); pac.SetDestinationIP((string)reader[2]); pac.SetProtocol((int)(Int64)reader[3]); pac.SetLength((int)(Int64)reader[4]); pac.SetPacketStoredPath((string)reader[5]); curPackets.AddPacket(pac); } return true; }
public void SetPacketList(OCurrentPacketList curList) { _list = curList; }