Class: Unified2::Construct

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/unified2/construct.rb

Instance Method Summary collapse

Instance Method Details

#padding_lengthObject

sometimes the data needs extra padding



45
46
47
48
49
50
51
# File 'lib/unified2/construct.rb', line 45

def padding_length
  if header.u2length > data.num_bytes
    header.u2length - data.num_bytes
  else
    0
  end
end

#type_selectionObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/unified2/construct.rb', line 20

def type_selection
  case header.u2type.to_i
  when 1
    # define UNIFIED2_EVENT 1
  when 2
    # define UNIFIED2_PACKET 2
    "packet"
  when 7
    # define UNIFIED2_IDS_EVENT 7
    "ev4"
  when 66
    # define UNIFIED2_EVENT_EXTENDED 66
  when 67
    # define UNIFIED2_PERFORMANCE 67
  when 68
    # define UNIFIED2_PORTSCAN 68
  when 72
    # define UNIFIED2_IDS_EVENT_IPV6 72
    "ev6"
  else
    "unknown type #{header.u2type}"
  end
end