Commit 92a687b9 authored by Sachin Goyal's avatar Sachin Goyal

Added 2 new programs:

1- elvindtest: a simple program to verify if a particular
    elvindserver is up or not

2- evproxyplab.cc: evproxy for planetlab nodes. It subscribes
   to the following events:
   host = node's ip addr
   objtype = EVPROXY
   objname = __$nodeid_proxy
   eventtype = UPDATE | CLEAR | RELOAD

   On UPDATE, it adds a new subscription to listen to an
   experiment conveyed by EXPT field of UPDATE message.

   On CLEAR, it removes the subscription for a experiment
   experiment conveyed by EXPT field of CLEAR message.

   On RELOAD, it removes all active experiment subscriptions.

   Also, while it comes up, it sends a RELAOD event to emulab's
   event-server to reload it with all existing experiments:

   host = node's ip addr
   objtype = EVPROXY
   objname = __$nodeid_proxy
   eventtype = RELOAD
parent e60d1d5d
......@@ -10,7 +10,7 @@ OBJDIR = ../..
SUBDIR = event/proxy
SYSTEM := $(shell uname -s)
PROGRAMS = evproxy proxytest
PROGRAMS = evproxy proxytest evproxyplab elvindtest
ifneq ($(SYSTEM),Linux)
PROGRAMS += evproxyclient evproxyserver
endif
......@@ -46,6 +46,7 @@ PFLAGS += `$(ELVIN_CONFIG) --cflags vin4mt`
LDFLAGS += -L$(OBJDIR)/lib -L$(OBJDIR)/lib/libtb -L../lib
LIBS += -levent -ltb -lcrypto
LIBS += `$(ELVIN_CONFIG) --libs vin4c`
CPPC = g++
ifeq ($(host_cpu),arm)
else
......@@ -81,6 +82,16 @@ proxyserver.o: proxyserver.c
proxytest-debug: proxytest.o $(LIBTBDIR)/log.o
$(CC) $(LDFLAGS) -o $@ proxytest.o $(LIBS)
evproxyplab.o: evproxyplab.cc
$(CPPC) $(CFLAGS) -c $<
evproxyplab: evproxyplab.o ../lib/libevent.a ../lib/event.h
$(CPPC) $(LDFLAGS) -o $@ evproxyplab.o $(LIBS)
elvindtest: elvindtest.o
$(CC) $(LDFLAGS) -o $@ elvindtest.o $(LIBS)
$(PROGRAMS): ../lib/libevent.a ../lib/event.h
client: evproxy
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2003, 2004 University of Utah and the Flux Group.
* All rights reserved.
*/
#include <stdio.h>
#include <ctype.h>
#include <netdb.h>
#include <unistd.h>
#include <time.h>
#include <math.h>
#include <paths.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "config.h"
#include "event.h"
#include "tbdefs.h"
#include "log.h"
static event_handle_t bosshandle;
void
usage(char *progname)
{
fprintf(stderr, "Usage: %s -s server -p port\n", progname);
exit(-1);
}
int
main(int argc, char **argv)
{
char *progname;
char *server = NULL;
char *port = NULL;
char buf[BUFSIZ];
int c;
progname = argv[0];
while ((c = getopt(argc, argv, "s:p:")) != -1) {
switch (c) {
case 's':
server = optarg;
break;
case 'p':
port = optarg;
break;
default:
usage(progname);
}
}
argc -= optind;
argv += optind;
if (argc)
usage(progname);
if ((! server) || (!port))
fatal("Must provide server and port");
/*
* Convert server/port to elvin thing.
*/
snprintf(buf, sizeof(buf), "elvin://%s:%s",
server, port);
server = buf;
/* Register with the event system on boss */
bosshandle = event_register_withkeydata_withretry(server, 0, NULL, 0, 0);
if (bosshandle == NULL) {
fatal("could not register with remote event system");
}
/* Unregister with the remote event system: */
if (event_unregister(bosshandle) == 0) {
fatal("could not unregister with remote event system");
}
return EXIT_SUCCESS;
}
This diff is collapsed.
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