hsmsd_interface.h

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 #ifndef _MESSAGES_H
00021 #define _MESSAGES_H
00022 #include <sys/types.h>
00023 
00024 #define HSMSD_FIFO_DIR "/var/run/hsmsd"
00025 
00026 #define HSMSD_REGISTER_FIFO         HSMSD_FIFO_DIR"/hsmsd"
00027 #define HSMSD_REGISTER_FIFO_IN      HSMSD_REGISTER_FIFO".in"
00028 #define HSMSD_REGISTER_FIFO_OUT     HSMSD_REGISTER_FIFO".out"
00029 
00030 #define HSMSD_CLIENT_FIFO_PATTERN HSMSD_FIFO_DIR"/%d"
00031 
00032 #define HSMSD_CLIENT_FIFO_CTL_IN_PATTERN HSMSD_CLIENT_FIFO_PATTERN"_%u.ctl.in"
00033 
00034 #define HSMSD_CLIENT_FIFO_CTL_OUT_PATTERN HSMSD_CLIENT_FIFO_PATTERN"_%u.ctl.out"
00035 
00036 #define HSMSD_CLIENT_FIFO_DATA_IN_PATTERN HSMSD_CLIENT_FIFO_PATTERN"_%u.data.in"
00037 
00038 #define HSMSD_CLIENT_FIFO_DATA_OUT_PATTERN HSMSD_CLIENT_FIFO_PATTERN"_%u.data.out"
00039 
00040 #define HSMS_NAME_MAX_LEN 128
00041 
00048 typedef struct
00049 {
00050     pid_t cli_pid;
00051     char cnx_name[HSMS_NAME_MAX_LEN];
00052 }hsmsd_register_req_t;
00053 
00068 typedef struct
00069 {
00070     enum
00071     {
00073         REG_OK = 0,
00078         REG_INVALID_NAME,
00084         REG_INVALID_PID,
00089         REG_ALREADY_REGISTERED,
00094         REG_ERR_NOMEM
00095     } rsp_code;
00096     char pipe_name_ctl_req[HSMS_NAME_MAX_LEN];
00097     char pipe_name_ctl_rsp[HSMS_NAME_MAX_LEN];
00098     char pipe_name_data_req[HSMS_NAME_MAX_LEN];
00099     char pipe_name_data_rsp[HSMS_NAME_MAX_LEN];
00100 }hsmsd_register_rsp_t;
00101 
00105 typedef struct
00106 {
00107     unsigned short  stream;
00108     unsigned short  function;
00109     unsigned char   wbit;
00110     unsigned int    sysbytes;
00111     unsigned int    data_len;
00112 }msg_header_t;
00113 
00117 typedef struct
00118 {
00119     enum
00120     {
00121         CNX_START,
00122         CNX_STOP,
00123         CNX_STATE,
00124         MSG_SEND
00125     }type;
00126 
00127     union
00128     {
00129         msg_header_t msg_header;
00130     }u;
00131 
00132 }hsmsd_client_req_t;
00133 
00137 typedef struct 
00138 {
00139     typedef enum
00140     {
00141         CNX_NOT_CONNECTED=0,
00142         CNX_NOT_SELECTED,
00143         CNX_SELECTED
00144     }cnx_state_t;
00145 
00146     enum
00147     {
00148         CNX_START=0,
00149         CNX_STOP,
00150         CNX_STATE_RSP,
00151         CNX_STATE_EVT,
00152         CNX_ERROR_EVT,
00153         MSG_SEND,
00154         MSG_RECV,
00155         MAX_RSP_TYPE
00156     }type;
00157 
00158     union
00159     {
00160         int req_status;
00161 
00162         int cnx_error;
00163     
00164         msg_header_t msg_header;
00165 
00166         cnx_state_t cnx_state;
00167     }u;
00168 } hsmsd_server_rsp_t;
00169 
00170 #endif /*_MESSAGES_H*/

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