Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
Vito Piserchia
2016-11-03 15:08:56 +01:00
3 changed files with 32 additions and 5 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include @PCAP_INC@
AM_CFLAGS = @PTHREAD_CFLAGS@
LDADD = $(top_builddir)/src/lib/libndpi.la @JSON_C_LIB@ @PTHREAD_LIBS@ @PCAP_LIB@
AM_LDFLAGS = -static
AM_LDFLAGS = -static -ldl
ndpiReader_SOURCES = ndpiReader.c ndpi_util.c ndpi_util.h
+21 -2
View File
@@ -4386,47 +4386,66 @@ char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod,
const char* ndpi_category_str(ndpi_protocol_category_t category) {
switch(category) {
case NDPI_PROTOCOL_CATEGORY_UNSPECIFIED:
return("Unspecified");
case NDPI_PROTOCOL_CATEGORY_MEDIA:
return("Media");
break;
case NDPI_PROTOCOL_CATEGORY_VPN:
return("VPN");
break;
case NDPI_PROTOCOL_CATEGORY_MAIL_SEND:
return("EmailSend");
break;
case NDPI_PROTOCOL_CATEGORY_MAIL_SYNC:
return("EmailSync");
break;
case NDPI_PROTOCOL_CATEGORY_FILE_TRANSFER:
return("FileTransfer");
break;
case NDPI_PROTOCOL_CATEGORY_WEB:
return("Web");
break;
case NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK:
return("SocialNetwork");
break;
case NDPI_PROTOCOL_CATEGORY_P2P:
return("P2P");
break;
case NDPI_PROTOCOL_CATEGORY_GAME:
return("Game");
break;
case NDPI_PROTOCOL_CATEGORY_CHAT:
return("Chat");
break;
case NDPI_PROTOCOL_CATEGORY_VOIP:
return("VoIP");
break;
case NDPI_PROTOCOL_CATEGORY_DATABASE:
return("Database");
break;
case NDPI_PROTOCOL_CATEGORY_REMOTE_ACCESS:
return("RemoteAccess");
break;
case NDPI_PROTOCOL_CATEGORY_CLOUD:
return("Cloud");
break;
case NDPI_PROTOCOL_CATEGORY_NETWORK:
return("Network");
break;
case NDPI_PROTOCOL_CATEGORY_COLLABORATIVE:
return("Collaborative");
break;
case NDPI_PROTOCOL_CATEGORY_RPC:
return("RPC");
break;
case NDPI_PROTOCOL_CATEGORY_NETWORK_TOOL:
return("NetworkTool");
break;
case NDPI_PROTOCOL_CATEGORY_SYSTEM:
return("System");
break;
}
return("Unspecified");
}
/* ****************************************************** */
+10 -2
View File
@@ -37,11 +37,19 @@
#define P_PACKET_ID_ARRAY_LEN_OFFSET(hmac_size) (P_HARD_RESET_PACKET_ID_OFFSET(hmac_size) + 8)
#define P_HARD_RESET_CLIENT_MAX_COUNT 5
static inline u_int32_t get_packet_id(const u_int8_t * payload, u_int8_t hms) {
static
#ifndef WIN32
inline
#endif
u_int32_t get_packet_id(const u_int8_t * payload, u_int8_t hms) {
return ntohl(*(u_int32_t*)(payload + P_HARD_RESET_PACKET_ID_OFFSET(hms)));
}
static inline int8_t check_pkid_and_detect_hmac_size(const u_int8_t * payload) {
static
#ifndef WIN32
inline
#endif
int8_t check_pkid_and_detect_hmac_size(const u_int8_t * payload) {
// try to guess
if (get_packet_id(payload, P_HMAC_160) == 1)
return P_HMAC_160;