From 2fca31ccc14c0655a21bdc9058096107cd38a42c Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Mon, 9 Aug 2021 16:14:37 +0200 Subject: Fixed Mingw64 build. * adapted to SonarCloud-CI workflow * removed broken and incomplete Windows example (tested on VS2017/VS2019) * removed unnecessary include (e.g. pthread.h for the library which does not make use of it) Signed-off-by: Toni Uhlig --- example/reader_util.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'example/reader_util.c') diff --git a/example/reader_util.c b/example/reader_util.c index bc7444f31..f4fe03504 100644 --- a/example/reader_util.c +++ b/example/reader_util.c @@ -26,16 +26,17 @@ #endif #include +#include +#include #ifdef WIN32 #include /* winsock.h is included automatically */ #include #include +#include #else #include #include -#include -#include #endif #include "reader_util.h" @@ -1581,8 +1582,12 @@ int ndpi_is_datalink_supported(int datalink_type) { case DLT_PPP_SERIAL: case DLT_C_HDLC: case DLT_PPP: +#ifdef DLT_IPV4 case DLT_IPV4: +#endif +#ifdef DLT_IPV6 case DLT_IPV6: +#endif case DLT_EN10MB: case DLT_LINUX_SLL: case DLT_IEEE802_11_RADIO: @@ -1708,15 +1713,19 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, } break; +#ifdef DLT_IPV4 case DLT_IPV4: type = ETH_P_IP; ip_offset = 0; break; +#endif +#ifdef DLT_IPV6 case DLT_IPV6: type = ETH_P_IPV6; ip_offset = 0; break; +#endif /* IEEE 802.3 Ethernet - 1 */ case DLT_EN10MB: @@ -1878,7 +1887,11 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, ip_len = ((u_int16_t)iph->ihl * 4); iph6 = NULL; - if(iph->protocol == IPPROTO_IPV6 || iph->protocol == IPPROTO_IPIP) { + if(iph->protocol == IPPROTO_IPV6 +#ifdef IPPROTO_IPIP + || iph->protocol == IPPROTO_IPIP +#endif + ) { ip_offset += ip_len; if(ip_len > 0) goto iph_check; @@ -1914,7 +1927,11 @@ struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow, return(nproto); } - if(proto == IPPROTO_IPV6 || proto == IPPROTO_IPIP) { + if(proto == IPPROTO_IPV6 +#ifdef IPPROTO_IPIP + || proto == IPPROTO_IPIP +#endif + ) { if(l4ptr > packet) { /* Better safe than sorry */ ip_offset = (l4ptr - packet); goto iph_check; -- cgit v1.2.3