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

Bro Tracker bro at tracker.bro.org
Mon Mar 18 10:10:57 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 yun):

 Replying to [comment:6 seth]:
 > Is there some reason that you have differentiated on different bit
 lengths?  That's what I was mostly focusing on with my comment earlier.
 It seems like you should have only implemented bytestring_to_count.

 I initially only needed to read a 32bit unsigned integer, so implemented
 that.. after that I had an use case for reading a 16bit unsigned short.
 Then I added the 64bit to make the patch more complete.

 I'm up for a more generic bytetring_to_count() but in most cases you would
 be reading the basic data types from the network, which are 16bit, 32bit,
 Maybe we can model it after the struct.unpack() like in Python? It uses
 the first parameter that indicates what datatype you are actually

 See here: http://docs.python.org/2/library/struct.html#format-characters

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

More information about the bro-dev mailing list