#ifndef INCLUDE_SERVER_PROTOCOLFACADE_H_ #define INCLUDE_SERVER_PROTOCOLFACADE_H_ #include #include #include #include #include #include #include struct Message; class ProtocolFacade { public: /** * encode messages * @param msg message that need to be encoded * @param obuf pointer to buffer * @return succes or failure */ bool encode(const struct Message &msg, std::shared_ptr obuf); /** * decode messages * @param buf pointer to buffer * @param msg pointer to message that need to be decoded * @return succes or failure */ bool decode(std::shared_ptr buf, std::shared_ptr *msg); private: LowLevel __lowlevel; /** low level handle */ Di::Rpc::Reader __reader; /** RPC reader handle */ /** * Creates a reply message containing the current DI-Net time */ bool __createTimeReply(std::shared_ptr obuf); /** * send encrypted message * @param conn connection where message need to be send */ bool __messageEncrypted(void *conn); /** * send non-encrypted message * @param conn connection where message need to be send */ bool __messagePlain(void *conn); /** * send repky message * @param conn connection where reply need to be send * @param success */ bool __sendReply(void *conn, bool success); }; #endif // INCLUDE_SERVER_PROTOCOLFACADE_H_