[Bro-Dev] #968: Add bytestring_to_uint16, uint32, uint64 functions

Bro Tracker bro at tracker.bro.org
Tue Mar 19 16:06:45 PDT 2013

#968: Add bytestring_to_uint16, uint32, uint64 functions
  Reporter:  yun    |      Owner:
      Type:  Patch  |     Status:  new
  Priority:  Low    |  Milestone:  Bro2.2
 Component:  Bro    |    Version:  git/master
Resolution:         |   Keywords:  bytestring

Comment (by robin):

 On Tue, Mar 19, 2013 at 18:41 -0000, you wrote:

 >  With that patch you can do this:
 >  {{{
 >    print bytestring_to_count(reverse("\x30\x39")); # 12345
 >    print bytestring_to_count(reverse("\x39\x30")); # 12345
 >  }}}
 >  Do you think that will solve the problem? Also, does bro function
 >  "optional" arguments? I personally think that it's annoying to specify
 >  endianness for every call if it cannot be optional.

 I can see the reverse() function for strings generally be useful but I
 don't think it's a nice solution for converting endianess with
 bytestring_to_count(). A default/optional argument would indeed be the
 best approach I think. We've been kicking that idea around a few times
 already, and I've now openened a ticket for that. For the time being,
 I'd indeed go with the explicit endianess argument and then switch
 over to an optional argument once we have that.

Ticket URL: <http://tracker.bro.org/bro/ticket/968#comment:21>
Bro Tracker <http://tracker.bro.org/bro>
Bro Issue Tracker

More information about the bro-dev mailing list