Class: Rex::Post::Meterpreter::Extensions::Stdapi::Railgun::ApiConstants

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/post/meterpreter/extensions/stdapi/railgun/const_manager.rb

Overview

A container holding useful API Constants.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.manager_semaphoreObject

Returns the value of attribute manager_semaphore


47
48
49
# File 'lib/rex/post/meterpreter/extensions/stdapi/railgun/const_manager.rb', line 47

def manager_semaphore
  @manager_semaphore
end

Class Method Details

.inherited(child_class) ⇒ Object


50
51
52
# File 'lib/rex/post/meterpreter/extensions/stdapi/railgun/const_manager.rb', line 50

def self.inherited(child_class)
  child_class.manager_semaphore = Mutex.new
end

.managerObject

Provides a frozen constant manager for the constants defined in self.add_constants


58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/rex/post/meterpreter/extensions/stdapi/railgun/const_manager.rb', line 58

def self.manager

  # The first check for nil is to potentially skip the need to synchronize
  if @manager.nil?
    # Looks like we MAY need to load manager
    @manager_semaphore.synchronize do
      # We check once more. Now our options are synchronized
      if @manager.nil?
        @manager = ConstManager.new

        self.add_constants(@manager)

        @manager.freeze
      end
    end
  end

  return @manager
end