Ask Your Question

Revision history [back]

ascii representation to uint for ProtoField

Hi folks,

I want to create a filter possibility. For strings it works perfect with: Protocol_Type = ProtoField.string( "MyProtocol.Type", "Type " ) Protocol.fields = { Protocol_Type } TreeNode:add_le(Protocol_Type, buffer( 9, 3 ) )

but how can I do it for ascii represented (uint) numbers to filter it as numbers, not as string:

0x30 0x32 0x33 0x34 -> ProtoField.uint16 = 234 (decimal)

0x30 0x30 0x30 0x30 -> ProtoField.uint16 = 0 (decimal)

The string representation have a fixed length of four bytes (0..9999)

TIA Matthias

ascii representation to uint for ProtoField

Hi folks,

I want to create a filter possibility. For strings it works perfect with: Protocol_Type = ProtoField.string( "MyProtocol.Type", "Type " ) Protocol.fields = { Protocol_Type } TreeNode:add_le(Protocol_Type, buffer( 9, 3 ) )

but how can I do it for ascii represented (uint) numbers to filter it as numbers, not as string:

0x30 0x32 0x33 0x34 -> ProtoField.uint16 = 234 (decimal)

0x30 0x30 0x30 0x30 -> ProtoField.uint16 = 0 (decimal)

The string representation have a fixed length of four bytes (0..9999)

TIA Matthias