aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices.GridServer/SimProfiles.cs
diff options
context:
space:
mode:
authorgareth2007-03-25 00:27:36 +0000
committergareth2007-03-25 00:27:36 +0000
commit11d7cc89a9203a8155f3e71b92162e5d2c09bd99 (patch)
tree34ca2bbd44c5e5cb9d0b416ba5040c553fea1437 /OpenGridServices.GridServer/SimProfiles.cs
parentMoved gridserver into main trunk (but no prebuild yet) (diff)
downloadopensim-SC-11d7cc89a9203a8155f3e71b92162e5d2c09bd99.zip
opensim-SC-11d7cc89a9203a8155f3e71b92162e5d2c09bd99.tar.gz
opensim-SC-11d7cc89a9203a8155f3e71b92162e5d2c09bd99.tar.bz2
opensim-SC-11d7cc89a9203a8155f3e71b92162e5d2c09bd99.tar.xz
Finished adding the grid server to prebuild
Diffstat (limited to 'OpenGridServices.GridServer/SimProfiles.cs')
-rw-r--r--OpenGridServices.GridServer/SimProfiles.cs114
1 files changed, 114 insertions, 0 deletions
diff --git a/OpenGridServices.GridServer/SimProfiles.cs b/OpenGridServices.GridServer/SimProfiles.cs
new file mode 100644
index 0000000..6db8331
--- /dev/null
+++ b/OpenGridServices.GridServer/SimProfiles.cs
@@ -0,0 +1,114 @@
1/*
2Copyright (c) OpenGrid 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
30using System;
31using System.Text;
32using System.Collections;
33using System.Collections.Generic;
34using libsecondlife;
35using ServerConsole;
36using OpenSim.Framework.Utilities;
37using OpenSim.Framework.Sims;
38
39namespace OpenGridServices
40{
41 /// <summary>
42 /// </summary>
43 public class SimProfileManager {
44
45 public Dictionary<LLUUID, SimProfileBase> SimProfiles = new Dictionary<LLUUID, SimProfileBase>();
46
47 public SimProfileManager() {
48 }
49
50 public void InitSimProfiles() {
51 // TODO: need to load from database
52 }
53
54 public SimProfileBase GetProfileByHandle(ulong reqhandle) {
55 foreach (libsecondlife.LLUUID UUID in SimProfiles.Keys) {
56 if(SimProfiles[UUID].regionhandle==reqhandle) return SimProfiles[UUID];
57 }
58 return null;
59 }
60
61 public SimProfileBase GetProfileByLLUUID(LLUUID ProfileLLUUID) {
62 return SimProfiles[ProfileLLUUID];
63 }
64
65 public bool AuthenticateSim(LLUUID RegionUUID, uint regionhandle, string simrecvkey) {
66 SimProfileBase TheSim=GetProfileByHandle(regionhandle);
67 if(TheSim != null)
68 if(TheSim.recvkey==simrecvkey) {
69 return true;
70 } else {
71 return false;
72 } else return false;
73
74 }
75
76 public SimProfileBase CreateNewProfile(string regionname, string caps_url, string sim_ip, uint sim_port, uint RegionLocX, uint RegionLocY, string sendkey, string recvkey) {
77 SimProfileBase newprofile = new SimProfileBase();
78 newprofile.regionname=regionname;
79 newprofile.sim_ip=sim_ip;
80 newprofile.sim_port=sim_port;
81 newprofile.RegionLocX=RegionLocX;
82 newprofile.RegionLocY=RegionLocY;
83 newprofile.caps_url="http://" + sim_ip + ":9000/";
84 newprofile.sendkey=sendkey;
85 newprofile.recvkey=recvkey;
86 newprofile.regionhandle=Util.UIntsToLong((RegionLocX*256), (RegionLocY*256));
87 newprofile.UUID=LLUUID.Random();
88 this.SimProfiles.Add(newprofile.UUID,newprofile);
89 return newprofile;
90 }
91
92 }
93
94 /* is in OpenSim.Framework
95 public class SimProfileBase {
96 public LLUUID UUID;
97 public ulong regionhandle;
98 public string regionname;
99 public string sim_ip;
100 public uint sim_port;
101 public string caps_url;
102 public uint RegionLocX;
103 public uint RegionLocY;
104 public string sendkey;
105 public string recvkey;
106
107
108 public SimProfileBase() {
109 }
110
111
112 }*/
113
114}