[cwscore-commit] CVS update: MODIFIED: source, globus_wsrf_core_tools.c ...
Joe Bester
commit at globus.org
Fri May 26 11:02:22 CDT 2006
User: bester
Date: 06/05/26 11:02:22
Modified: c/core/tools/source Makefile.am configure.in dirt.sh
globus_wsrf_core_tools.c globus_wsrf_core_tools.h
Added: c/core/tools/source globus_i_wsrf_options.c
globus_i_wsrf_options.h globus_wsrf_options.c
globus_wsrf_options.h
Log:
Added wsrf client command line programs
Added some documentation for globus_wsrf_core_tools package
Revision Changes Path
1.2 +7 -3 wsrf/c/core/tools/source/Makefile.am
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Makefile.am
===================================================================
RCS file: /home/globdev/CVS/globus-packages/wsrf/c/core/tools/source/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Makefile.am 23 Sep 2004 14:01:03 -0000 1.1
+++ Makefile.am 26 May 2006 16:02:22 -0000 1.2
@@ -1,14 +1,15 @@
include $(top_srcdir)/globus_automake_pre
include $(top_srcdir)/globus_automake_pre_top
-SUBDIRS= doxygen pkgdata
+SUBDIRS= . programs doxygen pkgdata
EXTRA_DIST=dirt.sh version.h.in
INCLUDES=-I$(GLOBUS_LOCATION)/include/$(GLOBUS_FLAVOR_NAME)/wsrf/services
flavorinclude_HEADERS = \
- globus_wsrf_core_tools.h
+ globus_wsrf_core_tools.h \
+ globus_wsrf_options.h
# lib_LTLIBRARIES is an automake macro which contains
# a list of libtool libraries that are to be installed in $prefix/lib
@@ -16,7 +17,10 @@
libglobus_wsrf_core_tools___GLOBUS_FLAVOR_NAME__la_SOURCES = \
globus_wsrf_core_tools.c \
- globus_i_wsrf_core_tools.h
+ globus_i_wsrf_core_tools.h \
+ globus_wsrf_options.c \
+ globus_i_wsrf_options.h \
+ globus_i_wsrf_options.c
libglobus_wsrf_core_tools___GLOBUS_FLAVOR_NAME__la_LDFLAGS = $(GPT_LDFLAGS)
libglobus_wsrf_core_tools___GLOBUS_FLAVOR_NAME__la_LIBADD = $(GPT_LIB_LINKS)
1.2 +3 -2 wsrf/c/core/tools/source/configure.in
(In the diff below, changes in quantity of whitespace are not shown.)
Index: configure.in
===================================================================
RCS file: /home/globdev/CVS/globus-packages/wsrf/c/core/tools/source/configure.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- configure.in 23 Sep 2004 14:01:03 -0000 1.1
+++ configure.in 26 May 2006 16:02:22 -0000 1.2
@@ -1,4 +1,4 @@
-AC_REVISION($Revision: 1.1 $)
+AC_REVISION($Revision: 1.2 $)
AC_INIT(Makefile.am)
GLOBUS_INIT
@@ -8,7 +8,7 @@
dnl Initialize the automake rules the last argument
AM_INIT_AUTOMAKE($GPT_NAME, $GPT_VERSION)
-LAC_DOXYGEN("../ ./", "*.dox")
+LAC_DOXYGEN("../ ./ ../programs/", "*.dox")
@@ -16,6 +16,7 @@
AC_OUTPUT(
Makefile
+ programs/Makefile
pkgdata/Makefile
pkgdata/pkg_data_src.gpt
doxygen/Makefile
1.20 +2 -2 wsrf/c/core/tools/source/dirt.sh
(In the diff below, changes in quantity of whitespace are not shown.)
Index: dirt.sh
===================================================================
RCS file: /home/globdev/CVS/globus-packages/wsrf/c/core/tools/source/dirt.sh,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- dirt.sh 26 May 2006 16:02:22 -0000 1.19
+++ dirt.sh 26 May 2006 16:02:22 -0000 1.20
@@ -1,2 +1,2 @@
-DIRT_TIMESTAMP=1148573586
-DIRT_BRANCH_ID=0
+DIRT_TIMESTAMP=1148659342
+DIRT_BRANCH_ID=1
1.29 +266 -28 wsrf/c/core/tools/source/globus_wsrf_core_tools.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: globus_wsrf_core_tools.c
===================================================================
RCS file: /home/globdev/CVS/globus-packages/wsrf/c/core/tools/source/globus_wsrf_core_tools.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- globus_wsrf_core_tools.c 18 May 2006 15:20:18 -0000 1.28
+++ globus_wsrf_core_tools.c 26 May 2006 16:02:22 -0000 1.29
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-
#include "globus_service_engine.h"
#include "globus_service_registry.h"
#include "globus_wsrf_core_tools.h"
@@ -25,8 +24,46 @@
#include "globus_error_string.h"
#include "wsbf_DescriptionType.h"
#include "globus_ws_addressing.h"
+#include "globus_xsd_primitives.h"
+#include "globus_wsrf_core_tools.h"
-
+/**
+ * @mainpage Globus WSRF Core Tools
+ *
+ * The Globus WSRF Core Tools package consists of C libraries and programs for
+ * accessing and manipulating WSRF resources. The library consists of functions for
+ * manipulating EndpointReferences, performing conversions on some core wsrf
+ * and xml types, and for parsing some standard command-line options for WSRF
+ * client programs.
+ *
+ * This module uses standard Globus module activation and deactivation.
+ *
+ * Before any functions in this module can be called, the GLOBUS_WSRF_CORE_TOOLS_MODULE
+ * module descriptor must be activated.
+ *
+ * <code>
+ * globus_module_activate(GLOBUS_WSRF_CORE_TOOLS_MODULE);
+ * </code>
+ *
+ * This function returns GLOBUS_SUCCESS if the module was
+ * successfully initialized, and you are therefore allowed to call
+ * functions implemented in it. Otherwise, an error code is returned, and
+ * functions from this module should not be subsequently called. This function
+ * may be called multiple times.
+ *
+ * To deactivate this module, the following must be called:
+ *
+ * <code>
+ * globus_module_deactivate(GLOBUS_WSRF_CORE_TOOLS_MODULE);
+ * </code>
+ *
+ * This function should be called once for each time the module was activated.
+ */
+
+/**
+ * @defgroup globus_wsrf_core_epr EndpointReferenceType Manipulation
+ * EndpointReferenceType constructors and manipulators.
+ */
static int
globus_l_wsrf_core_tools_activate();
@@ -45,8 +82,6 @@
GlobusDebugDefine(GLOBUS_WSRF_CORE_TOOLS);
-
-
static int
globus_l_wsrf_core_tools_activate()
{
@@ -112,9 +147,35 @@
return rc;
}
-#include "globus_xsd_primitives.h"
-#include "globus_wsrf_core_tools.h"
-
+/**
+ * Construct an EndpointReference.
+ * @ingroup globus_wsrf_core_epr
+ *
+ * Construct an EndpointReference from a collection of information about the
+ * current processing context.
+ *
+ * @param engine
+ * An engine which is servicing this resource. The engine is used to determine the
+ * base part of the address used in the EPR.
+ * @param path
+ * The service's path which must be passed to the engine when operating on
+ * this service.
+ * @param resource_id
+ * The element containing the resource-specific ReferenceProperties. If this
+ * is non-null, then the any will be moved to the resulting EPR and its original
+ * values will be destroyed. If this is null, no ReferenceProperties will
+ * be associated with the EPR.
+ * @param endpoint_reference
+ * A new EndpointReference which will be populated
+ *
+ * @retval GLOBUS_SUCCESS
+ * The new endpoint reference was created successfully.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAMETER
+ * Could not create new endpoint reference because @a engine, @a path, or
+ * @a endpoint_reference was NULL.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_OUT_OF_MEMORY
+ * Could not create new endpoint reference because of a lack of available memory.
+ */
globus_result_t
globus_wsrf_core_create_endpoint_reference(
globus_service_engine_t engine,
@@ -128,19 +189,52 @@
GlobusFuncName(globus_wsrf_core_create_endpoint_reference);
GlobusWSRFCoreToolsDebugEnter();
- globus_service_engine_get_contact(engine, &contact);
+ if (engine == NULL || path == NULL || endpoint_reference == NULL)
+ {
+ result = GlobusSoapMessageErrorNullParam;
+
+ goto out;
+ }
+ result = globus_service_engine_get_contact(engine, &contact);
+ if (result != GLOBUS_SUCCESS)
+ {
+ goto out;
+ }
- wsa_EndpointReferenceType_init_contents(endpoint_reference);
+ result = wsa_EndpointReferenceType_init_contents(endpoint_reference);
+ if (result != GLOBUS_SUCCESS)
+ {
+ goto free_contact_out;
+ }
endpoint_reference->Address.base_value =
globus_common_create_string("%s%s",
contact,
path);
- globus_free(contact);
- wsa_ReferencePropertiesType_init(&endpoint_reference->ReferenceProperties);
+ if (endpoint_reference->Address.base_value == NULL)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+ goto free_contact_out;
+ }
+
+ if (resource_id != NULL)
+ {
+ result = wsa_ReferencePropertiesType_init(
+ &endpoint_reference->ReferenceProperties);
+ if (result != GLOBUS_SUCCESS)
+ {
+ goto destroy_epr_contents_out;
+ }
+
new_rp = xsd_any_array_push(&endpoint_reference->ReferenceProperties->any);
+ if (new_rp == NULL)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+ goto destroy_epr_contents_out;
+ }
+
new_rp->value = (*resource_id)->value;
new_rp->element = (*resource_id)->element;
new_rp->any_info = (*resource_id)->any_info;
@@ -150,11 +244,49 @@
xsd_any_destroy(*resource_id);
*resource_id = NULL;
+ }
+destroy_epr_contents_out:
+ if (result != GLOBUS_SUCCESS)
+ {
+ wsa_EndpointReferenceType_destroy_contents(endpoint_reference);
+ }
+free_contact_out:
+ globus_free(contact);
+out:
GlobusWSRFCoreToolsDebugExit();
return result;
}
+/* globus_wsrf_core_create_endpoint_reference() */
+/**
+ * Construct an EndpointReference from a wrapped URI (deprecated)
+ * @ingroup globus_wsrf_core_epr
+ * Construct an EndpointReference from a string in wrapped URI format. The wrapped
+ * URI format is service-contact?reference-property-value (for example
+ * http://localhost:30001/wsrf/services/CounterService?1231231). The name of the reference
+ * property is specified by the @a id_element qname.
+ *
+ * @param wrapped_uri
+ * A wrapped-URI string.
+ * @param id_element
+ * QName of the element to used for the ReferenceProperty contained in the
+ * @a wrapped_uri. This may be NULL if no reference properties are needed to
+ * contact the service.
+ * @param endpoint_reference
+ * A new EndpointReference which will be populated
+ *
+ * @retval GLOBUS_SUCCESS
+ * The new endpoint reference was created successfully.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAMETER
+ * Could not create new endpoint reference because @a wrapped_uri or
+ * @a endpoint_reference was NULL.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_OUT_OF_MEMORY
+ * Could not create new endpoint reference because of a lack of available memory.
+ *
+ * @deprecated
+ * The wrapped-URI format used by this function is non-standard.
+ */
globus_result_t
globus_wsrf_core_unwrap_endpoint_reference(
const char * wrapped_uri,
@@ -189,9 +321,39 @@
return result;
}
+/**
+ * Convert an EndpointReference into a wrapped URI (deprecated)
+ * @ingroup globus_wsrf_core_epr
+ * Parse out the address and ReferenceProperties value from an EndpointReference and
+ * put them into a string in wrapped-URI format. The wrapped-URI
+ * format is service-contact?reference-property-value (for example
+ * http://localhost:30001/wsrf/services/CounterService?1231231).
+ *
+ * @param endpoint_reference
+ * A new EndpointReference which will be parsed.
+ * @param wrapped_uri
+ * A pointer to a newly allocated string containing the wrapped-URI.
+ *
+ * @retval GLOBUS_SUCCESS
+ * The new wrapped_uri was created successfull.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAMETER
+ * Could not create the wrapped URI because @a wrapped_uri or
+ * @a endpoint_reference was NULL.
+ * @retval GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_NULL_REF_PROP
+ * The ReferenceProperties of the EPR were NULL.
+ * @retval GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_REF_PROP_WRONG_COUNT
+ * There is not exactly one ReferenceProperties element in the EPR.
+ * @retval GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_INVALID_REF_PROP
+ * The reference properties value was not a string type.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_OUT_OF_MEMORY
+ * Could not create the new wrapped-URI because of a lack of available memory.
+ *
+ * @deprecated
+ * The wrapped-URI format used by this function is non-standard.
+ */
globus_result_t
globus_wsrf_core_wrap_endpoint_reference(
- wsa_EndpointReferenceType * endpoint_reference,
+ const wsa_EndpointReferenceType * endpoint_reference,
char ** wrapped_uri)
{
globus_result_t result = GLOBUS_SUCCESS;
@@ -199,6 +361,12 @@
GlobusWSRFCoreToolsDebugEnter();
/* verify endpoint reference property is xsd_string type */
+ if (endpoint_reference == NULL || wrapped_uri == NULL)
+ {
+ result = GlobusSoapMessageErrorNullParam;
+
+ goto exit;
+ }
if(endpoint_reference->ReferenceProperties)
{
@@ -227,12 +395,43 @@
endpoint_reference->Address.base_value,
endpoint_reference->ReferenceProperties->any.elements[0].value);
+ if (*wrapped_uri == NULL)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+ goto exit;
+ }
+
exit:
GlobusWSRFCoreToolsDebugExit();
return result;
}
+/* globus_wsrf_core_wrap_endpoint_reference() */
+/**
+ * Obtain a resource handle from a message handle and service descriptor.
+ * @ingroup globus_wsrf_core_resource
+ *
+ * Looks up the resource which is associated with the EndpointReference used in the
+ * addressing headers on the current message.
+ *
+ * @param message
+ * Message handle which the operation request arrived on.
+ * @param service
+ * Service handle for the service which is processing the operation.
+ * @param resource
+ * Pointer to a WSRF resource handle which will be set to the resource
+ * associated with the SOAP message EPR. This must be released by calling
+ * globus_resource_finish()
+ *
+ * @retval GLOBUS_SUCCESS
+ * Resource successfully located.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_OUT_OF_MEMORY
+ * Unable to locate the resource because of a lack of available memory.
+ * @retval GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_GET_RESOURCE_FAILED
+ * Unable to locate the resource because the EPR could not be determined, or the
+ * resource ID does not map to a valid resource.
+ */
globus_result_t
globus_wsrf_core_get_resource(
globus_soap_message_handle_t message,
@@ -245,6 +444,11 @@
GlobusFuncName(globus_wsrf_core_get_resource_id);
GlobusWSRFCoreToolsDebugEnter();
+ if (message == NULL || service == NULL || resource == NULL)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+ goto exit;
+ }
epr = globus_soap_message_handle_get_attr(
message,
WSADDR_EPR_KEY);
@@ -283,7 +487,29 @@
GlobusWSRFCoreToolsDebugExit();
return result;
}
+/* globus_wsrf_core_get_resource() */
+/**
+ * Obtain a resource handle from an EPR
+ * @ingroup globus_wsrf_core_resource
+ *
+ * Looks up the resource associated with an EPR.
+ *
+ * @param epr
+ * Endpoint reference to look up.
+ * @param resource
+ * Pointer to a WSRF resource handle which will be set to the resource
+ * associated with the EPR. This must be released by calling
+ * globus_resource_finish()
+ *
+ * @retval GLOBUS_SUCCESS
+ * Resource successfully located.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_OUT_OF_MEMORY
+ * Unable to locate the resource because of a lack of available memory.
+ * @retval GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_GET_RESOURCE_FAILED
+ * Unable to locate the resource because the EPR could not be determined, or the
+ * resource ID does not map to a valid resource.
+ */
globus_result_t
globus_wsrf_core_get_resource_from_epr(
const wsa_EndpointReferenceType * epr,
@@ -299,8 +525,19 @@
GlobusFuncName(globus_wsrf_core_get_resource_from_epr);
GlobusWSRFCoreToolsDebugEnter();
- globus_assert(epr);
- globus_assert(epr->Address.base_value);
+ if (epr == NULL || resource == NULL)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+
+ goto exit;
+ }
+
+ if (epr->Address.base_value == NULL)
+ {
+ result = GlobusWSRFCoreToolsErrorGetResourceFailed(GLOBUS_SUCCESS, "Invalid EPR");
+
+ goto exit;
+ }
uri = xmlParseURI(epr->Address.base_value);
if(!uri)
@@ -319,15 +556,14 @@
service_module_path = globus_common_create_string(
GLOBUS_SERVICE_ENGINE_MODULE_PATH_PREFIX "/%s",
base_path);
- GlobusWSRFCoreToolsDebugPrintf(GLOBUS_L_WSRF_CORE_TOOLS_DEBUG_DEBUG,
- ("Path for service module is `%s'\n", service_module_path));
-
if (service_module_path == NULL)
{
result = GlobusWSRFCoreToolsErrorGetResourceFailed(
GLOBUS_SUCCESS, "Failed to parse EPR Address");
goto exit;
}
+ GlobusWSRFCoreToolsDebugPrintf(GLOBUS_L_WSRF_CORE_TOOLS_DEBUG_DEBUG,
+ ("Path for service module is `%s'\n", service_module_path));
service = globus_extension_lookup(
&ext, GLOBUS_SERVICE_REGISTRY, service_module_path);
@@ -381,6 +617,7 @@
GlobusWSRFCoreToolsDebugExit();
return result;
}
+/* globus_wsrf_core_get_resource_from_epr() */
globus_result_t
globus_wsrf_core_get_resource_id_from_epr(
@@ -467,6 +704,7 @@
GlobusWSRFCoreToolsDebugExit();
return result;
}
+/* globus_wsrf_core_get_resource_id_from_epr() */
char *
globus_wsrf_core_export_timestamp(
1.18 +1 -1 wsrf/c/core/tools/source/globus_wsrf_core_tools.h
(In the diff below, changes in quantity of whitespace are not shown.)
Index: globus_wsrf_core_tools.h
===================================================================
RCS file: /home/globdev/CVS/globus-packages/wsrf/c/core/tools/source/globus_wsrf_core_tools.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- globus_wsrf_core_tools.h 18 May 2006 15:20:18 -0000 1.17
+++ globus_wsrf_core_tools.h 26 May 2006 16:02:22 -0000 1.18
@@ -58,7 +58,7 @@
globus_result_t
globus_wsrf_core_wrap_endpoint_reference(
- wsa_EndpointReferenceType * endpoint_reference,
+ const wsa_EndpointReferenceType * endpoint_reference,
char ** wrapped_uri);
globus_result_t
1.2 +1071 -0 wsrf/c/core/tools/source/globus_i_wsrf_options.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: globus_i_wsrf_options.c
===================================================================
RCS file: globus_i_wsrf_options.c
diff -N globus_i_wsrf_options.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ globus_i_wsrf_options.c 26 May 2006 16:02:22 -0000 1.2
@@ -0,0 +1,1071 @@
+/*
+ * Copyright 1999-2006 University of Chicago
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
+
+#include "globus_common.h"
+#include "globus_i_wsrf_options.h"
+#include "globus_wsrf_core_tools.h"
+#include "gssapi.h"
+#include "globus_error_gssapi.h"
+#include "version.h"
+
+#ifndef GSS_IMPEXP_MECH_SPECIFIC
+#define GSS_IMPEXP_MECH_SPECIFIC 1
+#endif
+#ifndef GSS_IMPEXP_OPAQUE_FORM
+#define GSS_IMPEXP_OPAQUE_FORM 0
+#endif
+
+static
+globus_result_t
+globus_l_wsrf_options_set_anonymous(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_result_t result;
+ globus_i_wsrf_options_handle_t * options = arg;
+
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_AUTH_ANONYMOUS_KEY,
+ NULL,
+ NULL,
+ (void *) 1);
+
+ return result;
+}
+/* globus_l_wsrf_options_set_anonymous() */
+
+#if 0
+static
+globus_result_t
+globus_l_wsrf_options_set_server_certificate(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ return GLOBUS_FAILURE;
+}
+/* globus_l_wsrf_options_set_server_certificate() */
+#endif
+
+static
+globus_result_t
+globus_l_wsrf_options_set_debug(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+
+ options->debug = GLOBUS_TRUE;
+ globus_i_GLOBUS_SOAP_MESSAGE_debug_handle.levels |= GLOBUS_SOAP_MESSAGE_DEBUG_MESSAGES;
+
+ return GLOBUS_SUCCESS;
+}
+/* globus_l_wsrf_options_set_debug() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_epr(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ globus_result_t result;
+
+ if (options->epr)
+ {
+ wsa_EndpointReferenceType_destroy(options->epr);
+ }
+ result = globus_wsrf_core_import_endpoint_reference(
+ param[0],
+ &options->epr,
+ NULL);
+
+ return result;
+}
+/* globus_l_wsrf_options_set_epr() */
+
+#if 0
+static
+globus_result_t
+globus_l_wsrf_options_set_descriptor(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ return GLOBUS_FAILURE;
+}
+/* globus_l_wsrf_options_set_descriptor() */
+#endif
+
+#if 0
+static
+globus_result_t
+globus_l_wsrf_options_set_delegation(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ return GLOBUS_FAILURE;
+}
+/* globus_l_wsrf_options_set_delegation() */
+#endif
+
+static
+globus_result_t
+globus_l_wsrf_options_set_help(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ const char * tmp;
+
+ if (options->application_name)
+ {
+ tmp = strrchr(options->application_name, '/');
+ tmp = tmp ? tmp+1 : options->application_name;
+ }
+ else
+ {
+ tmp = "globus_wsrf_core_tools";
+ }
+ if (options->usage)
+ {
+ printf("Usage: %s %s\nOptions:\n", tmp, options->usage);
+ }
+ globus_options_help(opts_handle);
+
+ if (options->post_banner)
+ {
+ printf("\n%s\n", options->post_banner);
+ }
+ return globus_error_put(globus_error_construct_error(
+ NULL,
+ NULL,
+ GLOBUS_OPTIONS_HELP,
+ __FILE__,
+ "globus_l_wsrf_options_help",
+ __LINE__,
+ "Help"));
+}
+/* globus_l_wsrf_options_set_help() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_usage(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ const char * tmp;
+
+ if (options->application_name)
+ {
+ tmp = strrchr(options->application_name, '/');
+ tmp = tmp ? tmp+1 : options->application_name;
+ }
+ else
+ {
+ tmp = "globus_wsrf_core_tools";
+ }
+ if (options->usage)
+ {
+ printf("Usage: %s %s\n", tmp, options->usage);
+ }
+ return globus_error_put(globus_error_construct_error(
+ NULL,
+ NULL,
+ GLOBUS_OPTIONS_HELP,
+ __FILE__,
+ "globus_l_wsrf_options_usage",
+ __LINE__,
+ "usage"));
+}
+/* globus_l_wsrf_options_set_usage() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_key(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ char * tmp;
+ globus_result_t result;
+ char * key = param[0];
+ xsd_any * any;
+ xsd_string * val;
+
+ if (options->epr && options->epr->ReferenceProperties)
+ {
+ wsa_ReferencePropertiesType_destroy(options->epr->ReferenceProperties);
+ }
+ else if (!options->epr)
+ {
+ result = wsa_EndpointReferenceType_init(&options->epr);
+
+ if (result != GLOBUS_SUCCESS)
+ {
+ goto out;
+ }
+ }
+ result = wsa_ReferencePropertiesType_init(&options->epr->ReferenceProperties);
+ if (result != GLOBUS_SUCCESS)
+ {
+ goto out;
+ }
+
+ any = xsd_any_array_push(&options->epr->ReferenceProperties->any);
+
+ if (!any)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+
+ goto out;
+ }
+
+ result = xsd_QName_init(&any->element);
+
+ if (result != GLOBUS_SUCCESS)
+ {
+ goto out;
+ }
+
+ if (key[0] == '{' && ((tmp = strchr(key, '}')) != NULL))
+ {
+ *tmp = '\0';
+ /* key is a QName in {Namespace}local form */
+ any->element->Namespace = globus_libc_strdup(key+1);
+ if (any->element->Namespace == NULL)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+
+ goto out;
+ }
+
+ any->element->local = globus_libc_strdup(tmp+1);
+ if (any->element->local == NULL)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+
+ goto out;
+ }
+ }
+ else
+ {
+ any->element->Namespace = NULL;
+ any->element->local = globus_libc_strdup(key);;
+ if (any->element->local == NULL)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+
+ goto out;
+ }
+ }
+ any->any_info = &xsd_string_info;
+ result = xsd_string_init(&val);
+ if (result != GLOBUS_SUCCESS)
+ {
+ goto out;
+ }
+ any->value = val;
+ result = xsd_string_copy_contents(
+ val,
+ ¶m[1]);
+ if (result != GLOBUS_SUCCESS)
+ {
+ goto out;
+ }
+
+out:
+ return result;
+}
+/* globus_l_wsrf_options_set_key() */
+
+#if 0
+static
+globus_result_t
+globus_l_wsrf_options_set_context_lifetime(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ return GLOBUS_FAILURE;
+}
+/* globus_l_wsrf_options_set_context_lifetime() */
+#endif
+
+static
+globus_result_t
+globus_l_wsrf_options_set_security_mech(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ globus_result_t result;
+
+ if (strcmp(param[0], "msg") == 0)
+ {
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_AUTHENTICATION_METHOD_KEY,
+ NULL,
+ NULL,
+ (void *) GLOBUS_SOAP_MESSAGE_AUTH_SECURE_MESSAGE);
+ }
+ else if (strcmp(param[0], "conv") == 0)
+ {
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_AUTH_PROTECTION_KEY,
+ NULL,
+ NULL,
+ (void *) GLOBUS_SOAP_MESSAGE_AUTH_SECURE_CONVERSATION);
+ }
+ else
+ {
+ result = globus_error_put(globus_error_construct_error(
+ NULL,
+ NULL,
+ GLOBUS_OPTIONS_INVALID_PARAMETER,
+ __FILE__,
+ "globus_l_wsrf_options_set_security_mech",
+ __LINE__,
+ "Unknown security mechanism %s.",
+ param[0]));
+ }
+ return GLOBUS_SUCCESS;
+}
+/* globus_l_wsrf_options_set_security_mech() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_protection(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ globus_result_t result;
+
+ if (strcmp(param[0], "sig") == 0)
+ {
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_AUTH_PROTECTION_KEY,
+ NULL,
+ NULL,
+ (void *) GLOBUS_SOAP_MESSAGE_AUTH_PROTECTION_INTEGRITY);
+ }
+ else if (strcmp(param[0], "enc") == 0)
+ {
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_AUTH_PROTECTION_KEY,
+ NULL,
+ NULL,
+ (void *) GLOBUS_SOAP_MESSAGE_AUTH_PROTECTION_PRIVACY);
+ }
+ else
+ {
+ return GLOBUS_FAILURE;
+ }
+ return GLOBUS_SUCCESS;
+}
+/* globus_l_wsrf_options_set_protection() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_service(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ globus_result_t result;
+
+ if (options->epr && options->epr->Address.base_value)
+ {
+ wsa_AttributedURI_destroy(&options->epr->Address);
+ }
+ else if (!options->epr)
+ {
+ result = wsa_EndpointReferenceType_init(&options->epr);
+
+ if (result != GLOBUS_SUCCESS)
+ {
+ goto out;
+ }
+ }
+ result = xsd_anyURI_copy_contents(
+ &options->epr->Address.base_value,
+ param);
+
+out:
+ return result;
+}
+/* globus_l_wsrf_options_set_service() */
+
+static
+globus_result_t
+globus_l_reltime_copy(
+ void ** new_attr,
+ const void * attr)
+{
+ *new_attr = malloc(sizeof(globus_reltime_t));
+
+ memcpy(*new_attr, attr, sizeof(globus_reltime_t));
+
+ return GLOBUS_SUCCESS;
+}
+/* globus_l_reltime_copy() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_timeout(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ globus_reltime_t timeout;
+ globus_result_t result;
+
+ timeout.tv_sec = atoi(param[0]);
+ timeout.tv_usec = 0;
+
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_TIMEOUT_KEY,
+ globus_l_reltime_copy,
+ free,
+ &timeout);
+
+ return result;
+}
+/* globus_l_wsrf_options_set_timeout() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_cert_key_files(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ char * b;
+ FILE * cert_in;
+ FILE * key_in;
+ size_t cert_size;
+ size_t key_size;
+ int rc;
+ globus_result_t result;
+ gss_cred_id_t cred;
+ OM_uint32 maj_stat;
+ OM_uint32 min_stat;
+ gss_buffer_desc import_buffer;
+
+ cert_in = fopen(param[0], "r");
+ if (cert_in == NULL)
+ {
+ result = globus_error_put(globus_error_construct_error(
+ NULL,
+ NULL,
+ GLOBUS_OPTIONS_INVALID_PARAMETER,
+ __FILE__,
+ "globus_l_wsrf_options_set_cert_key_files",
+ __LINE__,
+ "Unable to open cert file %s for reading.",
+ param[0]));
+
+ goto out;
+ }
+
+ if (fseek(cert_in, 0, SEEK_END) != 0)
+ {
+ result = globus_error_put(globus_error_construct_error(
+ NULL,
+ NULL,
+ GLOBUS_OPTIONS_INVALID_PARAMETER,
+ __FILE__,
+ "globus_l_wsrf_options_set_cert_key_files",
+ __LINE__,
+ "Unable to seek cert file %s.",
+ param[0]));
+ goto close_cert_out;
+ }
+ cert_size = ftell(cert_in);
+ rewind(cert_in);
+
+ key_in = fopen(param[1], "r");
+ if (key_in == NULL)
+ {
+ result = globus_error_put(globus_error_construct_error(
+ NULL,
+ NULL,
+ GLOBUS_OPTIONS_INVALID_PARAMETER,
+ __FILE__,
+ "globus_l_wsrf_options_set_cert_key_files",
+ __LINE__,
+ "Unable to open key file %s for reading.",
+ param[1]));
+ goto close_cert_out;
+ }
+
+ if (fseek(key_in, 0, SEEK_END) != 0)
+ {
+ result = globus_error_put(globus_error_construct_error(
+ NULL,
+ NULL,
+ GLOBUS_OPTIONS_INVALID_PARAMETER,
+ __FILE__,
+ "globus_l_wsrf_options_set_cert_key_files",
+ __LINE__,
+ "Unable to seek key file %s.",
+ param[1]));
+
+ goto close_key_file_out;
+ }
+ key_size = ftell(key_in);
+ rewind(key_in);
+
+ b = malloc(cert_size+key_size+2);
+ if (!b)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+
+ goto close_key_file_out;
+ }
+ rc = fread(b, 1, cert_size, cert_in);
+ b[rc++] = '\n';
+ rc += fread(b+rc, 1, key_size, key_in);
+ b[rc++] = '\0';
+
+ import_buffer.value = b;
+
+ import_buffer.length = strlen(b);
+
+ maj_stat = gss_import_cred(
+ &min_stat,
+ &cred,
+ GSS_C_NO_OID,
+ GSS_IMPEXP_OPAQUE_FORM,
+ &import_buffer,
+ 0,
+ NULL);
+ if (maj_stat != GSS_S_COMPLETE)
+ {
+ result = globus_error_put(
+ globus_error_construct_gssapi_error(NULL, NULL, maj_stat, min_stat));
+ goto free_import_buffer_out;
+
+ }
+
+ /* This will leak the cred because there is no cred copy function */
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_USER_CREDENTIAL_KEY,
+ NULL,
+ NULL,
+ cred);
+
+free_import_buffer_out:
+ free(import_buffer.value);
+close_key_file_out:
+ fclose(key_in);
+close_cert_out:
+ fclose(cert_in);
+out:
+ return result;
+}
+/* globus_l_wsrf_options_set_cert_key_files() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_proxy_file_name(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ globus_result_t result;
+ gss_cred_id_t cred;
+ OM_uint32 maj_stat;
+ OM_uint32 min_stat;
+ gss_buffer_desc import_buffer;
+
+ import_buffer.value = globus_common_create_string(
+ "X509_USER_PROXY=%s",
+ param[0]);
+ if (import_buffer.value == NULL)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+
+ goto out;
+ }
+ import_buffer.length = strlen(import_buffer.value);
+
+ maj_stat = gss_import_cred(
+ &min_stat,
+ &cred,
+ GSS_C_NO_OID,
+ GSS_IMPEXP_MECH_SPECIFIC,
+ &import_buffer,
+ 0,
+ NULL);
+ if (maj_stat != GSS_S_COMPLETE)
+ {
+ result = globus_error_put(
+ globus_error_construct_gssapi_error(NULL, NULL, maj_stat, min_stat));
+ goto free_import_buffer_out;
+
+ }
+
+ /* This will leak the cred because there is no cred copy function */
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_USER_CREDENTIAL_KEY,
+ NULL,
+ NULL,
+ cred);
+
+free_import_buffer_out:
+ free(import_buffer.value);
+out:
+ return result;
+}
+/* globus_l_wsrf_options_set_proxy_file_name() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_authorization(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ globus_result_t result;
+
+ if (strcmp(param[0], "self") == 0)
+ {
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_AUTHZ_METHOD_KEY,
+ NULL,
+ NULL,
+ (void *) GLOBUS_SOAP_MESSAGE_AUTHZ_SELF);
+ }
+ else if (strcmp(param[0], "host") == 0)
+ {
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_AUTHZ_METHOD_KEY,
+ NULL,
+ NULL,
+ (void *) GLOBUS_SOAP_MESSAGE_AUTHZ_HOST);
+ }
+ else if (strcmp(param[0], "none") == 0)
+ {
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_AUTHZ_METHOD_KEY,
+ NULL,
+ NULL,
+ (void *) GLOBUS_SOAP_MESSAGE_AUTHZ_NONE);
+ }
+ else
+ {
+ gss_buffer_desc buff;
+ gss_name_t name;
+ OM_uint32 min_stat;
+ OM_uint32 maj_stat;
+
+ /* Subject */
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_AUTHZ_METHOD_KEY,
+ NULL,
+ NULL,
+ (void *) GLOBUS_SOAP_MESSAGE_AUTHZ_IDENTITY);
+
+ buff.value = param;
+ buff.length = strlen(buff.value);
+
+ maj_stat = gss_import_name(
+ &min_stat,
+ &buff,
+ GSS_C_NO_OID,
+ &name);
+
+ result = globus_soap_message_attr_set(
+ options->attr,
+ GLOBUS_SOAP_MESSAGE_AUTHZ_TARGET_NAME_KEY,
+ NULL,
+ NULL,
+ name);
+
+ }
+
+ return GLOBUS_SUCCESS;
+}
+/* globus_l_wsrf_options_set_authorization() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_version(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_i_wsrf_options_handle_t * options = arg;
+ const char * tmp;
+ const globus_version_t * version;
+
+ if (options->application_name)
+ {
+ tmp = strrchr(options->application_name,'/');
+ tmp = tmp ? tmp+1 : options->application_name;
+ }
+ else
+ {
+ tmp = "globus_wsrf_core_tools";
+ }
+
+ if (options->application_version)
+ {
+ version = options->application_version;
+ }
+ else
+ {
+ version = &local_version;
+ }
+
+ globus_version_print(
+ tmp,
+ version,
+ stdout,
+ 1);
+
+ return globus_error_put(globus_error_construct_error(
+ NULL,
+ NULL,
+ GLOBUS_OPTIONS_HELP,
+ __FILE__,
+ "globus_l_wsrf_options_set_version",
+ __LINE__,
+ "Program versions"));
+}
+/* globus_l_wsrf_options_set_version() */
+
+static
+globus_result_t
+globus_l_wsrf_options_set_versions(
+ globus_options_handle_t opts_handle,
+ char * cmd,
+ char * param[],
+ void * arg,
+ int * out_params_used)
+{
+ globus_module_print_activated_versions(
+ stdout,
+ 1);
+
+ return globus_error_put(globus_error_construct_error(
+ NULL,
+ NULL,
+ GLOBUS_OPTIONS_HELP,
+ __FILE__,
+ "globus_l_wsrf_options_set_versions",
+ __LINE__,
+ "Program versions"));
+
+}
+/* globus_l_wsrf_options_set_versions() */
+#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
+
+/**
+ * @page globus_wsrf_options_options Common WSRF Client Options
+ *
+ * @ingroup globus_wsrf_options
+ * <pre>
+ * -a | --anonymous Use anonymous authentication. Requires either -m
+ * 'conv' or transport (https) security.
+ * -d | --debug Enable debug mode
+ * -e | --eprFile FILENAME Load service EPR from FILENAME
+ * -h | --help Print this help message.
+ * -k | --key KEYNAME VALUE Set resource key in service EPR to be named
+ * KEYNAME with VALUE as its value.
+ * -m | --securityMech TYPE Set authentication mechanism. TYPE is one of
+ * 'msg' for WS-SecureMessage or 'conv' for
+ * WS-SecureConversation.
+ * -p | --protection LEVEL Set message protection level. LEVEL is one of
+ * 'sig' for digital signature or 'enc' for
+ * encryption.
+ * -s | --service ENDPOINT Set ENDPOINT the service URL to use.
+ * -t | --timeout SECONDS Set client timeout to SECONDS.
+ * -u | --usage Print short usage message.
+ * -V | --version Show version information and exit.
+ * -v | --certKeyFiles CERTIFICATE-FILENAME KEY-FILENAME
+ * Use credentials located in CERTIFICATE-FILENAME
+ * and KEY-FILENAME. The key file must be
+ * unencrypted.
+ * -x | --proxyFilename FILENAME
+ * Use proxy credentials located in FILENAME
+ * -z | --authorization TYPE Set authorization mode. TYPE can be 'self',
+ * 'host', 'none', or a string specifying the
+ * identity of the remote party.
+ * --versions Show version information for all loaded modules
+ * and exit.
+ * </pre>
+ */
+#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
+globus_options_entry_t
+globus_i_wsrf_common_options_table[] =
+{
+ {
+ "anonymous",
+ "a",
+ NULL,
+ NULL,
+ "Use anonymous authentication. Requires either -m 'conv' or transport (https) "
+ "security.",
+ 0,
+ globus_l_wsrf_options_set_anonymous
+ },
+#if 0
+ {
+ "serviceCertificate",
+ "c",
+ NULL,
+ "FILENAME",
+ "Use server's certificate located in FILENAME for encryption with GSI Secure "
+ "Message",
+ 1,
+ globus_l_wsrf_options_set_server_certificate
+ },
+#endif
+ {
+ "debug",
+ "d",
+ NULL,
+ NULL,
+ "Enable debug mode",
+ 0,
+ globus_l_wsrf_options_set_debug
+ },
+ {
+ "eprFile",
+ "e",
+ NULL,
+ "FILENAME",
+ "Load service EPR from FILENAME",
+ 1,
+ globus_l_wsrf_options_set_epr
+ },
+#if 0
+ {
+ "descriptor",
+ "f",
+ NULL,
+ "FILENAME,
+ "Read client security descriptor from FILENAME",
+ 1,
+ globus_l_wsrf_options_set_descriptor
+ },
+#endif
+#if 0
+ {
+ "delegation",
+ "g",
+ NULL,
+ "MODE",
+ "Delegate credentials to service. MODE can be either 'limited' or 'full'. "
+ "Requires -m 'conv' option.",
+ 1,
+ globus_l_wsrf_options_set_delegation
+ },
+#endif
+ {
+ "help",
+ "h",
+ NULL,
+ NULL,
+ "Print this help message.",
+ 0,
+ globus_l_wsrf_options_set_help
+ },
+ {
+ "usage",
+ "u",
+ NULL,
+ NULL,
+ "Print short usage message.",
+ 0,
+ globus_l_wsrf_options_set_usage
+ },
+ {
+ "key",
+ "k",
+ NULL,
+ "KEYNAME VALUE",
+ "Set resource key in service EPR to be named KEYNAME with VALUE as its value.",
+ 2,
+ globus_l_wsrf_options_set_key
+ },
+#if 0
+ {
+ "contextLifetime",
+ "l",
+ NULL,
+ "SECONDS?",
+ "Set lifetime of GSI security context.",
+ 1,
+ globus_l_wsrf_options_set_context_lifetime
+ },
+#endif
+ {
+ "securityMech",
+ "m",
+ NULL,
+ "TYPE",
+ "Set authentication mechanism. TYPE is one of 'msg' for WS-SecureMessage or "
+ "'conv' for WS-SecureConversation.",
+ 1,
+ globus_l_wsrf_options_set_security_mech
+ },
+ {
+ "protection",
+ "p",
+ NULL,
+ "LEVEL",
+ "Set message protection level. LEVEL is one of 'sig' for digital signature or "
+ "'enc' for encryption. The default is 'sig'.",
+ 1,
+ globus_l_wsrf_options_set_protection
+ },
+ {
+ "service",
+ "s",
+ NULL,
+ "ENDPOINT",
+ "Set ENDPOINT the service URL to use.",
+ 1,
+ globus_l_wsrf_options_set_service
+ },
+ {
+ "timeout",
+ "t",
+ NULL,
+ "SECONDS",
+ "Set client timeout to SECONDS.",
+ 1,
+ globus_l_wsrf_options_set_timeout
+ },
+ {
+ "certKeyFiles",
+ "v",
+ NULL,
+ "CERTIFICATE-FILENAME KEY-FILENAME",
+ "Use credentials located in CERTIFICATE-FILENAME and KEY-FILENAME. The key file "
+ "must be unencrypted.",
+ 2,
+ globus_l_wsrf_options_set_cert_key_files
+ },
+ {
+ "proxyFilename",
+ "x",
+ NULL,
+ "FILENAME",
+ "Use proxy credentials located in FILENAME",
+ 1,
+ globus_l_wsrf_options_set_proxy_file_name
+ },
+ {
+ "authorization",
+ "z",
+ NULL,
+ "TYPE",
+ "Set authorization mode. TYPE can be 'self', 'host', 'none', or a string "
+ "specifying the identity of the remote party. The default is 'self'.",
+ 1,
+ globus_l_wsrf_options_set_authorization
+ },
+ {
+ "version",
+ "V",
+ NULL,
+ NULL,
+ "Show version information and exit.",
+ 0,
+ globus_l_wsrf_options_set_version
+ },
+ {
+ "versions",
+ NULL,
+ NULL,
+ NULL,
+ "Show version information for all loaded modules and exit.",
+ 0,
+ globus_l_wsrf_options_set_versions
+ },
+ GLOBUS_OPTIONS_END
+};
+#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
1.2 +37 -0 wsrf/c/core/tools/source/globus_i_wsrf_options.h
(In the diff below, changes in quantity of whitespace are not shown.)
Index: globus_i_wsrf_options.h
===================================================================
RCS file: globus_i_wsrf_options.h
diff -N globus_i_wsrf_options.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ globus_i_wsrf_options.h 26 May 2006 16:02:22 -0000 1.2
@@ -0,0 +1,37 @@
+/*
+ * Copyright 1999-2006 University of Chicago
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef GLOBUS_I_WSRF_OPTIONS_H
+#define GLOBUS_I_WSRF_OPTIONS_H 1
+
+#include "globus_wsrf_core_tools.h"
+#include "globus_wsrf_options.h"
+
+typedef struct globus_i_wsrf_options_handle_s
+{
+ const char * application_name;
+ const char * usage;
+ const char * post_banner;
+ const globus_version_t * application_version;
+ wsa_EndpointReferenceType * epr;
+ globus_bool_t debug;
+ globus_soap_message_attr_t attr;
+}
+globus_i_wsrf_options_handle_t;
+
+extern globus_options_entry_t globus_i_wsrf_common_options_table[];
+
+#endif /* GLOBUS_I_WSRF_OPTIONS_H */
1.2 +302 -0 wsrf/c/core/tools/source/globus_wsrf_options.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: globus_wsrf_options.c
===================================================================
RCS file: globus_wsrf_options.c
diff -N globus_wsrf_options.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ globus_wsrf_options.c 26 May 2006 16:02:22 -0000 1.2
@@ -0,0 +1,302 @@
+/*
+ * Copyright 1999-2006 University of Chicago
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "globus_wsrf_options.h"
+#include "globus_wsrf_core_tools.h"
+#include "globus_i_wsrf_options.h"
+
+/**
+ * Initialize a WSRF options parsing handle
+ * @ingroup globus_wsrf_options
+ *
+ * Creates a new handle which will contain state from parsing the command line
+ * options of a program. The handle should be added to a globus_options_handle_t
+ * table by calling globus_wsrf_options_handle_add_to_table() before calling
+ * globus_options_command_line_process(). The a list of ptions which the handle
+ * processes is located \ref globus_wsrf_options_options "here".
+ *
+ * @param handle
+ * Handle to be initialized.
+ * @param application_name
+ * Name of application (for --help message)
+ * @param application_version
+ * Version information about the application (for --version and --versions)
+ * @param usage
+ * Short usage to be printed when --usage or --help are used. The application
+ * name will be prepended to the usage string.
+ * @param post_help_banner
+ * Additional information to be printed after the option list when --help is
+ * used.
+ *
+ * @retval GLOBUS_SUCCESS
+ * Handle initialized
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM
+ * Unable to initialize handle---null parameter.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_OUT_OF_MEMORY
+ * Unable to initialize handle---malloc failed.
+ *
+ * @see globus_wsrf_options_handle_destroy()
+ */
+extern
+globus_result_t
+globus_wsrf_options_handle_init(
+ globus_wsrf_options_handle_t * handle,
+ const char * application_name,
+ globus_version_t * application_version,
+ const char * usage,
+ const char * post_help_banner)
+{
+ globus_result_t result = GLOBUS_SUCCESS;
+ globus_i_wsrf_options_handle_t * new_handle;
+ GlobusFuncName(globus_wsrf_options_handle_init);
+
+ if (handle == NULL)
+ {
+ result = GlobusSoapMessageErrorNullParam;
+
+ goto out;
+ }
+
+ new_handle = malloc(sizeof(globus_i_wsrf_options_handle_t));
+
+ if (new_handle == NULL)
+ {
+ result = GlobusSoapMessageErrorOutOfMemory;
+ goto out;
+ }
+ new_handle->application_name = application_name;
+ new_handle->application_version = application_version;
+ new_handle->epr = NULL;
+ new_handle->debug = GLOBUS_FALSE;
+ new_handle->usage = usage;
+ new_handle->post_banner = post_help_banner;
+
+ result = globus_soap_message_attr_init(&new_handle->attr);
+
+ if (result != GLOBUS_SUCCESS)
+ {
+ free(new_handle);
+ new_handle = NULL;
+ }
+ *handle = new_handle;
+out:
+ return result;
+}
+/* globus_wsrf_options_handle_init() */
+
+/**
+ * Free a WSRF options parsing handle
+ * @ingroup globus_wsrf_options
+ *
+ * Free memory associated with a globus_wsrf_options_handle_t.
+ *
+ * @param handle
+ * Handle to be freed.
+ *
+ * @return void
+ */
+extern
+void
+globus_wsrf_options_handle_destroy(
+ globus_wsrf_options_handle_t handle)
+{
+ if (handle)
+ {
+ globus_soap_message_attr_destroy(handle->attr);
+ free(handle);
+ }
+}
+/* globus_wsrf_options_handle_destroy() */
+
+/**
+ * Get the service EPR specified on the command line.
+ * @ingroup globus_wsrf_options
+ *
+ * After processing command line options, this function will return an
+ * EPR either constructed from the -s and -k options or read from an epr file
+ * specified by the -e option.
+ *
+ * @param handle
+ * Handle to query.
+ * @param epr
+ * Pointer to an EndpointReferenceType which will be set to
+ * contain the new parsed value. Caller must free the contents of this
+ * EPr.
+ *
+ * @retval GLOBUS_SUCCESS
+ * EPR located.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM
+ * Unable to query handle---null parameter.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_OUT_OF_MEMORY
+ * Unable to query handle---malloc failed.
+ *
+ */
+extern
+globus_result_t
+globus_wsrf_options_handle_get_epr(
+ globus_wsrf_options_handle_t handle,
+ wsa_EndpointReferenceType * epr)
+{
+ globus_result_t result = GLOBUS_SUCCESS;
+ GlobusFuncName(globus_wsrf_options_handle_get_epr);
+ if (handle == NULL || epr == NULL || handle->epr == NULL)
+ {
+ result = GlobusSoapMessageErrorNullParam;
+ goto out;
+ }
+ result = wsa_EndpointReferenceType_init_contents(epr);
+ if (result != GLOBUS_SUCCESS)
+ {
+ goto out;
+ }
+ result = wsa_EndpointReferenceType_copy_contents(epr, handle->epr);
+ if (result != GLOBUS_SUCCESS)
+ {
+ wsa_EndpointReferenceType_destroy_contents(epr);
+ }
+out:
+ return result;
+}
+/* globus_wsrf_options_handle_get_epr() */
+
+/**
+ * Get the debug option.
+ * @ingroup globus_wsrf_options
+ *
+ * After processing command line options, this function will return the
+ * debug flag value if it was passed on the command line via -d.
+ *
+ * @param handle
+ * Handle to query.
+ * @param debug
+ * Pointer to a globus_bool_t which will be set to GLOBUS_TRUE if the debug
+ * option was passed on the command line, GLOBUS_FALSE otherwise.
+ *
+ * @retval GLOBUS_SUCCESS
+ * EPR located.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM
+ * Unable to query handle---null parameter.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_OUT_OF_MEMORY
+ * Unable to query handle---malloc failed.
+ */
+extern
+globus_result_t
+globus_wsrf_options_handle_get_debug(
+ globus_wsrf_options_handle_t handle,
+ globus_bool_t * debug)
+{
+ globus_result_t result = GLOBUS_SUCCESS;
+ GlobusFuncName(globus_wsrf_options_handle_get_debug);
+
+ if (handle == NULL || debug == NULL)
+ {
+ result = GlobusSoapMessageErrorNullParam;
+ }
+ else
+ {
+ *debug = handle->debug;
+ }
+
+ return result;
+}
+/* globus_wsrf_options_handle_get_debug() */
+
+/**
+ * Get the SOAP message attrs set by command line options.
+ * @ingroup globus_wsrf_options
+ *
+ * After processing command line options, this function will return a SOAP
+ * message attribute constructed from various command line options. This attribute
+ * will contain security credentials, other security configuration, and
+ * communications settings.
+ *
+ * @param handle
+ * Handle to query.
+ * @param attr
+ * Pointer to a globus_soap_message_attr_t which will be set to a copy
+ * of the attributes which were set by the command-line option processing.
+ * Caller must destroy this attribute set.
+ *
+ * @retval GLOBUS_SUCCESS
+ * Attr copied.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM
+ * Unable to copy attr---null parameter.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_OUT_OF_MEMORY
+ * Unable to copy attr---malloc failed.
+ */
+extern
+globus_result_t
+globus_wsrf_options_handle_get_attr(
+ globus_wsrf_options_handle_t handle,
+ globus_soap_message_attr_t * attr)
+{
+ globus_result_t result = GLOBUS_SUCCESS;
+ GlobusFuncName(globus_wsrf_options_handle_get_attr);
+
+ if (handle == NULL || attr == NULL)
+ {
+ result = GlobusSoapMessageErrorNullParam;
+ }
+ else
+ {
+ result = globus_soap_message_attr_copy(attr, handle->attr);
+ }
+ return result;
+}
+/* globus_wsrf_options_handle_get_attr() */
+
+/**
+ * Add wsrf common arg parsing options to an options handle
+ * @ingroup globus_wsrf_options
+ *
+ * Configures a globus_options handle to process the SOAP client-related
+ * options.
+ *
+ * @param handle
+ * WSRF common options handle to add to wsrf table.
+ * @param options_handle
+ * Options processing handle.
+ *
+ * @retval GLOBUS_SUCCESS
+ * Options configured.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_NULL_PARAM
+ * Unable to set up options---null parameter.
+ * @retval GLOBUS_SOAP_MESSAGE_ERROR_TYPE_OUT_OF_MEMORY
+ * Unable to set up options---malloc failed.
+ */
+extern
+globus_result_t
+globus_wsrf_options_handle_add_to_table(
+ globus_wsrf_options_handle_t handle,
+ globus_options_handle_t options_handle)
+{
+ globus_result_t result = GLOBUS_SUCCESS;
+ GlobusFuncName(globus_wsrf_options_handle_add_to_table);
+
+ if (handle == NULL || options_handle == NULL)
+ {
+ result = GlobusSoapMessageErrorNullParam;
+ }
+ else
+ {
+ result = globus_options_add_table(
+ options_handle,
+ globus_i_wsrf_common_options_table,
+ handle);
+ }
+ return result;
+}
+/* globus_wsrf_options_handle_add_to_table() */
1.2 +77 -0 wsrf/c/core/tools/source/globus_wsrf_options.h
(In the diff below, changes in quantity of whitespace are not shown.)
Index: globus_wsrf_options.h
===================================================================
RCS file: globus_wsrf_options.h
diff -N globus_wsrf_options.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ globus_wsrf_options.h 26 May 2006 16:02:22 -0000 1.2
@@ -0,0 +1,77 @@
+/*
+ * Copyright 1999-2006 University of Chicago
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef GLOBUS_WSRF_OPTIONS_H
+#define GLOBUS_WSRF_OPTIONS_H 1
+
+#include "globus_common.h"
+#include "globus_wsrf_core_tools.h"
+
+/**
+ * @defgroup globus_wsrf_options WSRF Application Common Command-Line Option handling
+ *
+ * Applications which implement WSRF clients can use this library to implement
+ * common arguments to initialize WSRF attributes for such things as the EPR contact
+ * of a service to contact, security attributes, and debugging information. This
+ * API uses the globus_options API to handle general WSRF options.
+ *
+ */
+
+/**
+ * WSRF Options processing handle
+ * @ingroup globus_wsrf_options
+ */
+typedef struct globus_i_wsrf_options_handle_s * globus_wsrf_options_handle_t;
+
+extern
+globus_result_t
+globus_wsrf_options_handle_init(
+ globus_wsrf_options_handle_t * handle,
+ const char * application_name,
+ globus_version_t * application_version,
+ const char * usage,
+ const char * post_help_banner);
+
+extern
+void
+globus_wsrf_options_handle_destroy(
+ globus_wsrf_options_handle_t handle);
+
+extern
+globus_result_t
+globus_wsrf_options_handle_get_epr(
+ globus_wsrf_options_handle_t handle,
+ wsa_EndpointReferenceType * epr);
+
+extern
+globus_result_t
+globus_wsrf_options_handle_get_debug(
+ globus_wsrf_options_handle_t handle,
+ globus_bool_t * debug);
+
+extern
+globus_result_t
+globus_wsrf_options_handle_get_attr(
+ globus_wsrf_options_handle_t handle,
+ globus_soap_message_attr_t * attr);
+
+extern
+globus_result_t
+globus_wsrf_options_handle_add_to_table(
+ globus_wsrf_options_handle_t handle,
+ globus_options_handle_t options_handle);
+
+#endif /* GLOBUS_WSRF_OPTIONS_H */
More information about the cwscore-commit
mailing list