All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pxmlrpcs.h
Go to the documentation of this file.
/*
* pxmlrpcs.h
*
* XML parser support
*
* Portable Windows Library
*
* Copyright (c) 2002 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Contributor(s): ______________________________________.
*
* $Revision: 21788 $
* $Author: rjongbloed $
* $Date: 2008-12-11 23:42:13 -0600 (Thu, 11 Dec 2008) $
*/
#ifndef PTLIB_XMLRPCSRVR_H
#define PTLIB_XMLRPCSRVR_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <ptclib/pxmlrpc.h>
#include <ptclib/http.h>
class PXMLRPCServerMethod : public PString
{
PCLASSINFO(PXMLRPCServerMethod, PString);
public:
PXMLRPCServerMethod(const PString & name)
: PString(name) { }
PNotifier methodFunc;
};
PSORTED_LIST(PXMLRPCServerMethodList, PXMLRPCServerMethod);
class PXMLRPCServerResource : public PHTTPResource
{
PCLASSINFO(PXMLRPCServerResource, PHTTPResource);
public:
PXMLRPCServerResource();
PXMLRPCServerResource(
const PHTTPAuthority & auth
);
PXMLRPCServerResource(
const PURL & url
);
PXMLRPCServerResource(
const PURL & url,
const PHTTPAuthority & auth
);
// overrides from PHTTPResource
PBoolean LoadHeaders(PHTTPRequest & request);
PBoolean OnPOSTData(PHTTPRequest & request, const PStringToString & data);
// new functions
virtual void OnXMLRPCRequest(const PString & body, PString & reply);
virtual PBoolean SetMethod(const PString & methodName, const PNotifier & func);
void OnXMLRPCRequest(const PString & methodName, PXMLRPCBlock & request, PString & reply);
virtual PString FormatFault(
PINDEX code,
const PString & str
);
protected:
PMutex methodMutex;
PXMLRPCServerMethodList methodList;
};
class PXMLRPCServerParms : public PObject
{
PCLASSINFO(PXMLRPCServerParms, PObject);
public:
PXMLRPCServerParms(
PXMLRPCServerResource & res,
PXMLRPCBlock & req
) : resource(res), request(req) { }
void SetFault(
PINDEX code,
const PString & text
) { request.SetFault(code, resource.FormatFault(code, text)); }
PXMLRPCServerResource & resource;
PXMLRPCBlock & request;
PXMLRPCBlock response;
};
#endif // PTLIB_XMLRPCSRVR_H
// End Of File ///////////////////////////////////////////////////////////////
PSORTED_LIST
PSORTED_LIST(PXMLRPCServerMethodList, PXMLRPCServerMethod)
PNotifier
Class specialisation for PNotifierTemplate<INT>
PXMLRPCServerResource::methodList
PXMLRPCServerMethodList methodList
Definition: pxmlrpcs.h:88
PHTTPAuthority
This abstract class describes the authorisation mechanism for a Universal Resource Locator...
Definition: http.h:1002
PXMLRPCServerParms::SetFault
void SetFault(PINDEX code, const PString &text)
Definition: pxmlrpcs.h:101
PXMLRPCServerResource::FormatFault
virtual PString FormatFault(PINDEX code, const PString &str)
PXMLRPCServerResource::PXMLRPCServerResource
PXMLRPCServerResource()
PXMLRPCServerParms::request
PXMLRPCBlock & request
Definition: pxmlrpcs.h:107
PXMLRPCServerMethod::methodFunc
PNotifier methodFunc
Definition: pxmlrpcs.h:49
PXMLRPCServerResource::OnPOSTData
PBoolean OnPOSTData(PHTTPRequest &request, const PStringToString &data)
Send the data associated with a POST command.
PStringToString
This is a dictionary collection class of PString objects, keyed by another string.
Definition: pstring.h:2784
PHTTPResource
This object describes a HyperText Transport Protocol resource.
Definition: http.h:1222
http.h
PXMLRPCServerResource::SetMethod
virtual PBoolean SetMethod(const PString &methodName, const PNotifier &func)
PBoolean
BOOL PBoolean
Definition: object.h:102
PXMLRPCBlock::SetFault
void SetFault(PINDEX code, const PString &text)
Definition: pxmlrpc.h:128
PXMLRPCServerMethod::PXMLRPCServerMethod
PXMLRPCServerMethod(const PString &name)
Definition: pxmlrpcs.h:46
pxmlrpc.h
PXMLRPCBlock
Definition: pxmlrpc.h:111
PXMLRPCServerParms::response
PXMLRPCBlock response
Definition: pxmlrpcs.h:108
PString
The character string class.
Definition: pstring.h:108
PXMLRPCServerParms::resource
PXMLRPCServerResource & resource
Definition: pxmlrpcs.h:106
PXMLRPCServerResource::LoadHeaders
PBoolean LoadHeaders(PHTTPRequest &request)
Get the headers for block of data (eg HTML) that the resource contains.
PXMLRPCServerResource::OnXMLRPCRequest
virtual void OnXMLRPCRequest(const PString &body, PString &reply)
PXMLRPCServerResource
Definition: pxmlrpcs.h:56
PXMLRPCServerParms::PXMLRPCServerParms
PXMLRPCServerParms(PXMLRPCServerResource &res, PXMLRPCBlock &req)
Definition: pxmlrpcs.h:96
PMutex
Synonym for PTimedMutex.
PXMLRPCServerParms
Definition: pxmlrpcs.h:92
PHTTPRequest
This object describes a HyperText Transport Protocol request.
Definition: http.h:968
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PURL
This class describes a Universal Resource Locator.
Definition: url.h:54
PXMLRPCServerMethod
Definition: pxmlrpcs.h:42
PXMLRPCServerResource::methodMutex
PMutex methodMutex
Definition: pxmlrpcs.h:87