X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdiameter%2Flauncher%2FMyHandler.hpp;h=9e849a3a775fe7d742ae1a662ea1a4122963d18d;hb=e688b5354af3a5fe0add859710cae41ffe123f65;hp=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391;hpb=705d780f70b3596a222479ec7ad0dc3b3ab192cf;p=anna.git diff --git a/example/diameter/launcher/MyHandler.hpp b/example/diameter/launcher/MyHandler.hpp index e69de29..9e849a3 100644 --- a/example/diameter/launcher/MyHandler.hpp +++ b/example/diameter/launcher/MyHandler.hpp @@ -0,0 +1,36 @@ +// ANNA - Anna is Not Nothingness Anymore // +// // +// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // +// // +// See project site at http://redmine.teslayout.com/projects/anna-suite // +// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // + + +#ifndef example_diameter_launcher_MyHandler_hpp +#define example_diameter_launcher_MyHandler_hpp + +// Project +#include +#include +#include + + +class MyHandler : public anna::http::Handler { +public: + MyHandler() : anna::http::Handler("http_converter::MyHandler") { + allocateResponse()->createHeader(anna::http::Header::Type::Date); + } + +private: + void splitURI(const std::string &uri, std::string &operation, std::string & param1, std::string & param2) const; + + void sendResponse(anna::comm::ClientSocket&, anna::http::Response *response); + bool doGET(const std::string &uri, std::string &response); + bool doPOST(const std::string &uri, const nlohmann::json &j, std::string &reponse); + + void evRequest(anna::comm::ClientSocket&, const anna::http::Request& request) throw(anna::RuntimeException); + void evResponse(anna::comm::ClientSocket&, const anna::http::Response&) throw(anna::RuntimeException) {;} +}; + +#endif +