use better file names

git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@1009 a7169a2c-3604-0410-bc95-c702d8d87f7a
This commit is contained in:
drotos 2007-01-25 09:05:21 +00:00 committed by Adam Visegradi
parent 9bc30f0b39
commit a839efce51
6 changed files with 113 additions and 110 deletions

View File

@ -16,11 +16,24 @@ AM_CPPFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)
noinst_HEADERS = common_defs.h dc_local.h noinst_HEADERS = common_defs.h dc_local.h
libdc_local_la_SOURCES = \ libdc_local_la_SOURCES = \
dc.c \ local_master.c \
rm.c \ local_events.c \
events.c \ local_result.c
result.c
libdc_local_la_LIBADD = ../common/libdc-common-master.la $(GLIB_LIBS) libdc_local_la_LIBADD = ../common/libdc-common-master.la $(GLIB_LIBS)
libdc_client_local_la_SOURCES = client.c libdc_client_local_la_SOURCES = local_client.c
libdc_client_local_la_LIBADD = ../common/libdc-common-client.la libdc_client_local_la_LIBADD = ../common/libdc-common-client.la
#appdir = $(libdir)/dcapi/local
#app_PROGRAMS = lss lm
#lss_SOURCES = ../condor/tss.c ../condor/tc.c
#lss_LDADD = ../common/libdc-common-client.la libdc-client-local.la
#lm_SOURCES = ../condor/tm.c ../condor/tc.c
#lm_LDADD = ../common/libdc-common-master.la libdc-local.la -L. -ldl -luuid -lstdc++
#dd: all install_local
#install_local:
# ssh root@emma 'make -C /home/staff/drdani/prj/szdg/dcapi/trunk/local install'

View File

@ -1,105 +0,0 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <glib.h>
#include "dc_local.h"
/********************************************************************
* Global variables
*/
DC_ResultCallback _dc_resultcb;
DC_SubresultCallback _dc_subresultcb;
DC_MessageCallback _dc_messagecb;
char project_uuid_str[37];
uuid_t project_uuid;
int sleep_interval;
/********************************************************************
* API functions
*/
int DC_initMaster(const char *config_file)
{
char *cfgval;
int ret;
if (!config_file)
config_file = DC_CONFIG_FILE;
ret = _DC_parseCfg(config_file);
if (ret)
{
DC_log(LOG_ERR, "The DC-API cannot be initialized without a "
"config file");
return ret;
}
/* Check the working directory */
cfgval = DC_getCfgStr(CFG_WORKDIR);
if (!cfgval)
{
DC_log(LOG_ERR, "%s is not specified in the config file",
CFG_WORKDIR);
return DC_ERR_CONFIG;
}
free(cfgval);
/* Check sleep interval */
sleep_interval = DC_getCfgInt(CFG_SLEEPINTERVAL, DEFAULT_SLEEP_INTERVAL);
if (sleep_interval < 1)
sleep_interval = 1;
/* Check the project UUID */
cfgval = DC_getCfgStr(CFG_INSTANCEUUID);
if (!cfgval)
{
DC_log(LOG_ERR, "%s is not set in the config file",
CFG_INSTANCEUUID);
return DC_ERR_CONFIG;
}
ret = uuid_parse((char *)cfgval, project_uuid);
if (ret)
{
DC_log(LOG_ERR, "Invalid project UUID");
free(cfgval);
return DC_ERR_CONFIG;
}
free(cfgval);
/* Enforce a canonical string representation of the UUID */
uuid_unparse_lower(project_uuid, project_uuid_str);
return DC_OK;
}
int DC_getMaxMessageSize(void)
{
return MAX_MESSAGE_SIZE;
}
int DC_getMaxSubresults(void)
{
return MAX_SUBRESULTS;
}
unsigned DC_getGridCapabilities(void)
{
return DC_GC_STDOUT | DC_GC_STDERR;
}
void DC_setMasterCb(DC_ResultCallback resultcb, DC_SubresultCallback subresultcb,
DC_MessageCallback msgcb)
{
_dc_resultcb = resultcb;
_dc_subresultcb = subresultcb;
_dc_messagecb = msgcb;
}

View File

@ -14,8 +14,103 @@
#include "dc_local.h" #include "dc_local.h"
/********************************************************************
* Global variables
*/
DC_ResultCallback _dc_resultcb;
DC_SubresultCallback _dc_subresultcb;
DC_MessageCallback _dc_messagecb;
char project_uuid_str[37];
uuid_t project_uuid;
int sleep_interval;
static GHashTable *wu_table; static GHashTable *wu_table;
/********************************************************************
* API functions
*/
int DC_initMaster(const char *config_file)
{
char *cfgval;
int ret;
if (!config_file)
config_file = DC_CONFIG_FILE;
ret = _DC_parseCfg(config_file);
if (ret)
{
DC_log(LOG_ERR, "The DC-API cannot be initialized without a "
"config file");
return ret;
}
/* Check the working directory */
cfgval = DC_getCfgStr(CFG_WORKDIR);
if (!cfgval)
{
DC_log(LOG_ERR, "%s is not specified in the config file",
CFG_WORKDIR);
return DC_ERR_CONFIG;
}
free(cfgval);
/* Check sleep interval */
sleep_interval = DC_getCfgInt(CFG_SLEEPINTERVAL, DEFAULT_SLEEP_INTERVAL);
if (sleep_interval < 1)
sleep_interval = 1;
/* Check the project UUID */
cfgval = DC_getCfgStr(CFG_INSTANCEUUID);
if (!cfgval)
{
DC_log(LOG_ERR, "%s is not set in the config file",
CFG_INSTANCEUUID);
return DC_ERR_CONFIG;
}
ret = uuid_parse((char *)cfgval, project_uuid);
if (ret)
{
DC_log(LOG_ERR, "Invalid project UUID");
free(cfgval);
return DC_ERR_CONFIG;
}
free(cfgval);
/* Enforce a canonical string representation of the UUID */
uuid_unparse_lower(project_uuid, project_uuid_str);
return DC_OK;
}
int DC_getMaxMessageSize(void)
{
return MAX_MESSAGE_SIZE;
}
int DC_getMaxSubresults(void)
{
return MAX_SUBRESULTS;
}
unsigned DC_getGridCapabilities(void)
{
return DC_GC_STDOUT | DC_GC_STDERR;
}
void DC_setMasterCb(DC_ResultCallback resultcb, DC_SubresultCallback subresultcb,
DC_MessageCallback msgcb)
{
_dc_resultcb = resultcb;
_dc_subresultcb = subresultcb;
_dc_messagecb = msgcb;
}
/******************************************************************** /********************************************************************
* Functions * Functions
*/ */