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    /** Sets user ID */
091    int C_ISUID = 0004000;
092
093    /** Sets group ID */
094    int C_ISGID = 0002000;
095
096    /** On directories, restricted deletion flag. */
097    int C_ISVTX = 0001000;
098
099    /** Permits the owner of a file to read the file */
100    int C_IRUSR = 0000400;
101
102    /** Permits the owner of a file to write to the file */
103    int C_IWUSR = 0000200;
104
105    /** Permits the owner of a file to execute the file or to search the directory */
106    int C_IXUSR = 0000100;
107
108    /** Permits a file's group to read the file */
109    int C_IRGRP = 0000040;
110
111    /** Permits a file's group to write to the file */
112    int C_IWGRP = 0000020;
113
114    /** Permits a file's group to execute the file or to search the directory */
115    int C_IXGRP = 0000010;
116
117    /** Permits others to read the file */
118    int C_IROTH = 0000004;
119
120    /** Permits others to write to the file */
121    int C_IWOTH = 0000002;
122
123    /** Permits others to execute the file or to search the directory */
124    int C_IXOTH = 0000001;
125
126    /** The special trailer marker */
127    String CPIO_TRAILER = "TRAILER!!!";
128
129    /**
130     * The default block size.
131     *
132     * @since 1.1
133     */
134    int BLOCK_SIZE = 512;
135}