corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | /* |
2 | * Copyright (c) 2006-2014, openmetaverse.org |
||
3 | * All rights reserved. |
||
4 | * |
||
5 | * - Redistribution and use in source and binary forms, with or without |
||
6 | * modification, are permitted provided that the following conditions are met: |
||
7 | * |
||
8 | * - Redistributions of source code must retain the above copyright notice, this |
||
9 | * list of conditions and the following disclaimer. |
||
10 | * - Neither the name of the openmetaverse.org nor the names |
||
11 | * of its contributors may be used to endorse or promote products derived from |
||
12 | * this software without specific prior written permission. |
||
13 | * |
||
14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
||
18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
24 | * POSSIBILITY OF SUCH DAMAGE. |
||
25 | */ |
||
26 | |||
27 | using System; |
||
28 | using System.Collections.Generic; |
||
29 | using OpenMetaverse.Packets; |
||
30 | |||
31 | namespace OpenMetaverse |
||
32 | { |
||
33 | /// <summary> |
||
34 | /// Class for controlling various system settings. |
||
35 | /// </summary> |
||
36 | /// <remarks>Some values are readonly because they affect things that |
||
37 | /// happen when the GridClient object is initialized, so changing them at |
||
38 | /// runtime won't do any good. Non-readonly values may affect things that |
||
39 | /// happen at login or dynamically</remarks> |
||
40 | public class Settings |
||
41 | { |
||
42 | #region Login/Networking Settings |
||
43 | |||
44 | /// <summary>Main grid login server</summary> |
||
45 | public const string AGNI_LOGIN_SERVER = "https://login.agni.lindenlab.com/cgi-bin/login.cgi"; |
||
46 | |||
47 | /// <summary>Beta grid login server</summary> |
||
48 | public const string ADITI_LOGIN_SERVER = "https://login.aditi.lindenlab.com/cgi-bin/login.cgi"; |
||
49 | |||
50 | /// <summary>The relative directory where external resources are kept</summary> |
||
51 | public static string RESOURCE_DIR = "openmetaverse_data"; |
||
52 | |||
53 | /// <summary>Login server to connect to</summary> |
||
54 | public string LOGIN_SERVER = AGNI_LOGIN_SERVER; |
||
55 | |||
56 | /// <summary>IP Address the client will bind to</summary> |
||
57 | public static System.Net.IPAddress BIND_ADDR = System.Net.IPAddress.Any; |
||
58 | |||
59 | /// <summary>Use XML-RPC Login or LLSD Login, default is XML-RPC Login</summary> |
||
60 | public bool USE_LLSD_LOGIN = false; |
||
61 | |||
62 | /// <summary> |
||
63 | /// Maximum number of HTTP connections to open to a particular endpoint. |
||
64 | /// </summary> |
||
65 | /// <remarks> |
||
66 | /// An endpoint is defined as a commbination of network address and port. This is used for Caps. |
||
67 | /// This is a static variable which applies to all instances. |
||
68 | /// </remarks> |
||
69 | public static int MAX_HTTP_CONNECTIONS = 32; |
||
70 | |||
71 | #endregion |
||
72 | |||
73 | #region Inventory |
||
74 | |||
75 | /// <summary> |
||
76 | /// InventoryManager requests inventory information on login, |
||
77 | /// GridClient initializes an Inventory store for main inventory. |
||
78 | /// </summary> |
||
79 | public const bool ENABLE_INVENTORY_STORE = true; |
||
80 | /// <summary> |
||
81 | /// InventoryManager requests library information on login, |
||
82 | /// GridClient initializes an Inventory store for the library. |
||
83 | /// </summary> |
||
84 | public const bool ENABLE_LIBRARY_STORE = true; |
||
85 | /// <summary> |
||
86 | /// Use Caps for fetching inventory where available |
||
87 | /// </summary> |
||
88 | public bool HTTP_INVENTORY = true; |
||
89 | |||
90 | #endregion |
||
91 | |||
92 | #region Timeouts and Intervals |
||
93 | |||
94 | /// <summary>Number of milliseconds before an asset transfer will time |
||
95 | /// out</summary> |
||
96 | public int TRANSFER_TIMEOUT = 90 * 1000; |
||
97 | |||
98 | /// <summary>Number of milliseconds before a teleport attempt will time |
||
99 | /// out</summary> |
||
100 | public int TELEPORT_TIMEOUT = 40 * 1000; |
||
101 | |||
102 | /// <summary>Number of milliseconds before NetworkManager.Logout() will |
||
103 | /// time out</summary> |
||
104 | public int LOGOUT_TIMEOUT = 5 * 1000; |
||
105 | |||
106 | /// <summary>Number of milliseconds before a CAPS call will time out</summary> |
||
107 | /// <remarks>Setting this too low will cause web requests time out and |
||
108 | /// possibly retry repeatedly</remarks> |
||
109 | public int CAPS_TIMEOUT = 60 * 1000; |
||
110 | |||
111 | /// <summary>Number of milliseconds for xml-rpc to timeout</summary> |
||
112 | public int LOGIN_TIMEOUT = 60 * 1000; |
||
113 | |||
114 | /// <summary>Milliseconds before a packet is assumed lost and resent</summary> |
||
115 | public int RESEND_TIMEOUT = 4000; |
||
116 | |||
117 | /// <summary>Milliseconds without receiving a packet before the |
||
118 | /// connection to a simulator is assumed lost</summary> |
||
119 | public int SIMULATOR_TIMEOUT = 30 * 1000; |
||
120 | |||
121 | /// <summary>Milliseconds to wait for a simulator info request through |
||
122 | /// the grid interface</summary> |
||
123 | public int MAP_REQUEST_TIMEOUT = 5 * 1000; |
||
124 | |||
125 | /// <summary>Number of milliseconds between sending pings to each sim</summary> |
||
126 | public const int PING_INTERVAL = 2200; |
||
127 | |||
128 | /// <summary>Number of milliseconds between sending camera updates</summary> |
||
129 | public const int DEFAULT_AGENT_UPDATE_INTERVAL = 500; |
||
130 | |||
131 | /// <summary>Number of milliseconds between updating the current |
||
132 | /// positions of moving, non-accelerating and non-colliding objects</summary> |
||
133 | public const int INTERPOLATION_INTERVAL = 250; |
||
134 | |||
135 | /// <summary>Millisecond interval between ticks, where all ACKs are |
||
136 | /// sent out and the age of unACKed packets is checked</summary> |
||
137 | public const int NETWORK_TICK_INTERVAL = 500; |
||
138 | |||
139 | #endregion |
||
140 | #region Sizes |
||
141 | |||
142 | /// <summary>The initial size of the packet inbox, where packets are |
||
143 | /// stored before processing</summary> |
||
144 | public const int PACKET_INBOX_SIZE = 100; |
||
145 | /// <summary>Maximum size of packet that we want to send over the wire</summary> |
||
146 | public const int MAX_PACKET_SIZE = 1200; |
||
147 | /// <summary>The maximum value of a packet sequence number before it |
||
148 | /// rolls over back to one</summary> |
||
149 | public const int MAX_SEQUENCE = 0xFFFFFF; |
||
150 | /// <summary>The maximum size of the sequence number archive, used to |
||
151 | /// check for resent and/or duplicate packets</summary> |
||
152 | public static int PACKET_ARCHIVE_SIZE = 1000; |
||
153 | /// <summary>Maximum number of queued ACKs to be sent before SendAcks() |
||
154 | /// is forced</summary> |
||
155 | public int MAX_PENDING_ACKS = 10; |
||
156 | /// <summary>Network stats queue length (seconds)</summary> |
||
157 | public int STATS_QUEUE_SIZE = 5; |
||
158 | |||
159 | #endregion |
||
160 | |||
161 | #region Experimental options |
||
162 | |||
163 | /// <summary> |
||
164 | /// Primitives will be reused when falling in/out of interest list (and shared between clients) |
||
165 | /// prims returning to interest list do not need re-requested |
||
166 | /// Helps also in not re-requesting prim.Properties for code that checks for a Properties == null per client |
||
167 | /// </summary> |
||
168 | public bool CACHE_PRIMITIVES = false; |
||
169 | /// <summary> |
||
170 | /// Pool parcel data between clients (saves on requesting multiple times when all clients may need it) |
||
171 | /// </summary> |
||
172 | public bool POOL_PARCEL_DATA = false; |
||
173 | /// <summary> |
||
174 | /// How long to preserve cached data when no client is connected to a simulator |
||
175 | /// The reason for setting it to something like 2 minutes is in case a client |
||
176 | /// is running back and forth between region edges or a sim is comming and going |
||
177 | /// </summary> |
||
178 | public static int SIMULATOR_POOL_TIMEOUT = 2 * 60 * 1000; |
||
179 | |||
180 | #endregion |
||
181 | |||
182 | #region Configuration options (mostly booleans) |
||
183 | |||
184 | /// <summary>Enable/disable storing terrain heightmaps in the |
||
185 | /// TerrainManager</summary> |
||
186 | public bool STORE_LAND_PATCHES = false; |
||
187 | |||
188 | /// <summary>Enable/disable sending periodic camera updates</summary> |
||
189 | public bool SEND_AGENT_UPDATES = true; |
||
190 | |||
191 | /// <summary>Enable/disable automatically setting agent appearance at |
||
192 | /// login and after sim crossing</summary> |
||
193 | public bool SEND_AGENT_APPEARANCE = true; |
||
194 | |||
195 | /// <summary>Enable/disable automatically setting the bandwidth throttle |
||
196 | /// after connecting to each simulator</summary> |
||
197 | /// <remarks>The default throttle uses the equivalent of the maximum |
||
198 | /// bandwidth setting in the official client. If you do not set a |
||
199 | /// throttle your connection will by default be throttled well below |
||
200 | /// the minimum values and you may experience connection problems</remarks> |
||
201 | public bool SEND_AGENT_THROTTLE = true; |
||
202 | |||
203 | /// <summary>Enable/disable the sending of pings to monitor lag and |
||
204 | /// packet loss</summary> |
||
205 | public bool SEND_PINGS = true; |
||
206 | |||
207 | /// <summary>Should we connect to multiple sims? This will allow |
||
208 | /// viewing in to neighboring simulators and sim crossings |
||
209 | /// (Experimental)</summary> |
||
210 | public bool MULTIPLE_SIMS = true; |
||
211 | |||
212 | /// <summary>If true, all object update packets will be decoded in to |
||
213 | /// native objects. If false, only updates for our own agent will be |
||
214 | /// decoded. Registering an event handler will force objects for that |
||
215 | /// type to always be decoded. If this is disabled the object tracking |
||
216 | /// will have missing or partial prim and avatar information</summary> |
||
217 | public bool ALWAYS_DECODE_OBJECTS = true; |
||
218 | |||
219 | /// <summary>If true, when a cached object check is received from the |
||
220 | /// server the full object info will automatically be requested</summary> |
||
221 | public bool ALWAYS_REQUEST_OBJECTS = true; |
||
222 | |||
223 | /// <summary>Whether to establish connections to HTTP capabilities |
||
224 | /// servers for simulators</summary> |
||
225 | public bool ENABLE_CAPS = true; |
||
226 | |||
227 | /// <summary>Whether to decode sim stats</summary> |
||
228 | public bool ENABLE_SIMSTATS = true; |
||
229 | |||
230 | /// <summary>The capabilities servers are currently designed to |
||
231 | /// periodically return a 502 error which signals for the client to |
||
232 | /// re-establish a connection. Set this to true to log those 502 errors</summary> |
||
233 | public bool LOG_ALL_CAPS_ERRORS = false; |
||
234 | |||
235 | /// <summary>If true, any reference received for a folder or item |
||
236 | /// the library is not aware of will automatically be fetched</summary> |
||
237 | public bool FETCH_MISSING_INVENTORY = true; |
||
238 | |||
239 | /// <summary>If true, and <code>SEND_AGENT_UPDATES</code> is true, |
||
240 | /// AgentUpdate packets will continuously be sent out to give the bot |
||
241 | /// smoother movement and autopiloting</summary> |
||
242 | public bool DISABLE_AGENT_UPDATE_DUPLICATE_CHECK = true; |
||
243 | |||
244 | /// <summary>If true, currently visible avatars will be stored |
||
245 | /// in dictionaries inside <code>Simulator.ObjectAvatars</code>. |
||
246 | /// If false, a new Avatar or Primitive object will be created |
||
247 | /// each time an object update packet is received</summary> |
||
248 | public bool AVATAR_TRACKING = true; |
||
249 | |||
250 | /// <summary>If true, currently visible avatars will be stored |
||
251 | /// in dictionaries inside <code>Simulator.ObjectPrimitives</code>. |
||
252 | /// If false, a new Avatar or Primitive object will be created |
||
253 | /// each time an object update packet is received</summary> |
||
254 | public bool OBJECT_TRACKING = true; |
||
255 | |||
256 | /// <summary>If true, position and velocity will periodically be |
||
257 | /// interpolated (extrapolated, technically) for objects and |
||
258 | /// avatars that are being tracked by the library. This is |
||
259 | /// necessary to increase the accuracy of speed and position |
||
260 | /// estimates for simulated objects</summary> |
||
261 | public bool USE_INTERPOLATION_TIMER = true; |
||
262 | |||
263 | /// <summary> |
||
264 | /// If true, utilization statistics will be tracked. There is a minor penalty |
||
265 | /// in CPU time for enabling this option. |
||
266 | /// </summary> |
||
267 | public bool TRACK_UTILIZATION = false; |
||
268 | #endregion |
||
269 | #region Parcel Tracking |
||
270 | |||
271 | /// <summary>If true, parcel details will be stored in the |
||
272 | /// <code>Simulator.Parcels</code> dictionary as they are received</summary> |
||
273 | public bool PARCEL_TRACKING = true; |
||
274 | |||
275 | /// <summary> |
||
276 | /// If true, an incoming parcel properties reply will automatically send |
||
277 | /// a request for the parcel access list |
||
278 | /// </summary> |
||
279 | public bool ALWAYS_REQUEST_PARCEL_ACL = true; |
||
280 | |||
281 | /// <summary> |
||
282 | /// if true, an incoming parcel properties reply will automatically send |
||
283 | /// a request for the traffic count. |
||
284 | /// </summary> |
||
285 | public bool ALWAYS_REQUEST_PARCEL_DWELL = true; |
||
286 | |||
287 | #endregion |
||
288 | #region Asset Cache |
||
289 | |||
290 | /// <summary> |
||
291 | /// If true, images, and other assets downloaded from the server |
||
292 | /// will be cached in a local directory |
||
293 | /// </summary> |
||
294 | public bool USE_ASSET_CACHE = true; |
||
295 | |||
296 | /// <summary>Path to store cached texture data</summary> |
||
297 | public string ASSET_CACHE_DIR = RESOURCE_DIR + "/cache"; |
||
298 | |||
299 | /// <summary>Maximum size cached files are allowed to take on disk (bytes)</summary> |
||
300 | public long ASSET_CACHE_MAX_SIZE = 1024 * 1024 * 1024; // 1GB |
||
301 | |||
302 | #endregion |
||
303 | #region Misc |
||
304 | |||
305 | /// <summary>Default color used for viewer particle effects</summary> |
||
306 | public Color4 DEFAULT_EFFECT_COLOR = new Color4(255, 0, 0, 255); |
||
307 | |||
308 | /// <summary>Cost of uploading an asset</summary> |
||
309 | /// <remarks>Read-only since this value is dynamically fetched at login</remarks> |
||
310 | public int UPLOAD_COST { get { return priceUpload; } } |
||
311 | |||
312 | /// <summary>Maximum number of times to resend a failed packet</summary> |
||
313 | public int MAX_RESEND_COUNT = 3; |
||
314 | |||
315 | /// <summary>Throttle outgoing packet rate</summary> |
||
316 | public bool THROTTLE_OUTGOING_PACKETS = true; |
||
317 | |||
318 | /// <summary>UUID of a texture used by some viewers to indentify type of client used</summary> |
||
319 | public UUID CLIENT_IDENTIFICATION_TAG = UUID.Zero; |
||
320 | |||
321 | #endregion |
||
322 | #region Texture Pipeline |
||
323 | |||
324 | /// <summary> |
||
325 | /// Download textures using GetTexture capability when available |
||
326 | /// </summary> |
||
327 | public bool USE_HTTP_TEXTURES = true; |
||
328 | |||
329 | /// <summary>The maximum number of concurrent texture downloads allowed</summary> |
||
330 | /// <remarks>Increasing this number will not necessarily increase texture retrieval times due to |
||
331 | /// simulator throttles</remarks> |
||
332 | public int MAX_CONCURRENT_TEXTURE_DOWNLOADS = 4; |
||
333 | |||
334 | /// <summary> |
||
335 | /// The Refresh timer inteval is used to set the delay between checks for stalled texture downloads |
||
336 | /// </summary> |
||
337 | /// <remarks>This is a static variable which applies to all instances</remarks> |
||
338 | public static float PIPELINE_REFRESH_INTERVAL = 500.0f; |
||
339 | |||
340 | /// <summary> |
||
341 | /// Textures taking longer than this value will be flagged as timed out and removed from the pipeline |
||
342 | /// </summary> |
||
343 | public int PIPELINE_REQUEST_TIMEOUT = 45*1000; |
||
344 | #endregion |
||
345 | |||
346 | #region Logging Configuration |
||
347 | |||
348 | /// <summary> |
||
349 | /// Get or set the minimum log level to output to the console by default |
||
350 | /// |
||
351 | /// If the library is not compiled with DEBUG defined and this level is set to DEBUG |
||
352 | /// You will get no output on the console. This behavior can be overriden by creating |
||
353 | /// a logger configuration file for log4net |
||
354 | /// </summary> |
||
355 | public static Helpers.LogLevel LOG_LEVEL = Helpers.LogLevel.Debug; |
||
356 | |||
357 | /// <summary>Attach avatar names to log messages</summary> |
||
358 | public bool LOG_NAMES = true; |
||
359 | |||
360 | /// <summary>Log packet retransmission info</summary> |
||
361 | public bool LOG_RESENDS = true; |
||
362 | |||
363 | /// <summary>Log disk cache misses and other info</summary> |
||
364 | public bool LOG_DISKCACHE = true; |
||
365 | |||
366 | #endregion |
||
367 | #region Private Fields |
||
368 | |||
369 | private GridClient Client; |
||
370 | private int priceUpload = 0; |
||
371 | public static bool SORT_INVENTORY = false; |
||
372 | |||
373 | /// <summary>Constructor</summary> |
||
374 | /// <param name="client">Reference to a GridClient object</param> |
||
375 | public Settings(GridClient client) |
||
376 | { |
||
377 | Client = client; |
||
378 | Client.Network.RegisterCallback(Packets.PacketType.EconomyData, EconomyDataHandler); |
||
379 | } |
||
380 | |||
381 | #endregion |
||
382 | #region Packet Callbacks |
||
383 | |||
384 | /// <summary>Process an incoming packet and raise the appropriate events</summary> |
||
385 | /// <param name="sender">The sender</param> |
||
386 | /// <param name="e">The EventArgs object containing the packet data</param> |
||
387 | protected void EconomyDataHandler(object sender, PacketReceivedEventArgs e) |
||
388 | { |
||
389 | EconomyDataPacket econ = (EconomyDataPacket)e.Packet; |
||
390 | |||
391 | priceUpload = econ.Info.PriceUpload; |
||
392 | } |
||
393 | |||
394 | #endregion |
||
395 | } |
||
396 | } |