diff options
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs new file mode 100644 index 0000000..6e3cc49 --- /dev/null +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs | |||
@@ -0,0 +1,126 @@ | |||
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 OpenSim 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 Nwc.XmlRpc; | ||
29 | |||
30 | namespace OpenSim.Framework.Servers.HttpServer | ||
31 | { | ||
32 | /// <summary> | ||
33 | /// Interface to OpenSimulator's built in HTTP server. Use this to register handlers (http, llsd, xmlrpc, etc.) | ||
34 | /// for given URLs. | ||
35 | /// </summary> | ||
36 | public interface IHttpServer | ||
37 | { | ||
38 | uint SSLPort { get; } | ||
39 | string SSLCommonName { get; } | ||
40 | |||
41 | uint Port { get; } | ||
42 | bool UseSSL { get; } | ||
43 | |||
44 | // Note that the agent string is provided simply to differentiate | ||
45 | // the handlers - it is NOT required to be an actual agent header | ||
46 | // value. | ||
47 | bool AddAgentHandler(string agent, IHttpAgentHandler handler); | ||
48 | |||
49 | /// <summary> | ||
50 | /// Add a handler for an HTTP request | ||
51 | /// </summary> | ||
52 | /// | ||
53 | /// This handler can actually be invoked either as | ||
54 | /// | ||
55 | /// http://<hostname>:<port>/?method=<methodName> | ||
56 | /// | ||
57 | /// or | ||
58 | /// | ||
59 | /// http://<hostname>:<port><method> | ||
60 | /// | ||
61 | /// if the method name starts with a slash. For example, AddHTTPHandler("/object/", ...) on a standalone region | ||
62 | /// server will register a handler that can be invoked with either | ||
63 | /// | ||
64 | /// http://localhost:9000/?method=/object/ | ||
65 | /// | ||
66 | /// or | ||
67 | /// | ||
68 | /// http://localhost:9000/object/ | ||
69 | /// | ||
70 | /// <param name="methodName"></param> | ||
71 | /// <param name="handler"></param> | ||
72 | /// <returns> | ||
73 | /// true if the handler was successfully registered, false if a handler with the same name already existed. | ||
74 | /// </returns> | ||
75 | bool AddHTTPHandler(string methodName, GenericHTTPMethod handler); | ||
76 | |||
77 | /// <summary> | ||
78 | /// Adds a LLSD handler, yay. | ||
79 | /// </summary> | ||
80 | /// <param name="path">/resource/ path</param> | ||
81 | /// <param name="handler">handle the LLSD response</param> | ||
82 | /// <returns></returns> | ||
83 | bool AddLLSDHandler(string path, LLSDMethod handler); | ||
84 | |||
85 | /// <summary> | ||
86 | /// Add a stream handler to the http server. If the handler already exists, then nothing happens. | ||
87 | /// </summary> | ||
88 | /// <param name="handler"></param> | ||
89 | void AddStreamHandler(IRequestHandler handler); | ||
90 | |||
91 | bool AddXmlRPCHandler(string method, XmlRpcMethod handler); | ||
92 | bool AddXmlRPCHandler(string method, XmlRpcMethod handler, bool keepAlive); | ||
93 | |||
94 | /// <summary> | ||
95 | /// Gets the XML RPC handler for given method name | ||
96 | /// </summary> | ||
97 | /// <param name="method">Name of the method</param> | ||
98 | /// <returns>Returns null if not found</returns> | ||
99 | XmlRpcMethod GetXmlRPCHandler(string method); | ||
100 | |||
101 | bool SetDefaultLLSDHandler(DefaultLLSDMethod handler); | ||
102 | |||
103 | /// <summary> | ||
104 | /// Remove the agent if it is registered. | ||
105 | /// </summary> | ||
106 | /// <param name="agent"></param> | ||
107 | /// <param name="handler"></param> | ||
108 | /// <returns></returns> | ||
109 | bool RemoveAgentHandler(string agent, IHttpAgentHandler handler); | ||
110 | |||
111 | /// <summary> | ||
112 | /// Remove an HTTP handler | ||
113 | /// </summary> | ||
114 | /// <param name="httpMethod"></param> | ||
115 | /// <param name="path"></param> | ||
116 | void RemoveHTTPHandler(string httpMethod, string path); | ||
117 | |||
118 | bool RemoveLLSDHandler(string path, LLSDMethod handler); | ||
119 | |||
120 | void RemoveStreamHandler(string httpMethod, string path); | ||
121 | |||
122 | string GetHTTP404(string host); | ||
123 | |||
124 | string GetHTTP500(); | ||
125 | } | ||
126 | } | ||