Module: Ruckus

Defined in:
lib/ruckus.rb,
lib/ruckus/ip.rb,
lib/ruckus/str.rb,
lib/ruckus/blob.rb,
lib/ruckus/enum.rb,
lib/ruckus/null.rb,
lib/ruckus/choice.rb,
lib/ruckus/filter.rb,
lib/ruckus/number.rb,
lib/ruckus/parsel.rb,
lib/ruckus/time_t.rb,
lib/ruckus/vector.rb,
lib/ruckus/mutator.rb,
lib/ruckus/selector.rb,
lib/ruckus/structure.rb,
lib/ruckus/dictionary.rb,
lib/ruckus/human_display.rb,
lib/ruckus/structure/relate.rb,
lib/ruckus/structure/factory.rb,
lib/ruckus/structure/atcreate.rb,
lib/ruckus/structure/defaults.rb,
lib/ruckus/structure/validate.rb,
lib/ruckus/structure_shortcuts.rb,
lib/ruckus/structure/searchmods.rb,
lib/ruckus/structure/beforebacks.rb,
lib/ruckus/structure/fixupfields.rb,
lib/ruckus/structure/replacement.rb,
lib/ruckus/structure/initializers.rb,
lib/ruckus/structure/structureproxies.rb

Overview

A sort of half-baked DSL for defining packet fields.

These are all classmethods of Structure.

Defined Under Namespace

Modules: Mutator, StructureAllowFieldReplacement, StructureAtCreate, StructureBeforeCallbacks, StructureDefaultValues, StructureDetectFactory, StructureFactory, StructureFixupFieldNames, StructureInitializers, StructureProxies, StructureRelateDeclaration, StructureSearchModules, StructureValidateField Classes: Asciiz, Be16, Be32, Be64, Bit, Blob, Byte, Choice, Decimal, Dictionary, Enum, Filter, IP, IncompleteCapture, Le16, Le32, Le64, Len, Nibble, Null, Number, Padding, Parsel, Selector, Str, Structure, TimeT, Unicode, Unicodez, Vector

Constant Summary collapse

LIBPATH =

:stopdoc:

::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
Uniz =

XXX compat

Unicodez
Num =
Number.clone
H32 =
Le32.clone
Uint32le =
Le32.clone
H64 =
Le64.clone
Uint64le =
Le64.clone
N32 =
Be32.clone
Uint32be =
Be32.clone
N64 =
Be64.clone
Uint64be =
Be64.clone
Nybble =
Nibble.clone

Class Method Summary collapse

Class Method Details

.libpath(*args) ⇒ Object

Returns the library path for the module. If any arguments are given, they will be joined to the end of the libray path using File.join.



30
31
32
# File 'lib/ruckus.rb', line 30

def self.libpath( *args )
  args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
end

.path(*args) ⇒ Object

Returns the lpath for the module. If any arguments are given, they will be joined to the end of the path using File.join.



38
39
40
# File 'lib/ruckus.rb', line 38

def self.path( *args )
  args.empty? ? PATH : ::File.join(PATH, args.flatten)
end

.require_all_libs_relative_to(fname, dir = nil) ⇒ Object

Utility method used to require all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/ruckus.rb', line 47

def self.require_all_libs_relative_to( fname, dir = nil )
  dir ||= ::File.basename(fname, '.*')
  search_me = ::File.expand_path(
      ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
  extensions = ::File.expand_path(::File.join(::File.dirname(fname),dir,'extensions','**','*.rb'))
  spath = ::File.expand_path(::File.join(::File.dirname(fname), dir))
  Dir.glob(extensions).each{|rb| require rb}
  require ::File.join(spath, 'parsel.rb')
  require ::File.join(spath, 'number.rb')
  require ::File.join(spath, 'str.rb')
  require ::File.join(spath, 'structure.rb')
  # human_display needs to be loaded last and dfuzz isn't 1.9 compatable so don't load them now
  Dir.glob(search_me).reject{|rb| rb =~ /(human_display|dfuzz)\.rb/}.each {|rb| require rb}
  require ::File.join(spath, 'human_display.rb')
end

.versionObject

:startdoc: Returns the version string for the library.



22
23
24
# File 'lib/ruckus.rb', line 22

def self.version
  VERSION
end