Project

General

Profile

« Previous | Next » 

Revision d7ae0ab2

Added by Marc Dequènes over 13 years ago

  • ID d7ae0ab2845854a57e2d73e943d88eff5a7051bb

[layout] reorganization

View differences:

lib/cyborghood/cyborg/botnet.rb
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#++
require 'cyborghood/cyborg/interface'
require 'cyborghood/cyborg/conversation'
require 'cyborghood/cyborg/botnet_dsl'
require 'cyborghood/cyborg/botnet/interface'
require 'cyborghood/cyborg/botnet/conversation'
require 'cyborghood/cyborg/botnet/dsl'
require 'set'
module CyborgHood
......
include CyborgServerRootInterfaceAddon
end
module BotNetClientUNIXSocket
def identifier_prefix
"unix_socket"
end
def setup
super
@pending_conversation_close = Set.new
end
def peer_socket(peer)
File.join(Config::RUN_DIR, peer.downcase + ".sock")
end
def contact_peer(peer, &block)
super(peer, block) do |callback|
EventMachine.connect_unix_domain(peer_socket(peer), Conversation, self, callback)
end
end
end
module BotNet
attr_reader :interface
def self.included(base)
case Config.instance.botnet.connection_type
when 'unix_socket'
return base.class_eval("include BotNetClientUNIXSocket")
return base.class_eval("include BotNetUNIXSocket")
else
raise CyberError.new(:unrecoverable, "config", "Unknown botnet connection type")
end
......
def setup
super
@comm_list = {}
@comm_list_attempt = {}
self.interface.bot = self
end
def contact_peer(peer, block)
......
@comm_list.empty? and super
end
end
autoload :BotNetUNIXSocket, 'cyborghood/cyborg/botnet/backend/unix'
end

Also available in: Unified diff