config.h 2.23 KB
Newer Older
1
/*
Robert Ricci's avatar
Robert Ricci committed
2
 * EMULAB-COPYRIGHT
3
 * Copyright (c) 1999-2009 The University of Utah and the Flux Group.
4 5 6 7 8 9
 * All rights reserved.
 */

#ifndef __CONFIG_H
#define __CONFIG_H

10 11 12 13
#include "common.h"
#include "score.h"
#include "anneal.h"

14 15 16 17 18 19 20 21
/*
 * Dumb as a stump config for options that the test program supports
 */
struct config_param {
  const char *name;	/* name of the option */
  int type;		/* type (see below) */
  void *ptr;		/* pointer to value portion */
  void (*func)(struct config_param *opt, char *newval);
22
				/* function to set value (unused) */
23 24 25 26 27
};

/* types */
#define CONFIG_INT	0
#define CONFIG_FLOAT	1
28

29
void parse_options(char **argv, struct config_param options[], int nopt);
30 31
int config_parse(char **args, struct config_param cparams[], int nparams,
        bool exit_on_error);
32 33
void dump_options(const char *str, struct config_param cparams[], int nparams);

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
/*
 * To use these on the command line, each entry gets a
 * <name>=<value> pair on the command line.
 */
static struct config_param options[] = {
    { "IT",	CONFIG_INT,	&init_temp,			0 },
    { "TP",	CONFIG_INT,	&temp_prob,			0 },
    { "TS",	CONFIG_INT,	&temp_stop,			0 },
    { "CY",	CONFIG_INT,	&CYCLES,			0 },
    { "UN",	CONFIG_FLOAT,	&SCORE_UNASSIGNED,     		0 },
    { "1S",	CONFIG_FLOAT,	&SCORE_INTERSWITCH_LINK,	0 },
    { "2S",	CONFIG_FLOAT,	&SCORE_INTRASWITCH_LINK,	0 },
    { "NC",	CONFIG_FLOAT,	&SCORE_NO_CONNECTION,		0 },
    { "DL",	CONFIG_FLOAT,	&SCORE_DIRECT_LINK,		0 },
    { "DP",	CONFIG_FLOAT,	&SCORE_DIRECT_LINK_PENALTY,	0 },
    { "PN",	CONFIG_FLOAT,	&SCORE_PNODE,			0 },
    { "PP",	CONFIG_FLOAT,	&SCORE_PNODE_PENALTY,		0 },
    { "PC",	CONFIG_FLOAT,	&SCORE_PCLASS,		        0 },
    { "VC",     CONFIG_FLOAT,   &SCORE_VCLASS,                  0 },
    { "SW",	CONFIG_FLOAT,	&SCORE_SWITCH,			0 },
    { "EL",	CONFIG_FLOAT,	&SCORE_EMULATED_LINK,		0 },
    { "ON",	CONFIG_FLOAT,	&opt_nodes_per_sw,		0 },
    { "TR",	CONFIG_FLOAT,	&temp_rate,			0 },
    { "LD",     CONFIG_FLOAT,   &LINK_RESOLVE_DIRECT,           0 },
    { "LI",     CONFIG_FLOAT,   &LINK_RESOLVE_INTRASWITCH,      0 },
    { "LT",     CONFIG_FLOAT,   &LINK_RESOLVE_INTERSWITCH,      0 },
    { "OD",     CONFIG_FLOAT,   &SCORE_OUTSIDE_DELAY,           0 }
};

const int noptions = sizeof(options) / sizeof(options[0]);

65
#endif