PcapDotNet / Pcap.Net

.NET wrapper for WinPcap written in C++/CLI and C#, which features almost all WinPcap features and includes a packet interpretation framework.
BSD 3-Clause "New" or "Revised" License
564 stars 167 forks source link

Sealed classes is pain to extend #104

Closed solaristhesun closed 6 years ago

solaristhesun commented 6 years ago

How am I supposed to extend your classes if you make them all sealed?

I would like to parse a proprietary protocol based on ethernet. Deriving from EthernetDatagram does not work because EthernetDatagram is sealed. Deriving from EthernetBaseDiagram does not work because constructor is internal.

What approach do you recommend? What is the point in making these class sealed? What harm is done if someone derives from your classes?

solaristhesun commented 6 years ago

I tried to derive from DataSegment, but doesn't work either because I cannot really access the buffer. I can call ReadMacAddress but not ReadUShort for example. Lot of useful functions are internal.

bricknerb commented 6 years ago

Use the Pcap.Net Q&A Group to ask questions.

Only Pcap.Net's API is public. You're welcome to fork and make changes. You're also welcome to contribute changes, including making things more public. Changes would be accepted if they make sense with the general ideas behind Pcap.Net.