aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/share/ruby/gridserv.rb
diff options
context:
space:
mode:
authorAdam Frisby2007-11-06 21:41:11 +0000
committerAdam Frisby2007-11-06 21:41:11 +0000
commitc0010e4940dd0ca067d469d8194be69b2bc1dece (patch)
tree3dd9a39e2b9db0d6e97e15c8b3bb7d595f2da612 /share/ruby/gridserv.rb
parentset svn:eol-style (diff)
downloadopensim-SC_OLD-c0010e4940dd0ca067d469d8194be69b2bc1dece.zip
opensim-SC_OLD-c0010e4940dd0ca067d469d8194be69b2bc1dece.tar.gz
opensim-SC_OLD-c0010e4940dd0ca067d469d8194be69b2bc1dece.tar.bz2
opensim-SC_OLD-c0010e4940dd0ca067d469d8194be69b2bc1dece.tar.xz
* Moved /branches/ruby to /trunk/share/ruby
Diffstat (limited to '')
-rw-r--r--share/ruby/gridserv.rb69
1 files changed, 69 insertions, 0 deletions
diff --git a/share/ruby/gridserv.rb b/share/ruby/gridserv.rb
new file mode 100644
index 0000000..03cb4d1
--- /dev/null
+++ b/share/ruby/gridserv.rb
@@ -0,0 +1,69 @@
1require "webrick"
2require "xmlrpc/server"
3require 'xmlrpc/client'
4require 'pp'
5require 'config.rb'
6
7#
8# Dummy grid server
9#
10#
11
12class SimServlet < WEBrick::HTTPServlet::AbstractServlet
13 # does actually nothing
14 def do_POST(req, res)
15 STDERR.print "----\n"
16 end
17end
18
19$SimUUID = ""
20
21s = XMLRPC::WEBrickServlet.new
22s.add_handler("map_block") do |param|
23 # does just enough to login.. if you try using "map" you will cause the exception
24 # and hang the client
25 responseData = Hash.new
26 responseData["sim-profiles"] = [ ]
27 responseData
28end
29
30s.add_handler("simulator_login") do |param|
31 sc = SimConfig.new
32 responseData = Hash.new
33 STDERR.print "simulator login: " + param.inspect + "\n"
34 $SimUUID = param["UUID"]
35
36 responseData["UUID"] = param["UUID"]
37 responseData["region_locx"] = sc.cfgSimX
38 responseData["region_locy"] = sc.cfgSimY
39 responseData["regionname"] = "DalienLand"
40 responseData["estate_id"] = "1"
41 responseData["neighbours"] = [ ]
42 responseData["sim_ip"] = sc.cfgSimIP
43 responseData["sim_port"] = sc.cfgSimPort
44 responseData["asset_url"] = sc.cfgAssetServerUrl
45 responseData["asset_sendkey"] = ""
46 responseData["asset_recvkey"] = ""
47 responseData["user_url"] = sc.cfgUserServerUrl
48 responseData["user_sendkey"] = ""
49 responseData["user_recvkey"] = ""
50 responseData["authkey"] = ""
51
52 responseData
53
54end
55
56s.set_default_handler do |name, *args|
57 STDERR.print "Unknown method #{name}, #{args.inspect}\n\n"
58 raise XMLRPC::FaultException.new(-99, "Method #{name} missing" +
59 " or wrong number of parameters!")
60end
61
62httpserver = WEBrick::HTTPServer.new(:Port => 8001)
63httpserver.mount("/", s)
64httpserver.mount("/sims", SimServlet)
65
66trap(:INT) { httpserver.shutdown } # use 1 instead of "HUP" on Windows
67httpserver.start
68
69