    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one
    003 * or more contributor license agreements.  See the NOTICE file
    004 * distributed with this work for additional information
    005 * regarding copyright ownership.  The ASF licenses this file
    006 * to you under the Apache License, Version 2.0 (the
    007 * "License"); you may not use this file except in compliance
    008 * with the License.  You may obtain a copy of the License at
    009 *
    010 * http://www.apache.org/licenses/LICENSE-2.0
    011 *
    012 * Unless required by applicable law or agreed to in writing,
    013 * software distributed under the License is distributed on an
    014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    015 * KIND, either express or implied.  See the License for the
    016 * specific language governing permissions and limitations
    017 * under the License.
    018 */
    019package org.apache.commons.compress.archivers.cpio;
    020
    021/**
    022 * All constants needed by CPIO.
    023 *
    024 * based on code from the jRPM project (jrpm.sourceforge.net)
    025 *
    026 * http://www.opengroup.org/onlinepubs/9699919799/basedefs/cpio.h.html has a list of the C_xxx constants.
    027 */
    028public interface CpioConstants {
    029    /** magic number of a cpio entry in the new format */
    030    String MAGIC_NEW = "070701";
    031
    032    /** magic number of a cpio entry in the new format with crc */
    033    String MAGIC_NEW_CRC = "070702";
    034
    035    /** magic number of a cpio entry in the old ascii format */
    036    String MAGIC_OLD_ASCII = "070707";
    037
    038    /** magic number of a cpio entry in the old binary format */
    039    int MAGIC_OLD_BINARY = 070707;
    040
    041    /** write/read a CpioArchiveEntry in the new format. FORMAT_ constants are internal. */
    042    short FORMAT_NEW = 1;
    043
    044    /** write/read a CpioArchiveEntry in the new format with crc. FORMAT_ constants are internal. */
    045    short FORMAT_NEW_CRC = 2;
    046
    047    /** write/read a CpioArchiveEntry in the old ascii format. FORMAT_ constants are internal. */
    048    short FORMAT_OLD_ASCII = 4;
    049
    050    /** write/read a CpioArchiveEntry in the old binary format. FORMAT_ constants are internal. */
    051    short FORMAT_OLD_BINARY = 8;
    052
    053    /** Mask for both new formats. FORMAT_ constants are internal. */
    054    short FORMAT_NEW_MASK = 3;
    055
    056    /** Mask for both old formats. FORMAT_ constants are internal. */
    057    short FORMAT_OLD_MASK = 12;
    058
    059    /*
    060     * Constants for the MODE bits
    061     */
    062
    063    /** Mask for all file type bits. */
    064    int S_IFMT   = 0170000;
    065
    066    /** Defines a socket */
    067    int C_ISSOCK = 0140000;
    068
    069    /** Defines a symbolic link */
    070    int C_ISLNK  = 0120000;
    071
    072    /** HP/UX network special (C_ISCTG) */
    073    int C_ISNWK  = 0110000;
    074
    075    /** Defines a regular file */
    076    int C_ISREG  = 0100000;
    077
    078    /** Defines a block device */
    079    int C_ISBLK  = 0060000;
    080
    081    /** Defines a directory */
    082    int C_ISDIR  = 0040000;
    083
    084    /** Defines a character device */
    085    int C_ISCHR  = 0020000;
    086
    087    /** Defines a pipe */
    088    int C_ISFIFO = 0010000;
    089
    090
    091    /** Sets user ID */
    092    int C_ISUID  = 0004000;
    093
    094    /** Sets group ID */
    095    int C_ISGID  = 0002000;
    096
    097    /** On directories, restricted deletion flag. */
    098    int C_ISVTX  = 0001000;
    099
    100
    101    /** Permits the owner of a file to read the file */
    102    int C_IRUSR  = 0000400;
    103
    104    /** Permits the owner of a file to write to the file */
    105    int C_IWUSR  = 0000200;
    106
    107    /** Permits the owner of a file to execute the file or to search the directory */
    108    int C_IXUSR  = 0000100;
    109
    110
    111    /** Permits a file's group to read the file */
    112    int C_IRGRP  = 0000040;
    113
    114    /** Permits a file's group to write to the file */
    115    int C_IWGRP  = 0000020;
    116
    117    /** Permits a file's group to execute the file or to search the directory */
    118    int C_IXGRP  = 0000010;
    119
    120
    121    /** Permits others to read the file */
    122    int C_IROTH  = 0000004;
    123
    124    /** Permits others to write to the file */
    125    int C_IWOTH  = 0000002;
    126
    127    /** Permits others to execute the file or to search the directory */
    128    int C_IXOTH  = 0000001;
    129
    130    /** The special trailer marker */
    131    String CPIO_TRAILER = "TRAILER!!!";
    132
    133    /**
    134     * The default block size.
    135     *
    136     * @since 1.1
    137     */
    138    int BLOCK_SIZE = 512;
    139}