hsmsd_cli.cpp

00001 /*   
00002  *   (c) Copyright 2008 Philipp Skadorov (philipp_s@users.sourceforge.net)
00003  *
00004  *   This file is part of FREESECS.
00005  *
00006  *   FREESECS is free software: you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation, either version 3 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   FREESECS is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with FREESECS, see COPYING.
00018  *   If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 #include "hsmsd_cnx_proxy.h"
00021 #include "hsmsd_cli.h"
00022 
00023 using namespace freesecs;
00024 
00025 int hsmsd_alloc_handle              (hsmsd_handle_t *ph, const char *cnx_name)
00026 {
00027     try
00028     {
00029         *ph = (hsmsd_handle_t) new hsmsd_proxy_t(cnx_name);
00030     }
00031     catch(...)
00032     {
00033         return -1;
00034     }
00035     return 0;
00036 }
00037 
00038 int hsmsd_free_handle               (hsmsd_handle_t h)
00039 {
00040     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00041     delete cp;
00042     return 0;
00043 }
00044 
00045 int hsmsd_subscribe_for_msgs        (hsmsd_handle_t h, hsmsd_msg_handler_t mh)
00046 {
00047     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00048     return cp->set_msg_handler(mh);
00049 }
00050 
00051 int hsmsd_unsubscribe_for_msgs      (hsmsd_handle_t h)
00052 {
00053     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00054     return cp->set_msg_handler(NULL);
00055 }
00056 
00057 int hsmsd_subscribe_for_cnx_state   (hsmsd_handle_t h, hsmsd_cnx_state_handler_t sh)
00058 {
00059     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00060     return cp->set_cnx_state_handler(sh);
00061 }
00062 
00063 int hsmsd_unsubscribe_for_cnx_state (hsmsd_handle_t h)
00064 {
00065     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00066     return cp->set_cnx_state_handler(NULL);
00067 }
00068 
00069 int hsmsd_subscribe_for_cnx_error   (hsmsd_handle_t h, hsmsd_cnx_error_handler_t eh)
00070 {
00071     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00072     return cp->set_cnx_error_handler(eh);
00073 }
00074 
00075 int hsmsd_unsubscribe_for_cnx_error (hsmsd_handle_t h)
00076 {
00077     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00078     return cp->set_cnx_error_handler(NULL);
00079 }
00080 
00081 int hsmsd_cnx_start                 (hsmsd_handle_t h)
00082 {
00083     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00084     return cp->start();
00085 }
00086 
00087 int hsmsd_cnx_stop                  (hsmsd_handle_t h)
00088 {
00089     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00090     return cp->stop();
00091 }
00092 
00093 int hsmsd_cnx_get_state             (hsmsd_handle_t h, hsmsd_cnx_state_t *pstate)
00094 {
00095     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00096     return cp->get_state(pstate);
00097 }
00098 
00099 int hsmsd_cnx_send_msg              (hsmsd_handle_t h, hsmsd_msg_t *pmsg)
00100 {
00101     hsmsd_proxy_t *cp = (hsmsd_proxy_t*)h;
00102     return cp->send_msg(pmsg);
00103 }

Generated on Fri Oct 3 15:30:01 2008 for FREESECS hsms by  doxygen 1.5.1