/usr/include/sipxtapi/net/XmlRpcDispatch.h is in libsipxtapi-dev 3.3.0~test17-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | //
// Copyright (C) 2006-2012 SIPez LLC. All rights reserved.
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _XMLRPCDISPATCH_H_
#define _XMLRPCDISPATCH_H_
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include <os/OsBSem.h>
#include <xmlparser/tinyxml.h>
#include "net/HttpService.h"
#include "net/HttpServer.h"
#include "net/XmlRpcMethod.h"
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
// Private class to contain XmlRpcMethod and user data for each methodName
class XmlRpcMethodContainer : public UtlContainable
{
public:
static const UtlContainableType TYPE ; /** < Class type used for runtime checking */
XmlRpcMethodContainer();
virtual ~XmlRpcMethodContainer();
virtual UtlContainableType getContainableType() const;
virtual unsigned int hash() const;
int compareTo(const UtlContainable *b) const;
void setData(XmlRpcMethod::Get* method, void* userData);
void getData(XmlRpcMethod::Get*& method, void*& userData);
private:
void* mpUserData;
XmlRpcMethod::Get* mpMethod;
//! DISALLOWED accidental copying
XmlRpcMethodContainer(const XmlRpcMethodContainer& rXmlRpcMethodContainer);
XmlRpcMethodContainer& operator=(const XmlRpcMethodContainer& rhs);
};
/**
* A XmlRpcDispatch is a object that monitors the incoming
* XML-RPC requests, parses XmlRpcRequest messages, invokes the correct
* XmlRpcMethod calls, and sends back the corresponding XmlRpcResponse responses.
* If the correspnding method does not exit, it will send back a 404 response.
* Otherwise, it will always send back a 200 OK response with XmlRpcResponse
* content.
*
* For each XML-RPC server, it needs to instantiate a XmlRpcDispatch object first,
* and then register each service method using addMethod() or remove the method
* using removeMethod().
*/
class XmlRpcDispatch : public HttpService
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
static const char* DEFAULT_URL_PATH;
/* ============================ CREATORS ================================== */
/// Create a dispatch object.
XmlRpcDispatch(int httpServerPort, ///< port number for HttpServer
bool isSecureServer, ///< option for HTTP or HTTPS
const char* uriPath = DEFAULT_URL_PATH, ///< uri path
const char* httpBindAddress = NULL ///< IP address/interface to bind http server to
);
/// Destructor.
virtual ~XmlRpcDispatch();
/* ============================ MANIPULATORS ============================== */
/// Handler for XML-RPC requests
void processRequest(const HttpRequestContext& requestContext,
const HttpMessage& request,
HttpMessage*& response );
/// Parse a value in the XML-RPC request
static bool parseValue(TiXmlNode* valueNode, int index, UtlSList& params);
/// Clean up the memory in a struct
static void cleanUp(UtlHashMap* members);
/// Clean up the memory in an array
static void cleanUp(UtlSList* array);
/* ============================ ACCESSORS ================================= */
/// Add a method to the RPC dispatch
void addMethod(const char* methodName, XmlRpcMethod::Get* method, void* userData = NULL);
/// Remove a method from the RPC dispatch by name
void removeMethod(const char* methodName);
/// Return the HTTP server that services RPC requests
HttpServer* getHttpServer();
/* ============================ INQUIRY =================================== */
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
friend class XmlRpcTest;
/// Parse the XML-RPC request
bool parseXmlRpcRequest(UtlString& requestContent,
XmlRpcMethodContainer*& method,
UtlSList& params,
XmlRpcResponse& response);
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
/// Parse an array in the XML-RPC request
static bool parseArray(TiXmlNode* valueNode, UtlSList*& array);
/// Parse a struct in the XML-RPC request
static bool parseStruct(TiXmlNode* valueNode, UtlHashMap*& memebers);
/// Http server for handling the HTTP POST request
HttpServer* mpHttpServer;
/// hash map for holding all registered XML-RPC methods
UtlHashMap mMethods;
/// reader/writer lock for synchronization
OsBSem mLock;
/// Disabled copy constructor
XmlRpcDispatch(const XmlRpcDispatch& rXmlRpcDispatch);
/// Disabled assignment operator
XmlRpcDispatch& operator=(const XmlRpcDispatch& rhs);
};
/* ============================ INLINE METHODS ============================ */
#endif // _XMLRPCDISPATCH_H_
|