Reworked skype code
This commit is contained in:
@@ -29,6 +29,20 @@
|
|||||||
#include "ndpi_main.h"
|
#include "ndpi_main.h"
|
||||||
|
|
||||||
|
|
||||||
|
ndpi_port_range* ndpi_build_default_ports_range(ndpi_port_range *ports,
|
||||||
|
u_int16_t portA_low, u_int16_t portA_high,
|
||||||
|
u_int16_t portB_low, u_int16_t portB_high,
|
||||||
|
u_int16_t portC_low, u_int16_t portC_high,
|
||||||
|
u_int16_t portD_low, u_int16_t portD_high,
|
||||||
|
u_int16_t portE_low, u_int16_t portE_high);
|
||||||
|
|
||||||
|
ndpi_port_range* ndpi_build_default_ports(ndpi_port_range *ports,
|
||||||
|
u_int16_t portA,
|
||||||
|
u_int16_t portB,
|
||||||
|
u_int16_t portC,
|
||||||
|
u_int16_t portD,
|
||||||
|
u_int16_t portE);
|
||||||
|
|
||||||
/* TCP/UDP protocols */
|
/* TCP/UDP protocols */
|
||||||
u_int ndpi_search_tcp_or_udp_raw(struct ndpi_detection_module_struct *ndpi_struct,
|
u_int ndpi_search_tcp_or_udp_raw(struct ndpi_detection_module_struct *ndpi_struct,
|
||||||
u_int8_t protocol,
|
u_int8_t protocol,
|
||||||
@@ -142,7 +156,6 @@ void ndpi_search_crossfire_tcp_udp(struct ndpi_detection_module_struct *ndpi_str
|
|||||||
void ndpi_search_guildwars_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
void ndpi_search_guildwars_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||||
void ndpi_search_armagetron_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
void ndpi_search_armagetron_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||||
void ndpi_search_dropbox(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
void ndpi_search_dropbox(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||||
void ndpi_search_skype(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
|
||||||
void ndpi_search_citrix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
void ndpi_search_citrix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||||
void ndpi_search_dcerpc(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
void ndpi_search_dcerpc(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||||
void ndpi_search_netflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
void ndpi_search_netflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||||
@@ -182,4 +195,5 @@ void ndpi_search_eaq(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
|||||||
void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||||
void ndpi_search_mpegts(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
void ndpi_search_mpegts(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||||
|
|
||||||
|
void init_skype_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||||
#endif /* __NDPI_PROTOCOLS_INCLUDE_FILE__ */
|
#endif /* __NDPI_PROTOCOLS_INCLUDE_FILE__ */
|
||||||
|
|||||||
+4
-13
@@ -1361,11 +1361,6 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
|
|||||||
no_master, "DropBox",
|
no_master, "DropBox",
|
||||||
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
||||||
ndpi_build_default_ports(ports_b, 17500, 0, 0, 0, 0) /* UDP */);
|
ndpi_build_default_ports(ports_b, 17500, 0, 0, 0, 0) /* UDP */);
|
||||||
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_SKYPE,
|
|
||||||
no_master,
|
|
||||||
no_master, "Skype",
|
|
||||||
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
|
||||||
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
|
||||||
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_DCERPC,
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_DCERPC,
|
||||||
no_master,
|
no_master,
|
||||||
no_master, "DCE_RPC",
|
no_master, "DCE_RPC",
|
||||||
@@ -1426,6 +1421,7 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
|
|||||||
no_master, "Radius",
|
no_master, "Radius",
|
||||||
ndpi_build_default_ports(ports_a, 1812, 1813, 0, 0, 0) /* TCP */,
|
ndpi_build_default_ports(ports_a, 1812, 1813, 0, 0, 0) /* TCP */,
|
||||||
ndpi_build_default_ports(ports_b, 1812, 1813, 0, 0, 0) /* UDP */);
|
ndpi_build_default_ports(ports_b, 1812, 1813, 0, 0, 0) /* UDP */);
|
||||||
|
|
||||||
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_WINDOWS_UPDATE,
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_WINDOWS_UPDATE,
|
||||||
no_master,
|
no_master,
|
||||||
no_master, "WindowsUpdate",
|
no_master, "WindowsUpdate",
|
||||||
@@ -2358,6 +2354,9 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n
|
|||||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||||
ADD_TO_DETECTION_BITMASK);
|
ADD_TO_DETECTION_BITMASK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
init_skype_dissector(ndpi_struct, &a, detection_bitmask);
|
||||||
|
|
||||||
/*Update excluded protocol bitmask*/
|
/*Update excluded protocol bitmask*/
|
||||||
NDPI_BITMASK_SET(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask,
|
NDPI_BITMASK_SET(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask,
|
||||||
ndpi_struct->callback_buffer[a].detection_bitmask);
|
ndpi_struct->callback_buffer[a].detection_bitmask);
|
||||||
@@ -3288,14 +3287,6 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n
|
|||||||
ADD_TO_DETECTION_BITMASK);
|
ADD_TO_DETECTION_BITMASK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NDPI_PROTOCOL_SKYPE
|
|
||||||
ndpi_set_bitmask_protocol_detection("Skype", ndpi_struct, detection_bitmask, a++,
|
|
||||||
NDPI_PROTOCOL_SKYPE,
|
|
||||||
ndpi_search_skype,
|
|
||||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
|
|
||||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
|
||||||
ADD_TO_DETECTION_BITMASK);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NDPI_PROTOCOL_RADIUS
|
#ifdef NDPI_PROTOCOL_RADIUS
|
||||||
ndpi_set_bitmask_protocol_detection("RADIUS", ndpi_struct, detection_bitmask, a++,
|
ndpi_set_bitmask_protocol_detection("RADIUS", ndpi_struct, detection_bitmask, a++,
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#ifdef NDPI_PROTOCOL_SKYPE
|
#ifdef NDPI_PROTOCOL_SKYPE
|
||||||
|
|
||||||
|
|
||||||
static u_int8_t is_skype_host(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t host) {
|
static u_int8_t is_skype_host(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t host) {
|
||||||
struct in_addr pin;
|
struct in_addr pin;
|
||||||
|
|
||||||
@@ -119,4 +118,24 @@ void ndpi_search_skype(struct ndpi_detection_module_struct *ndpi_struct, struct
|
|||||||
ndpi_check_skype(ndpi_struct, flow);
|
ndpi_check_skype(ndpi_struct, flow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_skype_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) {
|
||||||
|
ndpi_port_range ports_a[MAX_DEFAULT_PORTS], ports_b[MAX_DEFAULT_PORTS];
|
||||||
|
u_int16_t no_master[2] = { NDPI_PROTOCOL_NO_MASTER_PROTO, NDPI_PROTOCOL_NO_MASTER_PROTO };
|
||||||
|
|
||||||
|
ndpi_set_proto_defaults(ndpi_struct, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_SKYPE,
|
||||||
|
no_master,
|
||||||
|
no_master, "Skype",
|
||||||
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
||||||
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
||||||
|
|
||||||
|
ndpi_set_bitmask_protocol_detection("Skype", ndpi_struct, detection_bitmask, *id,
|
||||||
|
NDPI_PROTOCOL_SKYPE,
|
||||||
|
ndpi_search_skype,
|
||||||
|
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
|
||||||
|
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||||
|
ADD_TO_DETECTION_BITMASK);
|
||||||
|
|
||||||
|
*id = *id+1;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user