Closed InteXX closed 2 years ago
1. `this._Time = packet.PcapHeader.Date;` (there is no `PcapHeader` property)
packet.Header https://github.com/dotpcap/sharppcap/blob/master/SharpPcap/PacketCapture.cs
2. `TCPPacket` and `UDPPacket` references (classes no longer exist)
See https://github.com/dotpcap/packetnet
3. `_offlinedevice = SharpPcap.GetPcapOfflineDevice(this.FileName);` (not finding an equivalent method)
CaptureFileReaderDevice
4. `while ((packet = _offlinedevice.PcapGetNextPacket()) != null) {}` (construct seems no longer valid)
See Example4
5. `if (device.PcapDumpOpened)` (property/field no longer exists)
IsOpen
6. `device.PcapDump(packet);` (method no longer exists)
Example6
7. `device.PcapOnPacketArrival += new SharpPcap.PacketArrivalEvent(device_PcapOnPacketArrival);` (event no longer exists)
OnPacketArrival
8. `device.PcapOpen(true, 1000);` (syntax is no longer valid)
device.Open(....)
9. `device.PcapDumpOpen(this.FileName);` (method no longer exists)
CaptureFileWriterDevice
Thank you very much. That was surprisingly fast.
Hm... still none of it is working, though. I'd better slow down and provide more detail for each one.
First up: this._Time = packet.PcapHeader.Date;
(there is no PcapHeader property)
Here's the snippet:
public bool FillConnection(Packet packet)
{
if (packet == null)
return false;
IPEndPoint srcAddress = null;
IPEndPoint dstAddress = null;
int UsefulTraffic = 0;//Length;
int RealTraffic = 0;//Length;
this._Direction = Direction.None;
this._IsValidConnection = false;
this._Time = packet.PcapHeader.Date;
}
The packet
paremeter was originally of type Tamir.IPLib.Packets.Packet
, not the new SharpPcap.PacketCapture
. What would be the equivalent for this?
Your code is way too old to map things one to one, PacketCapture contains the raw data from winpcap/LibPcap (timestamp and data bytes) IpPacket is the result of decoding the PacketCapture data and contains fields like ip addresses
That's what I was afraid of.
But thanks for the clarification.
Have you looked at some of the sharppcap and packet net examples? While it isn’t a one to one mapping it should be relatively apparent how to adjust for the api changes and we can help answer specific questions.
Regards, Chris
On Sun, Feb 6, 2022 at 7:05 PM Jeff Bowman @.***> wrote:
That's what I was afraid of.
But thanks for the clarification.
— Reply to this email directly, view it on GitHub https://github.com/dotpcap/sharppcap/issues/370#issuecomment-1030946441, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJH4AGZQHOVJ6MWVKEG643UZ4EDVANCNFSM5NUQMLIQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
@chmorgan
That's a gracious offer... I believe I'll take you up on that.
I'm presently juggling several projects, though, so it's going to be slow going.
Closing due to inactivity. Please reopen if you've got further questions!
Thanks Chris. I've just been so doggone busy...
I'm updating some very old code that uses SharpPCap v1.0.6, and I'm hitting some dead ends. Suggestions, please?
this._Time = packet.PcapHeader.Date;
(there is noPcapHeader
property)TCPPacket
andUDPPacket
references (classes no longer exist)_offlinedevice = SharpPcap.GetPcapOfflineDevice(this.FileName);
(not finding an equivalent method)while ((packet = _offlinedevice.PcapGetNextPacket()) != null) {}
(construct seems no longer valid)if (device.PcapDumpOpened)
(property/field no longer exists)device.PcapDump(packet);
(method no longer exists)device.PcapOnPacketArrival += new SharpPcap.PacketArrivalEvent(device_PcapOnPacketArrival);
(event no longer exists)device.PcapOpen(true, 1000);
(syntax is no longer valid)device.PcapDumpOpen(this.FileName);
(method no longer exists)