[Zeek] - set default to an enum type

Justin Azoff justin at corelight.com
Sun Jun 23 08:07:02 PDT 2019


That is the correct syntax.

http://try.bro.org/#/trybro/saved/334009

$ cat color.bro
type Color: enum {Red, Green, Blue};
type Whatever: record {
    color: Color &default=Red;
};

event bro_init()
{
    local t:  Whatever;
    print t$color;
}

$ bro color.bro
Red

On Sun, Jun 23, 2019 at 8:20 AM william de ping <bill.de.ping at gmail.com> wrote:
>
> Hi everyone,
>
> I have a variable that has &optional &default attributes.
> I want the &default attribute to have a value of an enum.
>
> So if the enum is : type color: enum { Red, White, Blue, };
> c: color &default=Red;
>
> Does not work..
>
> Any ideas on the correct syntax ?
>
> Thank you
> B
> _______________________________________________
> Zeek mailing list
> zeek at zeek.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/zeek



-- 
Justin


More information about the Zeek mailing list