(file) Return to WsmUtils.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / WsmServer

File: [Pegasus] / pegasus / src / Pegasus / WsmServer / WsmUtils.cpp (download)
Revision: 1.2, Tue Apr 29 19:40:16 2008 UTC (16 years, 2 months ago) by kumpf
Branch: MAIN
CVS Tags: TASK_PEP328_SOLARIS_NEVADA_PORT, TASK-PEP328_SOLARIS_NEVADA_PORT_v2-root, TASK-PEP328_SOLARIS_NEVADA_PORT_v2-branch, TASK-PEP328_SOLARIS_NEVADA_PORT-root, TASK-PEP328_SOLARIS_NEVADA_PORT-branch, TASK-PEP328_SOLARIS_IX86_CC_PORT-root, TASK-PEP328_SOLARIS_IX86_CC_PORT-branch-v2, TASK-PEP328_SOLARIS_IX86_CC_PORT-branch, TASK-PEP311_WSMan-root, TASK-PEP311_WSMan-branch, RELEASE_2_8_2-RC1, RELEASE_2_8_2, RELEASE_2_8_1-RC1, RELEASE_2_8_1, RELEASE_2_8_0_BETA, RELEASE_2_8_0-RC2, RELEASE_2_8_0-RC1, RELEASE_2_8_0-FC, RELEASE_2_8_0, RELEASE_2_8-root, RELEASE_2_8-branch
Changes since 1.1: +175 -0 lines
BUG#: 7610
TITLE: PEP 311 WS-Management Support in CIM Server
DESCRIPTION: Implement WS-Management protocol for WS-Transfer operations.

//%2006////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation, The Open Group.
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; Symantec Corporation; The Open Group.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//=============================================================================
//
//%////////////////////////////////////////////////////////////////////////////

#include <Pegasus/Common/String.h>
#include <Pegasus/Common/PegasusAssert.h>
#include "WsmUtils.h"

PEGASUS_NAMESPACE_BEGIN

XmlNamespace WsmNamespaces::supportedNamespaces[] =
{
    {
        "SOAP-ENV",
        "http://www.w3.org/2003/05/soap-envelope",
        SOAP_ENVELOPE,
        0
    },
    {
        "SOAP-ENC",
        "http://www.w3.org/2003/05/soap-encoding",
        SOAP_ENCODING,
        0
    },
    {
        "xml",
        "http://www.w3.org/XML/1998/namespace",
        XML_NAMESPACE,
        0
    },
    {
        "xsi",
        "http://www.w3.org/2001/XMLSchema-instance",
        XML_SCHEMA_INSTANCE,
        0
    },
    {
        "xsd",
        "http://www.w3.org/2001/XMLSchema",
        XML_SCHEMA,
        0
    },
    {
        "wsman",
        "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd",
        WS_MAN,
        0
    },
    {
        "wsmb",
        "http://schemas.dmtf.org/wbem/wsman/1/cimbinding.xsd",
        WS_CIM_BINDING,
        0
    },
    {
        "wsa",
        "http://schemas.xmlsoap.org/ws/2004/08/addressing",
        WS_ADDRESSING,
        0
    },
    {
        "wxf",
        "http://schemas.xmlsoap.org/ws/2004/09/transfer",
        WS_TRANSFER,
        0
    },
    {
        "wsen",
        "http://schemas.xmlsoap.org/ws/2004/09/enumeration",
        WS_ENUMERATION,
        0
    },
    {
        "wse",
        "http://schemas.xmlsoap.org/ws/2004/08/eventing",
        WS_EVENTING,
        0
    },
    {
        "wsp",
        "http://schemas.xmlsoap.org/ws/2004/09/policy",
        WS_POLICY,
        0
    },
    {
        "wsdl",
        "http://schemas.xmlsoap.org/wsdl",
        WSDL,
        0
    },
    {
        "wscim",
        "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2",
        WS_CIM_SCHEMA,
        0
    },
    {0, 0, LAST, 0}
};


String WsmUtils::getMessageId()
{
    // DSP0226 R5.4.4-1: The MessageID and RelatesTo URIs may be of any format,
    // as long as they are valid URIs according to RFC 3986.  Two URIs are
    // considered different even if the characters in the URIs differ only by
    // case.
    //
    // The following two formats are endorsed by this specification.  The first
    // is considered a best practice because it is backed by IETF RFC 4122:
    //     urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    //     or
    //     uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
    //
    // In these formats, each x is an uppercase or lowercase hexadecimal digit
    // (lowercase is required by RFC 4122); there are no spaces or other
    // tokens.  The value may be a DCE-style universally unique identifier
    // (UUID) with provable uniqueness properties in this format, however, it
    // is not necessary to have provable uniqueness properties in the URIs
    // used in the wsa:MessageID and wsa:RelatesTo headers.
    //
    // Regardless of format, the URI should not exceed the maximum defined in
    // R13.1-6. [sic]

    // DSP0226 R5.4.4-2: The MessageID should be generated according to any
    // algorithm that ensures that no two MessageIDs are repeated.  Because
    // the value is treated as case-sensitive (R5.4.4-1), confusion can arise
    // if the same value is reused differing only in case.  As a result, the
    // service shall not create or employ MessageID values that differ only in
    // case.  For any message transmitted by the service, the MessageID shall
    // not be reused.

    // Note: This algorithm could be improved, but provable uniqueness is not
    // required (see above).

    char uuid[42];
    sprintf(uuid, "uuid:%08X-%04X-%04X-%04X-%08X%04X",
        rand(),
        rand() & 0xFFFF,
        rand() & 0xFFFF,
        rand() & 0xFFFF,
        rand(),
        rand() & 0xFFFF);
    return String(uuid, 41);
}

PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2