gwenhywfar  5.1.2
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 
65 GWEN_MsgEngine_TrustedData_new(const char *data,
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
123 
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 
177 typedef const char *(*GWEN_MSGENGINE_GETCHARVALUE_PTR)(GWEN_MSGENGINE *e,
178  const char *name,
179  const char *defValue);
181  const char *name,
182  int defValue);
183 
184 typedef GWEN_DB_NODE *
185 (*GWEN_MSGENGINE_GETGLOBALVALUES_PTR)(GWEN_MSGENGINE *e);
186 
187 typedef void (*GWEN_MSGENGINE_FREEDATA_PTR)(GWEN_MSGENGINE *e);
188 
200 
213 
215 void GWEN_MsgEngine_SetCharsToEscape(GWEN_MSGENGINE *e, const char *c);
218 
220 void GWEN_MsgEngine_SetDelimiters(GWEN_MSGENGINE *e, const char *s);
223 
225 void GWEN_MsgEngine_SetMode(GWEN_MSGENGINE *e, const char *mode);
227 const char *GWEN_MsgEngine_GetMode(GWEN_MSGENGINE *e);
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
GWEN_DB_NODE_TYPE
Definition: db.h:232
GWEN_MsgEngine_GetInheritorData
GWENHYWFAR_API void * GWEN_MsgEngine_GetInheritorData(const GWEN_MSGENGINE *e)
GWEN_MsgEngine_TrustedData_GetData
const GWENHYWFAR_API char * GWEN_MsgEngine_TrustedData_GetData(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_MsgEngineTrustLevelHigh
Definition: msgengine.h:57
GWEN_MSGENGINE_TRUSTLEVEL
GWEN_MSGENGINE_TRUSTLEVEL
Definition: msgengine.h:53
GWEN_MSGENGINE_TRUSTEDDATA
struct GWEN_MSGENGINE_TRUSTEDDATA GWEN_MSGENGINE_TRUSTEDDATA
Definition: msgengine.h:51
GWEN_MSGENGINE_BINTYPEREAD_PTR
int(* GWEN_MSGENGINE_BINTYPEREAD_PTR)(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_DB_NODE *gr, GWEN_BUFFER *vbuf)
Definition: msgengine.h:163
GWEN_MsgEngine_TrustedData_CreateReplacements
GWENHYWFAR_API int GWEN_MsgEngine_TrustedData_CreateReplacements(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_MsgEngine_SetBinTypeWriteFunction
GWENHYWFAR_API void GWEN_MsgEngine_SetBinTypeWriteFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_BINTYPEWRITE_PTR p)
GWEN_MsgEngine_SkipSegment
GWENHYWFAR_API int GWEN_MsgEngine_SkipSegment(GWEN_MSGENGINE *e, GWEN_BUFFER *msgbuf, unsigned char escapeChar, unsigned char delimiter)
GWEN_MSGENGINE_TYPECHECK_PTR
GWEN_DB_NODE_TYPE(* GWEN_MSGENGINE_TYPECHECK_PTR)(GWEN_MSGENGINE *e, const char *tname)
Definition: msgengine.h:160
GWEN_MsgEngine_GetBinTypeWriteFunction
GWENHYWFAR_API GWEN_MSGENGINE_BINTYPEWRITE_PTR GWEN_MsgEngine_GetBinTypeWriteFunction(GWEN_MSGENGINE *e)
GWEN_MsgEngine_GetTypeWriteFunction
GWENHYWFAR_API GWEN_MSGENGINE_TYPEWRITE_PTR GWEN_MsgEngine_GetTypeWriteFunction(GWEN_MSGENGINE *e)
GWEN_MsgEngine_CreateMessage
GWENHYWFAR_API int GWEN_MsgEngine_CreateMessage(GWEN_MSGENGINE *e, const char *msgName, int msgVersion, GWEN_BUFFER *gbuf, GWEN_DB_NODE *msgData)
GWEN_MsgEngine_ListMessage
GWENHYWFAR_API GWEN_XMLNODE * GWEN_MsgEngine_ListMessage(GWEN_MSGENGINE *e, const char *typ, const char *msgName, int msgVersion, uint32_t flags)
GWEN_INHERIT_FUNCTION_LIB_DEFS
#define GWEN_INHERIT_FUNCTION_LIB_DEFS(t, decl)
Definition: inherit.h:124
GWEN_MsgEngine_ReadMessage
GWENHYWFAR_API int GWEN_MsgEngine_ReadMessage(GWEN_MSGENGINE *e, const char *gtype, GWEN_BUFFER *mbuf, GWEN_DB_NODE *gr, uint32_t flags)
GWEN_MSGENGINE
struct GWEN__MSGENGINE GWEN_MSGENGINE
Definition: msgengine.h:130
GWEN_MsgEngine_TrustedData_GetNextPos
GWENHYWFAR_API int GWEN_MsgEngine_TrustedData_GetNextPos(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_MsgEngineTrustLevelMedium
Definition: msgengine.h:56
GWEN_MsgEngine_TrustedData_GetTrustLevel
GWENHYWFAR_API GWEN_MSGENGINE_TRUSTLEVEL GWEN_MsgEngine_TrustedData_GetTrustLevel(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_MsgEngine_SetGetCharValueFunction
GWENHYWFAR_API void GWEN_MsgEngine_SetGetCharValueFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_GETCHARVALUE_PTR p)
GWEN_MsgEngine_TrustedData_AddPos
GWENHYWFAR_API int GWEN_MsgEngine_TrustedData_AddPos(GWEN_MSGENGINE_TRUSTEDDATA *td, unsigned int pos)
GWEN_MsgEngine_GetValue
const GWENHYWFAR_API char * GWEN_MsgEngine_GetValue(GWEN_MSGENGINE *e, const char *path, const char *defValue)
GWEN_MsgEngine_TrustedData_GetFirstPos
GWENHYWFAR_API int GWEN_MsgEngine_TrustedData_GetFirstPos(GWEN_MSGENGINE_TRUSTEDDATA *td)
db.h
xml.h
GWEN_MsgEngineTrustLevelFull
Definition: msgengine.h:58
GWEN_MsgEngine_GetBinTypeReadFunction
GWENHYWFAR_API GWEN_MSGENGINE_BINTYPEREAD_PTR GWEN_MsgEngine_GetBinTypeReadFunction(GWEN_MSGENGINE *e)
GWEN_MsgEngine_SetIntValue
GWENHYWFAR_API int GWEN_MsgEngine_SetIntValue(GWEN_MSGENGINE *e, const char *path, int value)
GWEN_MSGENGINE_GETCHARVALUE_PTR
const typedef char *(* GWEN_MSGENGINE_GETCHARVALUE_PTR)(GWEN_MSGENGINE *e, const char *name, const char *defValue)
Definition: msgengine.h:176
GWEN_MsgEngine_SetValue
GWENHYWFAR_API int GWEN_MsgEngine_SetValue(GWEN_MSGENGINE *e, const char *path, const char *value)
GWEN_MsgEngine_SetTypeCheckFunction
GWENHYWFAR_API void GWEN_MsgEngine_SetTypeCheckFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_TYPECHECK_PTR p)
GWEN_MsgEngine_GetProtocolVersion
GWENHYWFAR_API unsigned int GWEN_MsgEngine_GetProtocolVersion(GWEN_MSGENGINE *e)
GWEN_MsgEngine_SetGetIntValueFunction
GWENHYWFAR_API void GWEN_MsgEngine_SetGetIntValueFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_GETINTVALUE_PTR p)
GWEN_MsgEngine_SetInheritorData
GWENHYWFAR_API void GWEN_MsgEngine_SetInheritorData(GWEN_MSGENGINE *e, void *d)
GWEN_MsgEngine_FindNodeByProperty
GWENHYWFAR_API GWEN_XMLNODE * GWEN_MsgEngine_FindNodeByProperty(GWEN_MSGENGINE *e, const char *t, const char *pname, int version, const char *pvalue)
GWEN_MsgEngine_GetDelimiters
const GWENHYWFAR_API char * GWEN_MsgEngine_GetDelimiters(GWEN_MSGENGINE *e)
GWEN_MSGENGINE_TYPEWRITE_PTR
int(* GWEN_MSGENGINE_TYPEWRITE_PTR)(GWEN_MSGENGINE *e, GWEN_BUFFER *gbuf, GWEN_BUFFER *data, GWEN_XMLNODE *node)
Definition: msgengine.h:152
GWEN_MsgEngine_Attach
GWENHYWFAR_API void GWEN_MsgEngine_Attach(GWEN_MSGENGINE *e)
GWEN_MsgEngine_GetTypeReadFunction
GWENHYWFAR_API GWEN_MSGENGINE_TYPEREAD_PTR GWEN_MsgEngine_GetTypeReadFunction(GWEN_MSGENGINE *e)
GWEN_MSGENGINE_GETINTVALUE_PTR
int(* GWEN_MSGENGINE_GETINTVALUE_PTR)(GWEN_MSGENGINE *e, const char *name, int defValue)
Definition: msgengine.h:179
GWEN_MsgEngine_CreateMessageFromNode
GWENHYWFAR_API int GWEN_MsgEngine_CreateMessageFromNode(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_BUFFER *gbuf, GWEN_DB_NODE *msgData)
GWEN_MsgEngine_SearchForProperty
const GWENHYWFAR_API char * GWEN_MsgEngine_SearchForProperty(GWEN_XMLNODE *node, GWEN_XMLNODE *refnode, const char *name, int topDown)
GWEN_MsgEngine_GetDefinitions
GWENHYWFAR_API GWEN_XMLNODE * GWEN_MsgEngine_GetDefinitions(GWEN_MSGENGINE *e)
GWEN_MsgEngine_FindNodeByPropertyStrictProto
GWENHYWFAR_API GWEN_XMLNODE * GWEN_MsgEngine_FindNodeByPropertyStrictProto(GWEN_MSGENGINE *e, const char *t, const char *pname, int version, const char *pvalue)
GWEN_MsgEngine_SetGetGlobalValuesFunction
GWENHYWFAR_API void GWEN_MsgEngine_SetGetGlobalValuesFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_GETGLOBALVALUES_PTR p)
GWEN_MsgEngine_GetMode
const GWENHYWFAR_API char * GWEN_MsgEngine_GetMode(GWEN_MSGENGINE *e)
GWEN_MsgEngine_TrustedData_free
GWENHYWFAR_API void GWEN_MsgEngine_TrustedData_free(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_MsgEngine_ShowMessage
GWENHYWFAR_API int GWEN_MsgEngine_ShowMessage(GWEN_MSGENGINE *e, const char *typ, const char *msgName, int msgVersion, uint32_t flags)
GWEN_MsgEngine_TrustedData_GetNext
GWENHYWFAR_API GWEN_MSGENGINE_TRUSTEDDATA * GWEN_MsgEngine_TrustedData_GetNext(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_MSGENGINE_BINTYPEWRITE_PTR
int(* GWEN_MSGENGINE_BINTYPEWRITE_PTR)(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_DB_NODE *gr, GWEN_BUFFER *dbuf)
Definition: msgengine.h:168
GWEN_MsgEngine_TrustedData_new
GWENHYWFAR_API GWEN_MSGENGINE_TRUSTEDDATA * GWEN_MsgEngine_TrustedData_new(const char *data, unsigned int size, const char *description, GWEN_MSGENGINE_TRUSTLEVEL trustLevel)
GWEN_MsgEngine_SetTypeReadFunction
GWENHYWFAR_API void GWEN_MsgEngine_SetTypeReadFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_TYPEREAD_PTR p)
GWEN_MsgEngine_SetDelimiters
GWENHYWFAR_API void GWEN_MsgEngine_SetDelimiters(GWEN_MSGENGINE *e, const char *s)
GWEN_MsgEngine_GetEscapeChar
GWENHYWFAR_API char GWEN_MsgEngine_GetEscapeChar(GWEN_MSGENGINE *e)
GWEN_MsgEngine_AddTrustInfo
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)
GWEN_MsgEngineTrustLevelNone
Definition: msgengine.h:54
buffer.h
GWEN_MsgEngine_TakeTrustInfo
GWENHYWFAR_API GWEN_MSGENGINE_TRUSTEDDATA * GWEN_MsgEngine_TakeTrustInfo(GWEN_MSGENGINE *e)
GWEN_MSGENGINE_TYPEREAD_PTR
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:142
GWEN_MsgEngine_TrustedData_GetReplacement
const GWENHYWFAR_API char * GWEN_MsgEngine_TrustedData_GetReplacement(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_XMLNODE
struct GWEN__XMLNODE GWEN_XMLNODE
Definition: xml.h:148
GWEN_MSGENGINE_FREEDATA_PTR
void(* GWEN_MSGENGINE_FREEDATA_PTR)(GWEN_MSGENGINE *e)
Definition: msgengine.h:186
GWEN_MsgEngine_GetGetGlobalValuesFunction
GWENHYWFAR_API GWEN_MSGENGINE_GETGLOBALVALUES_PTR GWEN_MsgEngine_GetGetGlobalValuesFunction(GWEN_MSGENGINE *e)
GWEN_MsgEngine_ParseMessage
GWENHYWFAR_API int GWEN_MsgEngine_ParseMessage(GWEN_MSGENGINE *e, GWEN_XMLNODE *group, GWEN_BUFFER *msgbuf, GWEN_DB_NODE *gr, uint32_t flags)
GWEN_MsgEngine_GetTypeCheckFunction
GWENHYWFAR_API GWEN_MSGENGINE_TYPECHECK_PTR GWEN_MsgEngine_GetTypeCheckFunction(GWEN_MSGENGINE *e)
gwenhywfarapi.h
GWEN_MsgEngine_SetProtocolVersion
GWENHYWFAR_API void GWEN_MsgEngine_SetProtocolVersion(GWEN_MSGENGINE *e, unsigned int p)
GWEN_MsgEngine_GetIntValue
GWENHYWFAR_API int GWEN_MsgEngine_GetIntValue(GWEN_MSGENGINE *e, const char *path, int defValue)
GWEN_MsgEngine_SetFreeDataFunction
GWENHYWFAR_API void GWEN_MsgEngine_SetFreeDataFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_FREEDATA_PTR p)
GWEN_MsgEngine_AddDefinitions
GWENHYWFAR_API int GWEN_MsgEngine_AddDefinitions(GWEN_MSGENGINE *e, GWEN_XMLNODE *node)
GWEN_MsgEngine_SetCharsToEscape
GWENHYWFAR_API void GWEN_MsgEngine_SetCharsToEscape(GWEN_MSGENGINE *e, const char *c)
GWEN_MsgEngine_TrustedData_GetSize
GWENHYWFAR_API unsigned int GWEN_MsgEngine_TrustedData_GetSize(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_MsgEngine_new
GWENHYWFAR_API GWEN_MSGENGINE * GWEN_MsgEngine_new(void)
GWEN_MsgEngine_GetCharsToEscape
const GWENHYWFAR_API char * GWEN_MsgEngine_GetCharsToEscape(GWEN_MSGENGINE *e)
GWEN_MsgEngine_SetMode
GWENHYWFAR_API void GWEN_MsgEngine_SetMode(GWEN_MSGENGINE *e, const char *mode)
GWEN_DB_NODE
struct GWEN_DB_NODE GWEN_DB_NODE
Definition: db.h:227
GWEN_MsgEngine_SetEscapeChar
GWENHYWFAR_API void GWEN_MsgEngine_SetEscapeChar(GWEN_MSGENGINE *e, char c)
GWEN_MsgEngine_SetBinTypeReadFunction
GWENHYWFAR_API void GWEN_MsgEngine_SetBinTypeReadFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_BINTYPEREAD_PTR p)
GWENHYWFAR_API
#define GWENHYWFAR_API
Definition: gwenhywfarapi.h:66
GWEN_MsgEngine_FindGroupByProperty
GWENHYWFAR_API GWEN_XMLNODE * GWEN_MsgEngine_FindGroupByProperty(GWEN_MSGENGINE *e, const char *pname, int version, const char *pvalue)
GWEN_MsgEngine_SetDefinitions
GWENHYWFAR_API void GWEN_MsgEngine_SetDefinitions(GWEN_MSGENGINE *e, GWEN_XMLNODE *n, int take)
GWEN_MSGENGINE_GETGLOBALVALUES_PTR
GWEN_DB_NODE *(* GWEN_MSGENGINE_GETGLOBALVALUES_PTR)(GWEN_MSGENGINE *e)
Definition: msgengine.h:184
GWEN_MsgEngineTrustLevelLow
Definition: msgengine.h:55
GWEN_MsgEngine_free
GWENHYWFAR_API void GWEN_MsgEngine_free(GWEN_MSGENGINE *e)
GWEN_MsgEngine_SetTypeWriteFunction
GWENHYWFAR_API void GWEN_MsgEngine_SetTypeWriteFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_TYPEWRITE_PTR p)
GWEN_BUFFER
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:37
GWEN_MsgEngine_TrustedData_GetDescription
const GWENHYWFAR_API char * GWEN_MsgEngine_TrustedData_GetDescription(GWEN_MSGENGINE_TRUSTEDDATA *td)