29 #define DISABLE_DEBUGLOG 33 #include <gwenhywfar/gwenhywfarapi.h> 34 #include <msgengine_p.h> 35 #include <gwenhywfar/xml.h> 36 #include <gwenhywfar/text.h> 37 #include <gwenhywfar/misc.h> 38 #include <gwenhywfar/path.h> 39 #include <gwenhywfar/debug.h> 40 #include <gwenhywfar/buffer.h> 54 char currentDelimiter,
55 char currentTerminator,
56 const char *delimiters,
72 e->charsToEscape=strdup(GWEN_MSGENGINE_CHARSTOESCAPE);
73 e->delimiters=strdup(GWEN_MSGENGINE_DEFAULT_DELIMITERS);
86 if (--(e->usage)==0) {
89 if (e->inheritorData && e->freeDataPtr)
93 free(e->charsToEscape);
132 return e->escapeChar;
140 free(e->charsToEscape);
141 e->charsToEscape=strdup(c);
149 return e->charsToEscape;
159 e->delimiters=strdup(s);
161 e->delimiters=strdup(GWEN_MSGENGINE_DEFAULT_DELIMITERS);
169 return e->delimiters;
207 if (e->getGlobalValuesPtr) {
208 globalValues=e->getGlobalValuesPtr(e);
210 globalValues=e->globalValues;
213 globalValues=e->globalValues;
215 assert(globalValues);
272 e->getGlobalValuesPtr=p;
280 return e->getGlobalValuesPtr;
297 return e->typeReadPtr;
314 return e->typeWritePtr;
331 return e->typeCheckPtr;
351 return e->binTypeReadPtr;
360 e->binTypeWritePtr=p;
368 return e->binTypeWritePtr;
377 e->getCharValuePtr=p;
404 return e->inheritorData;
413 if (e->inheritorData && e->freeDataPtr)
425 unsigned int minsize;
426 unsigned int maxsize;
427 unsigned int fixSize;
428 unsigned int startPos;
454 if (e->typeWritePtr) {
455 rv=e->typeWritePtr(e,
468 if (strcasecmp(type,
"bin")==0) {
486 else if (strcasecmp(type,
"num")==0) {
501 for (lj=0; lj<(maxsize-len); lj++)
505 for (lj=0; lj<len; lj++)
515 for (lj=0; lj<len; lj++)
519 for (lj=0; lj<(maxsize-len); lj++)
527 for (lj=0; lj<len; lj++)
575 if (c==e->escapeChar)
578 if (e->charsToEscape)
579 if (strchr(e->charsToEscape, c))
602 "String for \"%s\" (type %s) is longer than expected " 623 "Data too long (size is %d, fixed size is %d)",
628 for (j=bs; j<fixSize; j++)
640 if (e->typeCheckPtr) {
643 vt=e->typeCheckPtr(e, type);
650 (strcasecmp(type,
"alpha")==0) ||
651 (strcasecmp(type,
"ascii")==0) ||
652 (strcasecmp(type,
"an")==0) ||
653 (strcasecmp(type,
"float")==0);
661 if (e->typeCheckPtr) {
664 vt=e->typeCheckPtr(e, type);
671 (strcasecmp(type,
"num")==0);
679 if (e->typeCheckPtr) {
682 vt=e->typeCheckPtr(e, type);
689 (strcasecmp(type,
"bin")==0);
705 "Getting data of type \"%s\" from within XML file", type);
756 unsigned int datasize;
773 if (e->binTypeWritePtr &&
783 rv=e->binTypeWritePtr(e, node, gr, data);
841 "Unable to determine parameter " 842 "type (%s), assuming \"char\" for this matter", type);
854 datasize=strlen(pdata);
865 sizeof(numbuffer), 0)) {
872 datasize=strlen(numbuffer);
895 node, copyOfNodePath, nptr,
929 "Value for element \"%s[%d]\" (mode \"%s\") not found",
987 if ((strlen(t)+4)>
sizeof(buffer)) {
1003 strcat(buffer,
"S");
1008 if (strcasecmp(p, buffer)==0)
1030 strcat(buffer,
"def");
1035 if (strcasecmp(p, buffer)==0) {
1037 if (strcasecmp(p, pvalue)==0) {
1039 if (proto==0 || (
int)proto==i || i==0) {
1041 if (version==0 || version==i) {
1043 if (strcasecmp(p, mode)==0 || !*p) {
1078 if ((strlen(t)+4)>
sizeof(buffer)) {
1094 strcat(buffer,
"S");
1099 if (strcasecmp(p, buffer)==0)
1121 strcat(buffer,
"def");
1126 if (strcasecmp(p, buffer)==0) {
1128 if (strcasecmp(p, pvalue)==0) {
1130 if (proto==0 || (
int)proto==i) {
1132 if (version==0 || version==i) {
1134 if (strcasecmp(p, mode)==0 || !*p) {
1160 unsigned int *datasize)
1163 static char pbuffer[256];
1167 assert(globalValues);
1173 while (*p && isspace((
int)*p))
1175 if (*p==
'$' || *p==
'+') {
1201 *datasize=strlen(pvalue);
1206 const char *type =
"should_be_known";
1225 "Unable to determine type of \"%s\" (xml)", p);
1233 *datasize=strlen(pvalue);
1243 *datasize=strlen(pvalue);
1266 *datasize=strlen(pvalue);
1295 if (e->getCharValuePtr) {
1296 pvalue=e->getCharValuePtr(e, p, 0);
1298 *datasize=strlen(pvalue);
1303 if (e->getIntValuePtr) {
1304 z=e->getIntValuePtr(e, p, 0);
1310 *datasize=strlen(pvalue);
1325 *datasize=strlen(pvalue);
1340 const char *lastValue;
1379 if (value>highestTrust)
1385 if (value>highestTrust)
1393 if (value>highestTrust)
1397 return highestTrust;
1406 unsigned int *datasize)
1412 const char *lastValue;
1413 unsigned int lastDataSize;
1414 unsigned int ldatasize;
1440 *datasize=ldatasize;
1445 lastDataSize=ldatasize;
1455 i=strlen(bufferPtr)+strlen(ppath)+2;
1456 tmpptr=(
char *)malloc(i);
1458 sprintf(tmpptr,
"%s/%s", ppath, bufferPtr);
1463 i=strlen(ppath)+strlen(name)+2;
1464 tmpptr=(
char *)malloc(i);
1466 sprintf(tmpptr,
"%s/%s", ppath, name);
1478 *datasize=lastDataSize;
1488 unsigned int *datasize)
1503 if (strcasecmp(p,
"VALUES")==0) {
1511 if (strcasecmp(p,
"VALUE")==0) {
1518 if (strcasecmp(name, pname)==0) {
1569 if ((strlen(t)+4)>
sizeof(buffer)) {
1579 strcat(buffer,
"S");
1583 "No definitions here for type \"%s\"", t);
1598 strcat(buffer,
"def");
1602 if (strcasecmp(p, buffer)==0 ||
1603 strcasecmp(p, t)==0) {
1605 if (strcasecmp(p, pvalue)!=0)
1607 if (strcasecmp(p, pvalue)==0) {
1609 if (proto==0 || (
int)proto==i || i==0) {
1611 if (version==0 || version==i) {
1613 if (strcasecmp(p, mode)==0 || !*p) {
1615 "Group definition for \"%s=%s\" found",
1627 "Group definition for \"%s=%s\"(%d) not found here",
1689 if (!nRes && e->defs)
1694 "Group definition for \"%s=%s\"(%d) not found",
1714 int groupIsOptional,
1722 int omittedElements;
1766 unsigned int minnum;
1767 unsigned int maxnum;
1769 const char *addEmptyMode;
1770 unsigned int loopNr;
1787 if (strcasecmp(typ,
"ELEM")==0) {
1794 for (loopNr=0; loopNr<maxnum; loopNr++) {
1795 unsigned int posBeforeElement;
1803 for (j=0; j<omittedElements; j++) {
1809 if (!isFirstElement)
1822 (groupIsOptional && !hasEntries),
1846 if (strcasecmp(addEmptyMode,
"max")==0) {
1848 omittedElements+=(maxnum-loopNr);
1850 else if (strcasecmp(addEmptyMode,
"min")==0) {
1853 omittedElements+=(minnum-loopNr);
1855 else if (strcasecmp(addEmptyMode,
"one")==0) {
1859 else if (strcasecmp(addEmptyMode,
"none")==0) {
1870 else if (strcasecmp(typ,
"VALUES")==0) {
1872 else if (strcasecmp(typ,
"DESCR")==0) {
1880 unsigned int posBeforeGroup;
1918 for (loopNr=0; loopNr<maxnum; loopNr++) {
1931 for (j=0; j<omittedElements; j++) {
1937 if (!isFirstElement)
1977 loopNr>=minnum || groupIsOptional,
2012 if (strcasecmp(addEmptyMode,
"max")==0) {
2014 omittedElements+=(maxnum-loopNr);
2016 else if (strcasecmp(addEmptyMode,
"min")==0) {
2019 omittedElements+=(minnum-loopNr);
2021 else if (strcasecmp(addEmptyMode,
"one")==0) {
2025 else if (strcasecmp(addEmptyMode,
"none")==0) {
2060 return hasEntries?0:1;
2106 const char *msgName,
2183 unsigned int minsize;
2184 unsigned int maxsize;
2185 unsigned int minnum;
2186 unsigned int maxnum;
2211 if (strlen(path)+strlen(name)+10>=
sizeof(nbuffer)) {
2216 sprintf(nbuffer,
"%s/%s", path, name);
2218 sprintf(nbuffer,
"%s", name);
2235 fprintf(stdout,
" %s",
2237 j=GWEN_MSGENGINE_VARNAME_WIDTH-strlen(npath);
2242 fprintf(stdout,
" ");
2244 fprintf(stdout,
"| %s", type);
2245 j=GWEN_MSGENGINE_TYPENAME_WIDTH-strlen(type);
2250 fprintf(stdout,
" ");
2252 fprintf(stdout,
"| %4d-%4d", minsize, maxsize);
2253 fprintf(stdout,
" | %3d ", maxnum);
2254 fprintf(stdout,
" |");
2256 fprintf(stdout,
" optvar");
2257 if (flags & GWEN_MSGENGINE_SHOW_FLAGS_OPTIONAL)
2258 fprintf(stdout,
" optgrp");
2261 fprintf(stdout,
" set");
2264 fprintf(stdout,
"\n");
2297 if (strcasecmp(p,
"VALUES")==0)
2313 if (strcasecmp(p,
"VALUE")==0) {
2331 while (*p && isspace((
int)*p))
2333 if (strlen(path)+strlen(pname)+2>
sizeof(pbuffer)) {
2338 sprintf(pbuffer,
"%s/%s", path, pname);
2340 sprintf(pbuffer,
"%s", pname);
2363 unsigned int minnum;
2364 unsigned int maxnum;
2367 unsigned int loopNr;
2368 unsigned int lflags;
2387 if (strcasecmp(typ,
"ELEM")==0) {
2403 else if (strcasecmp(typ,
"VALUES")==0) {
2405 else if (strcasecmp(typ,
"DESCR")==0) {
2414 lflags|=GWEN_MSGENGINE_SHOW_FLAGS_OPTIONAL;
2432 for (loopNr=0; loopNr<maxnum; loopNr++) {
2441 if (strlen(path)+strlen(gname)+1>
sizeof(pbuffer)) {
2445 sprintf(pbuffer,
"%s/%s", path, gname);
2450 if (strlen(path)+strlen(gname)+10>
sizeof(pbuffer)) {
2455 sprintf(pbuffer,
"%s/%s%d", path, gname, loopNr);
2457 sprintf(pbuffer,
"%s%d", gname, loopNr);
2483 const char *msgName,
2494 fprintf(stdout,
"Message \"%s\" version %d\n",
2495 msgName, msgVersion);
2496 for (i=0; i<76; i++)
2497 fprintf(stdout,
"=");
2498 fprintf(stdout,
"\n");
2500 fprintf(stdout,
"%s", p);
2501 i=GWEN_MSGENGINE_VARNAME_WIDTH-strlen(p);
2503 fprintf(stdout,
" ");
2505 fprintf(stdout,
" |");
2507 fprintf(stdout,
"%s", p);
2508 i=GWEN_MSGENGINE_TYPENAME_WIDTH-strlen(p);
2510 fprintf(stdout,
" ");
2512 fprintf(stdout,
" | Size | Num | Flags\n");
2513 for (i=0; i<76; i++)
2514 fprintf(stdout,
"-");
2515 fprintf(stdout,
"\n");
2569 if (strlen(path)+strlen(name)+10>=
sizeof(nbuffer)) {
2574 sprintf(nbuffer,
"%s/%s", path, name);
2576 sprintf(nbuffer,
"%s", name);
2629 if (strcasecmp(p,
"VALUES")==0)
2645 if (strcasecmp(p,
"VALUE")==0) {
2663 while (*p && isspace((
int)*p))
2665 if (strlen(path)+strlen(pname)+2>
sizeof(pbuffer)) {
2670 sprintf(pbuffer,
"%s/%s", path, pname);
2672 sprintf(pbuffer,
"%s", pname);
2695 unsigned int lflags;
2709 if (strcasecmp(typ,
"ELEM")==0) {
2722 else if (strcasecmp(typ,
"VALUES")==0) {
2724 else if (strcasecmp(typ,
"DESCR")==0) {
2753 if (strlen(path)+strlen(gname)+1>
sizeof(pbuffer)) {
2759 sprintf(pbuffer,
"%s/%s", path, gname);
2761 sprintf(pbuffer,
"%s", gname);
2790 const char *msgName,
2801 msgVersion, msgName);
2804 msgName, msgVersion);
2836 const char *delimiters,
2839 unsigned int minsize;
2840 unsigned int maxsize;
2842 unsigned int minnum;
2847 unsigned int realSize;
2859 if (e->typeReadPtr) {
2860 rv=e->typeReadPtr(e,
2872 if (strcasecmp(type,
"bin")==0) {
2907 if (sscanf(lbuffer,
"%d", &l)!=1) {
2939 (size==0 || br<(
int)size)) {
2943 if (lastWasEscape) {
2949 if (c==e->escapeChar) {
2955 if (!isEscaped && (c && strchr(delimiters, c)!=0)) {
2961 if (c==
'\\' || iscntrl(c)) {
2963 "Found a bad character (%02x) in type \"%s\", " 2964 "converting to SPACE",
3001 if (minsize!=0 && realSize<minsize) {
3009 if (maxsize!=0 && realSize>maxsize) {
3021 unsigned int ustart;
3047 const char *delimiters,
3052 unsigned int minnum;
3053 unsigned int maxnum;
3100 #ifdef HEAVY_DEBUG_MSGENGINE 3106 if (strcasecmp(type,
"ELEM")==0) {
3117 else if (strcasecmp(type,
"VALUES")==0) {
3120 else if (strcasecmp(type,
"DESCR")==0) {
3129 unsigned int gversion;
3130 unsigned int loopNr;
3155 while ((maxnum==0 || loopNr<maxnum) && !abortLoop) {
3163 (*gtype || (delimiter && delimiter == c) || (terminator && terminator == c)) &&
3200 if (abortLoop && maxnum) {
3201 uint32_t loopOpt=loopNr+1;
3206 for (; loopOpt<maxnum; loopOpt++) {
3211 if (loopOpt+1==maxnum && terminator) {
3217 if (loopOpt<maxnum) {
3219 "Delimiting character missing (pos=%d [%x]) " 3220 "expecting \"%c\", got \"%c\")",
3235 if (loopNr<minnum) {
3276 "Terminating character missing (pos=%d [%x]) " 3277 "expecting \"%c\", got \"%c\")",
3305 char currentDelimiter,
3306 char currentTerminator,
3307 const char *delimiters,
3310 unsigned int loopNr;
3311 unsigned int minnum;
3312 unsigned int maxnum;
3327 while ((maxnum==0 || loopNr<maxnum) && !abortLoop) {
3340 "Checking delimiter at pos %x " 3341 "(whether \"%c\" is in \"%s\")",
3344 if (c && strchr(delimiters, c)) {
3347 "Found delimiter (\"%c\" is in \"%s\")",
3363 #ifdef HEAVY_DEBUG_MSGENGINE 3386 rv=e->binTypeReadPtr(e, n, gr, vbuf);
3436 if (currentDelimiter) {
3439 if (abortLoop && maxnum) {
3440 uint32_t loopOpt=loopNr+1;
3445 for (; loopOpt<maxnum; loopOpt++) {
3450 if (loopOpt+1==maxnum && currentTerminator) {
3456 if (loopOpt<maxnum) {
3458 "Delimiting character missing (pos=%d [%x]) " 3459 "expecting \"%c\", got \"%c\")",
3473 if (loopNr<minnum) {
3517 assert(globalValues);
3534 assert(globalValues);
3545 const char *defValue)
3551 assert(globalValues);
3566 assert(globalValues);
3576 unsigned char escapeChar,
3577 unsigned char delimiter)
3604 if (c==escapeChar) {
3626 if (sscanf(lbuffer,
"%d", &l)!=1) {
3637 else if (c==delimiter) {
3657 unsigned int segments;
3663 unsigned int posBak;
3721 unsigned int ustart;
3728 "Unknown segment \"%s\" (Segnum=%d, version=%d, ref=%d)",
3764 unsigned int startPos;
3833 const char *description,
3841 td->data=(
char *)malloc(size);
3843 memmove(td->data, data, size);
3845 td->description=strdup(description);
3846 td->trustLevel=trustLevel;
3857 free(td->description);
3858 free(td->replacement);
3892 return td->description;
3900 return td->trustLevel;
3908 return td->replacement;
3917 if (td->posCount>=GWEN_MSGENGINE_TRUSTEDDATA_MAXPOS)
3919 td->positions[td->posCount++]=pos;
3937 if (td->posPointer>=td->posCount)
3939 return td->positions[td->posPointer++];
3947 unsigned int nextNr;
3975 while (
std &&
std!=ntd) {
3978 if (
std->size==ntd->size) {
3979 for (i=0; i<td->size; i++) {
3980 if (
std->data[i]!=ntd->data[i]) {
3996 rp=strdup(
std->replacement);
4000 rp=(
char *)malloc(ntd->size+1);
4007 sprintf(numbuffer,
"%02X", nextNr++);
4008 for (i=0; i<ntd->size; i++) {
4012 rp[i]=numbuffer[1-(i&1)];
4021 free(ntd->replacement);
4022 ntd->replacement=rp;
4047 const char *description,
4066 if (td->size==size &&
4068 *(td->description) &&
4069 trustLevel==td->trustLevel &&
4070 strcasecmp(description, td->description)==0) {
4072 for (i=0; i<td->size; i++) {
4073 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)
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)
static int _groupReadElement(GWEN_MSGENGINE *e, GWEN_BUFFER *msgbuf, GWEN_XMLNODE *n, GWEN_XMLNODE *rnode, GWEN_DB_NODE *gr, char currentDelimiter, char currentTerminator, const char *delimiters, uint32_t flags)
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__WriteElement(GWEN_MSGENGINE *e, GWEN_BUFFER *gbuf, GWEN_XMLNODE *node, GWEN_DB_NODE *gr, int loopNr, int isOptional, GWEN_XMLNODE_PATH *nodePath)
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_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)
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_MsgEngine__ShowGroup(GWEN_MSGENGINE *e, const char *path, GWEN_XMLNODE *node, GWEN_STRINGLIST *sl, uint32_t flags)
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__ListGroup(GWEN_MSGENGINE *e, const char *path, GWEN_XMLNODE *node, GWEN_STRINGLIST *sl, GWEN_XMLNODE *listNode, uint32_t flags)
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)