Loading src/Server.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ #include <boost/lexical_cast.hpp> #include <google/protobuf/stubs/common.h> namespace MetadataExporter_ns { Loading @@ -15,6 +17,8 @@ Server::Server(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_ { DEBUG_STREAM << "Server::Server()" << endl; GOOGLE_PROTOBUF_VERIFY_VERSION; m_ioService_sp.reset(new boost::asio::io_service); m_work_sp.reset(new boost::asio::io_service::work(*m_ioService_sp)); Loading @@ -41,6 +45,8 @@ Server::~Server() m_threadGroup_sp->join_all(); } google::protobuf::ShutdownProtobufLibrary(); } //============================================================================== Loading src/Session.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -21,4 +21,29 @@ Session::~Session() DEBUG_STREAM << "Session::~Session()" << endl; } //============================================================================== // Session::prepareResponse() //============================================================================== Session::ResponseSP Session::prepareResponse(Session::RequestSP request) { DEBUG_STREAM << "Client::prepareResponse()" << endl; ResponseSP response_sp(new Response()); switch(request->type()) { case Request::AUTHORIZATION: break; case Request::METADATA: break; default: ERROR_STREAM << "BAD REQUEST " << endl; //TODO: bad request case break; } return response_sp; } } //namespace src/Session.h +14 −4 Original line number Diff line number Diff line Loading @@ -7,19 +7,27 @@ #include <boost/array.hpp> #include <boost/shared_ptr.hpp> #include <Response.pb.h> #include <Request.pb.h> namespace MetadataExporter_ns { class Session : public Tango::LogAdapter { public: public: //TODO: buffer //------------------------------------------------------------------------------ // [Public] Shared pointer typedef // [Public] Buffer shared pointer typedef //------------------------------------------------------------------------------ typedef boost::array< char, 256 > Buffer; typedef boost::shared_ptr< Buffer > BufferSP; //------------------------------------------------------------------------------ // [Public] Request Response shared pointer typedef //------------------------------------------------------------------------------ typedef boost::shared_ptr<Request> RequestSP; typedef boost::shared_ptr<Response> ResponseSP; //------------------------------------------------------------------------------ // [Public] Shared pointer typedef //------------------------------------------------------------------------------ Loading Loading @@ -50,6 +58,8 @@ protected: virtual void handleResponse(const boost::system::error_code&, std::size_t) = 0; virtual ResponseSP prepareResponse(RequestSP); //------------------------------------------------------------------------------ // [Protected] Class variables //------------------------------------------------------------------------------ Loading Loading
src/Server.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ #include <boost/lexical_cast.hpp> #include <google/protobuf/stubs/common.h> namespace MetadataExporter_ns { Loading @@ -15,6 +17,8 @@ Server::Server(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_ { DEBUG_STREAM << "Server::Server()" << endl; GOOGLE_PROTOBUF_VERIFY_VERSION; m_ioService_sp.reset(new boost::asio::io_service); m_work_sp.reset(new boost::asio::io_service::work(*m_ioService_sp)); Loading @@ -41,6 +45,8 @@ Server::~Server() m_threadGroup_sp->join_all(); } google::protobuf::ShutdownProtobufLibrary(); } //============================================================================== Loading
src/Session.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -21,4 +21,29 @@ Session::~Session() DEBUG_STREAM << "Session::~Session()" << endl; } //============================================================================== // Session::prepareResponse() //============================================================================== Session::ResponseSP Session::prepareResponse(Session::RequestSP request) { DEBUG_STREAM << "Client::prepareResponse()" << endl; ResponseSP response_sp(new Response()); switch(request->type()) { case Request::AUTHORIZATION: break; case Request::METADATA: break; default: ERROR_STREAM << "BAD REQUEST " << endl; //TODO: bad request case break; } return response_sp; } } //namespace
src/Session.h +14 −4 Original line number Diff line number Diff line Loading @@ -7,19 +7,27 @@ #include <boost/array.hpp> #include <boost/shared_ptr.hpp> #include <Response.pb.h> #include <Request.pb.h> namespace MetadataExporter_ns { class Session : public Tango::LogAdapter { public: public: //TODO: buffer //------------------------------------------------------------------------------ // [Public] Shared pointer typedef // [Public] Buffer shared pointer typedef //------------------------------------------------------------------------------ typedef boost::array< char, 256 > Buffer; typedef boost::shared_ptr< Buffer > BufferSP; //------------------------------------------------------------------------------ // [Public] Request Response shared pointer typedef //------------------------------------------------------------------------------ typedef boost::shared_ptr<Request> RequestSP; typedef boost::shared_ptr<Response> ResponseSP; //------------------------------------------------------------------------------ // [Public] Shared pointer typedef //------------------------------------------------------------------------------ Loading Loading @@ -50,6 +58,8 @@ protected: virtual void handleResponse(const boost::system::error_code&, std::size_t) = 0; virtual ResponseSP prepareResponse(RequestSP); //------------------------------------------------------------------------------ // [Protected] Class variables //------------------------------------------------------------------------------ Loading