2006-02-23 14:00:51 +00:00
|
|
|
/*
|
|
|
|
* DC-API: Distributed Computing Platform for Master-Worker Applications
|
|
|
|
*
|
|
|
|
* Common definitions for both the master and client side
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Gabor Gombas <gombasg@sztaki.hu>
|
|
|
|
*
|
|
|
|
* Copyright MTA SZTAKI, 2006
|
|
|
|
*/
|
2006-02-08 15:20:11 +00:00
|
|
|
#ifndef __DC_COMMON_H_
|
|
|
|
#define __DC_COMMON_H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2006-06-14 12:05:02 +00:00
|
|
|
#ifdef _WIN32
|
2006-06-13 13:57:06 +00:00
|
|
|
#include <dc_win32.h>
|
|
|
|
#else
|
2006-04-13 09:28:28 +00:00
|
|
|
#include <sys/syslog.h>
|
2006-06-13 13:57:06 +00:00
|
|
|
#endif
|
|
|
|
|
2006-04-13 09:28:28 +00:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2006-02-23 14:00:51 +00:00
|
|
|
/********************************************************************
|
|
|
|
* Constant definitions
|
|
|
|
*/
|
|
|
|
|
2006-02-08 15:20:11 +00:00
|
|
|
/* API error codes */
|
2006-04-08 11:25:18 +00:00
|
|
|
typedef enum {
|
2006-02-23 14:00:51 +00:00
|
|
|
DC_OK, /* No error */
|
2006-03-09 15:17:30 +00:00
|
|
|
DC_ERR_CONFIG, /* Configuration error */
|
2006-03-10 14:00:50 +00:00
|
|
|
DC_ERR_DATABASE, /* Error with the internal data base */
|
2006-02-23 14:00:51 +00:00
|
|
|
DC_ERR_NOTIMPL, /* Not implemented by the API or by the
|
|
|
|
underlying grid infrastructure */
|
|
|
|
DC_ERR_UNKNOWN_WU, /* Unknown WU identifier */
|
|
|
|
DC_ERR_TIMEOUT, /* Timeout */
|
2006-03-10 14:00:50 +00:00
|
|
|
DC_ERR_BADPARAM, /* Bad function parameter */
|
2006-04-10 12:42:32 +00:00
|
|
|
DC_ERR_SYSTEM, /* A system call has failed, check errno */
|
2006-03-10 14:00:50 +00:00
|
|
|
DC_ERR_INTERNAL, /* Internal error */
|
2006-04-08 11:25:18 +00:00
|
|
|
} DC_ErrorCode;
|
2006-02-08 15:20:11 +00:00
|
|
|
|
2006-02-23 14:00:51 +00:00
|
|
|
/* Flags describing what capabilities does the underlying grid system
|
|
|
|
* support */
|
|
|
|
typedef enum {
|
|
|
|
DC_GC_EXITCODE = (1 << 0), /* DC_Result contains the
|
|
|
|
client's exit code */
|
|
|
|
DC_GC_STDOUT = (1 << 1), /* The client's standard output
|
|
|
|
is available for the
|
|
|
|
master */
|
|
|
|
DC_GC_STDERR = (1 << 2), /* Client's standard error is
|
|
|
|
available for the master */
|
|
|
|
DC_GC_LOG = (1 << 3), /* Log file generated by the
|
|
|
|
execution environment is
|
|
|
|
available for the master */
|
|
|
|
DC_GC_SUSPEND = (1 << 4), /* DC_suspendWU() works */
|
|
|
|
DC_GC_SUBRESULT = (1 << 5), /* Sub-results work */
|
|
|
|
DC_GC_MESSAGING = (1 << 6) /* Message sending works */
|
|
|
|
} DC_GridCapabilities;
|
|
|
|
|
|
|
|
/* File classification when passing a physical file name to DC-API */
|
|
|
|
typedef enum {
|
2006-03-09 15:17:30 +00:00
|
|
|
DC_FILE_REGULAR, /* Not persistent, needs copy */
|
|
|
|
DC_FILE_PERSISTENT, /* Persistent, link is enough */
|
|
|
|
DC_FILE_VOLATILE /* DC-API should remove the original */
|
2006-02-23 14:00:51 +00:00
|
|
|
} DC_FileMode;
|
|
|
|
|
2006-03-09 15:17:30 +00:00
|
|
|
/* Default name of the configuration file */
|
|
|
|
#define DC_CONFIG_FILE "dc-api.conf"
|
2006-02-23 14:00:51 +00:00
|
|
|
|
2006-05-19 12:58:38 +00:00
|
|
|
/* Logical names for special files */
|
|
|
|
#define DC_LABEL_STDOUT "dc_stdout.txt"
|
|
|
|
#define DC_LABEL_STDERR "dc_stderr.txt"
|
|
|
|
#define DC_LABEL_CLIENTLOG "dc_clientlog.txt"
|
|
|
|
|
2006-02-23 14:00:51 +00:00
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
* Function prototypes
|
|
|
|
*/
|
|
|
|
|
2006-06-19 10:42:40 +00:00
|
|
|
#ifndef __GNUC__
|
|
|
|
#define __attribute__(x)
|
|
|
|
#endif
|
|
|
|
|
2006-04-08 11:25:18 +00:00
|
|
|
/* Determines the maximum allowed message length. */
|
2006-02-23 14:00:51 +00:00
|
|
|
int DC_getMaxMessageSize(void);
|
|
|
|
|
2006-04-08 11:25:18 +00:00
|
|
|
/* Determines the maximum number of sub-results. */
|
2006-02-23 14:00:51 +00:00
|
|
|
int DC_getMaxSubresults(void);
|
|
|
|
|
2006-04-08 11:25:18 +00:00
|
|
|
/* Determines the basic capabilities of the underlying grid infrastructure. */
|
2006-05-19 13:39:25 +00:00
|
|
|
unsigned DC_getGridCapabilities(void);
|
2006-02-23 14:00:51 +00:00
|
|
|
|
2006-04-13 09:28:28 +00:00
|
|
|
/* Prints a message to the log file. */
|
|
|
|
void DC_log(int level, const char *fmt, ...)
|
|
|
|
__attribute__((format(printf, 2, 3)));
|
|
|
|
void DC_vlog(int level, const char *fmt, va_list args)
|
|
|
|
__attribute__((format(printf, 2, 0)));
|
|
|
|
|
2006-04-27 14:52:13 +00:00
|
|
|
/* Returns the value associated with the specified key in the config. file */
|
|
|
|
char *DC_getCfgStr(const char *name);
|
|
|
|
|
|
|
|
/* Returns the integer value associated with the specified key in the config.
|
|
|
|
* file */
|
|
|
|
int DC_getCfgInt(const char *name, int defaultValue);
|
2006-04-13 09:28:28 +00:00
|
|
|
|
2006-06-13 13:57:06 +00:00
|
|
|
/* Returns the boolean value associated with the specified key in the config.
|
|
|
|
* file */
|
|
|
|
int DC_getCfgBool(const char *name, int defaultValue);
|
|
|
|
|
2006-02-08 15:20:11 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __DC_COMMON_H_ */
|