aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Interfaces')
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs15
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs43
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs73
3 files changed, 118 insertions, 13 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
index 2027ca6..30e99b0 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
@@ -26,9 +26,11 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Threading;
29using OpenMetaverse; 30using OpenMetaverse;
30using OpenSim.Framework; 31using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Region.ScriptEngine.Shared;
32 34
33namespace OpenSim.Region.ScriptEngine.Interfaces 35namespace OpenSim.Region.ScriptEngine.Interfaces
34{ 36{
@@ -38,11 +40,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
38 /// Initialize the API 40 /// Initialize the API
39 /// </summary> 41 /// </summary>
40 /// <remarks> 42 /// <remarks>
41 /// Each API has an identifier, which is used to load the 43 /// Each API has an identifier, which is used to load the proper runtime assembly at load time.
42 /// proper runtime assembly at load time. 44 /// <param name='scriptEngine'>/param>
43 /// <param name='engine'>/param> 45 /// <param name='host'>/param>
44 /// <param name='part'></param> 46 /// <param name='item'>/param>
45 /// <param name='item'></param> 47 /// <param name='coopSleepHandle'>/param>
46 void Initialize(IScriptEngine engine, SceneObjectPart part, TaskInventoryItem item); 48 void Initialize(
49 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle);
47 } 50 }
48} \ No newline at end of file 51} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
index 17c2708..b8fdd01 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
@@ -25,16 +25,17 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using log4net;
29using System; 28using System;
30using OpenSim.Region.ScriptEngine.Shared; 29using System.Reflection;
30using OpenSim.Framework;
31using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
33using OpenMetaverse;
34using Nini.Config;
35using OpenSim.Region.ScriptEngine.Interfaces; 33using OpenSim.Region.ScriptEngine.Interfaces;
34using OpenSim.Region.ScriptEngine.Shared;
36using Amib.Threading; 35using Amib.Threading;
37using OpenSim.Framework; 36using log4net;
37using Nini.Config;
38using OpenMetaverse;
38 39
39namespace OpenSim.Region.ScriptEngine.Interfaces 40namespace OpenSim.Region.ScriptEngine.Interfaces
40{ 41{
@@ -76,6 +77,38 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
76 IConfigSource ConfigSource { get; } 77 IConfigSource ConfigSource { get; }
77 string ScriptEngineName { get; } 78 string ScriptEngineName { get; }
78 string ScriptEnginePath { get; } 79 string ScriptEnginePath { get; }
80
81 /// <summary>
82 /// Return the name of the class that will be used for all running scripts.
83 /// </summary>
84 /// <remarks>
85 /// Each class goes in its own assembly so we don't need to otherwise distinguish the class name.
86 /// </remarks>
87 string ScriptClassName { get; }
88
89 /// <summary>
90 /// Return the name of the base class that will be used for all running scripts.
91 /// </summary>
92 string ScriptBaseClassName { get; }
93
94 /// <summary>
95 /// Assemblies that need to be referenced when compiling scripts.
96 /// </summary>
97 /// <remarks>
98 /// These are currently additional to those always referenced by the compiler, BUT THIS MAY CHANGE IN THE
99 /// FUTURE.
100 /// This can be null if there are no additional assemblies.
101 /// </remarks>
102 string[] ScriptReferencedAssemblies { get; }
103
104 /// <summary>
105 /// Parameters for the generated script's constructor.
106 /// </summary>
107 /// <remarks>
108 /// Can be null if there are no parameters
109 /// </remarks>
110 ParameterInfo[] ScriptBaseClassParameters { get; }
111
79 IScriptApi GetApi(UUID itemID, string name); 112 IScriptApi GetApi(UUID itemID, string name);
80 } 113 }
81} 114}
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index b04f6b6..35ae44c 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -28,9 +28,11 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Threading;
31using OpenMetaverse; 32using OpenMetaverse;
32using log4net; 33using log4net;
33using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Region.Framework.Scenes;
34using OpenSim.Region.ScriptEngine.Shared; 36using OpenSim.Region.ScriptEngine.Shared;
35using OpenSim.Region.ScriptEngine.Interfaces; 37using OpenSim.Region.ScriptEngine.Interfaces;
36 38
@@ -50,7 +52,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
50 { 52 {
51 bool Cancel(); 53 bool Cancel();
52 void Abort(); 54 void Abort();
53 bool Wait(TimeSpan t); 55
56 /// <summary>
57 /// Wait for the work item to complete.
58 /// </summary>
59 /// <param name='t'>The number of milliseconds to wait. Must be >= -1 (Timeout.Infinite).</param>
60 bool Wait(int t);
54 } 61 }
55 62
56 /// <summary> 63 /// <summary>
@@ -59,6 +66,18 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
59 public interface IScriptInstance 66 public interface IScriptInstance
60 { 67 {
61 /// <summary> 68 /// <summary>
69 /// Debug level for this script instance.
70 /// </summary>
71 /// <remarks>
72 /// Level == 0, no extra data is logged.
73 /// Level >= 1, state changes are logged.
74 /// Level >= 2, event firing is logged.
75 /// <value>
76 /// The debug level.
77 /// </value>
78 int DebugLevel { get; set; }
79
80 /// <summary>
62 /// Is the script currently running? 81 /// Is the script currently running?
63 /// </summary> 82 /// </summary>
64 bool Running { get; set; } 83 bool Running { get; set; }
@@ -93,6 +112,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
93 /// </summary> 112 /// </summary>
94 long MeasurementPeriodExecutionTime { get; } 113 long MeasurementPeriodExecutionTime { get; }
95 114
115 /// <summary>
116 /// Scene part in which this script instance is contained.
117 /// </summary>
118 SceneObjectPart Part { get; }
119
96 IScriptEngine Engine { get; } 120 IScriptEngine Engine { get; }
97 UUID AppDomain { get; set; } 121 UUID AppDomain { get; set; }
98 string PrimName { get; } 122 string PrimName { get; }
@@ -112,8 +136,24 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
112 136
113 uint LocalID { get; } 137 uint LocalID { get; }
114 UUID AssetID { get; } 138 UUID AssetID { get; }
139
140 /// <summary>
141 /// Inventory item containing the script used.
142 /// </summary>
143 TaskInventoryItem ScriptTask { get; }
144
115 Queue EventQueue { get; } 145 Queue EventQueue { get; }
116 146
147 /// <summary>
148 /// Number of events queued for processing.
149 /// </summary>
150 long EventsQueued { get; }
151
152 /// <summary>
153 /// Number of events processed by this script instance.
154 /// </summary>
155 long EventsProcessed { get; }
156
117 void ClearQueue(); 157 void ClearQueue();
118 int StartParam { get; set; } 158 int StartParam { get; set; }
119 159
@@ -125,7 +165,13 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
125 /// <summary> 165 /// <summary>
126 /// Stop the script instance. 166 /// Stop the script instance.
127 /// </summary> 167 /// </summary>
168 /// <remarks>
169 /// This must not be called by a thread that is in the process of handling an event for this script. Otherwise
170 /// there is a danger that it will self-abort and not complete the reset.
171 /// </remarks>
128 /// <param name="timeout"></param> 172 /// <param name="timeout"></param>
173 /// How many milliseconds we will wait for an existing script event to finish before
174 /// forcibly aborting that event.
129 /// <returns>true if the script was successfully stopped, false otherwise</returns> 175 /// <returns>true if the script was successfully stopped, false otherwise</returns>
130 bool Stop(int timeout); 176 bool Stop(int timeout);
131 177
@@ -147,8 +193,31 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
147 object EventProcessor(); 193 object EventProcessor();
148 194
149 int EventTime(); 195 int EventTime();
150 void ResetScript(); 196
197 /// <summary>
198 /// Reset the script.
199 /// </summary>
200 /// <remarks>
201 /// This must not be called by a thread that is in the process of handling an event for this script. Otherwise
202 /// there is a danger that it will self-abort and not complete the reset. Such a thread must call
203 /// ApiResetScript() instead.
204 /// </remarks>
205 /// <param name='timeout'>
206 /// How many milliseconds we will wait for an existing script event to finish before
207 /// forcibly aborting that event prior to script reset.
208 /// </param>
209 void ResetScript(int timeout);
210
211 /// <summary>
212 /// Reset the script.
213 /// </summary>
214 /// <remarks>
215 /// This must not be called by any thread other than the one executing the scripts current event. This is
216 /// because there is no wait or abort logic if another thread is in the middle of processing a script event.
217 /// Such an external thread should use ResetScript() instead.
218 /// </remarks>
151 void ApiResetScript(); 219 void ApiResetScript();
220
152 Dictionary<string, object> GetVars(); 221 Dictionary<string, object> GetVars();
153 void SetVars(Dictionary<string, object> vars); 222 void SetVars(Dictionary<string, object> vars);
154 DetectParams GetDetectParams(int idx); 223 DetectParams GetDetectParams(int idx);