PTLib  Version 2.10.11
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-11 23:42:13 -0600 (Thu, 11 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 
43 {
44  PCLASSINFO(PXMLRPCServerMethod, PString);
45  public:
47  : PString(name) { }
48 
50 };
51 
52 
53 PSORTED_LIST(PXMLRPCServerMethodList, PXMLRPCServerMethod);
54 
55 
57 {
59  public:
62  const PHTTPAuthority & auth
63  );
65  const PURL & url
66  );
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:
88  PXMLRPCServerMethodList methodList;
89 };
90 
91 
92 class PXMLRPCServerParms : public PObject
93 {
95  public:
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 
109 };
110 
111 
112 #endif // PTLIB_XMLRPCSRVR_H
113 
114 
115 // End Of File ///////////////////////////////////////////////////////////////
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
PSORTED_LIST(PXMLRPCServerMethodList, PXMLRPCServerMethod)
Class specialisation for PNotifierTemplate<INT>
PXMLRPCServerMethodList methodList
Definition: pxmlrpcs.h:88
This abstract class describes the authorisation mechanism for a Universal Resource Locator...
Definition: http.h:1002
void SetFault(PINDEX code, const PString &text)
Definition: pxmlrpcs.h:101
PXMLRPCBlock & request
Definition: pxmlrpcs.h:107
PNotifier methodFunc
Definition: pxmlrpcs.h:49
This is a dictionary collection class of PString objects, keyed by another string.
Definition: pstring.h:2784
This object describes a HyperText Transport Protocol resource.
Definition: http.h:1222
BOOL PBoolean
Definition: object.h:102
PXMLRPCServerMethod(const PString &name)
Definition: pxmlrpcs.h:46
Definition: pxmlrpc.h:111
PXMLRPCBlock response
Definition: pxmlrpcs.h:108
The character string class.
Definition: pstring.h:108
PXMLRPCServerResource & resource
Definition: pxmlrpcs.h:106
Definition: pxmlrpcs.h:56
PXMLRPCServerParms(PXMLRPCServerResource &res, PXMLRPCBlock &req)
Definition: pxmlrpcs.h:96
Synonym for PTimedMutex.
Definition: pxmlrpcs.h:92
This object describes a HyperText Transport Protocol request.
Definition: http.h:968
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
This class describes a Universal Resource Locator.
Definition: url.h:54
Definition: pxmlrpcs.h:42
PMutex methodMutex
Definition: pxmlrpcs.h:87