[Bro-Dev] Difference between port conversion functions

Matthias Vallentin vallentin at icir.org
Thu Nov 17 08:06:54 PST 2011


> >     function count_to_port%(c: count, t: transport_proto%): port
> >     function to_port%(num: count, proto: transport_proto%): port
> 
> Yeah, looks like one can go. We should keep the one which's naming is
> more consistent with other coverters; which I believe should be
> count_to_port because the first argument is a specific type (and not
> "any" as other to_* function use). This is out of my memory though,
> worth checking.

I double-checked it and it is indeed the case. In fact, the to_*
functions are all string converters and (should) have a signature of the
form

    to_TYPE(s: string): TYPE

As such, to_port(...) would have to be changed to

    to_port(s: string) : port

if we want to be consistent.

    Matthias


More information about the bro-dev mailing list