diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/llmessage/lliohttpserver.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/llmessage/lliohttpserver.h')
-rw-r--r-- | linden/indra/llmessage/lliohttpserver.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/linden/indra/llmessage/lliohttpserver.h b/linden/indra/llmessage/lliohttpserver.h new file mode 100644 index 0000000..efbd7db --- /dev/null +++ b/linden/indra/llmessage/lliohttpserver.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /** | ||
2 | * @file lliohttpserver.h | ||
3 | * @brief Declaration of function for creating an HTTP wire server | ||
4 | * @see LLIOServerSocket, LLPumpIO | ||
5 | * | ||
6 | * Copyright (c) 2005-2007, Linden Research, Inc. | ||
7 | * | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #ifndef LL_LLIOHTTPSERVER_H | ||
30 | #define LL_LLIOHTTPSERVER_H | ||
31 | |||
32 | #include "llapr.h" | ||
33 | #include "llchainio.h" | ||
34 | #include "llhttpnode.h" | ||
35 | |||
36 | class LLPumpIO; | ||
37 | |||
38 | LLHTTPNode& LLCreateHTTPServer(apr_pool_t* pool, LLPumpIO& pump, U16 port); | ||
39 | /**< Creates an HTTP wire server on the pump for the given TCP port. | ||
40 | * | ||
41 | * Returns the root node of the new server. Add LLHTTPNode instances | ||
42 | * to this root. | ||
43 | * | ||
44 | * Nodes that return NULL for getProtocolHandler(), will use the | ||
45 | * default handler that interprets HTTP on the wire and converts | ||
46 | * it into calls to get(), put(), post(), del() with appropriate | ||
47 | * LLSD arguments and results. | ||
48 | * | ||
49 | * To have nodes that implement some other wire protocol (XML-RPC | ||
50 | * for example), use the helper templates below. | ||
51 | */ | ||
52 | |||
53 | void LLCreateHTTPPipe(LLPumpIO::chain_t& chain, const LLHTTPNode& root); | ||
54 | /**< Create a pipe on the chain that handles HTTP requests. | ||
55 | * The requests are served by the node tree given at root. | ||
56 | * | ||
57 | * This is primarily useful for unit testing. | ||
58 | */ | ||
59 | |||
60 | /* @name Helper Templates | ||
61 | * | ||
62 | * These templates make it easy to create nodes that use thier own protocol | ||
63 | * handlers rather than the default. Typically, you subclass LLIOPipe to | ||
64 | * implement the protocol, and then add a node using the templates: | ||
65 | * | ||
66 | * rootNode->addNode("thing", new LLHTTPNodeForPipe<LLThingPipe>); | ||
67 | * | ||
68 | * The templates are: | ||
69 | * | ||
70 | * LLChainIOFactoryForPipe | ||
71 | * - a simple factory that builds instances of a pipe | ||
72 | * | ||
73 | * LLHTTPNodeForFacotry | ||
74 | * - a HTTP node that uses a factory as the protocol handler | ||
75 | * | ||
76 | * LLHTTPNodeForPipe | ||
77 | * - a HTTP node that uses a simple factory based on a pipe | ||
78 | */ | ||
79 | //@{ | ||
80 | |||
81 | template<class Pipe> | ||
82 | class LLChainIOFactoryForPipe : public LLChainIOFactory | ||
83 | { | ||
84 | public: | ||
85 | virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const | ||
86 | { | ||
87 | chain.push_back(LLIOPipe::ptr_t(new Pipe)); | ||
88 | return true; | ||
89 | } | ||
90 | }; | ||
91 | |||
92 | template<class Factory> | ||
93 | class LLHTTPNodeForFactory : public LLHTTPNode | ||
94 | { | ||
95 | public: | ||
96 | const LLChainIOFactory* getProtocolHandler() const | ||
97 | { return &mProtocolHandler; } | ||
98 | |||
99 | private: | ||
100 | Factory mProtocolHandler; | ||
101 | }; | ||
102 | |||
103 | //@} | ||
104 | |||
105 | |||
106 | template<class Pipe> | ||
107 | class LLHTTPNodeForPipe : public LLHTTPNodeForFactory< | ||
108 | LLChainIOFactoryForPipe<Pipe> > | ||
109 | { | ||
110 | }; | ||
111 | |||
112 | |||
113 | #endif // LL_LLIOHTTPSERVER_H | ||
114 | |||