OW_HDBCommon.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright (C) 2001-2004 Vintela, Inc. All rights reserved.
00003 *
00004 * Redistribution and use in source and binary forms, with or without
00005 * modification, are permitted provided that the following conditions are met:
00006 *
00007 *  - Redistributions of source code must retain the above copyright notice,
00008 *    this list of conditions and the following disclaimer.
00009 *
00010 *  - Redistributions in binary form must reproduce the above copyright notice,
00011 *    this list of conditions and the following disclaimer in the documentation
00012 *    and/or other materials provided with the distribution.
00013 *
00014 *  - Neither the name of Vintela, Inc. nor the names of its
00015 *    contributors may be used to endorse or promote products derived from this
00016 *    software without specific prior written permission.
00017 *
00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00019 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 * ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc. OR THE CONTRIBUTORS
00022 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028 * POSSIBILITY OF SUCH DAMAGE.
00029 *******************************************************************************/
00030 
00036 #ifndef OW_HDBCOMMOM_HPP_INCLUDE_GUARD_
00037 #define OW_HDBCOMMOM_HPP_INCLUDE_GUARD_
00038 #include "OW_config.h"
00039 #include "OW_Types.hpp"
00040 #include "OW_Exception.hpp"
00041 #include "OW_CIMProperty.hpp"
00042 #include "OW_Array.hpp"
00043 
00044 #include <cstring>
00045 
00046 namespace OW_NAMESPACE
00047 {
00048 
00049 OW_DECLARE_APIEXCEPTION(HDB, OW_HDB_API)
00050 
00051 #define OW_HDBSIGNATURE "OWHIERARCHICADB"
00052 const int HDBSIGLEN = 16;
00053 
00054 // This should generally be kept in sync with the binary serialization version in OW_BinarySerialization.hpp
00055 // The general idea is to have it be a concatenation of release numbers with
00056 // a revision on the end (to prevent problems during development)
00057 // So 3000003 originated from version 3.0.0 rev 4
00058 //
00059 // 8/21/2003 - Changed from 3000003 to 3000004 because of a change in the 
00060 //   structure of CIMInstance.  The name and alias were removed.  Also
00061 //   changed the length of the signature to 16 so the header block could be
00062 //   aligned easier (and slightly smaller).
00063 // 10/25/2003 - 3000005. Changed enumClassNames to send over an enum of strings
00064 //   instead of object paths.
00065 // 2/6/2004 - 3000006. Changed CIMDateTime::{read,write}Object to write each
00066 //   item individually so struct packing doesn't cause incompatibilities.
00067 // 7/22/2004 - 3000008. Changed signatures and added versioning. Now all
00068 //   readObject() calls will be able to read older versions as well as the
00069 //   current.  Introduced MinBinaryProtocolVersion which is the oldest version
00070 //   we can sucessfully read.
00071 // 9/01/2005 - 4000000. Changed key format to use : instead of / to fix a bug.
00072 // 10/12/2005 - 4000001. Fixed association and instance key format wrt associations.
00073 const UInt32 HDBVERSION = 4000001;
00074 
00075 // This is the oldest version the code can handle.
00076 const UInt32 MinHDBVERSION = 4000001;
00077 
00082 struct OW_HDB_API HDBHeaderBlock
00083 {
00084    char signature[HDBSIGLEN];
00085    UInt32 version;
00086    Int32 firstRoot;
00087    Int32 lastRoot;
00088    Int32 firstFree;
00089 };
00093 struct OW_HDB_API HDBBlock
00094 {
00095    HDBBlock() { memset(this, 0, sizeof(HDBBlock)); }
00096    UInt32 chkSum;    // The check sum of all following fields
00097    unsigned char isFree;   // Node is free block
00098    UInt32 size;            // The size of this block (used in free list)
00099    UInt32 flags;     // User defined flags
00100    Int32 nextSib;          // offset of next sibling node in the file
00101    Int32 prevSib;          // offset of prev sibling node in the file
00102    Int32 parent;           // offset of the parent node in the file
00103    Int32 firstChild;       // offset of the first child node for this node
00104    Int32 lastChild;        // offset of the last child node for this node
00105    UInt32 keyLength;       // length of the key component of the data
00106    UInt32 dataLength;      // length of data not including key
00107    // Data follows
00108    // The data starts with the key, which is a null terminated string.
00109    // The length of the non-key data will be dataLength - keyLength;
00110 };
00111 #define OW_HDBLKSZ sizeof(HDBBlock);
00112 
00114 class HDBUtilKeyArray
00115 {
00116 public:
00117    HDBUtilKeyArray(const CIMPropertyArray& props);
00118    void toString(StringBuffer& out);
00119 private:
00120    CIMPropertyArray m_props;
00121 };
00122 
00123 
00124 
00125 } // end namespace OW_NAMESPACE
00126 
00127 #endif

Generated on Thu Feb 9 08:47:59 2006 for openwbem by  doxygen 1.4.6