PageRenderTime 12ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llmessage/machine.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 95 lines | 42 code | 18 blank | 35 comment | 1 complexity | 70c1661294fcaccef722abc2f4ddf0fe MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file machine.h
  3. * @brief LLMachine class header file
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_MACHINE_H
  27. #define LL_MACHINE_H
  28. #include "net.h"
  29. #include "llhost.h"
  30. typedef enum e_machine_type
  31. {
  32. MT_NULL,
  33. MT_SIMULATOR,
  34. MT_VIEWER,
  35. MT_SPACE_SERVER,
  36. MT_OBJECT_REPOSITORY,
  37. MT_PROXY,
  38. MT_EOF
  39. } EMachineType;
  40. const U32 ADDRESS_STRING_SIZE = 12;
  41. class LLMachine
  42. {
  43. public:
  44. LLMachine()
  45. : mMachineType(MT_NULL), mControlPort(0) {}
  46. LLMachine(EMachineType machine_type, U32 ip, S32 port)
  47. : mMachineType(machine_type), mControlPort(0), mHost(ip,port) {}
  48. LLMachine(EMachineType machine_type, const LLHost &host)
  49. : mMachineType(machine_type) {mHost = host; mControlPort = 0;}
  50. ~LLMachine() {}
  51. // get functions
  52. EMachineType getMachineType() const { return mMachineType; }
  53. U32 getMachineIP() const { return mHost.getAddress(); }
  54. S32 getMachinePort() const { return mHost.getPort(); }
  55. const LLHost &getMachineHost() const { return mHost; }
  56. // The control port is the listen port of the parent process that
  57. // launched this machine. 0 means none or not known.
  58. const S32 &getControlPort() const { return mControlPort; }
  59. BOOL isValid() const { return (mHost.getPort() != 0); } // TRUE if corresponds to functioning machine
  60. // set functions
  61. void setMachineType(EMachineType machine_type) { mMachineType = machine_type; }
  62. void setMachineIP(U32 ip) { mHost.setAddress(ip); }
  63. void setMachineHost(const LLHost &host) { mHost = host; }
  64. void setMachinePort(S32 port);
  65. void setControlPort( S32 port );
  66. // member variables
  67. // Someday these should be made private.
  68. // When they are, some of the code that breaks should
  69. // become member functions of LLMachine -- Leviathan
  70. //private:
  71. // I fixed the others, somebody should fix these! - djs
  72. EMachineType mMachineType;
  73. protected:
  74. S32 mControlPort;
  75. LLHost mHost;
  76. };
  77. #endif