//-*-c++-*--------------------------------------------------------------
//  nsrStat.cpp
//   Defines statics needed by UDF.
//
//   This file should be edited by every using implementation, and
//   their own registration number declared, etc.
//
//      Unpublished Confidential Information of Hewlett-Packard
//      Company. Do not disclose.  Copyright (c) Hewlett-Packard
//      Company 1995. All rights reserved
// 
// The contents of this software are proprietary and confidential to
// the Hewlett- Packard Company, and are limited in distribution to
// those with a direct need to know.  Individuals having access to
// this software are responsible for maintaining the confidentiality
// of the content and for keeping the software secure when not in use.
// Transfer to any party is strictly forbidden other than as expressly
// permitted in writing by Hewlett-Packard Company.  Unauthorized
// transfer to or possession by any unauthorized party may be a
// criminal offense.
//
//                  RESTRICTED RIGHTS LEGEND
//
//      Use,  duplication,  or disclosure by the U. S. Government is
//      subject to restrictions as set forth in subparagraph (c) (1)
//      (ii) in the Rights in Technical Data and Computer Software
//      clause in DFARS 252.227-7013 or any other successor clause.
//
//                      HEWLETT-PACKARD COMPANY
//                      3000 Hanover St.
//                      Palo Alto, CA  94304 U.S.A.
//
//      Rights for non-DOD U.S. Government Departments and Agencies
//      are as set forth in FAR 52.227-19 (c) (1,2) or any other
//      successor clause.
//
//----------------------------------------------------------------------
//
// $Source: /projects/HMS/nsr/udfCore/config/nsrStat.cpp,v $
// $Revision: 1.5 $     $Author: hmgr $
// $State: Exp $        $Locker:  $
// $Date: 96/05/28 15:55:40 $
//

#include "nsrLib.h"

//----------------------------------------------------------------------
//               ************ WARNING *****************
//
//  This file should not be modified. Tampering with this file MAY
//  make the code non-UDF-compliant. If the values shown here do not
//  match what is desired, then the appropriate statics must be
//  changed in some other scope. This is provided in order to give
//  examples of using and to provide documentation about the different
//  statics.
//
//               ************ WARNING *****************
//----------------------------------------------------------------------

//----------------------------------------------------------------------
// IMPLEMENTATION REGISTRATION INFORMATION
//      
//  The following statics MUST be instantiated somewhere by the using
//  implementation. HP mandates that each user properly initializes
//  the implRegNo to its assigned value, but the implVersion and
//  implRevision fields are for the implementation's use only.
//
//  See the documentation for the UserRegistration enum for
//  a list of currently registration numbers.
// 
//  Users may use the following definitions used for testing by HP as
//  examples of how to instantiate and initialize these statics:
//
//----------------------------------------------------------------------

#if defined(DESCRTEST) | defined(SSTEST) | defined(MSTEST)
NSR::UINT16 NSR::ImplRegID::UserRegNo     = ureg_HP_Test;
NSR::UINT8  NSR::ImplRegID::UserVersion   = 1; // Might as well for now
NSR::UINT8  NSR::ImplRegID::UserRevision  = 0; // Might as well for now
#endif // DESCRTEST | SSTEST | MSTEST

//----------------------------------------------------------------------
// BACKWARD COMPATIBILITY STATICS
//      
//  These statics provided ONLY to be able to recognize volumes
//  written by older pre-UDF HP products.
//
//----------------------------------------------------------------------

NSR::String NSR::DomainRegID::HPEarlyID1 ( "*OSTA Compliant HP 1.00" );
NSR::String NSR::DomainRegID::HPEarlyID2 ( "*OSTA Compliant HP 1.02" );
NSR::String NSR::ImplRegID::  HPEarlyID  ( "HP NSR File Format - MV" );

//----------------------------------------------------------------------
// CURRENT DESCRIPTOR STATICS
//      
//  These statics are used to fill in different fields of different
//  descriptors when we construct them and/or write them.
//
//----------------------------------------------------------------------

NSR::String NSR::DomainRegID::OSTAID    ( "*OSTA UDF Compliant" );
NSR::UINT16 NSR::DomainRegID::OSTARev   = 0x0100; // Used by OSTARegID
                                                  // also 
NSR::String NSR::OSTAVolumeDesc::UDFLVInfoID ( "*UDF LV Info" );

NSR::UINT8  NSR::CharSpec::OSTAType = 0;
NSR::String NSR::CharSpec::OSTAInfo = ( "OSTA Compressed Unicode" );

//----------------------------------------------------------------------
// DESCRIPTOR VERSION STATICS
//
// All descriptors with an ImplRegID field contain an 8-bit field
// which can hold the version of that descriptor. This is provided in
// case we need to support changes to the definitions of the
// implementation-use fields in these descriptors.
//
// As of 5/96, only the LVID supports more than one version.
//
// The following statics contain default values of each descriptor's
// version, and may thus be changed by the user at any time. These
// values are used by their descriptors at construction time, and upon
// a call to the Descriptor's clear() method.
//
//----------------------------------------------------------------------

