home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / rfc / rfc1740 < prev    next >
Text File  |  1994-12-29  |  31KB  |  900 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                   Patrik Faltstrom
  8. Request for Comments: 1740                 Royal Institute of Technology
  9. Category: Standards Track                                   Dave Crocker
  10.                                                   Brandenburg Consulting
  11.                                                             Erik E. Fair
  12.                                                      Apple Computer Inc.
  13.                                                            December 1994
  14.  
  15.  
  16.             MIME Encapsulation of Macintosh files - MacMIME
  17.  
  18. Status of this Memo
  19.  
  20.    This document specifies an Internet standards track protocol for the
  21.    Internet community, and requests discussion and suggestions for
  22.    improvements.  Please refer to the current edition of the "Internet
  23.    Official Protocol Standards" (STD 1) for the standardization state
  24.    and status of this protocol.  Distribution of this memo is unlimited.
  25.  
  26. Abstract
  27.  
  28.    This memo describes the format to use when sending Apple Macintosh
  29.    files via MIME [BORE93].  The format is compatible with existing
  30.    mechanisms for distributing Macintosh files, while allowing non-
  31.    Macintosh systems access to data in standardized formats.
  32.  
  33. 2.  Introduction
  34.  
  35.    Files on the Macintosh consists of two parts, called forks:
  36.  
  37.    Data fork:       The actual data included in the file.  The Data
  38.                     fork is typically the only meaningful part of a
  39.                     Macintosh file on a non-Macintosh computer system.
  40.                     For example, if a Macintosh user wants to send a
  41.                     file of data to a user on an IBM-PC, she would only
  42.                     send the Data fork.
  43.  
  44.    Resource fork:   Contains a collection of arbitrary attribute/value
  45.                     pairs, including program segments, icon bitmaps,
  46.                     and parametric values.
  47.  
  48.    Additional information regarding Macintosh files is stored by the
  49.    Finder in a hidden file, called the "Desktop Database".
  50.  
  51.    Because of the complications in storing different parts of a
  52.    Macintosh file in a non-Macintosh filesystem that only handles
  53.    consecutive data in one part, it is common to convert the Macintosh
  54.    file into some other format before transferring it over the network.
  55.  
  56.  
  57.  
  58. Faltstrom, Crocker & Fair                                       [Page 1]
  59.  
  60. RFC 1740                  MIME-based Mac files             December 1994
  61.  
  62.  
  63.    The two styles of use are [APPL90]:
  64.  
  65.    AppleSingle:   Apple's standard format for encoding Macintosh files
  66.                   as one byte stream.
  67.    AppleDouble:   Similar to AppleSingle except that the Data fork is
  68.                   separated from the Macintosh-specific parts by the
  69.                   AppleDouble encoding.
  70.  
  71.    AppleDouble is the preferred format for a Macintosh file that is to
  72.    be included in an Internet mail message, because it provides
  73.    recipients with Macintosh computers the entire document, including
  74.    Icons and other Macintosh specific information, while other users
  75.    easily can extract the Data fork (the actual data) as it is separated
  76.    from the AppleDouble encoding.
  77.  
  78. 2.  MIME format for Apple/Macintosh-specific file information
  79.  
  80.    2a.  APPLICATION/APPLEFILE
  81.  
  82.       MIME type-name:            APPLICATION
  83.       MIME subtype name:         APPLEFILE
  84.       Required parameters:       none
  85.       Optional parameters:       NAME, which must be a "value" as
  86.                                  defined in RFC-1521 [BORE93].
  87.       Encoding considerations:   The presence of binary data will
  88.                                  typically require use of
  89.                                  Content-Transfer-Encoding: BASE64
  90.       Security considerations:   See separate section in the document
  91.       Published specification:   Apple-single & Apple-double [APPL90]
  92.       Rationale:                 Permits MIME-based transmission of
  93.                                  data with Apple/Macintosh specific
  94.                                  information, while allowing general
  95.                                  access to non-specific user data.
  96.  
  97.    2b.  MULTIPART/APPLEDOUBLE
  98.  
  99.       MIME type-name:            MULTIPART
  100.       MIME subtype name:         APPLEDOUBLE
  101.       Required parameters:       none
  102.       Optional parameters:       NAME, which must be a "value" as
  103.                                  defined in RFC-1521 [BORE93].
  104.       Encoding considerations:   none
  105.       Security considerations:   See separate section in the document
  106.       Published specification:   Apple-single & Apple-double [APPL90]
  107.       Rationale:                 Permits MIME-based transmission of
  108.                                  data with Apple/Macintosh specific
  109.                                  information, while allowing general
  110.                                  access to non-specific user data.
  111.  
  112.  
  113.  
  114. Faltstrom, Crocker & Fair                                       [Page 2]
  115.  
  116. RFC 1740                  MIME-based Mac files             December 1994
  117.  
  118.  
  119.    2c.  Detail specific to MIME-based usage
  120.  
  121.       Macintosh documents do not always need to be sent in a special
  122.       format.  Those documents with well-known MIME types and
  123.       non-existent or trivial resource forks can be sent as regular
  124.       MIME body parts, without use of AppleSingle or AppleDouble.
  125.  
  126.       Documents which lack a data fork must be sent as AppleSingle.
  127.  
  128.       Unless there are strong reasons not to, all other documents
  129.       should normally be sent as AppleDouble.  This includes documents
  130.       with non-trivial resource forks, and documents without
  131.       corresponding well-known MIME types.
  132.  
  133.       It may be valuable in some cases to allow the user to choose one
  134.       format over another, either because he disagrees with the
  135.       implementor's definition of "trivial" resource forks, or for
  136.       reasons of his own.
  137.  
  138. 3.  AppleSingle
  139.  
  140.    An AppleSingle, version 2 file, is sent as one consecutive stream of
  141.    bytes.  The format is described in [APPL90] with a brief summary in
  142.    Appendix A. The one and only part of the file is sent in an
  143.    application/applefile message.
  144.  
  145.    The first four bytes of an AppleSingle header are, in hexadecimal:
  146.    00, 05, 16, 00.
  147.  
  148.    The AppleSingle file is binary data.  Hence, it may be necessary to
  149.    perform a Content-Transfer-Encoding for transmission, depending on
  150.    the underlying email transport environment.  The safest encoding is
  151.    Base64, since it permits transfer over the most restricted channels.
  152.  
  153.    Even though an AppleSingle file includes the original Macintosh
  154.    filename, it is recommended that a name parameter be included on the
  155.    Content-Type header to give the recipient a hint as to what file is
  156.    attached.  The value of the name parameter must be a "value" as
  157.    defined by RFC-1521 [BORE93].  Note that this restricts the value to
  158.     seven-bit US-ASCII characters.
  159.  
  160.    3a.  AppleSingle example
  161.  
  162.       Content-Type: application/applefile; name="Computers-1/2-93"
  163.  
  164.           [The AppleSingle file goes here]
  165.  
  166. 4.  AppleDouble
  167.  
  168.  
  169.  
  170. Faltstrom, Crocker & Fair                                       [Page 3]
  171.  
  172. RFC 1740                  MIME-based Mac files             December 1994
  173.  
  174.  
  175.    An AppleDouble, version 2, file is divided in two parts:
  176.  
  177.    Header:      including the Macintosh resource fork and desktop
  178.                 information and
  179.    Data fork:   containing the Macintosh data fork.
  180.  
  181.    The AppleDouble format is described in [APPL90] with a brief summary
  182.    in Appendix B.
  183.  
  184.    The AppleDouble file itself is sent as a multipart/appledouble MIME
  185.    body-part, which may have only two sub-parts.  The header is sent as
  186.    application/applefile and the data fork as whatever best describes
  187.    it.  For example, is the data for is actually a GIF image, it should
  188.    be sent as image/gif.  If no appropriate Content-Type has been
  189.    registered for the data type, it should be sent as an
  190.    application/octet-stream.
  191.  
  192.    The first four bytes of an AppleDouble header are, in hexadecimal:
  193.    00, 05, 16, 07.
  194.  
  195.    The AppleDouble header is binary data.  Hence, it may be necessary to
  196.    perform a Content-Transfer-Encoding for transmission, depending on
  197.    the underlying email transport environment.  The safest encoding is
  198.    Base64, since it permits transfer over the most restrictive channels.
  199.  
  200.    Even though an AppleDouble file includes the original Macintosh
  201.    filename, it is recommended that a name parameter be included on the
  202.    Content-Type header of both the header and data parts of the
  203.    AppleDouble file to give the recipient a hint as to what file is
  204.    attached.  The value of the name parameter must be a "value" as
  205.    defined by RFC-1521 [BORE93].  Note that this restricts the value to
  206.    seven-bit US-ASCII characters.
  207.  
  208.    4a.  AppleDouble example
  209.  
  210.       Content-Type: multipart/appledouble; boundary=mac-part
  211.  
  212.       --mac-part
  213.       Content-Type: application/applefile; name="My-new-car"
  214.  
  215.           [The AppleDouble header goes here]
  216.  
  217.       --mac-part
  218.       Content-Type: image/gif;
  219.  
  220.           [The data fork goes here]
  221.  
  222.       --mac-part--
  223.  
  224.  
  225.  
  226. Faltstrom, Crocker & Fair                                       [Page 4]
  227.  
  228. RFC 1740                  MIME-based Mac files             December 1994
  229.  
  230.  
  231. 5.  References
  232.  
  233.    BORE93   Borenstein N., and N. Freed, MIME (Multipurpose Internet
  234.             Mail Extensions): Mechanisms for Specifying and Describing
  235.             the Format of Internet Message Bodies, RFC 1521, Bellcore,
  236.             Innosoft, September 1993.
  237.  
  238.    APPL90   AppleSingle/AppleDouble Formats for Foreign Files
  239.             Developer's Note, Apple Computer, Inc., 1990
  240.  
  241. 6.  Security Considerations
  242.  
  243.    To the extent that application/applefile facilitates the transmission
  244.    of operating-system sensitive data, it may open a door for easier
  245.    relaxation of security rules than is intended either by the sender of
  246.    the administrator of the sender's system.
  247.  
  248. 7.  Acknowledgements
  249.  
  250.    Thanks to all of the people on the ietf-822 list who have provided
  251.    much meaningful input for this document.  Some of them must though be
  252.    remembered by name, because they have almost crushed my mailbox with
  253.    a very nice and interesting debate:
  254.  
  255.       Johan Berglund, Steve Dorner, David Gelhar, David Herron, Lee
  256.       Jones, Raymond Lau, Jamey Maze, John B. Melby, Jan Michael
  257.       Rynning, Rens Troost and Peter Svanberg.
  258.  
  259. 10.  Authors' Addresses
  260.  
  261.    Patrik Faltstrom
  262.    Department of Numerical Analysis and Computing Science
  263.    Royal Institute of Technology
  264.    S-100 44 Stockholm
  265.    Sweden
  266.  
  267.    EMail: paf@nada.kth.se
  268.  
  269.  
  270.    Dave Crocker
  271.    Brandenburg Consulting
  272.    675 Spruce Dr.
  273.    Sunnyvale, CA  94086
  274.  
  275.    EMail: dcrocker@mordor.stanford.edu
  276.  
  277.  
  278.    Erik E. Fair
  279.  
  280.  
  281.  
  282. Faltstrom, Crocker & Fair                                       [Page 5]
  283.  
  284. RFC 1740                  MIME-based Mac files             December 1994
  285.  
  286.  
  287.    Engineering Computer Operations
  288.    Apple Computer Inc.
  289.  
  290.    EMail: fair@apple.com
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Faltstrom, Crocker & Fair                                       [Page 6]
  339.  
  340. RFC 1740                  MIME-based Mac files             December 1994
  341.  
  342.  
  343. Appendix A.  The AppleSingle format
  344.  
  345.    In the AppleSingle format, a file's contents and attributes are
  346.    stored in a single file in the foreign file system.  For example,
  347.    both forks of a Macintosh file, the Finder information, and an
  348.    associated comment are arranged in a single file with a simple
  349.    structure.
  350.  
  351.    An AppleSingle file consists of a header followed by one or more data
  352.    entries.  The header consists of several fixed fields and a list of
  353.    entry descriptors, each pointing to a data entry.  Each entry is
  354.    optional and may or may not appear in the file.
  355.  
  356.     AppleSingle file header:
  357.  
  358.    Field               Length
  359.  
  360.    Magic number         4 bytes
  361.    Version number       4 bytes
  362.    Filler              16 bytes
  363.    Number of entries    2 bytes
  364.  
  365.     Entry descriptor for each entry:
  366.  
  367.    Entry ID             4 bytes
  368.    Offset               4 bytes
  369.    Length               4 bytes
  370.  
  371.    Byte ordering in the file fields follows MC68000 conventions, most
  372.    significant byte first.  The fields in the header file follow the
  373.    conventions described in the following sections.
  374.  
  375.    Magic number
  376.       This field, modelled after the UNIX magic number feature,
  377.       specifies the file's format.  Apple has defined the magic number
  378.       for the AppleSingle format as $00051600 or 0x00051600.
  379.  
  380.    Version number
  381.       This field denotes the version of AppleSingle format in the event
  382.       the format evolves (more fields may be added to the header).  The
  383.       version described in this note is version $00020000 or
  384.       0x00020000.
  385.  
  386.    Filler
  387.       This field is all zeros ($00 or 0x00).
  388.  
  389.    Number of entries
  390.       This field specifies how many different entries are included in
  391.  
  392.  
  393.  
  394. Faltstrom, Crocker & Fair                                       [Page 7]
  395.  
  396. RFC 1740                  MIME-based Mac files             December 1994
  397.  
  398.  
  399.       the file.  It is an unsigned 16-bit number.  If the number of
  400.       entries is any number other than 0, then that number of entry
  401.       descriptors immediately follows the number of entries field.
  402.  
  403.    Entry descriptors
  404.  
  405.       The entry descriptor is made up of the following three fields:
  406.  
  407.       Entry ID:   an unsigned 32-bit number, defines what the entry is.
  408.                   Entry IDs range from 1 to $FFFFFFFF. Entry ID 0 is
  409.                   invalid.
  410.       Offset:     an unsigned 32-bit number, shows the offset from the
  411.                   beginning of the file to the beginning of the entry's
  412.                   data.
  413.       Length:     an unsigned 32-bit number, shows the length of the
  414.                   data in bytes.  The length can be 0.
  415.  
  416.    Predefined entry ID's
  417.  
  418.       Apple has defined a set of entry IDs and their values as follows:
  419.  
  420.       Data Fork              1 Data fork
  421.       Resource Fork          2 Resource fork
  422.       Real Name              3 File's name as created on home file
  423.                                system
  424.       Comment                4 Standard Macintosh comment
  425.       Icon, B&W              5 Standard Macintosh black and white icon
  426.       Icon, Colour           6 Macintosh colour icon
  427.       File Dates Info        8 File creation date, modification date,
  428.                                and so on
  429.       Finder Info            9 Standard Macintosh Finder information
  430.       Macintosh File Info   10 Macintosh file information, attributes
  431.                                and so on
  432.       ProDOS File Info      11 ProDOS file information, attributes and
  433.                                so on
  434.       MS-DOS File Info      12 MS-DOS file information, attributes and
  435.                                so on
  436.       Short Name            13 AFP short name
  437.       AFP File Info         14 AFP file, information, attributes and so
  438.                                on
  439.       Directory ID          15 AFP directory ID
  440.  
  441.       Apple reserves the range of entry IDs from 1 to $7FFFFFFF. The
  442.       rest of the range is available for applications to define their
  443.       own entries.  Apple does not arbitrate the use of the rest of the
  444.       range.
  445.  
  446. Appendix B.  The AppleDouble format
  447.  
  448.  
  449.  
  450. Faltstrom, Crocker & Fair                                       [Page 8]
  451.  
  452. RFC 1740                  MIME-based Mac files             December 1994
  453.  
  454.  
  455.    The AppleDouble format uses two files to store data, resources and
  456.    attributes.  The AppleDouble Data file contains the data fork and the
  457.    AppleDouble Header file contains the resource fork.
  458.  
  459.    The AppleDouble Data file contains the standard Macintosh data fork
  460.    with no additional header.  The AppleDouble Header file has exactly
  461.    the same format as the AppleSingle file, except that it does not
  462.    contain a Data fork entry.  The magic number in the AppleDouble
  463.    Header file differs from the magic number in the AppleSingle Header
  464.    file so that an application can tell whether it needs to look in
  465.    another file for the data fork.  The magic number for the AppleDouble
  466.    format is $00051607 or 0x00051607.
  467.  
  468.    The entries in the AppleDouble Header file can appear in any order;
  469.    however, since the resource fork is the entry that is most commonly
  470.    extended (after the data fork), Apple recommends that the resource
  471.    fork entry to be placed last in the file.  The data fork is easily
  472.    extended because it resides by itself in the AppleDouble Data file.
  473.  
  474. Appendix C.  applefile.h
  475.  
  476.    This is an example of a header file for the language C which can be
  477.    used when parsing the data in either an AppleSingle file or
  478.    AppleDouble header.
  479.  
  480.    The file is written by Lee Jones.  Distribution is unlimited.
  481.  
  482.    /* applefile.h - Data structures used by AppleSingle/AppleDouble
  483.     * file format
  484.     *
  485.     * Written by Lee Jones, 22-Oct-1993
  486.     *
  487.     * For definitive information, see "AppleSingle/AppleDouble
  488.     * Formats for Foreign Files Developer's Note"; Apple Computer
  489.     * Inc.; (c) 1990.
  490.     *
  491.     * Other details were added from:
  492.     *   Inside Macintosh [old version], volumes II to VI,
  493.     *   Apple include files supplied with Think C 5.0.1,
  494.     *   Microsoft MS-DOS Programmer's Reference, version 5, and
  495.     *   Microsoft C 6.00a's dos.h include file.
  496.     *
  497.     * I don't have ProDOS or AFP Server documentation so related
  498.     * entries may be a bit skimpy.
  499.     *
  500.     * Edit history:
  501.     *
  502.     * when       who  why
  503.  
  504.  
  505.  
  506. Faltstrom, Crocker & Fair                                       [Page 9]
  507.  
  508. RFC 1740                  MIME-based Mac files             December 1994
  509.  
  510.  
  511.     * ---------  ---  ------------------------------------------
  512.     * 22-Oct-93  LMJ  Pull together from Inside Macintosh,
  513.     *                 Developer's Note, etc
  514.     * 26-Oct-93  LMJ  Finish writing first version and list
  515.     *                 references
  516.     * 06-Feb-94  EEF  Very minor cleanup
  517.     */
  518.  
  519.    /* Following items define machine specific size (for porting). */
  520.  
  521.    typedef char            xchar8;         /* 8-bit field */
  522.    typedef char            schar8;         /* signed 8-bit field */
  523.    typedef unsigned char   uchar8;         /* unsigned 8-bit field */
  524.    typedef short           xint16;         /* 16-bit field */
  525.    typedef unsigned short  uint16;         /* unsigned 16-bit field */
  526.    typedef long            xint32;         /* 32-bit field */
  527.    typedef long            sint32;         /* signed 32-bit field */
  528.    typedef unsigned long   uint32;         /* unsigned 32-bit field */
  529.  
  530.    /* REMINDER: the Motorola 680x0 is a big-endian architecture! */
  531.  
  532.    typedef uint32 OSType;                  /* 32 bit field */
  533.  
  534.    /* In the QuickDraw coordinate plane, each coordinate is
  535.     * -32767..32767. Each point is at the intersection of a
  536.     * horizontal grid line and a vertical grid line.  Horizontal
  537.     * coordinates increase from left to right. Vertical
  538.     * coordinates increase from top to bottom. This is the way
  539.     * both a TV screen and page of English text are scanned:
  540.     * from top left to bottom right.
  541.     */
  542.  
  543.    struct Point /* spot in QuickDraw 2-D grid */
  544.    {
  545.        xint16 v; /* vertical coordinate */
  546.        xint16 h; /* horizontal coordinate */
  547.    }; /* Point */
  548.  
  549.    typedef struct Point Point;
  550.  
  551.    /* See older Inside Macintosh, Volume II page 84 or Volume IV
  552.     * page 104.
  553.     */
  554.  
  555.    struct FInfo /* Finder information */
  556.    {
  557.        OSType fdType; /* File type, 4 ASCII chars */
  558.        OSType fdCreator; /* File's creator, 4 ASCII chars */
  559.  
  560.  
  561.  
  562. Faltstrom, Crocker & Fair                                      [Page 10]
  563.  
  564. RFC 1740                  MIME-based Mac files             December 1994
  565.  
  566.  
  567.        uint16 fdFlags; /* Finder flag bits */
  568.        Point  fdLocation; /* file's location in folder */
  569.        xint16 fdFldr; /* file 's folder (aka window) */
  570.    }; /* FInfo */
  571.  
  572.    typedef struct FInfo FInfo;
  573.  
  574.    /*
  575.     * Masks for finder flag bits (field fdFlags in struct
  576.     * FInfo).
  577.     */
  578.  
  579.    #define F_fOnDesk       0x0001 /* file is on desktop (HFS only) */
  580.    #define F_maskColor     0x000E /* color coding (3 bits) */
  581.    /*                      0x0010 /* reserved (System 7) */
  582.    #define F_fSwitchLaunch 0x0020 /* reserved (System 7) */
  583.    #define F_fShared       0x0040 /* appl available to multiple users */
  584.    #define F_fNoINITs      0x0080 /* file contains no INIT resources */
  585.    #define F_fBeenInited   0x0100 /* Finder has loaded bundle res. */
  586.    /*                      0x0200  /* reserved (System 7) */
  587.    #define F_fCustomIcom   0x0400 /* file contains custom icon */
  588.    #define F_fStationary   0x0800 /* file is a stationary pad */
  589.    #define F_fNameLocked   0x1000 /* file can't be renamed by Finder */
  590.    #define F_fHasBundle    0x2000 /* file has a bundle */
  591.    #define F_fInvisible    0x4000 /* file's icon is invisible */
  592.    #define F_fAlias        0x8000 /* file is an alias file (System 7) */
  593.  
  594.    /* See older Inside Macintosh, Volume IV, page 105.
  595.     */
  596.  
  597.    struct FXInfo /* Extended finder information */
  598.  
  599.    {
  600.        xint16 fdIconID; /* icon ID number */
  601.        xint16 fdUnused[3]; /* spare */
  602.        schar8 fdScript; /* scrip flag and code */
  603.        schar8 fdXFlags; /* reserved */
  604.        xint16 fdComment; /* comment ID number */
  605.        xint32 fdPutAway; /* home directory ID */
  606.    }; /* FXInfo */
  607.  
  608.    typedef struct FXInfo FXInfo;
  609.  
  610.    /* Pieces used by AppleSingle & AppleDouble (defined later). */
  611.  
  612.    struct ASHeader /* header portion of AppleSingle */
  613.    {
  614.                /* AppleSingle = 0x00051600; AppleDouble = 0x00051607 */
  615.  
  616.  
  617.  
  618. Faltstrom, Crocker & Fair                                      [Page 11]
  619.  
  620. RFC 1740                  MIME-based Mac files             December 1994
  621.  
  622.  
  623.        uint32 magicNum; /* internal file type tag */
  624.        uint32 versionNum; /* format version: 2 = 0x00020000 */
  625.        uchar8 filler[16]; /* filler, currently all bits 0 */
  626.        uint16 numEntries; /* number of entries which follow */
  627.    }; /* ASHeader */
  628.  
  629.    typedef struct ASHeader ASHeader;
  630.  
  631.    struct ASEntry /* one AppleSingle entry descriptor */
  632.    {
  633.        uint32 entryID; /* entry type: see list, 0 invalid */
  634.        uint32 entryOffset; /* offset, in octets, from beginning */
  635.                                    /* of file to this entry's data */
  636.        uint32 entryLength; /* length of data in octets */
  637.    }; /* ASEntry */
  638.  
  639.    typedef struct ASEntry ASEntry;
  640.  
  641.    /* Apple reserves the range of entry IDs from 1 to 0x7FFFFFFF.
  642.     * Entry ID 0 is invalid.  The rest of the range is available
  643.     * for applications to define their own entry types.  "Apple does
  644.     * not arbitrate the use of the rest of the range."
  645.     */
  646.  
  647.    #define AS_DATA         1 /* data fork */
  648.    #define AS_RESOURCE     2 /* resource fork */
  649.    #define AS_REALNAME     3 /* File's name on home file system */
  650.    #define AS_COMMENT      4 /* standard Mac comment */
  651.    #define AS_ICONBW       5 /* Mac black & white icon */
  652.    #define AS_ICONCOLOR    6 /* Mac color icon */
  653.            /*              7       /* not used */
  654.    #define AS_FILEDATES    8 /* file dates; create, modify, etc */
  655.    #define AS_FINDERINFO   9 /* Mac Finder info & extended info */
  656.    #define AS_MACINFO      10 /* Mac file info, attributes, etc */
  657.    #define AS_PRODOSINFO   11 /* Pro-DOS file info, attrib., etc */
  658.    #define AS_MSDOSINFO    12 /* MS-DOS file info, attributes, etc */
  659.    #define AS_AFPNAME      13 /* Short name on AFP server */
  660.    #define AS_AFPINFO      14 /* AFP file info, attrib., etc */
  661.  
  662.    #define AS_AFPDIRID     15 /* AFP directory ID */
  663.  
  664.    /* matrix of entry types and their usage:
  665.     *
  666.     *                   Macintosh    Pro-DOS    MS-DOS    AFP server
  667.     *                   ---------    -------    ------    ----------
  668.     *  1   AS_DATA         xxx         xxx       xxx         xxx
  669.     *  2   AS_RESOURCE     xxx         xxx
  670.     *  3   AS_REALNAME     xxx         xxx       xxx         xxx
  671.  
  672.  
  673.  
  674. Faltstrom, Crocker & Fair                                      [Page 12]
  675.  
  676. RFC 1740                  MIME-based Mac files             December 1994
  677.  
  678.  
  679.     *
  680.     *  4   AS_COMMENT      xxx
  681.     *  5   AS_ICONBW       xxx
  682.     *  6   AS_ICONCOLOR    xxx
  683.     *
  684.     *  8   AS_FILEDATES    xxx         xxx       xxx         xxx
  685.     *  9   AS_FINDERINFO   xxx
  686.     * 10   AS_MACINFO      xxx
  687.     *
  688.     * 11   AS_PRODOSINFO               xxx
  689.     * 12   AS_MSDOSINFO                          xxx
  690.     *
  691.     * 13   AS_AFPNAME                                        xxx
  692.     * 14   AS_AFPINFO                                        xxx
  693.     * 15   AS_AFPDIRID                                       xxx
  694.     */
  695.  
  696.    /* entry ID 1, data fork of file - arbitrary length octet string */
  697.  
  698.    /* entry ID 2, resource fork - arbitrary length opaque octet string;
  699.     *              as created and managed by Mac O.S. resoure manager
  700.     */
  701.  
  702.    /* entry ID 3, file's name as created on home file system - arbitrary
  703.     *              length octet string; usually short, printable ASCII
  704.     */
  705.  
  706.    /* entry ID 4, standard Macintosh comment - arbitrary length octet
  707.     *              string; printable ASCII, claimed 200 chars or less
  708.     */
  709.  
  710.    /* This is probably a simple duplicate of the 128 octet bitmap
  711.     * stored as the 'ICON' resource or the icon element from an 'ICN#'
  712.     * resource.
  713.     */
  714.  
  715.    struct ASIconBW /* entry ID 5, standard Mac black and white icon */
  716.    {
  717.        uint32 bitrow[32]; /* 32 rows of 32 1-bit pixels */
  718.    }; /* ASIconBW */
  719.  
  720.    typedef struct ASIconBW ASIconBW;
  721.  
  722.    /* entry ID 6, "standard" Macintosh color icon - several competing
  723.     *              color icons are defined.  Given the copyright dates
  724.     * of the Inside Macintosh volumes, the 'cicn' resource predominated
  725.     * when the AppleSingle Developer's Note was written (most probable
  726.     * candidate).  See Inside Macintosh, Volume V, pages 64 & 80-81 for
  727.  
  728.  
  729.  
  730. Faltstrom, Crocker & Fair                                      [Page 13]
  731.  
  732. RFC 1740                  MIME-based Mac files             December 1994
  733.  
  734.  
  735.     * a description of 'cicn' resources.
  736.     *
  737.     * With System 7, Apple introduced icon families.  They consist of:
  738.     *      large (32x32) B&W icon, 1-bit/pixel,    type 'ICN#',
  739.     *      small (16x16) B&W icon, 1-bit/pixel,    type 'ics#',
  740.     *      large (32x32) color icon, 4-bits/pixel, type 'icl4',
  741.     *      small (16x16) color icon, 4-bits/pixel, type 'ics4',
  742.     *      large (32x32) color icon, 8-bits/pixel, type 'icl8', and
  743.     *      small (16x16) color icon, 8-bits/pixel, type 'ics8'.
  744.     * If entry ID 6 is one of these, take your pick.  See Inside
  745.     * Macintosh, Volume VI, pages 2-18 to 2-22 and 9-9 to 9-13, for
  746.     * descriptions.
  747.     */
  748.  
  749.    /* entry ID 7, not used */
  750.  
  751.    /* Times are stored as a "signed number of seconds before of after
  752.     * 12:00 a.m. (midnight), January 1, 2000 Greenwich Mean Time (GMT).
  753.     * Applications must convert to their native date and time
  754.     * conventions." Any unknown entries are set to 0x80000000
  755.     * (earliest reasonable time).
  756.     */
  757.  
  758.    struct ASFileDates      /* entry ID 8, file dates info */
  759.    {
  760.        sint32 create; /* file creation date/time */
  761.        sint32 modify; /* last modification date/time */
  762.        sint32 backup; /* last backup date/time */
  763.        sint32 access; /* last access date/time */
  764.    }; /* ASFileDates */
  765.  
  766.    typedef struct ASFileDates ASFileDates;
  767.  
  768.    /* See older Inside Macintosh, Volume II, page 115 for
  769.     * PBGetFileInfo(), and Volume IV, page 155, for PBGetCatInfo().
  770.     */
  771.  
  772.    /* entry ID 9, Macintosh Finder info & extended info */
  773.    struct ASFinderInfo
  774.    {
  775.        FInfo ioFlFndrInfo; /* PBGetFileInfo() or PBGetCatInfo() */
  776.        FXInfo ioFlXFndrInfo; /* PBGetCatInfo() (HFS only) */
  777.    }; /* ASFinderInfo */
  778.  
  779.    typedef struct ASFinderInfo ASFinderInfo;
  780.  
  781.    struct ASMacInfo        /* entry ID 10, Macintosh file information */
  782.    {
  783.  
  784.  
  785.  
  786. Faltstrom, Crocker & Fair                                      [Page 14]
  787.  
  788. RFC 1740                  MIME-based Mac files             December 1994
  789.  
  790.  
  791.        uchar8 filler[3]; /* filler, currently all bits 0 */
  792.        uchar8 ioFlAttrib; /* PBGetFileInfo() or PBGetCatInfo() */
  793.    }; /* ASMacInfo */
  794.  
  795.    typedef struct ASMacInfo ASMacInfo;
  796.  
  797.    #define AS_PROTECTED    0x0002 /* protected bit */
  798.    #define AS_LOCKED       0x0001 /* locked bit */
  799.  
  800.    /* NOTE: ProDOS-16 and GS/OS use entire fields.  ProDOS-8 uses low
  801.     * order half of each item (low byte in access & filetype, low word
  802.     * in auxtype); remainder of each field should be zero filled.
  803.     */
  804.  
  805.    struct ASProdosInfo     /* entry ID 11, ProDOS file information */
  806.    {
  807.        uint16 access; /* access word */
  808.        uint16 filetype; /* file type of original file */
  809.        uint32 auxtype; /* auxiliary type of the orig file */
  810.    }; /* ASProDosInfo */
  811.  
  812.    typedef struct ASProdosInfo ASProdosInfo;
  813.  
  814.    /* MS-DOS file attributes occupy 1 octet; since the Developer Note
  815.     * is unspecific, I've placed them in the low order portion of the
  816.     * field (based on example of other ASMacInfo & ASProdosInfo).
  817.     */
  818.  
  819.    struct ASMsdosInfo      /* entry ID 12, MS-DOS file information */
  820.    {
  821.        uchar8 filler; /* filler, currently all bits 0 */
  822.        uchar8 attr; /* _dos_getfileattr(), MS-DOS */
  823.                                    /* interrupt 21h function 4300h */
  824.    }; /* ASMsdosInfo */
  825.  
  826.    typedef struct ASMsdosInfo ASMsdosInfo;
  827.  
  828.    #define AS_DOS_NORMAL   0x00 /* normal file (all bits clear) */
  829.    #define AS_DOS_READONLY 0x01 /* file is read-only */
  830.    #define AS_DOS_HIDDEN   0x02 /* hidden file (not shown by DIR) */
  831.    #define AS_DOS_SYSTEM   0x04 /* system file (not shown by DIR) */
  832.    #define AS_DOS_VOLID    0x08 /* volume label (only in root dir) */
  833.    #define AS_DOS_SUBDIR   0x10 /* file is a subdirectory */
  834.    #define AS_DOS_ARCHIVE  0x20 /* new or modified (needs backup) */
  835.  
  836.    /* entry ID 13, short file name on AFP server - arbitrary length
  837.     *              octet string; usualy printable ASCII starting with
  838.     *              '!' (0x21)
  839.  
  840.  
  841.  
  842. Faltstrom, Crocker & Fair                                      [Page 15]
  843.  
  844. RFC 1740                  MIME-based Mac files             December 1994
  845.  
  846.  
  847.     */
  848.  
  849.    struct ASAfpInfo   /* entry ID 12, AFP server file information */
  850.    {
  851.        uchar8 filler[3]; /* filler, currently all bits 0 */
  852.        uchar8 attr; /* file attributes */
  853.    }; /* ASAfpInfo */
  854.  
  855.    typedef struct ASAfpInfo ASAfpInfo;
  856.  
  857.    #define AS_AFP_Invisible    0x01 /* file is invisible */
  858.    #define AS_AFP_MultiUser    0x02 /* simultaneous access allowed */
  859.    #define AS_AFP_System       0x04 /* system file */
  860.    #define AS_AFP_BackupNeeded 0x40 /* new or modified (needs backup) */
  861.  
  862.    struct ASAfpDirId       /* entry ID 15, AFP server directory ID */
  863.    {
  864.        uint32 dirid; /* file's directory ID on AFP server */
  865.    }; /* ASAfpDirId */
  866.  
  867.    typedef struct ASAfpDirId ASAfpDirId;
  868.  
  869.    /*
  870.     * The format of an AppleSingle/AppleDouble header
  871.     */
  872.    struct AppleSingle /* format of disk file */
  873.    {
  874.        ASHeader header; /* AppleSingle header part */
  875.        ASEntry  entry[1]; /* array of entry descriptors */
  876.    /* uchar8  filedata[];          /* followed by rest of file */
  877.    }; /* AppleSingle */
  878.  
  879.    typedef struct AppleSingle AppleSingle;
  880.  
  881.    /*
  882.     * FINAL REMINDER: the Motorola 680x0 is a big-endian architecture!
  883.     */
  884.  
  885.    /* End of applefile.h */
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898. Faltstrom, Crocker & Fair                                      [Page 16]
  899.  
  900.