Commit aef98f9a authored by Timothy Stack's avatar Timothy Stack

Add tbsetdest utility for generating random "setdest" events for the
robots, it's just based on the original NS version.

	* configure, configure.in: Add tbsetdest stuff to the list of
	template files.  Fix from my last checkin, change error for
	missing rsync to a warning.

	* robots/GNUmakefile.in: Add tbsetdest subdir.

	* robots/tbsetdest/GNUmakefile.in, robots/tbsetdest/tbsetdest.h,
	robots/tbsetdest.cc: Original version of the NS "setdest"
	utility.
parent 97c60ef0
......@@ -1842,7 +1842,7 @@ esac
# Extract the first word of "rsync", so it can be a program name with args.
set dummy rsync; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1811: checking for $ac_word" >&5
echo "configure:1846: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RSYNC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -1876,7 +1876,7 @@ else
fi
if test x"$RSYNC" = x"" || test ! -x "$RSYNC"; then
{ echo "configure: error: Rsync is required to use this software, see www.rsync.org." 1>&2; exit 1; }
echo "configure: warning: Rsync is required for logholes to work, see www.rsync.org." 1>&2
fi
outfiles="$outfiles Makeconf GNUmakefile \
......@@ -2006,7 +2006,8 @@ outfiles="$outfiles Makeconf GNUmakefile \
install/GNUmakefile install/ops-install install/boss-install \
install/newnode_sshkeys/GNUmakefile \
mote/GNUmakefile mote/tbuisp mote/tbsgmotepower \
robots/GNUmakefile robots/mtp/GNUmakefile robots/emc/GNUmakefile \
robots/GNUmakefile robots/tbsetdest/GNUmakefile \
robots/mtp/GNUmakefile robots/emc/GNUmakefile \
robots/emc/test_emcd.sh robots/emc/loclistener \
robots/vmcd/GNUmakefile robots/vmcd/test_vmc-client.sh \
robots/rmcd/GNUmakefile robots/primotion/GNUmakefile \
......
......@@ -583,7 +583,7 @@ esac]
AC_PATH_PROG(RSYNC, rsync, "", [${PATH}])
if test x"$RSYNC" = x"" || test ! -x "$RSYNC"; then
AC_MSG_ERROR([Rsync is required to use this software, see www.rsync.org.])
AC_MSG_WARN([Rsync is required for logholes to work, see www.rsync.org.])
fi
outfiles="$outfiles Makeconf GNUmakefile \
......@@ -713,7 +713,8 @@ outfiles="$outfiles Makeconf GNUmakefile \
install/GNUmakefile install/ops-install install/boss-install \
install/newnode_sshkeys/GNUmakefile \
mote/GNUmakefile mote/tbuisp mote/tbsgmotepower \
robots/GNUmakefile robots/mtp/GNUmakefile robots/emc/GNUmakefile \
robots/GNUmakefile robots/tbsetdest/GNUmakefile \
robots/mtp/GNUmakefile robots/emc/GNUmakefile \
robots/emc/test_emcd.sh robots/emc/loclistener \
robots/vmcd/GNUmakefile robots/vmcd/test_vmc-client.sh \
robots/rmcd/GNUmakefile robots/primotion/GNUmakefile \
......
......@@ -23,7 +23,7 @@ else
EMCDIR=
endif
SUBDIRS = $(MEZZDIR) mtp $(EMCDIR) vmcd primotion rmcd
SUBDIRS = tbsetdest $(MEZZDIR) mtp $(EMCDIR) vmcd primotion rmcd
all: all-subdirs
client: client-subdirs
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005 University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = robots/tbsetdest
include $(OBJDIR)/Makeconf
PROGS = tbsetdest
all: $(PROGS)
client:
include $(TESTBED_SRCDIR)/GNUmakerules
OBJS = tbsetdest.o
ULXRINC = -I/usr/local/include/ulxmlrpcpp
CXXFLAGS += -O -g -Wall -I${OBJDIR} -I/usr/local/include $(ULXRINC)
CXXFLAGS += -pthread
LDFLAGS = -L/usr/local/lib
LIBS = -lulsshxmlrpcpp -lulxmlrpcpp -lexpat
tbsetdest: $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
install: all
-mkdir -p $(INSTALL_DIR)/opsdir/bin
$(INSTALL_PROGRAM) tbsetdest $(INSTALL_DIR)/opsdir/bin/tbsetdest
clean:
rm -f *.o
This diff is collapsed.
#ifndef __setdest_h__
#define __setdest_h__
/*#include <sys/queue.h>*/
#include "../../../config.h"
#include "../../../lib/bsd-list.h"
#ifndef LIST_FIRST
#define LIST_FIRST(head) ((head)->lh_first)
#endif
#ifndef LIST_NEXT
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
#endif
void ReadInMovementPattern(void);
class vector {
public:
vector(double x = 0.0, double y = 0.0, double z = 0.0) {
X = x; Y = y; Z = z;
}
double length() {
return sqrt(X*X + Y*Y + Z*Z);
}
inline void vector::operator=(const vector a) {
X = a.X;
Y = a.Y;
Z = a.Z;
}
inline void vector::operator+=(const vector a) {
X += a.X;
Y += a.Y;
Z += a.Z;
}
inline int vector::operator==(const vector a) {
return (X == a.X && Y == a.Y && Z == a.Z);
}
inline int vector::operator!=(const vector a) {
return (X != a.X || Y != a.Y || Z != a.Z);
}
inline vector operator-(const vector a) {
return vector(X-a.X, Y-a.Y, Z-a.Z);
}
friend inline vector operator*(const double a, const vector b) {
return vector(a*b.X, a*b.Y, a*b.Z);
}
friend inline vector operator/(const vector a, const double b) {
return vector(a.X/b, a.Y/b, a.Z/b);
}
double X;
double Y;
double Z;
};
class Neighbor {
public:
u_int32_t index; // index into NodeList
u_int32_t reachable; // != 0 --> reachable.
double time_transition; // next change
};
struct setdest {
double time;
double X, Y, Z;
double speed;
LIST_ENTRY(setdest) traj;
};
class Node {
friend void ReadInMovementPattern(void);
public:
Node(void);
void Update(void);
void UpdateNeighbors(void);
void Dump(void);
double time_arrival; // time of arrival at dest
double time_transition; // min of all neighbor times
// # of optimal route changes for this node
int route_changes;
int link_changes;
private:
void RandomPosition(void);
void RandomDestination(void);
void RandomSpeed(void);
u_int32_t index; // unique node identifier
u_int32_t first_trip; // 1 if first trip, 0 otherwise. (by J. Yoon)
vector position; // current position
vector destination; // destination
vector direction; // computed from pos and dest
double speed;
double time_update; // when pos last updated
static u_int32_t NodeIndex;
LIST_HEAD(traj, setdest) traj;
public:
// An array of NODES neighbors.
Neighbor *neighbor;
};
#endif /* __setdest_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