NSR::UINT8  NSR::PrimaryVolumeDesc::          descVersion_ = 0;
NSR::UINT8  NSR::PartitionDesc::              descVersion_ = 0;
NSR::UINT8  NSR::ImplementUseVolumeDesc::     descVersion_ = 0;
NSR::UINT8  NSR::OSTAVolumeDesc::             descVersion_ = 0;
NSR::UINT8  NSR::LogicalVolumeDesc::          descVersion_ = 0;
NSR::UINT8  NSR::LogicalVolumeIntegrityDesc:: descVersion_ = 1;
NSR::UINT8  NSR::FileEntry::                  descVersion_ = 0;
NSR::UINT8  NSR::FileIdentifierDesc::         descVersion_ = 0;

//----------------------------------------------------------------------
// DESCRIPTOR READING STATICS
//      
//  These statics indicate how on-disk structures are to be
//  interpreted. The default values are supplied here, but the value
//  may be modified, based upon what is found on the disk.
//
//  NOTE that both of the following are modifiable via static methods
//  of each of the descriptors.
//
//      FileIdentifierDesc::readCSType_
//      PathComponent::     readCSType_
//
//----------------------------------------------------------------------

NSR::CharSetType NSR::FileIdentifierDesc::readCSType_ = charset_OCU;
NSR::CharSetType NSR::PathComponent::     readCSType_ = charset_OCU;

//----------------------------------------------------------------------
// MULTI-SURFACE OR SINGLE SURFACE
//      
//  These statics specify whether the multi-surface or the
//  single-surface versions of the toolkit are being used.
//
//   NSR::ImplRegID::HPID
//   NSR::ImplRegID::HPVersion
//
//  Note that they are declared in config/nsrCfg.h.
//
//  This handles the three cases:
//
//     Multi-Surface
//     Single Surface
//     Descriptor Testing (Neither MS nor SS)
//
//----------------------------------------------------------------------

#ifdef _INCL_MSOBJS_
NSR::String NSR::ImplRegID::HPID      ( "HP UDF Tools (Archive)" );
NSR::UINT8  NSR::ImplRegID::HPVersion = 0;
#endif // _INCL_MSOBJS_

#ifdef _INCL_SSOBJS_
NSR::String NSR::ImplRegID::HPID      ( "HP UDF Tools" );
NSR::UINT8  NSR::ImplRegID::HPVersion = 0;
#endif // _INCL_SSOBJS_

#ifdef DESCRTEST
NSR::String NSR::ImplRegID::HPID      ( "HP UDF Tools (Test)" );
NSR::UINT8  NSR::ImplRegID::HPVersion = 0;
#endif // DESCRTEST

//----------------------------------------------------------------------
// PLATFORM-SPECIFIC CONFIGURATIONS
//
//  This defines the appropriate statics based upon PLATFORM defines. 
//
//  For different options available, see documentation for
//  OSIdentifier and OSClass enums.
//
//----------------------------------------------------------------------

#ifdef DOS_PLATFORM
  NSR::UINT8  NSR::OSTARegID::writeOSClass      = osclass_DOS;
  NSR::UINT8  NSR::OSTARegID::writeOSIdentifier = osid_Generic;
#endif //DOS_PLATFORM          
                               
#ifdef WINDOWS_PLATFORM        
  NSR::UINT8  NSR::OSTARegID::writeOSClass      = osclass_DOS1;
  NSR::UINT8  NSR::OSTARegID::writeOSIdentifier = osid_Generic;
#endif //WINDOWS_PLATFORM      
                               
#ifdef OS2_PLATFORM            
  NSR::UINT8  NSR::OSTARegID::writeOSClass      = osclass_OS2;
  NSR::UINT8  NSR::OSTARegID::writeOSIdentifier = osid_Generic;
#endif //OS2_PLATFORM          
                               
#ifdef MAC_PLATFORM            
  NSR::UINT8  NSR::OSTARegID::writeOSClass      = osclass_Macintosh;
  NSR::UINT8  NSR::OSTARegID::writeOSIdentifier = osid_Generic;
#endif //MAC_PLATFORM          
                               
