1/*
2  Copyright (c) 1990-1999 Info-ZIP.  All rights reserved.
3
4  See the accompanying file LICENSE, version 1999-Oct-05 or later
5  (the contents of which are also included in zip.h) for terms of use.
6  If, for some reason, both of these files are missing, the Info-ZIP license
7  also may be found at:  ftp://ftp.cdrom.com/pub/infozip/license.html
8*/
9#include <sys/types.h>
10#include <sys/stat.h>
11#include <unistd.h>
12
13#include <support/Errors.h>     /* for B_NO_ERROR */
14
15#define USE_EF_UT_TIME          /* Enable use of "UT" extra field time info */
16
17#define EB_L_BE_LEN 5           /* min size is an unsigned long and flag */
18#define EB_C_BE_LEN 5           /* Length of data in local EF and flag.  */
19
20#define EB_BE_FL_NATURAL    0x01    /* data is 'natural' (not compressed) */
21#define EB_BE_FL_BADBITS    0xfe    /* bits currently undefined           */
22
23#ifndef ZP_NEED_MEMCOMPR
24#  define ZP_NEED_MEMCOMPR
25#endif
26
27/* Set a file's MIME type. */
28#define BE_FILE_TYPE_NAME   "BEOS:TYPE"
29void setfiletype( const char *file, const char *type );
30
31/*
32DR9 'Be' extra-field layout:
33
34'Be'      - signature
35ef_size   - size of data in this EF (little-endian unsigned short)
36full_size - uncompressed data size (little-endian unsigned long)
37flag      - flags (byte)
38            flags & EB_BE_FL_NATURAL    = the data is not compressed
39            flags & EB_BE_FL_BADBITS    = the data is corrupted or we
40                                          can't handle it properly
41data      - compressed or uncompressed file attribute data
42
43If flag & EB_BE_FL_NATURAL, the data is not compressed; this optimisation is
44necessary to prevent wasted space for files with small attributes (which
45appears to be quite common on the Advanced Access DR9 release).  In this
46case, there should be ( ef_size - EB_L_BE_LEN ) bytes of data, and full_size
47should equal ( ef_size - EB_L_BE_LEN ).
48
49If the data is compressed, there will be ( ef_size - EB_L_BE_LEN ) bytes of
50compressed data, and full_size bytes of uncompressed data.
51
52If a file has absolutely no attributes, there will not be a 'Be' extra field.
53
54The uncompressed data is arranged like this:
55
56attr_name\0 - C string
57struct attr_info (big-endian)
58attr_data (length in attr_info.size)
59*/
60