PageRenderTime 34ms CodeModel.GetById 16ms app.highlight 12ms RepoModel.GetById 2ms 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
 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
27#ifndef LL_MACHINE_H
28#define LL_MACHINE_H
29
30#include "net.h"
31#include "llhost.h"
32
33typedef enum e_machine_type
34{
35	MT_NULL,
36	MT_SIMULATOR,
37	MT_VIEWER,
38	MT_SPACE_SERVER,
39	MT_OBJECT_REPOSITORY,
40	MT_PROXY,
41	MT_EOF
42} EMachineType;
43
44const U32 ADDRESS_STRING_SIZE = 12;
45
46class LLMachine
47{
48public:
49	LLMachine() 
50		: mMachineType(MT_NULL), mControlPort(0) {}	
51
52	LLMachine(EMachineType machine_type, U32 ip, S32 port) 
53		: mMachineType(machine_type), mControlPort(0), mHost(ip,port) {}
54
55	LLMachine(EMachineType machine_type, const LLHost &host) 
56		: mMachineType(machine_type) {mHost = host; mControlPort = 0;}
57
58	~LLMachine()	{}
59
60	// get functions
61	EMachineType	getMachineType()	const { return mMachineType; }
62	U32				getMachineIP()		const { return mHost.getAddress(); }
63	S32				getMachinePort()	const { return mHost.getPort(); }
64	const LLHost	&getMachineHost()	const { return mHost; }
65	// The control port is the listen port of the parent process that
66	// launched this machine. 0 means none or not known.
67	const S32		&getControlPort() 	const { return mControlPort; }
68	BOOL			isValid()			const { return (mHost.getPort() != 0); }	// TRUE if corresponds to functioning machine
69
70	// set functions
71	void			setMachineType(EMachineType machine_type)	{ mMachineType = machine_type; }
72	void			setMachineIP(U32 ip)						{ mHost.setAddress(ip); }
73	void			setMachineHost(const LLHost &host)	 	    { mHost = host; }
74
75	void 			setMachinePort(S32 port);
76	void			setControlPort( S32 port );
77
78
79	// member variables
80
81// Someday these should be made private.
82// When they are, some of the code that breaks should 
83// become member functions of LLMachine -- Leviathan
84//private:
85
86	// I fixed the others, somebody should fix these! - djs
87	EMachineType	mMachineType;
88
89protected:
90
91	S32				mControlPort;
92	LLHost          mHost;
93};
94
95#endif