You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Jose Alberto Fernandez <ja...@cellectivity.com> on 2005/12/05 14:57:51 UTC

[MINA] Another useful shortcut

Hi,

 

Now that we have support for length prefixed strings, it would be nice
to have an easy way to ask if the ByteBuffer has available (remaining)
an amount specified by a byte/short/int without needing to read the
value, check if there is enough, rewind and wait for more to come.
Something like:

 

            Boolean enoughAvailable(int prefixSizeLength) 

 

This may be very useful on many protocols that provide a size header in
front of variable data being sent.

 

Jose Alberto

 


Re: [MINA] Another useful shortcut

Posted by Trustin Lee <tr...@gmail.com>.
Hi Jose,

2005/12/5, Jose Alberto Fernandez <ja...@cellectivity.com>:
>
>  Now that we have support for length prefixed strings, it would be nice to
> have an easy way to ask if the ByteBuffer has available (remaining) an
> amount specified by a byte/short/int without needing to read the value,
> check if there is enough, rewind and wait for more to come. Something like:
>
>             Boolean enoughAvailable(int prefixSizeLength)
>
> This may be very useful on many protocols that provide a size header in
> front of variable data being sent.
>
It looks very useful, but it has a big pitfall; a possible DoS attack.  We
always have to check if the length of the data doesn't exceed the predefined
limit value, so providing this kind of method doesn't reduce the complexity
much IMHO.

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/