[ragel] Binary data and bits

sothy shan sothy.e98 at gmail.com
Sun Oct 1 06:52:14 UTC 2017


Hello,
Thanks again  Adrain. In GTP protocol, I have some data (array of
Information Element (IE)). Each IE  has around of 4 bytes. The data in the
first byte is like that.
In this case, I should use all times mask and shift the bits.

Best regards
Sothy

On Sat, Sep 30, 2017 at 5:38 PM, Adrian Thurston <thurston at colm.net> wrote:

> Looks like you accept all bytes so you don't really need ragel for that.
> Just need to mask and shift the bits.
>
>
>
> --
> Adrian D. Thurston
> Chief Scientist
> Colm Networks
> http://colm.net
>
>
> -------- Original message --------
> From: sothy shan <sothy.e98 at gmail.com>
> Date: 2017-09-30 6:43 AM (GMT-05:00)
> To: ragel at colm.net
> Subject: Re: [ragel] Binary data and bits
>
> Thanks Adrain,
>
> I am new to Ragel. I have one question.
> One BYTE information: 010 1 1 000
> I need to take firrst three bits into one int, other two bits are two
> boolean values and other three are together for one int.
>
> How to write grammar for parsing this data?
>
> Thanks for your help.
>
> Best regards
> Sothy
>
> On Fri, Sep 29, 2017 at 10:08 PM, Adrian Thurston <thurston at colm.net>
> wrote:
>
>> Hi Sothy, you need to specify the grammar at the byte level. You can
>> union bit patterns together, however.
>>
>> On 2017-09-27 15:35, sothy shan wrote:
>>
>> Hi,
>> I need to parse 4 bytes of data and some bits of data has valid
>> information.
>> How can I go with Ragel?
>> I am going to use Ragel with  C++.
>>
>> Best regards
>> Sothy
>>
>>
>> _______________________________________________
>> ragel mailing listragel at colm.nethttp://www.colm.net/cgi-bin/mailman/listinfo/ragel
>>
>>
>> _______________________________________________
>> ragel mailing list
>> ragel at colm.net
>> http://www.colm.net/cgi-bin/mailman/listinfo/ragel
>>
>>
>
> _______________________________________________
> ragel mailing list
> ragel at colm.net
> http://www.colm.net/cgi-bin/mailman/listinfo/ragel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20171001/3a73f906/attachment-0002.html>


More information about the ragel-users mailing list