Skip to content

Commit

Permalink
Reworked protocol initialization. Work in progress (more cleanup is n…
Browse files Browse the repository at this point in the history
…eeded)
  • Loading branch information
lucaderi committed Jul 8, 2015
1 parent dc1d7bf commit 5266c72
Show file tree
Hide file tree
Showing 137 changed files with 2,475 additions and 1,459 deletions.
134 changes: 134 additions & 0 deletions src/include/ndpi_protocols.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/lib/ndpi_content_match.c.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7314,6 +7314,7 @@ ndpi_protocol_match host_match[] = {
{ ".facebook.com", "Facebook", NDPI_SERVICE_FACEBOOK, NDPI_PROTOCOL_FUN },
{ ".fbcdn.net", "Facebook", NDPI_SERVICE_FACEBOOK, NDPI_PROTOCOL_FUN },
{ "fbcdn-", "Facebook", NDPI_SERVICE_FACEBOOK, NDPI_PROTOCOL_FUN }, /* fbcdn-video-a-akamaihd.net */
{ ".google.", "Google", NDPI_SERVICE_GOOGLE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".gstatic.com", "Google", NDPI_SERVICE_GOOGLE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".googlesyndication.com", "Google", NDPI_SERVICE_GOOGLE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".googletagservices.com", "Google", NDPI_SERVICE_GOOGLE, NDPI_PROTOCOL_ACCEPTABLE },
Expand Down Expand Up @@ -7359,7 +7360,6 @@ ndpi_protocol_match host_match[] = {
{ ".ytimg.com", "YouTube", NDPI_SERVICE_YOUTUBE, NDPI_PROTOCOL_FUN },
{ "youtube-nocookie.", "YouTube", NDPI_SERVICE_YOUTUBE, NDPI_PROTOCOL_FUN },
{ ".vevo.com", "Vevo", NDPI_SERVICE_VEVO, NDPI_PROTOCOL_FUN },
{ ".google.", "Google", NDPI_SERVICE_GOOGLE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".spotify.", "Spotify", NDPI_PROTOCOL_SPOTIFY, NDPI_PROTOCOL_FUN },
{ ".pandora.com", "Pandora", NDPI_SERVICE_PANDORA, NDPI_PROTOCOL_FUN },
{ ".torproject.org", "Tor", NDPI_PROTOCOL_TOR, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS },
Expand Down
1,845 changes: 441 additions & 1,404 deletions src/lib/ndpi_main.c

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/lib/protocols/afp.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,17 @@ void ndpi_search_afp(struct ndpi_detection_module_struct *ndpi_struct, struct nd
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_AFP);
}


void init_afp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("AFP", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_AFP,
ndpi_search_afp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}


#endif
14 changes: 14 additions & 0 deletions src/lib/protocols/aimini.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,18 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_AIMINI);

}


void init_aimini_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("AIMINI", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_AIMINI,
ndpi_search_aimini,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);

*id += 1;
}

#endif
13 changes: 13 additions & 0 deletions src/lib/protocols/applejuice.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,17 @@ void ndpi_search_applejuice_tcp(struct ndpi_detection_module_struct *ndpi_struct
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_APPLEJUICE);
}


void init_applejuice_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("APPLEJUICE", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_APPLEJUICE,
ndpi_search_applejuice_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);

*id += 1;
}

#endif
17 changes: 15 additions & 2 deletions src/lib/protocols/armagetron.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
*
*/



/* include files */
#include "ndpi_protocols.h"
#ifdef NDPI_PROTOCOL_ARMAGETRON
Expand Down Expand Up @@ -99,4 +97,19 @@ void ndpi_search_armagetron_udp(struct ndpi_detection_module_struct *ndpi_struct
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_ARMAGETRON);
}



void init_armagetron_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("ARMAGETRON", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_ARMAGETRON,
ndpi_search_armagetron_udp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);

*id += 1;
}


#endif
14 changes: 14 additions & 0 deletions src/lib/protocols/ayiya.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,18 @@ void ndpi_search_ayiya(struct ndpi_detection_module_struct *ndpi_struct, struct
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_AYIYA);
}
}


void init_ayiya_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("AYIYA", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_AYIYA,
ndpi_search_ayiya,
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);

*id += 1;
}

#endif
12 changes: 12 additions & 0 deletions src/lib/protocols/battlefield.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,16 @@ void ndpi_search_battlefield(struct ndpi_detection_module_struct *ndpi_struct, s
return;
}


void init_battlefield_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("BattleField", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_BATTLEFIELD,
ndpi_search_battlefield,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}

