Added the ability to define custom protocols with arbitrary Ids in proto.txt
Example - ip:213.75.170.11/32:443@CustomProtocol nDPI assigns an is that can change based on protos.txt content - ip:213.75.170.11/32:443@CustomProtocol=9999 nDPI assigns 9999 as protocolId to CustomProtocol and won't change when protos.txt content will chaneg
This commit is contained in:
@@ -978,6 +978,11 @@ extern "C" {
|
||||
ndpi_detection_preference pref,
|
||||
int value);
|
||||
|
||||
u_int16_t ndpi_map_user_proto_id_to_ndpi_id(struct ndpi_detection_module_struct *ndpi_str,
|
||||
u_int16_t user_proto_id);
|
||||
u_int16_t ndpi_map_ndpi_id_to_user_proto_id(struct ndpi_detection_module_struct *ndpi_str,
|
||||
u_int16_t ndpi_proto_id);
|
||||
|
||||
/* 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);
|
||||
@@ -1091,7 +1096,7 @@ extern "C" {
|
||||
const u_int8_t *src, u_int src_len);
|
||||
u_char* ndpi_base64_decode(const u_char *src, size_t len, size_t *out_len);
|
||||
char* ndpi_base64_encode(unsigned char const* bytes_to_encode, size_t in_len); /* NOTE: caller MUST free the returned pointer */
|
||||
void ndpi_string_sha1_hash(const uint8_t *message, size_t len, u_char *hash /* 20-bytes */);
|
||||
void ndpi_string_sha1_hash(const u_int8_t *message, size_t len, u_char *hash /* 20-bytes */);
|
||||
|
||||
int ndpi_load_ipv4_ptree(struct ndpi_detection_module_struct *ndpi_str,
|
||||
const char *path, u_int16_t protocol_id);
|
||||
@@ -1890,7 +1895,7 @@ extern "C" {
|
||||
|
||||
ndpi_bitmap_iterator* ndpi_bitmap_iterator_alloc(ndpi_bitmap* b);
|
||||
void ndpi_bitmap_iterator_free(ndpi_bitmap* b);
|
||||
bool ndpi_bitmap_iterator_next(ndpi_bitmap_iterator* i, uint32_t *value);
|
||||
bool ndpi_bitmap_iterator_next(ndpi_bitmap_iterator* i, u_int32_t *value);
|
||||
|
||||
/* ******************************* */
|
||||
|
||||
|
||||
@@ -68,15 +68,15 @@ extern float parameters_splt[NUM_PARAMETERS_SPLT_LOGREG];
|
||||
/* Classifier functions */
|
||||
float ndpi_classify(const unsigned short *pkt_len, const pkt_timeval *pkt_time,
|
||||
const unsigned short *pkt_len_twin, const pkt_timeval *pkt_time_twin,
|
||||
pkt_timeval start_time, pkt_timeval start_time_twin, uint32_t max_num_pkt_len,
|
||||
uint16_t sp, uint16_t dp, uint32_t op, uint32_t ip, uint32_t np_o, uint32_t np_i,
|
||||
uint32_t ob, uint32_t ib, uint16_t use_bd, const uint32_t *bd, const uint32_t *bd_t);
|
||||
pkt_timeval start_time, pkt_timeval start_time_twin, u_int32_t max_num_pkt_len,
|
||||
u_int16_t sp, u_int16_t dp, u_int32_t op, u_int32_t ip, u_int32_t np_o, u_int32_t np_i,
|
||||
u_int32_t ob, u_int32_t ib, u_int16_t use_bd, const u_int32_t *bd, const u_int32_t *bd_t);
|
||||
|
||||
void ndpi_merge_splt_arrays(const uint16_t *pkt_len, const pkt_timeval *pkt_time,
|
||||
const uint16_t *pkt_len_twin, const pkt_timeval *pkt_time_twin,
|
||||
void ndpi_merge_splt_arrays(const u_int16_t *pkt_len, const pkt_timeval *pkt_time,
|
||||
const u_int16_t *pkt_len_twin, const pkt_timeval *pkt_time_twin,
|
||||
pkt_timeval start_time, pkt_timeval start_time_twin,
|
||||
uint16_t s_idx, uint16_t r_idx,
|
||||
uint16_t *merged_lens, uint16_t *merged_times);
|
||||
u_int16_t s_idx, u_int16_t r_idx,
|
||||
u_int16_t *merged_lens, u_int16_t *merged_times);
|
||||
|
||||
void ndpi_update_params(classifier_type_codes_t param_type, const char *param_file);
|
||||
|
||||
@@ -87,6 +87,6 @@ void ndpi_timer_sub(const pkt_timeval *a, const pkt_timeval *b, pkt_timeval *res
|
||||
void ndpi_timer_clear(pkt_timeval *a);
|
||||
u_int64_t ndpi_timeval_to_milliseconds(pkt_timeval ts);
|
||||
u_int64_t ndpi_timeval_to_microseconds(pkt_timeval ts);
|
||||
void ndpi_log_timestamp(char *log_ts, uint32_t log_ts_len);
|
||||
void ndpi_log_timestamp(char *log_ts, u_int32_t log_ts_len);
|
||||
|
||||
#endif /* NDPI_CLASSIFY_H */
|
||||
|
||||
@@ -159,7 +159,7 @@ extern "C" {
|
||||
struct ndpi_flow_struct *flow, ndpi_risk_enum r);
|
||||
int ndpi_isset_risk(struct ndpi_detection_module_struct *ndpi_str,
|
||||
struct ndpi_flow_struct *flow, ndpi_risk_enum r);
|
||||
int ndpi_is_printable_buffer(uint8_t const * const buf, size_t len);
|
||||
int ndpi_is_printable_buffer(u_int8_t const * const buf, size_t len);
|
||||
int ndpi_normalize_printable_string(char * const str, size_t len);
|
||||
int ndpi_is_valid_hostname(char * const str, size_t len);
|
||||
#define NDPI_ENTROPY_ENCRYPTED_OR_RANDOM(entropy) (entropy > 7.0f)
|
||||
|
||||
@@ -516,13 +516,13 @@ struct ndpi_icmphdr {
|
||||
|
||||
PACK_ON
|
||||
struct ndpi_icmp6hdr {
|
||||
uint8_t icmp6_type; /* type field */
|
||||
uint8_t icmp6_code; /* code field */
|
||||
uint16_t icmp6_cksum; /* checksum field */
|
||||
u_int8_t icmp6_type; /* type field */
|
||||
u_int8_t icmp6_code; /* code field */
|
||||
u_int16_t icmp6_cksum; /* checksum field */
|
||||
union {
|
||||
uint32_t icmp6_un_data32[1]; /* type-specific field */
|
||||
uint16_t icmp6_un_data16[2]; /* type-specific field */
|
||||
uint8_t icmp6_un_data8[4]; /* type-specific field */
|
||||
u_int32_t icmp6_un_data32[1]; /* type-specific field */
|
||||
u_int16_t icmp6_un_data16[2]; /* type-specific field */
|
||||
u_int8_t icmp6_un_data8[4]; /* type-specific field */
|
||||
} icmp6_dataun;
|
||||
} PACK_OFF;
|
||||
|
||||
@@ -1228,6 +1228,7 @@ struct ndpi_detection_module_struct {
|
||||
int opportunistic_tls_pop_enabled;
|
||||
int opportunistic_tls_ftp_enabled;
|
||||
|
||||
u_int16_t ndpi_to_user_proto_id[NDPI_MAX_NUM_CUSTOM_PROTOCOLS]; /* custom protocolId mapping */
|
||||
ndpi_proto_defaults_t proto_defaults[NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS];
|
||||
|
||||
u_int8_t direction_detect_disable:1, /* disable internal detection of packet direction */ _pad:7;
|
||||
|
||||
Reference in New Issue
Block a user