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> 54 e->charsToEscape=strdup(GWEN_MSGENGINE_CHARSTOESCAPE);
55 e->delimiters=strdup(GWEN_MSGENGINE_DEFAULT_DELIMITERS);
68 if (--(e->usage)==0) {
71 if (e->inheritorData && e->freeDataPtr)
75 free(e->charsToEscape);
114 return e->escapeChar;
122 free(e->charsToEscape);
123 e->charsToEscape=strdup(c);
131 return e->charsToEscape;
141 e->delimiters=strdup(s);
143 e->delimiters=strdup(GWEN_MSGENGINE_DEFAULT_DELIMITERS);
151 return e->delimiters;
189 if (e->getGlobalValuesPtr) {
190 globalValues=e->getGlobalValuesPtr(e);
192 globalValues=e->globalValues;
195 globalValues=e->globalValues;
197 assert(globalValues);
254 e->getGlobalValuesPtr=p;
262 return e->getGlobalValuesPtr;
279 return e->typeReadPtr;
296 return e->typeWritePtr;
313 return e->typeCheckPtr;
333 return e->binTypeReadPtr;
342 e->binTypeWritePtr=p;
350 return e->binTypeWritePtr;
359 e->getCharValuePtr=p;
386 return e->inheritorData;
395 if (e->inheritorData && e->freeDataPtr)
407 unsigned int minsize;
408 unsigned int maxsize;
409 unsigned int fixSize;
410 unsigned int startPos;
436 if (e->typeWritePtr) {
437 rv=e->typeWritePtr(e,
450 if (strcasecmp(type,
"bin")==0) {
468 else if (strcasecmp(type,
"num")==0) {
483 for (lj=0; lj<(maxsize-len); lj++)
487 for (lj=0; lj<len; lj++)
497 for (lj=0; lj<len; lj++)
501 for (lj=0; lj<(maxsize-len); lj++)
509 for (lj=0; lj<len; lj++)
557 if (c==e->escapeChar)
560 if (e->charsToEscape)
561 if (strchr(e->charsToEscape, c))
584 "String for \"%s\" (type %s) is longer than expected " 605 "Data too long (size is %d, fixed size is %d)",
610 for (j=bs; j<fixSize; j++)
622 if (e->typeCheckPtr) {
625 vt=e->typeCheckPtr(e, type);
632 (strcasecmp(type,
"alpha")==0) ||
633 (strcasecmp(type,
"ascii")==0) ||
634 (strcasecmp(type,
"an")==0) ||
635 (strcasecmp(type,
"float")==0);
643 if (e->typeCheckPtr) {
646 vt=e->typeCheckPtr(e, type);
653 (strcasecmp(type,
"num")==0);
661 if (e->typeCheckPtr) {
664 vt=e->typeCheckPtr(e, type);
671 (strcasecmp(type,
"bin")==0);
687 "Getting data of type \"%s\" from within XML file", type);
739 unsigned int datasize;
756 if (e->binTypeWritePtr &&
766 rv=e->binTypeWritePtr(e, node, gr, data);
824 "Unable to determine parameter " 825 "type (%s), assuming \"char\" for this matter", type);
837 datasize=strlen(pdata);
848 sizeof(numbuffer), 0)) {
855 datasize=strlen(numbuffer);
878 node, copyOfNodePath, nptr,
912 "Value for element \"%s[%d]\" (mode \"%s\") not found",
970 if ((strlen(t)+4)>
sizeof(buffer)) {
991 if (strcasecmp(p, buffer)==0)
1013 strcat(buffer,
"def");
1018 if (strcasecmp(p, buffer)==0) {
1020 if (strcasecmp(p, pvalue)==0) {
1022 if (proto==0 || (
int)proto==i || i==0) {
1024 if (version==0 || version==i) {
1026 if (strcasecmp(p, mode)==0 || !*p) {
1061 if ((strlen(t)+4)>
sizeof(buffer)) {
1077 strcat(buffer,
"S");
1082 if (strcasecmp(p, buffer)==0)
1104 strcat(buffer,
"def");
1109 if (strcasecmp(p, buffer)==0) {
1111 if (strcasecmp(p, pvalue)==0) {
1113 if (proto==0 || (
int)proto==i) {
1115 if (version==0 || version==i) {
1117 if (strcasecmp(p, mode)==0 || !*p) {
1143 unsigned int *datasize)
1146 static char pbuffer[256];
1150 assert(globalValues);
1156 while (*p && isspace((
int)*p))
1158 if (*p==
'$' || *p==
'+') {
1184 *datasize=strlen(pvalue);
1189 const char *type =
"should_be_known";
1208 "Unable to determine type of \"%s\" (xml)", p);
1216 *datasize=strlen(pvalue);
1226 *datasize=strlen(pvalue);
1249 *datasize=strlen(pvalue);
1278 if (e->getCharValuePtr) {
1279 pvalue=e->getCharValuePtr(e, p, 0);
1281 *datasize=strlen(pvalue);
1286 if (e->getIntValuePtr) {
1287 z=e->getIntValuePtr(e, p, 0);
1293 *datasize=strlen(pvalue);
1308 *datasize=strlen(pvalue);
1323 const char *lastValue;
1362 if (value>highestTrust)
1368 if (value>highestTrust)
1376 if (value>highestTrust)
1380 return highestTrust;
1389 unsigned int *datasize)
1395 const char *lastValue;
1396 unsigned int lastDataSize;
1397 unsigned int ldatasize;
1423 *datasize=ldatasize;
1428 lastDataSize=ldatasize;
1438 i=strlen(bufferPtr)+strlen(ppath)+2;
1439 tmpptr=(
char *)malloc(i);
1441 sprintf(tmpptr,
"%s/%s", ppath, bufferPtr);
1446 i=strlen(ppath)+strlen(name)+2;
1447 tmpptr=(
char *)malloc(i);
1449 sprintf(tmpptr,
"%s/%s", ppath, name);
1461 *datasize=lastDataSize;
1471 unsigned int *datasize)
1486 if (strcasecmp(p,
"VALUES")==0) {
1494 if (strcasecmp(p,
"VALUE")==0) {
1501 if (strcasecmp(name, pname)==0) {
1552 if ((strlen(t)+4)>
sizeof(buffer)) {
1562 strcat(buffer,
"S");
1566 "No definitions here for type \"%s\"", t);
1581 strcat(buffer,
"def");
1585 if (strcasecmp(p, buffer)==0 ||
1586 strcasecmp(p, t)==0) {
1588 if (strcasecmp(p, pvalue)!=0)
1590 if (strcasecmp(p, pvalue)==0) {
1592 if (proto==0 || (
int)proto==i || i==0) {
1594 if (version==0 || version==i) {
1596 if (strcasecmp(p, mode)==0 || !*p) {
1598 "Group definition for \"%s=%s\" found",
1610 "Group definition for \"%s=%s\"(%d) not found here",
1672 if (!nRes && e->defs)
1677 "Group definition for \"%s=%s\"(%d) not found",
1697 int groupIsOptional,
1705 int omittedElements;
1749 unsigned int minnum;
1750 unsigned int maxnum;
1752 const char *addEmptyMode;
1753 unsigned int loopNr;
1770 if (strcasecmp(typ,
"ELEM")==0) {
1777 for (loopNr=0; loopNr<maxnum; loopNr++) {
1778 unsigned int posBeforeElement;
1786 for (j=0; j<omittedElements; j++) {
1792 if (!isFirstElement)
1806 (groupIsOptional && !hasEntries),
1830 if (strcasecmp(addEmptyMode,
"max")==0) {
1832 omittedElements+=(maxnum-loopNr);
1834 else if (strcasecmp(addEmptyMode,
"min")==0) {
1837 omittedElements+=(minnum-loopNr);
1839 else if (strcasecmp(addEmptyMode,
"one")==0) {
1843 else if (strcasecmp(addEmptyMode,
"none")==0) {
1854 else if (strcasecmp(typ,
"VALUES")==0) {
1856 else if (strcasecmp(typ,
"DESCR")==0) {
1864 unsigned int posBeforeGroup;
1902 for (loopNr=0; loopNr<maxnum; loopNr++) {
1915 for (j=0; j<omittedElements; j++) {
1921 if (!isFirstElement)
1961 loopNr>=minnum || groupIsOptional,
1996 if (strcasecmp(addEmptyMode,
"max")==0) {
1998 omittedElements+=(maxnum-loopNr);
2000 else if (strcasecmp(addEmptyMode,
"min")==0) {
2003 omittedElements+=(minnum-loopNr);
2005 else if (strcasecmp(addEmptyMode,
"one")==0) {
2009 else if (strcasecmp(addEmptyMode,
"none")==0) {
2044 return hasEntries?0:1;
2090 const char *msgName,
2167 unsigned int minsize;
2168 unsigned int maxsize;
2169 unsigned int minnum;
2170 unsigned int maxnum;
2195 if (strlen(path)+strlen(name)+10>=
sizeof(nbuffer)) {
2200 sprintf(nbuffer,
"%s/%s", path, name);
2202 sprintf(nbuffer,
"%s", name);
2219 fprintf(stdout,
" %s",
2221 j=GWEN_MSGENGINE_VARNAME_WIDTH-strlen(npath);
2226 fprintf(stdout,
" ");
2228 fprintf(stdout,
"| %s", type);
2229 j=GWEN_MSGENGINE_TYPENAME_WIDTH-strlen(type);
2234 fprintf(stdout,
" ");
2236 fprintf(stdout,
"| %4d-%4d", minsize, maxsize);
2237 fprintf(stdout,
" | %3d ", maxnum);
2238 fprintf(stdout,
" |");
2240 fprintf(stdout,
" optvar");
2241 if (flags & GWEN_MSGENGINE_SHOW_FLAGS_OPTIONAL)
2242 fprintf(stdout,
" optgrp");
2245 fprintf(stdout,
" set");
2248 fprintf(stdout,
"\n");
2264 int omittedElements;
2282 if (strcasecmp(p,
"VALUES")==0)
2298 if (strcasecmp(p,
"VALUE")==0) {
2316 while (*p && isspace((
int)*p))
2318 if (strlen(path)+strlen(pname)+2>
sizeof(pbuffer)) {
2323 sprintf(pbuffer,
"%s/%s", path, pname);
2325 sprintf(pbuffer,
"%s", pname);
2348 unsigned int minnum;
2349 unsigned int maxnum;
2352 unsigned int loopNr;
2353 unsigned int lflags;
2372 if (strcasecmp(typ,
"ELEM")==0) {
2388 else if (strcasecmp(typ,
"VALUES")==0) {
2390 else if (strcasecmp(typ,
"DESCR")==0) {
2399 lflags|=GWEN_MSGENGINE_SHOW_FLAGS_OPTIONAL;
2417 for (loopNr=0; loopNr<maxnum; loopNr++) {
2426 if (strlen(path)+strlen(gname)+1>
sizeof(pbuffer)) {
2430 sprintf(pbuffer,
"%s/%s", path, gname);
2435 if (strlen(path)+strlen(gname)+10>
sizeof(pbuffer)) {
2440 sprintf(pbuffer,
"%s/%s%d", path, gname, loopNr);
2442 sprintf(pbuffer,
"%s%d", gname, loopNr);
2473 const char *msgName,
2484 fprintf(stdout,
"Message \"%s\" version %d\n",
2485 msgName, msgVersion);
2486 for (i=0; i<76; i++)
2487 fprintf(stdout,
"=");
2488 fprintf(stdout,
"\n");
2490 fprintf(stdout,
"%s", p);
2491 i=GWEN_MSGENGINE_VARNAME_WIDTH-strlen(p);
2493 fprintf(stdout,
" ");
2495 fprintf(stdout,
" |");
2497 fprintf(stdout,
"%s", p);
2498 i=GWEN_MSGENGINE_TYPENAME_WIDTH-strlen(p);
2500 fprintf(stdout,
" ");
2502 fprintf(stdout,
" | Size | Num | Flags\n");
2503 for (i=0; i<76; i++)
2504 fprintf(stdout,
"-");
2505 fprintf(stdout,
"\n");
2560 if (strlen(path)+strlen(name)+10>=
sizeof(nbuffer)) {
2565 sprintf(nbuffer,
"%s/%s", path, name);
2567 sprintf(nbuffer,
"%s", name);
2621 if (strcasecmp(p,
"VALUES")==0)
2637 if (strcasecmp(p,
"VALUE")==0) {
2655 while (*p && isspace((
int)*p))
2657 if (strlen(path)+strlen(pname)+2>
sizeof(pbuffer)) {
2662 sprintf(pbuffer,
"%s/%s", path, pname);
2664 sprintf(pbuffer,
"%s", pname);
2687 unsigned int lflags;
2701 if (strcasecmp(typ,
"ELEM")==0) {
2714 else if (strcasecmp(typ,
"VALUES")==0) {
2716 else if (strcasecmp(typ,
"DESCR")==0) {
2745 if (strlen(path)+strlen(gname)+1>
sizeof(pbuffer)) {
2751 sprintf(pbuffer,
"%s/%s", path, gname);
2753 sprintf(pbuffer,
"%s", gname);
2788 const char *msgName,
2799 msgVersion, msgName);
2802 msgName, msgVersion);
2840 const char *delimiters,
2843 unsigned int minsize;
2844 unsigned int maxsize;
2846 unsigned int minnum;
2851 unsigned int realSize;
2863 if (e->typeReadPtr) {
2864 rv=e->typeReadPtr(e,
2876 if (strcasecmp(type,
"bin")==0) {
2911 if (sscanf(lbuffer,
"%d", &l)!=1) {
2943 (size==0 || br<size)) {
2947 if (lastWasEscape) {
2953 if (c==e->escapeChar) {
2959 if (!isEscaped && (c && strchr(delimiters, c)!=0)) {
2965 if (c==
'\\' || iscntrl(c)) {
2967 "Found a bad character (%02x) in type \"%s\", " 2968 "converting to SPACE",
3005 if (minsize!=0 && realSize<minsize) {
3013 if (maxsize!=0 && realSize>maxsize) {
3025 unsigned int ustart;
3051 const char *delimiters,
3056 unsigned int minnum;
3057 unsigned int maxnum;
3104 delimiters, delimiter);
3124 if (strcasecmp(type,
"ELEM")==0) {
3125 unsigned int loopNr;
3136 while ((maxnum==0 || loopNr<maxnum) && !abortLoop) {
3150 "Checking delimiter at pos %x " 3151 "(whether \"%c\" is in \"%s\")",
3157 "Found delimiter (\"%c\" is in \"%s\")",
3208 e->binTypeReadPtr) {
3209 rv=e->binTypeReadPtr(e, n, gr, vbuf);
3271 if (abortLoop && maxnum) {
3272 uint32_t loopOpt=loopNr+1;
3277 for (; loopOpt<maxnum; loopOpt++) {
3282 if (loopOpt+1==maxnum && terminator) {
3288 if (loopOpt<maxnum) {
3290 "Delimiting character missing (pos=%d [%x]) " 3291 "expecting \"%c\", got \"%c\")",
3306 if (loopNr<minnum) {
3314 else if (strcasecmp(type,
"VALUES")==0) {
3317 else if (strcasecmp(type,
"DESCR")==0) {
3326 unsigned int gversion;
3327 unsigned int loopNr;
3352 while ((maxnum==0 || loopNr<maxnum) && !abortLoop) {
3398 if (abortLoop && maxnum) {
3399 uint32_t loopOpt=loopNr+1;
3404 for (; loopOpt<maxnum; loopOpt++) {
3409 if (loopOpt+1==maxnum && terminator) {
3415 if (loopOpt<maxnum) {
3417 "Delimiting character missing (pos=%d [%x]) " 3418 "expecting \"%c\", got \"%c\")",
3433 if (loopNr<minnum) {
3474 "Terminating character missing (pos=%d [%x]) " 3475 "expecting \"%c\", got \"%c\")",
3529 assert(globalValues);
3546 assert(globalValues);
3557 const char *defValue)
3563 assert(globalValues);
3578 assert(globalValues);
3588 unsigned char escapeChar,
3589 unsigned char delimiter)
3616 if (c==escapeChar) {
3638 if (sscanf(lbuffer,
"%d", &l)!=1) {
3649 else if (c==delimiter) {
3669 unsigned int segments;
3675 unsigned int posBak;
3733 unsigned int ustart;
3740 "Unknown segment \"%s\" (Segnum=%d, version=%d, ref=%d)",
3776 unsigned int startPos;
3845 const char *description,
3853 td->data=(
char *)malloc(size);
3855 memmove(td->data, data, size);
3857 td->description=strdup(description);
3858 td->trustLevel=trustLevel;
3869 free(td->description);
3870 free(td->replacement);
3904 return td->description;
3912 return td->trustLevel;
3920 return td->replacement;
3929 if (td->posCount>=GWEN_MSGENGINE_TRUSTEDDATA_MAXPOS)
3931 td->positions[td->posCount++]=pos;
3949 if (td->posPointer>=td->posCount)
3951 return td->positions[td->posPointer++];
3959 unsigned int nextNr;
3987 while (std && std!=ntd) {
3990 if (std->size==ntd->size) {
3991 for (i=0; i<td->size; i++) {
3992 if (std->data[i]!=ntd->data[i]) {
4008 rp=strdup(std->replacement);
4012 rp=(
char *)malloc(ntd->size+1);
4019 sprintf(numbuffer,
"%02X", nextNr++);
4020 for (i=0; i<ntd->size; i++) {
4024 rp[i]=numbuffer[1-(i&1)];
4033 free(ntd->replacement);
4034 ntd->replacement=rp;
4059 const char *description,
4078 if (td->size==size &&
4080 *(td->description) &&
4081 trustLevel==td->trustLevel &&
4082 strcasecmp(description, td->description)==0) {
4084 for (i=0; i<td->size; i++) {
4085 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)
int(* GWEN_MSGENGINE_BINTYPEWRITE_PTR)(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_DB_NODE *gr, GWEN_BUFFER *dbuf)
GWEN_DB_NODE * GWEN_MsgEngine__GetGlobalValues(GWEN_MSGENGINE *e)
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
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)
int(* GWEN_MSGENGINE_GETINTVALUE_PTR)(GWEN_MSGENGINE *e, const char *name, int defValue)
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)
GWEN_DB_NODE_TYPE(* GWEN_MSGENGINE_TYPECHECK_PTR)(GWEN_MSGENGINE *e, const char *tname)
#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)
#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)
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)
void(* GWEN_MSGENGINE_FREEDATA_PTR)(GWEN_MSGENGINE *e)
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)
int(* GWEN_MSGENGINE_BINTYPEREAD_PTR)(GWEN_MSGENGINE *e, GWEN_XMLNODE *node, GWEN_DB_NODE *gr, GWEN_BUFFER *vbuf)
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_StringList_AppendString(GWEN_STRINGLIST *sl, const char *s, int take, int checkDouble)
#define DBG_DEBUG(dbg_logger, format, args...)
int GWEN_Buffer_AppendBuffer(GWEN_BUFFER *bf, GWEN_BUFFER *sf)
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_MSGENGINE_BINTYPEREAD_PTR GWEN_MsgEngine_GetBinTypeReadFunction(GWEN_MSGENGINE *e)
GWEN_DB_NODE *(* GWEN_MSGENGINE_GETGLOBALVALUES_PTR)(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)
int(* GWEN_MSGENGINE_TYPEWRITE_PTR)(GWEN_MSGENGINE *e, GWEN_BUFFER *gbuf, GWEN_BUFFER *data, GWEN_XMLNODE *node)
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)
int(* GWEN_MSGENGINE_TYPEREAD_PTR)(GWEN_MSGENGINE *e, GWEN_BUFFER *msgbuf, GWEN_XMLNODE *node, GWEN_BUFFER *vbuf, char escapeChar, const char *delimiters)
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)
const char *(* GWEN_MSGENGINE_GETCHARVALUE_PTR)(GWEN_MSGENGINE *e, const char *name, const char *defValue)
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)
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)