# msgengine.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: msgengine.h,v $
    00003  -------------------
    00004  cvs         : $Id: msgengine.h,v 1.26 2004/08/09 13:13:58 cstim Exp $
    00005  begin       : Fri Jul 04 2003
    00006  copyright   : (C) 2003 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 #ifndef GWENHYWFAR_MSGENGINE_H
    00029 #define GWENHYWFAR_MSGENGINE_H
    00030
    00031 #include <gwenhywfar/gwenhywfarapi.h>
    00032 #include <gwenhywfar/xml.h>
    00033 #include <gwenhywfar/db.h>
    00034 #include <gwenhywfar/buffer.h>
    00035
    00036 #ifdef __cplusplus
    00037 extern "C" {
    00038 #endif
    00039
    00047
    00052 typedef struct GWEN_MSGENGINE_TRUSTEDDATA GWEN_MSGENGINE_TRUSTEDDATA;
    00053
    00054 typedef enum {
    00055   GWEN_MsgEngineTrustLevelNone=0,
    00056   GWEN_MsgEngineTrustLevelLow,
    00057   GWEN_MsgEngineTrustLevelMedium,
    00058   GWEN_MsgEngineTrustLevelHigh,
    00059   GWEN_MsgEngineTrustLevelFull
    00060 } GWEN_MSGENGINE_TRUSTLEVEL;
    00061
    00062
    00063 GWENHYWFAR_API
    00064 GWEN_MSGENGINE_TRUSTEDDATA*
    00065   GWEN_MsgEngine_TrustedData_new(const char *data,
    00066                                  unsigned int size,
    00067                                  const char *description,
    00068                                  GWEN_MSGENGINE_TRUSTLEVEL trustLevel);
    00069 GWENHYWFAR_API
    00070 void GWEN_MsgEngine_TrustedData_free(GWEN_MSGENGINE_TRUSTEDDATA *td);
    00071
    00072 GWENHYWFAR_API
    00073 GWEN_MSGENGINE_TRUSTEDDATA*
    00074   GWEN_MsgEngine_TrustedData_GetNext(GWEN_MSGENGINE_TRUSTEDDATA *td);
    00075
    00076 GWENHYWFAR_API
    00077 const char*
    00078   GWEN_MsgEngine_TrustedData_GetData(GWEN_MSGENGINE_TRUSTEDDATA *td);
    00079
    00080 GWENHYWFAR_API
    00081 unsigned int
    00082   GWEN_MsgEngine_TrustedData_GetSize(GWEN_MSGENGINE_TRUSTEDDATA *td);
    00083
    00084 GWENHYWFAR_API
    00085 const char*
    00086   GWEN_MsgEngine_TrustedData_GetDescription(GWEN_MSGENGINE_TRUSTEDDATA *td);
    00087
    00088 GWENHYWFAR_API
    00089 GWEN_MSGENGINE_TRUSTLEVEL
    00090   GWEN_MsgEngine_TrustedData_GetTrustLevel(GWEN_MSGENGINE_TRUSTEDDATA *td);
    00091
    00092 GWENHYWFAR_API
    00093 const char*
    00094   GWEN_MsgEngine_TrustedData_GetReplacement(GWEN_MSGENGINE_TRUSTEDDATA *td);
    00095
    00096
    00097 GWENHYWFAR_API
    00098 int GWEN_MsgEngine_TrustedData_AddPos(GWEN_MSGENGINE_TRUSTEDDATA *td,
    00099                                       unsigned int pos);
    00100
    00101 GWENHYWFAR_API
    00102 int GWEN_MsgEngine_TrustedData_GetFirstPos(GWEN_MSGENGINE_TRUSTEDDATA *td);
    00103
    00104 GWENHYWFAR_API
    00105 int GWEN_MsgEngine_TrustedData_GetNextPos(GWEN_MSGENGINE_TRUSTEDDATA *td);
    00106
    00107 GWENHYWFAR_API
    00108 int
    00109   GWEN_MsgEngine_TrustedData_CreateReplacements(GWEN_MSGENGINE_TRUSTEDDATA
    00110                                                 *td); /* defgroup */
    00112
    00113
    00114
    00115 #define GWEN_MSGENGINE_SHOW_FLAGS_NOSET 0x0001
    00116 #define GWEN_MSGENGINE_MAX_VALUE_LEN    8192
    00117
    00121 #define GWEN_MSGENGINE_READ_FLAGS_TRUSTINFO 0x0001
    00122 #define GWEN_MSGENGINE_READ_FLAGS_DEFAULT 0
    00123
    00130
    00131 typedef struct GWEN__MSGENGINE GWEN_MSGENGINE;
    00132
    00133 GWEN_INHERIT_FUNCTION_LIB_DEFS(GWEN_MSGENGINE, GWENHYWFAR_API)
    00134
    00135
    00136
    00143 typedef int (*GWEN_MSGENGINE_TYPEREAD_PTR)(GWEN_MSGENGINE *e,
    00144                                            GWEN_BUFFER *msgbuf,
    00145                                            GWEN_XMLNODE *node,
    00146                                            GWEN_BUFFER *vbuf,
    00147                                            char escapeChar,
    00148                                            const char *delimiters);
    00149
    00153 typedef int (*GWEN_MSGENGINE_TYPEWRITE_PTR)(GWEN_MSGENGINE *e,
    00154                                             GWEN_BUFFER *gbuf,
    00155                                             GWEN_BUFFER *data,
    00156                                             GWEN_XMLNODE *node);
    00157
    00161 typedef GWEN_DB_VALUETYPE (*GWEN_MSGENGINE_TYPECHECK_PTR)(GWEN_MSGENGINE *e,
    00162                                                           const char *tname);
    00163
    00164 typedef int (*GWEN_MSGENGINE_BINTYPEREAD_PTR)(GWEN_MSGENGINE *e,
    00165                                               GWEN_XMLNODE *node,
    00166                                               GWEN_DB_NODE *gr,
    00167                                               GWEN_BUFFER *vbuf);
    00168
    00169 typedef int (*GWEN_MSGENGINE_BINTYPEWRITE_PTR)(GWEN_MSGENGINE *e,
    00170                                                GWEN_XMLNODE *node,
    00171                                                GWEN_DB_NODE *gr,
    00172                                                GWEN_BUFFER *dbuf);
    00173
    00177 typedef const char* (*GWEN_MSGENGINE_GETCHARVALUE_PTR)(GWEN_MSGENGINE *e,
    00178                                                          const char *name,
    00179                                                          const char *defValue);
    00180 typedef int (*GWEN_MSGENGINE_GETINTVALUE_PTR)(GWEN_MSGENGINE *e,
    00181                                                 const char *name,
    00182                                                 int defValue);
    00183
    00184 typedef GWEN_DB_NODE*
    00185   (*GWEN_MSGENGINE_GETGLOBALVALUES_PTR)(GWEN_MSGENGINE *e);
    00186
    00187 typedef void (*GWEN_MSGENGINE_FREEDATA_PTR)(GWEN_MSGENGINE *e);
    00188
    00196 GWENHYWFAR_API
    00197 GWEN_MSGENGINE *GWEN_MsgEngine_new();
    00198 GWENHYWFAR_API
    00199 void GWEN_MsgEngine_free(GWEN_MSGENGINE *e);
    00200
    00201 GWENHYWFAR_API
    00202 void GWEN_MsgEngine_Attach(GWEN_MSGENGINE *e);
    00209 GWENHYWFAR_API
    00210 void GWEN_MsgEngine_SetEscapeChar(GWEN_MSGENGINE *e, char c);
    00211 GWENHYWFAR_API
    00212 char GWEN_MsgEngine_GetEscapeChar(GWEN_MSGENGINE *e);
    00213
    00214 GWENHYWFAR_API
    00215 void GWEN_MsgEngine_SetCharsToEscape(GWEN_MSGENGINE *e, const char *c);
    00216 GWENHYWFAR_API
    00217 const char *GWEN_MsgEngine_GetCharsToEscape(GWEN_MSGENGINE *e);
    00218
    00219 GWENHYWFAR_API
    00220 void GWEN_MsgEngine_SetDelimiters(GWEN_MSGENGINE *e, const char *s);
    00221 GWENHYWFAR_API
    00222 const char *GWEN_MsgEngine_GetDelimiters(GWEN_MSGENGINE *e);
    00223
    00224 GWENHYWFAR_API
    00225 void GWEN_MsgEngine_SetMode(GWEN_MSGENGINE *e, const char *mode);
    00226 GWENHYWFAR_API
    00227 const char *GWEN_MsgEngine_GetMode(GWEN_MSGENGINE *e);
    00228
    00229
    00230 GWENHYWFAR_API
    00231 unsigned int GWEN_MsgEngine_GetProtocolVersion(GWEN_MSGENGINE *e);
    00232 GWENHYWFAR_API
    00233 void GWEN_MsgEngine_SetProtocolVersion(GWEN_MSGENGINE *e,
    00234                                        unsigned int p);
    00235
    00236
    00237 GWENHYWFAR_API
    00238   GWEN_XMLNODE *GWEN_MsgEngine_GetDefinitions(GWEN_MSGENGINE *e);
    00239
    00246 GWENHYWFAR_API
    00247 void GWEN_MsgEngine_SetDefinitions(GWEN_MSGENGINE *e,
    00248                                    GWEN_XMLNODE *n,
    00249                                    int take);
    00250
    00251 GWENHYWFAR_API
    00252 int GWEN_MsgEngine_AddDefinitions(GWEN_MSGENGINE *e,
    00253                                   GWEN_XMLNODE *node);
    00261 GWENHYWFAR_API
    00262 void GWEN_MsgEngine_SetTypeReadFunction(GWEN_MSGENGINE *e,
    00263                                         GWEN_MSGENGINE_TYPEREAD_PTR p);
    00264 GWENHYWFAR_API
    00265 GWEN_MSGENGINE_TYPEREAD_PTR
    00266   GWEN_MsgEngine_GetTypeReadFunction(GWEN_MSGENGINE *e);
    00267
    00268 GWENHYWFAR_API
    00269 void GWEN_MsgEngine_SetTypeWriteFunction(GWEN_MSGENGINE *e,
    00270                                          GWEN_MSGENGINE_TYPEWRITE_PTR p);
    00271 GWENHYWFAR_API
    00272 GWEN_MSGENGINE_TYPEWRITE_PTR
    00273   GWEN_MsgEngine_GetTypeWriteFunction(GWEN_MSGENGINE *e);
    00274
    00275 GWENHYWFAR_API
    00276 void GWEN_MsgEngine_SetTypeCheckFunction(GWEN_MSGENGINE *e,
    00277                                          GWEN_MSGENGINE_TYPECHECK_PTR p);
    00278 GWENHYWFAR_API
    00279 GWEN_MSGENGINE_TYPECHECK_PTR
    00280 GWEN_MsgEngine_GetTypeCheckFunction(GWEN_MSGENGINE *e);
    00281
    00282 GWENHYWFAR_API void
    00283   GWEN_MsgEngine_SetGetGlobalValuesFunction(GWEN_MSGENGINE *e,
    00284                                             GWEN_MSGENGINE_GETGLOBALVALUES_PTR p);
    00285
    00286 GWENHYWFAR_API
    00287   GWEN_MSGENGINE_GETGLOBALVALUES_PTR
    00288   GWEN_MsgEngine_GetGetGlobalValuesFunction(GWEN_MSGENGINE *e);
    00289  /* Extending Data Type Handling */
    00291
    00292
    00297 GWENHYWFAR_API
    00298 void GWEN_MsgEngine_SetBinTypeReadFunction(GWEN_MSGENGINE *e,
    00299                                            GWEN_MSGENGINE_BINTYPEREAD_PTR p);
    00300 GWENHYWFAR_API
    00301 GWEN_MSGENGINE_BINTYPEREAD_PTR
    00302   GWEN_MsgEngine_GetBinTypeReadFunction(GWEN_MSGENGINE *e);
    00303
    00304 GWENHYWFAR_API
    00305 void GWEN_MsgEngine_SetBinTypeWriteFunction(GWEN_MSGENGINE *e,
    00306                                             GWEN_MSGENGINE_BINTYPEWRITE_PTR p);
    00307 GWENHYWFAR_API
    00308 GWEN_MSGENGINE_BINTYPEWRITE_PTR
    00309   GWEN_MsgEngine_GetBinTypeWriteFunction(GWEN_MSGENGINE *e);  /* Extending Binary Data Handling */
    00311
    00312
    00317 GWENHYWFAR_API
    00318 void GWEN_MsgEngine_SetGetCharValueFunction(GWEN_MSGENGINE *e,
    00319                                             GWEN_MSGENGINE_GETCHARVALUE_PTR p);
    00320 GWENHYWFAR_API
    00321 void GWEN_MsgEngine_SetGetIntValueFunction(GWEN_MSGENGINE *e,
    00322                                            GWEN_MSGENGINE_GETINTVALUE_PTR p);  /* Getting variables */
    00324
    00325
    00331 GWENHYWFAR_API
    00332 void *GWEN_MsgEngine_GetInheritorData(const GWEN_MSGENGINE *e);
    00333 GWENHYWFAR_API
    00334 void GWEN_MsgEngine_SetInheritorData(GWEN_MSGENGINE *e, void *d);
    00335 GWENHYWFAR_API
    00336 void GWEN_MsgEngine_SetFreeDataFunction(GWEN_MSGENGINE *e,
    00337                                         GWEN_MSGENGINE_FREEDATA_PTR p);
    00338
    00345 GWENHYWFAR_API
    00346 GWEN_XMLNODE *GWEN_MsgEngine_FindGroupByProperty(GWEN_MSGENGINE *e,
    00347                                                  const char *pname,
    00348                                                  int version,
    00349                                                  const char *pvalue);
    00350
    00356 GWENHYWFAR_API
    00357 GWEN_XMLNODE *GWEN_MsgEngine_FindNodeByProperty(GWEN_MSGENGINE *e,
    00358                                                 const char *t,
    00359                                                 const char *pname,
    00360                                                 int version,
    00361                                                 const char *pvalue);
    00367 GWENHYWFAR_API
    00368 const char *GWEN_MsgEngine_SearchForProperty(GWEN_XMLNODE *node,
    00369                                              GWEN_XMLNODE *refnode,
    00370                                              const char *name,
    00371                                              int topDown);
    00382 GWENHYWFAR_API
    00383 int GWEN_MsgEngine_SetValue(GWEN_MSGENGINE *e,
    00384                             const char *path,
    00385                             const char *value);
    00386 GWENHYWFAR_API
    00387 int GWEN_MsgEngine_SetIntValue(GWEN_MSGENGINE *e,
    00388                                const char *path,
    00389                                int value);
    00390 GWENHYWFAR_API
    00391 const char *GWEN_MsgEngine_GetValue(GWEN_MSGENGINE *e,
    00392                                const char *path,
    00393                                const char *defValue);
    00394 GWENHYWFAR_API
    00395 int GWEN_MsgEngine_GetIntValue(GWEN_MSGENGINE *e,
    00396                                const char *path,
    00397                                int defValue);
    00405 GWENHYWFAR_API
    00406 int GWEN_MsgEngine_CreateMessage(GWEN_MSGENGINE *e,
    00407                                  const char *msgName,
    00408                                  int msgVersion,
    00409                                  GWEN_BUFFER *gbuf,
    00410                                  GWEN_DB_NODE *msgData);
    00411
    00412 GWENHYWFAR_API
    00413 int GWEN_MsgEngine_CreateMessageFromNode(GWEN_MSGENGINE *e,
    00414                                          GWEN_XMLNODE *node,
    00415                                          GWEN_BUFFER *gbuf,
    00416                                          GWEN_DB_NODE *msgData);
    00417
    00421 GWENHYWFAR_API
    00422 int GWEN_MsgEngine_ShowMessage(GWEN_MSGENGINE *e,
    00423                                const char *typ,
    00424                                const char *msgName,
    00425                                int msgVersion,
    00426                                GWEN_TYPE_UINT32 flags);
    00427
    00435 GWENHYWFAR_API
    00436 int GWEN_MsgEngine_ParseMessage(GWEN_MSGENGINE *e,
    00437                                 GWEN_XMLNODE *group,
    00438                                 GWEN_BUFFER *msgbuf,
    00439                                 GWEN_DB_NODE *gr,
    00440                                 GWEN_TYPE_UINT32 flags);
    00441
    00452 GWENHYWFAR_API
    00453 int GWEN_MsgEngine_SkipSegment(GWEN_MSGENGINE *e,
    00454                                GWEN_BUFFER *msgbuf,
    00455                                unsigned char escapeChar,
    00456                                unsigned char delimiter);
    00457
    00495 GWENHYWFAR_API
    00496 int GWEN_MsgEngine_ReadMessage(GWEN_MSGENGINE *e,
    00497                                const char *gtype,
    00498                                GWEN_BUFFER *mbuf,
    00499                                GWEN_DB_NODE *gr,
    00500                                GWEN_TYPE_UINT32 flags);
    00501
    00507 GWENHYWFAR_API
    00508 GWEN_XMLNODE *GWEN_MsgEngine_ListMessage(GWEN_MSGENGINE *e,
    00509                                          const char *typ,
    00510                                          const char *msgName,
    00511                                          int msgVersion,
    00512                                          GWEN_TYPE_UINT32 flags);
    00526 GWENHYWFAR_API
    00527 GWEN_MSGENGINE_TRUSTEDDATA *GWEN_MsgEngine_TakeTrustInfo(GWEN_MSGENGINE *e);
    00528
    00529
    00533 GWENHYWFAR_API
    00534 int GWEN_MsgEngine_AddTrustInfo(GWEN_MSGENGINE *e,
    00535                                 const char *data,
    00536                                 unsigned int size,
    00537                                 const char *description,
    00538                                 GWEN_MSGENGINE_TRUSTLEVEL trustLevel,
    00539                                 unsigned int pos);
    00540  /* Handling Trust Information */ /* defgroup */ /* defgroup (yes, twice) */
    00544
    00545
    00546 #ifdef __cplusplus
    00547 }
    00548 #endif
    00549
    00550 #endif
    00551