[Bro] Convert count (storing float) to double

Hui Lin (Hugo) hlin33 at illinois.edu
Fri Nov 10 18:59:11 PST 2017


As far as I know, there is no built-in function. I don't think that DNP3
follow a common rule to encode float point number; so I am afraid that you
probably need to write a parsing function.

Best,

Hui

On Fri, Nov 10, 2017 at 4:39 PM, Ren, Wenyu <wren3 at illinois.edu> wrote:

> Hi Hui,
>
> So there is no built-in function in Bro to do such things? Well, I need to
> write my parser so that it can parse floating point even if it might be the
> rare case I guess. I will take a look at how floating point is stored and
> write my own conversion function then. Thanks a lot.
>
> Best,
> Wenyu
>
>
> *Wenyu Ren*
> Ph.D. Candidate
> Department of Computer Science
> University of Illinois at Urbana-Champaign
> ------------------------------
> *From:* hugolin615 at gmail.com [hugolin615 at gmail.com] on behalf of Hui Lin
> (Hugo) [hlin33 at illinois.edu]
> *Sent:* Friday, November 10, 2017 6:31 PM
> *To:* Ren, Wenyu
> *Cc:* bro at bro.org
> *Subject:* Re: [Bro] Convert count (storing float) to double
>
> Hi Wenyu,
>
> There are multiple guys before you ask me about this question. Sorry that
> I have not included this conversion function in the original DNP3 analyzer.
> The main reason at that time is that this conversion is kind of ad-hoc to
> DNP3 not very general. My suggestion is to take a look at the DNP3 protocol
> to see how floating point is stored and then use basic
> arithmetic calculation to obtain the result of that floating point.
>
> Also, may I ask you why want to use DNP3 to deliver floating point? In
> many situations, I see that people use integer to store floating point
> for simplicity. For example, if one wants to deliver floating point 10.012,
> he first multiplies it by 1000 and delivers the value of 10012. On the
> receiving end, one just divides the value by 1000 to obtain the floating
> point.
>
> Hope it helps,
>
> Best,
>
> Hui Lin
>
> On Fri, Nov 10, 2017 at 4:00 PM, Ren, Wenyu <wren3 at illinois.edu> wrote:
>
>> Hi Everyone,
>>
>> This might be a dumb question, but does anyone know how to convert a
>> float value stored in count type to double type in Bro? For example,
>> 1092616192 should be converted to 10.0. I want to use DNP3 events such as
>> "dnp3_analog_input_SPwFlag". However, the value is given in count but is
>> actually a floating point value.
>>
>> Thanks a lot.
>>
>> Best,
>> Wenyu
>>
>>
>>
>> Wenyu Ren
>> Ph.D. Candidate
>> Department of Computer Science
>> University of Illinois at Urbana-Champaign
>>
>> _______________________________________________
>> Bro mailing list
>> bro at bro-ids.org
>> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/bro
>>
>
>
>
> --
> Hui Lin
> Ph.D. Candidate (http://hlin33.web.engr.illinois.edu/)
> DEPEND (http://depend.csl.illinois.edu/)
> ECE, Uni. of Illinois at Urbana-Champaign
>
>


-- 
Hui Lin
Ph.D. Candidate (http://hlin33.web.engr.illinois.edu/)
DEPEND (http://depend.csl.illinois.edu/)
ECE, Uni. of Illinois at Urbana-Champaign
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/bro/attachments/20171110/9f9b79b8/attachment.html 


More information about the Bro mailing list