2025-09-26 10:57:15 -04:00
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
2025-09-26 13:06:18 -04:00
|
|
|
namespace SabreTools.Data.Models.TAR
|
2025-09-26 10:57:15 -04:00
|
|
|
{
|
2025-10-30 23:45:14 -04:00
|
|
|
/// <see href="https://www.ibm.com/docs/en/aix/7.3?topic=files-tarh-file"/>
|
2025-09-26 10:57:15 -04:00
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
|
|
|
|
public sealed class Header
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// File name without a forward slash
|
|
|
|
|
/// </summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
|
2025-10-31 13:59:28 -04:00
|
|
|
public string FileName = string.Empty;
|
2025-09-26 10:57:15 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// File mode
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>Octal string representation</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
|
2025-10-31 13:59:28 -04:00
|
|
|
public string Mode = string.Empty;
|
2025-09-26 10:57:15 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Owner's numeric user ID
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>Octal string representation</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
|
2025-10-31 13:59:28 -04:00
|
|
|
public string UID = string.Empty;
|
2025-09-26 10:57:15 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Owner's numeric group ID
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>Octal string representation</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
|
2025-10-31 13:59:28 -04:00
|
|
|
public string GID = string.Empty;
|
2025-09-26 10:57:15 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// File size in bytes
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>Octal string representation</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
|
2025-10-31 13:59:28 -04:00
|
|
|
public string Size = string.Empty;
|
2025-09-26 10:57:15 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Last modification time in numeric Unix time format
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>Octal string representation</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)]
|
2025-10-31 13:59:28 -04:00
|
|
|
public string ModifiedTime = string.Empty;
|
2025-09-26 10:57:15 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Checksum for header record
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>Octal string representation</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
|
2025-10-31 13:59:28 -04:00
|
|
|
public string Checksum = string.Empty;
|
2025-09-26 10:57:15 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Link indicator (file type) / Type flag
|
|
|
|
|
/// </summary>
|
|
|
|
|
public TypeFlag TypeFlag;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Linked path name or file name
|
|
|
|
|
/// </summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
|
2025-10-31 13:59:28 -04:00
|
|
|
public string LinkName = string.Empty;
|
2025-09-26 10:57:15 -04:00
|
|
|
|
|
|
|
|
#region USTAR Extension
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// UStar indicator, "ustar"
|
|
|
|
|
/// </summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 5)]
|
|
|
|
|
public string? Magic;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// UStar version, "00"
|
|
|
|
|
/// </summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 3)]
|
|
|
|
|
public string? Version;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Owner user name
|
|
|
|
|
/// </summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
|
|
|
|
public string? UserName;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Owner group name
|
|
|
|
|
/// </summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
|
|
|
|
public string? GroupName;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Device major number
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>Octal string representation(?)</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
|
|
|
|
|
public string? DevMajor;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Device minor number
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>Octal string representation(?)</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
|
|
|
|
|
public string? DevMinor;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Path name without trailing slashes
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>155 bytes</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 155)]
|
|
|
|
|
public string? Prefix;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
2025-10-30 23:45:14 -04:00
|
|
|
}
|