}
}
+/**
+ * \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 *temp_stream_memcap_str;
- if (ConfGet("stream.memcap", &temp_stream_memcap_str) == 1) {
+ if (ConfGetValue("stream.memcap", &temp_stream_memcap_str) == 1) {
if (ParseSizeStringU64(temp_stream_memcap_str, &stream_config.memcap) < 0) {
SCLogError(SC_ERR_SIZE_PARSE, "Error parsing stream.memcap "
"from conf file - %s. Killing engine",
}
const char *temp_stream_inline_str;
- if (ConfGet("stream.inline", &temp_stream_inline_str) == 1) {
+ if (ConfGetValue("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 (ConfGet("stream.reassembly.memcap", &temp_stream_reassembly_memcap_str) == 1) {
+ if (ConfGetValue("stream.reassembly.memcap", &temp_stream_reassembly_memcap_str) == 1) {
if (ParseSizeStringU64(temp_stream_reassembly_memcap_str,
&stream_config.reassembly_memcap) < 0) {
SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
}
const char *temp_stream_reassembly_depth_str;
- if (ConfGet("stream.reassembly.depth", &temp_stream_reassembly_depth_str) == 1) {
+ if (ConfGetValue("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 (ConfGet("stream.reassembly.randomize-chunk-range",
+ if (ConfGetValue("stream.reassembly.randomize-chunk-range",
&temp_rdrange) == 1) {
if (ParseSizeStringU16(temp_rdrange, &rdrange) < 0) {
SCLogError(SC_ERR_SIZE_PARSE, "Error parsing "
}
const char *temp_stream_reassembly_toserver_chunk_size_str;
- if (ConfGet("stream.reassembly.toserver-chunk-size",
+ if (ConfGetValue("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) {
(r * 1.0 / RAND_MAX - 0.5) * rdrange / 100);
}
const char *temp_stream_reassembly_toclient_chunk_size_str;
- if (ConfGet("stream.reassembly.toclient-chunk-size",
+ if (ConfGetValue("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) {