public void ParseSingle(ref ListViewItem LItem) { PACKET_ITEM PItem; if (PacketCollection == null) { return; } if (PacketCollection.Count == 0) { return; } PItem = ( PACKET_ITEM )PacketCollection[Function.FindListIndex(LItem)]; Rtx.Text = ""; Rtx.AppendText(Function.GetHexString(PItem.Data)); WriteFRAMENode(ref mNode, PItem, ref LItem); PacketETHERNET.Parser(ref mNode, PItem.Data, ref LItem, ref PreviousHttpSequence, ref LastTftpPort); Function.ArrangeText(ref mNode, ":"); }
private void ParseOn() { int ByteOffset = 0; //, i = 0; int CurrentIndex = 0; bool UseThisPacket = false; uint tu = 0, tl = 0; bool IsMessageShowed = false; ulong LongVal1 = 0, LongVal2 = 0, TmpValue = 0; ListViewItem LItem; int ListViewIndex = 0; int PacketItemIndex = PacketCollection.Count; CurrentIndex = 0; do { if (StopCapture) { if (!IsMessageShowed) { if (MessageBox.Show("There are packet to be edited. Stop after processing packets in quiue ?", "Confirmations", MessageBoxButtons.YesNo) == DialogResult.No) { break; } IsMessageShowed = true; } } UseThisPacket = false; if (mCaptureOptions.LimitPackets) { if (PItem.CaptureLength > mCaptureOptions.PacketSize) { UseThisPacket = false; } else { UseThisPacket = true; } } else { UseThisPacket = true; } if (UseThisPacket) { LItem = LVw.Items.Add(ListViewIndex.ToString()); LItem.Text = PacketItemIndex.ToString(); // SubItems 0 - No LItem.SubItems.Add(""); // SubItems 1 - Time LItem.SubItems.Add(""); // SubItems 2 - Source LItem.SubItems.Add(""); // SubItems 3 - Destination LItem.SubItems.Add(""); // SubItems 4 - Protocol LItem.SubItems.Add(""); // SubItems 5 - Info ListViewIndex = LVw.Items.Count - 1; if (mDisplayOptions.UpdateListInRealTime) { LVw.EnsureVisible(ListViewIndex); } FRAMEParser(PacketBufferData, ref CurrentIndex, ref LItem); if (PacketCollection.Count == 0) { FirstSeconds = PItem.Seconds; FirstMiliSeconds = PItem.MicroSeconds; FirstLongValue = ( ulong )FirstSeconds; FirstLongValue *= 1000000; FirstLongValue += FirstMiliSeconds; PItem.CaptureTimeStr = "0.000000"; LItem.SubItems[1].Text = PItem.CaptureTimeStr; } else { LongVal1 = ( ulong )PItem.Seconds; LongVal1 *= 1000000; LongVal1 += ( ulong )PItem.MicroSeconds; LongVal2 = LongVal1 - FirstLongValue; TmpValue = LongVal2 / 1000000; tu = ( uint )TmpValue; TmpValue *= 1000000; TmpValue = LongVal2 - TmpValue; tl = ( uint )TmpValue; PItem.CaptureTimeStr = tu.ToString() + "." + tl.ToString("d6"); LItem.SubItems[1].Text = PItem.CaptureTimeStr; } PItem.TypeInfo = "Other"; PacketETHERNET.Parser(PItem.Data, ref LItem, ref PItem.TypeInfo, ref PreviousHttpSequence, ref LastTftpPort); PacketCollection.Add(PItem); PacketItemIndex = PacketCollection.Count; } ByteOffset = 20 + (int)PItem.CaptureLength; ByteOffset = Packet_WORDALIGN(ByteOffset); ByteOffset -= (20 + (int)PItem.CaptureLength); CurrentIndex += ByteOffset; }while(CurrentIndex < PacketBufferData.Length); }
public void ParseOff() { int CurrentIndex = 0; uint tu = 0, tl = 0; ulong LongVal1 = 0, LongVal2 = 0, TmpValue = 0; ListViewItem LItem; int ListViewIndex = 0; PacketCollection.Clear(); LVw.Items.Clear(); int PacketItemIndex = PacketCollection.Count; CurrentIndex = 0; do { LItem = LVw.Items.Add(ListViewIndex.ToString()); LItem.Text = PacketItemIndex.ToString(); // SubItems 0 - No LItem.SubItems.Add(""); // SubItems 1 - Time LItem.SubItems.Add(""); // SubItems 2 - Source LItem.SubItems.Add(""); // SubItems 3 - Destination LItem.SubItems.Add(""); // SubItems 4 - Protocol LItem.SubItems.Add(""); // SubItems 5 - Info ListViewIndex = LVw.Items.Count - 1; FRAMEParser(PacketBufferData, ref CurrentIndex, ref LItem); if (mDisplayOptions.UpdateListInRealTime) { LVw.EnsureVisible(ListViewIndex); } if (PacketCollection.Count == 0) { FirstSeconds = PItem.Seconds; FirstMiliSeconds = PItem.MicroSeconds; FirstLongValue = ( ulong )FirstSeconds; FirstLongValue *= 1000000; FirstLongValue += FirstMiliSeconds; PItem.CaptureTimeStr = "0.000000"; LItem.SubItems[1].Text = PItem.CaptureTimeStr; } else { LongVal1 = ( ulong )PItem.Seconds; LongVal1 *= 1000000; LongVal1 += ( ulong )PItem.MicroSeconds; LongVal2 = LongVal1 - FirstLongValue; TmpValue = LongVal2 / 1000000; tu = ( uint )TmpValue; TmpValue *= 1000000; TmpValue = LongVal2 - TmpValue; tl = ( uint )TmpValue; PItem.CaptureTimeStr = tu.ToString() + "." + tl.ToString("d6"); LItem.SubItems[1].Text = PItem.CaptureTimeStr; } PItem.TypeInfo = "Other"; PacketETHERNET.Parser(PItem.Data, ref LItem, ref PItem.TypeInfo, ref PreviousHttpSequence, ref LastTftpPort); ListViewIndex++; PacketCollection.Add(PItem); PacketItemIndex = PacketCollection.Count; }while(CurrentIndex < PacketBufferData.Length); }