internal DataSegment members should be protected

Apr 14, 2011 at 1:20 PM

Compliments on the excellent library you've constructed.

The following methods in class DataSegment are protected: ReadUInt(...) and ReadBytes(...) -- but these methods are internal: ReadBool(...), ReadUShort(...), and ReadInt(...).

I'm using a raw-packet, proprietary protocol in a different assembly where I derive my own XxxDatagram from Datagram/DataSegment. Some of the data in my XxxDatagram packet is UShort. Because ReadUShort(...) is internal and not protected, I can't get at the packet data in a straight forward way. I'm hoping 'internal' is just a typo that should have been 'protected.'

Help.

Also, DataSegment's Buffer property is internal. I think it, too should be protected.

Thanks.

-Steve

Coordinator
Apr 14, 2011 at 1:27 PM
Edited Apr 14, 2011 at 1:27 PM

Actually, internal isn't a typo.

The library currently isn't intended to be extended outside.

internal is intentional to make sure people won't try to extend it outside as long as extensions aren't supported.

One of the basic problems in extending is the fact that in order to extend it correctly, you have to add a data member+access property to the datagram containing your new datagram, which means you have to change the library's code anyways, so you might as well put your new protocol inside.

I'm not sure what is the best way to nicely solve this design issue.

 

You're welcome to open an issue for support of plugins/extensions of Datagrams and Layers.

 

Boaz.