Module: wine Branch: master Commit: 6d4eab9ab44100f13c4ca5802f579a28a5055a94 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6d4eab9ab44100f13c4ca5802f...
Author: Eric Durbin eadurbin@freebsd.org Date: Tue Jun 24 22:44:13 2008 -0500
iphlpapi: Implement getUDPStats on FreeBSD.
---
configure | 11 ++++++++++- configure.ac | 9 ++++++++- dlls/iphlpapi/ipstats.c | 31 +++++++++++++++++++++++++++++++ include/config.h.in | 6 ++++++ 4 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/configure b/configure index e855076..b9ef219 100755 --- a/configure +++ b/configure @@ -7085,6 +7085,7 @@ done
+ for ac_header in \ AudioUnit/AudioUnit.h \ Carbon/Carbon.h \ @@ -7136,6 +7137,7 @@ for ac_header in \ netinet/in_systm.h \ netinet/tcp.h \ netinet/tcp_fsm.h \ + netinet/udp.h \ openssl/err.h \ openssl/ssl.h \ png.h \ @@ -7551,7 +7553,8 @@ done
-for ac_header in netinet/tcp_var.h + +for ac_header in netinet/tcp_var.h netinet/udp_var.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -7575,6 +7578,12 @@ cat >>conftest.$ac_ext <<_ACEOF #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif + #ifdef HAVE_NETINET_IP_VAR_H + # include <netinet/ip_var.h> + #endif + #ifdef HAVE_NETINET_UDP_H + # include <netinet/udp.h> + #endif #ifdef HAVE_NETINET_TCP_H # include <netinet/tcp.h> #endif diff --git a/configure.ac b/configure.ac index 77287de..482c6dd 100644 --- a/configure.ac +++ b/configure.ac @@ -276,6 +276,7 @@ AC_CHECK_HEADERS(\ netinet/in_systm.h \ netinet/tcp.h \ netinet/tcp_fsm.h \ + netinet/udp.h \ openssl/err.h \ openssl/ssl.h \ png.h \ @@ -359,7 +360,7 @@ AC_CHECK_HEADERS([netinet/in_pcb.h netinet/ip_var.h net/if.h net/if_arp.h net/if # include <netinet/in.h> #endif])
-AC_CHECK_HEADERS([netinet/tcp_var.h],,, +AC_CHECK_HEADERS([netinet/tcp_var.h netinet/udp_var.h],,, [#include <sys/types.h> #ifdef HAVE_SYS_SOCKET_H # include <sys/socket.h> @@ -370,6 +371,12 @@ AC_CHECK_HEADERS([netinet/tcp_var.h],,, #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif + #ifdef HAVE_NETINET_IP_VAR_H + # include <netinet/ip_var.h> + #endif + #ifdef HAVE_NETINET_UDP_H + # include <netinet/udp.h> + #endif #ifdef HAVE_NETINET_TCP_H # include <netinet/tcp.h> #endif]) diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index fa2826d..772006b 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -68,6 +68,12 @@ #ifdef HAVE_NETINET_IP_VAR_H #include <netinet/ip_var.h> #endif +#ifdef HAVE_NETINET_UDP_H +#include <netinet/udp.h> +#endif +#ifdef HAVE_NETINET_UDP_VAR_H +#include <netinet/udp_var.h> +#endif
#ifdef HAVE_SYS_SYSCTL_H #include <sys/sysctl.h> @@ -587,6 +593,30 @@ DWORD getTCPStats(MIB_TCPSTATS *stats)
DWORD getUDPStats(MIB_UDPSTATS *stats) { +#if defined(HAVE_SYS_SYSCTL_H) && defined(UDPCTL_STATS) + int mib[] = {CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_STATS}; +#define MIB_LEN (sizeof(mib) / sizeof(mib[0])) + struct udpstat udp_stat; + size_t needed; + if (!stats) + return ERROR_INVALID_PARAMETER; + + needed = sizeof(udp_stat); + + if(sysctl(mib, MIB_LEN, &udp_stat, &needed, NULL, 0) == -1) + { + ERR ("failed to get udpstat\n"); + return ERROR_NOT_SUPPORTED; + } + + stats->dwInDatagrams = udp_stat.udps_ipackets; + stats->dwOutDatagrams = udp_stat.udps_opackets; + stats->dwNoPorts = udp_stat.udps_noport; + stats->dwInErrors = udp_stat.udps_hdrops + udp_stat.udps_badsum + udp_stat.udps_fullsock + udp_stat.udps_badlen; + stats->dwNumAddrs = getNumUdpEntries(); + + return NO_ERROR; +#else FILE *fp;
if (!stats) @@ -642,6 +672,7 @@ DWORD getUDPStats(MIB_UDPSTATS *stats) }
return NO_ERROR; +#endif }
static DWORD getNumWithOneHeader(const char *filename) diff --git a/include/config.h.in b/include/config.h.in index 9833b23..f9d27ae 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -456,6 +456,12 @@ /* Define to 1 if you have the <netinet/tcp_var.h> header file. */ #undef HAVE_NETINET_TCP_VAR_H
+/* Define to 1 if you have the <netinet/udp.h> header file. */ +#undef HAVE_NETINET_UDP_H + +/* Define to 1 if you have the <netinet/udp_var.h> header file. */ +#undef HAVE_NETINET_UDP_VAR_H + /* Define to 1 if you have the <netipx/ipx.h> header file. */ #undef HAVE_NETIPX_IPX_H