diff options
Diffstat (limited to 'indra/newview/llviewernetwork.h')
-rw-r--r-- | indra/newview/llviewernetwork.h | 201 |
1 files changed, 83 insertions, 118 deletions
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h index 70b06b1dc2..edae6dc47b 100644 --- a/indra/newview/llviewernetwork.h +++ b/indra/newview/llviewernetwork.h @@ -3,148 +3,113 @@ * @author James Cook * @brief Networking constants and globals for viewer. * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * $LicenseInfo:firstyear=2006&license=viewergpl$ + * + * Copyright (c) 2006-2009, Linden Research, Inc. * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ #ifndef LL_LLVIEWERNETWORK_H #define LL_LLVIEWERNETWORK_H - -extern const char* DEFAULT_LOGIN_PAGE; - -#define GRID_VALUE "name" -#define GRID_LABEL_VALUE "label" -#define GRID_ID_VALUE "grid_login_id" -#define GRID_LOGIN_URI_VALUE "login_uri" -#define GRID_HELPER_URI_VALUE "helper_uri" -#define GRID_LOGIN_PAGE_VALUE "login_page" -#define GRID_IS_SYSTEM_GRID_VALUE "system_grid" -#define GRID_IS_FAVORITE_VALUE "favorite" -#define MAINGRID "util.agni.lindenlab.com" -#define GRID_LOGIN_IDENTIFIER_TYPES "login_identifier_types" -// defines slurl formats associated with various grids. -// we need to continue to support existing forms, as slurls -// are shared between viewers that may not understand newer -// forms. -#define GRID_SLURL_BASE "slurl_base" -#define GRID_APP_SLURL_BASE "app_slurl_base" -class LLInvalidGridName +#include <boost/scoped_ptr.hpp> + +class LLHost; +class LLLogin; + +enum EGridInfo { -public: - LLInvalidGridName(std::string grid) : mGrid(grid) - { - } -protected: - std::string mGrid; + GRID_INFO_NONE, + GRID_INFO_ADITI, + GRID_INFO_AGNI, + GRID_INFO_ARUNA, + GRID_INFO_BHARATI, + GRID_INFO_CHANDRA, + GRID_INFO_DAMBALLAH, + GRID_INFO_DANU, + GRID_INFO_DURGA, + GRID_INFO_GANGA, + GRID_INFO_MITRA, + GRID_INFO_MOHINI, + GRID_INFO_NANDI, + GRID_INFO_PARVATI, + GRID_INFO_RADHA, + GRID_INFO_RAVI, + GRID_INFO_SIVA, + GRID_INFO_SHAKTI, + GRID_INFO_SKANDA, + GRID_INFO_SOMA, + GRID_INFO_UMA, + GRID_INFO_VAAK, + GRID_INFO_YAMI, + GRID_INFO_LOCAL, + GRID_INFO_OTHER, // IP address set via command line option + GRID_INFO_COUNT }; - /** - * @brief A class to manage the grids available to the viewer - * including persistance. This class also maintains the currently - * selected grid. + * @brief A class to manage the viewer's login state. * **/ -class LLGridManager : public LLSingleton<LLGridManager> +class LLViewerLogin : public LLSingleton<LLViewerLogin> { public: - - // when the grid manager is instantiated, the default grids are automatically - // loaded, and the grids favorites list is loaded from the xml file. - LLGridManager(const std::string& grid_file); - LLGridManager(); - ~LLGridManager(); - - void initialize(const std::string& grid_file); - // grid list management - - // add a grid to the list of grids - void addGrid(LLSD& grid_info); + LLViewerLogin(); + ~LLViewerLogin(); - // retrieve a map of grid-name <-> label - // by default only return the user visible grids - std::map<std::string, std::string> getKnownGrids(bool favorites_only=FALSE); - - void getGridInfo(const std::string& grid, LLSD &grid_info); - - // current grid management + void setGridChoice(EGridInfo grid); + void setGridChoice(const std::string& grid_name); + void resetURIs(); - // select a given grid as the current grid. If the grid - // is not a known grid, then it's assumed to be a dns name for the - // grid, and the various URIs will be automatically generated. - void setGridChoice(const std::string& grid); - - - std::string getGridLabel() { return mGridList[mGrid][GRID_LABEL_VALUE]; } - std::string getGrid() const { return mGrid; } - void getLoginURIs(std::vector<std::string>& uris); - std::string getHelperURI(); - std::string getLoginPage(); - std::string getGridLoginID() { return mGridList[mGrid][GRID_ID_VALUE]; } - std::string getLoginPage(const std::string& grid) { return mGridList[grid][GRID_LOGIN_PAGE_VALUE]; } - void getLoginIdentifierTypes(LLSD& idTypes) { idTypes = mGridList[mGrid][GRID_LOGIN_IDENTIFIER_TYPES]; } - - // build a slurl for the given region within the selected grid - std::string getSLURLBase(const std::string& grid); - std::string getSLURLBase() { return getSLURLBase(mGrid); } - - std::string getAppSLURLBase(const std::string& grid); - std::string getAppSLURLBase() { return getAppSLURLBase(mGrid); } - - void getGridInfo(LLSD &grid_info) { getGridInfo(mGrid, grid_info); } - - std::string getGridByLabel( const std::string &grid_label, bool case_sensitive = false); - - bool isSystemGrid(const std::string& grid) - { - return mGridList.has(grid) && - mGridList[grid].has(GRID_IS_SYSTEM_GRID_VALUE) && - mGridList[grid][GRID_IS_SYSTEM_GRID_VALUE].asBoolean(); - } - bool isSystemGrid() { return isSystemGrid(mGrid); } - // Mark this grid as a favorite that should be persisited on 'save' - // this is currently used to persist a grid after a successful login - void setFavorite() { mGridList[mGrid][GRID_IS_FAVORITE_VALUE] = TRUE; } - - bool isInProductionGrid(); - void saveFavorites(); - void clearFavorites(); + /** + * @brief Get the enumeration of the grid choice. + * Should only return values > 0 && < GRID_INFO_COUNT + **/ + EGridInfo getGridChoice() const; + + /** + * @brief Get a readable label for the grid choice. + * Returns the readable name for the grid choice. + * If the grid is 'other', returns something + * the string used to specifiy the grid. + **/ + std::string getGridLabel() const; -protected: + std::string getKnownGridLabel(EGridInfo grid_index) const; + + void getLoginURIs(std::vector<std::string>& uris) const; + std::string getHelperURI() const; + + bool isInProductionGrid(); - // helper function for adding the predefined grids - void addSystemGrid(const std::string& label, - const std::string& name, - const std::string& login, - const std::string& helper, - const std::string& login_page, - const std::string& login_id = ""); - - - std::string mGrid; - std::string mGridFile; - LLSD mGridList; +private: + EGridInfo mGridChoice; + std::string mGridName; }; const S32 MAC_ADDRESS_BYTES = 6; +extern unsigned char gMACAddress[MAC_ADDRESS_BYTES]; /* Flawfinder: ignore */ #endif |