[Bro-Dev] Opaque type in plugin

Jan Grashöfer jan.grashoefer at gmail.com
Mon May 2 06:39:35 PDT 2016

>> Is it possible to create a new opaque type for Bro using a dynamic
>> plugin without touching Bro sources?
> Yes, it should. I believe if you implement the logic in your plugin's
> InitPreScript() method, it should work.

Meanwhile I gave it a try: I implemented a class inheriting from
OpaqueVal and declared a global OpaqueType variable as extern. I
initialized the type variable inside InitPreScript(). That compiled just
fine but executing Bro failed due to dynamic linking issues
(http://stackoverflow.com/questions/19373061 seems to explain that). I
circumvented this issue by using a static variable (= limited scope)
that I initialized in place. This went well and the new opaque value
seems to behave as expected. However, I wonder if I am missing anything
that might cause problems?

One thing I am aware of is that I did not declare the value type as
serializable. I think that is not needed for my use case. Besides it
would require to define a corresponding identifier (see SerialTypes.h),
whose uniqueness cannot be guaranteed for a plugin, right?

Best regards

More information about the bro-dev mailing list