29 #define DISABLE_DEBUGLOG
31 #include <gwenhywfar/gwenhywfarapi.h>
32 #include <msgengine_p.h>
33 #include <gwenhywfar/xml.h>
34 #include <gwenhywfar/text.h>
35 #include <gwenhywfar/misc.h>
36 #include <gwenhywfar/path.h>
37 #include <gwenhywfar/debug.h>
38 #include <gwenhywfar/buffer.h>
53 e->charsToEscape=strdup(GWEN_MSGENGINE_CHARSTOESCAPE);
54 e->delimiters=strdup(GWEN_MSGENGINE_DEFAULT_DELIMITERS);
66 if (--(e->usage)==0) {
69 if (e->inheritorData && e->freeDataPtr)
73 free(e->charsToEscape);
109 return e->escapeChar;
116 free(e->charsToEscape);
117 e->charsToEscape=strdup(c);
124 return e->charsToEscape;
133 e->delimiters=strdup(s);
135 e->delimiters=strdup(GWEN_MSGENGINE_DEFAULT_DELIMITERS);
142 return e->delimiters;
177 if (e->getGlobalValuesPtr) {
178 globalValues=e->getGlobalValuesPtr(e);
180 globalValues=e->globalValues;
183 globalValues=e->globalValues;
185 assert(globalValues);
238 e->getGlobalValuesPtr=p;
246 return e->getGlobalValuesPtr;
262 return e->typeReadPtr;
278 return e->typeWritePtr;
294 return e->typeCheckPtr;
313 return e->binTypeReadPtr;
322 e->binTypeWritePtr=p;
330 return e->binTypeWritePtr;
339 e->getCharValuePtr=p;
365 return e->inheritorData;
373 if (e->inheritorData && e->freeDataPtr)
384 unsigned int minsize;
385 unsigned int maxsize;
386 unsigned int fixSize;
387 unsigned int startPos;
413 if (e->typeWritePtr) {
414 rv=e->typeWritePtr(e,
427 if (strcasecmp(type,
"bin")==0) {
445 else if (strcasecmp(type,
"num")==0) {
460 for (lj=0; lj<(maxsize-len); lj++)
464 for (lj=0; lj<len; lj++)
474 for (lj=0; lj<len; lj++)
478 for (lj=0; lj<(maxsize-len); lj++)
486 for (lj=0; lj<len; lj++)
534 if (c==e->escapeChar)
537 if (e->charsToEscape)
538 if (strchr(e->charsToEscape, c))
561 "String for \"%s\" (type %s) is longer than expected "
582 "Data too long (size is %d, fixed size is %d)",
587 for (j=bs; j<fixSize; j++)
598 if (e->typeCheckPtr) {
601 vt=e->typeCheckPtr(e, type);
608 (strcasecmp(type,
"alpha")==0) ||
609 (strcasecmp(type,
"ascii")==0) ||
610 (strcasecmp(type,
"an")==0) ||
611 (strcasecmp(type,
"float")==0);
618 if (e->typeCheckPtr) {
621 vt=e->typeCheckPtr(e, type);
628 (strcasecmp(type,
"num")==0);
635 if (e->typeCheckPtr) {
638 vt=e->typeCheckPtr(e, type);
645 (strcasecmp(type,
"bin")==0);
660 "Getting data of type \"%s\" from within XML file", type);
711 unsigned int datasize;
728 if (e->binTypeWritePtr &&
738 rv=e->binTypeWritePtr(e, node, gr, data);
796 "Unable to determine parameter "
797 "type (%s), assuming \"char\" for this matter", type);
809 datasize=strlen(pdata);
820 sizeof(numbuffer),0)) {
827 datasize=strlen(numbuffer);
850 node, copyOfNodePath, nptr,
884 "Value for element \"%s[%d]\" (mode \"%s\") not found",
922 const char *pvalue) {
932 const char *pvalue) {
940 if ((strlen(t)+4)>
sizeof(buffer)) {
961 if (strcasecmp(p, buffer)==0)
983 strcat(buffer,
"def");
988 if (strcasecmp(p, buffer)==0) {
990 if (strcasecmp(p, pvalue)==0) {
992 if (proto==0 || (
int)proto==i || i==0) {
994 if (version==0 || version==i) {
996 if (strcasecmp(p, mode)==0 || !*p) {
1022 const char *pvalue) {
1030 if ((strlen(t)+4)>
sizeof(buffer)) {
1051 if (strcasecmp(p, buffer)==0)
1073 strcat(buffer,
"def");
1078 if (strcasecmp(p, buffer)==0) {
1080 if (strcasecmp(p, pvalue)==0) {
1082 if (proto==0 || (
int)proto==i) {
1084 if (version==0 || version==i) {
1086 if (strcasecmp(p, mode)==0 || !*p) {
1112 unsigned int *datasize) {
1114 static char pbuffer[256];
1118 assert(globalValues);
1124 while (*p && isspace((
int)*p))
1126 if (*p==
'$' || *p==
'+') {
1152 *datasize=strlen(pvalue);
1157 const char *type =
"should_be_known";
1176 "Unable to determine type of \"%s\" (xml)", p);
1184 *datasize=strlen(pvalue);
1194 *datasize=strlen(pvalue);
1217 *datasize=strlen(pvalue);
1246 if (e->getCharValuePtr) {
1247 pvalue=e->getCharValuePtr(e, p, 0);
1249 *datasize=strlen(pvalue);
1254 if (e->getIntValuePtr) {
1255 z=e->getIntValuePtr(e, p, 0);
1261 *datasize=strlen(pvalue);
1276 *datasize=strlen(pvalue);
1290 const char *lastValue;
1328 if (value>highestTrust)
1334 if (value>highestTrust)
1342 if (value>highestTrust)
1346 return highestTrust;
1355 unsigned int *datasize) {
1360 const char *lastValue;
1361 unsigned int lastDataSize;
1362 unsigned int ldatasize;
1388 *datasize=ldatasize;
1393 lastDataSize=ldatasize;
1403 i=strlen(bufferPtr)+strlen(ppath)+2;
1404 tmpptr=(
char*)malloc(i);
1406 sprintf(tmpptr,
"%s/%s", ppath, bufferPtr);
1411 i=strlen(ppath)+strlen(name)+2;
1412 tmpptr=(
char*)malloc(i);
1414 sprintf(tmpptr,
"%s/%s", ppath, name);
1426 *datasize=lastDataSize;
1436 unsigned int *datasize) {
1450 if (strcasecmp(p,
"VALUES")==0) {
1458 if (strcasecmp(p,
"VALUE")==0) {
1465 if (strcasecmp(name, pname)==0) {
1507 const char *pvalue) {
1515 if ((strlen(t)+4)>
sizeof(buffer)) {
1529 "No definitions here for type \"%s\"", t);
1544 strcat(buffer,
"def");
1548 if (strcasecmp(p, buffer)==0 ||
1549 strcasecmp(p, t)==0) {
1551 if (strcasecmp(p, pvalue)!=0)
1553 if (strcasecmp(p, pvalue)==0) {
1555 if (proto==0 || (
int)proto==i || i==0) {
1557 if (version==0 || version==i) {
1559 if (strcasecmp(p, mode)==0 || !*p) {
1561 "Group definition for \"%s=%s\" found",
1573 "Group definition for \"%s=%s\"(%d) not found here",
1587 const char *pvalue) {
1634 if (!nRes && e->defs)
1639 "Group definition for \"%s=%s\"(%d) not found",
1659 int groupIsOptional,
1666 int omittedElements;
1710 unsigned int minnum;
1711 unsigned int maxnum;
1713 const char *addEmptyMode;
1714 unsigned int loopNr;
1731 if (strcasecmp(typ,
"ELEM")==0) {
1738 for (loopNr=0; loopNr<maxnum; loopNr++) {
1739 unsigned int posBeforeElement;
1747 for (j=0; j<omittedElements; j++) {
1753 if (!isFirstElement)
1767 (groupIsOptional && !hasEntries),
1791 if (strcasecmp(addEmptyMode,
"max")==0) {
1793 omittedElements+=(maxnum-loopNr);
1795 else if (strcasecmp(addEmptyMode,
"min")==0) {
1798 omittedElements+=(minnum-loopNr);
1800 else if (strcasecmp(addEmptyMode,
"one")==0) {
1804 else if (strcasecmp(addEmptyMode,
"none")==0) {
1815 else if (strcasecmp(typ,
"VALUES")==0) {
1817 else if (strcasecmp(typ,
"DESCR")==0) {
1825 unsigned int posBeforeGroup;
1863 for (loopNr=0; loopNr<maxnum; loopNr++) {
1876 for (j=0; j<omittedElements; j++) {
1882 if (!isFirstElement)
1922 loopNr>=minnum || groupIsOptional,
1957 if (strcasecmp(addEmptyMode,
"max")==0) {
1959 omittedElements+=(maxnum-loopNr);
1961 else if (strcasecmp(addEmptyMode,
"min")==0) {
1964 omittedElements+=(minnum-loopNr);
1966 else if (strcasecmp(addEmptyMode,
"one")==0) {
1970 else if (strcasecmp(addEmptyMode,
"none")==0) {
2005 return hasEntries?0:1;
2050 const char *msgName,
2124 unsigned int minsize;
2125 unsigned int maxsize;
2126 unsigned int minnum;
2127 unsigned int maxnum;
2152 if (strlen(path)+strlen(name)+10>=
sizeof(nbuffer)) {
2157 sprintf(nbuffer,
"%s/%s", path, name);
2159 sprintf(nbuffer,
"%s", name);
2176 fprintf(stdout,
" %s",
2178 j=GWEN_MSGENGINE_VARNAME_WIDTH-strlen(npath);
2183 fprintf(stdout,
" ");
2185 fprintf(stdout,
"| %s", type);
2186 j=GWEN_MSGENGINE_TYPENAME_WIDTH-strlen(type);
2191 fprintf(stdout,
" ");
2193 fprintf(stdout,
"| %4d-%4d", minsize, maxsize);
2194 fprintf(stdout,
" | %3d ", maxnum);
2195 fprintf(stdout,
" |");
2197 fprintf(stdout,
" optvar");
2198 if (flags & GWEN_MSGENGINE_SHOW_FLAGS_OPTIONAL)
2199 fprintf(stdout,
" optgrp");
2202 fprintf(stdout,
" set");
2205 fprintf(stdout,
"\n");
2220 int omittedElements;
2238 if (strcasecmp(p,
"VALUES")==0)
2254 if (strcasecmp(p,
"VALUE")==0) {
2272 while (*p && isspace((
int)*p))
2274 if (strlen(path)+strlen(pname)+2>
sizeof(pbuffer)) {
2279 sprintf(pbuffer,
"%s/%s", path, pname);
2281 sprintf(pbuffer,
"%s", pname);
2304 unsigned int minnum;
2305 unsigned int maxnum;
2308 unsigned int loopNr;
2309 unsigned int lflags;
2328 if (strcasecmp(typ,
"ELEM")==0) {
2344 else if (strcasecmp(typ,
"VALUES")==0) {
2346 else if (strcasecmp(typ,
"DESCR")==0) {
2355 lflags|=GWEN_MSGENGINE_SHOW_FLAGS_OPTIONAL;
2373 for (loopNr=0; loopNr<maxnum; loopNr++) {
2382 if (strlen(path)+strlen(gname)+1>
sizeof(pbuffer)) {
2386 sprintf(pbuffer,
"%s/%s", path, gname);
2391 if (strlen(path)+strlen(gname)+10>
sizeof(pbuffer)) {
2396 sprintf(pbuffer,
"%s/%s%d", path, gname, loopNr);
2398 sprintf(pbuffer,
"%s%d", gname, loopNr);
2429 const char *msgName,
2439 fprintf(stdout,
"Message \"%s\" version %d\n",
2440 msgName, msgVersion);
2441 for (i=0; i<76; i++)
2442 fprintf(stdout,
"=");
2443 fprintf(stdout,
"\n");
2445 fprintf(stdout,
"%s", p);
2446 i=GWEN_MSGENGINE_VARNAME_WIDTH-strlen(p);
2448 fprintf(stdout,
" ");
2450 fprintf(stdout,
" |");
2452 fprintf(stdout,
"%s", p);
2453 i=GWEN_MSGENGINE_TYPENAME_WIDTH-strlen(p);
2455 fprintf(stdout,
" ");
2457 fprintf(stdout,
" | Size | Num | Flags\n");
2458 for (i=0; i<76; i++)
2459 fprintf(stdout,
"-");
2460 fprintf(stdout,
"\n");
2514 if (strlen(path)+strlen(name)+10>=
sizeof(nbuffer)) {
2519 sprintf(nbuffer,
"%s/%s", path, name);
2521 sprintf(nbuffer,
"%s", name);
2574 if (strcasecmp(p,
"VALUES")==0)
2590 if (strcasecmp(p,
"VALUE")==0) {
2608 while (*p && isspace((
int)*p))
2610 if (strlen(path)+strlen(pname)+2>
sizeof(pbuffer)) {
2615 sprintf(pbuffer,
"%s/%s", path, pname);
2617 sprintf(pbuffer,
"%s", pname);
2640 unsigned int lflags;
2654 if (strcasecmp(typ,
"ELEM")==0) {
2667 else if (strcasecmp(typ,
"VALUES")==0) {
2669 else if (strcasecmp(typ,
"DESCR")==0) {
2698 if (strlen(path)+strlen(gname)+1>
sizeof(pbuffer)) {
2704 sprintf(pbuffer,
"%s/%s", path, gname);
2706 sprintf(pbuffer,
"%s", gname);
2741 const char *msgName,
2751 msgVersion, msgName);
2754 msgName, msgVersion);
2792 const char *delimiters,
2794 unsigned int minsize;
2795 unsigned int maxsize;
2797 unsigned int minnum;
2802 unsigned int realSize;
2814 if (e->typeReadPtr) {
2815 rv=e->typeReadPtr(e,
2827 if (strcasecmp(type,
"bin")==0) {
2862 if (sscanf(lbuffer,
"%d", &l)!=1) {
2894 (size==0 || br<size)) {
2898 if (lastWasEscape) {
2904 if (c==e->escapeChar) {
2910 if (!isEscaped && (c && strchr(delimiters, c)!=0)) {
2916 if (c==
'\\' || iscntrl(c)) {
2918 "Found a bad character (%02x) in type \"%s\", "
2919 "converting to SPACE",
2956 if (minsize!=0 && realSize<minsize) {
2964 if (maxsize!=0 && realSize>maxsize) {
2976 unsigned int ustart;
3002 const char *delimiters,
3006 unsigned int minnum;
3007 unsigned int maxnum;
3054 delimiters, delimiter);
3074 if (strcasecmp(type,
"ELEM")==0) {
3075 unsigned int loopNr;
3086 while((maxnum==0 || loopNr<maxnum) && !abortLoop) {
3100 "Checking delimiter at pos %x "
3101 "(whether \"%c\" is in \"%s\")",
3107 "Found delimiter (\"%c\" is in \"%s\")",
3158 e->binTypeReadPtr) {
3159 rv=e->binTypeReadPtr(e, n, gr, vbuf);
3221 if (abortLoop && maxnum) {
3222 uint32_t loopOpt=loopNr+1;
3227 for (; loopOpt<maxnum; loopOpt++) {
3232 if (loopOpt+1==maxnum && terminator) {
3238 if (loopOpt<maxnum) {
3240 "Delimiting character missing (pos=%d [%x]) "
3241 "expecting \"%c\", got \"%c\")",
3256 if (loopNr<minnum) {
3264 else if (strcasecmp(type,
"VALUES")==0) {
3267 else if (strcasecmp(type,
"DESCR")==0) {
3276 unsigned int gversion;
3277 unsigned int loopNr;
3302 while((maxnum==0 || loopNr<maxnum) && !abortLoop) {
3348 if (abortLoop && maxnum) {
3349 uint32_t loopOpt=loopNr+1;
3354 for (; loopOpt<maxnum; loopOpt++) {
3359 if (loopOpt+1==maxnum && terminator) {
3365 if (loopOpt<maxnum) {
3367 "Delimiting character missing (pos=%d [%x]) "
3368 "expecting \"%c\", got \"%c\")",
3383 if (loopNr<minnum) {
3424 "Terminating character missing (pos=%d [%x]) "
3425 "expecting \"%c\", got \"%c\")",
3472 const char *value) {
3477 assert(globalValues);
3493 assert(globalValues);
3504 const char *defValue) {
3509 assert(globalValues);
3523 assert(globalValues);
3533 unsigned char escapeChar,
3534 unsigned char delimiter) {
3552 if (c==escapeChar) {
3575 if (sscanf(lbuffer,
"%d", &l)!=1) {
3586 else if (c==delimiter) {
3605 unsigned int segments;
3611 unsigned int posBak;
3669 unsigned int ustart;
3676 "Unknown segment \"%s\" (Segnum=%d, version=%d, ref=%d)",
3712 unsigned int startPos;
3782 const char *description,
3789 td->data=(
char*)malloc(size);
3791 memmove(td->data, data, size);
3793 td->description=strdup(description);
3794 td->trustLevel=trustLevel;
3804 free(td->description);
3805 free(td->replacement);
3839 return td->description;
3847 return td->trustLevel;
3855 return td->replacement;
3863 if (td->posCount>=GWEN_MSGENGINE_TRUSTEDDATA_MAXPOS)
3865 td->positions[td->posCount++]=pos;
3881 if (td->posPointer>=td->posCount)
3883 return td->positions[td->posPointer++];
3891 unsigned int nextNr;
3919 while(std && std!=ntd) {
3922 if (std->size==ntd->size) {
3923 for (i=0; i<td->size; i++) {
3924 if (std->data[i]!=ntd->data[i]) {
3940 rp=strdup(std->replacement);
3944 rp=(
char*)malloc(ntd->size+1);
3951 sprintf(numbuffer,
"%02X", nextNr++);
3952 for (i=0; i<ntd->size; i++) {
3956 rp[i]=numbuffer[1-(i&1)];
3965 free(ntd->replacement);
3966 ntd->replacement=rp;
3990 const char *description,
4008 if (td->size==size &&
4010 *(td->description) &&
4011 trustLevel==td->trustLevel &&
4012 strcasecmp(description, td->description)==0) {
4014 for (i=0; i<td->size; i++) {
4015 if (td->data[i]!=data[i]) {
int GWEN_MsgEngine_TrustedData_CreateReplacements(GWEN_MSGENGINE_TRUSTEDDATA *td)
uint32_t GWEN_Buffer_GetBytesLeft(GWEN_BUFFER *bf)
GWEN_MSGENGINE_BINTYPEWRITE_PTR GWEN_MsgEngine_GetBinTypeWriteFunction(GWEN_MSGENGINE *e)
GWEN_DB_NODE * GWEN_MsgEngine__GetGlobalValues(GWEN_MSGENGINE *e)
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
int(* GWEN_MSGENGINE_BINTYPEREAD_PTR)(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_DB_NODE *gr, GWEN_BUFFER *vbuf)
struct GWEN_STRINGLISTENTRYSTRUCT GWEN_STRINGLISTENTRY
GWEN_MSGENGINE_TYPEWRITE_PTR GWEN_MsgEngine_GetTypeWriteFunction(GWEN_MSGENGINE *e)
#define GWEN_DB_FLAGS_OVERWRITE_VARS
void GWEN_MsgEngine_SetGetGlobalValuesFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_GETGLOBALVALUES_PTR p)
void GWEN_MsgEngine_TrustedData_free(GWEN_MSGENGINE_TRUSTEDDATA *td)
void GWEN_DB_Dump(GWEN_DB_NODE *n, int insert)
GWEN_MSGENGINE_TRUSTEDDATA * GWEN_MsgEngine_TrustedData_new(const char *data, unsigned int size, const char *description, GWEN_MSGENGINE_TRUSTLEVEL trustLevel)
int GWEN_MsgEngine_ReadMessage(GWEN_MSGENGINE *e, const char *gtype, GWEN_BUFFER *mbuf, GWEN_DB_NODE *gr, uint32_t flags)
int GWEN_MsgEngine_SetIntValue(GWEN_MSGENGINE *e, const char *path, int value)
struct GWEN_DB_NODE GWEN_DB_NODE
int GWEN_Buffer_AllocRoom(GWEN_BUFFER *bf, uint32_t size)
#define GWEN_INHERIT_FINI(t, element)
void GWEN_DB_Group_free(GWEN_DB_NODE *n)
int GWEN_MsgEngine__GetInline(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_BUFFER *mbuf)
void GWEN_MsgEngine_SetBinTypeWriteFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_BINTYPEWRITE_PTR p)
uint32_t GWEN_Buffer_GetUsedBytes(const GWEN_BUFFER *bf)
GWEN_MSGENGINE_TRUSTEDDATA * GWEN_MsgEngine_TrustedData_GetNext(GWEN_MSGENGINE_TRUSTEDDATA *td)
const char * GWEN_XMLNode_GetProperty(const GWEN_XMLNODE *n, const char *name, const char *defaultValue)
GWEN_XMLNODE * GWEN_MsgEngine_GetGroup(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, const GWEN_XMLNODE_PATH *nodePath, const char *t, int version, const char *pvalue)
int GWEN_MsgEngine__ListGroup(GWEN_MSGENGINE *e, const char *path, GWEN_XMLNODE *node, GWEN_XMLNODE *rnode, GWEN_STRINGLIST *sl, GWEN_XMLNODE *listNode, uint32_t flags)
GWEN_XMLNODE * GWEN_MsgEngine_FindNodeByPropertyStrictProto(GWEN_MSGENGINE *e, const char *t, const char *pname, int version, const char *pvalue)
GWEN_XMLNODE * GWEN_MsgEngine__GetGroup(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, const char *t, int version, const char *pvalue)
void GWEN_Text_DumpString(const char *s, unsigned int l, unsigned int insert)
GWEN_MSGENGINE_TYPECHECK_PTR GWEN_MsgEngine_GetTypeCheckFunction(GWEN_MSGENGINE *e)
#define DBG_NOTICE(dbg_logger, format, args...)
GWEN_XMLNODE * GWEN_XMLNode_GetFirstData(const GWEN_XMLNODE *n)
void GWEN_Buffer_SetStep(GWEN_BUFFER *bf, uint32_t step)
void GWEN_MsgEngine_SetFreeDataFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_FREEDATA_PTR p)
#define GWEN_FREE_OBJECT(varname)
GWEN_XMLNODE * GWEN_MsgEngine_FindNodeByProperty(GWEN_MSGENGINE *e, const char *t, const char *pname, int version, const char *pvalue)
GWEN_DB_NODE_TYPE(* GWEN_MSGENGINE_TYPECHECK_PTR)(GWEN_MSGENGINE *e, const char *tname)
#define GWEN_PATH_FLAGS_CREATE_GROUP
#define DBG_VERBOUS(dbg_logger, format, args...)
const char * GWEN_MsgEngine_TrustedData_GetReplacement(GWEN_MSGENGINE_TRUSTEDDATA *td)
void GWEN_XMLNode_SetProperty(GWEN_XMLNODE *n, const char *name, const char *value)
void GWEN_MsgEngine_SetCharsToEscape(GWEN_MSGENGINE *e, const char *c)
const char * GWEN_MsgEngine_TrustedData_GetData(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_XMLNODE * GWEN_MsgEngine_ListMessage(GWEN_MSGENGINE *e, const char *typ, const char *msgName, int msgVersion, uint32_t flags)
int(* GWEN_MSGENGINE_GETINTVALUE_PTR)(GWEN_MSGENGINE *e, const char *name, int defValue)
void GWEN_XMLNode_Dump(const GWEN_XMLNODE *n, int ind)
int GWEN_Buffer_AdjustUsedBytes(GWEN_BUFFER *bf)
#define DBG_WARN(dbg_logger, format, args...)
int GWEN_MsgEngine_SkipSegment(GWEN_UNUSED GWEN_MSGENGINE *e, GWEN_BUFFER *msgbuf, unsigned char escapeChar, unsigned char delimiter)
const char * GWEN_MsgEngine_GetValue(GWEN_MSGENGINE *e, const char *path, const char *defValue)
struct GWEN_MSGENGINE_TRUSTEDDATA GWEN_MSGENGINE_TRUSTEDDATA
void GWEN_XMLNode_RemoveChildren(GWEN_XMLNODE *n)
struct GWEN_XMLNODE_PATH GWEN_XMLNODE_PATH
GWEN_MSGENGINE_GETGLOBALVALUES_PTR GWEN_MsgEngine_GetGetGlobalValuesFunction(GWEN_MSGENGINE *e)
int GWEN_MsgEngine_TrustedData_AddPos(GWEN_MSGENGINE_TRUSTEDDATA *td, unsigned int pos)
int GWEN_DB_ValueExists(GWEN_DB_NODE *n, const char *path, unsigned int i)
uint32_t GWEN_Buffer_GetPos(const GWEN_BUFFER *bf)
void GWEN_MsgEngine_SetEscapeChar(GWEN_MSGENGINE *e, char c)
GWEN_MSGENGINE_TRUSTEDDATA * GWEN_MsgEngine_TakeTrustInfo(GWEN_MSGENGINE *e)
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
void GWEN_XMLNode_CopyProperties(GWEN_XMLNODE *tn, const GWEN_XMLNODE *sn, int overwrite)
char * GWEN_Buffer_GetPosPointer(const GWEN_BUFFER *bf)
GWEN_STRINGLISTENTRY * GWEN_StringList_FirstEntry(const GWEN_STRINGLIST *sl)
const char * GWEN_StringListEntry_Data(const GWEN_STRINGLISTENTRY *se)
int GWEN_Buffer_IncrementPos(GWEN_BUFFER *bf, uint32_t i)
void GWEN_MsgEngine_Attach(GWEN_MSGENGINE *e)
int GWEN_MsgEngine__ShowGroup(GWEN_MSGENGINE *e, const char *path, GWEN_XMLNODE *node, GWEN_XMLNODE *rnode, GWEN_STRINGLIST *sl, uint32_t flags)
int GWEN_MsgEngine_CreateMessage(GWEN_MSGENGINE *e, const char *msgName, int msgVersion, GWEN_BUFFER *gbuf, GWEN_DB_NODE *msgData)
GWEN_XMLNODE * GWEN_XMLNode_GetChild(const GWEN_XMLNODE *n)
const char *(* GWEN_MSGENGINE_GETCHARVALUE_PTR)(GWEN_MSGENGINE *e, const char *name, const char *defValue)
const char * GWEN_MsgEngine__SearchForValue(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_XMLNODE_PATH *nodePath, const char *name, unsigned int *datasize)
int GWEN_Buffer_PeekByte(GWEN_BUFFER *bf)
int GWEN_MsgEngine__WriteElement(GWEN_MSGENGINE *e, GWEN_BUFFER *gbuf, GWEN_XMLNODE *node, GWEN_XMLNODE *rnode, GWEN_DB_NODE *gr, int loopNr, int isOptional, GWEN_XMLNODE_PATH *nodePath)
void GWEN_StringList_free(GWEN_STRINGLIST *sl)
GWEN_XMLNODE * GWEN_XMLNode_FindFirstTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
GWEN_DB_NODE_TYPE GWEN_DB_GetVariableType(GWEN_DB_NODE *n, const char *p)
unsigned int GWEN_MsgEngine_TrustedData_GetSize(GWEN_MSGENGINE_TRUSTEDDATA *td)
int GWEN_DB_SetBinValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, const void *val, unsigned int valSize)
GWEN_MSGENGINE_TRUSTLEVEL GWEN_MsgEngine_TrustedData_GetTrustLevel(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_XMLNODE * GWEN_MsgEngine_GetDefinitions(GWEN_MSGENGINE *e)
#define GWEN_NEW_OBJECT(typ, varname)
GWEN_XMLNODE_TYPE GWEN_XMLNode_GetType(const GWEN_XMLNODE *n)
GWEN_XMLNODE_PATH * GWEN_XMLNode_Path_new(void)
int(* GWEN_MSGENGINE_TYPEWRITE_PTR)(GWEN_MSGENGINE *e, GWEN_BUFFER *gbuf, GWEN_BUFFER *data, GWEN_XMLNODE *node)
int GWEN_StringList_AppendString(GWEN_STRINGLIST *sl, const char *s, int take, int checkDouble)
int(* GWEN_MSGENGINE_BINTYPEWRITE_PTR)(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_DB_NODE *gr, GWEN_BUFFER *dbuf)
#define DBG_DEBUG(dbg_logger, format, args...)
int GWEN_Buffer_AppendBuffer(GWEN_BUFFER *bf, GWEN_BUFFER *sf)
int(* GWEN_MSGENGINE_TYPEREAD_PTR)(GWEN_MSGENGINE *e, GWEN_BUFFER *msgbuf, GWEN_XMLNODE *node, GWEN_BUFFER *vbuf, char escapeChar, const char *delimiters)
GWEN_XMLNODE * GWEN_XMLNode_GetNextTag(const GWEN_XMLNODE *n)
int GWEN_MsgEngine_TrustedData_GetFirstPos(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_XMLNODE * GWEN_MsgEngine_FindGroupByProperty(GWEN_MSGENGINE *e, const char *pname, int version, const char *pvalue)
GWEN_DB_NODE *(* GWEN_MSGENGINE_GETGLOBALVALUES_PTR)(GWEN_MSGENGINE *e)
GWEN_MSGENGINE_BINTYPEREAD_PTR GWEN_MsgEngine_GetBinTypeReadFunction(GWEN_MSGENGINE *e)
int GWEN_MsgEngine_ShowMessage(GWEN_MSGENGINE *e, const char *typ, const char *msgName, int msgVersion, uint32_t flags)
const void * GWEN_DB_GetBinValue(GWEN_DB_NODE *n, const char *path, int idx, const void *defVal, unsigned int defValSize, unsigned int *returnValueSize)
GWEN_XMLNODE * GWEN_XMLNode_Path_Surface(GWEN_XMLNODE_PATH *np)
const char * GWEN_MsgEngine_GetCharsToEscape(GWEN_MSGENGINE *e)
GWEN_MSGENGINE * GWEN_MsgEngine_new(void)
GWEN_XMLNODE * GWEN_XMLNode_Next(const GWEN_XMLNODE *n)
GWEN_XMLNODE * GWEN_XMLNode_FindNode(const GWEN_XMLNODE *node, GWEN_XMLNODE_TYPE t, const char *data)
struct GWEN_STRINGLISTSTRUCT GWEN_STRINGLIST
int GWEN_MsgEngine__ReadValue(GWEN_MSGENGINE *e, GWEN_BUFFER *msgbuf, GWEN_XMLNODE *node, GWEN_XMLNODE *rnode, GWEN_BUFFER *vbuf, const char *delimiters, uint32_t flags)
void GWEN_MsgEngine_SetDelimiters(GWEN_MSGENGINE *e, const char *s)
int GWEN_Buffer_AppendByte(GWEN_BUFFER *bf, char c)
const char * GWEN_DB_GetCharValue(GWEN_DB_NODE *n, const char *path, int idx, const char *defVal)
int GWEN_MsgEngine_TrustedData_GetNextPos(GWEN_MSGENGINE_TRUSTEDDATA *td)
const char * GWEN_MsgEngine__TransformValue(GWEN_MSGENGINE *e, const char *pvalue, GWEN_XMLNODE *node, GWEN_XMLNODE *dnode, unsigned int *datasize)
#define GWEN_INHERIT_INIT(t, element)
int GWEN_DB_VariableExists(GWEN_DB_NODE *n, const char *path)
GWEN_DB_NODE * GWEN_DB_GetGroup(GWEN_DB_NODE *n, uint32_t flags, const char *path)
const char * GWEN_MsgEngine_GetDelimiters(GWEN_MSGENGINE *e)
int GWEN_Buffer_DecrementPos(GWEN_BUFFER *bf, uint32_t i)
void GWEN_Buffer_free(GWEN_BUFFER *bf)
int GWEN_DB_DeleteVar(GWEN_DB_NODE *n, const char *path)
void GWEN_XMLNode_free(GWEN_XMLNODE *n)
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
void GWEN_MsgEngine_SetGetIntValueFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_GETINTVALUE_PTR p)
int GWEN_MsgEngine_GetHighestTrustLevel(GWEN_XMLNODE *node, GWEN_XMLNODE *refnode)
int GWEN_MsgEngine__IsCharTyp(GWEN_MSGENGINE *e, const char *type)
GWEN_XMLNODE * GWEN_XMLNode_GetParent(const GWEN_XMLNODE *n)
int GWEN_MsgEngine__IsBinTyp(GWEN_MSGENGINE *e, const char *type)
const char * GWEN_MsgEngine__findInValues(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_XMLNODE *dnode, const char *name, unsigned int *datasize)
void * GWEN_MsgEngine_GetInheritorData(const GWEN_MSGENGINE *e)
int GWEN_MsgEngine__IsIntTyp(GWEN_MSGENGINE *e, const char *type)
int GWEN_Buffer_Crop(GWEN_BUFFER *bf, uint32_t pos, uint32_t l)
int GWEN_Text_NumToString(int num, char *buffer, unsigned int bufsize, int fillchar)
GWEN_MSGENGINE_TRUSTLEVEL
int GWEN_MsgEngine_CreateMessageFromNode(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_BUFFER *gbuf, GWEN_DB_NODE *msgData)
#define DBG_ERROR(dbg_logger, format, args...)
GWEN_XMLNODE * GWEN_XMLNode_GetFirstTag(const GWEN_XMLNODE *n)
#define GWEN_MSGENGINE_READ_FLAGS_TRUSTINFO
const char * GWEN_MsgEngine_GetMode(GWEN_MSGENGINE *e)
const char * GWEN_XMLNode_GetData(const GWEN_XMLNODE *n)
void GWEN_MsgEngine_SetGetCharValueFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_GETCHARVALUE_PTR p)
int GWEN_Buffer_SetPos(GWEN_BUFFER *bf, uint32_t i)
struct GWEN__MSGENGINE GWEN_MSGENGINE
int GWEN_MsgEngine_AddDefinitions(GWEN_MSGENGINE *e, GWEN_XMLNODE *node)
int GWEN_DB_SetCharValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, const char *val)
#define GWEN_MSGENGINE_SHOW_FLAGS_NOSET
GWEN_STRINGLISTENTRY * GWEN_StringListEntry_Next(const GWEN_STRINGLISTENTRY *se)
GWEN_XMLNODE_PATH * GWEN_XMLNode_Path_dup(const GWEN_XMLNODE_PATH *np)
GWEN_MSGENGINE_TYPEREAD_PTR GWEN_MsgEngine_GetTypeReadFunction(GWEN_MSGENGINE *e)
int GWEN_MsgEngine__WriteGroup(GWEN_MSGENGINE *e, GWEN_BUFFER *gbuf, GWEN_XMLNODE *node, GWEN_XMLNODE *rnode, GWEN_DB_NODE *gr, int groupIsOptional, GWEN_XMLNODE_PATH *nodePath)
#define GWEN_MSGENGINE_MAX_VALUE_LEN
GWEN_DB_NODE_TYPE GWEN_DB_GetValueTypeByPath(GWEN_DB_NODE *n, const char *path, unsigned int i)
GWEN_XMLNODE * GWEN_XMLNode_dup(const GWEN_XMLNODE *n)
char GWEN_MsgEngine_GetEscapeChar(GWEN_MSGENGINE *e)
#define DBG_INFO(dbg_logger, format, args...)
void GWEN_MsgEngine_SetTypeReadFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_TYPEREAD_PTR p)
void GWEN_MsgEngine_SetBinTypeReadFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_BINTYPEREAD_PTR p)
int GWEN_MsgEngine_SetValue(GWEN_MSGENGINE *e, const char *path, const char *value)
int GWEN_MsgEngine__WriteValue(GWEN_MSGENGINE *e, GWEN_BUFFER *gbuf, GWEN_BUFFER *data, GWEN_XMLNODE *node)
int GWEN_XMLNode_Path_Dive(GWEN_XMLNODE_PATH *np, GWEN_XMLNODE *n)
void GWEN_MsgEngine_SetProtocolVersion(GWEN_MSGENGINE *e, unsigned int p)
int GWEN_Buffer_ReadByte(GWEN_BUFFER *bf)
int GWEN_MsgEngine_AddTrustInfo(GWEN_MSGENGINE *e, const char *data, unsigned int size, const char *description, GWEN_MSGENGINE_TRUSTLEVEL trustLevel, unsigned int pos)
void GWEN_MsgEngine_SetInheritorData(GWEN_MSGENGINE *e, void *d)
int GWEN_DB_GetIntValue(GWEN_DB_NODE *n, const char *path, int idx, int defVal)
int GWEN_Buffer_AppendBytes(GWEN_BUFFER *bf, const char *buffer, uint32_t size)
GWEN_DB_NODE * GWEN_DB_FindFirstGroup(GWEN_DB_NODE *n, const char *name)
GWEN_DB_NODE * GWEN_DB_Group_new(const char *name)
void GWEN_Buffer_Rewind(GWEN_BUFFER *bf)
void GWEN_XMLNode_Path_free(GWEN_XMLNODE_PATH *np)
#define GWEN_LIST_ADD(typ, sr, head)
int GWEN_MsgEngine__ReadGroup(GWEN_MSGENGINE *e, GWEN_BUFFER *msgbuf, GWEN_XMLNODE *node, GWEN_XMLNODE *rnode, GWEN_DB_NODE *gr, const char *delimiters, uint32_t flags)
int GWEN_DB_SetIntValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, int val)
void GWEN_MsgEngine_SetTypeCheckFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_TYPECHECK_PTR p)
void GWEN_MsgEngine_SetTypeWriteFunction(GWEN_MSGENGINE *e, GWEN_MSGENGINE_TYPEWRITE_PTR p)
int GWEN_MsgEngine__ShowElement(GWEN_UNUSED GWEN_MSGENGINE *e, const char *path, GWEN_XMLNODE *node, GWEN_STRINGLIST *sl, uint32_t flags)
void GWEN_MsgEngine_SetMode(GWEN_MSGENGINE *e, const char *mode)
int GWEN_Text_FromHexBuffer(const char *src, GWEN_BUFFER *buf)
void(* GWEN_MSGENGINE_FREEDATA_PTR)(GWEN_MSGENGINE *e)
int GWEN_MsgEngine_ParseMessage(GWEN_MSGENGINE *e, GWEN_XMLNODE *group, GWEN_BUFFER *msgbuf, GWEN_DB_NODE *msgData, uint32_t flags)
int GWEN_MsgEngine__ListElement(GWEN_UNUSED GWEN_MSGENGINE *e, const char *path, GWEN_XMLNODE *node, GWEN_STRINGLIST *sl, GWEN_XMLNODE *listNode, uint32_t flags)
unsigned int GWEN_MsgEngine_GetProtocolVersion(GWEN_MSGENGINE *e)
void GWEN_MsgEngine_SetDefinitions(GWEN_MSGENGINE *e, GWEN_XMLNODE *n, int take)
int GWEN_MsgEngine_GetIntValue(GWEN_MSGENGINE *e, const char *path, int defValue)
GWEN_STRINGLIST * GWEN_StringList_new(void)
const char * GWEN_MsgEngine_TrustedData_GetDescription(GWEN_MSGENGINE_TRUSTEDDATA *td)
GWEN_DB_NODE * GWEN_DB_FindNextGroup(GWEN_DB_NODE *n, const char *name)
#define GWEN_INHERIT_FUNCTIONS(t)
struct GWEN__XMLNODE GWEN_XMLNODE
int GWEN_Buffer_AppendString(GWEN_BUFFER *bf, const char *buffer)
#define GWEN_DB_FLAGS_DEFAULT
void GWEN_MsgEngine_free(GWEN_MSGENGINE *e)
const char * GWEN_MsgEngine_SearchForProperty(GWEN_XMLNODE *node, GWEN_XMLNODE *refnode, const char *name, int topDown)
void GWEN_XMLNode_AddChild(GWEN_XMLNODE *n, GWEN_XMLNODE *child)