2005-03-26 16:52:59 +00:00
|
|
|
#!/usr/bin/ruby
|
|
|
|
|
|
|
|
# Rex::Struct2
|
|
|
|
module Rex
|
|
|
|
module Struct2
|
|
|
|
|
|
|
|
class CStructTemplate
|
|
|
|
|
2005-07-09 21:18:49 +00:00
|
|
|
require 'rex/struct2/c_struct'
|
2005-03-26 16:52:59 +00:00
|
|
|
|
|
|
|
attr_reader :template, :template_create_restraints, :template_apply_restraint
|
|
|
|
attr_writer :template, :template_create_restraints, :template_apply_restraint
|
|
|
|
|
|
|
|
def initialize(*tem)
|
|
|
|
self.template = tem
|
|
|
|
self.template_create_restraints = [ ]
|
|
|
|
self.template_apply_restraint = [ ]
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_restraints(*ress)
|
|
|
|
self.template_create_restraints = ress
|
|
|
|
return self
|
|
|
|
end
|
|
|
|
|
|
|
|
def apply_restraint(*ress)
|
|
|
|
self.template_apply_restraint = ress
|
|
|
|
return self
|
|
|
|
end
|
|
|
|
|
|
|
|
def make_struct
|
|
|
|
Rex::Struct2::CStruct.new(*self.template).
|
|
|
|
create_restraints(*self.template_create_restraints).
|
|
|
|
apply_restraint(*self.template_apply_restraint)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# end Rex::Struct2
|
|
|
|
end
|
|
|
|
end
|