gwenhywfar 5.12.0
db.c File Reference
#include "db_p.h"
#include <gwenhywfar/misc.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/path.h>
#include <gwenhywfar/text.h>
#include <gwenhywfar/dbio.h>
#include <gwenhywfar/fslock.h>
#include <gwenhywfar/fastbuffer.h>
#include <gwenhywfar/syncio_file.h>
#include <gwenhywfar/syncio_memory.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include <sys/types.h>
#include "dbrw.c"
Include dependency graph for db.c:

Go to the source code of this file.

Macros

#define DISABLE_DEBUGLOG
#define GWEN_DB_NODE_FLAGS_GROUP   0x80000000
#define GWEN_DB_NODE_FLAGS_MASK_INTERNAL   0xf0000000

Functions

int GWENHYWFAR_CB _replaceVarsCb (void *cbPtr, const char *name, int index, GWEN_UNUSED int maxLen, GWEN_BUFFER *dstBuf)
static int GWENHYWFAR_CB _replaceVarsCb (void *cbPtr, const char *name, int index, int maxLen, GWEN_BUFFER *dstBuf)
static int _writeVarValueToBuffer (GWEN_DB_NODE *db, const char *name, int index, GWEN_BUFFER *dstBuf)
int GWEN_DB_AddCharValue (GWEN_DB_NODE *n, const char *path, const char *val, int senseCase, int check)
int GWEN_DB_AddGroup (GWEN_DB_NODE *n, GWEN_DB_NODE *nn)
int GWEN_DB_AddGroupChildren (GWEN_DB_NODE *n, GWEN_DB_NODE *nn)
int GWEN_DB_ClearGroup (GWEN_DB_NODE *n, const char *path)
void GWEN_DB_ClearNode (GWEN_DB_NODE *n)
void * GWEN_DB_count_cb (GWEN_UNUSED GWEN_DB_NODE *node, void *user_data)
int GWEN_DB_DeleteGroup (GWEN_DB_NODE *n, const char *path)
int GWEN_DB_DeleteVar (GWEN_DB_NODE *n, const char *path)
void GWEN_DB_Dump (GWEN_DB_NODE *n, int insert)
GWEN_DB_NODEGWEN_DB_FindFirstGroup (GWEN_DB_NODE *n, const char *name)
GWEN_DB_NODEGWEN_DB_FindFirstVar (GWEN_DB_NODE *n, const char *name)
GWEN_DB_NODEGWEN_DB_FindGroup (GWEN_DB_NODE *n, const char *name, int idx)
GWEN_DB_NODEGWEN_DB_FindNextGroup (GWEN_DB_NODE *n, const char *name)
GWEN_DB_NODEGWEN_DB_FindNextVar (GWEN_DB_NODE *n, const char *name)
GWEN_DB_NODEGWEN_DB_FindVar (GWEN_DB_NODE *n, const char *name, int idx)
const void * GWEN_DB_GetBinValue (GWEN_DB_NODE *n, const char *path, int idx, const void *defVal, unsigned int defValSize, unsigned int *returnValueSize)
const void * GWEN_DB_GetBinValueFromNode (const GWEN_DB_NODE *n, unsigned int *size)
const char * GWEN_DB_GetCharValue (GWEN_DB_NODE *n, const char *path, int idx, const char *defVal)
const char * GWEN_DB_GetCharValueFromNode (const GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_GetFirstGroup (GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_GetFirstValue (GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_GetFirstVar (GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_GetGroup (GWEN_DB_NODE *n, uint32_t flags, const char *path)
int GWEN_DB_GetIntValue (GWEN_DB_NODE *n, const char *path, int idx, int defVal)
int GWEN_DB_GetIntValueFromNode (const GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_GetNextGroup (GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_GetNextValue (GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_GetNextVar (GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_GetNode (GWEN_DB_NODE *n, const char *path, uint32_t flags)
uint32_t GWEN_DB_GetNodeFlags (const GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_GetParentGroup (GWEN_DB_NODE *n)
void * GWEN_DB_GetPtrValue (GWEN_DB_NODE *n, const char *path, int idx, void *defVal)
GWEN_DB_NODEGWEN_DB_GetValue (GWEN_DB_NODE *n, const char *path, int idx)
GWEN_DB_NODE_TYPE GWEN_DB_GetValueType (GWEN_DB_NODE *n)
GWEN_DB_NODE_TYPE GWEN_DB_GetValueTypeByPath (GWEN_DB_NODE *n, const char *path, unsigned int i)
GWEN_DB_NODE_TYPE GWEN_DB_GetVariableType (GWEN_DB_NODE *n, const char *p)
GWEN_DB_NODEGWEN_DB_Group_dup (const GWEN_DB_NODE *n)
void GWEN_DB_Group_free (GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_Group_new (const char *name)
const char * GWEN_DB_GroupName (GWEN_DB_NODE *n)
void GWEN_DB_GroupRename (GWEN_DB_NODE *n, const char *newname)
unsigned int GWEN_DB_Groups_Count (const GWEN_DB_NODE *node)
void * GWEN_DB_Groups_Foreach (GWEN_DB_NODE *node, GWEN_DB_NODES_CB func, void *user_data)
void * GWEN_DB_HandlePath (const char *entry, void *data, int idx, uint32_t flags)
int GWEN_DB_InsertGroup (GWEN_DB_NODE *n, GWEN_DB_NODE *nn)
int GWEN_DB_IsGroup (const GWEN_DB_NODE *n)
int GWEN_DB_IsValue (const GWEN_DB_NODE *n)
int GWEN_DB_IsVariable (const GWEN_DB_NODE *n)
void GWEN_DB_ModifyBranchFlagsDown (GWEN_DB_NODE *n, uint32_t newflags, uint32_t mask)
void GWEN_DB_ModifyBranchFlagsUp (GWEN_DB_NODE *n, uint32_t newflags, uint32_t mask)
void GWEN_DB_Node_Append (GWEN_DB_NODE *parent, GWEN_DB_NODE *n)
void GWEN_DB_Node_Append_UnDirty (GWEN_DB_NODE *parent, GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_Node_dup (const GWEN_DB_NODE *n)
void GWEN_DB_Node_free (GWEN_DB_NODE *n)
void GWEN_DB_Node_Insert (GWEN_DB_NODE *parent, GWEN_DB_NODE *n)
void GWEN_DB_Node_InsertUnDirty (GWEN_DB_NODE *parent, GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_Node_new (GWEN_DB_NODE_TYPE t)
void GWEN_DB_Node_Unlink (GWEN_DB_NODE *n)
void GWEN_DB_Node_Unlink_UnDirty (GWEN_DB_NODE *n)
int GWEN_DB_RemoveCharValue (GWEN_DB_NODE *n, const char *path, const char *val, int senseCase)
int GWEN_DB_ReplaceVars (GWEN_DB_NODE *db, const char *s, GWEN_BUFFER *dbuf)
int GWEN_DB_SetBinValue (GWEN_DB_NODE *n, uint32_t flags, const char *path, const void *val, unsigned int valSize)
int GWEN_DB_SetCharValue (GWEN_DB_NODE *n, uint32_t flags, const char *path, const char *val)
int GWEN_DB_SetCharValueFromInt (GWEN_DB_NODE *n, uint32_t flags, const char *path, int val)
int GWEN_DB_SetCharValueInNode (GWEN_DB_NODE *n, const char *s)
int GWEN_DB_SetIntValue (GWEN_DB_NODE *n, uint32_t flags, const char *path, int val)
void GWEN_DB_SetNodeFlags (GWEN_DB_NODE *n, uint32_t flags)
int GWEN_DB_SetPtrValue (GWEN_DB_NODE *n, uint32_t flags, const char *path, void *val)
void GWEN_DB_UnlinkGroup (GWEN_DB_NODE *n)
GWEN_DB_NODEGWEN_DB_ValueBin_new (const void *data, unsigned int datasize)
GWEN_DB_NODEGWEN_DB_ValueChar_new (const char *data)
GWEN_DB_NODEGWEN_DB_ValueChar_newFromInt (int v)
int GWEN_DB_ValueExists (GWEN_DB_NODE *n, const char *path, unsigned int i)
GWEN_DB_NODEGWEN_DB_ValueInt_new (int data)
GWEN_DB_NODEGWEN_DB_ValuePtr_new (void *data)
unsigned int GWEN_DB_Values_Count (const GWEN_DB_NODE *node)
void * GWEN_DB_Values_Foreach (GWEN_DB_NODE *node, GWEN_DB_NODES_CB func, void *user_data)
GWEN_DB_NODEGWEN_DB_Var_new (const char *name)
int GWEN_DB_VariableExists (GWEN_DB_NODE *n, const char *path)
const char * GWEN_DB_VariableName (GWEN_DB_NODE *n)
void GWEN_DB_VariableRename (GWEN_DB_NODE *n, const char *newname)
unsigned int GWEN_DB_Variables_Count (const GWEN_DB_NODE *node)
void * GWEN_DB_Variables_Foreach (GWEN_DB_NODE *node, GWEN_DB_NODES_CB func, void *user_data)
int GWEN_DB_WriteVarValueToBuffer (GWEN_DB_NODE *db, const char *name, int index, GWEN_BUFFER *dstBuf)

Macro Definition Documentation

◆ DISABLE_DEBUGLOG

#define DISABLE_DEBUGLOG

Definition at line 30 of file db.c.

◆ GWEN_DB_NODE_FLAGS_GROUP

#define GWEN_DB_NODE_FLAGS_GROUP   0x80000000

Definition at line 62 of file db.c.

◆ GWEN_DB_NODE_FLAGS_MASK_INTERNAL

#define GWEN_DB_NODE_FLAGS_MASK_INTERNAL   0xf0000000

Definition at line 61 of file db.c.

Function Documentation

◆ _replaceVarsCb() [1/2]

int GWENHYWFAR_CB _replaceVarsCb ( void * cbPtr,
const char * name,
int index,
GWEN_UNUSED int maxLen,
GWEN_BUFFER * dstBuf )

Definition at line 1965 of file db.c.

References DBG_INFO, GWEN_DB_WriteVarValueToBuffer(), GWEN_LOGDOMAIN, GWEN_UNUSED, and GWENHYWFAR_CB.

Here is the call graph for this function:

◆ _replaceVarsCb() [2/2]

int GWENHYWFAR_CB _replaceVarsCb ( void * cbPtr,
const char * name,
int index,
int maxLen,
GWEN_BUFFER * dstBuf )
static

References GWENHYWFAR_CB.

Referenced by GWEN_DB_ReplaceVars().

Here is the caller graph for this function:

◆ _writeVarValueToBuffer()

int _writeVarValueToBuffer ( GWEN_DB_NODE * db,
const char * name,
int index,
GWEN_BUFFER * dstBuf )
static

◆ GWEN_DB_AddCharValue()

int GWEN_DB_AddCharValue ( GWEN_DB_NODE * n,
const char * path,
const char * val,
int senseCase,
int check )

Adds the given char value to the given variable if it not already exists (depending on the arguments senseCase and check).

Returns
0 on success, nonzero on error
Parameters
ndb node
pathpath and name of the variable
valThe string value that is copied into the DB
senseCaseif 0 then the case of the value is ignored while checking
checkif 1 then the variable will be checked for this value

Definition at line 1073 of file db.c.

References DBG_DEBUG, DBG_VERBOUS, GWEN_DB_FLAGS_DEFAULT, GWEN_DB_GetFirstValue(), GWEN_DB_GetNode(), GWEN_DB_Node_Append(), GWEN_DB_NodeType_ValueChar, GWEN_DB_ValueChar_new(), GWEN_LOGDOMAIN, and GWEN_PATH_FLAGS_VARIABLE.

Here is the call graph for this function:

◆ GWEN_DB_AddGroup()

int GWEN_DB_AddGroup ( GWEN_DB_NODE * parent,
GWEN_DB_NODE * node )

Adds the given group node as a new child of the given parent group node.

The group name has no influence on what will happen in this function. In other words, if the parent group already has a child group with the same name as 'node', then after this function two child group nodes with the same name will exist.

Note
This function takes over the ownership of the new group, so you MUST NOT free it afterwards.
Parameters
parentSome group node that will be the parent of the added node
nodeGroup node to add

Definition at line 1482 of file db.c.

References DBG_ERROR, GWEN_DB_Node_Append(), GWEN_DB_NodeType_Group, and GWEN_LOGDOMAIN.

Referenced by _csvImport(), and GWEN_TLV_Buffer_To_DB().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_AddGroupChildren()

int GWEN_DB_AddGroupChildren ( GWEN_DB_NODE * n,
GWEN_DB_NODE * nn )

This function adds all children of the second node as new children to the first given one.

Note
This function does NOT take over ownership of the new group. The caller is still the owner of the given group.
Parameters
ndb node
nnnode whose children are to be added (makes deep copies)

Definition at line 1524 of file db.c.

References DBG_ERROR, DBG_VERBOUS, GWEN_DB_Dump(), GWEN_DB_Node_Append(), GWEN_DB_Node_dup(), GWEN_DB_NodeType_Group, and GWEN_LOGDOMAIN.

Referenced by _setupVariables(), GWEN_HttpSession_RecvCommand(), GWEN_Test_Module_WriteDb(), and GWEN_Url_toDb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_ClearGroup()

int GWEN_DB_ClearGroup ( GWEN_DB_NODE * n,
const char * path )

Frees all children of the given node thereby clearing it.

Returns
0 on success, nonzero on error
Parameters
ndb node
pathpath to the group under the given node to clear (if 0 then clear the given node)

Definition at line 944 of file db.c.

References DBG_VERBOUS, GWEN_DB_ClearNode(), GWEN_DB_GetNode(), GWEN_LOGDOMAIN, GWEN_PATH_FLAGS_NAMEMUSTEXIST, and GWEN_PATH_FLAGS_PATHMUSTEXIST.

Referenced by GWEN_Gui_Internal_SetPasswordStatus(), GWEN_SyncIo_Http_Read(), and GWEN_SyncIo_Http_SetWriteIdle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_ClearNode()

void GWEN_DB_ClearNode ( GWEN_DB_NODE * n)

Definition at line 852 of file db.c.

Referenced by GWEN_DB_ClearGroup(), GWEN_DB_GetGroup(), GWEN_DB_SetBinValue(), GWEN_DB_SetCharValue(), GWEN_DB_SetCharValueFromInt(), GWEN_DB_SetIntValue(), and GWEN_DB_SetPtrValue().

Here is the caller graph for this function:

◆ GWEN_DB_count_cb()

void * GWEN_DB_count_cb ( GWEN_UNUSED GWEN_DB_NODE * node,
void * user_data )

Definition at line 1688 of file db.c.

References GWEN_UNUSED, and NULL.

Referenced by GWEN_DB_Groups_Count(), GWEN_DB_Values_Count(), and GWEN_DB_Variables_Count().

Here is the caller graph for this function:

◆ GWEN_DB_DeleteGroup()

int GWEN_DB_DeleteGroup ( GWEN_DB_NODE * n,
const char * path )

Locates and removes the group of the given name.

Returns
0 on success, nonzero on error
Parameters
ndb node
pathpath to the group to delete

Definition at line 922 of file db.c.

References DBG_VERBOUS, GWEN_DB_GetNode(), GWEN_DB_Node_free(), GWEN_DB_Node_Unlink(), GWEN_LOGDOMAIN, GWEN_PATH_FLAGS_NAMEMUSTEXIST, and GWEN_PATH_FLAGS_PATHMUSTEXIST.

Referenced by GWB_Parser_CopyContextForSubdir(), GWEN_PathManager_RemovePaths(), and GWEN_Test_Module_WriteDb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_DeleteVar()

int GWEN_DB_DeleteVar ( GWEN_DB_NODE * n,
const char * path )

Deletes the given variable by removing it and its values from the DB.

Parameters
nroot of the DB
pathpath to the variable to remove
Returns
Zero on success, nonzero on error

Definition at line 899 of file db.c.

References DBG_VERBOUS, GWEN_DB_GetNode(), GWEN_DB_Node_free(), GWEN_DB_Node_Unlink(), GWEN_LOGDOMAIN, GWEN_PATH_FLAGS_NAMEMUSTEXIST, GWEN_PATH_FLAGS_PATHMUSTEXIST, and GWEN_PATH_FLAGS_VARIABLE.

Referenced by _convertAndSetCharValue(), _parseSetVar(), GWEN_Crypt_Token_Context_WriteDb(), GWEN_Crypt_Token_KeyInfo_WriteDb(), GWEN_Dialog_ListWriteColumnSettings(), GWEN_Gui_Internal_SetPasswordStatus(), GWEN_MsgEngine_SetMode(), GWEN_Param_WriteDb(), GWEN_PasswordStore__SetPassword(), GWEN_StringList2_toDb(), and GWEN_Test_Module_WriteDb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_Dump()

void GWEN_DB_Dump ( GWEN_DB_NODE * n,
int insert )

◆ GWEN_DB_FindFirstGroup()

GWEN_DB_NODE * GWEN_DB_FindFirstGroup ( GWEN_DB_NODE * n,
const char * name )

Returns the first group node below the given one by name.

If there is no matching group node then NULL is returned. This can either mean that this node does not have any children or the only children are variables instead of groups or their is no group of the given name.

Parameters
ndb node
namename to look for (joker and wildcards allowed)

Definition at line 1840 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Group, GWEN_LOGDOMAIN, GWEN_Text_ComparePattern(), and NULL.

Referenced by _dbForEvery(), GWEN_MsgEngine__WriteGroup(), GWEN_PathManager_FindFile(), GWEN_PathManager_GetMatchingFilesRecursively(), GWEN_PathManager_GetPaths(), GWEN_PathManager_RemovePath(), and GWEN_PathManager_RemovePaths().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_FindFirstVar()

GWEN_DB_NODE * GWEN_DB_FindFirstVar ( GWEN_DB_NODE * n,
const char * name )

Returns the first variable node below the given one by name.

If there is no matching variable node then NULL is returned. This can either mean that this node does not have any children or the only children are groups/values instead of variables or their is no variable of the given name.

Parameters
ndb node
namename to look for (joker and wildcards allowed)

Definition at line 1883 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Group, GWEN_DB_NodeType_Var, GWEN_LOGDOMAIN, GWEN_Text_ComparePattern(), and NULL.

Here is the call graph for this function:

◆ GWEN_DB_FindGroup()

GWEN_DB_NODE * GWEN_DB_FindGroup ( GWEN_DB_NODE * n,
const char * name,
int idx )

Definition at line 650 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Group, GWEN_LOGDOMAIN, and NULL.

Referenced by GWEN_DB_HandlePath().

Here is the caller graph for this function:

◆ GWEN_DB_FindNextGroup()

GWEN_DB_NODE * GWEN_DB_FindNextGroup ( GWEN_DB_NODE * n,
const char * name )

Returns the next group node following the given one, which has the same parent node, by name.

If there is no matching group node then NULL is returned. This can either mean that the parent node does not have any further children, or that the other children are variables instead of groups or that there is no group with the given name.

Note
This is one of the few functions where the returned node is not the child of the specified node, but instead it is the next node with the same parent node. In other words, this function is an exception. In most other functions the returned node is a child of the specified node.
Parameters
ndb node
namename to look for (joker and wildcards allowed)

Definition at line 1861 of file db.c.

References DBG_ERROR, GWEN_DB_GetNextGroup(), GWEN_DB_NodeType_Group, GWEN_LOGDOMAIN, GWEN_Text_ComparePattern(), and NULL.

Referenced by _dbForEvery(), GWEN_MsgEngine__WriteGroup(), GWEN_PathManager_FindFile(), GWEN_PathManager_GetMatchingFilesRecursively(), GWEN_PathManager_GetPaths(), GWEN_PathManager_RemovePath(), and GWEN_PathManager_RemovePaths().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_FindNextVar()

GWEN_DB_NODE * GWEN_DB_FindNextVar ( GWEN_DB_NODE * n,
const char * name )

Returns the next variable node following the given one, which has the same parent node, by name.

If there is no matching variable node then NULL is returned. This can either mean that this node does not have any children or the only children are groups/values instead of variables or their is no variable of the given name.

Note
This is one of the few functions where the returned node is not the child of the specified node, but instead it is the next node with the same parent node. In other words, this function is an exception. In most other functions the returned node is a child of the specified node.
Parameters
ndb node
namename to look for (joker and wildcards allowed)

Definition at line 1906 of file db.c.

References DBG_ERROR, GWEN_DB_GetNextVar(), GWEN_DB_NodeType_Var, GWEN_LOGDOMAIN, GWEN_Text_ComparePattern(), and NULL.

Here is the call graph for this function:

◆ GWEN_DB_FindVar()

GWEN_DB_NODE * GWEN_DB_FindVar ( GWEN_DB_NODE * n,
const char * name,
int idx )

Definition at line 684 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Group, GWEN_DB_NodeType_Var, GWEN_LOGDOMAIN, and NULL.

Referenced by GWEN_DB_GetVariableType(), and GWEN_DB_HandlePath().

Here is the caller graph for this function:

◆ GWEN_DB_GetBinValue()

const void * GWEN_DB_GetBinValue ( GWEN_DB_NODE * n,
const char * path,
int idx,
const void * defVal,
unsigned int defValSize,
unsigned int * returnValueSize )

Returns the variable's retrieved value. The size of the binary data is written into the int pointer argument returnValueSize.

Parameters
ndb node
pathpath and name of the variable
idxindex number of the value to return
defValdefault value to return in case there is no real value
defValSizesize of the default value
returnValueSizepointer to a variable to receive the length of the data returned

Definition at line 1237 of file db.c.

References DBG_VERBOUS, GWEN_DB_GetValue(), GWEN_DB_NodeType_ValueBin, and GWEN_LOGDOMAIN.

Referenced by GWEN_Crypt_CryptAlgo_fromDb(), GWEN_Crypt_HashAlgo_fromDb(), GWEN_Crypt_KeyRsa__ReadMpi(), GWEN_Crypt_KeySym__fromDb(), GWEN_Crypt_KeySym_fromDb(), GWEN_Crypt_Token_Context_ReadDb(), GWEN_Crypt_Token_KeyInfo_ReadDb(), GWEN_Crypt_TokenOHBCI__EncodeKey(), GWEN_MsgEngine__TransformValue(), and GWEN_MsgEngine__WriteElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_GetBinValueFromNode()

const void * GWEN_DB_GetBinValueFromNode ( const GWEN_DB_NODE * n,
unsigned int * size )

Definition at line 634 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_ValueBin, GWEN_LOGDOMAIN, and NULL.

Referenced by GWEN_DBIO_XmlDb__ExportVar().

Here is the caller graph for this function:

◆ GWEN_DB_GetCharValue()

const char * GWEN_DB_GetCharValue ( GWEN_DB_NODE * n,
const char * path,
int idx,
const char * defVal )

Returns the variable's retrieved value.

Parameters
ndb node
pathpath and name of the variable
idxindex number of the value to return
defValdefault value to return in case there is no real value

Definition at line 971 of file db.c.

References DBG_VERBOUS, GWEN_DB_GetValue(), GWEN_DB_NodeType_ValueChar, and GWEN_LOGDOMAIN.

Referenced by _addTargetForLanguage(), _appendVarValue(), _convertAndSetCharValue(), _csvExport(), _csvImport(), _dbIfCharDataMatches(), _dbIfHasCharData(), _dbIfNotCharDataMatches(), _dbIfNotHasCharData(), _determineTarget(), _determineTools(), _parseI18n(), _parseIfNotVarMatches(), _parseIfVarMatches(), _parseVersions(), _readOptionsFromDb(), _recvPacket(), _recvPacketToSio(), _setProjectVersionFromString(), _setupGui(), _stringListToDb(), _tryReadCachedPasswd(), _varHasValue(), _writeProjectVersionToContextDbVars(), _writeVarValueToBuffer(), _xmlSetCharValue(), activateKey(), add2Archive(), build(), buildDefs(), buildFile2(), changePin(), checkArchive(), checkTree(), createArchive(), createToken(), cryptWithNew(), doBuildDefs(), extractArchive(), genKey(), GWB_Build(), GWB_Parser_ReplaceVarsBetweenAtSigns(), GWB_Setup(), GWB_Tools_CheckCompilerArgs(), GWB_Tools_TryCompile(), GWB_Tools_TryLink(), GWEN_Crypt_CryptAlgo_fromDb(), GWEN_Crypt_HashAlgo_fromDb(), GWEN_Crypt_Key_fromDb(), GWEN_Crypt_PaddAlgo_fromDb(), GWEN_Crypt_Token_Context_ReadDb(), GWEN_Crypt_Token_KeyInfo_ReadDb(), GWEN_Crypt_TokenOHBCI__Decode(), GWEN_Date_fromDb(), GWEN_DBIO_XmlDb_Export(), GWEN_DBIO_XmlDb_Import(), GWEN_MsgEngine__TransformValue(), GWEN_MsgEngine__WriteElement(), GWEN_MsgEngine_GetMode(), GWEN_MsgEngine_GetValue(), GWEN_MsgEngine_ReadMessage(), GWEN_Param_ReadDb(), GWEN_PasswordStore__GetPassword(), GWEN_PathManager_FindFile(), GWEN_PathManager_GetMatchingFilesRecursively(), GWEN_PathManager_GetPaths(), GWEN_PathManager_RemovePath(), GWEN_PathManager_RemovePaths(), GWEN_SslCertDescr_ReadDb(), GWEN_StringList2_fromDb(), GWEN_SyncIo_Http_ParseHeader(), GWEN_SyncIo_Http_Read(), GWEN_SyncIo_Http_RecvBody(), GWEN_SyncIo_Http_RecvBodyToSio(), GWEN_SyncIo_Http_Write(), GWEN_SyncIo_Http_WriteCommand(), GWEN_SyncIo_Http_WriteStatus(), GWEN_Test_Module_GetCharParam(), GWEN_Test_Module_ReadDb(), GWEN_Timestamp_fromDb(), GWEN_Url_ReadDb(), hashTree(), HtmlGroup_Box_StartTag(), HtmlGroup_TableRow_StartTag(), listArchive(), main(), mkArchiveKey(), releaseFillIn(), setKey(), setSignSeq(), showKey(), showPasswords(), showUser(), signArchive(), signWithNew(), Typemaker2_Builder_ReplaceVars(), updateToken(), and verifyArchive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_GetCharValueFromNode()

const char * GWEN_DB_GetCharValueFromNode ( const GWEN_DB_NODE * n)

Returns the value data of the given value node. If the given node is not a char-value node then 0 is returned.

Definition at line 578 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_ValueChar, GWEN_LOGDOMAIN, and NULL.

Referenced by GWEN_DBIO_XmlDb__ExportVar(), GWEN_SyncIo_Http_WriteHeader(), GWEN_Url_toCommandString(), and GWEN_Url_toString().

Here is the caller graph for this function:

◆ GWEN_DB_GetFirstGroup()

GWEN_DB_NODE * GWEN_DB_GetFirstGroup ( GWEN_DB_NODE * n)

Returns the first group node below the given one.

If there is no group node then NULL is returned. This can either mean that this node does not have any children or the only children are variables instead of groups.

Parameters
ndb node

Definition at line 440 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Group, GWEN_LOGDOMAIN, and NULL.

Referenced by _csvExport(), GWEN_DB_Groups_Foreach(), GWEN_DBIO_XmlDb__ExportGroup(), and GWEN_PathManager_RemovePaths().

Here is the caller graph for this function:

◆ GWEN_DB_GetFirstValue()

GWEN_DB_NODE * GWEN_DB_GetFirstValue ( GWEN_DB_NODE * n)

Returns the first value below the given variable. If there is no value then NULL is returned.

Parameters
ndb node

Definition at line 518 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_ValueChar, GWEN_DB_NodeType_ValueLast, GWEN_DB_NodeType_Var, GWEN_LOGDOMAIN, and NULL.

Referenced by GWEN_DB_AddCharValue(), GWEN_DB_GetVariableType(), GWEN_DB_RemoveCharValue(), GWEN_DB_Values_Foreach(), GWEN_DBIO_XmlDb__ExportVar(), GWEN_SyncIo_Http_WriteHeader(), GWEN_Url_toCommandString(), and GWEN_Url_toString().

Here is the caller graph for this function:

◆ GWEN_DB_GetFirstVar()

GWEN_DB_NODE * GWEN_DB_GetFirstVar ( GWEN_DB_NODE * n)

Returns the first variable below the given group. If there is no variable then NULL is returned.

Parameters
ndb node

Definition at line 479 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Group, GWEN_DB_NodeType_Var, GWEN_LOGDOMAIN, and NULL.

Referenced by GWEN_DB_Variables_Foreach(), GWEN_DBIO_XmlDb__ExportGroup(), GWEN_PasswordStore_GetTokenList(), GWEN_SyncIo_Http_WriteHeader(), GWEN_Url_toCommandString(), and GWEN_Url_toString().

Here is the caller graph for this function:

◆ GWEN_DB_GetGroup()

GWEN_DB_NODE * GWEN_DB_GetGroup ( GWEN_DB_NODE * n,
uint32_t flags,
const char * path )

This function either creates a new group, returns an existing one or returns an error if there is no group but the caller wanted one (depending on the flags given).

Parameters
ndb node
flagssee GWEN_DB_FLAGS_OVERWRITE_VARS and others which can all be OR-combined to form the flags to use.
pathpath and name of the group to be created/located

Definition at line 1381 of file db.c.

References DBG_VERBOUS, GWEN_DB_ClearNode(), GWEN_DB_FLAGS_OVERWRITE_GROUPS, GWEN_DB_GetNode(), GWEN_LOGDOMAIN, GWEN_PATH_FLAGS_VARIABLE, and NULL.

Referenced by _csvExport(), _csvImport(), _dbEnter(), _dbIfNotPathExists(), _dbIfPathExists(), _handleDbCreateAndEnterGroup(), _handleDbCreateAndEnterGroup(), _handleDbCreateAndEnterTempGroup(), _handleDbCreateAndEnterTempGroup(), _stringListToDb(), activateKey(), add2Archive(), changePin(), checkArchive(), checkTree(), createArchive(), createToken(), cryptWithNew(), extractArchive(), genKey(), GWEN_Crypt_KeyRsa_fromDb(), GWEN_Crypt_KeyRsa_fromModExp(), GWEN_Crypt_KeyRsa_fromModPrivExp(), GWEN_Crypt_KeyRsa_toDb(), GWEN_Crypt_KeySym__fromDb(), GWEN_Crypt_KeySym__toDb(), GWEN_Crypt_KeySym_fromDb(), GWEN_Crypt_KeySym_toDb(), GWEN_Crypt_TokenOHBCI__Decode(), GWEN_Crypt_TokenOHBCI__DecodeKey(), GWEN_DB_ReadFromFastBuffer(), GWEN_DBIO__XmlDb_ImportGroup(), GWEN_DBIO_OldDb__ParseLine(), GWEN_HttpSession_RecvCommand(), GWEN_MsgEngine__ReadGroup(), GWEN_MsgEngine_ReadMessage(), GWEN_PathManager_AddPath(), GWEN_PathManager_DefinePath(), GWEN_PathManager_FindFile(), GWEN_PathManager_GetMatchingFilesRecursively(), GWEN_PathManager_GetPaths(), GWEN_PathManager_InsertPath(), GWEN_PathManager_PathChanged(), GWEN_PathManager_RemovePath(), GWEN_PathManager_UndefinePath(), GWEN_SslCertDescr_ReadDb(), GWEN_SslCertDescr_toDb(), GWEN_Test_Module_ReadDb(), GWEN_Test_Module_WriteDb(), GWEN_Time_fromDb(), GWEN_Time_toDb(), GWEN_Url_ReadDb(), GWEN_Url_toDb(), hashTree(), listArchive(), mkArchiveKey(), releaseFillIn(), setKey(), setSignSeq(), showKey(), showPasswords(), showUser(), signArchive(), signWithNew(), updateToken(), and verifyArchive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_GetIntValue()

int GWEN_DB_GetIntValue ( GWEN_DB_NODE * n,
const char * path,
int idx,
int defVal )

Returns the variable's retrieved value.

Parameters
ndb node
pathpath and name of the variable
idxindex number of the value to return
defValdefault value to return in case there is no real value

Definition at line 1163 of file db.c.

References DBG_ERROR, DBG_INFO, DBG_VERBOUS, GWEN_DB_GetValue(), GWEN_DB_NodeType_ValueChar, GWEN_DB_NodeType_ValueInt, and GWEN_LOGDOMAIN.

Referenced by _csvExport(), _csvImport(), _setProjectVersionFromString(), _setupGui(), _splitFixedWithStringIntoStringlist(), _writeVarValueToBuffer(), activateKey(), add2Archive(), buildFile2(), changePin(), cryptWithNew(), extractArchive(), genKey(), GWB_Build(), GWB_Setup(), GWEN_Args_Check(), GWEN_Crypt_CryptAlgo_fromDb(), GWEN_Crypt_Key_fromDb(), GWEN_Crypt_KeyRsa_fromDb(), GWEN_Crypt_PaddAlgo_fromDb(), GWEN_Crypt_Token_Context_ReadDb(), GWEN_Crypt_Token_KeyInfo_ReadDb(), GWEN_Dialog_ListReadColumnSettings(), GWEN_DlgInput_Init(), GWEN_DlgMessage_Init(), GWEN_DlgProgress_Init(), GWEN_DlgShowBox_Init(), GWEN_MsgEngine__TransformValue(), GWEN_MsgEngine__WriteElement(), GWEN_MsgEngine_GetIntValue(), GWEN_MsgEngine_GetProtocolVersion(), GWEN_MsgEngine_ReadMessage(), GWEN_Param_ReadDb(), GWEN_SslCertDescr_ReadDb(), GWEN_SyncIo_Http_ParseHeader(), GWEN_SyncIo_Http_RecvBody(), GWEN_SyncIo_Http_RecvBodyToSio(), GWEN_SyncIo_Http_WriteHeader(), GWEN_SyncIo_Http_WriteStatus(), GWEN_Test_Module_ReadDb(), GWEN_Time_fromDb(), GWEN_Url_ReadDb(), HtmlGroup_Box_StartTag(), main(), releaseFillIn(), setKey(), setSignSeq(), showKey(), showUser(), signWithNew(), and updateToken().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_GetIntValueFromNode()

int GWEN_DB_GetIntValueFromNode ( const GWEN_DB_NODE * n)

Definition at line 607 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_ValueChar, GWEN_DB_NodeType_ValueInt, and GWEN_LOGDOMAIN.

Referenced by GWEN_DBIO_XmlDb__ExportVar(), and GWEN_SyncIo_Http_WriteHeader().

Here is the caller graph for this function:

◆ GWEN_DB_GetNextGroup()

GWEN_DB_NODE * GWEN_DB_GetNextGroup ( GWEN_DB_NODE * n)

Returns the next group node following the given one, which has the same parent node.

This function works absolutely independently of the group nodes' names – the returned node may or may not have the same name as the specified node. The only guarantee is that the returned node will be a group node.

If there is no group node then NULL is returned. This can either mean that the parent node does not have any further children, or that the other children are variables instead of groups.

Note
This is one of the few functions where the returned node is not the child of the specified node, but instead it is the next node with the same parent node. In other words, this function is an exception. In most other functions the returned node is a child of the specified node.
Parameters
ndb node

Definition at line 461 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Group, GWEN_LOGDOMAIN, and NULL.

Referenced by _csvExport(), GWEN_DB_FindNextGroup(), GWEN_DB_Groups_Foreach(), GWEN_DBIO_XmlDb__ExportGroup(), and GWEN_PathManager_RemovePaths().

Here is the caller graph for this function:

◆ GWEN_DB_GetNextValue()

GWEN_DB_NODE * GWEN_DB_GetNextValue ( GWEN_DB_NODE * n)

Returns the next value node following the given one, which has the same parent node.

If there is no value node then NULL is returned. This can either mean that the parent node does not have any further children, or that the other children aren't values.

Note
This is the only function where the returned node is not the child of the specified node, but instead it is the next node with the same parent node. In other words, this function is an exception. In all other functions the returned node is a child of the specified node.
Parameters
ndb node

Definition at line 541 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_ValueChar, GWEN_DB_NodeType_ValueLast, GWEN_LOGDOMAIN, and NULL.

Referenced by GWEN_DB_Values_Foreach(), and GWEN_DBIO_XmlDb__ExportVar().

Here is the caller graph for this function:

◆ GWEN_DB_GetNextVar()

GWEN_DB_NODE * GWEN_DB_GetNextVar ( GWEN_DB_NODE * n)

Returns the next variable node following the given one, which has the same parent node.

This function works absolutely independently of the variable nodes' names – the returned node may or may not have the same name as the specified node. The only guarantee is that the returned node will be a variable node.

If there is no variable node then NULL is returned. This can either mean that the parent node does not have any further children, or that the other children are groups instead of variables.

Note
This is the only function where the returned node is not the child of the specified node, but instead it is the next node with the same parent node. In other words, this function is an exception. In all other functions the returned node is a child of the specified node.
Parameters
ndb node

Definition at line 500 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Var, GWEN_LOGDOMAIN, and NULL.

Referenced by GWEN_DB_FindNextVar(), GWEN_DB_Variables_Foreach(), GWEN_DBIO_XmlDb__ExportGroup(), GWEN_PasswordStore_GetTokenList(), GWEN_SyncIo_Http_WriteHeader(), GWEN_Url_toCommandString(), and GWEN_Url_toString().

Here is the caller graph for this function:

◆ GWEN_DB_GetNode()

◆ GWEN_DB_GetNodeFlags()

uint32_t GWEN_DB_GetNodeFlags ( const GWEN_DB_NODE * n)

Returns the node flags for the given db node. Please note that all modifications applied to a node will set the dirty flag in the node itself and all its parents. This allows to use this funcion here to check whether a DB has been modified.

Returns
current node flags for this node (see GWEN_DB_NODE_FLAGS_DIRTY)
Parameters
ndb node

Definition at line 1770 of file db.c.

Referenced by GWEN_DBIO_XmlDb__ExportGroup(), GWEN_DBIO_XmlDb__ExportVar(), and GWEN_PathManager_PathChanged().

Here is the caller graph for this function:

◆ GWEN_DB_GetParentGroup()

GWEN_DB_NODE * GWEN_DB_GetParentGroup ( GWEN_DB_NODE * n)

Returns the parent group of the given node.

Definition at line 1827 of file db.c.

References GWEN_DB_NodeType_Group.

◆ GWEN_DB_GetPtrValue()

void * GWEN_DB_GetPtrValue ( GWEN_DB_NODE * n,
const char * path,
int idx,
void * defVal )

Returns the variable's retrieved value.

Parameters
ndb node
pathpath and name of the variable
idxindex number of the value to return
defValdefault value to return in case there is no real value

Definition at line 1306 of file db.c.

References DBG_VERBOUS, GWEN_DB_GetValue(), GWEN_DB_NodeType_ValuePtr, and GWEN_LOGDOMAIN.

Here is the call graph for this function:

◆ GWEN_DB_GetValue()

GWEN_DB_NODE * GWEN_DB_GetValue ( GWEN_DB_NODE * n,
const char * path,
int idx )

◆ GWEN_DB_GetValueType()

GWEN_DB_NODE_TYPE GWEN_DB_GetValueType ( GWEN_DB_NODE * n)

Returns the type of the given value.

Parameters
ndb node

Definition at line 563 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Unknown, GWEN_DB_NodeType_ValueChar, GWEN_DB_NodeType_ValueLast, and GWEN_LOGDOMAIN.

Referenced by GWEN_DB_GetValueTypeByPath(), GWEN_DB_GetVariableType(), GWEN_DBIO_XmlDb__ExportVar(), and GWEN_SyncIo_Http_WriteHeader().

Here is the caller graph for this function:

◆ GWEN_DB_GetValueTypeByPath()

GWEN_DB_NODE_TYPE GWEN_DB_GetValueTypeByPath ( GWEN_DB_NODE * n,
const char * path,
unsigned int i )

Definition at line 1612 of file db.c.

References GWEN_DB_GetValue(), GWEN_DB_GetValueType(), and GWEN_DB_NodeType_Unknown.

Referenced by _csvExport(), _writeVarValueToBuffer(), and GWEN_MsgEngine__WriteElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_GetVariableType()

GWEN_DB_NODE_TYPE GWEN_DB_GetVariableType ( GWEN_DB_NODE * n,
const char * p )

Returns the type of the first value of the given variable

Parameters
nroot node of the DB
ppath of the variable to inspect

Definition at line 1595 of file db.c.

References GWEN_DB_FindVar(), GWEN_DB_GetFirstValue(), GWEN_DB_GetValueType(), and GWEN_DB_NodeType_Unknown.

Referenced by GWEN_MsgEngine__TransformValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_Group_dup()

GWEN_DB_NODE * GWEN_DB_Group_dup ( const GWEN_DB_NODE * n)

Creates a deep copy of the given node. This copy will then be owned by the caller and MUST be freed after using it by calling GWEN_DB_Group_free().

Parameters
ndb node

Definition at line 428 of file db.c.

References DBG_ERROR, GWEN_DB_Node_dup(), GWEN_DB_NodeType_Group, GWEN_LOGDOMAIN, and NULL.

Referenced by GWB_Context_dup(), GWEN_Msg_dup(), GWEN_Test_Module_copy(), GWEN_Test_Module_dup(), GWEN_Test_Module_ReadDb(), GWEN_Test_Module_SetParamsDb(), GWEN_Url_dup(), GWEN_Url_ReadDb(), and GWEN_Url_SetVars().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_Group_free()

void GWEN_DB_Group_free ( GWEN_DB_NODE * n)

Frees a DB group. I.e. this is the destructor. This is needed to avoid memory leaks.

Parameters
ndb node

Definition at line 421 of file db.c.

References GWEN_DB_Node_free().

Referenced by _buildGroupApiDoc(), _freeData(), _handleDbCreateAndEnterTempGroup(), _handleDbCreateAndEnterTempGroup(), _readCommandLine(), _setProjectVersionFromString(), GWB_Context_free(), GWB_ParseBuildFiles(), GWB_RepeatLastSetup(), GWEN_Args_Check(), GWEN_ConfigMgrDir_GetGroup(), GWEN_Crypt_KeyRsa_dup(), GWEN_Crypt_KeyRsa_fromModExp(), GWEN_Crypt_KeyRsa_fromModPrivExp(), GWEN_Crypt_TokenOHBCI__Decode(), GWEN_Crypt_TokenOHBCI__EncodeKey(), GWEN_DBIO_OldDb_CheckFile(), GWEN_Dialog_free(), GWEN_Gui_free(), GWEN_Gui_SetPasswordDb(), GWEN_Msg_free(), GWEN_Msg_SetDbParsedInfo(), GWEN_MsgEngine_free(), GWEN_MsgEngine_ReadMessage(), GWEN_PasswordStore_ClearStoragePasswd(), GWEN_PasswordStore_free(), GWEN_PasswordStore_SafeFreeDb(), GWEN_PathManager_ModuleFini(), GWEN_PathManager_RemovePath(), GWEN_PathManager_RemovePaths(), GWEN_PathManager_UndefinePath(), GWEN_SyncIo_Http_FreeData(), GWEN_SyncIo_Tls_GetPeerCert(), GWEN_Test_Module_copy(), GWEN_Test_Module_dup(), GWEN_Test_Module_free(), GWEN_Test_Module_ReadDb(), GWEN_Test_Module_SetParamsDb(), GWEN_Url_dup(), GWEN_Url_free(), GWEN_Url_fromCommandString(), GWEN_Url_fromString(), GWEN_Url_ReadDb(), GWEN_Url_SetVars(), HtmlCtx_FreeData(), HtmlCtx_StartTag(), and mkArchiveKey().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_Group_new()

GWEN_DB_NODE * GWEN_DB_Group_new ( const char * name)

◆ GWEN_DB_GroupName()

const char * GWEN_DB_GroupName ( GWEN_DB_NODE * n)

Returns the name of the given group.

Definition at line 1408 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Group, GWEN_LOGDOMAIN, and NULL.

Referenced by _csvExport(), and GWEN_DBIO_XmlDb__ExportGroup().

Here is the caller graph for this function:

◆ GWEN_DB_GroupRename()

void GWEN_DB_GroupRename ( GWEN_DB_NODE * n,
const char * newname )

Renames the given group.

Parameters
ndb node
newnamenew name for the group

Definition at line 1625 of file db.c.

References GWEN_DB_NodeType_Group, GWEN_Memory_dealloc(), and GWEN_Memory_strdup().

Here is the call graph for this function:

◆ GWEN_DB_Groups_Count()

unsigned int GWEN_DB_Groups_Count ( const GWEN_DB_NODE * node)

Returns the number of group nodes that are direct children of the given node. In other words, this is the number of group nodes that will be reached in the GWEN_DB_Groups_foreach() function.

Definition at line 1697 of file db.c.

References GWEN_DB_count_cb(), and GWEN_DB_Groups_Foreach().

Here is the call graph for this function:

◆ GWEN_DB_Groups_Foreach()

void * GWEN_DB_Groups_Foreach ( GWEN_DB_NODE * node,
GWEN_DB_NODES_CB func,
void * user_data )

Iterates through all group nodes that are direct children of the given node, calling the callback function 'func' on each group node. Traversal will stop when 'func' returns a non-NULL value, and the routine will return with that value. Otherwise the routine will return NULL.

If no nodes that are groups are found as children, then this function will simply do nothing.

Parameters
nodeThe group node whose children shall be iterated through.
funcThe function to be called with each group node.
user_dataA pointer passed on to the function 'func'.
Returns
The non-NULL pointer returned by 'func' as soon as it returns one. Otherwise (i.e. 'func' always returns NULL) returns NULL.
Author
Christian Stimming stimm.nosp@m.ing@.nosp@m.tuhh..nosp@m.de

Definition at line 1665 of file db.c.

References GWEN_DB_GetFirstGroup(), GWEN_DB_GetNextGroup(), and NULL.

Referenced by GWEN_DB_Groups_Count().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_HandlePath()

◆ GWEN_DB_InsertGroup()

int GWEN_DB_InsertGroup ( GWEN_DB_NODE * parent,
GWEN_DB_NODE * node )

Adds the given group node as the new first child of the given parent group node.

The group name has no influence on what will happen in this function. In other words, if the parent group already has a child group with the same name as 'node', then after this function two child group nodes with the same name will exist.

Note
This function takes over the ownership of the new group, so you MUST NOT free it afterwards.
Parameters
parentSome group node that will be the parent of the added node
nodeGroup node to add

Definition at line 1503 of file db.c.

References DBG_ERROR, GWEN_DB_Node_Insert(), GWEN_DB_NodeType_Group, and GWEN_LOGDOMAIN.

Here is the call graph for this function:

◆ GWEN_DB_IsGroup()

int GWEN_DB_IsGroup ( const GWEN_DB_NODE * n)

Predicate: Returns nonzero (TRUE) or zero (FALSE) if the given NODE is a Group or not. Usually these group nodes are the only nodes that the application gets in touch with.

Parameters
ndb node

Definition at line 1640 of file db.c.

References GWEN_DB_NodeType_Group.

◆ GWEN_DB_IsValue()

int GWEN_DB_IsValue ( const GWEN_DB_NODE * n)

Predicate: Returns nonzero (TRUE) or zero (FALSE) if the given NODE is a Value or not. Usually the Application does not get in touch with such Nodes but only with nodes that are Groups.

Parameters
ndb node

Definition at line 1656 of file db.c.

References GWEN_DB_NodeType_ValueChar, and GWEN_DB_NodeType_ValueLast.

◆ GWEN_DB_IsVariable()

int GWEN_DB_IsVariable ( const GWEN_DB_NODE * n)

Predicate: Returns nonzero (TRUE) or zero (FALSE) if the given NODE is a Variable or not. Usually the Application does not get in touch with such Nodes but only with nodes that are Groups.

Parameters
ndb node

Definition at line 1648 of file db.c.

References GWEN_DB_NodeType_Var.

◆ GWEN_DB_ModifyBranchFlagsDown()

void GWEN_DB_ModifyBranchFlagsDown ( GWEN_DB_NODE * n,
uint32_t newflags,
uint32_t mask )

Modifies the flags of the given node and all its children according to the parameters given.

Parameters
ndb node
newflagsnew flags to set (see GWEN_DB_NODE_FLAGS_DIRTY)
maskonly those flags which are set in this mask are modified according to newflags

Definition at line 1805 of file db.c.

References GWEN_DB_ModifyBranchFlagsDown().

Referenced by GWEN_DB_ModifyBranchFlagsDown(), GWEN_PasswordStore__SetPassword(), GWEN_PasswordStore_ClearStoragePasswd(), GWEN_PasswordStore_free(), GWEN_PasswordStore_ReadFile(), GWEN_PasswordStore_SafeFreeDb(), and GWEN_PasswordStore_SetPassword().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_ModifyBranchFlagsUp()

void GWEN_DB_ModifyBranchFlagsUp ( GWEN_DB_NODE * n,
uint32_t newflags,
uint32_t mask )

Modifies the flags of the given node and all its parents according to the parameters given.

Parameters
ndb node
newflagsnew flags to set (see GWEN_DB_NODE_FLAGS_DIRTY)
maskonly those flags which are set in this mask are modified according to newflags

Definition at line 1787 of file db.c.

Referenced by GWEN_DB_Node_Append(), GWEN_DB_Node_Insert(), and GWEN_DB_Node_Unlink().

Here is the caller graph for this function:

◆ GWEN_DB_Node_Append()

◆ GWEN_DB_Node_Append_UnDirty()

void GWEN_DB_Node_Append_UnDirty ( GWEN_DB_NODE * parent,
GWEN_DB_NODE * n )

Definition at line 205 of file db.c.

References NULL.

Referenced by GWEN_DB_Node_Append(), and GWEN_DB_Node_dup().

Here is the caller graph for this function:

◆ GWEN_DB_Node_dup()

◆ GWEN_DB_Node_free()

◆ GWEN_DB_Node_Insert()

void GWEN_DB_Node_Insert ( GWEN_DB_NODE * parent,
GWEN_DB_NODE * n )

Definition at line 246 of file db.c.

References GWEN_DB_ModifyBranchFlagsUp(), GWEN_DB_NODE_FLAGS_DIRTY, and GWEN_DB_Node_InsertUnDirty().

Referenced by GWEN_DB_HandlePath(), GWEN_DB_InsertGroup(), GWEN_DB_SetBinValue(), GWEN_DB_SetCharValue(), GWEN_DB_SetCharValueFromInt(), GWEN_DB_SetIntValue(), and GWEN_DB_SetPtrValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_Node_InsertUnDirty()

void GWEN_DB_Node_InsertUnDirty ( GWEN_DB_NODE * parent,
GWEN_DB_NODE * n )

Definition at line 231 of file db.c.

References NULL.

Referenced by GWEN_DB_Node_Insert().

Here is the caller graph for this function:

◆ GWEN_DB_Node_new()

GWEN_DB_NODE * GWEN_DB_Node_new ( GWEN_DB_NODE_TYPE t)

Definition at line 88 of file db.c.

References GWEN_DB_Node_new(), GWEN_LIST_INIT, and GWEN_NEW_OBJECT.

Referenced by GWEN_DB_Group_new(), GWEN_DB_Node_new(), GWEN_DB_ValueBin_new(), GWEN_DB_ValueChar_new(), GWEN_DB_ValueChar_newFromInt(), GWEN_DB_ValueInt_new(), GWEN_DB_ValuePtr_new(), and GWEN_DB_Var_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_Node_Unlink()

void GWEN_DB_Node_Unlink ( GWEN_DB_NODE * n)

Definition at line 274 of file db.c.

References GWEN_DB_ModifyBranchFlagsUp(), GWEN_DB_NODE_FLAGS_DIRTY, and GWEN_DB_Node_Unlink_UnDirty().

Referenced by GWEN_DB_DeleteGroup(), GWEN_DB_DeleteVar(), GWEN_DB_RemoveCharValue(), and GWEN_DB_UnlinkGroup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_Node_Unlink_UnDirty()

void GWEN_DB_Node_Unlink_UnDirty ( GWEN_DB_NODE * n)

Definition at line 257 of file db.c.

References DBG_WARN, GWEN_LOGDOMAIN, and NULL.

Referenced by GWEN_DB_Node_Unlink().

Here is the caller graph for this function:

◆ GWEN_DB_RemoveCharValue()

int GWEN_DB_RemoveCharValue ( GWEN_DB_NODE * n,
const char * path,
const char * val,
int senseCase )

Removes the given char value from the given variable if it exists (depending on the arguments senseCase and check).

Returns
0 on success, nonzero on error
Parameters
ndb node
pathpath and name of the variable
valThe string value to be removed
senseCaseif 0 then the case of the value is ignored while checking

Definition at line 1121 of file db.c.

References DBG_DEBUG, DBG_VERBOUS, GWEN_DB_FLAGS_DEFAULT, GWEN_DB_GetFirstValue(), GWEN_DB_GetNode(), GWEN_DB_Node_free(), GWEN_DB_Node_Unlink(), GWEN_DB_NodeType_ValueChar, GWEN_LOGDOMAIN, and GWEN_PATH_FLAGS_VARIABLE.

Here is the call graph for this function:

◆ GWEN_DB_ReplaceVars()

int GWEN_DB_ReplaceVars ( GWEN_DB_NODE * db,
const char * s,
GWEN_BUFFER * dbuf )

Read the given string and replace every variable in that string ( noted as "$(varname)") with the value of the mentioned variable.

Definition at line 1951 of file db.c.

References _replaceVarsCb(), DBG_INFO, GWEN_LOGDOMAIN, and GWEN_Text_ReplaceVars().

Referenced by _handleDbSetCharValue_internal(), _handleDbSetCharValue_internal(), _readFilesFromDataNode(), _readSubCmd(), _readXmlDataIntoBufferAndExpand(), _xmlSetCharValue(), GWB_Parser_ReadXmlDataIntoBufferAndExpand(), and GWEN_XMLNode_ExpandProperties().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_SetBinValue()

int GWEN_DB_SetBinValue ( GWEN_DB_NODE * n,
uint32_t flags,
const char * path,
const void * val,
unsigned int valSize )
Parameters
ndb node
pathpath and name of the variable
flagssee GWEN_DB_FLAGS_OVERWRITE_VARS and others which can all be OR-combined to form the flags to use.
valThe binary data that is copied into the DB.
valSizeThe number of bytes in the binary data value.
Returns
0 on success, nonzero on error

Definition at line 1269 of file db.c.

References DBG_VERBOUS, GWEN_DB_ClearNode(), GWEN_DB_FLAGS_INSERT, GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_GetNode(), GWEN_DB_Node_Append(), GWEN_DB_Node_Insert(), GWEN_DB_ValueBin_new(), GWEN_LOGDOMAIN, and GWEN_PATH_FLAGS_VARIABLE.

Referenced by _groupReadElement(), GWEN_Crypt_CryptAlgo_toDb(), GWEN_Crypt_HashAlgo_toDb(), GWEN_Crypt_KeyRsa__WriteMpi(), GWEN_Crypt_KeyRsa_fromModExp(), GWEN_Crypt_KeyRsa_fromModPrivExp(), GWEN_Crypt_KeySym__toDb(), GWEN_Crypt_KeySym_toDb(), GWEN_Crypt_Token_Context_WriteDb(), GWEN_Crypt_Token_KeyInfo_WriteDb(), GWEN_Crypt_TokenOHBCI__DecodeKey(), GWEN_DBIO__XmlDb_ImportVar(), and GWEN_TLV_Buffer_To_DB().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_SetCharValue()

int GWEN_DB_SetCharValue ( GWEN_DB_NODE * n,
uint32_t flags,
const char * path,
const char * val )
Returns
0 on success, nonzero on error
Parameters
ndb node
flagssee GWEN_DB_FLAGS_OVERWRITE_VARS and others which can all be OR-combined to form the flags to use.
pathpath and name of the variable
valThe string value that is copied into the DB

Definition at line 997 of file db.c.

References DBG_VERBOUS, GWEN_DB_ClearNode(), GWEN_DB_FLAGS_INSERT, GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_GetNode(), GWEN_DB_Node_Append(), GWEN_DB_Node_Insert(), GWEN_DB_ValueChar_new(), GWEN_LOGDOMAIN, and GWEN_PATH_FLAGS_VARIABLE.

Referenced by _addFilePathsToDb(), _appendVarValue(), _checkStringListOption(), _checkStringOption(), _convertAndSetCharValue(), _copyEnvironmentVariableToDb(), _determineNamePath(), _determineTarget(), _getAllToolPaths(), _getToolPath(), _groupReadElement(), _handleStringArgument(), _parseArg(), _parseSetVar(), _prepareContextForSetup(), _readArgsIntoDb(), _readTarget(), _setHostHeaderFromUrl(), _setProjectVersionFromString(), _setupAfterAddingFirstInputFile(), _setupVariables(), _stringListToDb(), _tryStorePasswdInCacheAndStorage(), _writeProjectVersionToContextDbVars(), GWB_ParseProject(), GWB_Parser_CopyContextForSubdir(), GWB_Parser_ReadBuildTree(), GWB_Parser_SetItemValue(), GWB_Utils_VersionStringToDb(), GWB_Utils_VersionToDbVar(), GWEN_Args_Check(), GWEN_Crypt_CryptAlgo_toDb(), GWEN_Crypt_HashAlgo_toDb(), GWEN_Crypt_Key_toDb(), GWEN_Crypt_KeyRsa_fromModExp(), GWEN_Crypt_KeyRsa_fromModPrivExp(), GWEN_Crypt_PaddAlgo_toDb(), GWEN_Crypt_Token_Context_WriteDb(), GWEN_Crypt_Token_KeyInfo_WriteDb(), GWEN_Crypt_TokenOHBCI__DecodeKey(), GWEN_Date_toDb(), GWEN_DBIO__XmlDb_ImportVar(), GWEN_DBIO_OldDb__ParseLine(), GWEN_Gui_ExtendSyncIo(), GWEN_HttpSession_Init(), GWEN_HttpSession_SendPacket(), GWEN_HttpSession_SendStatus(), GWEN_MsgEngine_SetMode(), GWEN_MsgEngine_SetValue(), GWEN_Param_WriteDb(), GWEN_PasswordStore__SetPassword(), GWEN_PathManager_AddPath(), GWEN_PathManager_InsertPath(), GWEN_SslCertDescr_toDb(), GWEN_StringList2_toDb(), GWEN_SyncIo_Http_ParseCommand(), GWEN_SyncIo_Http_ParseHeader(), GWEN_SyncIo_Http_ParseStatus(), GWEN_Test_Module_SetCharParam(), GWEN_Test_Module_WriteDb(), GWEN_Timestamp_toDb(), GWEN_TLV_Buffer_To_DB(), GWEN_Url_fromCommandString(), GWEN_Url_fromString(), GWEN_Url_toDb(), HtmlCtx_AddAttr(), releaseFillIn(), setCharValueWithTypePrefix(), and Typemaker2_Builder_CreateDbForCall().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_SetCharValueFromInt()

int GWEN_DB_SetCharValueFromInt ( GWEN_DB_NODE * n,
uint32_t flags,
const char * path,
int val )
Returns
0 on success, nonzero on error
Parameters
ndb node
flagssee GWEN_DB_FLAGS_OVERWRITE_VARS and others which can all be OR-combined to form the flags to use.
pathpath and name of the variable
valThe integer value to be stored as string value in the DB

Definition at line 1036 of file db.c.

References DBG_VERBOUS, GWEN_DB_ClearNode(), GWEN_DB_FLAGS_INSERT, GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_GetNode(), GWEN_DB_Node_Append(), GWEN_DB_Node_Insert(), GWEN_DB_ValueChar_newFromInt(), GWEN_LOGDOMAIN, and GWEN_PATH_FLAGS_VARIABLE.

Referenced by _readTarget(), _writeProjectSoVersionToContextDbVars(), and _writeProjectVersionToContextDbVars().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_SetCharValueInNode()

int GWEN_DB_SetCharValueInNode ( GWEN_DB_NODE * n,
const char * s )

Replaces the current value data of the given node by the new string.

Returns
0 if ok, error code otherwise

Definition at line 590 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_ValueChar, GWEN_ERROR_INVALID, GWEN_LOGDOMAIN, GWEN_Memory_dealloc(), and GWEN_Memory_strdup().

Here is the call graph for this function:

◆ GWEN_DB_SetIntValue()

int GWEN_DB_SetIntValue ( GWEN_DB_NODE * n,
uint32_t flags,
const char * path,
int val )
Returns
0 on success, nonzero on error
Parameters
ndb node
flagssee GWEN_DB_FLAGS_OVERWRITE_VARS and others which can all be OR-combined to form the flags to use.
pathpath and name of the variable
valnew value

Definition at line 1202 of file db.c.

References DBG_VERBOUS, GWEN_DB_ClearNode(), GWEN_DB_FLAGS_INSERT, GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_GetNode(), GWEN_DB_Node_Append(), GWEN_DB_Node_Insert(), GWEN_DB_ValueInt_new(), GWEN_LOGDOMAIN, and GWEN_PATH_FLAGS_VARIABLE.

Referenced by _groupReadElement(), _readAndStoreNextVersionPart(), _readArgsIntoDb(), GWEN_Args_Check(), GWEN_Crypt_CryptAlgo_toDb(), GWEN_Crypt_Key_toDb(), GWEN_Crypt_KeyRsa_fromModExp(), GWEN_Crypt_KeyRsa_fromModPrivExp(), GWEN_Crypt_KeyRsa_toDb(), GWEN_Crypt_PaddAlgo_toDb(), GWEN_Crypt_Token_Context_WriteDb(), GWEN_Crypt_Token_KeyInfo_WriteDb(), GWEN_Crypt_TokenOHBCI__Decode(), GWEN_Crypt_TokenOHBCI__DecodeKey(), GWEN_DBIO__XmlDb_ImportVar(), GWEN_Dialog_ListWriteColumnSettings(), GWEN_DlgInput_Fini(), GWEN_DlgMessage_Fini(), GWEN_DlgProgress_Fini(), GWEN_DlgShowBox_Fini(), GWEN_HttpSession_Init(), GWEN_HttpSession_SendPacket(), GWEN_HttpSession_SendStatus(), GWEN_MsgEngine__TransformValue(), GWEN_MsgEngine_ReadMessage(), GWEN_MsgEngine_SetIntValue(), GWEN_MsgEngine_SetProtocolVersion(), GWEN_Param_WriteDb(), GWEN_SslCertDescr_toDb(), GWEN_SyncIo_Http_ParseStatus(), GWEN_Test_Module_WriteDb(), GWEN_Time_toDb(), GWEN_TLV_Buffer_To_DB(), and GWEN_Url_toDb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_SetNodeFlags()

void GWEN_DB_SetNodeFlags ( GWEN_DB_NODE * n,
uint32_t flags )

Modifies the node flags for the given db node

Parameters
ndb node
flagsflags to set (see GWEN_DB_NODE_FLAGS_DIRTY)

Definition at line 1778 of file db.c.

◆ GWEN_DB_SetPtrValue()

int GWEN_DB_SetPtrValue ( GWEN_DB_NODE * n,
uint32_t flags,
const char * path,
void * val )
Parameters
ndb node
pathpath and name of the variable
flagssee GWEN_DB_FLAGS_OVERWRITE_VARS and others which can all be OR-combined to form the flags to use.
valThe pointer that is stored within the DB.
Returns
0 on success, nonzero on error

Definition at line 1332 of file db.c.

References DBG_VERBOUS, GWEN_DB_ClearNode(), GWEN_DB_FLAGS_INSERT, GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_GetNode(), GWEN_DB_Node_Append(), GWEN_DB_Node_Insert(), GWEN_DB_ValuePtr_new(), GWEN_LOGDOMAIN, and GWEN_PATH_FLAGS_VARIABLE.

Here is the call graph for this function:

◆ GWEN_DB_UnlinkGroup()

void GWEN_DB_UnlinkGroup ( GWEN_DB_NODE * n)

Unlinks a group (and thereby all its children) from its parent and brothers.

This function DOES NOT free the group, it just unlinks it. You can then use it with e.g. GWEN_DB_AddGroup or other functions to relink it at any other position of even in other DBs.

Parameters
ndb node

Definition at line 1554 of file db.c.

References DBG_ERROR, GWEN_DB_Node_Unlink(), GWEN_DB_NodeType_Group, and GWEN_LOGDOMAIN.

Referenced by _handleDbCreateAndEnterTempGroup(), _handleDbCreateAndEnterTempGroup(), GWEN_PathManager_RemovePath(), GWEN_PathManager_RemovePaths(), and GWEN_PathManager_UndefinePath().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_ValueBin_new()

GWEN_DB_NODE * GWEN_DB_ValueBin_new ( const void * data,
unsigned int datasize )

Definition at line 101 of file db.c.

References GWEN_DB_Node_new(), GWEN_DB_NodeType_ValueBin, and GWEN_Memory_malloc().

Referenced by GWEN_DB__ReadValues(), GWEN_DB_Node_dup(), and GWEN_DB_SetBinValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_ValueChar_new()

GWEN_DB_NODE * GWEN_DB_ValueChar_new ( const char * data)

Definition at line 130 of file db.c.

References GWEN_DB_Node_new(), GWEN_DB_NodeType_ValueChar, and GWEN_Memory_strdup().

Referenced by GWEN_DB__ReadValues(), GWEN_DB_AddCharValue(), GWEN_DB_Node_dup(), and GWEN_DB_SetCharValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_ValueChar_newFromInt()

GWEN_DB_NODE * GWEN_DB_ValueChar_newFromInt ( int v)

Definition at line 144 of file db.c.

References GWEN_DB_Node_new(), GWEN_DB_NodeType_ValueChar, and GWEN_Memory_strdup().

Referenced by GWEN_DB_SetCharValueFromInt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_ValueExists()

int GWEN_DB_ValueExists ( GWEN_DB_NODE * n,
const char * path,
unsigned int idx )

Checks whether the given variable and value exists.

Returns
Zero if variable not found, nonzero otherwise
Parameters
nroot of the DB
pathpath to the variable to check for
idxindex number of the variable's value to check for

Definition at line 1586 of file db.c.

References GWEN_DB_GetValue().

Referenced by GWEN_MsgEngine__WriteElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_ValueInt_new()

GWEN_DB_NODE * GWEN_DB_ValueInt_new ( int data)

Definition at line 119 of file db.c.

References GWEN_DB_Node_new(), and GWEN_DB_NodeType_ValueInt.

Referenced by GWEN_DB__ReadValues(), GWEN_DB_Node_dup(), and GWEN_DB_SetIntValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_ValuePtr_new()

GWEN_DB_NODE * GWEN_DB_ValuePtr_new ( void * data)

Definition at line 162 of file db.c.

References GWEN_DB_Node_new(), and GWEN_DB_NodeType_ValuePtr.

Referenced by GWEN_DB_Node_dup(), and GWEN_DB_SetPtrValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_Values_Count()

unsigned int GWEN_DB_Values_Count ( const GWEN_DB_NODE * node)

Returns the number of value nodes that are direct children of the given node. In other words, this is the number of value nodes that will be reached in the GWEN_DB_Values_foreach() function.

Definition at line 1761 of file db.c.

References GWEN_DB_count_cb(), and GWEN_DB_Values_Foreach().

Here is the call graph for this function:

◆ GWEN_DB_Values_Foreach()

void * GWEN_DB_Values_Foreach ( GWEN_DB_NODE * node,
GWEN_DB_NODES_CB func,
void * user_data )

Iterates through all value nodes that are direct children of the given node, calling the callback function 'func' on each value node. Traversal will stop when 'func' returns a non-NULL value, and the routine will return with that value. Otherwise the routine will return NULL.

If no nodes that are values are found as children, then this function will simply do nothing.

Parameters
nodeThe variable node whose children shall be iterated through.
funcThe function to be called with each group node.
user_dataA pointer passed on to the function 'func'.
Returns
The non-NULL pointer returned by 'func' as soon as it returns one. Otherwise (i.e. 'func' always returns NULL) returns NULL.
Author
Christian Stimming stimm.nosp@m.ing@.nosp@m.tuhh..nosp@m.de

Definition at line 1738 of file db.c.

References GWEN_DB_GetFirstValue(), GWEN_DB_GetNextValue(), and NULL.

Referenced by GWEN_DB_Values_Count().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_Var_new()

GWEN_DB_NODE * GWEN_DB_Var_new ( const char * name)

Definition at line 189 of file db.c.

References GWEN_DB_Node_new(), GWEN_DB_NodeType_Var, and GWEN_Memory_strdup().

Referenced by GWEN_DB_HandlePath(), and GWEN_DB_Node_dup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_VariableExists()

int GWEN_DB_VariableExists ( GWEN_DB_NODE * n,
const char * path )

Checks whether the given variable exists.

Returns
Zero if variable not found, nonzero otherwise
Parameters
nroot of the DB
pathpath to the variable to check for

Definition at line 1565 of file db.c.

References DBG_VERBOUS, GWEN_DB_GetNode(), GWEN_LOGDOMAIN, GWEN_PATH_FLAGS_NAMEMUSTEXIST, GWEN_PATH_FLAGS_PATHMUSTEXIST, and GWEN_PATH_FLAGS_VARIABLE.

Referenced by _csvExport(), and GWEN_MsgEngine__TransformValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_VariableName()

const char * GWEN_DB_VariableName ( GWEN_DB_NODE * n)

Returns the name of the variable specified by the given node.

Parameters
ndb node specifying a variable (not a group !)

Definition at line 1928 of file db.c.

References DBG_ERROR, GWEN_DB_NodeType_Var, GWEN_LOGDOMAIN, and NULL.

Referenced by GWEN_DBIO_XmlDb__ExportVar(), GWEN_PasswordStore_GetTokenList(), GWEN_SyncIo_Http_WriteHeader(), GWEN_Url_toCommandString(), and GWEN_Url_toString().

Here is the caller graph for this function:

◆ GWEN_DB_VariableRename()

void GWEN_DB_VariableRename ( GWEN_DB_NODE * n,
const char * newname )

Definition at line 1940 of file db.c.

References GWEN_DB_NodeType_Var, GWEN_Memory_dealloc(), and GWEN_Memory_strdup().

Here is the call graph for this function:

◆ GWEN_DB_Variables_Count()

unsigned int GWEN_DB_Variables_Count ( const GWEN_DB_NODE * node)

Returns the number of variable nodes that are direct children of the given node. In other words, this is the number of variable nodes that will be reached in the GWEN_DB_Variables_Foreach() function.

Definition at line 1729 of file db.c.

References GWEN_DB_count_cb(), and GWEN_DB_Variables_Foreach().

Here is the call graph for this function:

◆ GWEN_DB_Variables_Foreach()

void * GWEN_DB_Variables_Foreach ( GWEN_DB_NODE * node,
GWEN_DB_NODES_CB func,
void * user_data )

Iterates through all variable nodes that are direct children of the given node, calling the callback function 'func' on each variable node. Traversal will stop when 'func' returns a non-NULL value, and the routine will return with that value. Otherwise the routine will return NULL.

If no nodes that are variables are found as children, then this function will simply do nothing.

Parameters
nodeThe group node whose children shall be iterated through.
funcThe function to be called with each group node.
user_dataA pointer passed on to the function 'func'.
Returns
The non-NULL pointer returned by 'func' as soon as it returns one. Otherwise (i.e. 'func' always returns NULL) returns NULL.
Author
Christian Stimming stimm.nosp@m.ing@.nosp@m.tuhh..nosp@m.de

Definition at line 1706 of file db.c.

References GWEN_DB_GetFirstVar(), GWEN_DB_GetNextVar(), and NULL.

Referenced by GWEN_DB_Variables_Count().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_DB_WriteVarValueToBuffer()

int GWEN_DB_WriteVarValueToBuffer ( GWEN_DB_NODE * n,
const char * path,
int index,
GWEN_BUFFER * dstBuf )
Returns
0 if okay, error code on error (GWEN_ERROR_NO_DATA if the variable doesn't exist or has no value)
Parameters
ndb node
pathpath and name of the variable
indexnumber of value to read (if there are multiple values in the variable, 0 being the first)
dstBufbuffer to write the value into
Returns
0 on success, nonzero on error

Definition at line 1982 of file db.c.

References _writeVarValueToBuffer(), GWEN_Buffer_AppendString(), and GWEN_Buffer_GetUsedBytes().

Referenced by _replaceVarsCb().

Here is the call graph for this function:
Here is the caller graph for this function: