/*
 * Portions of this file Copyright 1999-2005 University of Chicago
 * Portions of this file Copyright 1999-2005 The University of Southern California.
 *
 * This file or a portion of this file is licensed under the
 * terms of the Globus Toolkit Public License, found at
 * http://www.globus.org/toolkit/download/license.html.
 * If you redistribute this file, with or without
 * modifications, you must include this notice in the file.
 */


#ifndef _GLOBUS_WSRF_CORE_TOOLS_H_
#define _GLOBUS_WSRF_CORE_TOOLS_H_

#include "globus_common.h"

EXTERN_C_BEGIN

#include "xsd_any.h"
#include "wsa_EndpointReferenceType.h"
#include "globus_service_engine.h"
#include "globus_service_registry.h"
#include "globus_wsrf_resource.h"
#include "globus_service_registry.h"
#include "wsbf_BaseFaultType.h"

extern globus_module_descriptor_t  globus_l_wsrf_core_tools_module;
#define GLOBUS_WSRF_CORE_TOOLS_MODULE &globus_l_wsrf_core_tools_module

enum
{
    GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_INVALID_REF_PROP,
    GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_REF_PROP_WRONG_COUNT,
    GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_NULL_REF_PROP,
    GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_GET_RESOURCE_FAILED,
    GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_EXPORT_FAILED,
    GLOBUS_WSRF_CORE_TOOLS_ERROR_TYPE_IMPORT_FAILED
};

globus_result_t
globus_wsrf_core_create_endpoint_reference(
    globus_service_engine_t             engine,
    const char *                        path,
    xsd_any * *                         resource_id,
    wsa_EndpointReferenceType   *       endpoint_reference);    

globus_result_t
globus_wsrf_core_unwrap_endpoint_reference(
    const char *                        wrapped_uri,
    xsd_QName *                         id_element,
    wsa_EndpointReferenceType   *       endpoint_reference);

globus_result_t
globus_wsrf_core_wrap_endpoint_reference(
    wsa_EndpointReferenceType *         endpoint_reference,
    char **                             wrapped_uri);

globus_result_t
globus_wsrf_core_export_endpoint_reference(
    const wsa_EndpointReferenceType *   endpoint_reference,
    const char *                        filename,
    xsd_QName *                         element);

globus_result_t
globus_wsrf_core_import_endpoint_reference(
    const char *                        filename,
    wsa_EndpointReferenceType **        endpoint_reference,
    xsd_QName *                         element);

globus_result_t
globus_wsrf_core_get_resource(
    globus_soap_message_handle_t        message,
    globus_service_descriptor_t *       service,
    globus_resource_t *                 resource);

globus_result_t
globus_wsrf_core_get_resource_from_epr(
    wsa_EndpointReferenceType *         endpoint_reference,
    globus_resource_t *                 resource);

char *
globus_wsrf_core_export_timestamp(
    xsd_dateTime *                      dt);

xsd_dateTime *
globus_wsrf_core_import_timestamp(
    const char *                        timestamp_string);

globus_object_t *
globus_error_convert_wsrf_fault(
    const wsbf_BaseFaultType *          fault);

EXTERN_C_END

#endif
