diff options
Diffstat (limited to 'src/include/ndpi_api.h.in')
-rw-r--r-- | src/include/ndpi_api.h.in | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/include/ndpi_api.h.in b/src/include/ndpi_api.h.in index 6495c6825..5f8604f8e 100644 --- a/src/include/ndpi_api.h.in +++ b/src/include/ndpi_api.h.in @@ -137,7 +137,7 @@ extern "C" { * NULL if the substring is not found * */ - char* ndpi_strncasestr(const char *s, const char *find, size_t slen); + const char* ndpi_strncasestr(const char *s, const char *find, size_t slen); /** * Returns the nDPI protocol id for IP-based protocol detection @@ -191,7 +191,7 @@ extern "C" { /** * Completes the initialization (2nd step) * - * @return the initialized detection module + * @par ndpi_str = the struct created for the protocol detection * */ void ndpi_finalize_initalization(struct ndpi_detection_module_struct *ndpi_str); @@ -258,7 +258,7 @@ extern "C" { */ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *ndpi_struct, const NDPI_PROTOCOL_BITMASK * detection_bitmask); - + /** * Function to be called before we give up with detection for a given flow. * This function reduces the NDPI_UNKNOWN_PROTOCOL detection @@ -330,7 +330,7 @@ extern "C" { */ u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); - + /** * API call that is called internally by ndpi_detection_process_packet or by apps * that want to avoid calling ndpi_detection_process_packet as they have already @@ -431,7 +431,7 @@ extern "C" { char *string_to_match, u_int string_to_match_len, ndpi_protocol_match_result *ret_match, - u_int16_t master_protocol_id); + u_int16_t master_protocol_id); /** * Check if the string content passed match with a protocol @@ -558,7 +558,7 @@ extern "C" { */ int ndpi_match_hostname_protocol(struct ndpi_detection_module_struct *ndpi_mod, struct ndpi_flow_struct *flow, - u_int16_t master_protocol, + u_int16_t master_protocol, char *name, u_int name_len); /** @@ -838,7 +838,7 @@ extern "C" { /* Tells to called on what l4 protocol given application protocol can be found */ ndpi_l4_proto_info ndpi_get_l4_proto_info(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t ndpi_proto_id); const char* ndpi_get_l4_proto_name(ndpi_l4_proto_info proto); - + 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); @@ -851,7 +851,7 @@ extern "C" { u_int8_t ndpi_lru_find_cache(struct ndpi_lru_cache *c, u_int32_t key, u_int16_t *value, u_int8_t clean_key_when_found); void ndpi_lru_add_to_cache(struct ndpi_lru_cache *c, u_int32_t key, u_int16_t value); - + /** * Find a protocol id associated with a string automata * @@ -886,7 +886,7 @@ extern "C" { u_int16_t src_port, u_int16_t dst_port, u_int8_t icmp_type, u_int8_t icmp_code, u_char *hash_buf, u_int8_t hash_buf_len); u_int8_t ndpi_extra_dissection_possible(struct ndpi_detection_module_struct *ndpi_struct, - struct ndpi_flow_struct *flow); + struct ndpi_flow_struct *flow); u_int8_t ndpi_is_safe_ssl_cipher(u_int32_t cipher); const char* ndpi_cipher2str(u_int32_t cipher); const char* ndpi_tunnel2str(ndpi_packet_tunnel tt); @@ -904,7 +904,10 @@ extern "C" { char* ndpi_base64_encode(unsigned char const* bytes_to_encode, size_t in_len); int ndpi_load_ipv4_ptree(struct ndpi_detection_module_struct *ndpi_str, const char *path, u_int16_t protocol_id); - + int ndpi_dpi2json(struct ndpi_detection_module_struct *ndpi_struct, + struct ndpi_flow_struct *flow, + ndpi_protocol l7_protocol, + ndpi_serializer *serializer); int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int8_t ip_version, @@ -949,7 +952,7 @@ extern "C" { int ndpi_serialize_string_int32(ndpi_serializer *serializer, const char *key, int32_t value); int ndpi_serialize_string_int64(ndpi_serializer *serializer, - const char *key, int64_t value); + const char *key, int64_t value); int ndpi_serialize_string_uint32(ndpi_serializer *serializer, const char *key, u_int32_t value); int ndpi_serialize_string_uint32_format(ndpi_serializer *serializer, @@ -973,6 +976,9 @@ extern "C" { int ndpi_serialize_raw_record(ndpi_serializer *_serializer, u_char *record, u_int32_t record_len); int ndpi_serialize_end_of_record(ndpi_serializer *serializer); + int ndpi_serialize_start_of_list(ndpi_serializer *serializer, + const char *key); + int ndpi_serialize_end_of_list(ndpi_serializer *serializer); int ndpi_serialize_start_of_block(ndpi_serializer *serializer, const char *key); int ndpi_serialize_end_of_block(ndpi_serializer *serializer); @@ -981,17 +987,18 @@ extern "C" { u_int32_t ndpi_serializer_get_internal_buffer_size(ndpi_serializer *serializer); int ndpi_serializer_set_buffer_len(ndpi_serializer *serializer, u_int32_t l); void ndpi_serializer_set_csv_separator(ndpi_serializer *serializer, char separator); + char* ndpi_serializer_get_header(ndpi_serializer *serializer, u_int32_t *buffer_len); void ndpi_serializer_create_snapshot(ndpi_serializer *serializer); void ndpi_serializer_rollback_snapshot(ndpi_serializer *serializer); - + /* Deserializer */ int ndpi_init_deserializer(ndpi_deserializer *deserializer, ndpi_serializer *serializer); int ndpi_init_deserializer_buf(ndpi_deserializer *deserializer, u_int8_t *serialized_buffer, u_int32_t serialized_buffer_len); - + ndpi_serialization_format ndpi_deserialize_get_format(ndpi_deserializer *_deserializer); ndpi_serialization_type ndpi_deserialize_get_item_type(ndpi_deserializer *deserializer, ndpi_serialization_type *key_type); int ndpi_deserialize_next(ndpi_deserializer *deserializer); @@ -1017,22 +1024,23 @@ extern "C" { float ndpi_data_average(struct ndpi_analyze_struct *s); float ndpi_data_window_average(struct ndpi_analyze_struct *s); - + float ndpi_data_entropy(struct ndpi_analyze_struct *s); float ndpi_data_variance(struct ndpi_analyze_struct *s); float ndpi_data_stddev(struct ndpi_analyze_struct *s); u_int32_t ndpi_data_min(struct ndpi_analyze_struct *s); u_int32_t ndpi_data_max(struct ndpi_analyze_struct *s); float ndpi_data_ratio(u_int32_t sent, u_int32_t rcvd); - + const char* ndpi_data_ratio2str(float ratio); - + void ndpi_data_print_window_values(struct ndpi_analyze_struct *s); /* debug */ ndpi_risk_enum ndpi_validate_url(char *url); u_int8_t ndpi_is_protocol_detected(struct ndpi_detection_module_struct *ndpi_str, ndpi_protocol proto); + void ndpi_serialize_risk(ndpi_serializer *serializer, struct ndpi_flow_struct *flow); const char* ndpi_risk2str(ndpi_risk_enum risk); #ifdef __cplusplus |