Beispiel #1
0
        public override void CustomiseResponse(ref System.Collections.Hashtable response, UserProfile theUser)
        {
            Int32 circode = (Int32)response["circuit_code"];

            theUser.AddSimCircuit((uint)circode, LLUUID.Random());
            response["home"]     = "{'region_handle':[r" + (997 * 256).ToString() + ",r" + (996 * 256).ToString() + "], 'position':[r" + theUser.homepos.X.ToString() + ",r" + theUser.homepos.Y.ToString() + ",r" + theUser.homepos.Z.ToString() + "], 'look_at':[r" + theUser.homelookat.X.ToString() + ",r" + theUser.homelookat.Y.ToString() + ",r" + theUser.homelookat.Z.ToString() + "]}";
            response["sim_port"] = m_port;
            response["sim_ip"]   = m_ipAddr;
            response["region_y"] = (Int32)regionY * 256;
            response["region_x"] = (Int32)regionX * 256;

            string first;
            string last;

            if (response.Contains("first_name"))
            {
                first = (string)response["first_name"];
            }
            else
            {
                first = "test";
            }

            if (response.Contains("last_name"))
            {
                last = (string)response["last_name"];
            }
            else
            {
                last = "User";
            }

            ArrayList InventoryList = (ArrayList)response["inventory-skeleton"];
            Hashtable Inventory1    = (Hashtable)InventoryList[0];

            Login _login = new Login();

            //copy data to login object
            _login.First           = first;
            _login.Last            = last;
            _login.Agent           = new LLUUID((string)response["agent_id"]);
            _login.Session         = new LLUUID((string)response["session_id"]);
            _login.SecureSession   = new LLUUID((string)response["secure_session_id"]);
            _login.BaseFolder      = null;
            _login.InventoryFolder = new LLUUID((string)Inventory1["folder_id"]);

            //working on local computer if so lets add to the gridserver's list of sessions?
            if (m_gridServer.GetName() == "Local")
            {
                Console.WriteLine("adding login data to gridserver");
                ((LocalGridBase)this.m_gridServer).AddNewSession(_login);
            }
        }
        public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary <uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat)
        {
            m_world          = world;
            m_clientThreads  = clientThreads;
            m_assetCache     = assetCache;
            m_gridServer     = gridServer;
            m_application    = application;
            m_inventoryCache = inventoryCache;
            m_sandboxMode    = sandboxMode;
            m_child          = child;
            m_regionData     = regionDat;

            OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
            cirpack = initialcirpack;
            userEP  = remoteEP;
            if (m_gridServer.GetName() == "Remote")
            {
                this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[initialcirpack.CircuitCode.Code].startpos;
            }
            else
            {
                this.startpos = new LLVector3(128, 128, m_world.Terrain[(int)128, (int)128] + 15.0f); // new LLVector3(128.0f, 128.0f, 60f);
            }
            PacketQueue = new BlockingQueue <QueItem>();

            this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache);
            AckTimer          = new System.Timers.Timer(500);
            AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
            AckTimer.Start();

            this.RegisterLocalPacketHandlers();

            ClientThread = new Thread(new ThreadStart(AuthUser));
            ClientThread.IsBackground = true;
            ClientThread.Start();
        }
        public SimClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, World world, Dictionary<uint, SimClient> clientThreads, AssetCache assetCache, IGridServer gridServer, OpenSimNetworkHandler application, InventoryCache inventoryCache, bool sandboxMode, bool child, RegionInfo regionDat)
        {
            m_world = world;
            m_clientThreads = clientThreads;
            m_assetCache = assetCache;
            m_gridServer = gridServer;
            m_application = application;
            m_inventoryCache = inventoryCache;
            m_sandboxMode = sandboxMode;
            m_child = child;
            m_regionData = regionDat;

            OpenSim.Framework.Console.MainConsole.Instance.WriteLine("OpenSimClient.cs - Started up new client thread to handle incoming request");
            cirpack = initialcirpack;
            userEP = remoteEP;
            if (m_gridServer.GetName() == "Remote")
            {
                this.startpos = ((RemoteGridBase)m_gridServer).agentcircuits[initialcirpack.CircuitCode.Code].startpos;
            }
            else
            {
                this.startpos = new LLVector3(128, 128, m_world.Terrain[(int)128, (int)128] + 15.0f); // new LLVector3(128.0f, 128.0f, 60f);
            }
            PacketQueue = new BlockingQueue<QueItem>();

            this.UploadAssets = new AgentAssetUpload(this, m_assetCache, m_inventoryCache);
            AckTimer = new System.Timers.Timer(500);
            AckTimer.Elapsed += new ElapsedEventHandler(AckTimer_Elapsed);
            AckTimer.Start();

            this.RegisterLocalPacketHandlers();

            ClientThread = new Thread(new ThreadStart(AuthUser));
            ClientThread.IsBackground = true;
            ClientThread.Start();
        }
