📄 hsmsd_cli.cpp
字号:
/* * (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/>. */#include "hsmsd_cnx_proxy.h"#include "hsmsd_cli.h"using namespace freesecs;int hsmsd_alloc_handle (hsmsd_handle_t *ph, const char *cnx_name){ try { *ph = (hsmsd_handle_t) new hsmsd_proxy_t(cnx_name); } catch(...) { return -1; } return 0;}int hsmsd_free_handle (hsmsd_handle_t h){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; delete cp; return 0;}int hsmsd_subscribe_for_msgs (hsmsd_handle_t h, hsmsd_msg_handler_t mh){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; return cp->set_msg_handler(mh);}int hsmsd_unsubscribe_for_msgs (hsmsd_handle_t h){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; return cp->set_msg_handler(NULL);}int hsmsd_subscribe_for_cnx_state (hsmsd_handle_t h, hsmsd_cnx_state_handler_t sh){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; return cp->set_cnx_state_handler(sh);}int hsmsd_unsubscribe_for_cnx_state (hsmsd_handle_t h){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; return cp->set_cnx_state_handler(NULL);}int hsmsd_subscribe_for_cnx_error (hsmsd_handle_t h, hsmsd_cnx_error_handler_t eh){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; return cp->set_cnx_error_handler(eh);}int hsmsd_unsubscribe_for_cnx_error (hsmsd_handle_t h){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; return cp->set_cnx_error_handler(NULL);}int hsmsd_cnx_start (hsmsd_handle_t h){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; return cp->start();}int hsmsd_cnx_stop (hsmsd_handle_t h){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; return cp->stop();}int hsmsd_cnx_get_state (hsmsd_handle_t h, hsmsd_cnx_state_t *pstate){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; return cp->get_state(pstate);}int hsmsd_cnx_send_msg (hsmsd_handle_t h, hsmsd_msg_t *pmsg){ hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h; return cp->send_msg(pmsg);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -