Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

ipcmessage.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile: ipcmessage.h,v $
00003                              -------------------
00004     cvs         : $Id: ipcmessage.h,v 1.6 2003/05/08 12:26:37 aquamaniac Exp $
00005     begin       : Fri Oct 11 2002
00006     copyright   : (C) 2002 by Martin Preuss
00007     email       : martin@libchipcard.de
00008 
00009  ***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU Lesser General Public            *
00013  *   License as published by the Free Software Foundation; either          *
00014  *   version 2.1 of the License, or (at your option) any later version.    *
00015  *                                                                         *
00016  *   This library is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00019  *   Lesser General Public License for more details.                       *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU Lesser General Public      *
00022  *   License along with this library; if not, write to the Free Software   *
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
00024  *   MA  02111-1307  USA                                                   *
00025  *                                                                         *
00026  ***************************************************************************/
00027 
00028 
00029 #ifndef IPCMESSAGE_H
00030 #define IPCMESSAGE_H
00031 
00032 #include "chameleon/error.h"
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 #define IPCMESSAGE_HEADERSIZE 2
00039 
00040 #define IPCMESSAGE_MAXMSGSIZE 4096
00041 
00042 #define IPCMESSAGE_ERROR_TYPE              "IPC"
00043 #define IPCMESSAGE_ERROR_COMMAND_END         1
00044 #define IPCMESSAGE_ERROR_COMMAND_FULL        2
00045 #define IPCMESSAGE_ERROR_COMMAND_EMPTY       3
00046 #define IPCMESSAGE_ERROR_COMMAND_CORRUPTED   4
00047 #define IPCMESSAGE_ERROR_COMMAND_TOO_BIG     5
00048 #define IPCMESSAGE_ERROR_BAD_MESSAGE         6
00049 #define IPCMESSAGE_ERROR_NO_MESSAGE          7
00050 #define IPCMESSAGE_ERROR_NO_MESSAGELAYER     8
00051 #define IPCMESSAGE_ERROR_BUFFER_TOO_SMALL    9
00052 #define IPCMESSAGE_ERROR_NO_TRANSPORTLAYER   10
00053 #define IPCMESSAGE_ERROR_NO_SOCKETNAME       11
00054 
00055 struct IPCMESSAGESTRUCT;
00056 
00057 
00058 CHIPCARD_API struct IPCMESSAGESTRUCT {
00059   int ownPointer;
00060   char *ptr;
00061   int bsize;
00062   int size;
00063   int pos;
00064   struct IPCMESSAGESTRUCT *next;
00065 };
00066 
00067 CHIPCARD_API typedef struct IPCMESSAGESTRUCT IPCMESSAGE;
00068 
00069 
00070 CHIPCARD_API ERRORCODE IPCMessage_ModuleInit();
00071 CHIPCARD_API ERRORCODE IPCMessage_ModuleFini();
00072 
00073 
00074 CHIPCARD_API IPCMESSAGE *IPCMessage_new();
00075 CHIPCARD_API void IPCMessage_free(IPCMESSAGE *cmd);
00076 
00077 
00082 CHIPCARD_API ERRORCODE IPCMessage_SetBuffer(IPCMESSAGE *cmd,
00083                                             char *ptr,
00084                                             int size);
00085 
00089 CHIPCARD_API ERRORCODE IPCMessage_UseBuffer(IPCMESSAGE *cmd,
00090                                             char *ptr,
00091                                             int size);
00092 
00093 CHIPCARD_API ERRORCODE IPCMessage_GetBuffer(const IPCMESSAGE *cmd,
00094                                             const char **ptr,
00095                                             int *size);
00096 
00097 CHIPCARD_API const char *IPCMessage_GetMessageBegin(IPCMESSAGE *cmd);
00098 
00099 CHIPCARD_API int IPCMessage_GetMessageSize(IPCMESSAGE *cmd);
00100 
00101 
00102 CHIPCARD_API ERRORCODE IPCMessage_FirstParameter(IPCMESSAGE *cmd,
00103                                                  char **ptr,
00104                                                  int *size);
00105 CHIPCARD_API ERRORCODE IPCMessage_FirstIntParameter(IPCMESSAGE *cmd,
00106                                                     int *param);
00107 CHIPCARD_API ERRORCODE IPCMessage_FirstStringParameter(IPCMESSAGE *cmd,
00108                                                        char **param);
00109 
00110 CHIPCARD_API ERRORCODE IPCMessage_NextParameter(IPCMESSAGE *cmd,
00111                                                 char **ptr,
00112                                                 int *size);
00113 CHIPCARD_API ERRORCODE IPCMessage_NextIntParameter(IPCMESSAGE *cmd,
00114                                                    int *param);
00115 CHIPCARD_API ERRORCODE IPCMessage_NextStringParameter(IPCMESSAGE *cmd,
00116                                                       char **param);
00117 CHIPCARD_API ERRORCODE IPCMessage_Parameter(IPCMESSAGE *cmd,
00118                                             int idx,
00119                                             char **ptr,
00120                                             int *size);
00121 CHIPCARD_API ERRORCODE IPCMessage_IntParameter(IPCMESSAGE *cmd,
00122                                                int idx,
00123                                                int *param);
00124 CHIPCARD_API ERRORCODE IPCMessage_StringParameter(IPCMESSAGE *cmd,
00125                                                   int idx,
00126                                                   char **param);
00127 
00128 
00129 CHIPCARD_API ERRORCODE IPCMessage_AddParameter(IPCMESSAGE *cmd,
00130                                                const char *ptr,
00131                                                int size);
00132 CHIPCARD_API ERRORCODE IPCMessage_AddIntParameter(IPCMESSAGE *cmd,
00133                                                   int param);
00134 CHIPCARD_API ERRORCODE IPCMessage_AddStringParameter(IPCMESSAGE *cmd,
00135                                                      const char *param);
00136 
00137 
00138 CHIPCARD_API ERRORCODE IPCMessage_BuildMessage(IPCMESSAGE *cmd);
00139 
00140 
00141 CHIPCARD_API void IPCMessage_AddMessage(IPCMESSAGE *cmd, IPCMESSAGE **head);
00142 CHIPCARD_API void IPCMessage_RemoveMessage(IPCMESSAGE *cmd, IPCMESSAGE **head);
00143 
00144 
00145 
00146 #ifdef __cplusplus
00147 }
00148 #endif
00149 
00150 #endif
00151 
00152 
00153 

Generated on Mon Jun 6 18:17:40 2005 for libchipcard by  doxygen 1.4.2