[ragel-users] Ragel and protocol analysis

Adrian Thurston thurston at complang.org
Fri Feb 6 00:45:12 UTC 2009


You can parse binary protocols with ragel ... you just use numerical 
values when defining the machines.

main = 0xaf any;

You can't define anything smaller than a byte, however. You need to 
define ranges of bytes that give you the right bit-pattern and the whole 
byte gets tested using binary search on the value, which is not optimal 
for parsing binary protocols.

-Adrian



Horacio Sanson wrote:
> Once I tried to implement a transport protocol parser with ragel but
> since ragel works with text strings any binary protocol (TCP, UDP, IP)
> would be difficult to parse. For example how would you match a TCP or
> IP header using text strings?
> 
> In the other hand text based protocols (RTSP, SDP, etc..) are a LOT
> easier to do with Ragel.
> 
> regards,
> Horacio
> 
> On Sat, Jan 24, 2009 at 8:30 AM, Adrian Thurston <thurston at complang.org> wrote:
>> It's certainly possible:
>>
>> http://www.zedshaw.com/tips/ragel_state_charts.html
>>
>> Keep in mind though that this is not what ragel was designed for. It was
>> made for compiling regular languages with embedded actions to C code.
>>
>> -Adrian
>>
>> Alexis Letessier wrote:
>>> Hello,
>>>
>>> I am new to this mailing list and i am also discovering ragel.
>>>
>>> I would like to know if protocol analysis is possible with ragel?
>>>
>>> For example, would it be possible to feed ragel with tcpdump or tshark
>>> ouput and validate it against a tcp state diagram ?
>>> http://www.andreadrian.de/c-workshop/tcp-state-diagram.gif
>>>
>>> Regards
>>>
>>> Alexis
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> ragel-users mailing list
>>> ragel-users at complang.org
>>> http://www.complang.org/mailman/listinfo/ragel-users
>> _______________________________________________
>> ragel-users mailing list
>> ragel-users at complang.org
>> http://www.complang.org/mailman/listinfo/ragel-users
>>
> 
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users




More information about the ragel-users mailing list