#endif
13 changes: 13 additions & 0 deletions src/lib/protocols/bgp.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,17 @@ void ndpi_search_bgp(struct ndpi_detection_module_struct *ndpi_struct, struct nd
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_BGP);
}


void init_bgp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("BGP", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_BGP,
ndpi_search_bgp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}


#endif
13 changes: 13 additions & 0 deletions src/lib/protocols/bittorrent.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,17 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
}
}
}


void init_bittorrent_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("BitTorrent", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_BITTORRENT,
ndpi_search_bittorrent,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}

#endif
13 changes: 13 additions & 0 deletions src/lib/protocols/ciscovpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,17 @@ void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, stru
}

}


void init_ciscovpn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("CiscoVPN", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_CISCOVPN,
ndpi_search_ciscovpn,
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}

#endif
12 changes: 12 additions & 0 deletions src/lib/protocols/citrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,16 @@ void ndpi_search_citrix(struct ndpi_detection_module_struct *ndpi_struct, struct
ndpi_check_citrix(ndpi_struct, flow);
}


void init_citrix_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("Citrix", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_CITRIX,
ndpi_search_citrix,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}

#endif
1 change: 1 addition & 0 deletions src/lib/protocols/collectd.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struct, stru
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_COLLECTD);
}
}

#endif
12 changes: 12 additions & 0 deletions src/lib/protocols/corba.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,16 @@ void ndpi_search_corba(struct ndpi_detection_module_struct *ndpi_struct, struct
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_CORBA);
}
}


void init_corba_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("Corba", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_CORBA,
ndpi_search_corba,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}
#endif
11 changes: 10 additions & 1 deletion src/lib/protocols/crossfire.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/



/* include files */
#include "ndpi_protocols.h"
#ifdef NDPI_PROTOCOL_CROSSFIRE
Expand Down Expand Up @@ -81,5 +80,15 @@ void ndpi_search_crossfire_tcp_udp(struct ndpi_detection_module_struct *ndpi_str
}


void init_crossfire_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("Crossfire", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_CROSSFIRE,
ndpi_search_crossfire_tcp_udp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}

#endif
12 changes: 12 additions & 0 deletions src/lib/protocols/dcerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,16 @@ void ndpi_search_dcerpc(struct ndpi_detection_module_struct *ndpi_struct, struct
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DCERPC);
}


void init_dcerpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("DCE_RPC", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_DCERPC,
ndpi_search_dcerpc,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}

#endif
13 changes: 13 additions & 0 deletions src/lib/protocols/dhcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,17 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru

NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DHCP);
}


void init_dhcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("DHCP", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_DHCP,
ndpi_search_dhcp_udp,
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}

#endif
12 changes: 12 additions & 0 deletions src/lib/protocols/dhcpv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,16 @@ void ndpi_search_dhcpv6_udp(struct ndpi_detection_module_struct *ndpi_struct, st
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DHCPV6);
}


void init_dhcpv6_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("DHCPV6", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_DHCPV6,
ndpi_search_dhcpv6_udp,
NDPI_SELECTION_BITMASK_PROTOCOL_V6_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}

#endif
13 changes: 13 additions & 0 deletions src/lib/protocols/directconnect.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,17 @@ void ndpi_search_directconnect(struct ndpi_detection_module_struct
}
}


void init_directconnect_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("DIRECTCONNECT", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_DIRECTCONNECT,
ndpi_search_directconnect,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);

*id += 1;
}

#endif
12 changes: 12 additions & 0 deletions src/lib/protocols/directdownloadlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,4 +734,16 @@ void ndpi_search_direct_download_link_tcp(struct ndpi_detection_module_struct *n
}

}

void init_directdownloadlink_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("DIRECT_DOWNLOAD_LINK", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK,
ndpi_search_direct_download_link_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);

*id += 1;
}
#endif
14 changes: 14 additions & 0 deletions src/lib/protocols/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,18 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
}
}
}


void init_dns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("DNS", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_DNS,
ndpi_search_dns,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);

*id += 1;
}

#endif
12 changes: 12 additions & 0 deletions src/lib/protocols/dofus.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,16 @@ void ndpi_search_dofus(struct ndpi_detection_module_struct *ndpi_struct, struct
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DOFUS);
}


void init_dofus_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("DOFUS", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_DOFUS,
ndpi_search_dofus,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);

*id += 1;
}
#endif
14 changes: 14 additions & 0 deletions src/lib/protocols/dropbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,18 @@ void ndpi_search_dropbox(struct ndpi_detection_module_struct *ndpi_struct, struc
}
}


void init_dropbox_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("DROPBOX", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_DROPBOX,
ndpi_search_dropbox,
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}



#endif
Loading

0 comments on commit 5266c72

Please sign in to comment.