Commit 2569635c authored by Mark Adams's avatar Mark Adams Committed by Alexandre Julliard

iphlpapi: Add support for GetTcpTable on Mac OS X.

parent 154389ce
......@@ -6820,6 +6820,7 @@ done
for ac_header in \
AudioUnit/AudioUnit.h \
Carbon/Carbon.h \
......@@ -6913,6 +6914,7 @@ for ac_header in \
sys/shm.h \
sys/signal.h \
sys/socket.h \
sys/socketvar.h \
sys/sockio.h \
sys/soundcard.h \
sys/statvfs.h \
......@@ -7216,7 +7218,74 @@ done
for ac_header in net/if.h net/if_arp.h net/if_dl.h net/if_types.h net/route.h netipx/ipx.h
for ac_header in netinet/in_pcb.h netinet/ip_var.h net/if.h net/if_arp.h net/if_dl.h net/if_types.h net/route.h netipx/ipx.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_Header=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
ac_res=`eval echo '${'$as_ac_Header'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
#if HAVE_SYS_SOCKETVAR_H
# include <sys/socketvar.h>
#endif
for ac_header in netinet/tcp_var.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_header" >&5
......@@ -7234,6 +7303,15 @@ cat >>conftest.$ac_ext <<_ACEOF
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#if HAVE_SYS_SOCKETVAR_H
# include <sys/socketvar.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
#include <$ac_header>
_ACEOF
......
......@@ -249,6 +249,7 @@ AC_CHECK_HEADERS(\
sys/shm.h \
sys/signal.h \
sys/socket.h \
sys/socketvar.h \
sys/sockio.h \
sys/soundcard.h \
sys/statvfs.h \
......@@ -278,11 +279,29 @@ AC_CHECK_HEADERS([sys/mount.h sys/statfs.h sys/user.h sys/vfs.h],,,
# include <sys/param.h>
#endif])
AC_CHECK_HEADERS([net/if.h net/if_arp.h net/if_dl.h net/if_types.h net/route.h netipx/ipx.h],,,
AC_CHECK_HEADERS([netinet/in_pcb.h netinet/ip_var.h net/if.h net/if_arp.h net/if_dl.h net/if_types.h net/route.h netipx/ipx.h],,,
[#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif])
#if HAVE_SYS_SOCKETVAR_H
# include <sys/socketvar.h>
#endif
AC_CHECK_HEADERS([netinet/tcp_var.h],,,
[#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#if HAVE_SYS_SOCKETVAR_H
# include <sys/socketvar.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif])
AC_CHECK_HEADERS([linux/ipx.h],,,
[#include <sys/types.h>
......
......@@ -336,7 +336,9 @@ DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable,
TRACE("ppTcpTable %p, bOrder %d, heap %p, flags 0x%08x\n",
ppTcpTable, bOrder, heap, flags);
ret = getTcpTable(ppTcpTable, heap, flags);
*ppTcpTable = NULL;
ret = getTcpTable(ppTcpTable, 0, heap, flags);
if (!ret && bOrder)
qsort((*ppTcpTable)->table, (*ppTcpTable)->dwNumEntries,
sizeof(MIB_TCPROW), TcpTableSorter);
......@@ -1545,25 +1547,16 @@ DWORD WINAPI GetTcpTable(PMIB_TCPTABLE pTcpTable, PDWORD pdwSize, BOOL bOrder)
ret = ERROR_INSUFFICIENT_BUFFER;
}
else {
PMIB_TCPTABLE table;
ret = getTcpTable(&table, GetProcessHeap(), 0);
ret = getTcpTable(&pTcpTable, numEntries, 0, 0);
if (!ret) {
size = sizeof(MIB_TCPTABLE) + (table->dwNumEntries - 1) *
size = sizeof(MIB_TCPTABLE) + (pTcpTable->dwNumEntries - 1) *
sizeof(MIB_TCPROW);
if (*pdwSize < size) {
*pdwSize = size;
ret = ERROR_INSUFFICIENT_BUFFER;
}
else {
*pdwSize = size;
memcpy(pTcpTable, table, size);
*pdwSize = size;
if (bOrder)
qsort(pTcpTable->table, pTcpTable->dwNumEntries,
sizeof(MIB_TCPROW), TcpTableSorter);
qsort(pTcpTable->table, pTcpTable->dwNumEntries,
sizeof(MIB_TCPROW), TcpTableSorter);
ret = NO_ERROR;
}
HeapFree(GetProcessHeap(), 0, table);
}
else
ret = ERROR_OUTOFMEMORY;
......
......@@ -83,6 +83,7 @@ DWORD getNumTcpEntries(void);
/* Allocates the TCP state table from heap and returns it to you in *ppTcpTable.
* Returns NO_ERROR on success, something else on failure.
*/
DWORD getTcpTable(PMIB_TCPTABLE *ppTcpTable, HANDLE heap, DWORD flags);
DWORD getTcpTable(PMIB_TCPTABLE *ppTcpTable, DWORD maxEntries, HANDLE heap,
DWORD flags);
#endif /* ndef WINE_IPSTATS_H_ */
......@@ -426,15 +426,24 @@
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <netinet/in_pcb.h> header file. */
#undef HAVE_NETINET_IN_PCB_H
/* Define to 1 if you have the <netinet/in_systm.h> header file. */
#undef HAVE_NETINET_IN_SYSTM_H
/* Define to 1 if you have the <netinet/ip_var.h> header file. */
#undef HAVE_NETINET_IP_VAR_H
/* Define to 1 if you have the <netinet/tcp_fsm.h> header file. */
#undef HAVE_NETINET_TCP_FSM_H
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
/* 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 <netipx/ipx.h> header file. */
#undef HAVE_NETIPX_IPX_H
......@@ -777,6 +786,9 @@
/* Define to 1 if you have the <sys/signal.h> header file. */
#undef HAVE_SYS_SIGNAL_H
/* Define to 1 if you have the <sys/socketvar.h> header file. */
#undef HAVE_SYS_SOCKETVAR_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment