* \retval The existing configuration node if it exists, or a newly
* created node for the provided name. On error, NULL will be returned.
*/
-static ConfNode *
-ConfGetNodeOrCreate(const char *name, int final)
+static ConfNode *ConfGetNodeOrCreate(const char *name, int final)
{
ConfNode *parent = root;
ConfNode *node = NULL;
/**
* \brief Initialize the configuration system.
*/
-void
-ConfInit(void)
+void ConfInit(void)
{
if (root != NULL) {
SCLogDebug("already initialized");
*
* \retval An allocated configuration node on success, NULL on failure.
*/
-ConfNode *
-ConfNodeNew(void)
+ConfNode *ConfNodeNew(void)
{
ConfNode *new;
*
* \param node The configuration node to SCFree.
*/
-void
-ConfNodeFree(ConfNode *node)
+void ConfNodeFree(ConfNode *node)
{
ConfNode *tmp;
* \retval A pointer to ConfNode is found or NULL if the configuration
* node does not exist.
*/
-ConfNode *
-ConfGetNode(const char *name)
+ConfNode *ConfGetNode(const char *name)
{
ConfNode *node = root;
char node_name[NODE_NAME_MAX];
/**
* \brief Get the root configuration node.
*/
-ConfNode *
-ConfGetRootNode(void)
+ConfNode *ConfGetRootNode(void)
{
return root;
}
*
* \retval 1 if the value was set otherwise 0.
*/
-int
-ConfSet(const char *name, char *val)
+int ConfSet(const char *name, char *val)
{
ConfNode *node = ConfGetNodeOrCreate(name, 0);
if (node == NULL || node->final) {
*
* \retval 1 if the value was set otherwise 0.
*/
-int
-ConfSetFinal(const char *name, char *val)
+int ConfSetFinal(const char *name, char *val)
{
ConfNode *node = ConfGetNodeOrCreate(name, 1);
if (node == NULL) {
* \retval 1 will be returned if the name is found, otherwise 0 will
* be returned.
*/
-int
-ConfGet(const char *name, char **vptr)
+int ConfGet(const char *name, char **vptr)
{
ConfNode *node = ConfGetNode(name);
if (node == NULL) {
}
-int ConfGetChildValueWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, char **vptr)
+int ConfGetChildValueWithDefault(const ConfNode *base, const ConfNode *dflt,
+ const char *name, char **vptr)
{
int ret = ConfGetChildValue(base, name, vptr);
/* Get 'default' value */
* \retval 1 will be returned if the name is found and was properly
* converted to an interger, otherwise 0 will be returned.
*/
-int
-ConfGetInt(const char *name, intmax_t *val)
+int ConfGetInt(const char *name, intmax_t *val)
{
char *strval;
intmax_t tmpint;
}
-int ConfGetChildValueIntWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, intmax_t *val)
+int ConfGetChildValueIntWithDefault(const ConfNode *base, const ConfNode *dflt,
+ const char *name, intmax_t *val)
{
int ret = ConfGetChildValueInt(base, name, val);
/* Get 'default' value */
* \retval 1 will be returned if the name is found and was properly
* converted to a boolean, otherwise 0 will be returned.
*/
-int
-ConfGetBool(const char *name, int *val)
+int ConfGetBool(const char *name, int *val)
{
char *strval;
return 1;
}
-int ConfGetChildValueBoolWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, int *val)
+int ConfGetChildValueBoolWithDefault(const ConfNode *base, const ConfNode *dflt,
+ const char *name, int *val)
{
int ret = ConfGetChildValueBool(base, name, val);
/* Get 'default' value */
*
* \retval 1 If the value is true, 0 if not.
*/
-int
-ConfValIsTrue(const char *val)
+int ConfValIsTrue(const char *val)
{
char *trues[] = {"1", "yes", "true", "on"};
size_t u;
*
* \retval 1 If the value is false, 0 if not.
*/
-int
-ConfValIsFalse(const char *val)
+int ConfValIsFalse(const char *val)
{
char *falses[] = {"0", "no", "false", "off"};
size_t u;
* \retval 1 will be returned if the name is found and was properly
* converted to a double, otherwise 0 will be returned.
*/
-int
-ConfGetDouble(const char *name, double *val)
+int ConfGetDouble(const char *name, double *val)
{
char *strval;
double tmpdo;
* \retval 1 will be returned if the name is found and was properly
* converted to a double, otherwise 0 will be returned.
*/
-int
-ConfGetFloat(const char *name, float *val)
+int ConfGetFloat(const char *name, float *val)
{
char *strval;
double tmpfl;
/**
* \brief Remove (and SCFree) the provided configuration node.
*/
-void
-ConfNodeRemove(ConfNode *node)
+void ConfNodeRemove(ConfNode *node)
{
if (node->parent != NULL)
TAILQ_REMOVE(&node->parent->head, node, next);
* \retval Returns 1 if the parameter was removed, otherwise 0 is returned
* most likely indicating the parameter was not set.
*/
-int
-ConfRemove(const char *name)
+int ConfRemove(const char *name)
{
ConfNode *node;
/**
* \brief Creates a backup of the conf_hash hash_table used by the conf API.
*/
-void
-ConfCreateContextBackup(void)
+void ConfCreateContextBackup(void)
{
root_backup = root;
root = NULL;
* \brief Restores the backup of the hash_table present in backup_conf_hash
* back to conf_hash.
*/
-void
-ConfRestoreContextBackup(void)
+void ConfRestoreContextBackup(void)
{
root = root_backup;
root_backup = NULL;
/**
* \brief De-initializes the configuration system.
*/
-void
-ConfDeInit(void)
+void ConfDeInit(void)
{
if (root != NULL) {
ConfNodeFree(root);
SCLogDebug("configuration module de-initialized");
}
-static char *
-ConfPrintNameArray(char **name_arr, int level)
+static char *ConfPrintNameArray(char **name_arr, int level)
{
static char name[128*128];
int i;
/**
* \brief Dump a configuration node and all its children.
*/
-void
-ConfNodeDump(const ConfNode *node, const char *prefix)
+void ConfNodeDump(const ConfNode *node, const char *prefix)
{
ConfNode *child;
/**
* \brief Dump configuration to stdout.
*/
-void
-ConfDump(void)
+void ConfDump(void)
{
ConfNodeDump(root, NULL);
}
*
* \retval A pointer the child ConfNode if found otherwise NULL.
*/
-ConfNode *
-ConfNodeLookupChild(const ConfNode *node, const char *name)
+ConfNode *ConfNodeLookupChild(const ConfNode *node, const char *name)
{
ConfNode *child;
*
* \retval A pointer the child ConfNodes value if found otherwise NULL.
*/
-const char *
-ConfNodeLookupChildValue(const ConfNode *node, const char *name)
+const char *ConfNodeLookupChildValue(const ConfNode *node, const char *name)
{
ConfNode *child;
* \return the ConfNode matching or NULL
*/
-ConfNode *ConfNodeLookupKeyValue(const ConfNode *base, const char *key, const char *value)
+ConfNode *ConfNodeLookupKeyValue(const ConfNode *base, const char *key,
+ const char *value)
{
ConfNode *child;
* \retval 1 if the child node has a true value, otherwise 0 is
* returned, even if the child node does not exist.
*/
-int
-ConfNodeChildValueIsTrue(const ConfNode *node, const char *key)
+int ConfNodeChildValueIsTrue(const ConfNode *node, const char *key)
{
const char *val;
*
* \param node The configuration node to prune.
*/
-void
-ConfNodePrune(ConfNode *node)
+void ConfNodePrune(ConfNode *node)
{
ConfNode *item, *it;
*
* \return 1 if node is a seuence, otherwise 0.
*/
-int
-ConfNodeIsSequence(const ConfNode *node)
+int ConfNodeIsSequence(const ConfNode *node)
{
return node->is_seq == 0 ? 0 : 1;
}
/**
* Lookup a non-existant value.
*/
-static int
-ConfTestGetNonExistant(void)
+static int ConfTestGetNonExistant(void)
{
char name[] = "non-existant-value";
char *value;
/**
* Set then lookup a value.
*/
-static int
-ConfTestSetAndGet(void)
+static int ConfTestSetAndGet(void)
{
char name[] = "some-name";
char value[] = "some-value";
* Test that overriding a value is allowed provided allow_override is
* true and that the config parameter gets the new value.
*/
-static int
-ConfTestOverrideValue1(void)
+static int ConfTestOverrideValue1(void)
{
char name[] = "some-name";
char value0[] = "some-value";
/**
* Test that a final value will not be overrided by a ConfSet.
*/
-static int
-ConfTestOverrideValue2(void)
+static int ConfTestOverrideValue2(void)
{
char name[] = "some-name";
char value0[] = "some-value";
/**
* Test retrieving an integer value from the configuration db.
*/
-static int
-ConfTestGetInt(void)
+static int ConfTestGetInt(void)
{
char name[] = "some-int.x";
intmax_t val;
/**
* Test retrieving a boolean value from the configuration db.
*/
-static int
-ConfTestGetBool(void)
+static int ConfTestGetBool(void)
{
char name[] = "some-bool";
char *trues[] = {
return 1;
}
-static int
-ConfNodeLookupChildTest(void)
+static int ConfNodeLookupChildTest(void)
{
char *test_vals[] = { "one", "two", "three" };
size_t u;
return 1;
}
-static int
-ConfNodeLookupChildValueTest(void)
+static int ConfNodeLookupChildValueTest(void)
{
char *test_vals[] = { "one", "two", "three" };
size_t u;
/**
* Test the removal of a configuration node.
*/
-static int
-ConfNodeRemoveTest(void)
+static int ConfNodeRemoveTest(void)
{
ConfCreateContextBackup();
ConfInit();
return 1;
}
-static int
-ConfSetTest(void)
+static int ConfSetTest(void)
{
ConfCreateContextBackup();
ConfInit();
return 1;
}
-static int
-ConfGetNodeOrCreateTest(void)
+static int ConfGetNodeOrCreateTest(void)
{
ConfNode *node;
int ret = 0;
return ret;
}
-static int
-ConfNodePruneTest(void)
+static int ConfNodePruneTest(void)
{
int ret = 0;
ConfNode *node;
return ret;
}
-int
-ConfNodeIsSequenceTest(void)
+int ConfNodeIsSequenceTest(void)
{
int retval = 0;
ConfNode *node = ConfNodeNew();
return retval;
}
-void
-ConfRegisterTests(void)
+void ConfRegisterTests(void)
{
UtRegisterTest("ConfTestGetNonExistant", ConfTestGetNonExistant, 1);
UtRegisterTest("ConfSetTest", ConfSetTest, 1);