update test pcap due to modification of quic protocol - improved readability of code

This commit is contained in:
Campus
2016-05-12 23:17:41 +02:00
parent 32847fcfd0
commit 6edb280cc7
4 changed files with 25 additions and 6 deletions
+12 -2
View File
@@ -45,11 +45,15 @@
#define DIGIT(X, Y, Z) ((isdigit(X) && isdigit(Y) && isdigit(Z)) ? (INT(X) * 100 + INT(Y) * 10 + INT(Z)) : 0)
#ifdef NDPI_PROTOCOL_QUIC
static void ndpi_int_quic_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_QUIC, NDPI_PROTOCOL_UNKNOWN);
}
static int connect_id(const unsigned char pflags)
{
u_int cid_len;
@@ -69,6 +73,7 @@ static int connect_id(const unsigned char pflags)
return cid_len + 1;
}
static int sequence(const unsigned char *payload)
{
char test[6] = {0};
@@ -94,6 +99,7 @@ static int sequence(const unsigned char *payload)
return memcmp(payload + cid_offs, test, seq_lens);
}
void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
struct ndpi_packet_struct *packet = &flow->packet;
@@ -154,10 +160,14 @@ void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct, struct n
}
}
void init_quic_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("QUIC", ndpi_struct, detection_bitmask, *id, NDPI_PROTOCOL_QUIC, ndpi_search_quic,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD, SAVE_DETECTION_BITMASK_AS_UNKNOWN, ADD_TO_DETECTION_BITMASK);
ndpi_set_bitmask_protocol_detection("QUIC", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_QUIC,
ndpi_search_quic,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN, ADD_TO_DETECTION_BITMASK);
*id += 1;
}