aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorLuca Deri <deri@ntop.org>2024-08-26 15:56:18 +0200
committerLuca Deri <deri@ntop.org>2024-08-26 15:56:18 +0200
commit9263d4dd873c4e2068e392a692b20609b1ec5a9a (patch)
treebd5608e2c953f013daca7b6b5db4d3b4ebafbbca /src/include
parente4e91e9380618229b66da7210f920f7099d6e214 (diff)
Added in API
bool ndpi_is_proto(ndpi_master_app_protocol proto, u_int16_t p); bool ndpi_is_proto_unknown(ndpi_master_app_protocol proto); bool ndpi_is_proto_equals(ndpi_master_app_protocol to_check, ndpi_master_app_protocol to_match, bool exact_match_only); u_int16_t ndpi_get_proto_by_name(struct ndpi_detection_module_struct *ndpi_mod, const char *name); char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id); extern ndpi_master_app_protocol ndpi_get_protocol_by_name(struct ndpi_detection_module_struct *ndpi_str, const char *name); Removed (duplicate of ndpi_get_proto_by_name) int ndpi_get_protocol_id(struct ndpi_detection_module_struct *ndpi_mod, char *proto);
Diffstat (limited to 'src/include')
2 files changed, 29 insertions, 10 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h
index 6394481cc..45c96e194 100644
--- a/src/include/ndpi_api.h
+++ b/src/include/ndpi_api.h
@@ -690,14 +690,36 @@ extern "C" {
char* ndpi_get_proto_breed_name(ndpi_protocol_breed_t breed_id);
/**
- * Return the ID of the protocol
+ * Return the name of the protocol given its ID
*
* @par ndpi_mod = the detection module
- * @par proto = the protocol name
+ * @par name = the protocol name
* @return the ID of the protocol
*
*/
- int ndpi_get_protocol_id(struct ndpi_detection_module_struct *ndpi_mod, char *proto);
+ extern u_int16_t ndpi_get_proto_by_name(struct ndpi_detection_module_struct *ndpi_mod, const char *name);
+
+ /**
+ * Return the name of the protocol given its ID
+ *
+ * @par ndpi_mod = the detection module
+ * @par id = the protocol id
+ * @return the name of the protocol
+ *
+ */
+ extern char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id);
+
+ /**
+ * Return the name of the protocol given its ID
+ *
+ * @par ndpi_mod = the detection module
+ * @par id = the protocol id
+ * @return the name of the protocol
+ *
+ */
+
+ extern ndpi_master_app_protocol ndpi_get_protocol_by_name(struct ndpi_detection_module_struct *ndpi_str, const char *name);
+
/**
* Return the ID of the category
@@ -1036,7 +1058,10 @@ extern "C" {
u_int16_t ndpi_get_lower_proto(ndpi_protocol proto);
u_int16_t ndpi_get_upper_proto(ndpi_protocol proto);
-
+ bool ndpi_is_proto(ndpi_master_app_protocol proto, u_int16_t p);
+ bool ndpi_is_proto_unknown(ndpi_master_app_protocol proto);
+ bool ndpi_is_proto_equals(ndpi_master_app_protocol to_check, ndpi_master_app_protocol to_match, bool exact_match_only);
+
ndpi_proto_defaults_t* ndpi_get_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod);
u_int ndpi_get_ndpi_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod);
u_int ndpi_get_ndpi_num_custom_protocols(struct ndpi_detection_module_struct *ndpi_mod);
diff --git a/src/include/ndpi_main.h b/src/include/ndpi_main.h
index 1b8de4558..e96d96b91 100644
--- a/src/include/ndpi_main.h
+++ b/src/include/ndpi_main.h
@@ -69,12 +69,6 @@ extern "C" {
extern char *ndpi_get_ip_string(const ndpi_ip_addr_t * ip, char *buf, u_int buf_len);
extern u_int8_t ndpi_is_ipv6(const ndpi_ip_addr_t *ip);
- extern char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id);
- u_int16_t ndpi_get_proto_by_name(struct ndpi_detection_module_struct *ndpi_mod, const char *name);
- ndpi_master_app_protocol ndpi_get_protocol_by_name(struct ndpi_detection_module_struct *ndpi_str, const char *name);
-
- extern u_int8_t ndpi_is_proto(ndpi_protocol proto, u_int16_t p);
-
extern void ndpi_search_tcp_or_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
/** Checks when the @p payload starts with the string literal @p str.