Changes made for RPC

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RpcHandler.h Source File

RpcHandler.h

00001 /* RpcHandler.h */
00002 /*
00003 Copyright (c) 2013 Henry Leinen (henry[dot]leinen [at] online [dot] de)
00004  
00005 Permission is hereby granted, free of charge, to any person obtaining a copy
00006 of this software and associated documentation files (the "Software"), to deal
00007 in the Software without restriction, including without limitation the rights
00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00009 copies of the Software, and to permit persons to whom the Software is
00010 furnished to do so, subject to the following conditions:
00011  
00012 The above copyright notice and this permission notice shall be included in
00013 all copies or substantial portions of the Software.
00014  
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00021 THE SOFTWARE.
00022 */
00023 #ifndef __RPCHANDLER_H__
00024 #define __RPCHANDLER_H__
00025 
00026 #include "mbed.h"
00027 #include "HTTPRequestHandler.h"
00028 
00029 class HTTPRpcRequestHandler : public HTTPRequestHandler
00030 {
00031         std::string m_rootPath;
00032         std::string m_localPath;
00033 
00034     public:
00035         /** constructor for HTTPRpcRequestHandler object and stores the request related data locally. 
00036         * the request handling will be initiated from within the constructor.
00037         * @param rootPath : The path under which the handler was registered.
00038         * @param localPath : The path which is relative to the registered file system root.
00039         * @param Msg : Message request information that comes with the request.
00040         * @param Tcp : The socket connection for communicating with the client.
00041         */
00042         HTTPRpcRequestHandler(const char* rootPath, const char* localPath, HTTPConnection::HTTPMessage& Msg, TCPSocketConnection& Tcp);
00043         
00044         /** Destructor 
00045         */
00046         virtual ~HTTPRpcRequestHandler();
00047   
00048         /** static creation function for this object.
00049         */
00050         static inline HTTPRequestHandler* create(const char* rootPath, const char* localPath, HTTPConnection::HTTPMessage& msg, TCPSocketConnection& tcp) { return new HTTPRpcRequestHandler(rootPath, localPath, msg, tcp); }
00051               
00052         /** Handler function to serve GET requests
00053         */
00054         virtual int handleGetRequest();
00055         
00056         /** Handler function to serve PUT requests
00057         */
00058         virtual int handlePutRequest();
00059         
00060         /** Handler function to serve POST requests
00061         */
00062         virtual int handlePostRequest();
00063 
00064         /** Parse a uri string for uri file name and argument:value pairs
00065         */
00066 //        int parseUriArgs(string uri, string map<string, string>& args);
00067 };
00068 #endif //   __RPCHANDLER_H__