tbdefs.c 1.72 KB
Newer Older
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1 2 3 4 5 6
/*
 * EMULAB-COPYRIGHT
 * Copyright (c) 2000-2002 University of Utah and the Flux Group.
 * All rights reserved.
 */

7 8 9
/*
 *
 */
10
#include <string.h>
11 12 13 14
#include "tbdefs.h"

char *tbdb_objecttypes[] = {
	TBDB_OBJECTTYPE_TESTBED,
Mac Newbold's avatar
Mac Newbold committed
15 16
	TBDB_OBJECTTYPE_STATE,
	TBDB_OBJECTTYPE_OPMODE,
17 18 19
	TBDB_OBJECTTYPE_LINK,
	TBDB_OBJECTTYPE_TRAFGEN,
	TBDB_OBJECTTYPE_TIME,
20
	TBDB_OBJECTTYPE_PROGRAM,
21 22 23 24 25 26
	0,
};

char *tbdb_eventtypes[] = {
	TBDB_EVENTTYPE_START,
	TBDB_EVENTTYPE_STOP,
27
	TBDB_EVENTTYPE_KILL,
28 29 30 31 32 33
	TBDB_EVENTTYPE_ISUP,
	TBDB_EVENTTYPE_REBOOT,
	TBDB_EVENTTYPE_UP,
	TBDB_EVENTTYPE_DOWN,
	TBDB_EVENTTYPE_MODIFY,
	TBDB_EVENTTYPE_SET,
34
	TBDB_EVENTTYPE_RESET,
Mac Newbold's avatar
Mac Newbold committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
        TBDB_NODESTATE_ISUP, 
        TBDB_NODESTATE_REBOOTED, 
        TBDB_NODESTATE_REBOOTING, 
        TBDB_NODESTATE_SHUTDOWN, 
        TBDB_NODESTATE_BOOTING, 
        TBDB_NODESTATE_TBSETUP, 
        TBDB_NODESTATE_RELOADSETUP, 
        TBDB_NODESTATE_RELOADING, 
        TBDB_NODESTATE_RELOADDONE, 
        TBDB_NODESTATE_UNKNOWN, 
        TBDB_NODEOPMODE_NORMAL, 
        TBDB_NODEOPMODE_DELAYING, 
        TBDB_NODEOPMODE_UNKNOWNOS, 
        TBDB_NODEOPMODE_RELOADING, 
        TBDB_NODEOPMODE_NORMALv1, 
        TBDB_NODEOPMODE_MINIMAL, 
        TBDB_NODEOPMODE_RELOAD, 
        TBDB_NODEOPMODE_DELAY, 
        TBDB_NODEOPMODE_BOOTWHAT, 
        TBDB_NODEOPMODE_UNKNOWN, 
        TBDB_TBCONTROL_RESET, 
        TBDB_TBCONTROL_RELOADDONE, 
        TBDB_TBCONTROL_TIMEOUT, 
    	0,
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
};

/*
 * Check that events are legal.
 */
int
tbdb_validobjecttype(char *foo)
{
	char	**bp = tbdb_objecttypes;

	while (*bp) {
		if (!strcmp(*bp, foo))
			return 1;
		bp++;
	}
	return 0;
}

int
tbdb_valideventtype(char *foo)
{
	char	**bp = tbdb_eventtypes;

	while (*bp) {
		if (!strcmp(*bp, foo))
			return 1;
		bp++;
	}
	return 0;
}