#
# Revision history:
# $Log$
+# Revision 1.1.1.1 2004/05/26 18:45:05 eronchie
+# Import of wms jobid
+#
#
#
BOOST_LIBS="-L$REPOSITORY/boost/1.29.1/rhel30_gcc32/lib/release -lboost_fs -lboost_thread -lpthread -lboost_regex -lc"
AC_SUBST([BOOST_LIBS])
-CLASSAD_CFLAGS=-I$REPOSITORY/classads/0.9.4/rhel30_gcc32/include
+CLASSAD_CFLAGS=-I$REPOSITORY/classads/0.9.5/rhel30_gcc32/include
AC_SUBST([CLASSAD_CFLAGS])
CLASSAD_CPPFLAGS=$CLASSAD_CFLAGS
AC_SUBST([CLASSAD_CPPFLAGS])
-CLASSAD_LIBS="-L$REPOSITORY/classads/0.9.4/rhel30_gcc32/lib -lclassad"
+CLASSAD_LIBS="-L$REPOSITORY/classads/0.9.5/rhel30_gcc32/lib -lclassad"
AC_SUBST([CLASSAD_LIBS])
GLOBUS_SSL_UTILS_CFLAGS="-I$STAGE/include"
GLITE_WORKLOAD_CFLAGS="-I$STAGE/include"
AC_SUBST([GLITE_WORKLOAD_CFLAGS])
-GLITE_WORKLOAD_COMMON_LIBS="-L$STAGE/lib -lglite_wl_exceptions"
+GLITE_WORKLOAD_COMMON_LIBS="-L$STAGE/lib -lglite_wms_exceptions"
AC_SUBST([GLITE_WORKLOAD_COMMON_LIBS])
GLOBUS_COMMON_NOTHR_LIBS="-L$REPOSITORY/globus/2.4.3/rhel30_gcc32/lib -lglobus_common_gcc32"
* copyright : (C) 2002 by DATAMAT
***************************************************************************/
-#include "../jobid/JobId.h"
+#include "JobId.h"
+
#include <iostream>
-#include "../jobid/JobIdExceptions.h"
+#include "JobIdExceptions.h"
COMMON_NAMESPACE_BEGIN{
namespace jobid{
#include <iosfwd>
#include "../jobid_namespace.h"
-#include "../jobid/jobid-c.h"
+#include "jobid.h"
typedef struct _edg_wlc_jobid_s* edg_wlc_jobid_t;
-
#define COMMON_JOBID_NAMESPACE_BEGIN namespace edg { namespace workload { namespace common {namespace jobid{
COMMON_JOBID_NAMESPACE_BEGIN
/**
* author : Alessandro Maraschini <alessandro.maraschini@datamat.it>
* copyright : (C) 2002 by DATAMAT
***************************************************************************/
-#include "../jobid/JobIdExceptions.h"
+
+#include "JobIdExceptions.h"
COMMON_NAMESPACE_BEGIN{
namespace jobid{
* JobIdExceptions.h
* Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
*/
-#include "glite/workload/common/utilities/Exceptions.h"
+#include "glite/wms/common/utilities/Exceptions.h"
#define COMMON_JOBID_NAMESPACE_BEGIN namespace edg { namespace workload { namespace common {namespace jobid{
COMMON_JOBID_NAMESPACE_BEGIN
## *
## *********************************************************************
-lib_LTLIBRARIES = libglite_wl_jobid.la
+lib_LTLIBRARIES = libglite_wms_jobid.la
-libglite_wl_jobid_la_SOURCES = \
+libglite_wms_jobid_la_SOURCES = \
JobId.cpp \
JobIdExceptions.cpp \
manipulation.cpp \
jobid.c \
strmd5.c
-jobidincludedir = $(includedir)/glite/workload/jobid
+jobidincludedir = $(includedir)/glite/wms/jobid
jobidinclude_HEADERS = \
JobId.h \
JobIdExceptions.h \
- jobid-c.h \
+ jobid.h \
manipulation.h \
strmd5.h
AM_CPPFLAGS = -I$(top_srcdir)/.. \
- $(GLOBUS_CFLAGS) $(BOOST_CFLAGS) \
$(GLITE_WORKLOAD_CFLAGS) \
+ $(GLOBUS_CFLAGS) \
+ $(BOOST_CFLAGS) \
-D_GNU_SOURCE
MAINTAINERCLEANFILES = Makefile.in
#include <sys/time.h>
#include <unistd.h>
-#include "../jobid/jobid-c.h"
-#include "../jobid/strmd5.h"
+#include "jobid.h"
+#include "strmd5.h"
struct _edg_wlc_JobId {
char *id; /* unique job identification */
if (!bkserver)
return EINVAL;
- gethostname(hostname, 100);
- he = gethostbyname(hostname);
- assert(he->h_length > 0);
- gettimeofday(&tv, NULL);
- srandom(tv.tv_usec);
+ if (unique == NULL) {
+ gethostname(hostname, 100);
+ he = gethostbyname(hostname);
+ assert(he->h_length > 0);
+ gettimeofday(&tv, NULL);
+ srandom(tv.tv_usec);
- skip = strlen(hostname);
- skip += sprintf(hostname + skip, "-IP:0x%x-pid:%d-rnd:%d-time:%d:%d",
+ skip = strlen(hostname);
+ skip += sprintf(hostname + skip, "-IP:0x%x-pid:%d-rnd:%d-time:%d:%d",
*((int*)he->h_addr_list[0]), getpid(), (int)random(),
(int)tv.tv_sec, (int)tv.tv_usec);
+ }
*jobId = NULL;
out = (edg_wlc_JobId) malloc (sizeof(*out));
/* extract the unique part */
out->id = strdup(pom1+1);
+ for (pom1 = out->BShost; *pom1; pom1++)
+ if (isspace(*pom1)) break;
+
+ for (pom2 = out->id; *pom2; pom2++)
+ if (isspace(*pom2)) break;
+
+ if (*pom1 || *pom2) {
+ free(pom);
+ edg_wlc_JobIdFree(out);
+ return EINVAL;
+ }
+
free(pom);
*jobId = out;
return 0;
--- /dev/null
+#ifndef _EDG_JOBID_H
+#define _EDG_JOBID_H
+
+/*!
+ * \file jobid/jobid.h
+ * \brief L&B consumer API
+ */
+
+#ident "$Header$"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _edg_wlc_JobId *edg_wlc_JobId;
+
+#define EDG_WLC_JOBID_DEFAULT_PORT 9000 /**< Default port where bookkeeping server listens */
+#define EDG_WLC_JOBID_PROTO_PREFIX "https://" /**< JobId protocol prefix */
+
+
+/* All the pointer functions return malloc'ed objects (or NULL on error) */
+
+/**
+ * Create a Job ID.
+ * See the lb_draft document for details on its construction and components
+ * \param bkserver book keeping server hostname
+ * \param port port for the bk service
+ * \param jobid new created job id
+ * \ret al 0 success
+ * \retval EINVAL invalid bkserver
+ * \retval ENOMEM if memory allocation fails
+ */
+int edg_wlc_JobIdCreate(const char * bkserver, int port, edg_wlc_JobId * jobid);
+
+/**
+ * Recreate a Job ID
+ * \param bkserver bookkeeping server hostname
+ * \param port port for the bk service
+ * \param unique string which represent created jobid (if NULL then new
+ * one is created)
+ * \param jobid new created job id
+ * \retval 0 success
+ * \retval EINVAL invalid bkserver
+ * \retval ENOMEM if memory allocation fails
+ */
+int edg_wlc_JobIdRecreate(const char *bkserver, int port, const char * unique, edg_wlc_JobId * jobid);
+
+/**
+ * Create copy of Job ID
+ * \param in jobid for duplication
+ * \param jobid duplicated jobid
+ * \retval 0 for success
+ * \retval EINVAL invalid jobid
+ * \retval ENOMEM if memory allocation fails
+ */
+int edg_wlc_JobIdDup(const edg_wlc_JobId in, edg_wlc_JobId * jobid);
+
+/*
+ * Free jobid structure
+ * \param jobid for dealocation
+ */
+void edg_wlc_JobIdFree(edg_wlc_JobId jobid);
+
+/**
+ * Parse Job ID string and creates jobid structure
+ * \param jobidstr string representation of jobid
+ * \param jobid parsed job id
+ * \retval 0 for success
+ * \retval EINVAL jobidstr can't be parsed
+ * \retval ENOMEM if memory allocation fails
+ */
+int edg_wlc_JobIdParse(const char* jobidstr, edg_wlc_JobId * jobid);
+
+/**
+ * Unparse Job ID (produce the string form of JobId).
+ * \param jobid to be converted to string
+ * \return allocated string which represents jobid
+ */
+char* edg_wlc_JobIdUnparse(const edg_wlc_JobId jobid);
+
+/**
+ * Extract bookkeeping server address (address:port)
+ * \param jobid from which the bkserver address should be extracted
+ * \retval pointer to allocated string with bkserver address
+ * \retval NULL if jobid is 0 or memory allocation fails
+ */
+char* edg_wlc_JobIdGetServer(const edg_wlc_JobId jobid);
+
+/**
+ * Extract bookkeeping server address and port
+ * \param jobid from which the bkserver address should be extracted
+ * \param srvName pointer where to return server name
+ * \param srvPort pointer where to return server port
+ * */
+void edg_wlc_JobIdGetServerParts(const edg_wlc_JobId jobid, char **srvName, unsigned int *srvPort);
+
+/**
+ * Extract unique string
+ * \param jobid
+ * \retval pointer to allocated unique string representing jobid
+ * \retval NULL if jobid is 0 or memory allocation fails
+ */
+char* edg_wlc_JobIdGetUnique(const edg_wlc_JobId jobid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _EDG_JOBID_H */
#include <algorithm>
#include "../jobid_namespace.h"
-#include "../jobid/JobId.h"
+#include "JobId.h"
using namespace std;
#include <string>
-#include "../common_namespace.h"
+#include "edg/workload/common/common_namespace.h"
COMMON_NAMESPACE_BEGIN {
#ident "$Header$"
+#include <openssl/md5.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <openssl/md5.h>
#include "../jobid/strmd5.h"
STDCPP = -lstdc++
-WL_JOBID_TEST = testjobid
+JOBID = $(top_builddir)/src/jobid/libglite_wms_jobid.la
-check_PROGRAMS = $(WL_JOBID_TEST)
+check_PROGRAMS = testjobid
testjobid_SOURCES = testjobid.c
testjobid_LDADD = \
- $(top_builddir)/src/jobid/libglite_wl_jobid.la \
+ $(JOBID) \
$(GLITE_WORKLOAD_COMMON_LIBS) \
$(GLOBUS_LIBS) \
$(STDCPP)
#include <stdio.h>
#include <stdlib.h>
-#include "../src/jobid/jobid-c.h"
+#include "../src/jobid.h"
int main(int argc, char* argv[])
{