[Bro-Dev] Include C++ header file in plugin function

Dane Wullen dane.wullen at alumni.fh-aachen.de
Fri May 18 10:59:41 PDT 2018


Hi there,

I want to write a function as a plugin to convert a 4 byte hex string 
like "405f612f" to float/double (3.49031 in this case).

An easy way to do so in C++ is this:

#include<sstream>

union  ulf
{
     unsigned  long  ul;
     float  f;
};

int  main()
{
     ulf u;
     string str ="405f612f";
     stringstream ss(str);
     ss >> hex >> u.ul;
     float  f = u.f;
     cout << f << endl;
}

Unfortunatly, to use "stringstream" I will have to include the <sstream> 
header file. Is this possible to do in plugin functions?

Thanks.

Dane

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.icsi.berkeley.edu/pipermail/bro-dev/attachments/20180518/ac61ba82/attachment.html 


More information about the bro-dev mailing list