diff options
author | gareth | 2007-03-07 18:48:38 +0000 |
---|---|---|
committer | gareth | 2007-03-07 18:48:38 +0000 |
commit | b3844c1f7348b4296b5ab1df258935d7f971e412 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
parent | * Updating libsecondlife.dll to the latest version with a working LayerData f... (diff) | |
download | opensim-SC_OLD-b3844c1f7348b4296b5ab1df258935d7f971e412.zip opensim-SC_OLD-b3844c1f7348b4296b5ab1df258935d7f971e412.tar.gz opensim-SC_OLD-b3844c1f7348b4296b5ab1df258935d7f971e412.tar.bz2 opensim-SC_OLD-b3844c1f7348b4296b5ab1df258935d7f971e412.tar.xz |
Deleted old trunk code
49 files changed, 0 insertions, 3856 deletions
diff --git a/OGS.sql b/OGS.sql deleted file mode 100644 index 5efaf97..0000000 --- a/OGS.sql +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | -- phpMyAdmin SQL Dump | ||
2 | -- version 2.6.3-pl1 | ||
3 | -- http://www.phpmyadmin.net | ||
4 | -- | ||
5 | -- Host: 127.0.0.1 | ||
6 | -- Generation Time: Feb 16, 2007 at 09:54 PM | ||
7 | -- Server version: 4.0.23 | ||
8 | -- PHP Version: 4.4.0 | ||
9 | -- | ||
10 | -- Database: `OGS` | ||
11 | -- | ||
12 | |||
13 | -- -------------------------------------------------------- | ||
14 | |||
15 | -- | ||
16 | -- Table structure for table `Grid_settings` | ||
17 | -- | ||
18 | |||
19 | DROP TABLE IF EXISTS `Grid_settings`; | ||
20 | CREATE TABLE IF NOT EXISTS `Grid_settings` ( | ||
21 | `Setting` text NOT NULL, | ||
22 | `value` text NOT NULL | ||
23 | ) TYPE=MyISAM; | ||
24 | |||
25 | -- | ||
26 | -- Dumping data for table `Grid_settings` | ||
27 | -- | ||
28 | |||
29 | INSERT INTO `Grid_settings` (`Setting`, `value`) VALUES ('highest_LLUUID', '51AEFF430000000000000000000002fd'); | ||
30 | |||
31 | -- -------------------------------------------------------- | ||
32 | |||
33 | -- | ||
34 | -- Table structure for table `foreign_profiles` | ||
35 | -- | ||
36 | |||
37 | DROP TABLE IF EXISTS `foreign_profiles`; | ||
38 | CREATE TABLE IF NOT EXISTS `foreign_profiles` ( | ||
39 | `userprofile_LLUUID` varchar(32) NOT NULL default '', | ||
40 | `foreigngrid` text NOT NULL, | ||
41 | `profile_firstname` text NOT NULL, | ||
42 | `profile_lastname` text NOT NULL, | ||
43 | `profile_passwdmd5` text NOT NULL, | ||
44 | `homesim_ip` text NOT NULL, | ||
45 | `homesim_port` int(11) NOT NULL default '0', | ||
46 | `homeasset_url` text NOT NULL, | ||
47 | `homeuser_url` text NOT NULL, | ||
48 | `look_at` text NOT NULL, | ||
49 | `region_handle` text NOT NULL, | ||
50 | `position` text NOT NULL, | ||
51 | PRIMARY KEY (`userprofile_LLUUID`) | ||
52 | ) TYPE=MyISAM; | ||
53 | |||
54 | -- | ||
55 | -- Dumping data for table `foreign_profiles` | ||
56 | -- | ||
57 | |||
58 | |||
59 | -- -------------------------------------------------------- | ||
60 | |||
61 | -- | ||
62 | -- Table structure for table `local_user_profiles` | ||
63 | -- | ||
64 | |||
65 | DROP TABLE IF EXISTS `local_user_profiles`; | ||
66 | CREATE TABLE IF NOT EXISTS `local_user_profiles` ( | ||
67 | `userprofile_LLUUID` varchar(32) NOT NULL default '', | ||
68 | `profile_firstname` text NOT NULL, | ||
69 | `profile_lastname` text NOT NULL, | ||
70 | `profile_passwdmd5` text NOT NULL, | ||
71 | `homesim_ip` text NOT NULL, | ||
72 | `homesim_port` int(11) NOT NULL default '0', | ||
73 | `homeasset_url` text NOT NULL, | ||
74 | `look_at` text NOT NULL, | ||
75 | `region_handle` text NOT NULL, | ||
76 | `position` text NOT NULL, | ||
77 | PRIMARY KEY (`userprofile_LLUUID`) | ||
78 | ) TYPE=MyISAM; | ||
79 | |||
80 | -- | ||
81 | -- Dumping data for table `local_user_profiles` | ||
82 | -- | ||
83 | |||
84 | INSERT INTO `local_user_profiles` (`userprofile_LLUUID`, `profile_firstname`, `profile_lastname`, `profile_passwdmd5`, `homesim_ip`, `homesim_port`, `homeasset_url`, `look_at`, `region_handle`, `position`) VALUES ('51AEFF43000000000000000000000100', 'Test', 'User', '$1$098f6bcd4621d373cade4e832627b4f6', '127.0.0.1', 1000, 'http://dummyassetserver.net/', 'r-0.57343, r-0.819255,r0', 'r255232,254976', 'r41.6589, r100.8374, r22.5072'); | ||
85 | |||
86 | -- -------------------------------------------------------- | ||
87 | |||
88 | -- | ||
89 | -- Table structure for table `region_profiles` | ||
90 | -- | ||
91 | |||
92 | DROP TABLE IF EXISTS `region_profiles`; | ||
93 | CREATE TABLE IF NOT EXISTS `region_profiles` ( | ||
94 | `RegionID` varchar(32) NOT NULL default '', | ||
95 | `Name` text NOT NULL, | ||
96 | `GridLocX` bigint(20) NOT NULL default '0', | ||
97 | `GridLocY` bigint(20) NOT NULL default '0', | ||
98 | `region_handle` text NOT NULL, | ||
99 | `ip_addr` text NOT NULL, | ||
100 | `port` text NOT NULL, | ||
101 | PRIMARY KEY (`RegionID`) | ||
102 | ) TYPE=MyISAM; | ||
103 | |||
104 | -- | ||
105 | -- Dumping data for table `region_profiles` | ||
106 | -- | ||
107 | |||
108 | INSERT INTO `region_profiles` (`RegionID`, `Name`, `GridLocX`, `GridLocY`, `region_handle`, `ip_addr`, `port`) VALUES ('51AEFF43000000000000000000000200', 'Test sandbox', 997, 996, 'r255232,254976', '127.0.0.1', '1000'); | ||
109 | |||
110 | -- -------------------------------------------------------- | ||
111 | |||
112 | -- | ||
113 | -- Table structure for table `sessions` | ||
114 | -- | ||
115 | |||
116 | DROP TABLE IF EXISTS `sessions`; | ||
117 | CREATE TABLE IF NOT EXISTS `sessions` ( | ||
118 | `session_id` varchar(32) NOT NULL default '', | ||
119 | `secure_session_id` text NOT NULL, | ||
120 | `agent_id` text NOT NULL, | ||
121 | `session_start` datetime NOT NULL default '0000-00-00 00:00:00', | ||
122 | `session_end` datetime NOT NULL default '0000-00-00 00:00:00', | ||
123 | `session_active` tinyint(4) NOT NULL default '0', | ||
124 | `current_location` text NOT NULL, | ||
125 | `remote_ip` text NOT NULL, | ||
126 | `circuit_code` int(11) NOT NULL default '0', | ||
127 | PRIMARY KEY (`session_id`) | ||
128 | ) TYPE=MyISAM; | ||
129 | |||
130 | -- | ||
131 | -- Dumping data for table `sessions` | ||
132 | -- | ||
133 | |||
134 | INSERT INTO `sessions` (`session_id`, `secure_session_id`, `agent_id`, `session_start`, `session_end`, `session_active`, `current_location`, `remote_ip`, `circuit_code`) VALUES ('51AEFF430000000000000000000002fc', '51AEFF430000000000000000000002fd', '51AEFF43000000000000000000000100', '2007-02-16 21:13:19', '0000-00-00 00:00:00', 1, 'r255232,254976', '81.174.255.70', 0); | ||
@@ -1,22 +0,0 @@ | |||
1 | Some basic instructions on how to use OpenSim/OGS for hackers and geeks | ||
2 | ------------------------------------------------- | ||
3 | |||
4 | 1.First, either get in touch with a grid owner or install the OGS server components on your own server. | ||
5 | 2.Ask the grid owner to send you keys over a secure channel (encrypted email, paper mail, phone, encrypted IM/IRC). If you and the grid owner are not concerned about security (YOU SHOULD BE!!!) then this exchange can be done over any communications channel. | ||
6 | 3.Edit src/Config.cs to reflect your changes or if the grid owner has provided you with a template/custom database, drop opensim.yap into bin/ | ||
7 | 4.If you edited src/Config.cs then run "nant build" at the root directory | ||
8 | 5.With mono on Linux/BSD cd into bin/ and run "mono OpenSim.exe", On win32 just run OpenSim.exe | ||
9 | 5.Login to the grid with a standard viewer and find your sim (note that at certain times the SVN version does not allow logins) | ||
10 | |||
11 | Some basic instructions on how to use OpenSim/OGS for the laymen | ||
12 | ------------------------------------------------- | ||
13 | |||
14 | 1.Ensure you either have mono or the .NET framework runtime installed | ||
15 | 2.Find a grid owner | ||
16 | 3.Ask the grid owner to send you connection instructions | ||
17 | 4.Either install the grid owner's opensim.yap by placing it into the same directory as OpenSim.exe or follow their instructions | ||
18 | 5.On Linux/BSD, go to a command prompt and type: | ||
19 | cd /path/to/where/you/downloaded/ | ||
20 | cd bin/ | ||
21 | mono OpenSim.exe | ||
22 | 6.Login to the grid in the normal way | ||
diff --git a/bin/Axiom.MathLib.dll b/bin/Axiom.MathLib.dll deleted file mode 100644 index 21ce3a8..0000000 --- a/bin/Axiom.MathLib.dll +++ /dev/null | |||
Binary files differ | |||
diff --git a/bin/Db4objects.Db4o.dll b/bin/Db4objects.Db4o.dll deleted file mode 100755 index be976a1..0000000 --- a/bin/Db4objects.Db4o.dll +++ /dev/null | |||
Binary files differ | |||
diff --git a/bin/avatar-template.dat b/bin/avatar-template.dat deleted file mode 100644 index 286b75d..0000000 --- a/bin/avatar-template.dat +++ /dev/null | |||
Binary files differ | |||
diff --git a/bin/libsecondlife.dll b/bin/libsecondlife.dll deleted file mode 100755 index 89d692a..0000000 --- a/bin/libsecondlife.dll +++ /dev/null | |||
Binary files differ | |||
diff --git a/bin/log4net.dll b/bin/log4net.dll deleted file mode 100644 index ffc57e1..0000000 --- a/bin/log4net.dll +++ /dev/null | |||
Binary files differ | |||
diff --git a/caffeine.sh b/caffeine.sh deleted file mode 100644 index 6387fff..0000000 --- a/caffeine.sh +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # WILL NOT BUILD WITHOUT THIS FILE, VERY IMPORTANT! | ||
4 | |||
5 | kill -9 `/var/run/brain/pituaritygland/melatonin` | ||
6 | /usr/sbin/service norephrine start | ||
7 | rm -rf /brain/receptors/adenosine/* | ||
8 | |||
9 | # Caused a conflict with taste.buds, removed for now | ||
10 | # drink /var/drinks/coffee | ||
11 | |||
12 | # We use this instead, enables implementation of the WINGS (Will Interefere with Need for General Sleep) protocol | ||
13 | drink /var/drinks/redbull | ||
diff --git a/genvers.sh b/genvers.sh deleted file mode 100755 index 3da91d7..0000000 --- a/genvers.sh +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | MAJOR=0 | ||
4 | MINOR=1 | ||
5 | BUILD=`date +%s` | ||
6 | REVISION=`svnversion | sed s/:// | sed s/M//` | ||
7 | REALREVISION=`svnversion` | ||
8 | cat src/VersionInfo.cs.template | sed s/@@VERSION/"$MAJOR.$MINOR, Build $BUILD, Revision $REALREVISION"/g >src/VersionInfo.cs | ||
9 | echo -n $MAJOR.$MINOR.*.$REVISION >VERSION | ||
diff --git a/ogs/assetserver/assets/00000000000000005005000000000005/data b/ogs/assetserver/assets/00000000000000005005000000000005/data deleted file mode 100644 index e6840e2..0000000 --- a/ogs/assetserver/assets/00000000000000005005000000000005/data +++ /dev/null | |||
Binary files differ | |||
diff --git a/ogs/assetserver/assets/00000000000000007007000000000006/data b/ogs/assetserver/assets/00000000000000007007000000000006/data deleted file mode 100644 index 5ad1fd0..0000000 --- a/ogs/assetserver/assets/00000000000000007007000000000006/data +++ /dev/null | |||
Binary files differ | |||
diff --git a/ogs/assetserver/assets/00000000000000007009000000000008/data b/ogs/assetserver/assets/00000000000000007009000000000008/data deleted file mode 100644 index cd2fd94..0000000 --- a/ogs/assetserver/assets/00000000000000007009000000000008/data +++ /dev/null | |||
Binary files differ | |||
diff --git a/ogs/assetserver/assets/66c41e3938f9f75a024e585989bfab73/data b/ogs/assetserver/assets/66c41e3938f9f75a024e585989bfab73/data deleted file mode 100644 index 920c775..0000000 --- a/ogs/assetserver/assets/66c41e3938f9f75a024e585989bfab73/data +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | LLWearable version 22 | ||
2 | Female Shape and Outfit 3 Shape | ||
3 | Created by system from avatar's appearance. | ||
4 | permissions 0 | ||
5 | { | ||
6 | base_mask 00082000 | ||
7 | owner_mask 00082000 | ||
8 | group_mask 00082000 | ||
9 | everyone_mask 00082000 | ||
10 | next_owner_mask 00082000 | ||
11 | creator_id 3d924400-038e-6ad9-920b-cfbb9b40585c | ||
12 | owner_id 542ffb8e-8932-49b9-8664-58f53e442797 | ||
13 | last_owner_id 3d924400-038e-6ad9-920b-cfbb9b40585c | ||
14 | group_id 00000000-0000-0000-0000-000000000000 | ||
15 | } | ||
16 | sale_info 0 | ||
17 | { | ||
18 | sale_type not | ||
19 | sale_price 0 | ||
20 | } | ||
21 | type 0 | ||
22 | parameters 82 | ||
23 | 1 .21 | ||
24 | 2 -.5 | ||
25 | 4 -.11 | ||
26 | 5 -.1 | ||
27 | 6 -.3 | ||
28 | 7 -.4 | ||
29 | 8 -.5 | ||
30 | 10 .7 | ||
31 | 11 .34 | ||
32 | 12 -.5 | ||
33 | 13 0 | ||
34 | 14 .04 | ||
35 | 15 .58 | ||
36 | 17 .56 | ||
37 | 18 -.26 | ||
38 | 19 -.73 | ||
39 | 20 -.34 | ||
40 | 21 -.01 | ||
41 | 22 1 | ||
42 | 23 -.5 | ||
43 | 24 -.63 | ||
44 | 25 .44 | ||
45 | 27 .05 | ||
46 | 33 -.24 | ||
47 | 34 -.7 | ||
48 | 35 -.16 | ||
49 | 36 -.2 | ||
50 | 37 -.98 | ||
51 | 38 -.5 | ||
52 | 80 0 | ||
53 | 105 .07 | ||
54 | 155 -.22 | ||
55 | 157 0 | ||
56 | 185 -1 | ||
57 | 193 .86 | ||
58 | 196 -.74 | ||
59 | 505 .65 | ||
60 | 506 .12 | ||
61 | 507 -1.5 | ||
62 | 515 0 | ||
63 | 517 .16 | ||
64 | 518 .8 | ||
65 | 629 0 | ||
66 | 637 0 | ||
67 | 646 .4 | ||
68 | 647 1 | ||
69 | 649 .36 | ||
70 | 650 .85 | ||
71 | 652 .49 | ||
72 | 653 -1 | ||
73 | 656 0 | ||
74 | 659 .65 | ||
75 | 662 .5 | ||
76 | 663 0 | ||
77 | 664 0 | ||
78 | 665 0 | ||
79 | 675 -.15 | ||
80 | 676 .26 | ||
81 | 678 .28 | ||
82 | 682 .27 | ||
83 | 683 -.19 | ||
84 | 684 -.09 | ||
85 | 685 0 | ||
86 | 690 .45 | ||
87 | 692 .4 | ||
88 | 693 -0 | ||
89 | 753 -.5 | ||
90 | 756 -.08 | ||
91 | 758 .24 | ||
92 | 759 .6 | ||
93 | 760 .11 | ||
94 | 764 -.38 | ||
95 | 765 -.3 | ||
96 | 769 .42 | ||
97 | 773 .51 | ||
98 | 795 .16 | ||
99 | 796 .11 | ||
100 | 799 .36 | ||
101 | 841 0 | ||
102 | 842 -.82 | ||
103 | 879 0 | ||
104 | 880 0 | ||
105 | textures 0 | ||
diff --git a/ogs/assetserver/assets/e0ee49b5a4184df8d3c9a65361fe7f49/data b/ogs/assetserver/assets/e0ee49b5a4184df8d3c9a65361fe7f49/data deleted file mode 100644 index 95cc683..0000000 --- a/ogs/assetserver/assets/e0ee49b5a4184df8d3c9a65361fe7f49/data +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | LLWearable version 22 | ||
2 | Sexy - Female Skin | ||
3 | |||
4 | permissions 0 | ||
5 | { | ||
6 | base_mask 00086000 | ||
7 | owner_mask 00086000 | ||
8 | group_mask 00000000 | ||
9 | everyone_mask 00000000 | ||
10 | next_owner_mask 00086000 | ||
11 | creator_id 3b659a92-dbf0-4301-8fdc-208d78f00d77 | ||
12 | owner_id 3d924400-038e-6ad9-920b-cfbb9b40585c | ||
13 | last_owner_id 101358d5-469d-4b24-9b85-4dc3c05e635d | ||
14 | group_id 00000000-0000-0000-0000-000000000000 | ||
15 | } | ||
16 | sale_info 0 | ||
17 | { | ||
18 | sale_type not | ||
19 | sale_price 10 | ||
20 | } | ||
21 | type 1 | ||
22 | parameters 26 | ||
23 | 108 0 | ||
24 | 110 0 | ||
25 | 111 0 | ||
26 | 116 0 | ||
27 | 117 1 | ||
28 | 150 0 | ||
29 | 162 0 | ||
30 | 163 0 | ||
31 | 165 0 | ||
32 | 700 .01 | ||
33 | 701 .5 | ||
34 | 702 .26 | ||
35 | 703 0 | ||
36 | 704 0 | ||
37 | 705 .5 | ||
38 | 706 .6 | ||
39 | 707 0 | ||
40 | 708 0 | ||
41 | 709 0 | ||
42 | 710 0 | ||
43 | 711 .5 | ||
44 | 712 0 | ||
45 | 713 .7 | ||
46 | 714 0 | ||
47 | 715 0 | ||
48 | 775 0 | ||
49 | textures 3 | ||
50 | 0 f9261672-5058-9ef8-c0c4-48f43a0b16d4 | ||
51 | 5 b6ba53be-b5bf-9a1f-2e19-21daf998429c | ||
52 | 6 703f6e24-a1fb-1980-acaf-6ab8a99a5bd5 | ||
diff --git a/ogs/assetserver/assetserver_config.inc.php b/ogs/assetserver/assetserver_config.inc.php deleted file mode 100644 index b2199f3..0000000 --- a/ogs/assetserver/assetserver_config.inc.php +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | <? | ||
2 | // All the asset server specific stuff lives here | ||
3 | |||
4 | // The asset server's relative URL to the root of the webserver | ||
5 | // If you place this at http://servername/assets then this would be set to /assets/index.php | ||
6 | // wikipedia style URLs need to be implemented - and will be (en.wikipedia.org/wiki/blabla rather than en.wikipedia.org/wiki/index.php?something=bla or en.wikipedia.org/wiki.php/bla) | ||
7 | $asset_home = "/ogs/assetserver/"; | ||
8 | |||
9 | // The key we expect from sims | ||
10 | $sim_recvkey = "1234"; | ||
11 | |||
12 | // The path where the asset repository is stored, this should be readable by the webserver but NOT in the document root | ||
13 | // The default below is BAD for production use and intended to be simply generic - change it or risk copyright theft | ||
14 | // greater than you could ever imagine, alternatively use .htaccess or other mechanisms. | ||
15 | $asset_repos = "/usr/local/sites/osgrid.org/web/ogs/assetserver/assets"; | ||
16 | ?> | ||
diff --git a/ogs/assetserver/index.php b/ogs/assetserver/index.php deleted file mode 100644 index ee20229..0000000 --- a/ogs/assetserver/index.php +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | <? | ||
2 | error_reporting(0); // Remember kids, PHP errors kill XML-RPC responses and REST too! will the slaughter ever end? | ||
3 | |||
4 | include("assetserver_config.inc.php"); | ||
5 | |||
6 | // Parse out the parameters from the URL | ||
7 | $params = str_replace($asset_home,'', $_SERVER['REQUEST_URI']); | ||
8 | $params = str_replace("index.php/","",$params); | ||
9 | $params = split('/',$params); | ||
10 | |||
11 | // Die if the key doesn't match | ||
12 | if($params[1]!=$sim_recvkey) { | ||
13 | die(); | ||
14 | } | ||
15 | |||
16 | // Send requested data | ||
17 | switch($params[0]) { | ||
18 | case 'getasset': | ||
19 | if($params[3]=="data") { | ||
20 | Header("Content-Length: ". (string)filesize($asset_repos . "/" . $params[2] . "/data")); | ||
21 | readfile($asset_repos . "/" . $params[2] . "/data"); | ||
22 | } | ||
23 | break; | ||
24 | } | ||
25 | ?> | ||
diff --git a/ogs/common/database.inc.php.tmpl b/ogs/common/database.inc.php.tmpl deleted file mode 100644 index 42ac5ca..0000000 --- a/ogs/common/database.inc.php.tmpl +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | <? | ||
2 | // this file tells all the OGS services where to find the MySQL database | ||
3 | // if multiple OGS services are running on one machine, it is assumed that they all use the same MySQL server/database | ||
4 | |||
5 | $dbhost="YOURSERVERHERE"; | ||
6 | $dbuser="opengridservice"; | ||
7 | $dbname="OGS"; | ||
8 | $dbpasswd="supersecret"; | ||
9 | ?> | ||
diff --git a/ogs/common/grid_config.inc.php b/ogs/common/grid_config.inc.php deleted file mode 100644 index 0bc6a5e..0000000 --- a/ogs/common/grid_config.inc.php +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | <? | ||
2 | // this file is common across servers and must be kept in sync | ||
3 | |||
4 | $gridserver_url="http://www.garethnelson.com/ogs/gridserver/"; | ||
5 | |||
6 | $grid_owner="Gareth Nelson"; | ||
7 | ?> \ No newline at end of file | ||
diff --git a/ogs/common/util.inc.php b/ogs/common/util.inc.php deleted file mode 100644 index b931205..0000000 --- a/ogs/common/util.inc.php +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | <? | ||
2 | // Some generic utilities which may be used by any services | ||
3 | |||
4 | function inc_lluuid($lluuid) | ||
5 | { | ||
6 | $partB = substr($lluuid, 15); | ||
7 | $partB = (float)base_convert($partB,16,10)+1; | ||
8 | $partB = sprintf('%016x', $partB); | ||
9 | $partA = substr($lluuid, 0, 16); | ||
10 | |||
11 | if(substr($lluuid,15,16)=='FFFFFFFFFFFFFFFE') { | ||
12 | $partA = (float)base_convert($partA,16,10)+1; | ||
13 | $partA = sprintf('%016x', $partA); | ||
14 | } | ||
15 | |||
16 | $returnval = sprintf('%s%s',$partA, $partB); | ||
17 | |||
18 | return $returnval; | ||
19 | } | ||
20 | |||
21 | function format_lluuid($uuid) | ||
22 | { | ||
23 | return strtolower(substr($uuid,0,8)."-".substr($uuid,8,4)."-".substr($uuid,12,4)."-".substr($uuid,16,4)."-".substr($uuid,20)); | ||
24 | } | ||
25 | |||
26 | function output_xml_block($blockname, $data) { | ||
27 | echo("<$blockname>\n"); | ||
28 | foreach($data as $name => $value) { | ||
29 | echo(" <$name>$value</$name>\n"); | ||
30 | } | ||
31 | echo("</$blockname>\n"); | ||
32 | } | ||
33 | |||
34 | function rand_uuid() | ||
35 | { | ||
36 | return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', | ||
37 | mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), | ||
38 | mt_rand( 0, 0x0fff ) | 0x4000, | ||
39 | mt_rand( 0, 0x3fff ) | 0x8000, | ||
40 | mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) ); | ||
41 | } | ||
42 | ?> | ||
diff --git a/ogs/common/xmlrpc.inc.php b/ogs/common/xmlrpc.inc.php deleted file mode 100644 index 03c1ee7..0000000 --- a/ogs/common/xmlrpc.inc.php +++ /dev/null | |||
@@ -1,828 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | IXR - The Inutio XML-RPC Library - (c) Incutio Ltd 2002 | ||
5 | Version 1.61 - Simon Willison, 11th July 2003 (htmlentities -> htmlspecialchars) | ||
6 | Site: http://scripts.incutio.com/xmlrpc/ | ||
7 | Manual: http://scripts.incutio.com/xmlrpc/manual.php | ||
8 | Made available under the Artistic License: http://www.opensource.org/licenses/artistic-license.php | ||
9 | */ | ||
10 | |||
11 | |||
12 | class IXR_Value { | ||
13 | var $data; | ||
14 | var $type; | ||
15 | function IXR_Value ($data, $type = false) { | ||
16 | $this->data = $data; | ||
17 | if (!$type) { | ||
18 | $type = $this->calculateType(); | ||
19 | } | ||
20 | $this->type = $type; | ||
21 | if ($type == 'struct') { | ||
22 | /* Turn all the values in the array in to new IXR_Value objects */ | ||
23 | foreach ($this->data as $key => $value) { | ||
24 | $this->data[$key] = new IXR_Value($value); | ||
25 | } | ||
26 | } | ||
27 | if ($type == 'array') { | ||
28 | for ($i = 0, $j = count($this->data); $i < $j; $i++) { | ||
29 | $this->data[$i] = new IXR_Value($this->data[$i]); | ||
30 | } | ||
31 | } | ||
32 | } | ||
33 | function calculateType() { | ||
34 | if ($this->data === true || $this->data === false) { | ||
35 | return 'boolean'; | ||
36 | } | ||
37 | if (is_integer($this->data)) { | ||
38 | return 'i4'; | ||
39 | } | ||
40 | if (is_double($this->data)) { | ||
41 | return 'double'; | ||
42 | } | ||
43 | // Deal with IXR object types base64 and date | ||
44 | if (is_object($this->data) && is_a($this->data, 'IXR_Date')) { | ||
45 | return 'date'; | ||
46 | } | ||
47 | if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) { | ||
48 | return 'base64'; | ||
49 | } | ||
50 | if (is_object($this->data)) { | ||
51 | return 'object'; | ||
52 | } | ||
53 | if (!is_array($this->data)) { | ||
54 | return 'string'; | ||
55 | } | ||
56 | /* We have an array - is it an array or a struct ? */ | ||
57 | if ($this->isStruct($this->data)) { | ||
58 | return 'struct'; | ||
59 | } else { | ||
60 | return 'array'; | ||
61 | } | ||
62 | } | ||
63 | function getXml() { | ||
64 | /* Return XML for this value */ | ||
65 | switch ($this->type) { | ||
66 | case 'boolean': | ||
67 | return '<boolean>'.(($this->data) ? '1' : '0').'</boolean>'; | ||
68 | break; | ||
69 | case 'i4': | ||
70 | return '<i4>'.$this->data.'</i4>'; | ||
71 | break; | ||
72 | case 'double': | ||
73 | return '<double>'.$this->data.'</double>'; | ||
74 | break; | ||
75 | case 'string': | ||
76 | return '<string>'.htmlspecialchars($this->data).'</string>'; | ||
77 | break; | ||
78 | case 'array': | ||
79 | $return = '<array><data>'.""; | ||
80 | foreach ($this->data as $item) { | ||
81 | $return .= ' <value>'.$item->getXml()."</value>"; | ||
82 | } | ||
83 | $return .= '</data></array>'; | ||
84 | return $return; | ||
85 | break; | ||
86 | case 'struct': | ||
87 | $return = '<struct>'.""; | ||
88 | foreach ($this->data as $name => $value) { | ||
89 | $return .= "<member><name>$name</name><value>"; | ||
90 | $return .= $value->getXml()."</value></member>"; | ||
91 | } | ||
92 | $return .= '</struct>'; | ||
93 | return $return; | ||
94 | break; | ||
95 | case 'date': | ||
96 | case 'base64': | ||
97 | return $this->data->getXml(); | ||
98 | break; | ||
99 | case 'object': | ||
100 | return $this->data->getXml(); | ||
101 | break; | ||
102 | } | ||
103 | return false; | ||
104 | } | ||
105 | function isStruct($array) { | ||
106 | /* Nasty function to check if an array is a struct or not */ | ||
107 | $expected = 0; | ||
108 | foreach ($array as $key => $value) { | ||
109 | if ((string)$key != (string)$expected) { | ||
110 | return true; | ||
111 | } | ||
112 | $expected++; | ||
113 | } | ||
114 | return false; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | |||
119 | class IXR_Message { | ||
120 | var $message; | ||
121 | var $messageType; // methodCall / methodResponse / fault | ||
122 | var $faultCode; | ||
123 | var $faultString; | ||
124 | var $methodName; | ||
125 | var $params; | ||
126 | // Current variable stacks | ||
127 | var $_arraystructs = array(); // The stack used to keep track of the current array/struct | ||
128 | var $_arraystructstypes = array(); // Stack keeping track of if things are structs or array | ||
129 | var $_currentStructName = array(); // A stack as well | ||
130 | var $_param; | ||
131 | var $_value; | ||
132 | var $_currentTag; | ||
133 | var $_currentTagContents; | ||
134 | // The XML parser | ||
135 | var $_parser; | ||
136 | function IXR_Message ($message) { | ||
137 | $this->message = $message; | ||
138 | } | ||
139 | function parse() { | ||
140 | // first remove the XML declaration | ||
141 | $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message); | ||
142 | if (trim($this->message) == '') { | ||
143 | return false; | ||
144 | } | ||
145 | $this->_parser = xml_parser_create(); | ||
146 | // Set XML parser to take the case of tags in to account | ||
147 | xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false); | ||
148 | // Set XML parser callback functions | ||
149 | xml_set_object($this->_parser, $this); | ||
150 | xml_set_element_handler($this->_parser, 'tag_open', 'tag_close'); | ||
151 | xml_set_character_data_handler($this->_parser, 'cdata'); | ||
152 | if (!xml_parse($this->_parser, $this->message)) { | ||
153 | /* die(sprintf('XML error: %s at line %d', | ||
154 | xml_error_string(xml_get_error_code($this->_parser)), | ||
155 | xml_get_current_line_number($this->_parser))); */ | ||
156 | return false; | ||
157 | } | ||
158 | xml_parser_free($this->_parser); | ||
159 | // Grab the error messages, if any | ||
160 | if ($this->messageType == 'fault') { | ||
161 | $this->faultCode = $this->params[0]['faultCode']; | ||
162 | $this->faultString = $this->params[0]['faultString']; | ||
163 | } | ||
164 | return true; | ||
165 | } | ||
166 | function tag_open($parser, $tag, $attr) { | ||
167 | $this->currentTag = $tag; | ||
168 | switch($tag) { | ||
169 | case 'methodCall': | ||
170 | case 'methodResponse': | ||
171 | case 'fault': | ||
172 | $this->messageType = $tag; | ||
173 | break; | ||
174 | /* Deal with stacks of arrays and structs */ | ||
175 | case 'data': // data is to all intents and puposes more interesting than array | ||
176 | $this->_arraystructstypes[] = 'array'; | ||
177 | $this->_arraystructs[] = array(); | ||
178 | break; | ||
179 | case 'struct': | ||
180 | $this->_arraystructstypes[] = 'struct'; | ||
181 | $this->_arraystructs[] = array(); | ||
182 | break; | ||
183 | } | ||
184 | } | ||
185 | function cdata($parser, $cdata) { | ||
186 | $this->_currentTagContents .= $cdata; | ||
187 | } | ||
188 | function tag_close($parser, $tag) { | ||
189 | $valueFlag = false; | ||
190 | switch($tag) { | ||
191 | case 'int': | ||
192 | case 'i4': | ||
193 | $value = (int)trim($this->_currentTagContents); | ||
194 | $this->_currentTagContents = ''; | ||
195 | $valueFlag = true; | ||
196 | break; | ||
197 | case 'double': | ||
198 | $value = (double)trim($this->_currentTagContents); | ||
199 | $this->_currentTagContents = ''; | ||
200 | $valueFlag = true; | ||
201 | break; | ||
202 | case 'string': | ||
203 | $value = (string)trim($this->_currentTagContents); | ||
204 | $this->_currentTagContents = ''; | ||
205 | $valueFlag = true; | ||
206 | break; | ||
207 | case 'dateTime.iso8601': | ||
208 | $value = new IXR_Date(trim($this->_currentTagContents)); | ||
209 | // $value = $iso->getTimestamp(); | ||
210 | $this->_currentTagContents = ''; | ||
211 | $valueFlag = true; | ||
212 | break; | ||
213 | case 'value': | ||
214 | // "If no type is indicated, the type is string." | ||
215 | if (trim($this->_currentTagContents) != '') { | ||
216 | $value = (string)$this->_currentTagContents; | ||
217 | $this->_currentTagContents = ''; | ||
218 | $valueFlag = true; | ||
219 | } | ||
220 | break; | ||
221 | case 'boolean': | ||
222 | $value = (boolean)trim($this->_currentTagContents); | ||
223 | $this->_currentTagContents = ''; | ||
224 | $valueFlag = true; | ||
225 | break; | ||
226 | case 'base64': | ||
227 | $value = base64_decode($this->_currentTagContents); | ||
228 | $this->_currentTagContents = ''; | ||
229 | $valueFlag = true; | ||
230 | break; | ||
231 | /* Deal with stacks of arrays and structs */ | ||
232 | case 'data': | ||
233 | case 'struct': | ||
234 | $value = array_pop($this->_arraystructs); | ||
235 | array_pop($this->_arraystructstypes); | ||
236 | $valueFlag = true; | ||
237 | break; | ||
238 | case 'member': | ||
239 | array_pop($this->_currentStructName); | ||
240 | break; | ||
241 | case 'name': | ||
242 | $this->_currentStructName[] = trim($this->_currentTagContents); | ||
243 | $this->_currentTagContents = ''; | ||
244 | break; | ||
245 | case 'methodName': | ||
246 | $this->methodName = trim($this->_currentTagContents); | ||
247 | $this->_currentTagContents = ''; | ||
248 | break; | ||
249 | } | ||
250 | if ($valueFlag) { | ||
251 | /* | ||
252 | if (!is_array($value) && !is_object($value)) { | ||
253 | $value = trim($value); | ||
254 | } | ||
255 | */ | ||
256 | if (count($this->_arraystructs) > 0) { | ||
257 | // Add value to struct or array | ||
258 | if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') { | ||
259 | // Add to struct | ||
260 | $this->_arraystructs[count($this->_arraystructs)-1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value; | ||
261 | } else { | ||
262 | // Add to array | ||
263 | $this->_arraystructs[count($this->_arraystructs)-1][] = $value; | ||
264 | } | ||
265 | } else { | ||
266 | // Just add as a paramater | ||
267 | $this->params[] = $value; | ||
268 | } | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | |||
273 | |||
274 | class IXR_Server { | ||
275 | var $data; | ||
276 | var $callbacks = array(); | ||
277 | var $message; | ||
278 | var $capabilities; | ||
279 | function IXR_Server($callbacks = false, $data = false) { | ||
280 | $this->setCapabilities(); | ||
281 | if ($callbacks) { | ||
282 | $this->callbacks = $callbacks; | ||
283 | } | ||
284 | $this->setCallbacks(); | ||
285 | $this->serve($data); | ||
286 | } | ||
287 | function serve($data = false) { | ||
288 | if (!$data) { | ||
289 | global $HTTP_RAW_POST_DATA; | ||
290 | if (!$HTTP_RAW_POST_DATA) { | ||
291 | die('XML-RPC server accepts POST requests only.'); | ||
292 | } | ||
293 | $data = $HTTP_RAW_POST_DATA; | ||
294 | } | ||
295 | $this->message = new IXR_Message($data); | ||
296 | if (!$this->message->parse()) { | ||
297 | $this->error(-32700, 'parse error. not well formed'); | ||
298 | } | ||
299 | if ($this->message->messageType != 'methodCall') { | ||
300 | $this->error(-32600, 'server error. invalid xml-rpc. not conforming to spec. Request must be a methodCall'); | ||
301 | } | ||
302 | $result = $this->call($this->message->methodName, $this->message->params); | ||
303 | // Is the result an error? | ||
304 | if (is_a($result, 'IXR_Error')) { | ||
305 | $this->error($result); | ||
306 | } | ||
307 | // Encode the result | ||
308 | $r = new IXR_Value($result); | ||
309 | $resultxml = $r->getXml(); | ||
310 | // Create the XML | ||
311 | $xml = <<<EOD | ||
312 | <methodResponse><params><param><value>$resultxml</value></param></params></methodResponse> | ||
313 | EOD; | ||
314 | // Send it | ||
315 | $this->output($xml); | ||
316 | } | ||
317 | function call($methodname, $args) { | ||
318 | if (!$this->hasMethod($methodname)) { | ||
319 | return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.'); | ||
320 | } | ||
321 | $method = $this->callbacks[$methodname]; | ||
322 | // Perform the callback and send the response | ||
323 | if (count($args) == 1) { | ||
324 | // If only one paramater just send that instead of the whole array | ||
325 | $args = $args[0]; | ||
326 | } | ||
327 | // Are we dealing with a function or a method? | ||
328 | if (substr($method, 0, 5) == 'this:') { | ||
329 | // It's a class method - check it exists | ||
330 | $method = substr($method, 5); | ||
331 | if (!method_exists($this, $method)) { | ||
332 | return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.'); | ||
333 | } | ||
334 | // Call the method | ||
335 | $result = $this->$method($args); | ||
336 | } else { | ||
337 | // It's a function - does it exist? | ||
338 | if (!function_exists($method)) { | ||
339 | return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.'); | ||
340 | } | ||
341 | // Call the function | ||
342 | $result = $method($args); | ||
343 | } | ||
344 | return $result; | ||
345 | } | ||
346 | |||
347 | function error($error, $message = false) { | ||
348 | // Accepts either an error object or an error code and message | ||
349 | if ($message && !is_object($error)) { | ||
350 | $error = new IXR_Error($error, $message); | ||
351 | } | ||
352 | $this->output($error->getXml()); | ||
353 | } | ||
354 | function output($xml) { | ||
355 | $xml = '<?xml version="1.0" encoding="utf-8"?>'."".$xml; | ||
356 | $length = strlen($xml); | ||
357 | header('Connection: close'); | ||
358 | header('Content-Length: '.$length); | ||
359 | header('Content-Type: text/xml'); | ||
360 | header('Date: '.date('r')); | ||
361 | echo $xml; | ||
362 | exit; | ||
363 | } | ||
364 | function hasMethod($method) { | ||
365 | return in_array($method, array_keys($this->callbacks)); | ||
366 | } | ||
367 | function setCapabilities() { | ||
368 | // Initialises capabilities array | ||
369 | $this->capabilities = array( | ||
370 | 'xmlrpc' => array( | ||
371 | 'specUrl' => 'http://www.xmlrpc.com/spec', | ||
372 | 'specVersion' => 1 | ||
373 | ), | ||
374 | 'faults_interop' => array( | ||
375 | 'specUrl' => 'http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php', | ||
376 | 'specVersion' => 20010516 | ||
377 | ), | ||
378 | 'system.multicall' => array( | ||
379 | 'specUrl' => 'http://www.xmlrpc.com/discuss/msgReader$1208', | ||
380 | 'specVersion' => 1 | ||
381 | ), | ||
382 | ); | ||
383 | } | ||
384 | function getCapabilities($args) { | ||
385 | return $this->capabilities; | ||
386 | } | ||
387 | function setCallbacks() { | ||
388 | $this->callbacks['system.getCapabilities'] = 'this:getCapabilities'; | ||
389 | $this->callbacks['system.listMethods'] = 'this:listMethods'; | ||
390 | $this->callbacks['system.multicall'] = 'this:multiCall'; | ||
391 | } | ||
392 | function listMethods($args) { | ||
393 | // Returns a list of methods - uses array_reverse to ensure user defined | ||
394 | // methods are listed before server defined methods | ||
395 | return array_reverse(array_keys($this->callbacks)); | ||
396 | } | ||
397 | function multiCall($methodcalls) { | ||
398 | // See http://www.xmlrpc.com/discuss/msgReader$1208 | ||
399 | $return = array(); | ||
400 | foreach ($methodcalls as $call) { | ||
401 | $method = $call['methodName']; | ||
402 | $params = $call['params']; | ||
403 | if ($method == 'system.multicall') { | ||
404 | $result = new IXR_Error(-32600, 'Recursive calls to system.multicall are forbidden'); | ||
405 | } else { | ||
406 | $result = $this->call($method, $params); | ||
407 | } | ||
408 | if (is_a($result, 'IXR_Error')) { | ||
409 | $return[] = array( | ||
410 | 'faultCode' => $result->code, | ||
411 | 'faultString' => $result->message | ||
412 | ); | ||
413 | } else { | ||
414 | $return[] = array($result); | ||
415 | } | ||
416 | } | ||
417 | return $return; | ||
418 | } | ||
419 | } | ||
420 | |||
421 | class IXR_Request { | ||
422 | var $method; | ||
423 | var $args; | ||
424 | var $xml; | ||
425 | function IXR_Request($method, $args) { | ||
426 | $this->method = $method; | ||
427 | $this->args = $args; | ||
428 | $this->xml = <<<EOD | ||
429 | <?xml version="1.0"?> | ||
430 | <methodCall> | ||
431 | <methodName>{$this->method}</methodName> | ||
432 | <params> | ||
433 | |||
434 | EOD; | ||
435 | foreach ($this->args as $arg) { | ||
436 | $this->xml .= '<param><value>'; | ||
437 | $v = new IXR_Value($arg); | ||
438 | $this->xml .= $v->getXml(); | ||
439 | $this->xml .= "</value></param>"; | ||
440 | } | ||
441 | $this->xml .= '</params></methodCall>'; | ||
442 | } | ||
443 | function getLength() { | ||
444 | return strlen($this->xml); | ||
445 | } | ||
446 | function getXml() { | ||
447 | return $this->xml; | ||
448 | } | ||
449 | } | ||
450 | |||
451 | |||
452 | class IXR_Client { | ||
453 | var $server; | ||
454 | var $port; | ||
455 | var $path; | ||
456 | var $useragent; | ||
457 | var $response; | ||
458 | var $message = false; | ||
459 | var $debug = false; | ||
460 | // Storage place for an error message | ||
461 | var $error = false; | ||
462 | function IXR_Client($server, $path = false, $port = 80) { | ||
463 | if (!$path) { | ||
464 | // Assume we have been given a URL instead | ||
465 | $bits = parse_url($server); | ||
466 | $this->server = $bits['host']; | ||
467 | $this->port = isset($bits['port']) ? $bits['port'] : 80; | ||
468 | $this->path = isset($bits['path']) ? $bits['path'] : '/'; | ||
469 | // Make absolutely sure we have a path | ||
470 | if (!$this->path) { | ||
471 | $this->path = '/'; | ||
472 | } | ||
473 | } else { | ||
474 | $this->server = $server; | ||
475 | $this->path = $path; | ||
476 | $this->port = $port; | ||
477 | } | ||
478 | $this->useragent = 'The Incutio XML-RPC PHP Library'; | ||
479 | } | ||
480 | function query() { | ||
481 | $args = func_get_args(); | ||
482 | $method = array_shift($args); | ||
483 | $request = new IXR_Request($method, $args); | ||
484 | $length = $request->getLength(); | ||
485 | $xml = $request->getXml(); | ||
486 | $r = "\r\n"; | ||
487 | $request = "POST {$this->path} HTTP/1.0$r"; | ||
488 | $request .= "Host: {$this->server}$r"; | ||
489 | $request .= "Content-Type: text/xml$r"; | ||
490 | $request .= "User-Agent: {$this->useragent}$r"; | ||
491 | $request .= "Content-length: {$length}$r$r"; | ||
492 | $request .= $xml; | ||
493 | // Now send the request | ||
494 | if ($this->debug) { | ||
495 | echo '<pre>'.htmlspecialchars($request)."\n</pre>\n\n"; | ||
496 | } | ||
497 | $fp = @fsockopen($this->server, $this->port); | ||
498 | if (!$fp) { | ||
499 | $this->error = new IXR_Error(-32300, 'transport error - could not open socket'); | ||
500 | return false; | ||
501 | } | ||
502 | fputs($fp, $request); | ||
503 | $contents = ''; | ||
504 | $gotFirstLine = false; | ||
505 | $gettingHeaders = true; | ||
506 | while (!feof($fp)) { | ||
507 | $line = fgets($fp, 4096); | ||
508 | if (!$gotFirstLine) { | ||
509 | // Check line for '200' | ||
510 | if (strstr($line, '200') === false) { | ||
511 | $this->error = new IXR_Error(-32300, 'transport error - HTTP status code was not 200'); | ||
512 | return false; | ||
513 | } | ||
514 | $gotFirstLine = true; | ||
515 | } | ||
516 | if (trim($line) == '') { | ||
517 | $gettingHeaders = false; | ||
518 | } | ||
519 | if (!$gettingHeaders) { | ||
520 | $contents .= trim($line)."\n"; | ||
521 | } | ||
522 | } | ||
523 | if ($this->debug) { | ||
524 | echo '<pre>'.htmlspecialchars($contents)."\n</pre>\n\n"; | ||
525 | } | ||
526 | // Now parse what we've got back | ||
527 | $this->message = new IXR_Message($contents); | ||
528 | if (!$this->message->parse()) { | ||
529 | // XML error | ||
530 | $this->error = new IXR_Error(-32700, 'parse error. not well formed'); | ||
531 | return false; | ||
532 | } | ||
533 | // Is the message a fault? | ||
534 | if ($this->message->messageType == 'fault') { | ||
535 | $this->error = new IXR_Error($this->message->faultCode, $this->message->faultString); | ||
536 | return false; | ||
537 | } | ||
538 | // Message must be OK | ||
539 | return true; | ||
540 | } | ||
541 | function getResponse() { | ||
542 | // methodResponses can only have one param - return that | ||
543 | return $this->message->params[0]; | ||
544 | } | ||
545 | function isError() { | ||
546 | return (is_object($this->error)); | ||
547 | } | ||
548 | function getErrorCode() { | ||
549 | return $this->error->code; | ||
550 | } | ||
551 | function getErrorMessage() { | ||
552 | return $this->error->message; | ||
553 | } | ||
554 | } | ||
555 | |||
556 | |||
557 | class IXR_Error { | ||
558 | var $code; | ||
559 | var $message; | ||
560 | function IXR_Error($code, $message) { | ||
561 | $this->code = $code; | ||
562 | $this->message = $message; | ||
563 | } | ||
564 | function getXml() { | ||
565 | $xml = <<<EOD | ||
566 | <methodResponse> | ||
567 | <fault> | ||
568 | <value> | ||
569 | <struct> | ||
570 | <member> | ||
571 | <name>faultCode</name> | ||
572 | <value><int>{$this->code}</int></value> | ||
573 | </member> | ||
574 | <member> | ||
575 | <name>faultString</name> | ||
576 | <value><string>{$this->message}</string></value> | ||
577 | </member> | ||
578 | </struct> | ||
579 | </value> | ||
580 | </fault> | ||
581 | </methodResponse> | ||
582 | |||
583 | EOD; | ||
584 | return $xml; | ||
585 | } | ||
586 | } | ||
587 | |||
588 | |||
589 | class IXR_Date { | ||
590 | var $year; | ||
591 | var $month; | ||
592 | var $day; | ||
593 | var $hour; | ||
594 | var $minute; | ||
595 | var $second; | ||
596 | function IXR_Date($time) { | ||
597 | // $time can be a PHP timestamp or an ISO one | ||
598 | if (is_numeric($time)) { | ||
599 | $this->parseTimestamp($time); | ||
600 | } else { | ||
601 | $this->parseIso($time); | ||
602 | } | ||
603 | } | ||
604 | function parseTimestamp($timestamp) { | ||
605 | $this->year = date('Y', $timestamp); | ||
606 | $this->month = date('Y', $timestamp); | ||
607 | $this->day = date('Y', $timestamp); | ||
608 | $this->hour = date('H', $timestamp); | ||
609 | $this->minute = date('i', $timestamp); | ||
610 | $this->second = date('s', $timestamp); | ||
611 | } | ||
612 | function parseIso($iso) { | ||
613 | $this->year = substr($iso, 0, 4); | ||
614 | $this->month = substr($iso, 4, 2); | ||
615 | $this->day = substr($iso, 6, 2); | ||
616 | $this->hour = substr($iso, 9, 2); | ||
617 | $this->minute = substr($iso, 12, 2); | ||
618 | $this->second = substr($iso, 15, 2); | ||
619 | } | ||
620 | function getIso() { | ||
621 | return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second; | ||
622 | } | ||
623 | function getXml() { | ||
624 | return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>'; | ||
625 | } | ||
626 | function getTimestamp() { | ||
627 | return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year); | ||
628 | } | ||
629 | } | ||
630 | |||
631 | class LLBlock { | ||
632 | var $data; | ||
633 | var $xml; | ||
634 | |||
635 | function LLBlock($data) { | ||
636 | $this->data = $data; | ||
637 | } | ||
638 | |||
639 | function getXml() { | ||
640 | if(count($this->data)>0) { | ||
641 | $this->xml="<array><data><value><struct>"; | ||
642 | foreach($this->data as $name => $value) { | ||
643 | $this->xml=$this->xml."<member><name>".$name."</name><value><string>".$value."</string></value></member>"; | ||
644 | } | ||
645 | $this->xml=$this->xml."</struct></value></data></array>"; | ||
646 | return $this->xml; | ||
647 | } | ||
648 | } | ||
649 | } | ||
650 | |||
651 | class IXR_Base64 { | ||
652 | var $data; | ||
653 | function IXR_Base64($data) { | ||
654 | $this->data = $data; | ||
655 | } | ||
656 | function getXml() { | ||
657 | return '<base64>'.base64_encode($this->data).'</base64>'; | ||
658 | } | ||
659 | } | ||
660 | |||
661 | |||
662 | class IXR_IntrospectionServer extends IXR_Server { | ||
663 | var $signatures; | ||
664 | var $help; | ||
665 | function IXR_IntrospectionServer() { | ||
666 | $this->setCallbacks(); | ||
667 | $this->setCapabilities(); | ||
668 | $this->capabilities['introspection'] = array( | ||
669 | 'specUrl' => 'http://xmlrpc.usefulinc.com/doc/reserved.html', | ||
670 | 'specVersion' => 1 | ||
671 | ); | ||
672 | $this->addCallback( | ||
673 | 'system.methodSignature', | ||
674 | 'this:methodSignature', | ||
675 | array('array', 'string'), | ||
676 | 'Returns an array describing the return type and required parameters of a method' | ||
677 | ); | ||
678 | $this->addCallback( | ||
679 | 'system.getCapabilities', | ||
680 | 'this:getCapabilities', | ||
681 | array('struct'), | ||
682 | 'Returns a struct describing the XML-RPC specifications supported by this server' | ||
683 | ); | ||
684 | $this->addCallback( | ||
685 | 'system.listMethods', | ||
686 | 'this:listMethods', | ||
687 | array('array'), | ||
688 | 'Returns an array of available methods on this server' | ||
689 | ); | ||
690 | $this->addCallback( | ||
691 | 'system.methodHelp', | ||
692 | 'this:methodHelp', | ||
693 | array('string', 'string'), | ||
694 | 'Returns a documentation string for the specified method' | ||
695 | ); | ||
696 | } | ||
697 | function addCallback($method, $callback, $args, $help) { | ||
698 | $this->callbacks[$method] = $callback; | ||
699 | $this->signatures[$method] = $args; | ||
700 | $this->help[$method] = $help; | ||
701 | } | ||
702 | function call($methodname, $args) { | ||
703 | // Make sure it's in an array | ||
704 | if ($args && !is_array($args)) { | ||
705 | $args = array($args); | ||
706 | } | ||
707 | // Over-rides default call method, adds signature check | ||
708 | if (!$this->hasMethod($methodname)) { | ||
709 | return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.'); | ||
710 | } | ||
711 | $method = $this->callbacks[$methodname]; | ||
712 | $signature = $this->signatures[$methodname]; | ||
713 | $returnType = array_shift($signature); | ||
714 | // Check the number of arguments | ||
715 | if (count($args) != count($signature)) { | ||
716 | // print 'Num of args: '.count($args).' Num in signature: '.count($signature); | ||
717 | return new IXR_Error(-32602, 'server error. wrong number of method parameters'); | ||
718 | } | ||
719 | // Check the argument types | ||
720 | $ok = true; | ||
721 | $argsbackup = $args; | ||
722 | for ($i = 0, $j = count($args); $i < $j; $i++) { | ||
723 | $arg = array_shift($args); | ||
724 | $type = array_shift($signature); | ||
725 | switch ($type) { | ||
726 | case 'int': | ||
727 | case 'i4': | ||
728 | if (is_array($arg) || !is_int($arg)) { | ||
729 | $ok = false; | ||
730 | } | ||
731 | break; | ||
732 | case 'base64': | ||
733 | case 'string': | ||
734 | if (!is_string($arg)) { | ||
735 | $ok = false; | ||
736 | } | ||
737 | break; | ||
738 | case 'boolean': | ||
739 | if ($arg !== false && $arg !== true) { | ||
740 | $ok = false; | ||
741 | } | ||
742 | break; | ||
743 | case 'float': | ||
744 | case 'double': | ||
745 | if (!is_float($arg)) { | ||
746 | $ok = false; | ||
747 | } | ||
748 | break; | ||
749 | case 'date': | ||
750 | case 'dateTime.iso8601': | ||
751 | if (!is_a($arg, 'IXR_Date')) { | ||
752 | $ok = false; | ||
753 | } | ||
754 | break; | ||
755 | } | ||
756 | if (!$ok) { | ||
757 | return new IXR_Error(-32602, 'server error. invalid method parameters'); | ||
758 | } | ||
759 | } | ||
760 | // It passed the test - run the "real" method call | ||
761 | return parent::call($methodname, $argsbackup); | ||
762 | } | ||
763 | function methodSignature($method) { | ||
764 | if (!$this->hasMethod($method)) { | ||
765 | return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.'); | ||
766 | } | ||
767 | // We should be returning an array of types | ||
768 | $types = $this->signatures[$method]; | ||
769 | $return = array(); | ||
770 | foreach ($types as $type) { | ||
771 | switch ($type) { | ||
772 | case 'string': | ||
773 | $return[] = 'string'; | ||
774 | break; | ||
775 | case 'int': | ||
776 | case 'i4': | ||
777 | $return[] = 42; | ||
778 | break; | ||
779 | case 'double': | ||
780 | $return[] = 3.1415; | ||
781 | break; | ||
782 | case 'dateTime.iso8601': | ||
783 | $return[] = new IXR_Date(time()); | ||
784 | break; | ||
785 | case 'boolean': | ||
786 | $return[] = true; | ||
787 | break; | ||
788 | case 'base64': | ||
789 | $return[] = new IXR_Base64('base64'); | ||
790 | break; | ||
791 | case 'array': | ||
792 | $return[] = array('array'); | ||
793 | break; | ||
794 | case 'struct': | ||
795 | $return[] = array('struct' => 'struct'); | ||
796 | break; | ||
797 | } | ||
798 | } | ||
799 | return $return; | ||
800 | } | ||
801 | function methodHelp($method) { | ||
802 | return $this->help[$method]; | ||
803 | } | ||
804 | } | ||
805 | |||
806 | |||
807 | class IXR_ClientMulticall extends IXR_Client { | ||
808 | var $calls = array(); | ||
809 | function IXR_ClientMulticall($server, $path = false, $port = 80) { | ||
810 | parent::IXR_Client($server, $path, $port); | ||
811 | $this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)'; | ||
812 | } | ||
813 | function addCall() { | ||
814 | $args = func_get_args(); | ||
815 | $methodName = array_shift($args); | ||
816 | $struct = array( | ||
817 | 'methodName' => $methodName, | ||
818 | 'params' => $args | ||
819 | ); | ||
820 | $this->calls[] = $struct; | ||
821 | } | ||
822 | function query() { | ||
823 | // Prepare multicall, then call the parent::query() method | ||
824 | return parent::query('system.multicall', $this->calls); | ||
825 | } | ||
826 | } | ||
827 | |||
828 | ?> | ||
diff --git a/ogs/gridserver/gridserver_config.inc.php b/ogs/gridserver/gridserver_config.inc.php deleted file mode 100644 index 98ebed3..0000000 --- a/ogs/gridserver/gridserver_config.inc.php +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | <? | ||
2 | // All the grid server specific stuff lives here | ||
3 | |||
4 | // What we send to authenticate to the user/login server | ||
5 | $userserver_sendkey="1234"; | ||
6 | |||
7 | // What we expect to get back from the user/login server | ||
8 | $userserver_recvkey="1234"; | ||
9 | |||
10 | $sim_recvkey = "1234"; | ||
11 | $sim_sendkey = "1234"; | ||
12 | |||
13 | $grid_home = "/ogs/gridserver/"; | ||
14 | ?> | ||
diff --git a/ogs/gridserver/index.php b/ogs/gridserver/index.php deleted file mode 100644 index f7754c6..0000000 --- a/ogs/gridserver/index.php +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | <? | ||
2 | error_reporting(E_ALL); // yes, we remember this from the login server, don't we boys and girls? don't kill innocent XML-RPC! | ||
3 | |||
4 | // these files are soooo common..... (to the grid) | ||
5 | include("../common/xmlrpc.inc.php"); | ||
6 | include("../common/database.inc.php"); | ||
7 | include("../common/grid_config.inc.php"); | ||
8 | include("../common/util.inc.php"); | ||
9 | |||
10 | include("gridserver_config.inc.php"); // grid server specific config stuff | ||
11 | |||
12 | function get_sim_info($args) { | ||
13 | global $dbhost,$dbuser,$dbpasswd,$dbname; | ||
14 | global $userserver_sendkey, $userserver_recvkey; | ||
15 | |||
16 | // First see who's talking to us, if key is invalid then send an invalid one back and nothing more | ||
17 | if($args['authkey']!=$userserver_recvkey) { | ||
18 | return Array( | ||
19 | 'authkey' => 'I can play the bad key trick too you know', | ||
20 | 'login' => 'false' | ||
21 | ); | ||
22 | } | ||
23 | |||
24 | // if we get to here, the key is valid, give that login server what it wants! | ||
25 | |||
26 | $link = mysql_connect($dbhost,$dbuser,$dbpasswd) | ||
27 | OR die("Unable to connect to database"); | ||
28 | |||
29 | mysql_select_db($dbname) | ||
30 | or die("Unable to select database"); | ||
31 | |||
32 | $region_handle = $args['region_handle']; | ||
33 | $query = "SELECT * FROM region_profiles WHERE region_handle='$region_handle'"; | ||
34 | $result = mysql_query($query); | ||
35 | |||
36 | return mysql_fetch_assoc($result); | ||
37 | } | ||
38 | |||
39 | function get_session_info($args) { | ||
40 | global $dbhost,$dbuser,$dbpasswd,$dbname; | ||
41 | global $sim_sendkey, $sim_recvkey; | ||
42 | |||
43 | // authkey, session-id, agent-id | ||
44 | |||
45 | // First see who's talking to us, if key is invalid then send an invalid one back and nothing more | ||
46 | if($args[0]!=$sim_recvkey) { | ||
47 | return Array( | ||
48 | 'authkey' => "I can play the bad key trick too you know" | ||
49 | ); | ||
50 | } | ||
51 | |||
52 | $link = mysql_connect($dbhost,$dbuser,$dbpasswd) | ||
53 | OR die("Unable to connect to database"); | ||
54 | |||
55 | mysql_select_db($dbname) | ||
56 | or die("Unable to select database"); | ||
57 | |||
58 | $session_id = $args[1]; | ||
59 | $agent_id = $args[2]; | ||
60 | |||
61 | $query = "SELECT * FROM sessions WHERE session_id = '$session_id' AND agent_id='$agent_id' AND session_active=1"; | ||
62 | $result = mysql_query($query); | ||
63 | if(mysql_num_rows($result)>0) { | ||
64 | $info=mysql_fetch_assoc($result); | ||
65 | $circuit_code = $info['circuit_code']; | ||
66 | $secure_session_id=$info['secure_session_id']; | ||
67 | |||
68 | $query = "SELECT * FROM local_user_profiles WHERE userprofile_LLUUID='$agent_id'"; | ||
69 | $result=mysql_query($query); | ||
70 | $userinfo=mysql_fetch_assoc($result); | ||
71 | $firstname=$userinfo['profile_firstname']; | ||
72 | $lastname=$userinfo['profile_lastname']; | ||
73 | $agent_id=$userinfo['userprofile_LLUUID']; | ||
74 | return Array( | ||
75 | 'authkey' => $sim_sendkey, | ||
76 | 'circuit_code' => $circuit_code, | ||
77 | 'agent_id' => $agent_id, | ||
78 | 'session_id' => $session_id, | ||
79 | 'secure_session_id' => $secure_session_id, | ||
80 | 'firstname' => $firstname, | ||
81 | 'lastname' => $lastname | ||
82 | ); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | function check_loggedin($args) { | ||
87 | global $dbhost,$dbuser,$dbpasswd,$dbname; | ||
88 | global $userserver_sendkey, $userserver_recvkey; | ||
89 | |||
90 | // First see who's talking to us, if key is invalid then send an invalid one back and nothing more | ||
91 | if($args['authkey']!=$userserver_recvkey) { | ||
92 | return Array( | ||
93 | 'authkey' => "I can play the bad key trick too you know" | ||
94 | ); | ||
95 | } | ||
96 | |||
97 | // if we get to here, the key is valid, give that login server what it wants! | ||
98 | |||
99 | $link = mysql_connect($dbhost,$dbuser,$dbpasswd) | ||
100 | OR die("Unable to connect to database"); | ||
101 | |||
102 | mysql_select_db($dbname) | ||
103 | or die("Unable to select database"); | ||
104 | |||
105 | $userprofile_LLUUID = $args['userprofile_LLUUID']; | ||
106 | $query = "SELECT * FROM sessions WHERE agent_id='$userprofile_LLUUID' AND session_active=1"; | ||
107 | $result = mysql_query($query); | ||
108 | |||
109 | if(mysql_num_rows($result)>1) { | ||
110 | return Array( | ||
111 | 'authkey' => $userserver_sendkey, | ||
112 | 'logged_in' => 1 | ||
113 | ); | ||
114 | } else { | ||
115 | return Array( | ||
116 | 'authkey' => $userserver_sendkey, | ||
117 | 'logged_in' => 0 | ||
118 | ); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | function create_session($args) { | ||
123 | global $dbhost,$dbuser,$dbpasswd,$dbname; | ||
124 | global $userserver_sendkey, $userserver_recvkey; | ||
125 | |||
126 | // First see who's talking to us, if key is invalid then send an invalid one back and nothing more | ||
127 | if($args['authkey']!=$userserver_recvkey) { | ||
128 | return Array( | ||
129 | 'authkey' => "I can play the bad key trick too you know" | ||
130 | ); | ||
131 | } | ||
132 | |||
133 | // if we get to here, the key is valid, give that login server what it wants! | ||
134 | |||
135 | $link = mysql_connect($dbhost,$dbuser,$dbpasswd) | ||
136 | OR die("Unable to connect to database"); | ||
137 | |||
138 | mysql_select_db($dbname) | ||
139 | or die("Unable to select database"); | ||
140 | |||
141 | // yes, secure_sessionid should be different, i know... | ||
142 | $query = "SELECT value FROM Grid_settings WHERE setting='highest_LLUUID'"; | ||
143 | $result = mysql_query($query); | ||
144 | $row = mysql_fetch_array($result); | ||
145 | $highest_LLUUID = $row['value']; | ||
146 | $newsession_id=inc_lluuid($highest_LLUUID); | ||
147 | $secure_session_id=inc_lluuid($newsession_id); | ||
148 | |||
149 | $query="UPDATE Grid_settings SET value='$secure_session_id' WHERE setting='highest_LLUUID' LIMIT 1"; | ||
150 | $result=mysql_query($query); | ||
151 | |||
152 | $userprofile_LLUUID=$args['userprofile_LLUUID']; | ||
153 | $current_location=$args['current_location']; | ||
154 | $remote_ip=$args['remote_ip']; | ||
155 | $query="INSERT INTO sessions(session_id,secure_session_id,agent_id,session_start,session_active,current_location,remote_ip) VALUES('$newsession_id','$secure_session_id','$userprofile_LLUUID',NOW(),1,'$current_location','$remote_ip')"; | ||
156 | $result=mysql_query($query); | ||
157 | if(!isset($result)) { | ||
158 | die(); | ||
159 | } | ||
160 | return Array( | ||
161 | 'authkey' => $userserver_sendkey, | ||
162 | 'session_id' => $newsession_id, | ||
163 | 'secure_session_id' => $secure_session_id | ||
164 | ); | ||
165 | } | ||
166 | |||
167 | $server=new IXR_Server( | ||
168 | Array( | ||
169 | 'check_session_loggedin' => 'check_loggedin', | ||
170 | 'create_session' => 'create_session', | ||
171 | 'get_sim_info' => 'get_sim_info', | ||
172 | 'get_session_info' => 'get_session_info' | ||
173 | ) | ||
174 | ); | ||
175 | |||
176 | ?> \ No newline at end of file | ||
diff --git a/ogs/gridserver/usersessions/.htaccess b/ogs/gridserver/usersessions/.htaccess deleted file mode 100644 index 3b76a74..0000000 --- a/ogs/gridserver/usersessions/.htaccess +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | Options +FollowSymlinks | ||
2 | |||
3 | RewriteEngine on | ||
4 | RewriteOptions MaxRedirects=1 | ||
5 | RewriteRule .* index.php [L] | ||
diff --git a/ogs/gridserver/usersessions/index.php b/ogs/gridserver/usersessions/index.php deleted file mode 100644 index e7a3817..0000000 --- a/ogs/gridserver/usersessions/index.php +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | <? | ||
2 | // DIRTY HACK ALERT!!!!!!!!!!!!! | ||
3 | // The following code shows the vital importance of the r69 revision of the original gareth/ branch | ||
4 | |||
5 | |||
6 | // This file parses URLs of the format: | ||
7 | // usersessions/key/userid/data | ||
8 | // where key is the key to authenticate with the grid, userid is the user's LLUUID and data is the data about the user's session being requested | ||
9 | // if the data requested is left out, an XML response will be sent | ||
10 | |||
11 | error_reporting(E_ALL); // Remember kids, PHP errors kill XML-RPC responses and REST too! will the slaughter ever end? | ||
12 | |||
13 | include("../gridserver_config.inc.php"); | ||
14 | include("../../common/database.inc.php"); | ||
15 | include("../../common/util.inc.php"); | ||
16 | |||
17 | // Parse out the parameters from the URL | ||
18 | $params = str_replace($grid_home,'', $_SERVER['REQUEST_URI']); | ||
19 | $params = str_replace("index.php/","",$params); | ||
20 | $params = split('/',$params); | ||
21 | |||
22 | // Die if the key doesn't match | ||
23 | if($params[1]!=$sim_recvkey) { | ||
24 | die(); | ||
25 | } | ||
26 | |||
27 | $link = mysql_connect($dbhost,$dbuser,$dbpasswd) | ||
28 | OR die("Unable to connect to database"); | ||
29 | |||
30 | mysql_select_db($dbname) | ||
31 | or die("Unable to select database"); | ||
32 | |||
33 | $agent_id = strtolower($params[2]); | ||
34 | $query = "SELECT * FROM sessions WHERE agent_id='$agent_id' AND session_active=1"; | ||
35 | |||
36 | // if we have 4 params, then param 4 is the command | ||
37 | if(count($params)==4) { | ||
38 | $cmd=$params['3']; | ||
39 | } else if(count($params)==5) { | ||
40 | $circuit_code=$params[3]; | ||
41 | $cmd=$params[4]; // otherwise, 5 is the command and 4 is the circuit code | ||
42 | } | ||
43 | |||
44 | $result = mysql_query($query); | ||
45 | if(mysql_num_rows($result)>0) { | ||
46 | $info=mysql_fetch_assoc($result); | ||
47 | $circuit_code = $info['circuit_code']; | ||
48 | if($circuit_code == 0) $circuit_code=$params['4']; | ||
49 | $secure_session_id=$info['secure_session_id']; | ||
50 | $session_id=$info['session_id']; | ||
51 | |||
52 | $query = "SELECT * FROM local_user_profiles WHERE userprofile_LLUUID='$agent_id'"; | ||
53 | $result=mysql_query($query); | ||
54 | $userinfo=mysql_fetch_assoc($result); | ||
55 | $firstname=$userinfo['profile_firstname']; | ||
56 | $lastname=$userinfo['profile_lastname']; | ||
57 | $agent_id=$userinfo['userprofile_LLUUID']; | ||
58 | $exists=1; | ||
59 | } else { | ||
60 | $exists=0; | ||
61 | } | ||
62 | |||
63 | // if only 3 params, assume we are sending an XML response | ||
64 | if(count($params)==3) { | ||
65 | output_xml_block("usersession",Array( | ||
66 | 'authkey' => $sim_sendkey, | ||
67 | 'circuit_code' => $circuit_code, | ||
68 | 'agent_id' => $agent_id, | ||
69 | 'session_id' => $session_id, | ||
70 | 'secure_session_id' => $secure_session_id, | ||
71 | 'firstname' => $firstname, | ||
72 | 'lastname' => $lastname | ||
73 | )); | ||
74 | } | ||
75 | |||
76 | switch($cmd) { | ||
77 | case 'exists': | ||
78 | echo $exists; | ||
79 | break; | ||
80 | case 'delete': | ||
81 | $query = "UPDATE sessions SET session_active=0, session_end=NOW() WHERE agent_id='$agent_id' LIMIT 1"; | ||
82 | $deleteresult = mysql_query($query); | ||
83 | break; | ||
84 | } | ||
85 | ?> | ||
diff --git a/ogs/login/index.php b/ogs/login/index.php deleted file mode 100644 index 4f53c11..0000000 --- a/ogs/login/index.php +++ /dev/null | |||
@@ -1,170 +0,0 @@ | |||
1 | <? | ||
2 | error_reporting(0); // Remember kids, PHP errors kill XML-RPC responses! | ||
3 | |||
4 | // include all the common stuff | ||
5 | include("../common/xmlrpc.inc.php"); | ||
6 | include("../common/database.inc.php"); | ||
7 | include("../common/grid_config.inc.php"); | ||
8 | include("../common/util.inc.php"); | ||
9 | |||
10 | include("login_config.inc.php"); // include login/user specific config stuff (authentication keys etc) | ||
11 | |||
12 | function login($args) { | ||
13 | global $dbhost,$dbuser,$dbpasswd,$dbname; | ||
14 | global $grid_owner, $gridserver_sendkey, $gridserver_recvkey, $gridserver_url; | ||
15 | |||
16 | |||
17 | if(get_magic_quotes_gpc()) { | ||
18 | $firstname=addslashes($args['first']); | ||
19 | $lastname=addslashes($args['last']); | ||
20 | $passwd=addslashes($args['passwd']); | ||
21 | } else { | ||
22 | $firstname=$args['first']; | ||
23 | $lastname=$args['last']; | ||
24 | $passwd=$args['passwd']; | ||
25 | } | ||
26 | |||
27 | $link = mysql_connect($dbhost,$dbuser,$dbpasswd) | ||
28 | OR die("Unable to connect to database"); | ||
29 | |||
30 | mysql_select_db($dbname) | ||
31 | or die("Unable to select database"); | ||
32 | |||
33 | $query = "SELECT userprofile_LLUUID, profile_firstname, profile_lastname, profile_passwdmd5, homesim_ip, homesim_port, homeasset_url, look_at, region_handle, position FROM local_user_profiles WHERE profile_firstname='".$firstname."' AND profile_lastname='".$lastname."' AND profile_passwdmd5='" .$passwd."'"; | ||
34 | |||
35 | $profile_lookup_result=mysql_query($query); | ||
36 | |||
37 | if(mysql_num_rows($profile_lookup_result) >0) { | ||
38 | $profiledata = mysql_fetch_assoc($profile_lookup_result); | ||
39 | |||
40 | // if we get here, the username/password is valid, but still need to check there's not an already existing session | ||
41 | $client = new IXR_Client($gridserver_url); | ||
42 | if (!$client->query('check_session_loggedin', Array('userprofile_LLUUID' => $profiledata['userprofile_LLUUID'], 'authkey' => $gridserver_sendkey, 'server_type' => 'login'))) { // if this doesn't work, grid server is down - that's bad | ||
43 | return Array ( | ||
44 | 'reason' => 'key', | ||
45 | 'message' => "Could not connect to grid server. Please try again later or contact the grid owner ". $grid_owner, | ||
46 | 'login' => "false" | ||
47 | ); | ||
48 | } | ||
49 | |||
50 | $response=$client->getResponse(); | ||
51 | if($response['authkey'] != $gridserver_recvkey) { // if this doesn't match up, it's a fake grid server | ||
52 | return Array ( | ||
53 | 'reason' => 'key', | ||
54 | 'message' => "Could not connect to grid server due to possible security issues. It is possible that the grid has been compromised. Please contact the grid owner " . $grid_owner . " and report this issue", | ||
55 | 'login' => "false" | ||
56 | ); | ||
57 | } | ||
58 | |||
59 | |||
60 | if($response['logged_in'] == 1) { // if the user is already logged in, tell them | ||
61 | return Array ( | ||
62 | 'reason' => 'presence', | ||
63 | 'message' => "You appear to already be logged into this grid, if your client has recently crashed then please try again later", | ||
64 | 'login' => "false" | ||
65 | ); | ||
66 | } | ||
67 | |||
68 | // now we start a new session on the grid | ||
69 | $remote_ip=$_SERVER['REMOTE_ADDR']; | ||
70 | $region_handle=$profiledata['region_handle']; | ||
71 | $client->query('create_session',Array('userprofile_LLUUID' => $profiledata['userprofile_LLUUID'], 'authkey' => $gridserver_sendkey, 'remote_ip' => $remote_ip, 'current_location' => $region_handle)); | ||
72 | $response = $client->getResponse(); | ||
73 | $session_id = $response['session_id']; | ||
74 | $secure_session_id = $response['secure_session_id']; | ||
75 | |||
76 | // ask the grid server what the IP address and port of the sim we want to connect to is | ||
77 | $client->query('get_sim_info', Array('region_handle' => $region_handle, 'authkey' => $gridserver_sendkey) ); | ||
78 | $siminfo = $client->getResponse(); | ||
79 | |||
80 | // send the final response! | ||
81 | $position=$profiledata['position']; | ||
82 | $look_at=$profiledata['look_at']; | ||
83 | |||
84 | $LocX=intval($siminfo['GridLocX'])*256; | ||
85 | $LocY=intval($siminfo['GridLocY'])*256; | ||
86 | $home="{'region_handle':'$region_handle', 'position':'$position', 'look_at':'$look_at'}"; | ||
87 | |||
88 | $globaltextures = new LLBlock( | ||
89 | Array( | ||
90 | 'sun_texture_id' => "cce0f112-878f-4586-a2e2-a8f104bba271", | ||
91 | 'cloud_texture_id' => "fc4b9f0b-d008-45c6-96a4-01dd947ac621", | ||
92 | 'moon_texture_id' => "d07f6eed-b96a-47cd-b51d-400ad4a1c428" | ||
93 | )); | ||
94 | |||
95 | $login_flags = new LLBlock( | ||
96 | Array( | ||
97 | 'stipend_since_login' => "N", | ||
98 | 'ever_logged_in' => "Y", | ||
99 | 'gendered' => "Y", | ||
100 | 'daylight_savings' => "N" | ||
101 | )); | ||
102 | $ui_config = new LLBlock( | ||
103 | Array( | ||
104 | 'allow_first_life' => "Y" | ||
105 | )); | ||
106 | $inventory_skeleton = new LLBlock(Array( | ||
107 | Array( | ||
108 | 'name' => 'My inventory', | ||
109 | 'parent_id' => '00000000-0000-0000-0000-000000000000', | ||
110 | 'version' => 4, | ||
111 | 'type_default' => 8, | ||
112 | 'folder_id' => 'f798e114-c10f-409b-a90d-a11577ff1de8' | ||
113 | ), | ||
114 | Array( | ||
115 | 'name' => 'Textures', | ||
116 | 'parent_id' => 'f798e114-c10f-409b-a90d-a11577ff1de8', | ||
117 | 'version' => 1, | ||
118 | 'type_default' => 0, | ||
119 | 'folder_id' => 'fc8b4059-30bb-43a8-a042-46f5b431ad82' | ||
120 | ))); | ||
121 | $inventory_root = new LLBlock( | ||
122 | Array( | ||
123 | 'folder_id' => "f798e114-c10f-409b-a90d-a11577ff1de8" | ||
124 | )); | ||
125 | $initial_outfit = new LLBlock( | ||
126 | Array( | ||
127 | 'folder_name' => "Nightclub Female", | ||
128 | 'gender' => "female" | ||
129 | )); | ||
130 | return Array ( | ||
131 | 'message' => "Welcome to OGS!", | ||
132 | 'session_id' => format_lluuid($session_id), | ||
133 | 'sim_port' => intval($siminfo['port']), | ||
134 | 'agent_access' => "M", | ||
135 | 'start_location' => "last", | ||
136 | 'global-textures' => $globaltextures, | ||
137 | 'seconds_since_epoch' => time(), | ||
138 | 'first_name' => $profiledata['profile_firstname'], | ||
139 | 'circuit_code' => 50633318, | ||
140 | 'login_flags' => $login_flags, | ||
141 | 'seed_capability' => '', | ||
142 | 'home' => $home, | ||
143 | 'secure_session_id' => format_lluuid($secure_session_id), | ||
144 | 'last_name' => $profiledata['profile_lastname'], | ||
145 | 'ui-config' => $ui_config, | ||
146 | 'region_x' => $LocX, | ||
147 | 'inventory_skeleton' => $inventory_skeleton, | ||
148 | 'sim_ip' => $siminfo['ip_addr'], | ||
149 | 'region_y' => $LocY, | ||
150 | 'inventory-root' => $inventory_root, | ||
151 | 'login' => "true", | ||
152 | 'look_at' => $look_at, | ||
153 | 'agent_id' => format_lluuid($profiledata['userprofile_LLUUID']), | ||
154 | 'initial-outfit' => $initial_outfit | ||
155 | ); | ||
156 | |||
157 | |||
158 | } else { | ||
159 | // this is the default invalid username/password error | ||
160 | return Array ( | ||
161 | 'reason' => 'key', | ||
162 | 'message' => "You have entered an invalid name/password combination or are using an incompatible client. Please check with the grid owner " .$grid_owner . " if you are sure your login details are accurate.", | ||
163 | 'login' => "false", | ||
164 | ); | ||
165 | } | ||
166 | |||
167 | } | ||
168 | |||
169 | $server=new IXR_Server(array('login_to_simulator' => 'login')); | ||
170 | ?> | ||
diff --git a/ogs/login/login_config.inc.php b/ogs/login/login_config.inc.php deleted file mode 100644 index 4cce696..0000000 --- a/ogs/login/login_config.inc.php +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | <? | ||
2 | // All the user/login server specific stuff lives here | ||
3 | |||
4 | // What we send to authenticate to the grid server | ||
5 | $gridserver_sendkey="1234"; | ||
6 | |||
7 | // What we expect to get back from the grid server | ||
8 | $gridserver_recvkey="1234"; | ||
9 | |||
10 | $gridserver_url="http://www.osgrid.org/ogs/gridserver/index.php"; | ||
11 | ?> | ||
diff --git a/opensim.build b/opensim.build deleted file mode 100644 index 2fdf1cb..0000000 --- a/opensim.build +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <project name="OpenSim" default="build" basedir="."> | ||
3 | <description>First nant buildfile for OpenSim</description> | ||
4 | <property name="debug" value="true" overwrite="false" /> | ||
5 | <target name="clean" description="remove all generated files"> | ||
6 | <delete file="bin/OpenSim.exe" failonerror="false" /> | ||
7 | <delete file="bin/OpenSim.pdb" failonerror="false" /> | ||
8 | </target> | ||
9 | |||
10 | <target name="svnupdate" description="updates to latest SVN"> | ||
11 | <exec program="svn"> | ||
12 | <arg value="update" /> | ||
13 | </exec> | ||
14 | </target> | ||
15 | |||
16 | <target name="upgrade" description="updates from SVN and then builds" depends="clean,svnupdate,build"> | ||
17 | |||
18 | </target> | ||
19 | |||
20 | <target name="build" description="compiles the source code"> | ||
21 | |||
22 | <exec program="genvers.sh" /> | ||
23 | <loadfile file="VERSION" property="svnver"/> | ||
24 | |||
25 | <asminfo output="src/AssemblyInfo.cs" language="CSharp"> | ||
26 | <imports> | ||
27 | <import namespace="System" /> | ||
28 | <import namespace="System.Reflection" /> | ||
29 | <import namespace="System.Runtime.InteropServices" /> | ||
30 | </imports> | ||
31 | <attributes> | ||
32 | <attribute type="ComVisibleAttribute" value="false" /> | ||
33 | <attribute type="CLSCompliantAttribute" value="false" /> | ||
34 | <attribute type="AssemblyVersionAttribute" value="${svnver}" /> | ||
35 | <attribute type="AssemblyTitleAttribute" value="opensim" /> | ||
36 | <attribute type="AssemblyDescriptionAttribute" value="The C# implementation of the simulator portion of OGS" /> | ||
37 | <attribute type="AssemblyCopyrightAttribute" value="Copyright © OGS development team 2007"/> | ||
38 | </attributes> | ||
39 | </asminfo> | ||
40 | <csc target="exe" output="bin/OpenSim.exe" debug="${debug}" verbose="true" warninglevel="4"> | ||
41 | <references basedir="bin/" failonempty="true"> | ||
42 | <include name="System" /> | ||
43 | <include name="System.Data" /> | ||
44 | <include name="System.Xml" /> | ||
45 | <include name="Axiom.MathLib.dll" /> | ||
46 | <include name="libsecondlife.dll" /> | ||
47 | <include name="log4net.dll" /> | ||
48 | <include name="Db4objects.Db4o.dll" /> | ||
49 | </references> | ||
50 | <sources basedir="src/"> | ||
51 | <include name="AssemblyInfo.cs" /> | ||
52 | <include name="ServerConsole.cs" /> | ||
53 | <include name="Config.cs" /> | ||
54 | <include name="VersionInfo.cs" /> | ||
55 | <include name="Util.cs" /> | ||
56 | <include name="types/*.cs" /> | ||
57 | <include name="world/*.cs" /> | ||
58 | <include name="OpenSimClient.cs" /> | ||
59 | <include name="Main.cs" /> | ||
60 | </sources> | ||
61 | </csc> | ||
62 | </target> | ||
63 | </project> | ||
diff --git a/opensim.mdp b/opensim.mdp deleted file mode 100644 index f41280f..0000000 --- a/opensim.mdp +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | <Project name="opensim" fileversion="2.0" language="C#" clr-version="Net_2_0" ctype="DotNetProject"> | ||
2 | <Configurations active="Debug"> | ||
3 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> | ||
4 | <Output directory="./bin/Debug" assembly="opensim" /> | ||
5 | <Build debugmode="True" target="Exe" /> | ||
6 | <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> | ||
7 | <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> | ||
8 | </Configuration> | ||
9 | <Configuration name="Release" ctype="DotNetProjectConfiguration"> | ||
10 | <Output directory="./bin/Release" assembly="opensim" /> | ||
11 | <Build debugmode="False" target="Exe" /> | ||
12 | <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> | ||
13 | <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> | ||
14 | </Configuration> | ||
15 | </Configurations> | ||
16 | <Contents> | ||
17 | <File name="./src/Config.cs" subtype="Code" buildaction="Compile" /> | ||
18 | <File name="./src/Main.cs" subtype="Code" buildaction="Compile" /> | ||
19 | <File name="./src/OpenSimClient.cs" subtype="Code" buildaction="Compile" /> | ||
20 | <File name="./src/Util.cs" subtype="Code" buildaction="Compile" /> | ||
21 | <File name="./src/VersionInfo.cs" subtype="Code" buildaction="Compile" /> | ||
22 | <File name="./src/types/BitPack.cs" subtype="Code" buildaction="Compile" /> | ||
23 | <File name="./src/types/Mesh.cs" subtype="Code" buildaction="Compile" /> | ||
24 | <File name="./src/types/Triangle.cs" subtype="Code" buildaction="Compile" /> | ||
25 | <File name="./src/world/Avatar.cs" subtype="Code" buildaction="Compile" /> | ||
26 | <File name="./src/world/Entity.cs" subtype="Code" buildaction="Compile" /> | ||
27 | <File name="./src/world/Primitive.cs" subtype="Code" buildaction="Compile" /> | ||
28 | <File name="./src/world/ScriptEngine.cs" subtype="Code" buildaction="Compile" /> | ||
29 | <File name="./src/world/SurfacePatch.cs" subtype="Code" buildaction="Compile" /> | ||
30 | <File name="./src/world/TerrainDecoder.cs" subtype="Code" buildaction="Compile" /> | ||
31 | <File name="./src/world/World.cs" subtype="Code" buildaction="Compile" /> | ||
32 | <File name="./src/world/scripting/IScript.cs" subtype="Code" buildaction="Compile" /> | ||
33 | <File name="./src/AssemblyInfo.cs" subtype="Code" buildaction="Compile" /> | ||
34 | </Contents> | ||
35 | <References> | ||
36 | <ProjectReference type="Gac" localcopy="True" refto="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
37 | <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
38 | <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
39 | <ProjectReference type="Assembly" localcopy="True" refto="./bin/Axiom.MathLib.dll" /> | ||
40 | <ProjectReference type="Assembly" localcopy="True" refto="./bin/Db4objects.Db4o.dll" /> | ||
41 | <ProjectReference type="Assembly" localcopy="True" refto="./bin/libsecondlife.dll" /> | ||
42 | <ProjectReference type="Assembly" localcopy="True" refto="./bin/log4net.dll" /> | ||
43 | </References> | ||
44 | </Project> \ No newline at end of file | ||
diff --git a/opensim.mds b/opensim.mds deleted file mode 100644 index 7587db3..0000000 --- a/opensim.mds +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | <Combine name="opensim" fileversion="2.0"> | ||
2 | <Configurations active="Debug"> | ||
3 | <Configuration name="Debug" ctype="CombineConfiguration"> | ||
4 | <Entry build="True" name="opensim" configuration="Debug" /> | ||
5 | </Configuration> | ||
6 | <Configuration name="Release" ctype="CombineConfiguration"> | ||
7 | <Entry build="True" name="opensim" configuration="Release" /> | ||
8 | </Configuration> | ||
9 | </Configurations> | ||
10 | <StartMode startupentry="opensim" single="True"> | ||
11 | <Execute type="None" entry="opensim" /> | ||
12 | </StartMode> | ||
13 | <Entries> | ||
14 | <Entry filename="./opensim.mdp" /> | ||
15 | </Entries> | ||
16 | </Combine> \ No newline at end of file | ||
diff --git a/src/Config.cs b/src/Config.cs deleted file mode 100644 index 9bb9296..0000000 --- a/src/Config.cs +++ /dev/null | |||
@@ -1,174 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | |||
4 | * Copyright (c) <year>, <copyright holder> | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions are met: | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * * Neither the name of the <organization> nor the | ||
15 | * names of its contributors may be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
21 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.IO; | ||
33 | using Db4objects.Db4o; | ||
34 | using libsecondlife; | ||
35 | using OpenSim.world; | ||
36 | |||
37 | namespace OpenSim | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// This class handles connection to the underlying database used for configuration of the region. | ||
41 | /// Region content is also stored by this class. The main entry point is InitConfig() which attempts to locate | ||
42 | /// opensim.yap in the current working directory. If opensim.yap can not be found, default settings are loaded from | ||
43 | /// what is hardcoded here and then saved into opensim.yap for future startups. | ||
44 | /// </summary> | ||
45 | public class SimConfig | ||
46 | { | ||
47 | public string RegionName; | ||
48 | |||
49 | public uint RegionLocX; | ||
50 | public uint RegionLocY; | ||
51 | public ulong RegionHandle; | ||
52 | |||
53 | public int IPListenPort; | ||
54 | public string IPListenAddr; | ||
55 | |||
56 | public bool sandbox = true; | ||
57 | public string AssetURL = String.Empty; | ||
58 | public string AssetSendKey = String.Empty; | ||
59 | |||
60 | public string GridURL = String.Empty; | ||
61 | public string GridSendKey = String.Empty; | ||
62 | |||
63 | private IObjectContainer db; | ||
64 | |||
65 | public void LoadDefaults() | ||
66 | { | ||
67 | string tempstring; | ||
68 | OpenSim_Main.localcons.WriteLine("Config.cs:LoadDefaults() - Please press enter to retain default or enter new settings"); | ||
69 | |||
70 | this.RegionName = OpenSim_Main.localcons.CmdPrompt("Name [OpenSim test]: ", "OpenSim test"); | ||
71 | this.RegionLocX = (uint)Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("Grid Location X [997]: ", "997")); | ||
72 | this.RegionLocY = (uint)Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("Grid Location Y [996]: ", "996")); | ||
73 | this.IPListenPort = Convert.ToInt32(OpenSim_Main.localcons.CmdPrompt("UDP port for client connections [9000]: ", "9000")); | ||
74 | this.IPListenAddr = OpenSim_Main.localcons.CmdPrompt("IP Address to listen on for client connections [127.0.0.1]: ", "127.0.0.1"); | ||
75 | |||
76 | tempstring = OpenSim_Main.localcons.CmdPrompt("Run in sandbox or grid mode? [sandbox]: ", "sandbox", "sandbox", "grid"); | ||
77 | this.sandbox = tempstring.Equals("sandbox"); | ||
78 | |||
79 | if (!this.sandbox) | ||
80 | { | ||
81 | this.AssetURL = OpenSim_Main.localcons.CmdPrompt("Asset server URL: "); | ||
82 | this.AssetSendKey = OpenSim_Main.localcons.CmdPrompt("Asset server key: "); | ||
83 | this.GridURL = OpenSim_Main.localcons.CmdPrompt("Grid server URL: "); | ||
84 | this.GridSendKey = OpenSim_Main.localcons.CmdPrompt("Grid server key: "); | ||
85 | } | ||
86 | this.RegionHandle = Helpers.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
87 | } | ||
88 | |||
89 | public void InitConfig() | ||
90 | { | ||
91 | try | ||
92 | { | ||
93 | db = Db4oFactory.OpenFile("opensim.yap"); | ||
94 | IObjectSet result = db.Get(typeof(SimConfig)); | ||
95 | if (result.Count == 1) | ||
96 | { | ||
97 | OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Found a SimConfig object in the local database, loading"); | ||
98 | foreach (SimConfig cfg in result) | ||
99 | { | ||
100 | this.sandbox = cfg.sandbox; | ||
101 | this.RegionName = cfg.RegionName; | ||
102 | this.RegionLocX = cfg.RegionLocX; | ||
103 | this.RegionLocY = cfg.RegionLocY; | ||
104 | this.RegionHandle = Helpers.UIntsToLong((RegionLocX * 256), (RegionLocY * 256)); | ||
105 | this.IPListenPort = cfg.IPListenPort; | ||
106 | this.IPListenAddr = cfg.IPListenAddr; | ||
107 | this.AssetURL = cfg.AssetURL; | ||
108 | this.AssetSendKey = cfg.AssetSendKey; | ||
109 | this.GridURL = cfg.GridURL; | ||
110 | this.GridSendKey = cfg.GridSendKey; | ||
111 | } | ||
112 | } | ||
113 | else | ||
114 | { | ||
115 | OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Could not find object in database, loading precompiled defaults"); | ||
116 | LoadDefaults(); | ||
117 | OpenSim_Main.localcons.WriteLine("Writing out default settings to local database"); | ||
118 | db.Set(this); | ||
119 | } | ||
120 | } | ||
121 | catch (Exception e) | ||
122 | { | ||
123 | db.Close(); | ||
124 | OpenSim_Main.localcons.WriteLine("Config.cs:InitConfig() - Exception occured"); | ||
125 | OpenSim_Main.localcons.WriteLine(e.ToString()); | ||
126 | } | ||
127 | OpenSim_Main.localcons.WriteLine("Sim settings loaded:"); | ||
128 | OpenSim_Main.localcons.WriteLine("Name: " + this.RegionName); | ||
129 | OpenSim_Main.localcons.WriteLine("Region Location: [" + this.RegionLocX.ToString() + "," + this.RegionLocY + "]"); | ||
130 | OpenSim_Main.localcons.WriteLine("Region Handle: " + this.RegionHandle.ToString()); | ||
131 | OpenSim_Main.localcons.WriteLine("Listening on IP: " + this.IPListenAddr + ":" + this.IPListenPort); | ||
132 | OpenSim_Main.localcons.WriteLine("Sandbox Mode? " + this.sandbox.ToString()); | ||
133 | OpenSim_Main.localcons.WriteLine("Asset URL: " + this.AssetURL); | ||
134 | OpenSim_Main.localcons.WriteLine("Asset key: " + this.AssetSendKey); | ||
135 | OpenSim_Main.localcons.WriteLine("Grid URL: " + this.GridURL); | ||
136 | OpenSim_Main.localcons.WriteLine("Grid key: " + this.GridSendKey); | ||
137 | } | ||
138 | |||
139 | public World LoadWorld() | ||
140 | { | ||
141 | OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Loading world...."); | ||
142 | World blank = new World(); | ||
143 | OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB"); | ||
144 | IObjectSet world_result = db.Get(new float[65536]); | ||
145 | if (world_result.Count > 0) | ||
146 | { | ||
147 | OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading"); | ||
148 | blank.LandMap = (float[])world_result.Next(); | ||
149 | } | ||
150 | else | ||
151 | { | ||
152 | OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one"); | ||
153 | HeightmapGenHills hills = new HeightmapGenHills(); | ||
154 | blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false); | ||
155 | |||
156 | OpenSim_Main.localcons.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database"); | ||
157 | db.Set(blank.LandMap); | ||
158 | db.Commit(); | ||
159 | } | ||
160 | return blank; | ||
161 | } | ||
162 | |||
163 | public void LoadFromGrid() | ||
164 | { | ||
165 | OpenSim_Main.localcons.WriteLine("Config.cs:LoadFromGrid() - dummy function, DOING ABSOLUTELY NOTHING AT ALL!!!"); | ||
166 | // TODO: Make this crap work | ||
167 | } | ||
168 | |||
169 | public void Shutdown() | ||
170 | { | ||
171 | db.Close(); | ||
172 | } | ||
173 | } | ||
174 | } | ||
diff --git a/src/Main.cs b/src/Main.cs deleted file mode 100644 index f3fa609..0000000 --- a/src/Main.cs +++ /dev/null | |||
@@ -1,159 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | |||
4 | |||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions are met: | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * * Neither the name of the <organization> nor the | ||
15 | * names of its contributors may be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
21 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | using System; | ||
31 | using System.Text; | ||
32 | using System.IO; | ||
33 | using System.Threading; | ||
34 | using System.Net; | ||
35 | using System.Net.Sockets; | ||
36 | using System.Collections; | ||
37 | using System.Collections.Generic; | ||
38 | using libsecondlife; | ||
39 | using libsecondlife.Packets; | ||
40 | using OpenSim.world; | ||
41 | |||
42 | namespace OpenSim | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// Description of MainForm. | ||
46 | /// </summary> | ||
47 | public class OpenSim_Main | ||
48 | { | ||
49 | public static DateTime startuptime; | ||
50 | public static OpenSim_Main sim; | ||
51 | public static SimConfig cfg; | ||
52 | public static World local_world; | ||
53 | public static ServerConsole localcons; | ||
54 | private static Thread MainListener; | ||
55 | public static Socket Server; | ||
56 | private static IPEndPoint ServerIncoming; | ||
57 | private static byte[] RecvBuffer = new byte[4096]; | ||
58 | private byte[] ZeroBuffer = new byte[8192]; | ||
59 | private static IPEndPoint ipeSender; | ||
60 | private static EndPoint epSender; | ||
61 | private static AsyncCallback ReceivedData; | ||
62 | public Dictionary<EndPoint, OpenSimClient> ClientThreads = new Dictionary<EndPoint, OpenSimClient>(); | ||
63 | |||
64 | [STAThread] | ||
65 | public static void Main( string[] args ) | ||
66 | { | ||
67 | Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); | ||
68 | Console.WriteLine("Starting...\n"); | ||
69 | sim = new OpenSim_Main(); | ||
70 | sim.Startup(); | ||
71 | while(true) { | ||
72 | localcons.MainConsolePrompt(); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | private OpenSim_Main() { | ||
77 | } | ||
78 | |||
79 | public static void Shutdown() { | ||
80 | localcons.WriteLine("Main.cs:Shutdown() - Closing all threads"); | ||
81 | localcons.WriteLine("Main.cs:Shutdown() - Killing listener thread"); | ||
82 | MainListener.Abort(); | ||
83 | localcons.WriteLine("Main.cs:Shutdown() - Killing clients"); | ||
84 | // IMPLEMENT THIS | ||
85 | localcons.WriteLine("Main.cs:Shutdown() - Closing console and terminating"); | ||
86 | localcons.Close(); | ||
87 | Environment.Exit(0); | ||
88 | } | ||
89 | |||
90 | private void Startup() { | ||
91 | startuptime=DateTime.Now; | ||
92 | localcons=new ServerConsole(ServerConsole.ConsoleType.Local,"",0); | ||
93 | // We check our local database first, then the grid for config options | ||
94 | localcons.WriteLine("Main.cs:Startup() - Loading configuration"); | ||
95 | cfg = new SimConfig(); | ||
96 | cfg.InitConfig(); | ||
97 | localcons.WriteLine("Main.cs:Startup() - Contacting gridserver"); | ||
98 | cfg.LoadFromGrid(); | ||
99 | |||
100 | localcons.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString()); | ||
101 | localcons.WriteLine("Initialising world"); | ||
102 | local_world = cfg.LoadWorld(); | ||
103 | |||
104 | localcons.WriteLine("Main.cs:Startup() - Starting up main world loop"); | ||
105 | local_world.InitLoop(); | ||
106 | |||
107 | localcons.WriteLine("Main.cs:Startup() - Starting up messaging system"); | ||
108 | MainListener = new Thread(new ThreadStart(MainServerListener)); | ||
109 | MainListener.Start(); | ||
110 | |||
111 | Thread.Sleep(500); // give other threads a chance to catch up | ||
112 | string[] noparams = new string[1]; | ||
113 | noparams[0]=""; | ||
114 | localcons.WriteLine("\nOpenSim ready\nType help for list of commands"); | ||
115 | } | ||
116 | |||
117 | private void OnReceivedData(IAsyncResult result) { | ||
118 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | ||
119 | epSender = (EndPoint)ipeSender; | ||
120 | Packet packet = null; | ||
121 | int numBytes = Server.EndReceiveFrom(result, ref epSender); | ||
122 | int packetEnd = numBytes - 1; | ||
123 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); | ||
124 | |||
125 | // This is either a new client or a packet to send to an old one | ||
126 | if(ClientThreads.ContainsKey(epSender)) { | ||
127 | ClientThreads[epSender].InPacket(packet); | ||
128 | } else if( packet.Type == PacketType.UseCircuitCode ) { // new client | ||
129 | OpenSimClient newuser = new OpenSimClient(epSender,(UseCircuitCodePacket)packet); | ||
130 | ClientThreads.Add(epSender, newuser); | ||
131 | } else { // invalid client | ||
132 | Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString()); | ||
133 | } | ||
134 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
135 | } | ||
136 | |||
137 | private void MainServerListener() { | ||
138 | localcons.WriteLine("Main.cs:MainServerListener() - New thread started"); | ||
139 | localcons.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + cfg.IPListenAddr + ":" + cfg.IPListenPort); | ||
140 | |||
141 | ServerIncoming = new IPEndPoint(IPAddress.Any, cfg.IPListenPort); | ||
142 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | ||
143 | Server.Bind(ServerIncoming); | ||
144 | |||
145 | localcons.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); | ||
146 | |||
147 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | ||
148 | epSender = (EndPoint) ipeSender; | ||
149 | ReceivedData = new AsyncCallback(this.OnReceivedData); | ||
150 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
151 | |||
152 | localcons.WriteLine("Main.cs:MainServerListener() - Listening..."); | ||
153 | while(true) { | ||
154 | Thread.Sleep(100); | ||
155 | local_world.DoStuff(); | ||
156 | } | ||
157 | } | ||
158 | } | ||
159 | } | ||
diff --git a/src/OpenSimClient.cs b/src/OpenSimClient.cs deleted file mode 100644 index 497df00..0000000 --- a/src/OpenSimClient.cs +++ /dev/null | |||
@@ -1,510 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | */ | ||
26 | |||
27 | using System; | ||
28 | using System.Collections; | ||
29 | using System.Collections.Generic; | ||
30 | using libsecondlife; | ||
31 | using libsecondlife.Packets; | ||
32 | using System.Net; | ||
33 | using System.Net.Sockets; | ||
34 | using System.IO; | ||
35 | using System.Threading; | ||
36 | using System.Timers; | ||
37 | |||
38 | namespace OpenSim | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Handles new client connections | ||
42 | /// Constructor takes a single Packet and authenticates everything | ||
43 | /// </summary> | ||
44 | public class OpenSimClient | ||
45 | { | ||
46 | |||
47 | public LLUUID AgentID; | ||
48 | public LLUUID SessionID; | ||
49 | public uint CircuitCode; | ||
50 | public world.Avatar ClientAvatar; | ||
51 | private UseCircuitCodePacket cirpack; | ||
52 | private Thread ClientThread; | ||
53 | public EndPoint userEP; | ||
54 | private BlockingQueue<QueItem> PacketQueue; | ||
55 | private BlockingQueue<TransferRequestPacket> AssetRequests; | ||
56 | private Dictionary<uint, uint> PendingAcks = new Dictionary<uint, uint>(); | ||
57 | private Dictionary<uint, Packet> NeedAck = new Dictionary<uint, Packet>(); | ||
58 | private System.Timers.Timer AckTimer; | ||
59 | private uint Sequence = 0; | ||
60 | private object SequenceLock = new object(); | ||
61 | private const int MAX_APPENDED_ACKS = 10; | ||
62 | private const int RESEND_TIMEOUT = 4000; | ||
63 | private const int MAX_SEQUENCE = 0xFFFFFF; | ||
64 | //private Queue<uint> Inbox; | ||
65 | |||
66 | public void ack_pack(Packet Pack) | ||
67 | { | ||
68 | //libsecondlife.Packets.PacketAckPacket ack_it = new PacketAckPacket(); | ||
69 | //ack_it.Packets = new PacketAckPacket.PacketsBlock[1]; | ||
70 | //ack_it.Packets[0] = new PacketAckPacket.PacketsBlock(); | ||
71 | //ack_it.Packets[0].ID = Pack.Header.ID; | ||
72 | //ack_it.Header.Reliable = false; | ||
73 | |||
74 | //OutPacket(ack_it); | ||
75 | |||
76 | if (Pack.Header.Reliable) | ||
77 | { | ||
78 | lock (PendingAcks) | ||
79 | { | ||
80 | uint sequence = (uint)Pack.Header.Sequence; | ||
81 | if (!PendingAcks.ContainsKey(sequence)) { PendingAcks[sequence] = sequence; } | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | |||
86 | public void AssetLoader() | ||
87 | { | ||
88 | if (OpenSim_Main.cfg.sandbox == false) | ||
89 | { | ||
90 | WebResponse AssetResponse; | ||
91 | byte[] idata; | ||
92 | |||
93 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AssetLoader() - Starting new thread"); | ||
94 | TransferRequestPacket reqPacket = AssetRequests.Dequeue(); | ||
95 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AssetLoader() - Got a request, processing it"); | ||
96 | LLUUID AssetID = new LLUUID(reqPacket.TransferInfo.Params, 0); | ||
97 | |||
98 | try | ||
99 | { | ||
100 | WebRequest AssetLoad = WebRequest.Create(OpenSim_Main.cfg.AssetURL + "getasset/" + OpenSim_Main.cfg.AssetSendKey + "/" + AssetID + "/data"); | ||
101 | AssetResponse = AssetLoad.GetResponse(); | ||
102 | idata = new byte[(int)AssetResponse.ContentLength]; | ||
103 | BinaryReader br = new BinaryReader(AssetResponse.GetResponseStream()); | ||
104 | idata = br.ReadBytes((int)AssetResponse.ContentLength); | ||
105 | br.Close(); | ||
106 | } | ||
107 | catch (Exception e) | ||
108 | { | ||
109 | Console.WriteLine(e.ToString()); | ||
110 | return; | ||
111 | } | ||
112 | |||
113 | TransferInfoPacket Transfer = new TransferInfoPacket(); | ||
114 | Transfer.TransferInfo.ChannelType = 2; | ||
115 | Transfer.TransferInfo.Status = 0; | ||
116 | Transfer.TransferInfo.TargetType = 0; | ||
117 | Transfer.TransferInfo.Params = reqPacket.TransferInfo.Params; | ||
118 | Transfer.TransferInfo.Size = (int)AssetResponse.ContentLength; | ||
119 | Transfer.TransferInfo.TransferID = reqPacket.TransferInfo.TransferID; | ||
120 | |||
121 | OutPacket(Transfer); | ||
122 | |||
123 | TransferPacketPacket TransferPacket = new TransferPacketPacket(); | ||
124 | TransferPacket.TransferData.Packet = 0; | ||
125 | TransferPacket.TransferData.ChannelType = 2; | ||
126 | TransferPacket.TransferData.TransferID = reqPacket.TransferInfo.TransferID; | ||
127 | |||
128 | if (AssetResponse.ContentLength > 1000) | ||
129 | { | ||
130 | byte[] chunk = new byte[1000]; | ||
131 | Array.Copy(idata, chunk, 1000); | ||
132 | TransferPacket.TransferData.Data = chunk; | ||
133 | TransferPacket.TransferData.Status = 0; | ||
134 | OutPacket(TransferPacket); | ||
135 | |||
136 | TransferPacket = new TransferPacketPacket(); | ||
137 | TransferPacket.TransferData.Packet = 1; | ||
138 | TransferPacket.TransferData.ChannelType = 2; | ||
139 | TransferPacket.TransferData.TransferID = reqPacket.TransferInfo.TransferID; | ||
140 | byte[] chunk1 = new byte[(idata.Length - 1000)]; | ||
141 | Array.Copy(idata, 1000, chunk1, 0, chunk1.Length); | ||
142 | TransferPacket.TransferData.Data = chunk1; | ||
143 | TransferPacket.TransferData.Status = 1; | ||
144 | OutPacket(TransferPacket); | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | TransferPacket.TransferData.Status = 1; | ||
149 | TransferPacket.TransferData.Data = idata; | ||
150 | OutPacket(TransferPacket); | ||
151 | } | ||
152 | AssetResponse.Close(); | ||
153 | } | ||
154 | } | ||
155 | |||
156 | public void Logout() | ||
157 | { | ||
158 | // TODO - kill any AssetLoaders | ||
159 | ClientThread.Abort(); | ||
160 | } | ||
161 | |||
162 | public void ProcessInPacket(Packet Pack) | ||
163 | { | ||
164 | ack_pack(Pack); | ||
165 | switch (Pack.Type) | ||
166 | { | ||
167 | case PacketType.CompleteAgentMovement: | ||
168 | ClientAvatar.CompleteMovement(OpenSim_Main.local_world); | ||
169 | ClientAvatar.SendInitialPosition(); | ||
170 | break; | ||
171 | case PacketType.RegionHandshakeReply: | ||
172 | OpenSim_Main.local_world.SendLayerData(this); | ||
173 | break; | ||
174 | case PacketType.AgentWearablesRequest: | ||
175 | ClientAvatar.SendInitialAppearance(); | ||
176 | break; | ||
177 | case PacketType.TransferRequest: | ||
178 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got transfer request"); | ||
179 | // We put transfer requests into a big queue and then spawn a thread for each new one | ||
180 | TransferRequestPacket transfer = (TransferRequestPacket)Pack; | ||
181 | AssetRequests.Enqueue(transfer); | ||
182 | Thread AssetLoaderThread = new Thread(new ThreadStart(AssetLoader)); | ||
183 | AssetLoaderThread.Start(); | ||
184 | break; | ||
185 | case PacketType.LogoutRequest: | ||
186 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ProcessInPacket() - Got a logout request"); | ||
187 | lock (OpenSim_Main.local_world.Entities) | ||
188 | { | ||
189 | OpenSim_Main.local_world.Entities.Remove(this.AgentID); | ||
190 | } | ||
191 | |||
192 | if (OpenSim_Main.cfg.sandbox == false) | ||
193 | { | ||
194 | WebRequest DeleteSession = WebRequest.Create(OpenSim_Main.cfg.GridURL + "/usersessions/" + OpenSim_Main.cfg.GridSendKey + "/" + this.AgentID.ToString() + this.CircuitCode.ToString() + "/delete"); | ||
195 | WebResponse GridResponse = DeleteSession.GetResponse(); | ||
196 | StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); | ||
197 | String grTest = sr.ReadLine(); | ||
198 | sr.Close(); | ||
199 | GridResponse.Close(); | ||
200 | OpenSim_Main.localcons.WriteLine("DEBUG: " + grTest); | ||
201 | } | ||
202 | this.ClientThread.Abort(); | ||
203 | break; | ||
204 | case PacketType.AgentUpdate: | ||
205 | ClientAvatar.HandleAgentUpdate((AgentUpdatePacket)Pack); | ||
206 | break; | ||
207 | case PacketType.ChatFromViewer: | ||
208 | ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; | ||
209 | if (Helpers.FieldToString(inchatpack.ChatData.Message) == "") break; | ||
210 | |||
211 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
212 | libsecondlife.Packets.ChatFromSimulatorPacket reply = new ChatFromSimulatorPacket(); | ||
213 | reply.ChatData.Audible = 1; | ||
214 | reply.ChatData.Message = inchatpack.ChatData.Message; | ||
215 | reply.ChatData.ChatType = 1; | ||
216 | reply.ChatData.SourceType = 1; | ||
217 | reply.ChatData.Position = this.ClientAvatar.position; | ||
218 | reply.ChatData.FromName = _enc.GetBytes(this.ClientAvatar.firstname + " " + this.ClientAvatar.lastname + "\0"); | ||
219 | reply.ChatData.OwnerID = this.AgentID; | ||
220 | reply.ChatData.SourceID = this.AgentID; | ||
221 | |||
222 | |||
223 | |||
224 | foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) | ||
225 | { | ||
226 | client.OutPacket(reply); | ||
227 | } | ||
228 | break; | ||
229 | } | ||
230 | } | ||
231 | |||
232 | private void ResendUnacked() | ||
233 | { | ||
234 | int now = Environment.TickCount; | ||
235 | |||
236 | lock (NeedAck) | ||
237 | { | ||
238 | foreach (Packet packet in NeedAck.Values) | ||
239 | { | ||
240 | if (now - packet.TickCount > RESEND_TIMEOUT) | ||
241 | { | ||
242 | |||
243 | packet.Header.Resent = true; | ||
244 | OutPacket(packet); | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | } | ||
249 | |||
250 | private void SendAcks() | ||
251 | { | ||
252 | lock (PendingAcks) | ||
253 | { | ||
254 | if (PendingAcks.Count > 0) | ||
255 | { | ||
256 | if (PendingAcks.Count > 250) | ||
257 | { | ||
258 | return; | ||
259 | } | ||
260 | |||
261 | |||
262 | |||
263 | int i = 0; | ||
264 | PacketAckPacket acks = new PacketAckPacket(); | ||
265 | acks.Packets = new PacketAckPacket.PacketsBlock[PendingAcks.Count]; | ||
266 | |||
267 | foreach (uint ack in PendingAcks.Values) | ||
268 | { | ||
269 | acks.Packets[i] = new PacketAckPacket.PacketsBlock(); | ||
270 | acks.Packets[i].ID = ack; | ||
271 | i++; | ||
272 | } | ||
273 | |||
274 | acks.Header.Reliable = false; | ||
275 | OutPacket(acks); | ||
276 | |||
277 | PendingAcks.Clear(); | ||
278 | } | ||
279 | } | ||
280 | } | ||
281 | |||
282 | private void AckTimer_Elapsed(object sender, ElapsedEventArgs ea) | ||
283 | { | ||
284 | SendAcks(); | ||
285 | ResendUnacked(); | ||
286 | } | ||
287 | |||
288 | public void ProcessOutPacket(Packet Pack) | ||
289 | { | ||
290 | |||
291 | // Keep track of when this packet was sent out | ||
292 | Pack.TickCount = Environment.TickCount; | ||
293 | |||
294 | if (!Pack.Header.Resent) | ||
295 | { | ||
296 | // Set the sequence number | ||
297 | lock (SequenceLock) | ||
298 | { | ||
299 | if (Sequence >= MAX_SEQUENCE) | ||
300 | Sequence = 1; | ||
301 | else | ||
302 | Sequence++; | ||
303 | Pack.Header.Sequence = Sequence; | ||
304 | } | ||
305 | |||
306 | if (Pack.Header.Reliable) //DIRTY HACK | ||
307 | { | ||
308 | lock (NeedAck) | ||
309 | { | ||
310 | if (!NeedAck.ContainsKey(Pack.Header.Sequence)) | ||
311 | { | ||
312 | NeedAck.Add(Pack.Header.Sequence, Pack); | ||
313 | } | ||
314 | else | ||
315 | { | ||
316 | // Client.Log("Attempted to add a duplicate sequence number (" + | ||
317 | // packet.Header.Sequence + ") to the NeedAck dictionary for packet type " + | ||
318 | // packet.Type.ToString(), Helpers.LogLevel.Warning); | ||
319 | } | ||
320 | } | ||
321 | |||
322 | // Don't append ACKs to resent packets, in case that's what was causing the | ||
323 | // delivery to fail | ||
324 | if (!Pack.Header.Resent) | ||
325 | { | ||
326 | // Append any ACKs that need to be sent out to this packet | ||
327 | lock (PendingAcks) | ||
328 | { | ||
329 | if (PendingAcks.Count > 0 && PendingAcks.Count < MAX_APPENDED_ACKS && | ||
330 | Pack.Type != PacketType.PacketAck && | ||
331 | Pack.Type != PacketType.LogoutRequest) | ||
332 | { | ||
333 | Pack.Header.AckList = new uint[PendingAcks.Count]; | ||
334 | int i = 0; | ||
335 | |||
336 | foreach (uint ack in PendingAcks.Values) | ||
337 | { | ||
338 | Pack.Header.AckList[i] = ack; | ||
339 | i++; | ||
340 | } | ||
341 | |||
342 | PendingAcks.Clear(); | ||
343 | Pack.Header.AppendedAcks = true; | ||
344 | } | ||
345 | } | ||
346 | } | ||
347 | } | ||
348 | } | ||
349 | |||
350 | |||
351 | byte[] ZeroOutBuffer = new byte[4096]; | ||
352 | byte[] sendbuffer; | ||
353 | sendbuffer = Pack.ToBytes(); | ||
354 | |||
355 | try | ||
356 | { | ||
357 | if (Pack.Header.Zerocoded) | ||
358 | { | ||
359 | int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); | ||
360 | OpenSim_Main.Server.SendTo(ZeroOutBuffer, packetsize, SocketFlags.None, userEP); | ||
361 | } | ||
362 | else | ||
363 | { | ||
364 | OpenSim_Main.Server.SendTo(sendbuffer, sendbuffer.Length, SocketFlags.None, userEP); | ||
365 | } | ||
366 | } | ||
367 | catch (Exception) | ||
368 | { | ||
369 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); | ||
370 | ClientThread.Abort(); | ||
371 | } | ||
372 | |||
373 | } | ||
374 | |||
375 | public void InPacket(Packet NewPack) | ||
376 | { | ||
377 | // Handle appended ACKs | ||
378 | if (NewPack.Header.AppendedAcks) | ||
379 | { | ||
380 | lock (NeedAck) | ||
381 | { | ||
382 | foreach (uint ack in NewPack.Header.AckList) | ||
383 | { | ||
384 | OpenSim_Main.localcons.WriteLine("Got appended ack: " + ack); | ||
385 | NeedAck.Remove(ack); | ||
386 | } | ||
387 | } | ||
388 | } | ||
389 | |||
390 | // Handle PacketAck packets | ||
391 | if (NewPack.Type == PacketType.PacketAck) | ||
392 | { | ||
393 | PacketAckPacket ackPacket = (PacketAckPacket)NewPack; | ||
394 | |||
395 | lock (NeedAck) | ||
396 | { | ||
397 | foreach (PacketAckPacket.PacketsBlock block in ackPacket.Packets) | ||
398 | { | ||
399 | NeedAck.Remove(block.ID); | ||
400 | } | ||
401 | } | ||
402 | } | ||
403 | else if ((NewPack.Type == PacketType.StartPingCheck)) | ||
404 | { | ||
405 | //reply to pingcheck | ||
406 | libsecondlife.Packets.StartPingCheckPacket startPing = (libsecondlife.Packets.StartPingCheckPacket)NewPack; | ||
407 | libsecondlife.Packets.CompletePingCheckPacket endPing = new CompletePingCheckPacket(); | ||
408 | endPing.PingID.PingID = startPing.PingID.PingID; | ||
409 | OutPacket(endPing); | ||
410 | } | ||
411 | else | ||
412 | { | ||
413 | QueItem item = new QueItem(); | ||
414 | item.Packet = NewPack; | ||
415 | item.Incoming = true; | ||
416 | this.PacketQueue.Enqueue(item); | ||
417 | } | ||
418 | |||
419 | } | ||
420 | |||
421 | public void OutPacket(Packet NewPack) | ||
422 | { | ||
423 | QueItem item = new QueItem(); | ||
424 | item.Packet = NewPack; | ||
425 | item.Incoming = false; | ||
426 | this.PacketQueue.Enqueue(item); | ||
427 | } | ||
428 | |||
429 | public OpenSimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack) | ||
430 | { | ||
431 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request"); | ||
432 | cirpack = initialcirpack; | ||
433 | userEP = remoteEP; | ||
434 | PacketQueue = new BlockingQueue<QueItem>(); | ||
435 | AssetRequests = new BlockingQueue<TransferRequestPacket>(); | ||
436 | AckTimer = new System.Timers.Timer(500); | ||
437 | AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed); | ||
438 | AckTimer.Start(); | ||
439 | |||
440 | ClientThread = new Thread(new ThreadStart(AuthUser)); | ||
441 | ClientThread.IsBackground = true; | ||
442 | ClientThread.Start(); | ||
443 | } | ||
444 | |||
445 | private void ClientLoop() | ||
446 | { | ||
447 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:ClientLoop() - Entered loop"); | ||
448 | while (true) | ||
449 | { | ||
450 | QueItem nextPacket = PacketQueue.Dequeue(); | ||
451 | if (nextPacket.Incoming) | ||
452 | { | ||
453 | //is a incoming packet | ||
454 | ProcessInPacket(nextPacket.Packet); | ||
455 | } | ||
456 | else | ||
457 | { | ||
458 | //is a out going packet | ||
459 | ProcessOutPacket(nextPacket.Packet); | ||
460 | } | ||
461 | } | ||
462 | } | ||
463 | |||
464 | private void InitNewClient() | ||
465 | { | ||
466 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); | ||
467 | OpenSim_Main.local_world.AddViewerAgent(this); | ||
468 | world.Entity tempent = OpenSim_Main.local_world.Entities[this.AgentID]; | ||
469 | this.ClientAvatar = (world.Avatar)tempent; | ||
470 | } | ||
471 | |||
472 | private void AuthUser() | ||
473 | { | ||
474 | if (OpenSim_Main.cfg.sandbox == false) | ||
475 | { | ||
476 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AuthUser() - Authenticating new user request with grid"); | ||
477 | WebRequest CheckSession = WebRequest.Create(OpenSim_Main.cfg.GridURL + "/usersessions/" + OpenSim_Main.cfg.GridSendKey + "/" + cirpack.CircuitCode.ID.ToString() + "/" + cirpack.CircuitCode.Code.ToString() + "/exists"); | ||
478 | OpenSim_Main.localcons.WriteLine(OpenSim_Main.cfg.GridURL); | ||
479 | WebResponse GridResponse = CheckSession.GetResponse(); | ||
480 | StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); | ||
481 | String grTest = sr.ReadLine(); | ||
482 | sr.Close(); | ||
483 | GridResponse.Close(); | ||
484 | if (String.IsNullOrEmpty(grTest) || grTest.Equals("1")) | ||
485 | { // YAY! Valid login | ||
486 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); | ||
487 | this.AgentID = cirpack.CircuitCode.ID; | ||
488 | this.SessionID = cirpack.CircuitCode.SessionID; | ||
489 | this.CircuitCode = cirpack.CircuitCode.Code; | ||
490 | InitNewClient(); | ||
491 | ClientLoop(); | ||
492 | } | ||
493 | else | ||
494 | { // Invalid | ||
495 | OpenSim_Main.localcons.WriteLine("OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); | ||
496 | ClientThread.Abort(); | ||
497 | } | ||
498 | } | ||
499 | else | ||
500 | { | ||
501 | this.AgentID = cirpack.CircuitCode.ID; | ||
502 | this.SessionID = cirpack.CircuitCode.SessionID; | ||
503 | this.CircuitCode = cirpack.CircuitCode.Code; | ||
504 | InitNewClient(); | ||
505 | ClientLoop(); | ||
506 | } | ||
507 | } | ||
508 | } | ||
509 | |||
510 | } | ||
diff --git a/src/Second-server.csproj b/src/Second-server.csproj deleted file mode 100644 index 8d55e06..0000000 --- a/src/Second-server.csproj +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <OutputType>Exe</OutputType> | ||
4 | <RootNamespace>OpenSim</RootNamespace> | ||
5 | <AssemblyName>OpenSim</AssemblyName> | ||
6 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
7 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
8 | <ProjectGuid>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</ProjectGuid> | ||
9 | <StartupObject>OpenSim.OpenSim_Main</StartupObject> | ||
10 | </PropertyGroup> | ||
11 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
12 | <OutputPath>..\bin\</OutputPath> | ||
13 | <Optimize>False</Optimize> | ||
14 | <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
15 | <DebugSymbols>True</DebugSymbols> | ||
16 | <DebugType>Full</DebugType> | ||
17 | <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> | ||
18 | </PropertyGroup> | ||
19 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
20 | <OutputPath>..\bin\</OutputPath> | ||
21 | <Optimize>True</Optimize> | ||
22 | <DefineConstants>TRACE</DefineConstants> | ||
23 | <DebugSymbols>False</DebugSymbols> | ||
24 | <DebugType>None</DebugType> | ||
25 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
26 | </PropertyGroup> | ||
27 | <ItemGroup> | ||
28 | <Reference Include="Axiom.MathLib, Version=0.7.0.25497, Culture=neutral"> | ||
29 | <SpecificVersion>False</SpecificVersion> | ||
30 | <HintPath>..\bin\Axiom.MathLib.dll</HintPath> | ||
31 | </Reference> | ||
32 | <Reference Include="Db4objects.Db4o, Version=6.0.1.0, Culture=neutral, PublicKeyToken=6199cd4f203aa8eb, processorArchitecture=MSIL" /> | ||
33 | <Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
34 | <SpecificVersion>False</SpecificVersion> | ||
35 | <HintPath>..\bin\libsecondlife.dll</HintPath> | ||
36 | </Reference> | ||
37 | <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL"> | ||
38 | <SpecificVersion>False</SpecificVersion> | ||
39 | <HintPath>..\bin\log4net.dll</HintPath> | ||
40 | </Reference> | ||
41 | <Reference Include="System" /> | ||
42 | <Reference Include="System.Data" /> | ||
43 | <Reference Include="System.Xml" /> | ||
44 | </ItemGroup> | ||
45 | <ItemGroup> | ||
46 | <Compile Include="Config.cs" /> | ||
47 | <Compile Include="Main.cs" /> | ||
48 | <Compile Include="OpenSimClient.cs" /> | ||
49 | <Compile Include="ServerConsole.cs" /> | ||
50 | <Compile Include="types\Mesh.cs" /> | ||
51 | <Compile Include="types\Triangle.cs" /> | ||
52 | <Compile Include="Util.cs" /> | ||
53 | <Compile Include="VersionInfo.cs" /> | ||
54 | <Compile Include="world\Avatar.cs" /> | ||
55 | <Compile Include="world\Entity.cs" /> | ||
56 | <Compile Include="world\HeightmapGenHills.cs" /> | ||
57 | <Compile Include="world\PhysicsEngine.cs" /> | ||
58 | <Compile Include="world\Primitive.cs" /> | ||
59 | <Compile Include="world\ScriptEngine.cs" /> | ||
60 | <Compile Include="world\scripting\IScript.cs" /> | ||
61 | <Compile Include="world\SurfacePatch.cs" /> | ||
62 | <Compile Include="world\World.cs" /> | ||
63 | </ItemGroup> | ||
64 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> | ||
65 | </Project> \ No newline at end of file | ||
diff --git a/src/Second-server.sln b/src/Second-server.sln deleted file mode 100644 index 86fc54c..0000000 --- a/src/Second-server.sln +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 |  | ||
2 | Microsoft Visual Studio Solution File, Format Version 9.00 | ||
3 | # Visual Studio 2005 | ||
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}" | ||
5 | EndProject | ||
6 | Global | ||
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
8 | Debug|.NET 1.1 = Debug|.NET 1.1 | ||
9 | Debug|Any CPU = Debug|Any CPU | ||
10 | Release|.NET 1.1 = Release|.NET 1.1 | ||
11 | Release|Any CPU = Release|Any CPU | ||
12 | EndGlobalSection | ||
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
14 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|.NET 1.1.ActiveCfg = Debug|Any CPU | ||
15 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|.NET 1.1.Build.0 = Debug|Any CPU | ||
16 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
17 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
18 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|.NET 1.1.ActiveCfg = Release|Any CPU | ||
19 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|.NET 1.1.Build.0 = Release|.NET 1.1 | ||
20 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
21 | {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
22 | EndGlobalSection | ||
23 | GlobalSection(SolutionProperties) = preSolution | ||
24 | HideSolutionNode = FALSE | ||
25 | EndGlobalSection | ||
26 | EndGlobal | ||
diff --git a/src/ServerConsole.cs b/src/ServerConsole.cs deleted file mode 100644 index 21a465d..0000000 --- a/src/ServerConsole.cs +++ /dev/null | |||
@@ -1,195 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | |||
4 | * Copyright (c) <year>, <copyright holder> | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions are met: | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * * Neither the name of the <organization> nor the | ||
15 | * names of its contributors may be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
21 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | using System; | ||
31 | using System.Collections; | ||
32 | using System.Collections.Generic; | ||
33 | using System.Threading; | ||
34 | using System.IO; | ||
35 | using System.Net; | ||
36 | using libsecondlife; | ||
37 | using libsecondlife.Packets; | ||
38 | |||
39 | namespace OpenSim | ||
40 | { | ||
41 | public class ServerConsole { | ||
42 | private ConsoleType ConsType; | ||
43 | StreamWriter Log; | ||
44 | |||
45 | public enum ConsoleType { | ||
46 | Local, // Use stdio | ||
47 | TCP, // Use TCP/telnet | ||
48 | SimChat // Use in-world chat (for gods) | ||
49 | } | ||
50 | |||
51 | |||
52 | // STUPID HACK ALERT!!!! STUPID HACK ALERT!!!!! | ||
53 | // constype - the type of console to use (see enum ConsoleType) | ||
54 | // sparam - depending on the console type: | ||
55 | // TCP - the IP to bind to (127.0.0.1 if blank) | ||
56 | // Local - param ignored | ||
57 | // SimChat - the AgentID of this sim's admin | ||
58 | // and for the iparam: | ||
59 | // TCP - the port to bind to | ||
60 | // Local - param ignored | ||
61 | // SimChat - the chat channel to accept commands from | ||
62 | public ServerConsole(ConsoleType constype, string sparam, int iparam) { | ||
63 | ConsType = constype; | ||
64 | switch(constype) { | ||
65 | case ConsoleType.Local: | ||
66 | Console.WriteLine("ServerConsole.cs - creating new local console"); | ||
67 | Console.WriteLine("Logs will be saved to current directory in opensim-console.log"); | ||
68 | Log=File.AppendText("opensim-console.log"); | ||
69 | Log.WriteLine("========================================================================"); | ||
70 | Log.WriteLine("OpenSim " + VersionInfo.Version + " Started at " + DateTime.Now.ToString()); | ||
71 | break; | ||
72 | case ConsoleType.TCP: | ||
73 | break; | ||
74 | case ConsoleType.SimChat: | ||
75 | break; | ||
76 | |||
77 | default: | ||
78 | Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!"); | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | public void Close() { | ||
84 | Log.WriteLine("OpenSim shutdown at " + DateTime.Now.ToString()); | ||
85 | Log.Close(); | ||
86 | } | ||
87 | |||
88 | // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here | ||
89 | public void WriteLine(string Line) { | ||
90 | Log.WriteLine(Line); | ||
91 | Console.WriteLine(Line); | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | public string ReadLine() { | ||
96 | string TempStr=Console.ReadLine(); | ||
97 | Log.WriteLine(TempStr); | ||
98 | return TempStr; | ||
99 | } | ||
100 | |||
101 | public int Read() { | ||
102 | int TempInt= Console.Read(); | ||
103 | Log.Write((char)TempInt); | ||
104 | return TempInt; | ||
105 | } | ||
106 | |||
107 | public void Write(string Line) { | ||
108 | Console.Write(Line); | ||
109 | Log.Write(Line); | ||
110 | return; | ||
111 | } | ||
112 | |||
113 | // Displays a command prompt and waits for the user to enter a string, then returns that string | ||
114 | public string CmdPrompt(string prompt) { | ||
115 | this.Write(prompt); | ||
116 | return this.ReadLine(); | ||
117 | } | ||
118 | |||
119 | // Displays a command prompt and returns a default value if the user simply presses enter | ||
120 | public string CmdPrompt(string prompt, string defaultresponse) { | ||
121 | string temp=CmdPrompt(prompt); | ||
122 | if(temp=="") { | ||
123 | return defaultresponse; | ||
124 | } else { | ||
125 | return temp; | ||
126 | } | ||
127 | } | ||
128 | |||
129 | // Displays a command prompt and returns a default value, user may only enter 1 of 2 options | ||
130 | public string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB) { | ||
131 | bool itisdone=false; | ||
132 | string temp=CmdPrompt(prompt,defaultresponse); | ||
133 | while(itisdone==false) { | ||
134 | if((temp==OptionA) || (temp==OptionB)) { | ||
135 | itisdone=true; | ||
136 | } else { | ||
137 | this.WriteLine("Valid options are " + OptionA + " or " + OptionB); | ||
138 | temp=CmdPrompt(prompt,defaultresponse); | ||
139 | } | ||
140 | } | ||
141 | return temp; | ||
142 | } | ||
143 | |||
144 | // Runs a command with a number of parameters | ||
145 | public Object RunCmd(string Cmd, string[] cmdparams) { | ||
146 | switch(Cmd) { | ||
147 | case "help": | ||
148 | this.WriteLine("show users - show info about connected users"); | ||
149 | this.WriteLine("shutdown - disconnect all clients and shutdown"); | ||
150 | break; | ||
151 | |||
152 | case "show": | ||
153 | ShowCommands(cmdparams[0]); | ||
154 | break; | ||
155 | |||
156 | case "shutdown": | ||
157 | OpenSim_Main.Shutdown(); | ||
158 | break; | ||
159 | } | ||
160 | return null; | ||
161 | } | ||
162 | |||
163 | // Shows data about something | ||
164 | public void ShowCommands(string ShowWhat) { | ||
165 | switch(ShowWhat) { | ||
166 | case "uptime": | ||
167 | this.WriteLine("OpenSim has been running since " + OpenSim_Main.startuptime.ToString()); | ||
168 | this.WriteLine("That is " + (DateTime.Now-OpenSim_Main.startuptime).ToString()); | ||
169 | break; | ||
170 | case "users": | ||
171 | OpenSim.world.Avatar TempAv; | ||
172 | this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP")); | ||
173 | foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) { | ||
174 | TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID]; | ||
175 | this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}",TempAv.firstname, TempAv.lastname,UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); | ||
176 | } | ||
177 | break; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | // Displays a prompt to the user and then runs the command they entered | ||
182 | public void MainConsolePrompt() { | ||
183 | string[] tempstrarray; | ||
184 | string tempstr = this.CmdPrompt("OpenSim-" + OpenSim_Main.cfg.RegionHandle.ToString() + " # "); | ||
185 | tempstrarray = tempstr.Split(' '); | ||
186 | string cmd=tempstrarray[0]; | ||
187 | Array.Reverse(tempstrarray); | ||
188 | Array.Resize<string>(ref tempstrarray,tempstrarray.Length-1); | ||
189 | Array.Reverse(tempstrarray); | ||
190 | string[] cmdparams=(string[])tempstrarray; | ||
191 | RunCmd(cmd,cmdparams); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | } | ||
diff --git a/src/Util.cs b/src/Util.cs deleted file mode 100644 index 3b89b25..0000000 --- a/src/Util.cs +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | |||
4 | * Copyright (c) <year>, <copyright holder> | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * Redistribution and use in source and binary forms, with or without | ||
8 | * modification, are permitted provided that the following conditions are met: | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * * Redistributions in binary form must reproduce the above copyright | ||
12 | * notice, this list of conditions and the following disclaimer in the | ||
13 | * documentation and/or other materials provided with the distribution. | ||
14 | * * Neither the name of the <organization> nor the | ||
15 | * names of its contributors may be used to endorse or promote products | ||
16 | * derived from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
21 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Threading; | ||
33 | using libsecondlife; | ||
34 | using libsecondlife.Packets; | ||
35 | |||
36 | namespace OpenSim | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// </summary> | ||
40 | public class QueItem { | ||
41 | public QueItem() | ||
42 | { | ||
43 | } | ||
44 | |||
45 | public Packet Packet; | ||
46 | public bool Incoming; | ||
47 | } | ||
48 | |||
49 | |||
50 | public class BlockingQueue< T > { | ||
51 | private Queue< T > _queue = new Queue< T >(); | ||
52 | private object _queueSync = new object(); | ||
53 | |||
54 | public void Enqueue(T value) | ||
55 | { | ||
56 | lock(_queueSync) | ||
57 | { | ||
58 | _queue.Enqueue(value); | ||
59 | Monitor.Pulse(_queueSync); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | public T Dequeue() | ||
64 | { | ||
65 | lock(_queueSync) | ||
66 | { | ||
67 | if( _queue.Count < 1) | ||
68 | Monitor.Wait(_queueSync); | ||
69 | |||
70 | return _queue.Dequeue(); | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | } | ||
diff --git a/src/VersionInfo.cs b/src/VersionInfo.cs deleted file mode 100644 index 14581ee..0000000 --- a/src/VersionInfo.cs +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | */ | ||
26 | |||
27 | using System; | ||
28 | |||
29 | namespace OpenSim | ||
30 | { | ||
31 | /// <summary> | ||
32 | /// </summary> | ||
33 | public class VersionInfo | ||
34 | { | ||
35 | public static string Version = "0.0.1-unofficial"; | ||
36 | } | ||
37 | } | ||
diff --git a/src/VersionInfo.cs.template b/src/VersionInfo.cs.template deleted file mode 100644 index e4e1b95..0000000 --- a/src/VersionInfo.cs.template +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | Copyright (c) OpenSim project, http://osgrid.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | */ | ||
26 | |||
27 | using System; | ||
28 | |||
29 | namespace OpenSim | ||
30 | { | ||
31 | /// <summary> | ||
32 | /// </summary> | ||
33 | public class VersionInfo | ||
34 | { | ||
35 | public static string Version = "@@VERSION"; | ||
36 | } | ||
37 | } | ||
diff --git a/src/types/Mesh.cs b/src/types/Mesh.cs deleted file mode 100644 index 3e00c91..0000000 --- a/src/types/Mesh.cs +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.types | ||
6 | { | ||
7 | // TODO: This will need some performance tuning no doubt. | ||
8 | public class Mesh | ||
9 | { | ||
10 | public List<Triangle> mesh; | ||
11 | |||
12 | public Mesh() | ||
13 | { | ||
14 | mesh = new List<Triangle>(); | ||
15 | } | ||
16 | |||
17 | public void AddTri(Triangle tri) | ||
18 | { | ||
19 | mesh.Add(tri); | ||
20 | } | ||
21 | |||
22 | public static Mesh operator +(Mesh a, Mesh b) | ||
23 | { | ||
24 | a.mesh.AddRange(b.mesh); | ||
25 | return a; | ||
26 | } | ||
27 | } | ||
28 | } | ||
diff --git a/src/types/Triangle.cs b/src/types/Triangle.cs deleted file mode 100644 index 8dfea6e..0000000 --- a/src/types/Triangle.cs +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using Axiom.MathLib; | ||
5 | |||
6 | namespace OpenSim.types | ||
7 | { | ||
8 | public class Triangle | ||
9 | { | ||
10 | Vector3 a; | ||
11 | Vector3 b; | ||
12 | Vector3 c; | ||
13 | |||
14 | public Triangle() | ||
15 | { | ||
16 | a = new Vector3(); | ||
17 | b = new Vector3(); | ||
18 | c = new Vector3(); | ||
19 | } | ||
20 | |||
21 | public Triangle(Vector3 A, Vector3 B, Vector3 C) | ||
22 | { | ||
23 | a = A; | ||
24 | b = B; | ||
25 | c = C; | ||
26 | } | ||
27 | } | ||
28 | } | ||
diff --git a/src/world/Avatar.cs b/src/world/Avatar.cs deleted file mode 100644 index 9d8d7d2..0000000 --- a/src/world/Avatar.cs +++ /dev/null | |||
@@ -1,256 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.IO; | ||
4 | using System.Text; | ||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | using Axiom.MathLib; | ||
8 | |||
9 | namespace OpenSim.world | ||
10 | { | ||
11 | public class Avatar : Entity | ||
12 | { | ||
13 | public string firstname; | ||
14 | public string lastname; | ||
15 | public OpenSimClient ControllingClient; | ||
16 | public LLVector3 oldvel; | ||
17 | public LLVector3 oldpos; | ||
18 | public uint CurrentKeyMask; | ||
19 | public bool walking; | ||
20 | |||
21 | private libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock AvatarTemplate; | ||
22 | |||
23 | public Avatar(OpenSimClient TheClient) { | ||
24 | OpenSim_Main.localcons.WriteLine("Avatar.cs - Loading details from grid (DUMMY)"); | ||
25 | ControllingClient=TheClient; | ||
26 | SetupTemplate("avatar-template.dat"); | ||
27 | |||
28 | position = new LLVector3(100.0f,100.0f,60.0f); | ||
29 | } | ||
30 | |||
31 | public override void update() { | ||
32 | lock(this) { | ||
33 | base.update(); | ||
34 | |||
35 | oldvel=this.velocity; | ||
36 | oldpos=this.position; | ||
37 | if((this.CurrentKeyMask & (uint)MainAvatar.AgentUpdateFlags.AGENT_CONTROL_AT_POS) != 0) { | ||
38 | Vector3 tmpVelocity = this.rotation * new Vector3(1.0f,0.0f,0.0f); | ||
39 | tmpVelocity.Normalize(); tmpVelocity = tmpVelocity * 0.5f; | ||
40 | this.velocity.X = tmpVelocity.x; | ||
41 | this.velocity.Y = tmpVelocity.y; | ||
42 | this.velocity.Z = tmpVelocity.z; | ||
43 | this.walking=true; | ||
44 | } else { | ||
45 | this.velocity.X=0; | ||
46 | this.velocity.Y=0; | ||
47 | this.velocity.Z=0; | ||
48 | this.walking=false; | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | |||
53 | private void SetupTemplate(string name) | ||
54 | { | ||
55 | |||
56 | int i = 0; | ||
57 | FileInfo fInfo = new FileInfo(name); | ||
58 | long numBytes = fInfo.Length; | ||
59 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | ||
60 | BinaryReader br = new BinaryReader(fStream); | ||
61 | byte [] data1 = br.ReadBytes((int)numBytes); | ||
62 | br.Close(); | ||
63 | fStream.Close(); | ||
64 | |||
65 | libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock objdata = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock(data1, ref i); | ||
66 | |||
67 | System.Text.Encoding enc = System.Text.Encoding.ASCII; | ||
68 | libsecondlife.LLVector3 pos = new LLVector3(objdata.ObjectData, 16); | ||
69 | pos.X = 100f; | ||
70 | objdata.ID = this.localid; | ||
71 | objdata.NameValue = enc.GetBytes("FirstName STRING RW SV Test \nLastName STRING RW SV User \0"); | ||
72 | libsecondlife.LLVector3 pos2 = new LLVector3(100f,100f,23f); | ||
73 | //objdata.FullID=user.AgentID; | ||
74 | byte[] pb = pos.GetBytes(); | ||
75 | Array.Copy(pb, 0, objdata.ObjectData, 16, pb.Length); | ||
76 | |||
77 | AvatarTemplate = objdata; | ||
78 | |||
79 | } | ||
80 | |||
81 | public void CompleteMovement(World RegionInfo) { | ||
82 | OpenSim_Main.localcons.WriteLine("Avatar.cs:CompleteMovement() - Constructing AgentMovementComplete packet"); | ||
83 | AgentMovementCompletePacket mov = new AgentMovementCompletePacket(); | ||
84 | mov.AgentData.SessionID = this.ControllingClient.SessionID; | ||
85 | mov.AgentData.AgentID = this.ControllingClient.AgentID; | ||
86 | mov.Data.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
87 | // TODO - dynamicalise this stuff | ||
88 | mov.Data.Timestamp = 1172750370; | ||
89 | mov.Data.Position = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z); | ||
90 | mov.Data.LookAt = new LLVector3(0.99f, 0.042f, 0); | ||
91 | |||
92 | OpenSim_Main.localcons.WriteLine("Sending AgentMovementComplete packet"); | ||
93 | ControllingClient.OutPacket(mov); | ||
94 | } | ||
95 | |||
96 | public void SendInitialPosition() { | ||
97 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
98 | |||
99 | |||
100 | //send a objectupdate packet with information about the clients avatar | ||
101 | ObjectUpdatePacket objupdate = new ObjectUpdatePacket(); | ||
102 | objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; | ||
103 | objupdate.RegionData.TimeDilation = 64096; | ||
104 | objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1]; | ||
105 | |||
106 | objupdate.ObjectData[0] = AvatarTemplate; | ||
107 | //give this avatar object a local id and assign the user a name | ||
108 | objupdate.ObjectData[0].ID = this.localid; | ||
109 | //User_info.name="Test"+this.local_numer+" User"; | ||
110 | objupdate.ObjectData[0].FullID = ControllingClient.AgentID; | ||
111 | objupdate.ObjectData[0].NameValue = _enc.GetBytes("FirstName STRING RW SV " + firstname + "\nLastName STRING RW SV " + lastname + " \0"); | ||
112 | |||
113 | libsecondlife.LLVector3 pos2 = new LLVector3((float)this.position.X, (float)this.position.Y, (float)this.position.Z); | ||
114 | |||
115 | byte[] pb = pos2.GetBytes(); | ||
116 | |||
117 | Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length); | ||
118 | OpenSim_Main.local_world._localNumber++; | ||
119 | this.ControllingClient.OutPacket(objupdate); | ||
120 | } | ||
121 | |||
122 | public override ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() { | ||
123 | byte[] bytes = new byte[60]; | ||
124 | int i=0; | ||
125 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock(); | ||
126 | |||
127 | dat.TextureEntry = AvatarTemplate.TextureEntry; | ||
128 | libsecondlife.LLVector3 pos2 = new LLVector3(this.position.X, this.position.Y, this.position.Z); | ||
129 | |||
130 | uint ID = this.localid; | ||
131 | bytes[i++] = (byte)(ID % 256); | ||
132 | bytes[i++] = (byte)((ID >> 8) % 256); | ||
133 | bytes[i++] = (byte)((ID >> 16) % 256); | ||
134 | bytes[i++] = (byte)((ID >> 24) % 256); | ||
135 | bytes[i++] = 0; | ||
136 | bytes[i++] = 1; | ||
137 | i += 14; | ||
138 | bytes[i++] = 128; | ||
139 | bytes[i++] = 63; | ||
140 | |||
141 | byte[] pb = pos2.GetBytes(); | ||
142 | Array.Copy(pb, 0, bytes, i, pb.Length); | ||
143 | i += 12; | ||
144 | |||
145 | |||
146 | ushort ac = 32767; | ||
147 | bytes[i++] = (byte)((ushort)(((this.velocity.X/128f)+1)*32767) % 256 ); | ||
148 | bytes[i++] = (byte)(((ushort)(((this.velocity.X/128f)+1)*32767) >> 8) % 256); | ||
149 | bytes[i++] = (byte)((ushort)(((this.velocity.Y/128f)+1)*32767) % 256); | ||
150 | bytes[i++] = (byte)(((ushort)(((this.velocity.Y/128f)+1)*32767) >> 8) % 256); | ||
151 | bytes[i++] = (byte)((ushort)(((this.velocity.Z/128f)+1)*32767) % 256); | ||
152 | bytes[i++] = (byte)(((ushort)(((this.velocity.Z/128f)+1)*32767) >> 8) % 256); | ||
153 | |||
154 | |||
155 | |||
156 | |||
157 | //accel | ||
158 | bytes[i++] = (byte)(ac % 256); | ||
159 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
160 | bytes[i++] = (byte)(ac % 256); | ||
161 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
162 | bytes[i++] = (byte)(ac % 256); | ||
163 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
164 | |||
165 | //rot | ||
166 | bytes[i++] = (byte)(ac % 256); | ||
167 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
168 | bytes[i++] = (byte)(ac % 256); | ||
169 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
170 | bytes[i++] = (byte)(ac % 256); | ||
171 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
172 | bytes[i++] = (byte)(ac % 256); | ||
173 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
174 | |||
175 | //rotation vel | ||
176 | bytes[i++] = (byte)(ac % 256); | ||
177 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
178 | bytes[i++] = (byte)(ac % 256); | ||
179 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
180 | bytes[i++] = (byte)(ac % 256); | ||
181 | bytes[i++] = (byte)((ac >> 8) % 256); | ||
182 | |||
183 | dat.Data=bytes; | ||
184 | return(dat); | ||
185 | |||
186 | } | ||
187 | |||
188 | public void SendInitialAppearance() { | ||
189 | AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket(); | ||
190 | aw.AgentData.AgentID = this.ControllingClient.AgentID; | ||
191 | aw.AgentData.SerialNum = 0; | ||
192 | aw.AgentData.SessionID = ControllingClient.SessionID; | ||
193 | |||
194 | aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13]; | ||
195 | AgentWearablesUpdatePacket.WearableDataBlock awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
196 | awb.WearableType = (byte)0; | ||
197 | awb.AssetID = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); | ||
198 | awb.ItemID = LLUUID.Random(); | ||
199 | aw.WearableData[0] = awb; | ||
200 | |||
201 | for(int i=1; i<13; i++) { | ||
202 | awb = new AgentWearablesUpdatePacket.WearableDataBlock(); | ||
203 | awb.WearableType = (byte)i; | ||
204 | awb.AssetID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
205 | awb.ItemID = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
206 | aw.WearableData[i] = awb; | ||
207 | } | ||
208 | |||
209 | ControllingClient.OutPacket(aw); | ||
210 | } | ||
211 | |||
212 | public void SendRegionHandshake(World RegionInfo) { | ||
213 | OpenSim_Main.localcons.WriteLine("Avatar.cs:SendRegionHandshake() - Creating empty RegionHandshake packet"); | ||
214 | System.Text.Encoding _enc = System.Text.Encoding.ASCII; | ||
215 | RegionHandshakePacket handshake = new RegionHandshakePacket(); | ||
216 | |||
217 | OpenSim_Main.localcons.WriteLine("Avatar.cs:SendRegionhandshake() - Filling in RegionHandshake details"); | ||
218 | handshake.RegionInfo.BillableFactor = 0; | ||
219 | handshake.RegionInfo.IsEstateManager = false; | ||
220 | handshake.RegionInfo.TerrainHeightRange00 = 60; | ||
221 | handshake.RegionInfo.TerrainHeightRange01 = 60; | ||
222 | handshake.RegionInfo.TerrainHeightRange10 = 60; | ||
223 | handshake.RegionInfo.TerrainHeightRange11 = 60; | ||
224 | handshake.RegionInfo.TerrainStartHeight00 = 10; | ||
225 | handshake.RegionInfo.TerrainStartHeight01 = 10; | ||
226 | handshake.RegionInfo.TerrainStartHeight10 = 10; | ||
227 | handshake.RegionInfo.TerrainStartHeight11 = 10; | ||
228 | handshake.RegionInfo.SimAccess = 13; | ||
229 | handshake.RegionInfo.WaterHeight = 20.0f; | ||
230 | handshake.RegionInfo.RegionFlags = 72458694; // TODO: WTF sirs? Use an enum! | ||
231 | handshake.RegionInfo.SimName = _enc.GetBytes(OpenSim_Main.cfg.RegionName + "\0"); | ||
232 | handshake.RegionInfo.SimOwner = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
233 | handshake.RegionInfo.TerrainBase0 = new LLUUID("b8d3965a-ad78-bf43-699b-bff8eca6c975"); | ||
234 | handshake.RegionInfo.TerrainBase1 = new LLUUID("abb783e6-3e93-26c0-248a-247666855da3"); | ||
235 | handshake.RegionInfo.TerrainBase2 = new LLUUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); | ||
236 | handshake.RegionInfo.TerrainBase3 = new LLUUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); | ||
237 | handshake.RegionInfo.TerrainDetail0 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
238 | handshake.RegionInfo.TerrainDetail1 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
239 | handshake.RegionInfo.TerrainDetail2 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
240 | handshake.RegionInfo.TerrainDetail3 = new LLUUID("00000000-0000-0000-0000-000000000000"); | ||
241 | handshake.RegionInfo.CacheID = new LLUUID("545ec0a5-5751-1026-8a0b-216e38a7ab37"); | ||
242 | |||
243 | OpenSim_Main.localcons.WriteLine("Avatar.cs:SendRegionHandshake() - Sending RegionHandshake packet"); | ||
244 | this.ControllingClient.OutPacket(handshake); | ||
245 | } | ||
246 | |||
247 | public void HandleAgentUpdate(AgentUpdatePacket update) { | ||
248 | lock(this) { | ||
249 | this.CurrentKeyMask = update.AgentData.ControlFlags; | ||
250 | this.rotation = new Quaternion(update.AgentData.BodyRotation.W, update.AgentData.BodyRotation.X, update.AgentData.BodyRotation.Y, update.AgentData.BodyRotation.Z); | ||
251 | this.needupdate = true; | ||
252 | } | ||
253 | } | ||
254 | |||
255 | } | ||
256 | } | ||
diff --git a/src/world/Entity.cs b/src/world/Entity.cs deleted file mode 100644 index 7880a46..0000000 --- a/src/world/Entity.cs +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using Axiom.MathLib; | ||
5 | using libsecondlife; | ||
6 | using OpenSim.types; | ||
7 | using libsecondlife.Packets; | ||
8 | |||
9 | namespace OpenSim.world | ||
10 | { | ||
11 | public class Entity | ||
12 | { | ||
13 | protected libsecondlife.LLUUID uuid; | ||
14 | protected uint localid; | ||
15 | public LLVector3 position; | ||
16 | public LLVector3 velocity; | ||
17 | protected Quaternion rotation; | ||
18 | protected string name; | ||
19 | protected List<Entity> children; | ||
20 | public bool needupdate; | ||
21 | |||
22 | public Entity() | ||
23 | { | ||
24 | uuid = new libsecondlife.LLUUID(); | ||
25 | localid = 8880000 + (OpenSim_Main.local_world._localNumber++); // FIXME - race condition! | ||
26 | position = new LLVector3(); | ||
27 | velocity = new LLVector3(); | ||
28 | rotation = new Quaternion(); | ||
29 | name = "(basic entity)"; | ||
30 | children = new List<Entity>(); | ||
31 | } | ||
32 | |||
33 | public virtual void update() { | ||
34 | // Do any per-frame updates needed that are applicable to every type of entity | ||
35 | foreach (Entity child in children) | ||
36 | { | ||
37 | if(child.needupdate) | ||
38 | child.update(); | ||
39 | } | ||
40 | this.needupdate=false; | ||
41 | } | ||
42 | |||
43 | public virtual ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateTerseBlock() { | ||
44 | return null; | ||
45 | } | ||
46 | |||
47 | |||
48 | public virtual string getName() | ||
49 | { | ||
50 | return name; | ||
51 | } | ||
52 | |||
53 | public virtual Mesh getMesh() | ||
54 | { | ||
55 | Mesh mesh = new Mesh(); | ||
56 | |||
57 | foreach (Entity child in children) | ||
58 | { | ||
59 | mesh += child.getMesh(); | ||
60 | } | ||
61 | |||
62 | return mesh; | ||
63 | } | ||
64 | } | ||
65 | } | ||
diff --git a/src/world/HeightmapGenHills.cs b/src/world/HeightmapGenHills.cs deleted file mode 100644 index 12af005..0000000 --- a/src/world/HeightmapGenHills.cs +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | using System; | ||
2 | |||
3 | namespace libsecondlife | ||
4 | { | ||
5 | public class HeightmapGenHills | ||
6 | { | ||
7 | private Random Rand = new Random(); | ||
8 | private int NumHills; | ||
9 | private float HillMin; | ||
10 | private float HillMax; | ||
11 | private bool Island; | ||
12 | private float[] heightmap; | ||
13 | |||
14 | public float[] GenerateHeightmap(int numHills, float hillMin, float hillMax, bool island) | ||
15 | { | ||
16 | NumHills = numHills; | ||
17 | HillMin = hillMin; | ||
18 | HillMax = hillMax; | ||
19 | Island = island; | ||
20 | |||
21 | heightmap = new float[256 * 256]; | ||
22 | |||
23 | for (int i = 0; i < numHills; i++) | ||
24 | { | ||
25 | AddHill(); | ||
26 | } | ||
27 | |||
28 | Normalize(); | ||
29 | |||
30 | return heightmap; | ||
31 | } | ||
32 | |||
33 | private void AddHill() | ||
34 | { | ||
35 | float x, y; | ||
36 | float radius = RandomRange(HillMin, HillMax); | ||
37 | |||
38 | if (Island) | ||
39 | { | ||
40 | // Which direction from the center of the map the hill is placed | ||
41 | float theta = RandomRange(0, 6.28f); | ||
42 | |||
43 | // How far from the center of the map to place the hill. The radius | ||
44 | // is subtracted from the range to prevent any part of the hill from | ||
45 | // reaching the edge of the map | ||
46 | float distance = RandomRange(radius / 2.0f, 128.0f - radius); | ||
47 | |||
48 | x = 128.0f + (float)Math.Cos(theta) * distance; | ||
49 | y = 128.0f + (float)Math.Sin(theta) * distance; | ||
50 | } | ||
51 | else | ||
52 | { | ||
53 | x = RandomRange(-radius, 256.0f + radius); | ||
54 | y = RandomRange(-radius, 256.0f + radius); | ||
55 | } | ||
56 | |||
57 | float radiusSq = radius * radius; | ||
58 | float distSq; | ||
59 | float height; | ||
60 | |||
61 | int xMin = (int)(x - radius) - 1; | ||
62 | int xMax = (int)(x + radius) + 1; | ||
63 | if (xMin < 0) xMin = 0; | ||
64 | if (xMax > 255) xMax = 255; | ||
65 | |||
66 | int yMin = (int)(y - radius) - 1; | ||
67 | int yMax = (int)(y + radius) + 1; | ||
68 | if (yMin < 0) yMin = 0; | ||
69 | if (yMax > 255) yMax = 255; | ||
70 | |||
71 | // Loop through each affected cell and determine the height at that point | ||
72 | for (int v = yMin; v <= yMax; ++v) | ||
73 | { | ||
74 | float fv = (float)v; | ||
75 | |||
76 | for (int h = xMin; h <= xMax; ++h) | ||
77 | { | ||
78 | float fh = (float)h; | ||
79 | |||
80 | // Determine how far from the center of this hill this point is | ||
81 | distSq = (x - fh) * (x - fh) + (y - fv) * (y - fv); | ||
82 | height = radiusSq - distSq; | ||
83 | |||
84 | // Don't add negative hill values | ||
85 | if (height > 0.0f) heightmap[h + v * 256] += height; | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | |||
90 | private void Normalize() | ||
91 | { | ||
92 | float min = heightmap[0]; | ||
93 | float max = heightmap[0]; | ||
94 | |||
95 | for (int x = 0; x < 256; x++) | ||
96 | { | ||
97 | for (int y = 0; y < 256; y++) | ||
98 | { | ||
99 | if (heightmap[x + y * 256] < min) min = heightmap[x + y * 256]; | ||
100 | if (heightmap[x + y * 256] > max) max = heightmap[x + y * 256]; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | // Avoid a rare divide by zero | ||
105 | if (min != max) | ||
106 | { | ||
107 | for (int x = 0; x < 256; x++) | ||
108 | { | ||
109 | for (int y = 0; y < 256; y++) | ||
110 | { | ||
111 | heightmap[x + y * 256] = ((heightmap[x + y * 256] - min) / (max - min)) * (HillMax - HillMin); | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | } | ||
116 | |||
117 | private float RandomRange(float min, float max) | ||
118 | { | ||
119 | return (float)Rand.NextDouble() * (max - min) + min; | ||
120 | } | ||
121 | } | ||
122 | } | ||
diff --git a/src/world/PhysicsEngine.cs b/src/world/PhysicsEngine.cs deleted file mode 100644 index b237f5e..0000000 --- a/src/world/PhysicsEngine.cs +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Threading; | ||
3 | using libsecondlife; | ||
4 | using libsecondlife.Packets; | ||
5 | using System.Collections.Generic; | ||
6 | using System.Text; | ||
7 | |||
8 | namespace OpenSim.world | ||
9 | { | ||
10 | public class PhysicsEngine | ||
11 | { | ||
12 | |||
13 | public PhysicsEngine() { | ||
14 | } | ||
15 | |||
16 | public void Startup() { | ||
17 | OpenSim_Main.localcons.WriteLine("PhysicsEngine.cs:Startup() - DOING NOTHING, DUMMY FUNCTION!"); | ||
18 | } | ||
19 | |||
20 | public void DoStuff(World simworld) { | ||
21 | foreach (libsecondlife.LLUUID UUID in simworld.Entities.Keys) | ||
22 | { | ||
23 | simworld.Entities[UUID].position += simworld.Entities[UUID].velocity; | ||
24 | simworld.Entities[UUID].position.Z = simworld.LandMap[(int)simworld.Entities[UUID].position.Y * 256 + (int)simworld.Entities[UUID].position.X]+1; | ||
25 | if(simworld.Entities[UUID].position.X<0) simworld.Entities[UUID].position.X=0; | ||
26 | if(simworld.Entities[UUID].position.Y<0) simworld.Entities[UUID].position.Y=0; | ||
27 | if(simworld.Entities[UUID].position.X>255) simworld.Entities[UUID].position.X=255; | ||
28 | if(simworld.Entities[UUID].position.Y>255) simworld.Entities[UUID].position.Y=255; | ||
29 | } | ||
30 | } | ||
31 | } | ||
32 | } | ||
diff --git a/src/world/Primitive.cs b/src/world/Primitive.cs deleted file mode 100644 index 143fa55..0000000 --- a/src/world/Primitive.cs +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.types; | ||
5 | |||
6 | namespace OpenSim.world | ||
7 | { | ||
8 | public class Primitive : Entity | ||
9 | { | ||
10 | protected float mesh_cutbegin; | ||
11 | protected float mesh_cutend; | ||
12 | |||
13 | public Primitive() | ||
14 | { | ||
15 | mesh_cutbegin = 0.0f; | ||
16 | mesh_cutend = 1.0f; | ||
17 | } | ||
18 | |||
19 | public override Mesh getMesh() | ||
20 | { | ||
21 | Mesh mesh = new Mesh(); | ||
22 | Triangle tri = new Triangle( | ||
23 | new Axiom.MathLib.Vector3(0.0f, 1.0f, 1.0f), | ||
24 | new Axiom.MathLib.Vector3(1.0f, 0.0f, 1.0f), | ||
25 | new Axiom.MathLib.Vector3(1.0f, 1.0f, 0.0f)); | ||
26 | |||
27 | mesh.AddTri(tri); | ||
28 | mesh += base.getMesh(); | ||
29 | |||
30 | return mesh; | ||
31 | } | ||
32 | } | ||
33 | } | ||
diff --git a/src/world/ScriptEngine.cs b/src/world/ScriptEngine.cs deleted file mode 100644 index f20a08e..0000000 --- a/src/world/ScriptEngine.cs +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.world | ||
6 | { | ||
7 | public class ScriptEngine | ||
8 | { | ||
9 | public ScriptEngine(World env) | ||
10 | { | ||
11 | } | ||
12 | |||
13 | public void LoadScript() | ||
14 | { | ||
15 | |||
16 | } | ||
17 | } | ||
18 | } | ||
diff --git a/src/world/SurfacePatch.cs b/src/world/SurfacePatch.cs deleted file mode 100644 index 71e4116..0000000 --- a/src/world/SurfacePatch.cs +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.world | ||
6 | { | ||
7 | public class SurfacePatch | ||
8 | { | ||
9 | public float[] HeightMap; | ||
10 | |||
11 | public SurfacePatch() { | ||
12 | HeightMap = new float[16*16]; | ||
13 | |||
14 | int xinc; | ||
15 | int yinc; | ||
16 | for(xinc=0; xinc<16; xinc++) for(yinc=0; yinc<16; yinc++) { | ||
17 | HeightMap[xinc+(yinc*16)]=100.0f; | ||
18 | } | ||
19 | |||
20 | } | ||
21 | } | ||
22 | } | ||
diff --git a/src/world/World.cs b/src/world/World.cs deleted file mode 100644 index 158ddc2..0000000 --- a/src/world/World.cs +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Threading; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Text; | ||
5 | using libsecondlife; | ||
6 | using libsecondlife.Packets; | ||
7 | |||
8 | namespace OpenSim.world | ||
9 | { | ||
10 | public class World | ||
11 | { | ||
12 | public Dictionary<libsecondlife.LLUUID, Entity> Entities; | ||
13 | public float[] LandMap; | ||
14 | public ScriptEngine Scripts; | ||
15 | public uint _localNumber = 0; | ||
16 | public PhysicsEngine physics; | ||
17 | |||
18 | private libsecondlife.TerrainManager TerrainManager; | ||
19 | private Random Rand = new Random(); | ||
20 | |||
21 | public World() | ||
22 | { | ||
23 | OpenSim_Main.localcons.WriteLine("World.cs - creating new entitities instance"); | ||
24 | Entities = new Dictionary<libsecondlife.LLUUID, Entity>(); | ||
25 | |||
26 | OpenSim_Main.localcons.WriteLine("World.cs - creating LandMap"); | ||
27 | TerrainManager = new TerrainManager(new SecondLife()); | ||
28 | } | ||
29 | |||
30 | public void InitLoop() | ||
31 | { | ||
32 | OpenSim_Main.localcons.WriteLine("World.cs:StartLoop() - Initialising physics"); | ||
33 | this.physics = new PhysicsEngine(); | ||
34 | physics.Startup(); | ||
35 | } | ||
36 | |||
37 | public void DoStuff() | ||
38 | { | ||
39 | lock (this) | ||
40 | { | ||
41 | physics.DoStuff(this); | ||
42 | this.Update(); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | public void Update() | ||
47 | { | ||
48 | foreach (libsecondlife.LLUUID UUID in Entities.Keys) | ||
49 | { | ||
50 | if (Entities[UUID].needupdate) | ||
51 | { | ||
52 | Entities[UUID].update(); | ||
53 | |||
54 | if (Entities[UUID] is Avatar) | ||
55 | { | ||
56 | Avatar avatar = (Avatar)Entities[UUID]; | ||
57 | if ((avatar.oldpos != avatar.position) || (avatar.oldvel != avatar.velocity) || avatar.walking) | ||
58 | { | ||
59 | ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = Entities[UUID].CreateTerseBlock(); | ||
60 | foreach (OpenSimClient client in OpenSim_Main.sim.ClientThreads.Values) | ||
61 | { | ||
62 | ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket(); | ||
63 | terse.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle; // FIXME | ||
64 | terse.RegionData.TimeDilation = 0; | ||
65 | terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; | ||
66 | terse.ObjectData[0] = terseBlock; | ||
67 | client.OutPacket(terse); | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
75 | public void SendLayerData(OpenSimClient RemoteClient) | ||
76 | { | ||
77 | int[] patches = new int[4]; | ||
78 | |||
79 | for (int y = 0; y < 16; y++) | ||
80 | { | ||
81 | for (int x = 0; x < 16; x = x + 4) | ||
82 | { | ||
83 | patches[0] = x + 0 + y * 16; | ||
84 | patches[1] = x + 1 + y * 16; | ||
85 | patches[2] = x + 2 + y * 16; | ||
86 | patches[3] = x + 3 + y * 16; | ||
87 | |||
88 | Packet layerpack = TerrainManager.CreateLandPacket(LandMap, patches); | ||
89 | RemoteClient.OutPacket(layerpack); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | |||
94 | public void AddViewerAgent(OpenSimClient AgentClient) | ||
95 | { | ||
96 | OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent"); | ||
97 | Avatar NewAvatar = new Avatar(AgentClient); | ||
98 | OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Adding new avatar to world"); | ||
99 | this.Entities.Add(AgentClient.AgentID, NewAvatar); | ||
100 | OpenSim_Main.localcons.WriteLine("World.cs:AddViewerAgent() - Starting RegionHandshake "); | ||
101 | NewAvatar.SendRegionHandshake(this); | ||
102 | this.Update(); // will work for now, but needs to be optimised so we don't update everything in the sim for each new user | ||
103 | } | ||
104 | |||
105 | public bool Backup() | ||
106 | { | ||
107 | /* TODO: Save the current world entities state. */ | ||
108 | |||
109 | return false; | ||
110 | } | ||
111 | } | ||
112 | } | ||
diff --git a/src/world/scripting/IScript.cs b/src/world/scripting/IScript.cs deleted file mode 100644 index 550594d..0000000 --- a/src/world/scripting/IScript.cs +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.world.scripting | ||
6 | { | ||
7 | public interface IScriptHost { | ||
8 | bool Register(IScript iscript); | ||
9 | } | ||
10 | public interface IScript | ||
11 | { | ||
12 | string Name{get;set;} | ||
13 | IScriptHost Host{get;set;} | ||
14 | void Show(); | ||
15 | } | ||
16 | } | ||