Back to index

lightning-sunbird  0.9+nobinonly
nsMsgAppleCodes.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org Code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 /*
00040 **     AD_Codes.h
00041 **
00042 **     ---------------
00043 **
00044 **            Head file for Apple Decode/Encode enssential codes.
00045 **
00046 **
00047 */
00048 
00049 #ifndef ad_codes_h
00050 #define ad_codes_h
00051 
00052 /*
00053 ** applefile definitions used 
00054 */
00055 #ifdef XP_MAC
00056 #if PRAGMA_STRUCT_ALIGN
00057 #pragma options align=mac68k
00058 #endif
00059 #endif /* XP_MAC */
00060 
00061 #if defined(XP_MACOSX)
00062 #pragma options align=mac68k
00063 #endif /* XP_MACOSX */
00064 
00065 #define APPLESINGLE_MAGIC   0x00051600L
00066 #define APPLEDOUBLE_MAGIC   0x00051607L
00067 #define VERSION                    0x00020000
00068 
00069 #define NUM_ENTRIES         6
00070 
00071 #define ENT_DFORK           1L
00072 #define ENT_RFORK           2L
00073 #define ENT_NAME            3L
00074 #define ENT_COMMENT         4L
00075 #define ENT_DATES           8L
00076 #define ENT_FINFO           9L
00077 #define CONVERT_TIME               1265437696L
00078 
00079 /*
00080 ** data type used in the encoder/decoder.
00081 */
00082 typedef struct ap_header 
00083 {
00084        PRInt32       magic;
00085        PRInt32       version;
00086        char   fill[16];
00087        PRInt16       entries;
00088 
00089 } ap_header;
00090 
00091 typedef struct ap_entry 
00092 {
00093        PRInt32  id;
00094        PRInt32       offset;
00095        PRInt32       length;
00096        
00097 } ap_entry;
00098 
00099 typedef struct ap_dates 
00100 {
00101        PRInt32 create, modify, backup, access;
00102 
00103 } ap_dates;
00104 
00105 typedef struct myFInfo                    /* the mac FInfo structure for the cross platform. */
00106 {      
00107        PRInt32       fdType, fdCreator;
00108        PRInt16       fdFlags;
00109        PRInt32       fdLocation;                 /* it really should  be a pointer, but just a place-holder  */
00110        PRInt16       fdFldr;       
00111 
00112 }      myFInfo;
00113 
00114 PR_BEGIN_EXTERN_C
00115 /*
00116 **     string utils.
00117 */
00118 int write_stream(appledouble_encode_object *p_ap_encode_obj,char *s,int       len);
00119 
00120 int fill_apple_mime_header(appledouble_encode_object *p_ap_encode_obj);
00121 int ap_encode_file_infor(appledouble_encode_object *p_ap_encode_obj);
00122 int ap_encode_header(appledouble_encode_object* p_ap_encode_obj, PRBool firstTime);
00123 int ap_encode_data(  appledouble_encode_object* p_ap_encode_obj, PRBool firstTime);
00124 
00125 /*
00126 **     the prototypes for the ap_decoder.
00127 */
00128 int  fetch_a_line(appledouble_decode_object* p_ap_decode_obj, char *buff);
00129 int  ParseFileHeader(appledouble_decode_object* p_ap_decode_obj);
00130 int  ap_seek_part_start(appledouble_decode_object* p_ap_decode_obj);
00131 void parse_param(char *p, char **param, char**define, char **np);
00132 int  ap_seek_to_boundary(appledouble_decode_object* p_ap_decode_obj, PRBool firstime);
00133 int  ap_parse_header(appledouble_decode_object* p_ap_decode_obj,PRBool firstime);
00134 int  ap_decode_file_infor(appledouble_decode_object* p_ap_decode_obj);
00135 int  ap_decode_process_header(appledouble_decode_object* p_ap_decode_obj, PRBool firstime);
00136 int  ap_decode_process_data(  appledouble_decode_object* p_ap_decode_obj, PRBool firstime);
00137 
00138 PR_END_EXTERN_C
00139  
00140 #ifdef XP_MAC
00141 #if PRAGMA_STRUCT_ALIGN
00142 #pragma options align=reset
00143 #endif
00144 #endif /* XP_MAC */
00145 
00146 #if defined(XP_MACOSX)
00147 #pragma options align=reset
00148 #endif /* XP_MACOSX */
00149 
00150 #endif /* ad_codes_h */