Back to index

lightning-sunbird  0.9+nobinonly
gdiff.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 /*--------------------------------------------------------------
00038  * GDIFF.H
00039  *
00040  * Constants used in processing the GDIFF format
00041  *--------------------------------------------------------------*/
00042 
00043 
00044 #include "prio.h"
00045 
00046 #define GDIFF_MAGIC         "\xD1\xFF\xD1\xFF"
00047 #define GDIFF_MAGIC_LEN     4
00048 #define GDIFF_VER           5
00049 #define GDIFF_EOF           "\0"
00050 
00051 #define GDIFF_VER_POS       4
00052 #define GDIFF_CS_POS        5
00053 #define GDIFF_CSLEN_POS     6
00054 
00055 #define GDIFF_HEADERSIZE    7
00056 #define GDIFF_APPDATALEN    4
00057 
00058 #define GDIFF_CS_NONE       0
00059 #define GDIFF_CS_MD5        1
00060 #define GDIFF_CS_SHA        2
00061 #define GDIFF_CS_CRC32      32
00062 
00063 #define CRC32_LEN           4
00064 
00065 /*--------------------------------------
00066  *  GDIFF opcodes
00067  *------------------------------------*/
00068 #define ENDDIFF     0
00069 #define ADD8MAX     246
00070 #define ADD16       247
00071 #define ADD32       248
00072 #define COPY16BYTE  249
00073 #define COPY16SHORT 250
00074 #define COPY16LONG  251
00075 #define COPY32BYTE  252
00076 #define COPY32SHORT 253
00077 #define COPY32LONG  254
00078 #define COPY64      255
00079 
00080 /* instruction sizes */
00081 #define ADD16SIZE           2
00082 #define ADD32SIZE           4
00083 #define COPY16BYTESIZE      3
00084 #define COPY16SHORTSIZE     4
00085 #define COPY16LONGSIZE      6
00086 #define COPY32BYTESIZE      5
00087 #define COPY32SHORTSIZE     6
00088 #define COPY32LONGSIZE      8
00089 #define COPY64SIZE          12
00090 
00091 
00092 /*--------------------------------------
00093  *  error codes
00094  *------------------------------------*/
00095 #define GDIFF_OK                0
00096 #define GDIFF_ERR_UNKNOWN       -1
00097 #define GDIFF_ERR_ARGS          -2
00098 #define GDIFF_ERR_ACCESS        -3
00099 #define GDIFF_ERR_MEM           -4
00100 #define GDIFF_ERR_HEADER        -5
00101 #define GDIFF_ERR_BADDIFF       -6
00102 #define GDIFF_ERR_OPCODE        -7
00103 #define GDIFF_ERR_OLDFILE       -8
00104 #define GDIFF_ERR_CHKSUMTYPE    -9
00105 #define GDIFF_ERR_CHECKSUM      -10
00106 #define GDIFF_ERR_CHECKSUM_TARGET  -11
00107 #define GDIFF_ERR_CHECKSUM_RESULT  -12
00108 
00109 
00110 /*--------------------------------------
00111  *  types
00112  *------------------------------------*/
00113 #ifndef AIX
00114 #ifdef OSF1
00115 #include <sys/types.h>
00116 #else
00117 typedef unsigned char uchar;
00118 #endif
00119 #endif
00120 
00121 typedef struct _diffdata {
00122     PRFileDesc*      fSrc;
00123     PRFileDesc*      fOut;
00124     PRFileDesc*      fDiff;
00125     uint8       checksumType;
00126     uint8       checksumLength;
00127     uchar*      oldChecksum;
00128     uchar*      newChecksum;
00129     PRBool      bMacAppleSingle;
00130     PRBool      bWin32BoundImage;
00131     uchar*      databuf;
00132     uint32      bufsize;
00133 } DIFFDATA;
00134 
00135 typedef DIFFDATA* pDIFFDATA;
00136 
00137 
00138 /*--------------------------------------
00139  *  miscellaneous
00140  *------------------------------------*/
00141 
00142 #define APPFLAG_W32BOUND        "autoinstall:Win32PE"
00143 #define APPFLAG_APPLESINGLE     "autoinstall:AppleSingle"
00144 
00145 #ifndef TRUE
00146   #define TRUE  1
00147 #endif
00148 
00149 #ifndef FALSE
00150   #define FALSE 0
00151 #endif
00152 
00153