⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user_agent.h

📁 与secs相关的hsms协议
💻 H
字号:
/*    *   (c) Copyright 2008 Philipp Skadorov (philipp_s@users.sourceforge.net) * *   This file is part of FREESECS. * *   FREESECS is free software: you can redistribute it and/or modify *   it under the terms of the GNU General Public License as published by *   the Free Software Foundation, either version 3 of the License, or *   (at your option) any later version. * *   FREESECS is distributed in the hope that it will be useful, *   but WITHOUT ANY WARRANTY; without even the implied warranty of *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *   GNU General Public License for more details. * *   You should have received a copy of the GNU General Public License *   along with FREESECS, see COPYING. *   If not, see <http://www.gnu.org/licenses/>. */#ifndef _USER_AGENT_H#define _USER_AGENT_H#include <string>#include <pthread.h>#include "shared_ptr.h"#include "hsms_cnx.h"#include "async_reception.h"#include "hsmsd_interface.h"namespace freesecs{    /**     * \brief Processes request data from the client     */    class ua_req_handler_t    {    public:        ua_req_handler_t();        virtual ~ua_req_handler_t(){};        void process_ctl(hsmsd_client_req_t&, size_t);        void process_data(hsmsd_client_req_t&, size_t);    protected:        virtual void rcv_from_ctl(void *buf, size_t count) = 0;        virtual void rcv_from_data(void *buf, size_t count) = 0;        virtual void send_msg(hsms_cnx_t::pdata_t) = 0;        virtual void start_cnx() = 0;        virtual void stop_cnx() = 0;        virtual void get_cnx_state() = 0;    private:        hsms_cnx_t::pdata_t _pmsg;        int _msg_len;        int _nb_received;        int _data_state;    };    /**     * \brief User agent for the HSMS daemon client     * Processes requests from the client and is a mediator     * between the client and HSMS connection instance.     * \see      */    class user_agent_t : public ua_req_handler_t    {    public:        typedef shared_ptr_t<hsms_cnx_t> pcnx_t;    public:        user_agent_t(   const char *ctl_in_fifo_name,                         const char *ctl_out_fifo_name,                         const char *data_in_fifo_name,                         const char *data_out_fifo_name,                         pcnx_t pcnx);        virtual ~user_agent_t();    public:        /*user data handlers*/        int user_ctl_handler(const size_t&);        int user_data_handler(const size_t&);        int user_error_handler(const int&);        /*cnx data handlers*/        int cnx_ctl_handler(const hsms_socket_t::pdata_t&);        int cnx_data_handler(const hsms_socket_t::pdata_t&);        int cnx_state_handler(const hsms_state_et&);    protected:    /*ua_req_handler_t iface*/        virtual void rcv_from_ctl(void *buf, size_t count);        virtual void rcv_from_data(void *buf, size_t count);        virtual void send_msg(hsms_cnx_t::pdata_t);        virtual void start_cnx();        virtual void stop_cnx();        virtual void get_cnx_state();    private:        pcnx_t                          _pcnx;    private:        int                             _fd_ctl_in;        int                             _fd_ctl_out;        int                             _fd_data_in;        int                             _fd_data_out;        shared_ptr_t<async_reception_t> _ar_ctl;        shared_ptr_t<async_reception_t> _ar_data;    private:        hsmsd_client_req_t     _client_ctl_req;        hsmsd_client_req_t     _client_data_req;    };}//namespace#endif /*_USER_AGENT_H*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -