PTLib  Version 2.18.8
 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 
27 #ifndef PTLIB_XMLRPCSRVR_H
28 #define PTLIB_XMLRPCSRVR_H
29 
30 #ifdef P_USE_PRAGMA
31 #pragma interface
32 #endif
33 
34 #include <ptclib/pxmlrpc.h>
35 #include <ptclib/http.h>
36 
37 
39 {
40  PCLASSINFO(PXMLRPCServerMethod, PString);
41  public:
43  : PString(name) { }
44 
46 };
47 
48 
49 PSORTED_LIST(PXMLRPCServerMethodList, PXMLRPCServerMethod);
50 
51 
53 {
55  public:
58  const PHTTPAuthority & auth
59  );
61  const PURL & url
62  );
64  const PURL & url,
65  const PHTTPAuthority & auth
66  );
67 
68  // overrides from PHTTPResource
70  PBoolean OnPOSTData(PHTTPRequest & request, const PStringToString & data);
71 
72  // new functions
73  virtual void OnXMLRPCRequest(const PString & body, PString & reply);
74  virtual PBoolean SetMethod(const PString & methodName, const PNotifier & func);
75  void OnXMLRPCRequest(const PString & methodName, PXMLRPCBlock & request, PString & reply);
76 
77  virtual PString FormatFault(
78  PINDEX code,
79  const PString & str
80  );
81 
82  protected:
83  PDECLARE_MUTEX(methodMutex);
84  PXMLRPCServerMethodList methodList;
85 };
86 
87 
88 class PXMLRPCServerParms : public PObject
89 {
90  PCLASSINFO(PXMLRPCServerParms, PObject);
91  public:
94  PXMLRPCBlock & req
95  ) : resource(res), request(req) { }
96 
97  void SetFault(
98  PINDEX code,
99  const PString & text
100  ) { request.SetFault(code, resource.FormatFault(code, text)); }
101 
105 };
106 
107 
108 #endif // PTLIB_XMLRPCSRVR_H
109 
110 
111 // End Of File ///////////////////////////////////////////////////////////////
Class specialisation for PNotifierTemplate&lt;P_INT_PTR&gt;
PXMLRPCServerMethodList methodList
Definition: pxmlrpcs.h:84
This abstract class describes the authorisation mechanism for a Universal Resource Locator...
Definition: http.h:1452
void SetFault(PINDEX code, const PString &text)
Definition: pxmlrpcs.h:97
virtual PString FormatFault(PINDEX code, const PString &str)
PXMLRPCBlock & request
Definition: pxmlrpcs.h:103
PNotifier methodFunc
Definition: pxmlrpcs.h:45
PBoolean OnPOSTData(PHTTPRequest &request, const PStringToString &data)
Send the data associated with a POST command.
This is a dictionary collection class of PString objects, keyed by another string.
Definition: pstring.h:3151
PDECLARE_MUTEX(methodMutex)
This object describes a HyperText Transport Protocol resource.
Definition: http.h:1680
virtual PBoolean SetMethod(const PString &methodName, const PNotifier &func)
void SetFault(PINDEX code, const PString &text)
Definition: pxmlrpc.h:122
PXMLRPCServerMethod(const PString &name)
Definition: pxmlrpcs.h:42
Definition: pxmlrpc.h:107
PXMLRPCBlock response
Definition: pxmlrpcs.h:104
bool PBoolean
Definition: object.h:174
The character string class.
Definition: pstring.h:108
PXMLRPCServerResource & resource
Definition: pxmlrpcs.h:102
PBoolean LoadHeaders(PHTTPRequest &request)
Get the headers for block of data (eg HTML) that the resource contains.
virtual void OnXMLRPCRequest(const PString &body, PString &reply)
Definition: pxmlrpcs.h:52
PXMLRPCServerParms(PXMLRPCServerResource &res, PXMLRPCBlock &req)
Definition: pxmlrpcs.h:92
Definition: pxmlrpcs.h:88
#define PSORTED_LIST(cls, T)
Declare a sorted list class.
Definition: lists.h:1116
This object describes a HyperText Transport Protocol request.
Definition: http.h:1417
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
This class describes a Universal Resource Locator.
Definition: url.h:56
Definition: pxmlrpcs.h:38