Hi Emmanuel, > > It's really depending on the protocol you are handling : > - If you have fixed size PDUs, then you can build a filter which gather all > the incoming packets until the PDU is complete. > - If your PDU contains a size in the first few bytes (let's say that the 4 > first bytes are describing the PDU size), when you have received those 4 > first bytes (which may perfectly arrive in 4 packets), you fall back in the > same scenario as the first one. > - If your protocol does not gives you a size for a PDU, but you have a > terminaison token like CR/LF or a keyword, then you have to read the bytes > until you get this terminal token. > > In any case, as you can see, it's impossible for MINA to provide a generic > solution to this kind of problem, as it's protocol dependant. However, for > commonly used protocols, what would be good is to offer implementations. > > We discussed a while back about writing something like Ethereal (now > WireShark) on top of MINA (a good name could be MINAreal ;) where we > implement a lot of common protocol, that could help users to analyse the way > MINA can be used to implement a protocol. > > Hope it helps.
It helps, it is a bit confusing to come into MINA when there's both chained-based filters and inheritance-based decoders, which seem very similar yet different :). Regarding WireShark, that is one idea, but IMHO it would be better to have some sort of traffic injection robustness tests. You would specify your data to send, and it got injected into MINA in various ways, varying package sizes, offsets, simulating resends etc. This way you could test that your handler can cope with the corner cases. Of course not everything can be tested, but if you design the robustness tests to be evil it should be enough :)
