/// <summary> /// Gets the number of bytes in the packet capture between time1 and time2 in the timestamp file /// </summary> /// <param name="time1">the start time (inclusive)</param> /// <param name="time2">the end time (exclusive)</param> /// <returns>the packet count</returns> public long GetDataSpan(DateTime time1, DateTime time2) { long packetStartIndex, packetEndIndex; TimeFile.GetPacketIndices(time1, time2, out packetStartIndex, out packetEndIndex); return(GetDataSpan(packetStartIndex, packetEndIndex)); }
/// <summary> /// Gets the number of packets contained between time1 and time2 /// </summary> /// <param name="time1">the start time (inclusive)</param> /// <param name="time2">the end time (exclusive)</param> /// <returns>the packet count</returns> public long GetIndexSpan(DateTime time1, DateTime time2) { long start, end; TimeFile.GetPacketIndices(time1, time2, out start, out end); return(end - start); }
/// <summary> /// Gets all packets between time1 and time2 from the capture file. /// </summary> /// <param name="time">the inclusive time of the first record in the time index file</param> /// <param name="count">the exclusive time at which to stop collecting</param> /// <returns>a new packet collection object</returns> public PacketCollection GetPackets(DateTime time1, DateTime time2) { long packetIndex1; long packetIndex2; TimeFile.GetPacketIndices(time1, time2, out packetIndex1, out packetIndex2); int count = (int)(packetIndex2 - packetIndex1); return(GetPackets(packetIndex1, count)); }
/// <summary> /// Gets one or more packets from the capture file, beginning at the specified time /// </summary> /// <param name="time">the time of the first record in the time index file</param> /// <param name="count">the number of packets to collect</param> /// <returns>a new packet collection object</returns> public PacketCollection GetPackets(DateTime time, int count = 1) { return(GetPackets(TimeFile.GetPacketIndex(time), count)); }
/// <summary> /// Fills the parent element, and generates the canvas data /// </summary> /// <param name="time1">The time to start the canvas</param> /// <param name="time2">The time to end the canvas</param> /// <param name="parentLevel">the parent nodes level</param> /// <returns>The CanvasData for the specified range and resolution</returns> public void FillFrameElement(FrameElement frame) { //Debug.Assert(frame.Level != FrameNodeLevel.Second); //seconds cannot be subdivided if (frame.Level == FrameNodeLevel.Second) { return; } long packetIndex1, packetIndex2; long startOffset, endOffset; //first time record packetIndex1 = TimeFile.GetPacketIndex(frame.StartTime); //first index record startOffset = IndexFile.GetDataIndex(packetIndex1); //second element DateTime curr = frame.StartTime; DateTime next = Increment(curr, frame); // Increment(frame.StartTime, frame.Level); frame.Children.Clear(); while (curr < frame.EndTime) { packetIndex2 = TimeFile.GetPacketIndex(next); endOffset = IndexFile.GetDataIndex(packetIndex2); frame.CreateChildElement(curr, next.Subtract(curr), packetIndex2 - packetIndex1, endOffset - startOffset); curr = next; next = Increment(curr, frame); packetIndex1 = packetIndex2; startOffset = endOffset; } //if (FilterFiles.Count < 1) return; //List<FilterData> filters = new List<FilterData>(); ////use collected filter byte segments to generate packet counts per filter //foreach (var filter in FilterFiles) //{ // filters.Add(new FilterData(FilterFiles.IndexOf(filter), filter.FillBitResultsList(filterIndeces))); //} //if (CountFilters != null) CountFilters(filters); ////filters now contains the correct coutn information //for (int k = 0; k < filters.Count; k++) //{ // for (int j = 0; j < filters[k].Segments.Count; j++) // { // //copy the jth segment count in filter k to the kth filter index in frame child j // frame.Children[j].FilterCounts.Add(filters[k].Counts[j]); // } //} }