PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pxmlrpcs.h
Go to the documentation of this file.
1 /*
2 * pxmlrpcs.h
3 *
4 * XML parser support
5 *
6 * Portable Windows Library
7 *
8 * Copyright (c) 2002 Equivalence Pty. Ltd.
9 *
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
14 *
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * The Original Code is Portable Windows Library.
21 *
22 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23 *
24 * Contributor(s): ______________________________________.
25 *
26 * $Revision: 21788 $
27 * $Author: rjongbloed $
28 * $Date: 2008-12-12 16:42:13 +1100 (Fri, 12 Dec 2008) $
29 */
30
31 #ifndef PTLIB_XMLRPCSRVR_H
32 #define PTLIB_XMLRPCSRVR_H
33
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
37
38 #include <ptclib/pxmlrpc.h>
39 #include <ptclib/http.h>
40
41
42 class PXMLRPCServerMethod : public PString
43 {
44 PCLASSINFO(PXMLRPCServerMethod, PString);
45 public:
46 PXMLRPCServerMethod(const PString & name)
47 : PString(name) { }
48
49 PNotifier methodFunc;
50 };
51
52
53 PSORTED_LIST(PXMLRPCServerMethodList, PXMLRPCServerMethod);
54
55
56 class PXMLRPCServerResource : public PHTTPResource
57 {
58 PCLASSINFO(PXMLRPCServerResource, PHTTPResource);
59 public:
60 PXMLRPCServerResource();
61 PXMLRPCServerResource(
62 const PHTTPAuthority & auth
63 );
64 PXMLRPCServerResource(
65 const PURL & url
66 );
67 PXMLRPCServerResource(
68 const PURL & url,
69 const PHTTPAuthority & auth
70 );
71
72 // overrides from PHTTPResource
73 PBoolean LoadHeaders(PHTTPRequest & request);
74 PBoolean OnPOSTData(PHTTPRequest & request, const PStringToString & data);
75
76 // new functions
77 virtual void OnXMLRPCRequest(const PString & body, PString & reply);
78 virtual PBoolean SetMethod(const PString & methodName, const PNotifier & func);
79 void OnXMLRPCRequest(const PString & methodName, PXMLRPCBlock & request, PString & reply);
80
81 virtual PString FormatFault(
82 PINDEX code,
83 const PString & str
84 );
85
86 protected:
87 PMutex methodMutex;
88 PXMLRPCServerMethodList methodList;
89 };
90
91
92 class PXMLRPCServerParms : public PObject
93 {
94 PCLASSINFO(PXMLRPCServerParms, PObject);
95 public:
96 PXMLRPCServerParms(
97 PXMLRPCServerResource & res,
98 PXMLRPCBlock & req
99 ) : resource(res), request(req) { }
100
101 void SetFault(
102 PINDEX code,
103 const PString & text
104 ) { request.SetFault(code, resource.FormatFault(code, text)); }
105
106 PXMLRPCServerResource & resource;
107 PXMLRPCBlock & request;
108 PXMLRPCBlock response;
109 };
110
111
112 #endif // PTLIB_XMLRPCSRVR_H
113
114
115 // End Of File ///////////////////////////////////////////////////////////////