opensim – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 eva 1 /*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
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 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27  
28 using System;
29 using System.Collections;
30 using OpenSim.Region.ScriptEngine.Interfaces;
31  
32 using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
33 using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
34 using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
35 using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
36 using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
37 using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
38 using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
39 using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
40  
41 namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
42 {
43 /// <summary>
44 /// To permit region owners to enable the extended scripting functionality
45 /// of OSSL, without allowing malicious scripts to access potentially
46 /// troublesome functions, each OSSL function is assigned a threat level,
47 /// and access to the functions is granted or denied based on a default
48 /// threshold set in OpenSim.ini (which can be overridden for individual
49 /// functions on a case-by-case basis)
50 /// </summary>
51 public enum ThreatLevel
52 {
53 // Not documented, presumably means permanently disabled ?
54 NoAccess = -1,
55  
56 /// <summary>
57 /// Function is no threat at all. It doesn't constitute a threat to
58 /// either users or the system and has no known side effects.
59 /// </summary>
60 None = 0,
61  
62 /// <summary>
63 /// Abuse of this command can cause a nuisance to the region operator,
64 /// such as log message spew.
65 /// </summary>
66 Nuisance = 1,
67  
68 /// <summary>
69 /// Extreme levels of abuse of this function can cause impaired
70 /// functioning of the region, or very gullible users can be tricked
71 /// into experiencing harmless effects.
72 /// </summary>
73 VeryLow = 2,
74  
75 /// <summary>
76 /// Intentional abuse can cause crashes or malfunction under certain
77 /// circumstances, which can be easily rectified; or certain users can
78 /// be tricked into certain situations in an avoidable manner.
79 /// </summary>
80 Low = 3,
81  
82 /// <summary>
83 /// Intentional abuse can cause denial of service and crashes with
84 /// potential of data or state loss; or trusting users can be tricked
85 /// into embarrassing or uncomfortable situations.
86 /// </summary>
87 Moderate = 4,
88  
89 /// <summary>
90 /// Casual abuse can cause impaired functionality or temporary denial
91 /// of service conditions. Intentional abuse can easily cause crashes
92 /// with potential data loss, or can be used to trick experienced and
93 /// cautious users into unwanted situations, or changes global data
94 /// permanently and without undo ability.
95 /// </summary>
96 High = 5,
97  
98 /// <summary>
99 /// Even normal use may, depending on the number of instances, or
100 /// frequency of use, result in severe service impairment or crash
101 /// with loss of data, or can be used to cause unwanted or harmful
102 /// effects on users without giving the user a means to avoid it.
103 /// </summary>
104 VeryHigh = 6,
105  
106 /// <summary>
107 /// Even casual use is a danger to region stability, or function allows
108 /// console or OS command execution, or function allows taking money
109 /// without consent, or allows deletion or modification of user data,
110 /// or allows the compromise of sensitive data by design.
111 /// </summary>
112 Severe = 7
113 };
114  
115 public interface IOSSL_Api
116 {
117 void CheckThreatLevel(ThreatLevel level, string function);
118  
119 //OpenSim functions
120 string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);
121 string osSetDynamicTextureURLBlend(string dynamicID, string contentType, string url, string extraParams,
122 int timer, int alpha);
123 string osSetDynamicTextureURLBlendFace(string dynamicID, string contentType, string url, string extraParams,
124 bool blend, int disp, int timer, int alpha, int face);
125 string osSetDynamicTextureData(string dynamicID, string contentType, string data, string extraParams, int timer);
126 string osSetDynamicTextureDataBlend(string dynamicID, string contentType, string data, string extraParams,
127 int timer, int alpha);
128 string osSetDynamicTextureDataBlendFace(string dynamicID, string contentType, string data, string extraParams,
129 bool blend, int disp, int timer, int alpha, int face);
130  
131 LSL_Float osGetTerrainHeight(int x, int y);
132 LSL_Float osTerrainGetHeight(int x, int y); // Deprecated
133 LSL_Integer osSetTerrainHeight(int x, int y, double val);
134 LSL_Integer osTerrainSetHeight(int x, int y, double val); //Deprecated
135 void osTerrainFlush();
136  
137 int osRegionRestart(double seconds);
138 void osRegionNotice(string msg);
139 bool osConsoleCommand(string Command);
140 void osSetParcelMediaURL(string url);
141 void osSetPrimFloatOnWater(int floatYN);
142 void osSetParcelSIPAddress(string SIPAddress);
143  
144 // Avatar Info Commands
145 string osGetAgentIP(string agent);
146 LSL_List osGetAgents();
147  
148 // Teleport commands
149 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
150 void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
151 void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
152 void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
153 void osTeleportOwner(int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
154 void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
155  
156 // Animation commands
157 void osAvatarPlayAnimation(string avatar, string animation);
158 void osAvatarStopAnimation(string avatar, string animation);
159  
160 #region Attachment commands
161  
162 /// <summary>
163 /// Attach the object containing this script to the avatar that owns it without asking for PERMISSION_ATTACH
164 /// </summary>
165 /// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param>
166 void osForceAttachToAvatar(int attachment);
167  
168 /// <summary>
169 /// Attach an inventory item in the object containing this script to the avatar that owns it without asking for PERMISSION_ATTACH
170 /// </summary>
171 /// <remarks>
172 /// Nothing happens if the owner is not in the region.
173 /// </remarks>
174 /// <param name='itemName'>Tha name of the item. If this is not found then a warning is said to the owner</param>
175 /// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param>
176 void osForceAttachToAvatarFromInventory(string itemName, int attachment);
177  
178 /// <summary>
179 /// Attach an inventory item in the object containing this script to any avatar in the region without asking for PERMISSION_ATTACH
180 /// </summary>
181 /// <remarks>
182 /// Nothing happens if the avatar is not in the region.
183 /// </remarks>
184 /// <param name='rawAvatarId'>The UUID of the avatar to which to attach. Nothing happens if this is not a UUID</para>
185 /// <param name='itemName'>The name of the item. If this is not found then a warning is said to the owner</param>
186 /// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param>
187 void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint);
188  
189 /// <summary>
190 /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH
191 /// </summary>
192 /// <remarks>Nothing happens if the object is not attached.</remarks>
193 void osForceDetachFromAvatar();
194  
195 /// <summary>
196 /// Returns a strided list of the specified attachment points and the number of attachments on those points.
197 /// </summary>
198 /// <param name="avatar">avatar UUID</param>
199 /// <param name="attachmentPoints">list of ATTACH_* constants</param>
200 /// <returns></returns>
201 LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints);
202  
203 /// <summary>
204 /// Sends a specified message to the specified avatar's attachments on
205 /// the specified attachment points.
206 /// </summary>
207 /// <remarks>
208 /// Behaves as osMessageObject(), without the sending script needing to know the attachment keys in advance.
209 /// </remarks>
210 /// <param name="avatar">avatar UUID</param>
211 /// <param name="message">message string</param>
212 /// <param name="attachmentPoints">list of ATTACH_* constants, or -1 for all attachments. If -1 is specified and OS_ATTACH_MSG_INVERT_POINTS is present in flags, no action is taken.</param>
213 /// <param name="flags">flags further constraining the attachments to deliver the message to.</param>
214 void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int flags);
215  
216 #endregion
217  
218 //texture draw functions
219 string osMovePen(string drawList, int x, int y);
220 string osDrawLine(string drawList, int startX, int startY, int endX, int endY);
221 string osDrawLine(string drawList, int endX, int endY);
222 string osDrawText(string drawList, string text);
223 string osDrawEllipse(string drawList, int width, int height);
224 string osDrawRectangle(string drawList, int width, int height);
225 string osDrawFilledRectangle(string drawList, int width, int height);
226 string osDrawPolygon(string drawList, LSL_List x, LSL_List y);
227 string osDrawFilledPolygon(string drawList, LSL_List x, LSL_List y);
228 string osSetFontName(string drawList, string fontName);
229 string osSetFontSize(string drawList, int fontSize);
230 string osSetPenSize(string drawList, int penSize);
231 string osSetPenColor(string drawList, string color);
232 string osSetPenColour(string drawList, string colour); // Deprecated
233 string osSetPenCap(string drawList, string direction, string type);
234 string osDrawImage(string drawList, int width, int height, string imageUrl);
235 vector osGetDrawStringSize(string contentType, string text, string fontName, int fontSize);
236 void osSetStateEvents(int events);
237  
238 double osList2Double(LSL_Types.list src, int index);
239  
240 void osSetRegionWaterHeight(double height);
241 void osSetRegionSunSettings(bool useEstateSun, bool sunFixed, double sunHour);
242 void osSetEstateSunSettings(bool sunFixed, double sunHour);
243 double osGetCurrentSunHour();
244 double osGetSunParam(string param);
245 double osSunGetParam(string param); // Deprecated
246 void osSetSunParam(string param, double value);
247 void osSunSetParam(string param, double value); // Deprecated
248  
249 // Wind Module Functions
250 string osWindActiveModelPluginName();
251 void osSetWindParam(string plugin, string param, LSL_Float value);
252 LSL_Float osGetWindParam(string plugin, string param);
253  
254 // Parcel commands
255 void osParcelJoin(vector pos1, vector pos2);
256 void osParcelSubdivide(vector pos1, vector pos2);
257 void osSetParcelDetails(vector pos, LSL_List rules);
258 void osParcelSetDetails(vector pos, LSL_List rules); // Deprecated
259  
260 string osGetScriptEngineName();
261 string osGetSimulatorVersion();
262 string osGetPhysicsEngineType();
263 Object osParseJSONNew(string JSON);
264 Hashtable osParseJSON(string JSON);
265  
266 void osMessageObject(key objectUUID,string message);
267  
268 void osMakeNotecard(string notecardName, LSL_Types.list contents);
269  
270 string osGetNotecardLine(string name, int line);
271 string osGetNotecard(string name);
272 int osGetNumberOfNotecardLines(string name);
273  
274 string osAvatarName2Key(string firstname, string lastname);
275 string osKey2Name(string id);
276  
277 // Grid Info Functions
278 string osGetGridNick();
279 string osGetGridName();
280 string osGetGridLoginURI();
281 string osGetGridHomeURI();
282 string osGetGridGatekeeperURI();
283 string osGetGridCustom(string key);
284  
285 LSL_String osFormatString(string str, LSL_List strings);
286 LSL_List osMatchString(string src, string pattern, int start);
287 LSL_String osReplaceString(string src, string pattern, string replace, int count, int start);
288  
289 // Information about data loaded into the region
290 string osLoadedCreationDate();
291 string osLoadedCreationTime();
292 string osLoadedCreationID();
293  
294 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
295  
296 /// <summary>
297 /// Check if the given key is an npc
298 /// </summary>
299 /// <param name="npc"></param>
300 /// <returns>TRUE if the key belongs to an npc in the scene. FALSE otherwise.</returns>
301 LSL_Integer osIsNpc(LSL_Key npc);
302  
303 key osNpcCreate(string user, string name, vector position, string notecard);
304 key osNpcCreate(string user, string name, vector position, string notecard, int options);
305 LSL_Key osNpcSaveAppearance(key npc, string notecard);
306 void osNpcLoadAppearance(key npc, string notecard);
307 vector osNpcGetPos(key npc);
308 void osNpcMoveTo(key npc, vector position);
309 void osNpcMoveToTarget(key npc, vector target, int options);
310  
311 /// <summary>
312 /// Get the owner of the NPC
313 /// </summary>
314 /// <param name="npc"></param>
315 /// <returns>
316 /// The owner of the NPC for an owned NPC. The NPC's agent id for an unowned NPC. UUID.Zero if the key is not an npc.
317 /// </returns>
318 LSL_Key osNpcGetOwner(key npc);
319  
320 rotation osNpcGetRot(key npc);
321 void osNpcSetRot(LSL_Key npc, rotation rot);
322 void osNpcStopMoveToTarget(LSL_Key npc);
323 void osNpcSay(key npc, string message);
324 void osNpcSay(key npc, int channel, string message);
325 void osNpcShout(key npc, int channel, string message);
326 void osNpcSit(key npc, key target, int options);
327 void osNpcStand(LSL_Key npc);
328 void osNpcRemove(key npc);
329 void osNpcPlayAnimation(LSL_Key npc, string animation);
330 void osNpcStopAnimation(LSL_Key npc, string animation);
331 void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num);
332 void osNpcWhisper(key npc, int channel, string message);
333  
334 LSL_Key osOwnerSaveAppearance(string notecard);
335 LSL_Key osAgentSaveAppearance(key agentId, string notecard);
336  
337 key osGetMapTexture();
338 key osGetRegionMapTexture(string regionName);
339 LSL_List osGetRegionStats();
340 vector osGetRegionSize();
341  
342 int osGetSimulatorMemory();
343 void osKickAvatar(string FirstName,string SurName,string alert);
344 void osSetSpeed(string UUID, LSL_Float SpeedModifier);
345 LSL_Float osGetHealth(string avatar);
346 void osCauseHealing(string avatar, double healing);
347 void osCauseDamage(string avatar, double damage);
348 LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules);
349 void osSetPrimitiveParams(LSL_Key prim, LSL_List rules);
350 void osSetProjectionParams(bool projection, LSL_Key texture, double fov, double focus, double amb);
351 void osSetProjectionParams(LSL_Key prim, bool projection, LSL_Key texture, double fov, double focus, double amb);
352  
353 LSL_List osGetAvatarList();
354  
355 LSL_String osUnixTimeToTimestamp(long time);
356  
357 LSL_String osGetInventoryDesc(string item);
358  
359 LSL_Integer osInviteToGroup(LSL_Key agentId);
360 LSL_Integer osEjectFromGroup(LSL_Key agentId);
361  
362 void osSetTerrainTexture(int level, LSL_Key texture);
363 void osSetTerrainTextureHeight(int corner, double low, double high);
364  
365 /// <summary>
366 /// Checks if thing is a UUID.
367 /// </summary>
368 /// <param name="thing"></param>
369 /// <returns>1 if thing is a valid UUID, 0 otherwise</returns>
370 LSL_Integer osIsUUID(string thing);
371  
372 /// <summary>
373 /// Wraps to Math.Min()
374 /// </summary>
375 /// <param name="a"></param>
376 /// <param name="b"></param>
377 /// <returns></returns>
378 LSL_Float osMin(double a, double b);
379  
380 /// <summary>
381 /// Wraps to Math.max()
382 /// </summary>
383 /// <param name="a"></param>
384 /// <param name="b"></param>
385 /// <returns></returns>
386 LSL_Float osMax(double a, double b);
387  
388 /// <summary>
389 /// Get the key of the object that rezzed this object.
390 /// </summary>
391 /// <returns>Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.</returns>
392 LSL_Key osGetRezzingObject();
393  
394 /// <summary>
395 /// Sets the response type for an HTTP request/response
396 /// </summary>
397 /// <returns></returns>
398 void osSetContentType(LSL_Key id, string type);
399  
400 /// <summary>
401 /// Attempts to drop an attachment to the ground
402 /// </summary>
403 void osDropAttachment();
404  
405 /// <summary>
406 /// Attempts to drop an attachment to the ground while bypassing the script permissions
407 /// </summary>
408 void osForceDropAttachment();
409  
410 /// <summary>
411 /// Attempts to drop an attachment at the specified coordinates.
412 /// </summary>
413 /// <param name="pos"></param>
414 /// <param name="rot"></param>
415 void osDropAttachmentAt(vector pos, rotation rot);
416  
417 /// <summary>
418 /// Attempts to drop an attachment at the specified coordinates while bypassing the script permissions
419 /// </summary>
420 /// <param name="pos"></param>
421 /// <param name="rot"></param>
422 void osForceDropAttachmentAt(vector pos, rotation rot);
423  
424 /// <summary>
425 /// Identical to llListen except for a bitfield which indicates which
426 /// string parameters should be parsed as regex patterns.
427 /// </summary>
428 /// <param name="channelID"></param>
429 /// <param name="name"></param>
430 /// <param name="ID"></param>
431 /// <param name="msg"></param>
432 /// <param name="regexBitfield">
433 /// OS_LISTEN_REGEX_NAME
434 /// OS_LISTEN_REGEX_MESSAGE
435 /// </param>
436 /// <returns></returns>
437 LSL_Integer osListenRegex(int channelID, string name, string ID,
438 string msg, int regexBitfield);
439  
440 /// <summary>
441 /// Wraps to bool Regex.IsMatch(string input, string pattern)
442 /// </summary>
443 /// <param name="input">string to test for match</param>
444 /// <param name="regex">string to use as pattern</param>
445 /// <returns>boolean</returns>
446 LSL_Integer osRegexIsMatch(string input, string pattern);
447 }
448 }