From 6bc948784a8a71f6f32931cbd01cb0e119022f95 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 28 Apr 2024 02:02:58 -0400 Subject: [PATCH] Add PKZIP appendix A and B --- PKZIP/AS400ExtraFieldAttribute.cs | 26 + PKZIP/Enums.cs | 800 +++++++++++++++++++ PKZIP/PolicyKeyDataRecordRecordExtraField.cs | 2 +- PKZIP/ZOSExtraFieldAttribute.cs | 26 + 4 files changed, 853 insertions(+), 1 deletion(-) create mode 100644 PKZIP/AS400ExtraFieldAttribute.cs create mode 100644 PKZIP/ZOSExtraFieldAttribute.cs diff --git a/PKZIP/AS400ExtraFieldAttribute.cs b/PKZIP/AS400ExtraFieldAttribute.cs new file mode 100644 index 0000000..c737d73 --- /dev/null +++ b/PKZIP/AS400ExtraFieldAttribute.cs @@ -0,0 +1,26 @@ +namespace SabreTools.Models.PKZIP +{ + /// + /// AS/400 Extra Field (0x0065) Attribute [APPENDIX A] + /// + /// + public class AS400ExtraFieldAttribute : ExtensibleDataField + { + /// + /// Field length including length + /// + /// Big-endian + public ushort FieldLength { get; set; } + + /// + /// Field code + /// + public AS400ExtraFieldAttributeFieldCode FieldCode { get; set; } + + /// + /// Data + /// + /// Variable byte length based on field code + public byte[]? Data { get; set; } + } +} \ No newline at end of file diff --git a/PKZIP/Enums.cs b/PKZIP/Enums.cs index 068da57..720b8f2 100644 --- a/PKZIP/Enums.cs +++ b/PKZIP/Enums.cs @@ -207,6 +207,87 @@ namespace SabreTools.Models.PKZIP Reserved31 = 0b1000_0000_0000_0000_0000_0000_0000_0000, } + public enum AS400ExtraFieldAttributeFieldCode : ushort + { + /// + /// Source type i.e. CLP etc + /// + SourceType = 0x4001, + + /// + /// The text description of the library + /// + LibraryTextDescription = 0x4002, + + /// + /// The text description of the file + /// + FileTextDescription = 0x4003, + + /// + /// The text description of the member + /// + MemberTextDescription = 0x4004, + + /// + /// x'F0' or 0 is PF-DTA, x'F1' or 1 is PF_SRC + /// + PFType = 0x4005, + + /// + /// Database Type Code + /// + /// 1 byte + DatabaseTypeCode = 0x4007, + + /// + /// Database file and fields definition + /// + DatabaseFileAndFieldsDefinition = 0x4008, + + /// + /// GZIP file type + /// + /// 2 bytes + GZIPFileType = 0x4009, + + /// + /// IFS code page + /// + /// 2 bytes + IFSCodePage = 0x400B, + + /// + /// IFS Time of last file status change + /// + /// 4 bytes + IFSTimeOfLastFileStatusChange = 0x400C, + + /// + /// IFS Access Time + /// + /// 4 bytes + IFSAccessTime = 0x4001, + + /// + /// IFS Modification time + /// + /// 4 bytes + IFSModificationTime = 0x4001, + + /// + /// Length of the records in the file + /// + /// 2 bytes + RecordsLength = 0x4001, + + /// + /// GZIP two words + /// + /// 8 bytes + GZIPTwoWords = 0x4001, + } + public enum CompressionMethod : ushort { /// @@ -920,4 +1001,723 @@ namespace SabreTools.Models.PKZIP value is provided for mainframe data transfer support. */ } + + public enum ZOSExtraFieldAttributeFieldCode : ushort + { + /// + /// File Type + /// + /// 2 bytes + FileType = 0x0001, + + /// + /// NonVSAM Record Format + /// + /// 1 byte + NonVSAMRecordFormat = 0x0002, + + /// + /// Reserved + /// + /// + Reserved03 = 0x0003, + + /// + /// NonVSAM Block Size + /// + /// 2 bytes Big Endian + NonVSAMBlockSize = 0x0004, + + /// + /// Primary Space Allocation + /// + /// 3 bytes Big Endian + PrimarySpaceAllocation = 0x0005, + + /// + /// Secondary Space Allocation + /// + /// 3 bytes Big Endian + SecondarySpaceAllocation = 0x0006, + + /// + /// Space Allocation Type1 byte flag + /// + /// 1 byte + SpaceAllocationType1ByteFlag = 0x0007, + + /// + /// Modification Date + /// + /// Retired with PKZIP 5.0 + + ModificationDate = 0x0008, + + /// + /// Expiration Date + /// + /// Retired with PKZIP 5.0 + + ExpirationDate = 0x0009, + + /// + /// PDS Directory Block Allocation + /// + /// 3 bytes Big Endian binary value + PDSDirectoryBlockAllocation = 0x000A, + + /// + /// NonVSAM Volume List + /// + /// variable + NonVSAMVolumeList = 0x000B, + + /// + /// UNIT Reference + /// + /// Retired with PKZIP 5.0 + + UNITReference = 0x000C, + + /// + /// DF/SMS Management Class + /// + /// 8 bytes EBCDIC Text Value + DFSMSManagementClass = 0x000D, + + /// + /// DF/SMS Storage Class + /// + /// 8 bytes EBCDIC Text Value + DFSMSStorageClass = 0x000E, + + /// + /// DF/SMS Data Class + /// + /// 8 bytes EBCDIC Text Value + DFSMSDataClass = 0x000F, + + /// + /// PDS/PDSE Member Info + /// + /// 30 bytes + PDSPDSEMemberInfo = 0x0010, + + /// + /// VSAM sub-filetype + /// + /// 2 bytes + VSAMSubFiletype = 0x0011, + + /// + /// VSAM LRECL + /// + /// 13 bytes EBCDIC "(num_avg num_max)" + VSAMLRECL = 0x0012, + + /// + /// VSAM Cluster Name + /// + /// Retired with PKZIP 5.0 + + VSAMClusterName = 0x0013, + + /// + /// VSAM KSDS Key Information + /// + /// 13 bytes EBCDIC "(num_length num_position)" + VSAMKSDSKeyInformation = 0x0014, + + /// + /// VSAM Average LRECL + /// + /// 5 bytes EBCDIC num_value padded with blanks + VSAMAverageLRECL = 0x0015, + + /// + /// VSAM Maximum LRECL + /// + /// 5 bytes EBCDIC num_value padded with blanks + VSAMMaximumLRECL = 0x0016, + + /// + /// VSAM KSDS Key Length + /// + /// 5 bytes EBCDIC num_value padded with blanks + VSAMKSDSKeyLength = 0x0017, + + /// + /// VSAM KSDS Key Position + /// + /// 5 bytes EBCDIC num_value padded with blanks + VSAMKSDSKeyPosition = 0x0018, + + /// + /// VSAM Data Name + /// + /// 1-44 bytes EBCDIC text string + VSAMDataName = 0x0019, + + /// + /// VSAM KSDS Index Name + /// + /// 1-44 bytes EBCDIC text string + VSAMKSDSIndexName = 0x001A, + + /// + /// VSAM Catalog Name + /// + /// 1-44 bytes EBCDIC text string + VSAMCatalogName = 0x001B, + + /// + /// VSAM Data Space Type + /// + /// 9 bytes EBCDIC text string + VSAMDataSpaceType = 0x001C, + + /// + /// VSAM Data Space Primary + /// + /// 9 bytes EBCDIC num_value left-justified + VSAMDataSpacePrimary = 0x001D, + + /// + /// VSAM Data Space Secondary + /// + /// 9 bytes EBCDIC num_value left-justified + VSAMDataSpaceSecondary = 0x001E, + + /// + /// VSAM Data Volume List + /// + /// variable EBCDIC text list of 6-character Volume IDs + VSAMDataVolumeList = 0x001F, + + /// + /// VSAM Data Buffer Space + /// + /// 8 bytes EBCDIC num_value left-justified + VSAMDataBufferSpace = 0x0020, + + /// + /// VSAM Data CISIZE + /// + /// 5 bytes EBCDIC num_value left-justified + VSAMDataCISIZE = 0x0021, + + /// + /// VSAM Erase Flag + /// + /// 1 byte flag + VSAMEraseFlag = 0x0022, + + /// + /// VSAM Free CI % + /// + /// 3 bytes EBCDIC num_value left-justified + VSAMFreeCIPercentage = 0x0023, + + /// + /// VSAM Free CA % + /// + /// 3 bytes EBCDIC num_value left-justified + VSAMFreeCAPercentage = 0x0024, + + /// + /// VSAM Index Volume List + /// + /// variable EBCDIC text list of 6-character Volume IDs + VSAMIndexVolumeList = 0x0025, + + /// + /// VSAM Ordered Flag + /// + /// 1 byte flag + VSAMOrderedFlag = 0x0026, + + /// + /// VSAM REUSE Flag + /// + /// 1 byte flag + VSAMREUSEFlag = 0x0027, + + /// + /// VSAM SPANNED Flag + /// + /// 1 byte flag + VSAMSPANNEDFlag = 0x0028, + + /// + /// VSAM Recovery Flag + /// + /// 1 byte flag + VSAMRecoveryFlag = 0x0029, + + /// + /// VSAM WRITECHK Flag + /// + /// 1 byte flag + VSAMWRITECHKFlag = 0x002A, + + /// + /// VSAM Cluster/Data SHROPTS + /// + /// 3 bytes EBCDIC "n,y" + CSAMClusterDataSHROPTS = 0x002B, + + /// + /// VSAM Index SHROPTS + /// + /// 3 bytes EBCDIC "n,y" + VSAMIndexSHROPTS = 0x002C, + + /// + /// VSAM Index Space Type + /// + /// 9 bytes EBCDIC text string + VSAMIndexSpaceType = 0x002D, + + /// + /// VSAM Index Space Primary + /// + /// 9 bytes EBCDIC num_value left-justified + VSAMIndexSpacePrimary = 0x002E, + + /// + /// VSAM Index Space Secondary + /// + /// 9 bytes EBCDIC num_value left-justified + VSAMIndexSpaceSecondary = 0x002F, + + /// + /// VSAM Index CISIZE + /// + /// v + VSAMIndexCISIZE = 0x0030, + + /// + /// VSAM Index IMBED + /// + /// 1 byte flag + VSAMIndexIMBED = 0x0031, + + /// + /// VSAM Index Ordered Flag + /// + /// 1 byte flag + VSAMIndexOrderedFlag = 0x0032, + + /// + /// VSAM REPLICATE Flag + /// + /// 1 byte flag + VSAMREPLICATEFlag = 0x0033, + + /// + /// VSAM Index REUSE Flag + /// + /// 1 byte flag + VSAMIndexREUSEFlag = 0x0034, + + /// + /// VSAM Index WRITECHK Flag + /// + /// 1 byte flag Retired with PKZIP 5.0 + + VSAMIndexWRITECHKFlag = 0x0035, + + /// + /// VSAM Owner + /// + /// 8 bytes EBCDIC text string + VSAMOwner = 0x0036, + + /// + /// VSAM Index Owner + /// + /// 8 bytes EBCDIC text string + VSAMIndexOwner = 0x0037, + + /// + /// Reserved + /// + Reserved38 = 0x0038, + + /// + /// Reserved + /// + Reserved39 = 0x0039, + + /// + /// Reserved + /// + Reserved3A = 0x003A, + + /// + /// Reserved + /// + Reserved3B = 0x003B, + + /// + /// Reserved + /// + Reserved3C = 0x003C, + + /// + /// Reserved + /// + Reserved3D = 0x003D, + + /// + /// Reserved + /// + Reserved3E = 0x003E, + + /// + /// Reserved + /// + ReservedeF = 0x003F, + + /// + /// Reserved + /// + Reserved40 = 0x0040, + + /// + /// Reserved + /// + Reserved41 = 0x0041, + + /// + /// Reserved + /// + Reserved42 = 0x0042, + + /// + /// Reserved + /// + Reserved43 = 0x0043, + + /// + /// Reserved + /// + Reserved44 = 0x0044, + + /// + /// Reserved + /// + Reserved45 = 0x0045, + + /// + /// Reserved + /// + Reserved46 = 0x0046, + + /// + /// Reserved + /// + Reserved47 = 0x0047, + + /// + /// Reserved + /// + Reserved48 = 0x0048, + + /// + /// Reserved + /// + Reserved49 = 0x0049, + + /// + /// Reserved + /// + Reserved4A = 0x004A, + + /// + /// Reserved + /// + Reserved4B = 0x004B, + + /// + /// Reserved + /// + Reserved4C = 0x004C, + + /// + /// Reserved + /// + Reserved4D = 0x004D, + + /// + /// Reserved + /// + Reserved4E = 0x004E, + + /// + /// Reserved + /// + Reserved4F = 0x004F, + + /// + /// Reserved + /// + Reserved50 = 0x0050, + + /// + /// Reserved + /// + Reserved51 = 0x0051, + + /// + /// Reserved + /// + Reserved52 = 0x0052, + + /// + /// Reserved + /// + Reserved53 = 0x0053, + + /// + /// Reserved + /// + Reserved54 = 0x0054, + + /// + /// Reserved + /// + Reserved55 = 0x0055, + + /// + /// Reserved + /// + Reserved56 = 0x0056, + + /// + /// Reserved + /// + Reserved57 = 0x0057, + + /// + /// PDS/PDSE Member TTR Info + /// + /// 6 bytes Big Endian + PDSPDSEMemberTTRInfo = 0x0058, + + /// + /// PDS 1st LMOD Text TTR + /// + /// 3 bytes Big Endian + PDSFirstLMODTextTTR = 0x0059, + + /// + /// PDS LMOD EP Rec # + /// + /// 4 bytes Big Endian + PDSLMODEPRecNum = 0x005A, + + /// + /// Reserved + /// + Reserved5B = 0x005B, + + /// + /// Max Length of records + /// + /// 2 bytes Big Endian + MaxLengthOfRecords = 0x005C, + + /// + /// PDSE Flag + /// + /// 1 byte flag + PDSEFlag = 0x005D, + + /// + /// Reserved + /// + Reserved5E = 0x005E, + + /// + /// Reserved + /// + Reserved5F = 0x005F, + + /// + /// Reserved + /// + Reserved60 = 0x0060, + + /// + /// Reserved + /// + Reserved61 = 0x0061, + + /// + /// Reserved + /// + Reserved62 = 0x0062, + + /// + /// Reserved + /// + Reserved63 = 0x0063, + + /// + /// Reserved + /// + Reserved64 = 0x0064, + + /// + /// Last Date Referenced + /// + /// 4 bytes Packed Hex "yyyymmdd" + LastDateReferenced = 0x0065, + + /// + /// Date Created + /// + /// 4 bytes Packed Hex "yyyymmdd" + DateCreated = 0x0066, + + /// + /// GZIP two words + /// + /// 8 bytes + GZIPTwoWords = 0x0068, + + /// + /// Extended NOTE Location + /// + /// 12 bytes Big Endian + ExtendedNOTELocation = 0x0071, + + /// + /// Archive device UNIT + /// + /// 6 bytes EBCDIC + ArchiveDeviceUNIT = 0x0072, + + /// + /// Archive 1st Volume + /// + /// 6 bytes EBCDIC + ArchiveFirstVolume = 0x0073, + + /// + /// Archive 1st VOL File Seq# + /// + /// 2 bytes Binary + ArchiveFirstVolFileSeqNum = 0x0074, + + /// + /// Native I/O Flags + /// + /// 2 bytes + NativeIOFlags = 0x0075, + + /// + /// Unix File Type + /// + /// 1 byte enumerated + UnixFileType = 0x0081, + + /// + /// Unix File Format + /// + /// 1 byte enumerated + UnixFileFormat = 0x0082, + + /// + /// Unix File Character Set Tag Info + /// + /// 4 bytes + UnixFileCharacterSetTagInfo = 0x0083, + + /// + /// ZIP Environmental Processing Info + /// + /// 4 bytes + ZIPEnvironmentalProcessingInfo = 0x0090, + + /// + /// EAV EATTR Flags + /// + /// 1 byte + EAVEATTRFlags = 0x0091, + + /// + /// DSNTYPE Flags + /// + /// 1 byte + DSNTYPEFlags = 0x0092, + + /// + /// Total Space Allocation (Cyls) + /// + /// 4 bytes Big Endian + TotalSpaceAllocationCyls = 0x0093, + + /// + /// NONVSAM DSORG + /// + /// 2 bytes + NONVSAMDSORG = 0x009D, + + /// + /// Program Virtual Object Info + /// + /// 3 bytes + ProgramVirtualObjectInfo = 0x009E, + + /// + /// Encapsulated file Info + /// + /// 9 bytes + EncapsulatedFileInfo = 0x009F, + + /// + /// Cluster Log + /// + /// 4 bytes Binary + ClusterLog = 0x00A2, + + /// + /// Cluster LSID Length + /// + /// 4 bytes Binary + ClusterLSIDLength = 0x00A3, + + /// + /// Cluster LSID + /// + /// 26 bytes EBCDIC + ClusterLSID = 0x00A4, + + /// + /// Unix File Creation Time + /// + /// 4 bytes + UnixFileCreationTime = 0x400C, + + /// + /// Unix File Access Time + /// + /// 4 bytes + UnixFileAccessTime = 0x400D, + + /// + /// Unix File Modification time + /// + /// 4 bytes + UnixFileModificationTime = 0x400E, + + /// + /// IBMCMPSC Compression Info + /// + /// variable + IBMCMPSCCompressionInfo = 0x4101, + + /// + /// IBMCMPSC Compression Size + /// + /// 8 bytes Big Endian + IBMCMPSCCompressionSize = 0x4102, + } } \ No newline at end of file diff --git a/PKZIP/PolicyKeyDataRecordRecordExtraField.cs b/PKZIP/PolicyKeyDataRecordRecordExtraField.cs index aec56b4..60c6f1a 100644 --- a/PKZIP/PolicyKeyDataRecordRecordExtraField.cs +++ b/PKZIP/PolicyKeyDataRecordRecordExtraField.cs @@ -1,7 +1,7 @@ namespace SabreTools.Models.PKZIP { /// - /// TThe following is the layout of the Policy Key Data "extra" block. + /// The following is the layout of the Policy Key Data "extra" block. /// TData is a variable length, variable content field. It holds /// information about encryptions and/or encryption key sources. /// Contact PKWARE for information on current TData structures. diff --git a/PKZIP/ZOSExtraFieldAttribute.cs b/PKZIP/ZOSExtraFieldAttribute.cs new file mode 100644 index 0000000..71f2460 --- /dev/null +++ b/PKZIP/ZOSExtraFieldAttribute.cs @@ -0,0 +1,26 @@ +namespace SabreTools.Models.PKZIP +{ + /// + /// z/OS Extra Field (0x0065) Attribute [APPENDIX B] + /// + /// + public class ZOSExtraFieldAttribute : ExtensibleDataField + { + /// + /// Field length including length + /// + /// Big-endian + public ushort FieldLength { get; set; } + + /// + /// Field code + /// + public ZOSExtraFieldAttributeFieldCode FieldCode { get; set; } + + /// + /// Data + /// + /// Variable byte length based on field code + public byte[]? Data { get; set; } + } +} \ No newline at end of file