gwenhywfar  5.11.1beta
msgengine.h
Go to the documentation of this file.
1 /***************************************************************************
2  $RCSfile$
3  -------------------
4  cvs : $Id$
5  begin : Fri Jul 04 2003
6  copyright : (C) 2003 by Martin Preuss
7  email : martin@libchipcard.de
8 
9  ***************************************************************************
10  * *
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU Lesser General Public *
13  * License as published by the Free Software Foundation; either *
14  * version 2.1 of the License, or (at your option) any later version. *
15  * *
16  * This library is distributed in the hope that it will be useful, *
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
19  * Lesser General Public License for more details. *
20  * *
21  * You should have received a copy of the GNU Lesser General Public *
22  * License along with this library; if not, write to the Free Software *
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
24  * MA 02111-1307 USA *
25  * *
26  ***************************************************************************/
27 
28 #ifndef GWENHYWFAR_MSGENGINE_H
29 #define GWENHYWFAR_MSGENGINE_H
30 
32 #include <gwenhywfar/xml.h>
33 #include <gwenhywfar/db.h>
34 #include <gwenhywfar/buffer.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
47 
53 
54 typedef enum {
61 
62 
66  unsigned int size,
67  const char *description,
68  GWEN_MSGENGINE_TRUSTLEVEL trustLevel);
71 
75 
77 const char *
79 
81 unsigned int
83 
85 const char *
87 
91 
93 const char *
95 
96 
99  unsigned int pos);
100 
103 
106 
108 int
110  *td); /* defgroup */
112 
113 
114 
115 #define GWEN_MSGENGINE_SHOW_FLAGS_NOSET 0x0001
116 #define GWEN_MSGENGINE_MAX_VALUE_LEN 8192
117 
121 #define GWEN_MSGENGINE_READ_FLAGS_TRUSTINFO 0x0001
122 #define GWEN_MSGENGINE_READ_FLAGS_DEFAULT 0
130 
131 typedef struct GWEN__MSGENGINE GWEN_MSGENGINE;
132 
134 
135 
136 
144  GWEN_BUFFER *msgbuf,
145  GWEN_XMLNODE *node,
146  GWEN_BUFFER *vbuf,
147  char escapeChar,
148  const char *delimiters);
149 
154  GWEN_BUFFER *gbuf,
155  GWEN_BUFFER *data,
156  GWEN_XMLNODE *node);
157 
162  const char *tname);
163 
165  GWEN_XMLNODE *node,
166  GWEN_DB_NODE *gr,
167  GWEN_BUFFER *vbuf);
168 
170  GWEN_XMLNODE *node,
171  GWEN_DB_NODE *gr,
172  GWEN_BUFFER *dbuf);
173 
178  const char *name,
179  const char *defValue);
181  const char *name,
182  int defValue);
183 
184 typedef GWEN_DB_NODE *
186 
188 
200 
213 
218 
223 
225 void GWEN_MsgEngine_SetMode(GWEN_MSGENGINE *e, const char *mode);
228 
229 
234  unsigned int p);
235 
236 
239 
248  GWEN_XMLNODE *n,
249  int take);
250 
253  GWEN_XMLNODE *node);
267 
274 
281 
282 GWENHYWFAR_API void
285 
289  /* Extending Data Type Handling */
291 
292 
303 
309 GWEN_MsgEngine_GetBinTypeWriteFunction(GWEN_MSGENGINE *e); /* Extending Binary Data Handling */
311 
312 
322  GWEN_MSGENGINE_GETINTVALUE_PTR p); /* Getting variables */
324 
325 
338 
347  const char *pname,
348  int version,
349  const char *pvalue);
350 
358  const char *t,
359  const char *pname,
360  int version,
361  const char *pvalue);
362 
365  const char *t,
366  const char *pname,
367  int version,
368  const char *pvalue);
369 
377  GWEN_XMLNODE *refnode,
378  const char *name,
379  int topDown);
392  const char *path,
393  const char *value);
396  const char *path,
397  int value);
400  const char *path,
401  const char *defValue);
404  const char *path,
405  int defValue);
415  const char *msgName,
416  int msgVersion,
417  GWEN_BUFFER *gbuf,
418  GWEN_DB_NODE *msgData);
419 
422  GWEN_XMLNODE *node,
423  GWEN_BUFFER *gbuf,
424  GWEN_DB_NODE *msgData);
425 
431  const char *typ,
432  const char *msgName,
433  int msgVersion,
434  uint32_t flags);
435 
445  GWEN_XMLNODE *group,
446  GWEN_BUFFER *msgbuf,
447  GWEN_DB_NODE *gr,
448  uint32_t flags);
449 
462  GWEN_BUFFER *msgbuf,
463  unsigned char escapeChar,
464  unsigned char delimiter);
465 
505  const char *gtype,
506  GWEN_BUFFER *mbuf,
507  GWEN_DB_NODE *gr,
508  uint32_t flags);
509 
517  const char *typ,
518  const char *msgName,
519  int msgVersion,
520  uint32_t flags);
536 
537 
543  const char *data,
544  unsigned int size,
545  const char *description,
546  GWEN_MSGENGINE_TRUSTLEVEL trustLevel,
547  unsigned int pos);
548  /* Handling Trust Information */ /* defgroup */ /* defgroup (yes, twice) */
552 
553 
554 #ifdef __cplusplus
555 }
556 #endif
557 
558 #endif
559 
GWEN_DB_NODE_TYPE
Definition: db.h:233
struct GWEN_DB_NODE GWEN_DB_NODE
Definition: db.h:228
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:38
#define GWENHYWFAR_API
Definition: gwenhywfarapi.h:67
#define GWEN_INHERIT_FUNCTION_LIB_DEFS(t, decl)
Definition: inherit.h:125
GWENHYWFAR_API void GWEN_MsgEngine_free(GWEN_MSGENGINE *e)
GWEN_MSGENGINE_TRUSTLEVEL
Definition: msgengine.h:54
@ GWEN_MsgEngineTrustLevelHigh
Definition: msgengine.h:58
@ GWEN_MsgEngineTrustLevelMedium
Definition: msgengine.h:57
@ GWEN_MsgEngineTrustLevelNone
Definition: msgengine.h:55
@ GWEN_MsgEngineTrustLevelFull
Definition: msgengine.h:59
@ GWEN_MsgEngineTrustLevelLow
Definition: msgengine.h:56
GWENHYWFAR_API void GWEN_MsgEngine_SetGetGlobalValuesFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_GETGLOBALVALUES_PTR p)
GWENHYWFAR_API int GWEN_MsgEngine_TrustedData_AddPos(GWEN_MSGENGINE_TRUSTEDDATA *td, unsigned int pos)
GWENHYWFAR_API GWEN_MSGENGINE_TYPEWRITE_PTR GWEN_MsgEngine_GetTypeWriteFunction(GWEN_MSGENGINE *e)
GWENHYWFAR_API void GWEN_MsgEngine_SetTypeWriteFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_TYPEWRITE_PTR p)
GWENHYWFAR_API void GWEN_MsgEngine_SetDefinitions(GWEN_MSGENGINE *e, GWEN_XMLNODE *n, int take)
GWENHYWFAR_API int GWEN_MsgEngine_CreateMessageFromNode(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_BUFFER *gbuf, GWEN_DB_NODE *msgData)
GWENHYWFAR_API GWEN_XMLNODE * GWEN_MsgEngine_ListMessage(GWEN_MSGENGINE *e, const char *typ, const char *msgName, int msgVersion, uint32_t flags)
GWENHYWFAR_API void GWEN_MsgEngine_TrustedData_free(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWENHYWFAR_API void GWEN_MsgEngine_SetGetIntValueFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_GETINTVALUE_PTR p)
GWENHYWFAR_API GWEN_XMLNODE * GWEN_MsgEngine_FindNodeByPropertyStrictProto(GWEN_MSGENGINE *e, const char *t, const char *pname, int version, const char *pvalue)
GWENHYWFAR_API const char * GWEN_MsgEngine_TrustedData_GetDescription(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWENHYWFAR_API const char * GWEN_MsgEngine_GetMode(GWEN_MSGENGINE *e)
GWENHYWFAR_API void GWEN_MsgEngine_SetTypeCheckFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_TYPECHECK_PTR p)
GWENHYWFAR_API void GWEN_MsgEngine_SetCharsToEscape(GWEN_MSGENGINE *e, const char *c)
GWENHYWFAR_API GWEN_MSGENGINE_TRUSTLEVEL GWEN_MsgEngine_TrustedData_GetTrustLevel(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWENHYWFAR_API GWEN_MSGENGINE_BINTYPEWRITE_PTR GWEN_MsgEngine_GetBinTypeWriteFunction(GWEN_MSGENGINE *e)
GWENHYWFAR_API GWEN_MSGENGINE_BINTYPEREAD_PTR GWEN_MsgEngine_GetBinTypeReadFunction(GWEN_MSGENGINE *e)
GWENHYWFAR_API GWEN_XMLNODE * GWEN_MsgEngine_FindNodeByProperty(GWEN_MSGENGINE *e, const char *t, const char *pname, int version, const char *pvalue)
GWENHYWFAR_API int GWEN_MsgEngine_SkipSegment(GWEN_MSGENGINE *e, GWEN_BUFFER *msgbuf, unsigned char escapeChar, unsigned char delimiter)
GWENHYWFAR_API void * GWEN_MsgEngine_GetInheritorData(const GWEN_MSGENGINE *e)
int(* GWEN_MSGENGINE_TYPEREAD_PTR)(GWEN_MSGENGINE *e, GWEN_BUFFER *msgbuf, GWEN_XMLNODE *node, GWEN_BUFFER *vbuf, char escapeChar, const char *delimiters)
Definition: msgengine.h:143
GWENHYWFAR_API void GWEN_MsgEngine_SetMode(GWEN_MSGENGINE *e, const char *mode)
GWENHYWFAR_API char GWEN_MsgEngine_GetEscapeChar(GWEN_MSGENGINE *e)
GWENHYWFAR_API int GWEN_MsgEngine_TrustedData_CreateReplacements(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWENHYWFAR_API const char * GWEN_MsgEngine_SearchForProperty(GWEN_XMLNODE *node, GWEN_XMLNODE *refnode, const char *name, int topDown)
GWENHYWFAR_API GWEN_XMLNODE * GWEN_MsgEngine_GetDefinitions(GWEN_MSGENGINE *e)
int(* GWEN_MSGENGINE_BINTYPEREAD_PTR)(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_DB_NODE *gr, GWEN_BUFFER *vbuf)
Definition: msgengine.h:164
GWENHYWFAR_API void GWEN_MsgEngine_SetBinTypeReadFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_BINTYPEREAD_PTR p)
GWEN_DB_NODE_TYPE(* GWEN_MSGENGINE_TYPECHECK_PTR)(GWEN_MSGENGINE *e, const char *tname)
Definition: msgengine.h:161
GWENHYWFAR_API const char * GWEN_MsgEngine_GetCharsToEscape(GWEN_MSGENGINE *e)
GWENHYWFAR_API int GWEN_MsgEngine_GetIntValue(GWEN_MSGENGINE *e, const char *path, int defValue)
GWENHYWFAR_API const char * GWEN_MsgEngine_TrustedData_GetData(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWENHYWFAR_API GWEN_MSGENGINE_TYPEREAD_PTR GWEN_MsgEngine_GetTypeReadFunction(GWEN_MSGENGINE *e)
GWENHYWFAR_API int GWEN_MsgEngine_ReadMessage(GWEN_MSGENGINE *e, const char *gtype, GWEN_BUFFER *mbuf, GWEN_DB_NODE *gr, uint32_t flags)
GWENHYWFAR_API GWEN_MSGENGINE * GWEN_MsgEngine_new(void)
GWENHYWFAR_API void GWEN_MsgEngine_SetInheritorData(GWEN_MSGENGINE *e, void *d)
GWENHYWFAR_API void GWEN_MsgEngine_SetDelimiters(GWEN_MSGENGINE *e, const char *s)
GWENHYWFAR_API int GWEN_MsgEngine_AddTrustInfo(GWEN_MSGENGINE *e, const char *data, unsigned int size, const char *description, GWEN_MSGENGINE_TRUSTLEVEL trustLevel, unsigned int pos)
GWENHYWFAR_API void GWEN_MsgEngine_SetBinTypeWriteFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_BINTYPEWRITE_PTR p)
GWENHYWFAR_API int GWEN_MsgEngine_TrustedData_GetFirstPos(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWENHYWFAR_API int GWEN_MsgEngine_AddDefinitions(GWEN_MSGENGINE *e, GWEN_XMLNODE *node)
GWENHYWFAR_API const char * GWEN_MsgEngine_GetDelimiters(GWEN_MSGENGINE *e)
GWENHYWFAR_API void GWEN_MsgEngine_SetProtocolVersion(GWEN_MSGENGINE *e, unsigned int p)
GWENHYWFAR_API const char * GWEN_MsgEngine_TrustedData_GetReplacement(GWEN_MSGENGINE_TRUSTEDDATA *td)
void(* GWEN_MSGENGINE_FREEDATA_PTR)(GWEN_MSGENGINE *e)
Definition: msgengine.h:187
GWENHYWFAR_API unsigned int GWEN_MsgEngine_GetProtocolVersion(GWEN_MSGENGINE *e)
const char *(* GWEN_MSGENGINE_GETCHARVALUE_PTR)(GWEN_MSGENGINE *e, const char *name, const char *defValue)
Definition: msgengine.h:177
GWENHYWFAR_API GWEN_XMLNODE * GWEN_MsgEngine_FindGroupByProperty(GWEN_MSGENGINE *e, const char *pname, int version, const char *pvalue)
GWENHYWFAR_API int GWEN_MsgEngine_SetValue(GWEN_MSGENGINE *e, const char *path, const char *value)
GWENHYWFAR_API void GWEN_MsgEngine_SetFreeDataFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_FREEDATA_PTR p)
GWENHYWFAR_API GWEN_MSGENGINE_TRUSTEDDATA * GWEN_MsgEngine_TrustedData_GetNext(GWEN_MSGENGINE_TRUSTEDDATA *td)
struct GWEN__MSGENGINE GWEN_MSGENGINE
Definition: msgengine.h:131
int(* GWEN_MSGENGINE_BINTYPEWRITE_PTR)(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_DB_NODE *gr, GWEN_BUFFER *dbuf)
Definition: msgengine.h:169
GWENHYWFAR_API GWEN_MSGENGINE_GETGLOBALVALUES_PTR GWEN_MsgEngine_GetGetGlobalValuesFunction(GWEN_MSGENGINE *e)
GWENHYWFAR_API int GWEN_MsgEngine_SetIntValue(GWEN_MSGENGINE *e, const char *path, int value)
GWENHYWFAR_API int GWEN_MsgEngine_ParseMessage(GWEN_MSGENGINE *e, GWEN_XMLNODE *group, GWEN_BUFFER *msgbuf, GWEN_DB_NODE *gr, uint32_t flags)
GWENHYWFAR_API int GWEN_MsgEngine_ShowMessage(GWEN_MSGENGINE *e, const char *typ, const char *msgName, int msgVersion, uint32_t flags)
GWENHYWFAR_API void GWEN_MsgEngine_SetGetCharValueFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_GETCHARVALUE_PTR p)
GWENHYWFAR_API GWEN_MSGENGINE_TRUSTEDDATA * GWEN_MsgEngine_TakeTrustInfo(GWEN_MSGENGINE *e)
int(* GWEN_MSGENGINE_GETINTVALUE_PTR)(GWEN_MSGENGINE *e, const char *name, int defValue)
Definition: msgengine.h:180
struct GWEN_MSGENGINE_TRUSTEDDATA GWEN_MSGENGINE_TRUSTEDDATA
Definition: msgengine.h:52
GWENHYWFAR_API void GWEN_MsgEngine_Attach(GWEN_MSGENGINE *e)
GWEN_DB_NODE *(* GWEN_MSGENGINE_GETGLOBALVALUES_PTR)(GWEN_MSGENGINE *e)
Definition: msgengine.h:185
GWENHYWFAR_API GWEN_MSGENGINE_TYPECHECK_PTR GWEN_MsgEngine_GetTypeCheckFunction(GWEN_MSGENGINE *e)
GWENHYWFAR_API void GWEN_MsgEngine_SetEscapeChar(GWEN_MSGENGINE *e, char c)
GWENHYWFAR_API unsigned int GWEN_MsgEngine_TrustedData_GetSize(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWENHYWFAR_API int GWEN_MsgEngine_CreateMessage(GWEN_MSGENGINE *e, const char *msgName, int msgVersion, GWEN_BUFFER *gbuf, GWEN_DB_NODE *msgData)
GWENHYWFAR_API int GWEN_MsgEngine_TrustedData_GetNextPos(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWENHYWFAR_API GWEN_MSGENGINE_TRUSTEDDATA * GWEN_MsgEngine_TrustedData_new(const char *data, unsigned int size, const char *description, GWEN_MSGENGINE_TRUSTLEVEL trustLevel)
int(* GWEN_MSGENGINE_TYPEWRITE_PTR)(GWEN_MSGENGINE *e, GWEN_BUFFER *gbuf, GWEN_BUFFER *data, GWEN_XMLNODE *node)
Definition: msgengine.h:153
GWENHYWFAR_API const char * GWEN_MsgEngine_GetValue(GWEN_MSGENGINE *e, const char *path, const char *defValue)
GWENHYWFAR_API void GWEN_MsgEngine_SetTypeReadFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_TYPEREAD_PTR p)
struct GWEN__XMLNODE GWEN_XMLNODE
Definition: xml.h:156