| 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.apache.commons.compress.archivers.cpio; |
| 20 | |
| 21 | /** |
| 22 | * All constants needed by CPIO. |
| 23 | * <p> |
| 24 | * Based on code from the <a href="jrpm.sourceforge.net">jRPM project</a>. |
| 25 | * </p> |
| 26 | * <p> |
| 27 | * A list of the {@code C_xxx} constants is <a href="http://www.opengroup.org/onlinepubs/9699919799/basedefs/cpio.h.html">here</a>. |
| 28 | * </p> |
| 29 | * <p> |
| 30 | * TODO Next major version: Update to a class. |
| 31 | * </p> |
| 32 | */ |
| 33 | public interface CpioConstants { |
| 34 | /** Magic number of a cpio entry in the new format */ |
| 35 | String MAGIC_NEW = "070701"; |
| 36 | |
| 37 | /** Magic number of a cpio entry in the new format with CRC */ |
| 38 | String MAGIC_NEW_CRC = "070702"; |
| 39 | |
| 40 | /** Magic number of a cpio entry in the old ASCII format */ |
| 41 | String MAGIC_OLD_ASCII = "070707"; |
| 42 | |
| 43 | /** Magic number of a cpio entry in the old binary format */ |
| 44 | int MAGIC_OLD_BINARY = 070707; |
| 45 | |
| 46 | /** Write/read a CpioArchiveEntry in the new format. FORMAT_ constants are internal. */ |
| 47 | short FORMAT_NEW = 1; |
| 48 | |
| 49 | /** Write/read a CpioArchiveEntry in the new format with CRC. FORMAT_ constants are internal. */ |
| 50 | short FORMAT_NEW_CRC = 2; |
| 51 | |
| 52 | /** Write/read a CpioArchiveEntry in the old ASCII format. FORMAT_ constants are internal. */ |
| 53 | short FORMAT_OLD_ASCII = 4; |
| 54 | |
| 55 | /** Write/read a CpioArchiveEntry in the old binary format. FORMAT_ constants are internal. */ |
| 56 | short FORMAT_OLD_BINARY = 8; |
| 57 | |
| 58 | /** Mask for both new formats. FORMAT_ constants are internal. */ |
| 59 | short FORMAT_NEW_MASK = 3; |
| 60 | |
| 61 | /** Mask for both old formats. FORMAT_ constants are internal. */ |
| 62 | short FORMAT_OLD_MASK = 12; |
| 63 | |
| 64 | /* |
| 65 | * Constants for the MODE bits |
| 66 | */ |
| 67 | |
| 68 | /** Mask for all file type bits. */ |
| 69 | int S_IFMT = 0170000; |
| 70 | |
| 71 | /** Defines a socket */ |
| 72 | int C_ISSOCK = 0140000; |
| 73 | |
| 74 | /** Defines a symbolic link */ |
| 75 | int C_ISLNK = 0120000; |
| 76 | |
| 77 | /** HP/UX network special (C_ISCTG) */ |
| 78 | int C_ISNWK = 0110000; |
| 79 | |
| 80 | /** Defines a regular file */ |
| 81 | int C_ISREG = 0100000; |
| 82 | |
| 83 | /** Defines a block device */ |
| 84 | int C_ISBLK = 0060000; |
| 85 | |
| 86 | /** Defines a directory */ |
| 87 | int C_ISDIR = 0040000; |
| 88 | |
| 89 | /** Defines a character device */ |
| 90 | int C_ISCHR = 0020000; |
| 91 | |
| 92 | /** Defines a pipe */ |
| 93 | int C_ISFIFO = 0010000; |
| 94 | |
| 95 | /** Sets user ID */ |
| 96 | int C_ISUID = 0004000; |
| 97 | |
| 98 | /** Sets group ID */ |
| 99 | int C_ISGID = 0002000; |
| 100 | |
| 101 | /** On directories, restricted deletion flag. */ |
| 102 | int C_ISVTX = 0001000; |
| 103 | |
| 104 | /** Permits the owner of a file to read the file */ |
| 105 | int C_IRUSR = 0000400; |
| 106 | |
| 107 | /** Permits the owner of a file to write to the file */ |
| 108 | int C_IWUSR = 0000200; |
| 109 | |
| 110 | /** Permits the owner of a file to execute the file or to search the directory */ |
| 111 | int C_IXUSR = 0000100; |
| 112 | |
| 113 | /** Permits a file's group to read the file */ |
| 114 | int C_IRGRP = 0000040; |
| 115 | |
| 116 | /** Permits a file's group to write to the file */ |
| 117 | int C_IWGRP = 0000020; |
| 118 | |
| 119 | /** Permits a file's group to execute the file or to search the directory */ |
| 120 | int C_IXGRP = 0000010; |
| 121 | |
| 122 | /** Permits others to read the file */ |
| 123 | int C_IROTH = 0000004; |
| 124 | |
| 125 | /** Permits others to write to the file */ |
| 126 | int C_IWOTH = 0000002; |
| 127 | |
| 128 | /** Permits others to execute the file or to search the directory */ |
| 129 | int C_IXOTH = 0000001; |
| 130 | |
| 131 | /** The special trailer marker */ |
| 132 | String CPIO_TRAILER = "TRAILER!!!"; |
| 133 | |
| 134 | /** |
| 135 | * The default block size. |
| 136 | * |
| 137 | * @since 1.1 |
| 138 | */ |
| 139 | int BLOCK_SIZE = 512; |
| 140 | } |