const char *str = NULL;
uint64_t memcap = HTTP_RANGE_DEFAULT_MEMCAP;
uint32_t timeout = HTTP_RANGE_DEFAULT_TIMEOUT;
- if (ConfGetValue("app-layer.protocols.http.byterange.memcap", &str) == 1) {
+ if (ConfGet("app-layer.protocols.http.byterange.memcap", &str) == 1) {
if (ParseSizeStringU64(str, &memcap) < 0) {
SCLogWarning(SC_ERR_INVALID_VALUE,
"memcap value cannot be deduced: %s,"
memcap = 0;
}
}
- if (ConfGetValue("app-layer.protocols.http.byterange.timeout", &str) == 1) {
+ if (ConfGet("app-layer.protocols.http.byterange.timeout", &str) == 1) {
size_t slen = strlen(str);
if (slen > UINT16_MAX || StringParseUint32(&timeout, 10, (uint16_t)slen, str) <= 0) {
SCLogWarning(SC_ERR_INVALID_VALUE,
/* Check if we should generate Hassh fingerprints */
int enable_hassh = SSH_CONFIG_DEFAULT_HASSH;
const char *strval = NULL;
- if (ConfGetValue("app-layer.protocols.ssh.hassh", &strval) != 1) {
+ if (ConfGet("app-layer.protocols.ssh.hassh", &strval) != 1) {
enable_hassh = SSH_CONFIG_DEFAULT_HASSH;
} else if (strcmp(strval, "auto") == 0) {
enable_hassh = SSH_CONFIG_DEFAULT_HASSH;
/* Check if we should generate JA3 fingerprints */
int enable_ja3 = SSL_CONFIG_DEFAULT_JA3;
const char *strval = NULL;
- if (ConfGetValue("app-layer.protocols.tls.ja3-fingerprints", &strval) != 1) {
+ if (ConfGet("app-layer.protocols.tls.ja3-fingerprints", &strval) != 1) {
enable_ja3 = SSL_CONFIG_DEFAULT_JA3;
} else if (strcmp(strval, "auto") == 0) {
enable_ja3 = SSL_CONFIG_DEFAULT_JA3;
}
}
-/**
- * \brief Retrieve the value of a configuration node.
- *
- * This function will return the value for a configuration node based
- * on the full name of the node. This function notifies if vptr returns NULL
- * or if name is set to NULL.
- *
- * \param name Name of configuration parameter to get.
- * \param vptr Pointer that will be set to the configuration value parameter.
- * Note that this is just a reference to the actual value, not a copy.
- *
- * \retval 0 will be returned if name was not found,
- * 1 will be returned if the name and it's value was found,
- * -1 if the value returns NULL,
- * -2 if name is NULL.
- */
-int ConfGetValue(const char *name, const char **vptr)
-{
- ConfNode *node;
-
- if (name == NULL) {
- SCLogError(SC_ERR_INVALID_ARGUMENT,"parameter 'name' is NULL");
- return -2;
- }
-
- node = ConfGetNode(name);
-
- if (node == NULL) {
- SCLogDebug("failed to lookup configuration parameter '%s'", name);
- return 0;
- }
- else {
-
- if (node->val == NULL) {
- SCLogDebug("value for configuration parameter '%s' is NULL", name);
- return -1;
- }
-
- *vptr = node->val;
- return 1;
- }
-
-}
-
int ConfGetChildValue(const ConfNode *base, const char *name, const char **vptr)
{
ConfNode *node = ConfNodeLookupChild(base, name);
const char *strval = NULL;
*val = 0;
- if (ConfGetValue(name, &strval) != 1)
+ if (ConfGet(name, &strval) != 1)
return 0;
*val = ConfValIsTrue(strval);
void ConfDeInit(void);
ConfNode *ConfGetRootNode(void);
int ConfGet(const char *name, const char **vptr);
-int ConfGetValue(const char *name, const char **vptr);
int ConfGetInt(const char *name, intmax_t *val);
int ConfGetBool(const char *name, int *val);
int ConfGetDouble(const char *name, double *val);
static void GetDefaultMemcap(uint64_t *memcap, uint32_t *hashsize)
{
const char *str = NULL;
- if (ConfGetValue("datasets.defaults.memcap", &str) == 1) {
+ if (ConfGet("datasets.defaults.memcap", &str) == 1) {
if (ParseSizeStringU64(str, memcap) < 0) {
SCLogWarning(SC_ERR_INVALID_VALUE,
"memcap value cannot be deduced: %s,"
*memcap = 0;
}
}
- if (ConfGetValue("datasets.defaults.hashsize", &str) == 1) {
+ if (ConfGet("datasets.defaults.hashsize", &str) == 1) {
if (ParseSizeStringU32(str, hashsize) < 0) {
SCLogWarning(SC_ERR_INVALID_VALUE,
"hashsize value cannot be deduced: %s,"
uint32_t configval = 0;
/** set config values for memcap, prealloc and hash_size */
- if ((ConfGetValue("host.memcap", &conf_val)) == 1)
- {
+ if ((ConfGet("host.memcap", &conf_val)) == 1) {
uint64_t host_memcap = 0;
if (ParseSizeStringU64(conf_val, &host_memcap) < 0) {
SCLogError(SC_ERR_SIZE_PARSE, "Error parsing host.memcap "
SC_ATOMIC_SET(host_config.memcap, host_memcap);
}
}
- if ((ConfGetValue("host.hash-size", &conf_val)) == 1)
- {
+ if ((ConfGet("host.hash-size", &conf_val)) == 1) {
if (StringParseUint32(&configval, 10, strlen(conf_val),
conf_val) > 0) {
host_config.hash_size = configval;
}
}
- if ((ConfGetValue("host.prealloc", &conf_val)) == 1)
- {
+ if ((ConfGet("host.prealloc", &conf_val)) == 1) {
if (StringParseUint32(&configval, 10, strlen(conf_val),
conf_val) > 0) {
host_config.prealloc = configval;
* in case the default per-thread stack size is to be adjusted
*/
const char *ss = NULL;
- if ((ConfGetValue("threading.stack-size", &ss)) == 1) {
+ if ((ConfGet("threading.stack-size", &ss)) == 1) {
if (ss != NULL) {
if (ParseSizeStringU64(ss, &threading_set_stack_size) < 0) {
FatalError(SC_ERR_INVALID_ARGUMENT,
}
const char *temp_stream_memcap_str;
- if (ConfGetValue("stream.memcap", &temp_stream_memcap_str) == 1) {
+ if (ConfGet("stream.memcap", &temp_stream_memcap_str) == 1) {
uint64_t stream_memcap_copy;
if (ParseSizeStringU64(temp_stream_memcap_str, &stream_memcap_copy) < 0) {
SCLogError(SC_ERR_SIZE_PARSE, "Error parsing stream.memcap "
}
const char *temp_stream_inline_str;
- if (ConfGetValue("stream.inline", &temp_stream_inline_str) == 1) {
+ if (ConfGet("stream.inline", &temp_stream_inline_str) == 1) {
int inl = 0;
/* checking for "auto" and falling back to boolean to provide
}
const char *temp_stream_reassembly_memcap_str;
- if (ConfGetValue("stream.reassembly.memcap", &temp_stream_reassembly_memcap_str) == 1) {
+ if (ConfGet("stream.reassembly.memcap", &temp_stream_reassembly_memcap_str) == 1) {
uint64_t stream_reassembly_memcap_copy;
if (ParseSizeStringU64(temp_stream_reassembly_memcap_str,
&stream_reassembly_memcap_copy) < 0) {
}
const char *temp_stream_reassembly_depth_str;
- if (ConfGetValue("stream.reassembly.depth", &temp_stream_reassembly_depth_str) == 1) {
+ if (ConfGet("stream.reassembly.depth", &temp_stream_reassembly_depth_str) == 1) {
if (ParseSizeStringU32(temp_stream_reassembly_depth_str,
&stream_config.reassembly_depth) < 0) {
SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
if (randomize) {
const char *temp_rdrange;
- if (ConfGetValue("stream.reassembly.randomize-chunk-range",
- &temp_rdrange) == 1) {
+ if (ConfGet("stream.reassembly.randomize-chunk-range", &temp_rdrange) == 1) {
if (ParseSizeStringU16(temp_rdrange, &rdrange) < 0) {
SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
"stream.reassembly.randomize-chunk-range "
}
const char *temp_stream_reassembly_toserver_chunk_size_str;
- if (ConfGetValue("stream.reassembly.toserver-chunk-size",
+ if (ConfGet("stream.reassembly.toserver-chunk-size",
&temp_stream_reassembly_toserver_chunk_size_str) == 1) {
if (ParseSizeStringU16(temp_stream_reassembly_toserver_chunk_size_str,
&stream_config.reassembly_toserver_chunk_size) < 0) {
rdrange / 100);
}
const char *temp_stream_reassembly_toclient_chunk_size_str;
- if (ConfGetValue("stream.reassembly.toclient-chunk-size",
+ if (ConfGet("stream.reassembly.toclient-chunk-size",
&temp_stream_reassembly_toclient_chunk_size_str) == 1) {
if (ParseSizeStringU16(temp_stream_reassembly_toclient_chunk_size_str,
&stream_config.reassembly_toclient_chunk_size) < 0) {
{
const char *hostmode = NULL;
- if (ConfGetValue("host-mode", &hostmode) == 1) {
+ if (ConfGet("host-mode", &hostmode) == 1) {
if (!strcmp(hostmode, "router")) {
host_mode = SURI_HOST_IS_ROUTER;
} else if (!strcmp(hostmode, "sniffer-only")) {
"default setting 'sniffer-only'");
}
}
-
}
static void SetupUserMode(SCInstance *suri)
if (suri->checksum_validation == -1) {
const char *cv = NULL;
- if (ConfGetValue("capture.checksum-validation", &cv) == 1) {
+ if (ConfGet("capture.checksum-validation", &cv) == 1) {
if (strcmp(cv, "none") == 0) {
suri->checksum_validation = 0;
} else if (strcmp(cv, "all") == 0) {