aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
3 files changed, 19 insertions, 11 deletions
diff --git a/src/include/ndpi_api.h b/src/include/ndpi_api.h
index 5ec188be5..d3fff5cfd 100644
--- a/src/include/ndpi_api.h
+++ b/src/include/ndpi_api.h
@@ -123,13 +123,13 @@ extern "C" {
* @param dst void pointer to the destination subscriber state machine
* @return returns the detected ID of the protocol
*/
- u_int16_t ndpi_detection_process_packet(struct ndpi_detection_module_struct *ndpi_struct,
- struct ndpi_flow_struct *flow,
- const unsigned char *packet,
- const unsigned short packetlen,
- const u_int64_t current_tick,
- struct ndpi_id_struct *src,
- struct ndpi_id_struct *dst);
+ ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct *ndpi_struct,
+ struct ndpi_flow_struct *flow,
+ const unsigned char *packet,
+ const unsigned short packetlen,
+ const u_int64_t current_tick,
+ struct ndpi_id_struct *src,
+ struct ndpi_id_struct *dst);
u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow);
@@ -169,10 +169,10 @@ extern "C" {
u_int8_t ndpi_detection_flow_protocol_history_contains_protocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow,
u_int16_t protocol_id);
- unsigned int ndpi_find_port_based_protocol(struct ndpi_detection_module_struct *ndpi_struct,
- u_int8_t proto, u_int32_t shost, u_int16_t sport, u_int32_t dhost, u_int16_t dport);
- unsigned int ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct *ndpi_struct,
+ ndpi_protocol ndpi_find_port_based_protocol(struct ndpi_detection_module_struct *ndpi_struct,
u_int8_t proto, u_int32_t shost, u_int16_t sport, u_int32_t dhost, u_int16_t dport);
+ ndpi_protocol ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct *ndpi_struct,
+ u_int8_t proto, u_int32_t shost, u_int16_t sport, u_int32_t dhost, u_int16_t dport);
int ndpi_match_string_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow, char *string_to_match, u_int string_to_match_len);
int ndpi_match_content_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
@@ -180,6 +180,7 @@ extern "C" {
char *string_to_match, u_int string_to_match_len);
int ndpi_match_bigram(struct ndpi_detection_module_struct *ndpi_struct,
ndpi_automa *automa, char *bigram_to_match);
+ char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod, ndpi_protocol proto, char *buf, u_int buf_len);
char* ndpi_get_proto_name(struct ndpi_detection_module_struct *mod, u_int16_t proto_id);
ndpi_protocol_breed_t ndpi_get_proto_breed(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t proto);
char* ndpi_get_proto_breed_name(struct ndpi_detection_module_struct *ndpi_struct, ndpi_protocol_breed_t breed_id);
diff --git a/src/include/ndpi_main.h b/src/include/ndpi_main.h
index ab869b167..adec3edf1 100644
--- a/src/include/ndpi_main.h
+++ b/src/include/ndpi_main.h
@@ -136,6 +136,8 @@ extern char *ndpi_get_packet_src_ip_string(struct ndpi_detection_module_struct *
extern char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id);
extern u_int16_t ndpi_guess_protocol_id(struct ndpi_detection_module_struct *ndpi_struct,
u_int8_t proto, u_int16_t sport, u_int16_t dport);
+extern u_int8_t ndpi_is_proto(ndpi_protocol p, u_int16_t proto);
+extern u_int16_t ndpi_get_lower_proto(ndpi_protocol p);
extern int ndpi_get_protocol_id_master_proto(struct ndpi_detection_module_struct *ndpi_struct,
u_int16_t protocol_id,
u_int16_t** tcp_master_proto,
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h
index 7ca59fa58..8404daa2e 100644
--- a/src/include/ndpi_typedefs.h
+++ b/src/include/ndpi_typedefs.h
@@ -561,6 +561,12 @@ typedef struct _ndpi_automa {
u_int8_t ac_automa_finalized;
} ndpi_automa;
+typedef struct ndpi_proto {
+ u_int16_t master_protocol /* e.g. HTTP */, protocol /* e.g. FaceBook */;
+} ndpi_protocol;
+
+#define NDPI_PROTOCOL_NULL { NDPI_PROTOCOL_UNKNOWN , NDPI_PROTOCOL_UNKNOWN }
+
typedef struct ndpi_detection_module_struct {
NDPI_PROTOCOL_BITMASK detection_bitmask;
NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask;
@@ -671,7 +677,6 @@ typedef struct ndpi_flow_struct {
u_int16_t guessed_protocol_id;
u_int8_t protocol_id_already_guessed:1;
- u_int8_t no_cache_protocol:1;
u_int8_t init_finished:1;
u_int8_t setup_packet_direction:1;
u_int8_t packet_direction:1; /* if ndpi_struct->direction_detect_disable == 1 */