aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/ndpi_api.h14
-rw-r--r--src/lib/ndpi_main.c15
2 files changed, 19 insertions, 10 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h
index 9a0620f23..d3e591dc5 100644
--- a/src/include/ndpi_api.h
+++ b/src/include/ndpi_api.h
@@ -453,12 +453,22 @@ extern "C" {
* Find out if a given category is custom/user-defined
*
* @par category = the category associated to the protocol
- * @return 1 if this is a custom user category, 0 otherwise
+ * @return True if this is a custom user category, false otherwise
*
*/
- int ndpi_is_custom_category(ndpi_protocol_category_t category);
+ bool ndpi_is_custom_category(ndpi_protocol_category_t category);
/**
+ * Find out if a given protocol is custom/user-defined
+ *
+ * @par ndpi_str = the detection module
+ * @par proto_id = the proto_id to check
+ * @return True if this is a custom user protocol, false otherwise (nDPI protocol already supported in the engine)
+ *
+ */
+ bool ndpi_is_custom_protocol(struct ndpi_detection_module_struct *ndpi_str, u_int16_t proto_id);
+
+ /**
* Overwrite a protocol category defined by nDPI with the custom category
*
* @par ndpi_mod = the detection module
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index 2a087476d..638d30cab 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -247,8 +247,6 @@ static int addDefaultPort(struct ndpi_detection_module_struct *ndpi_str,
const char *_func,
int _line);
-int ndpi_is_custom_protocol(struct ndpi_detection_module_struct *ndpi_str, u_int16_t proto_id);
-
/* ****************************************** */
ndpi_custom_dga_predict_fctn ndpi_dga_function = NULL;
@@ -5130,11 +5128,12 @@ u_int ndpi_get_num_internal_protocols(void) {
/* ******************************************************************** */
-int ndpi_is_custom_protocol(struct ndpi_detection_module_struct *ndpi_str, u_int16_t proto_id)
+bool ndpi_is_custom_protocol(struct ndpi_detection_module_struct *ndpi_str, u_int16_t proto_id)
{
if(!ndpi_str || proto_id >= ndpi_str->proto_defaults_num_allocated)
- return 0;
- return ndpi_str->proto_defaults[proto_id].isCustomProto;
+ return false;
+
+ return(ndpi_str->proto_defaults[proto_id].isCustomProto ? true : false);
}
/* ******************************************************************** */
@@ -10785,17 +10784,17 @@ char *ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_str,
/* ****************************************************** */
-int ndpi_is_custom_category(ndpi_protocol_category_t category) {
+bool ndpi_is_custom_category(ndpi_protocol_category_t category) {
switch(category) {
case NDPI_PROTOCOL_CATEGORY_CUSTOM_1:
case NDPI_PROTOCOL_CATEGORY_CUSTOM_2:
case NDPI_PROTOCOL_CATEGORY_CUSTOM_3:
case NDPI_PROTOCOL_CATEGORY_CUSTOM_4:
case NDPI_PROTOCOL_CATEGORY_CUSTOM_5:
- return(1);
+ return(true);
default:
- return(0);
+ return(false);
}
}