Got rid of libuuid stuff, for portability.

This commit is contained in:
jef 2012-08-10 12:43:50 -07:00
parent 7590fc8d16
commit 2ab386bf13
10 changed files with 2077 additions and 1418 deletions

1095
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

2255
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -43,36 +43,6 @@ echo "nanosleep() required for timing operations."
exit 1
])
# Check for uuid.h and a valid libuuid
AC_CHECK_FUNC(uuid_create)
if test "${ac_cv_func_uuid_create}" = yes ; then
AC_DEFINE(HAVE_UUID_CREATE, [], "specifies if the uuid_create function defined")
use_uuid_library="no"
else
AC_CHECK_FUNC(uuid_generate)
if test "${ac_cv_func_uuid_generate}" = yes ; then
AC_DEFINE(HAVE_UUID_GENERATE, [], "specifies if the uuid_generate function defined")
use_uuid_library="no"
else
AC_CHECK_LIB(uuid, uuid_generate, ,
AC_MSG_ERROR([libuuid is not available]))
AC_DEFINE(HAVE_UUID_GENERATE, [], "specifies if the uuid_generate function defined")
use_uuid_library="yes"
fi
fi
AM_CONDITIONAL(USE_UUID_LIBRARY, test "${use_uuid_library}" = yes)
AC_CHECK_HEADER(uuid.h)
if test "${ac_cv_header_uuid_h}" = yes ; then
AC_DEFINE(HAVE_UUID_H, [], "specifies if the uuid.h header exists")
else
AC_CHECK_HEADER(uuid/uuid.h)
if test "${ac_cv_header_uuid_uuid_h}" = yes ; then
AC_DEFINE(HAVE_UUID_UUID_H, [], "specifies if the uuid/uuid.h header exists")
fi
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

View File

@ -38,13 +38,7 @@ libiperf_a_SOURCES = \
iperf3_SOURCES = main.c
iperf3_CFLAGS = -g -Wall
iperf3_LDADD = libiperf.a
# Linux installs require the uuid library explicitly linked in
if USE_UUID_LIBRARY
iperf3_LDFLAGS = -luuid
else
iperf3_LDFLAGS =
endif
# Specify the sources and various flags for the profiled iperf binary. This
# binary recompiles all the source files to make sure they are all profiled.
@ -53,13 +47,7 @@ iperf3_profile_SOURCES = main.c \
iperf3_profile_CFLAGS = -pg -Wall
iperf3_profile_LDADD = libiperf.a
# Linux installs require the uuid library explicitly linked in
if USE_UUID_LIBRARY
iperf3_profile_LDFLAGS = -luuid
else
iperf3_profile_LDFLAGS =
endif
# Specify the sources and various flags for the test cases
t_timer_SOURCES = t_timer.c

View File

