simulator-agent.h 1.98 KB
Newer Older
1 2
/*
 * EMULAB-COPYRIGHT
3
 * Copyright (c) 2004, 2005 University of Utah and the Flux Group.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
 * All rights reserved.
 */

/**
 * @file simulator-agent.h
 *
 * Header file for the SIMULATOR agent.
 */

#ifndef _simulator_agent_h
#define _simulator_agent_h

#include "event-sched.h"
#include "local-agent.h"
#include "error-record.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Enumeration of the different categories of text in a report.
 */
typedef enum {
	SA_RDK_MESSAGE,	/*< Main message body, this is at the top of the report
			 and is intended for a plain english description of
			 the experiment. */
	SA_RDK_LOG,	/*< Log data for the tail of the report, used for
			  machine generated data mostly. */
33
	SA_RDK_CONFIG,	/*< Config data for the tail of the report. */
34 35 36 37

	SA_RDK_MAX	/*< The maximum number of message types. */
} sa_report_data_kind_t;

38 39 40 41 42 43 44 45
enum {
	SAB_STABLE,
};

enum {
	SAF_STABLE = (1L << SAB_STABLE),
};

46 47 48 49 50
/**
 * A local agent structure for the NS Simulator object.
 */
struct _simulator_agent {
	struct _local_agent sa_local_agent;	/*< Local agent base. */
51
	unsigned long sa_flags;
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
	struct lnList sa_error_records;		/*< The error records that have
						  been collected over the
						  course of the experiment. */
	char *sa_report_data[SA_RDK_MAX];	/*< Different kinds of text to
						 include in the report. */
};

/**
 * Pointer type for the _simulator_agent structure.
 */
typedef struct _simulator_agent *simulator_agent_t;

/**
 * Create a simulator agent and initialize it with the default values.
 *
 * @return An initialized simulator agent.
 */
simulator_agent_t create_simulator_agent(void);

/**
 * Check a simulator agent object against the following invariants:
 *
 * @li sa_local_agent is sane
 * @li sa_error_records is sane
 *
 * @param sa An initialized simulator agent object.
 * @return True.
 */
int simulator_agent_invariant(simulator_agent_t sa);

82 83 84 85
int add_report_data(simulator_agent_t sa,
		    sa_report_data_kind_t rdk,
		    char *data);

86 87 88 89 90
#ifdef __cplusplus
}
#endif

#endif