@@ -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); @@ -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. |