@ -45,8 +45,7 @@ DIST_COMMON = $(dist_man1_MANS) $(include_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ax_lib_socket_nsl.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
@ -172,6 +171,7 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@ -195,6 +195,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
@ -220,6 +221,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
@ -305,10 +307,7 @@ libiperf_a_SOURCES = \
iperf3_SOURCES = main.c
iperf3_CFLAGS = -g -Wall
iperf3_LDADD = libiperf.a
@USE_UUID_LIBRARY_FALSE@iperf3_LDFLAGS =
# Linux installs require the uuid library explicitly linked in
@USE_UUID_LIBRARY_TRUE@iperf3_LDFLAGS = -luuid
iperf3_LDFLAGS =
# Specify the sources and various flags for the profiled iperf binary. This
# binary recompiles all the source files to make sure they are all profiled.
@ -317,10 +316,7 @@ iperf3_profile_SOURCES = main.c \
iperf3_profile_CFLAGS = -pg -Wall
iperf3_profile_LDADD = libiperf.a
@USE_UUID_LIBRARY_FALSE@iperf3_profile_LDFLAGS =
# Linux installs require the uuid library explicitly linked in
@USE_UUID_LIBRARY_TRUE@iperf3_profile_LDFLAGS = -luuid
iperf3_profile_LDFLAGS =
# Specify the sources and various flags for the test cases
t_timer_SOURCES = t_timer.c
@ -350,9 +346,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/Makefile
$(AUTOMAKE) --gnu src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \

View File

@ -6,9 +6,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `uuid' library (-luuid). */
#undef HAVE_LIBUUID
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@ -33,18 +30,6 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* "specifies if the uuid_create function defined" */
#undef HAVE_UUID_CREATE
/* "specifies if the uuid_generate function defined" */
#undef HAVE_UUID_GENERATE
/* "specifies if the uuid.h header exists" */
#undef HAVE_UUID_H
/* "specifies if the uuid/uuid.h header exists" */
#undef HAVE_UUID_UUID_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR

View File

@ -130,7 +130,7 @@ iperf_connect(struct iperf_test *test)
FD_ZERO(&test->read_set);
FD_ZERO(&test->write_set);
get_uuid(test->cookie);
make_cookie(test->cookie);
/* Create and connect the control channel */
test->ctrl_sck = netdial(test->settings->domain, Ptcp, test->bind_address, test->server_hostname, test->server_port);

View File

@ -21,28 +21,9 @@
#include "config.h"
/* XXX: this code is not portable: not all versions of linux install libuuidgen
* by default
/* make_cookie
*
* if not installed, may need to do something like this:
* yum install libuuid-devel
* apt-get install uuid-dev
*/
#if defined(HAVE_UUID_H)
#warning DOING SOMETHING
#include <uuid.h>
#elif defined(HAVE_UUID_UUID_H)
#include <uuid/uuid.h>
#else
#error No uuid header file specified
#endif
/* get_uuid
*
* Generate and return a UUID string
* Generate and return a cookie string
*
* Iperf uses this function to create test "cookies" which
* server as unique test identifiers. These cookies are also
@ -50,26 +31,24 @@
*/
void
get_uuid(char *temp)
make_cookie(char *cookie)
{
char *s;
uuid_t uu;
static int randomized = 0;
char hostname[500];
struct timeval tv;
char temp[1000];
#if defined(HAVE_UUID_CREATE)
uuid_create(&uu, NULL);
uuid_to_string(&uu, &s, 0);
#elif defined(HAVE_UUID_GENERATE)
s = (char *) malloc(37);
uuid_generate(uu);
uuid_unparse(uu, s);
#else
#error No uuid function specified
#endif
memcpy(temp, s, 37);
if ( ! randomized )
srandom((int) time(0) ^ getpid());
// XXX: Freeing s only works if you HAVE_UUID_GENERATE
// Otherwise use rpc_string_free (?)
free(s);
/* Generate a string based on hostname, time, randomness, and filler. */
(void) gethostname(hostname, sizeof(hostname));
(void) gettimeofday(&tv, 0);
(void) snprintf(temp, sizeof(temp), "%s.%d.%06d.%08lx%08lx.%s", hostname, tv.tv_sec, tv.tv_usec, (unsigned long int) random(), (unsigned long int) random(), "1234567890123456789012345678901234567890");
/* Now truncate it to 36 bytes and terminate. */
memcpy(cookie, temp, 36);
cookie[36] = '\0';
}

View File

@ -10,7 +10,7 @@
#ifndef __IPERF_UTIL_H
#define __IPERF_UTIL_H
void get_uuid(char *);
void make_cookie(char *);
int is_closed(int);

View File

@ -16,11 +16,12 @@
int
main(int argc, char **argv)
{
char uuid[37];
get_uuid(uuid);
if (strlen(uuid) != 36)
char cookie[37];
make_cookie(cookie);
printf("cookie: '%s'\n", cookie);
if (strlen(cookie) != 36)
{
printf("uuid is not 37 characters long %s.\n", uuid);
printf("Not 36 characters long!\n");
exit(-1);
}
exit(0);