Beispiel #4
0
        public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
        {
            Console.WriteLine("login attempt");
            Hashtable requestData = (Hashtable)request.Params[0];
            string    first;
            string    last;
            string    passwd;
            LLUUID    Agent;
            LLUUID    Session;

            LoginResponse loginResponse = new LoginResponse(regionX, regionY);

            //get login name
            if (requestData.Contains("first"))
            {
                first = (string)requestData["first"];
            }
            else
            {
                first = "test";
            }

            if (requestData.Contains("last"))
            {
                last = (string)requestData["last"];
            }
            else
            {
                last = "User" + NumClients.ToString();
            }

            if (requestData.Contains("passwd"))
            {
                passwd = (string)requestData["passwd"];
            }
            else
            {
                passwd = "notfound";
            }

            if (!Authenticate(first, last, passwd))
            {
                return(loginResponse.LoginFailedResponse());
            }

            NumClients++;

            // Create a agent and session LLUUID
            Agent = GetAgentId(first, last);
            int SessionRand = Util.RandomClass.Next(1, 999);

            Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
            LLUUID secureSess = LLUUID.Random();

            loginResponse.SimPort         = m_simPort.ToString();
            loginResponse.SimAddress      = m_simAddr.ToString();
            loginResponse.AgentID         = Agent.ToStringHyphenated();
            loginResponse.SessionID       = Session.ToStringHyphenated();
            loginResponse.SecureSessionID = secureSess.ToStringHyphenated();
            loginResponse.CircuitCode     = (Int32)(Util.RandomClass.Next());
            XmlRpcResponse response     = loginResponse.ToXmlRpcResponse();
            Hashtable      responseData = (Hashtable)response.Value;

            // inventory
            ArrayList InventoryList     = (ArrayList)responseData["inventory-skeleton"];
            Hashtable Inventory1        = (Hashtable)InventoryList[0];
            Hashtable Inventory2        = (Hashtable)InventoryList[1];
            LLUUID    BaseFolderID      = LLUUID.Random();
            LLUUID    InventoryFolderID = LLUUID.Random();

            Inventory2["name"]         = "Textures";
            Inventory2["folder_id"]    = BaseFolderID.ToStringHyphenated();
            Inventory2["type_default"] = 0;
            Inventory1["folder_id"]    = InventoryFolderID.ToStringHyphenated();

            ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
            Hashtable Inventoryroot = (Hashtable)InventoryRoot[0];

            Inventoryroot["folder_id"] = InventoryFolderID.ToStringHyphenated();

            CustomiseLoginResponse(responseData, first, last);

            Login _login = new Login();

            //copy data to login object
            _login.First           = first;
            _login.Last            = last;
            _login.Agent           = Agent;
            _login.Session         = Session;
            _login.SecureSession   = secureSess;
            _login.BaseFolder      = BaseFolderID;
            _login.InventoryFolder = InventoryFolderID;

            //working on local computer if so lets add to the gridserver's list of sessions?
            if (m_gridServer.GetName() == "Local")
            {
                ((LocalGridBase)m_gridServer).AddNewSession(_login);
            }

            return(response);
        }