# New bro types when writing a plugin

**URL:** <https://community.zeek.org/t/new-bro-types-when-writing-a-plugin/5233>\
**Category:** Zeek\
**Created:** [March 27, 2018, 4:31pm UTC](https://community.zeek.org/t/new-bro-types-when-writing-a-plugin/5233 "2018-03-27T16:31:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dw21](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@dw21](https://community.zeek.org/u/dw21)\
**Post date:** [March 27, 2018, 4:31pm UTC](https://community.zeek.org/t/new-bro-types-when-writing-a-plugin/5233/1 "2018-03-27T16:31:57Z")

</div>

Hey there,

I'm writing an analyzer as a plugin and I would like to create some new bro data type (record type to be exact) to hand over some protocol data in a compact form as parameters to the event functions.

For now I have declared the new types in types.bif and defined them in init-bare.bro, but I don't think that this is the right way, because I have to manually modify the bro source files.

Is there a way to declare and define the new type inside the plugin source files, so that the types will be featured in bro after the plugin was installed?

Greetings,

Dane

---

<div class="post-metadata">

**Author:** ![Vitaly\_Repin1](https://avatars.discourse-cdn.com/v4/letter/v/a88e57/32.png) [@Vitaly\_Repin1](https://community.zeek.org/u/Vitaly_Repin1)\
**Post date:** [March 28, 2018, 7:32am UTC](https://community.zeek.org/t/new-bro-types-when-writing-a-plugin/5233/2 "2018-03-28T07:32:33Z")

</div>

Hello,

Take a look into this example: [https://github.com/vitalyrepin/uap-bro](https://github.com/vitalyrepin/uap-bro) I have defined three record types in that plugin: DeviceRec, UserAgentRec and AgentRec.

P.S. I think bro-dev is a better mailing list to discuss bro dev. issues: [http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev](http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev)

---

<div class="post-metadata">

**Author:** ![dw21](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@dw21](https://community.zeek.org/u/dw21)\
**Post date:** [March 28, 2018, 8:41am UTC](https://community.zeek.org/t/new-bro-types-when-writing-a-plugin/5233/3 "2018-03-28T08:41:50Z")

</div>

Hey

thanks for the hint. I declared my types in types.bif and defined them in types.bro now, but now I can’t acces them anymore in my Source.cc file. I get following error:

error: ‘BifType::Record::My\_Type’ has not been declared

My .cc line: rl = new RecordVal(BifType::Record::My\_Type);

How can I access the types now?

P.S. Yeah, I think the other mailing list is besser for this purpose, but I don’t want to start a new question now. 🙂

---

<div class="post-metadata">

**Author:** ![seth](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.zeek.org/seth/32/642_2.png) [@seth](https://community.zeek.org/u/seth)\
**Post date:** [April 23, 2018, 6:13pm UTC](https://community.zeek.org/t/new-bro-types-when-writing-a-plugin/5233/4 "2018-04-23T18:13:03Z")

</div>

Make sure you include the generated header file in your .cc file like this…

#include “types.bif.h”

.Seth

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:45pm UTC](https://community.zeek.org/t/new-bro-types-when-writing-a-plugin/5233/5 "2022-05-06T15:45:39Z")

</div>