#ifdef UNIX_PLATFORM           
  NSR::UINT8  NSR::OSTARegID::writeOSClass      = osclass_Unix;
  NSR::UINT8  NSR::OSTARegID::writeOSIdentifier = osid_Generic;

  #ifdef HP_UX_PLATFORM   
    NSR::UINT8  NSR::OSTARegID::writeOSIdentifier = osid_HP_UX;
  #endif //HP_UX_PLATFORM   

  #ifdef AIX_PLATFORM     
    NSR::UINT8  NSR::OSTARegID::writeOSIdentifier = osid_IBM_AIX;
  #endif //AIX_PLATFORM     

  #ifdef SOLARIS_PLATFORM 
    NSR::UINT8  NSR::OSTARegID::writeOSIdentifier = osid_SUN_Solaris;
  #endif //SOLARIS_PLATFORM 

  #ifdef IRIX_PLATFORM    
    NSR::UINT8  NSR::OSTARegID::writeOSIdentifier = osid_SGI_Irix;
  #endif //IRIX_PLATFORM    
#endif //UNIX_PLATFORM

//----------------------------------------------------------------------
// LEGACY IMPLEMENTATION INFORMATION
//
// Here is a history of what all HP has shipped in its products:
//
// Description of different Domains:
//
// "*OSTA Compliant HP 1.00"
//
//     ImplRegID:
//      - implementID  : "HP NSR File Format - MV"
//      - librVersion  : 0
//      - implRegNo    : 0x0000
//      - implVersion  : 1
//      - implRevision : 0
//
//     Known ISO non-conformance:
//      - Parent bit not set in parent FID characteristics field.
//      - Terminating descriptor not written after FSD in FSDS.
//      - Character Sets set to 2,3,&8, although not enforced.
//        Therefore, may generate disks with FIDs with illegal characters.
//     Known OSTA non-conformance:
//      - Character Set are 2,3, and 8. Should be 0 only.
//      - VolumeSetIdentifier does NOT have unique first 16
//        characters.
//      - Does not write OSTAVolumeDesc on every surface.
//      - FSDS is 10 sectors long (OSTA: == 1 (rw))
//      - Integrity Sequence 1 sector long (OSTA: >= 8KB.)
//      - AD Extent Types in USE (FST, UST) are Unallocated (OSTA:
//        Allocated)
//      - NSR::osClass is set at 5 (OSTA: 4)
//
// "*OSTA Compliant HP 1.01"
//
//     ImplRegID:
//      - implementID  : "HP NSR File Format - MV"
//      - librVersion  : 0
//      - implRegNo    : 0x0000
//      - implVersion  : 1
//      - implRevision : 1
//
//     Fixes:
//      - Parent bit correctly set in parent FID characteristics
//        field. 
//      - Terminating descriptor properly written after FSD in FSDS.
//     Known ISO non-conformance:
//      - Character Sets set to 2,3,&8, although not enforced.
//        Therefore, may generate disks with FIDs with illegal characters.
//     Known OSTA non-conformance:
//      - Character Set are 2,3, and 8. Should be 0 only.
//      - Does not write OSTAVolumeDesc on every surface.
//      - VolumeSetIdentifier does NOT have unique first 16 characters.
//      - FSDS is 10 sectors long (OSTA: == 1 (rw))
//      - Integrity Sequence 1 sector long (OSTA: >= 8KB.)
//      - AD Extent Types in USE (FST, UST) are Unallocated (OSTA:
//        Allocated)
//      - NSR::osClass is set at 5 (OSTA: 4)
//
// "*OSTA Compliant HP 1.02"  (released with maestro-sunspot, jan '95)
//
//   * means that fix is in Archive object.
//
//     ImplRegID:
//      - implementID  : "HP NSR File Format - MV"
//      - librVersion  : 0
//      - implRegNo    : 0x0000
//      - implVersion  : 1
//      - implRevision : 2
//
//     Fixes:
//      - Character Sets set to 0.
//      - NSR::osClass set to 4.
//     Known ISO non-conformance:
//     Known OSTA non-conformance:
// *    - VolumeSetIdentifier does NOT have unique first 16
//        characters.
// *    - Does not write OSTAVolumeDesc on every surface.
//      - Character Set Info field not set to OSTA-specified value.
// *    - FSDS is 10 sectors long (OSTA: == 1 (rw))
// *    - Integrity Sequence 1 sector long (OSTA: >= 8KB.)
//      - AD Extent Types in USE (FST, UST) are Unallocated (OSTA:
//        Allocated)
//      - Character Sets Information field set to "OSTA HP-0" (OSTA:
//        TBD)
//
// "*OSTA Compliant HP 1.03" (to be released with ??)
//
//   * means that fix is in Archive object.
//
//     ImplRegID:
//      - implementID  : "HP NSR File Format - MV"
//      - librVersion  : 0
//      - implRegNo    : 0x0000
//      - implVersion  : 1
//      - implRevision : 3
//
//     Fixes:
// *    - AD Extent Types in USE (FST, UST) are Allocated (OSTA:
//        Allocated)
//      - VolumeSetIdentifier has unique first 16 characters.
// *    - UnallocSpaceTable Entry length = logicalBlockSize for Rewritable.
// *    - descVersionLVID = 1;  icb table an extended attribute of root icb
//
//----------------------------------------------------------------------
