1 #ifndef LIBRARIES_XADMASTER_H
    2 #define LIBRARIES_XADMASTER_H
    3 
    4 /*  $Id: xadmaster.h,v 1.3 2025/08/27 20:09:02 piru Exp $
    5     xadmaster.library defines and structures
    6 
    7     XAD library system for archive handling
    8     Copyright (C) 1998 and later by Dirk Stöcker <soft@dstoecker.de>
    9 
   10     This library is free software; you can redistribute it and/or
   11     modify it under the terms of the GNU Lesser General Public
   12     License as published by the Free Software Foundation; either
   13     version 2.1 of the License, or (at your option) any later version.
   14 
   15     This library is distributed in the hope that it will be useful,
   16     but WITHOUT ANY WARRANTY; without even the implied warranty of
   17     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   18     Lesser General Public License for more details.
   19 
   20     You should have received a copy of the GNU Lesser General Public
   21     License along with this library; if not, write to the Free Software
   22     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23 */
   24 
   25 #ifdef __cplusplus
   26 extern "C" {
   27 #endif
   28 
   29 #ifndef DOS_DOS_H
   30 #include <dos/dos.h>
   31 #endif
   32 
   33 #ifndef EXEC_LIBRARIES_H
   34 #include <exec/libraries.h>
   35 #endif
   36 
   37 #ifndef UTILITY_TAGITEM_H
   38 #include <utility/tagitem.h>
   39 #endif
   40 
   41 #define XADNAME  "xadmaster.library"
   42 
   43 #define XADM
   44 
   45 #ifdef HAVE_STDINT_H
   46 #include <stdint.h>
   47 typedef uint32_t           xadUINT32;
   48 typedef int32_t            xadINT32;
   49 typedef uint16_t           xadUINT16;
   50 typedef int16_t            xadINT16;
   51 typedef uint8_t            xadUINT8;
   52 typedef int8_t             xadINT8;
   53 typedef uint32_t           xadSize;
   54 typedef int32_t            xadSignSize;
   55 #else
   56 typedef unsigned long      xadUINT32;
   57 typedef signed long        xadINT32;
   58 typedef unsigned short     xadUINT16;
   59 typedef signed short       xadINT16;
   60 typedef unsigned char      xadUINT8;
   61 typedef signed char        xadINT8;
   62 typedef xadUINT32          xadSize;
   63 typedef xadINT32           xadSignSize;
   64 #endif
   65 typedef void *             xadPTR;
   66 typedef char               xadSTRING;
   67 typedef xadSTRING *        xadSTRPTR;
   68 typedef unsigned int       xadUINT;
   69 typedef int                xadINT;
   70 typedef xadINT32           xadERROR;
   71 typedef xadINT16           xadBOOL;
   72 
   73 typedef BPTR             xadFileHandle;
   74 typedef Tag              xadTag;
   75 typedef struct TagItem * xadTAGPTR;
   76 
   77 #define XADFALSE        0
   78 #define XADTRUE         1
   79 #define XADMEMF_ANY     (0)
   80 #define XADMEMF_CLEAR   (1L << 16)
   81 #define XADMEMF_PUBLIC  (1L << 0)
   82 
   83 #define TAG_PTR TAG_USER
   84 #define TAG_INT TAG_USER
   85 #define TAG_SIZ TAG_USER
   86 
   87 /* NOTE: Nearly all structures need to be allocated using the
   88    xadAllocObject function. */
   89 
   90 /************************************************************************
   91 *                                                                       *
   92 *    library base structure                                             *
   93 *                                                                       *
   94 ************************************************************************/
   95 
   96 struct xadMasterBase {
   97   struct Library       xmb_LibNode;
   98 #ifdef XAD_OBSOLETE
   99   struct ExecBase *    xmb_SysBase;
  100   struct DosLibrary *  xmb_DOSBase;
  101   struct UtilityBase * xmb_UtilityBase;
  102   xadSize              xmb_RecogSize;   /* read only */
  103   xadSTRPTR            xmb_DefaultName; /* name for XADFIF_NOFILENAME (V6) */
  104 #endif
  105 };
  106 
  107 /************************************************************************
  108 *                                                                       *
  109 *    tag-function call flags                                            *
  110 *                                                                       *
  111 ************************************************************************/
  112 
  113 /* input tags for xadGetInfo, only one can be specified per call */
  114 #define XAD_INSIZE              (TAG_USER+  1) /* input data size */
  115 #define XAD_INFILENAME          (TAG_USER+  2)
  116 #define XAD_INFILEHANDLE        (TAG_USER+  3)
  117 #define XAD_INMEMORY            (TAG_USER+  4)
  118 #define XAD_INHOOK              (TAG_USER+  5)
  119 #define XAD_INSPLITTED          (TAG_USER+  6) /* (V2) */
  120 #define XAD_INDISKARCHIVE       (TAG_USER+  7) /* (V4) */
  121 #define XAD_INXADSTREAM         (TAG_USER+  8) /* (V8) */
  122 #define XAD_INDEVICE            (TAG_USER+  9) /* (V11) */
  123 
  124 /* output tags, only one can be specified per call, xadXXXXUnArc */
  125 #define XAD_OUTSIZE             (TAG_USER+ 10) /* output data size */
  126 #define XAD_OUTFILENAME         (TAG_USER+ 11)
  127 #define XAD_OUTFILEHANDLE       (TAG_USER+ 12)
  128 #define XAD_OUTMEMORY           (TAG_USER+ 13)
  129 #define XAD_OUTHOOK             (TAG_USER+ 14)
  130 #define XAD_OUTDEVICE           (TAG_USER+ 15)
  131 #define XAD_OUTXADSTREAM        (TAG_USER+ 16) /* (V8) */
  132 
  133 /* object allocation tags for xadAllocObjectA */
  134 #define XAD_OBJNAMESIZE         (TAG_USER+ 20) /* XADOBJ_FILEINFO, size of needed name space */
  135 #define XAD_OBJCOMMENTSIZE      (TAG_USER+ 21) /* XADOBJ_FILEINFO, size of needed comment space */
  136 #define XAD_OBJPRIVINFOSIZE     (TAG_USER+ 22) /* XADOBJ_FILEINFO & XADOBJ_DISKINFO, self use size */
  137 #define XAD_OBJBLOCKENTRIES     (TAG_USER+ 23) /* XADOBJ_DISKINFO, number of needed entries */
  138 
  139 /* tags for xadGetInfo, xadFileUnArc and xadDiskUnArc */
  140 #define XAD_NOEXTERN            (TAG_USER+ 50) /* do not use extern clients */
  141 #define XAD_PASSWORD            (TAG_USER+ 51) /* password when needed */
  142 #define XAD_ENTRYNUMBER         (TAG_USER+ 52) /* number of wanted entry */
  143 #define XAD_PROGRESSHOOK        (TAG_USER+ 53) /* the progress hook */
  144 #define XAD_OVERWRITE           (TAG_USER+ 54) /* overwrite file ? */
  145 #define XAD_MAKEDIRECTORY       (TAG_USER+ 55) /* create directory tree */
  146 #define XAD_IGNOREGEOMETRY      (TAG_USER+ 56) /* ignore drive geometry ? */
  147 #define XAD_LOWCYLINDER         (TAG_USER+ 57) /* lowest cylinder */
  148 #define XAD_HIGHCYLINDER        (TAG_USER+ 58) /* highest cylinder */
  149 #define XAD_VERIFY              (TAG_USER+ 59) /* verify for disk hook */
  150 #define XAD_NOKILLPARTIAL       (TAG_USER+ 60) /* do not delete partial/corrupt files (V3.3) */
  151 #define XAD_FORMAT              (TAG_USER+ 61) /* format output device (V5) */
  152 #define XAD_USESECTORLABELS     (TAG_USER+ 62) /* sector labels are stored on disk (V9) */
  153 #define XAD_IGNOREFLAGS         (TAG_USER+ 63) /* ignore the client, if certain flags are set (V11) */
  154 #define XAD_ONLYFLAGS           (TAG_USER+ 64) /* ignore the client, if certain flags are NOT set (V11) */
  155 
  156 /* input tags for xadConvertDates, only one can be passed */
  157 #define XAD_DATEUNIX            (TAG_USER+ 70) /* unix date variable */
  158 #define XAD_DATEAMIGA           (TAG_USER+ 71) /* Amiga date variable */
  159 #define XAD_DATEDATESTAMP       (TAG_USER+ 72) /* Amiga struct DateStamp */
  160 #define XAD_DATEXADDATE         (TAG_USER+ 73) /* struct xadDate */
  161 #define XAD_DATECLOCKDATA       (TAG_USER+ 74) /* Amiga struct ClockData */
  162 #define XAD_DATECURRENTTIME     (TAG_USER+ 75) /* input is system time */
  163 #define XAD_DATEMSDOS           (TAG_USER+ 76) /* MS-DOS packed format (V2) */
  164 #define XAD_DATEMAC             (TAG_USER+ 77) /* Mac date variable (V8) */
  165 #define XAD_DATECPM             (TAG_USER+ 78) /* CP/M data structure (V10) */
  166 #define XAD_DATECPM2            (TAG_USER+ 79) /* CP/M data structure type 2 (V10) */
  167 #define XAD_DATEISO9660         (TAG_USER+300) /* ISO9660 date structure (V11) */
  168 #define XAD_DATEPOSIXDATESTAMP  (TAG_USER+400) /* MorphOS struct PosixDateStamp */
  169 
  170 /* output tags, there can be specified multiple tags for one call */
  171 #define XAD_GETDATEUNIX         (TAG_USER+ 80) /* unix date variable */
  172 #define XAD_GETDATEAMIGA        (TAG_USER+ 81) /* Amiga date variable */
  173 #define XAD_GETDATEDATESTAMP    (TAG_USER+ 82) /* Amiga struct DateStamp */
  174 #define XAD_GETDATEXADDATE      (TAG_USER+ 83) /* struct xadDate */
  175 #define XAD_GETDATECLOCKDATA    (TAG_USER+ 84) /* Amiga struct ClockData */
  176 #define XAD_GETDATEMSDOS        (TAG_USER+ 86) /* MS-DOS packed format (V2) */
  177 #define XAD_GETDATEMAC          (TAG_USER+ 87) /* Mac date variable (V8) */
  178 #define XAD_GETDATECPM          (TAG_USER+ 88) /* CP/M data structure (V10) */
  179 #define XAD_GETDATECPM2         (TAG_USER+ 89) /* CP/M data structure type 2 (V10) */
  180 #define XAD_GETDATEISO9660      (TAG_USER+320) /* ISO9660 date structure (V11) */
  181 #define XAD_GETDATEPOSIXDATESTAMP (TAG_PTR+420) /* MorphOS struct PosixDateStamp */
  182 
  183 /* following tags need locale.library to be installed on Amiga */
  184 #define XAD_MAKEGMTDATE         (TAG_USER+ 90) /* make local to GMT time */
  185 #define XAD_MAKELOCALDATE       (TAG_USER+ 91) /* make GMT to local time */
  186 
  187 /* tags for xadHookTagAccess (V3) */
  188 #define XAD_USESKIPINFO         (TAG_USER+104) /* the hook uses xadSkipInfo (V3) */
  189 #define XAD_SECTORLABELS        (TAG_USER+105) /* pass sector labels with XADAC_WRITE (V9) */
  190 
  191 #define XAD_GETCRC16            (TAG_USER+120) /* pointer to xadUINT16 value (V3) */
  192 #define XAD_GETCRC32            (TAG_USER+121) /* pointer to xadUINT32 value (V3) */
  193 
  194 #define XAD_CRC16ID             (TAG_USER+130) /* ID for crc calculation (V3) */
  195 #define XAD_CRC32ID             (TAG_USER+131) /* ID for crc calculation (V3) */
  196 
  197 /* tags for xadConvertProtection (V4) */
  198 #define XAD_PROTAMIGA           (TAG_USER+160) /* Amiga type protection bits (V4) */
  199 #define XAD_PROTUNIX            (TAG_USER+161) /* protection bits in UNIX mode (V4) */
  200 #define XAD_PROTMSDOS           (TAG_USER+162) /* MSDOS type protection bits (V4) */
  201 #define XAD_PROTFILEINFO        (TAG_USER+163) /* input is a xadFileInfo structure (V11) */
  202 
  203 #define XAD_GETPROTAMIGA        (TAG_USER+170) /* return Amiga protection bits (V4) */
  204 #define XAD_GETPROTUNIX         (TAG_USER+171) /* return UNIX protection bits (V11) */
  205 #define XAD_GETPROTMSDOS        (TAG_USER+172) /* return MSDOS protection bits (V11) */
  206 #define XAD_GETPROTFILEINFO     (TAG_USER+173) /* fill xadFileInfo protection fields (V11) */
  207 
  208 /* tags for xadGetDiskInfo (V7) */
  209 #define XAD_STARTCLIENT         (TAG_USER+180) /* the client to start with (V7) */
  210 #define XAD_NOEMPTYERROR        (TAG_USER+181) /* do not create XADERR_EMPTY (V8) */
  211 
  212 /* tags for xadFreeHookAccess (V8) */
  213 #define XAD_WASERROR            (TAG_USER+190) /* error occured, call abort method (V8) */
  214 
  215 /* tags for miscellaneous stuff */
  216 #define XAD_ARCHIVEINFO         (TAG_USER+200) /* xadArchiveInfo for stream hooks (V8) */
  217 #define XAD_ERRORCODE           (TAG_USER+201) /* error code of function (V12) */
  218 #define XAD_EXTENSION           (TAG_USER+202) /* argument for xadGetDefaultName() (V13) */
  219 
  220 /* tags for xadAddFileEntry and xadAddDiskEntry (V10) */
  221 #define XAD_SETINPOS            (TAG_USER+240) /* set xai_InPos after call (V10) */
  222 #define XAD_INSERTDIRSFIRST     (TAG_USER+241) /* insert dirs at list start (V10) */
  223 
  224 /* tags for xadConvertName (V12) */
  225 #define XAD_PATHSEPERATOR       (TAG_USER+260) /* xadUINT16 *, default is {'/','\\',0} in source charset (V12) */
  226 #define XAD_CHARACTERSET        (TAG_USER+261) /* the characterset of string (V12) */
  227 #define XAD_STRINGSIZE          (TAG_USER+262) /* maximum size of following (V12) */
  228 #define XAD_CSTRING             (TAG_USER+263) /* zero-terminated string (V12) */
  229 #define XAD_PSTRING             (TAG_USER+264) /* lengthed Pascal string (V12) */
  230 #define XAD_XADSTRING           (TAG_USER+265) /* an xad string (V12) */
  231 #define XAD_ADDPATHSEPERATOR    (TAG_USER+266) /* default is TRUE (V12) */
  232 
  233 /* tags for xadGetFilename (V12) */
  234 #define XAD_NOLEADINGPATH       (TAG_USER+280) /* default is FALSE (V12) */
  235 #define XAD_NOTRAILINGPATH      (TAG_USER+281) /* default is FALSE (V12) */
  236 #define XAD_MASKCHARACTERS      (TAG_USER+282) /* default are #?()[]~%*:|",1-31,127-160 (V12) */
  237 #define XAD_MASKINGCHAR         (TAG_USER+283) /* default is '_' (V12) */
  238 #define XAD_REQUIREDBUFFERSIZE  (TAG_USER+284) /* pointer which should hold buf size (V12) */
  239 
  240 /* Places 300-339 used for dates! */
  241 
  242 /************************************************************************
  243 *                                                                       *
  244 *    objects for xadAllocObjectA                                        *
  245 *                                                                       *
  246 ************************************************************************/
  247 
  248 #define XADOBJ_ARCHIVEINFO      0x0001 /* struct xadArchiveInfo */
  249 #define XADOBJ_FILEINFO         0x0002 /* struct xadFileInfo */
  250 #define XADOBJ_DISKINFO         0x0003 /* struct xadDiskInfo */
  251 #define XADOBJ_HOOKPARAM        0x0004 /* struct HookParam */
  252 #define XADOBJ_DEVICEINFO       0x0005 /* struct xadDeviceInfo */
  253 #define XADOBJ_PROGRESSINFO     0x0006 /* struct xadProgressInfo */
  254 #define XADOBJ_TEXTINFO         0x0007 /* struct xadTextInfo */
  255 #define XADOBJ_SPLITFILE        0x0008 /* struct xadSplitFile (V2) */
  256 #define XADOBJ_SKIPINFO         0x0009 /* struct xadSkipInfo (V3) */
  257 #define XADOBJ_IMAGEINFO        0x000A /* struct xadImageInfo (V4) */
  258 #define XADOBJ_SPECIAL          0x000B /* struct xadSpecial (V11) */
  259 
  260 /* result type of xadAllocVec */
  261 #define XADOBJ_MEMBLOCK         0x0100 /* memory of requested size and type */
  262 /* private type */
  263 #define XADOBJ_STRING           0x0101 /* a typed XAD string (V12) */
  264 
  265 /************************************************************************
  266 *                                                                       *
  267 *    modes for xadCalcCRC126 and xadCalcCRC32                           *
  268 *                                                                       *
  269 ************************************************************************/
  270 
  271 #define XADCRC16_ID1            0xA001
  272 #define XADCRC32_ID1            0xEDB88320
  273 
  274 /************************************************************************
  275 *                                                                       *
  276 *    hook related stuff                                                 *
  277 *                                                                       *
  278 ************************************************************************/
  279 
  280 #define XADHC_READ      1       /* read data into buffer */
  281 #define XADHC_WRITE     2       /* write buffer data to file/memory */
  282 #define XADHC_SEEK      3       /* seek in file */
  283 #define XADHC_INIT      4       /* initialize the hook */
  284 #define XADHC_FREE      5       /* end up hook work, free stuff */
  285 #define XADHC_ABORT     6       /* an error occured, delete partial stuff */
  286 #define XADHC_FULLSIZE  7       /* complete input size is needed */
  287 #define XADHC_IMAGEINFO 8       /* return disk image info (V4) */
  288 
  289 struct xadHookParam {
  290   xadUINT32    xhp_Command;
  291   xadSignSize  xhp_CommandData;
  292   xadPTR       xhp_BufferPtr;
  293   xadSize      xhp_BufferSize;
  294   xadSize      xhp_DataPos;        /* current seek position */
  295   xadPTR       xhp_PrivatePtr;
  296   xadTAGPTR    xhp_TagList;        /* allows to transport tags to hook (V9) */
  297 };
  298 
  299 /* xadHookAccess commands */
  300 #define XADAC_READ              10      /* get data */
  301 #define XADAC_WRITE             11      /* write data */
  302 #define XADAC_COPY              12      /* copy input to output */
  303 #define XADAC_INPUTSEEK         13      /* seek in input file */
  304 #define XADAC_OUTPUTSEEK        14      /* seek in output file */
  305 
  306 /************************************************************************
  307 *                                                                       *
  308 *    support structures                                                 *
  309 *                                                                       *
  310 ************************************************************************/
  311 
  312 /* Own date structure to cover all possible dates in a human friendly
  313    format. xadConvertDates may be used to convert between different date
  314    structures and variables. */
  315 struct xadDate {
  316   xadUINT32 xd_Micros;  /* values 0 to 999999     */
  317   xadINT32  xd_Year;    /* values 1 to 2147483648 */
  318   xadUINT8  xd_Month;   /* values 1 to 12         */
  319   xadUINT8  xd_WeekDay; /* values 1 to 7          */
  320   xadUINT8  xd_Day;     /* values 1 to 31         */
  321   xadUINT8  xd_Hour;    /* values 0 to 23         */
  322   xadUINT8  xd_Minute;  /* values 0 to 59         */
  323   xadUINT8  xd_Second;  /* values 0 to 59         */
  324 };
  325 
  326 #define XADDAY_MONDAY           1       /* monday is the first day and */
  327 #define XADDAY_TUESDAY          2
  328 #define XADDAY_WEDNESDAY        3
  329 #define XADDAY_THURSDAY         4
  330 #define XADDAY_FRIDAY           5
  331 #define XADDAY_SATURDAY         6
  332 #define XADDAY_SUNDAY           7       /* sunday the last day of a week */
  333 
  334 struct xadDeviceInfo { /* for XAD_OUTDEVICE tag */
  335   xadSTRPTR xdi_DeviceName; /* name of device */
  336   xadUINT32 xdi_Unit;       /* unit of device */
  337   xadSTRPTR xdi_DOSName;    /* instead of Device+Unit, dos name without ':' */
  338 };
  339 
  340 struct xadSplitFile { /* for XAD_INSPLITTED */
  341   struct xadSplitFile *xsf_Next;
  342   xadUINT32            xsf_Type; /* XAD_INFILENAME, XAD_INFILEHANDLE, XAD_INMEMORY, XAD_INHOOK */
  343   xadSize              xsf_Size; /* necessary for XAD_INMEMORY, useful for others */
  344   xadUINT32            xsf_Data; /* FileName, Filehandle, Hookpointer or Memory */
  345 };
  346 
  347 struct xadSkipInfo {
  348   struct xadSkipInfo *xsi_Next;
  349   xadSize             xsi_Position; /* position, where it should be skipped */
  350   xadSize             xsi_SkipSize; /* size to skip */
  351 };
  352 
  353 struct xadImageInfo { /* for XADHC_IMAGEINFO */
  354   xadUINT32 xii_SectorSize;   /* usually 512 */
  355   xadUINT32 xii_FirstSector;  /* of the image file */
  356   xadUINT32 xii_NumSectors;   /* of the image file */
  357   xadUINT32 xii_TotalSectors; /* of this device type */
  358 };
  359 /* If the image file holds total data of disk xii_TotalSectors equals
  360    xii_NumSectors and xii_FirstSector is zero. Addition of xii_FirstSector
  361    and xii_NumSectors cannot exceed xii_TotalSectors value!
  362 */
  363 
  364 /************************************************************************
  365 *                                                                       *
  366 *    system information structure                                       *
  367 *                                                                       *
  368 ************************************************************************/
  369 struct xadSystemInfo {
  370   xadUINT16                xsi_Version;   /* master library version */
  371   xadUINT16                xsi_Revision;  /* master library revision */
  372   xadSize                  xsi_RecogSize; /* size for recognition */
  373 };
  374 
  375 /************************************************************************
  376 *                                                                       *
  377 *    information structures                                             *
  378 *                                                                       *
  379 ************************************************************************/
  380 
  381 struct xadArchiveInfo {
  382   struct xadClient *   xai_Client;   /* pointer to unarchiving client */
  383   xadPTR               xai_PrivateClient; /* private client data */
  384   xadSTRPTR            xai_Password; /* password for crypted archives */
  385   xadUINT32            xai_Flags;    /* read only XADAIF_ flags */
  386   xadUINT32            xai_LowCyl;   /* lowest cylinder to unarchive */
  387   xadUINT32            xai_HighCyl;  /* highest cylinder to unarchive */
  388   xadSize              xai_InPos;    /* input position, read only */
  389   xadSize              xai_InSize;   /* input size, read only */
  390   xadSize              xai_OutPos;   /* output position, read only */
  391   xadSize              xai_OutSize;  /* output file size, read only */
  392   struct xadFileInfo * xai_FileInfo; /* data pointer for file arcs */
  393   struct xadDiskInfo * xai_DiskInfo; /* data pointer for disk arcs */
  394   struct xadFileInfo * xai_CurFile;  /* data pointer for current file arc */
  395   struct xadDiskInfo * xai_CurDisk;  /* data pointer for current disk arc */
  396   xadERROR             xai_LastError;   /* last error, when XADAIF_FILECORRUPT (V2) */
  397   xadSize *            xai_MultiVolume; /* array of start offsets from parts (V2) */
  398   struct xadSkipInfo * xai_SkipInfo;    /* linked list of skip entries (V3) */
  399   struct xadImageInfo *xai_ImageInfo;   /* for filesystem clients (V5) */
  400   xadSTRPTR            xai_InName;   /* Input archive name if available (V7) */
  401 };
  402 /* This structure is nearly complete private to either xadmaster or its
  403 clients. An application program may access for reading only xai_Client,
  404 xai_Flags, xai_FileInfo and xai_DiskInfo. For xai_Flags only XADAIF_CRYPTED
  405 and XADAIF_FILECORRUPT are useful. All the other stuff is private and should
  406 not be accessed! */
  407 
  408 #define XADAIB_CRYPTED           0 /* archive entries are encrypted */
  409 #define XADAIB_FILECORRUPT       1 /* file is corrupt, but valid entries are in the list */
  410 #define XADAIB_FILEARCHIVE       2 /* unarchive file entry */
  411 #define XADAIB_DISKARCHIVE       3 /* unarchive disk entry */
  412 #define XADAIB_OVERWRITE         4 /* overwrite the file (PRIVATE) */
  413 #define XADAIB_MAKEDIRECTORY     5 /* create directory when missing (PRIVATE) */
  414 #define XADAIB_IGNOREGEOMETRY    6 /* ignore drive geometry (PRIVATE) */
  415 #define XADAIB_VERIFY            7 /* verify is turned on for disk hook (PRIVATE) */
  416 #define XADAIB_NOKILLPARTIAL     8 /* do not delete partial files (PRIVATE) */
  417 #define XADAIB_DISKIMAGE         9 /* is disk image extraction (V5) */
  418 #define XADAIB_FORMAT           10 /* format in disk hook (PRIVATE) */
  419 #define XADAIB_NOEMPTYERROR     11 /* do not create empty error (PRIVATE) */
  420 #define XADAIB_ONLYIN           12 /* in stuff only (PRIVATE) */
  421 #define XADAIB_ONLYOUT          13 /* out stuff only (PRIVATE) */
  422 #define XADAIB_USESECTORLABELS  14 /* use SectorLabels (PRIVATE) */
  423 
  424 #define XADAIF_CRYPTED          (1<<XADAIB_CRYPTED)
  425 #define XADAIF_FILECORRUPT      (1<<XADAIB_FILECORRUPT)
  426 #define XADAIF_FILEARCHIVE      (1<<XADAIB_FILEARCHIVE)
  427 #define XADAIF_DISKARCHIVE      (1<<XADAIB_DISKARCHIVE)
  428 #define XADAIF_OVERWRITE        (1<<XADAIB_OVERWRITE)
  429 #define XADAIF_MAKEDIRECTORY    (1<<XADAIB_MAKEDIRECTORY)
  430 #define XADAIF_IGNOREGEOMETRY   (1<<XADAIB_IGNOREGEOMETRY)
  431 #define XADAIF_VERIFY           (1<<XADAIB_VERIFY)
  432 #define XADAIF_NOKILLPARTIAL    (1<<XADAIB_NOKILLPARTIAL)
  433 #define XADAIF_DISKIMAGE        (1<<XADAIB_DISKIMAGE)
  434 #define XADAIF_FORMAT           (1<<XADAIB_FORMAT)
  435 #define XADAIF_NOEMPTYERROR     (1<<XADAIB_NOEMPTYERROR)
  436 #define XADAIF_ONLYIN           (1<<XADAIB_ONLYIN)
  437 #define XADAIF_ONLYOUT          (1<<XADAIB_ONLYOUT)
  438 #define XADAIF_USESECTORLABELS  (1<<XADAIB_USESECTORLABELS)
  439 
  440 struct xadFileInfo {
  441   struct xadFileInfo * xfi_Next;
  442   xadUINT32            xfi_EntryNumber;/* number of entry */
  443   xadSTRPTR            xfi_EntryInfo;  /* additional archiver text */
  444   xadPTR               xfi_PrivateInfo;/* client private, see XAD_OBJPRIVINFOSIZE */
  445   xadUINT32            xfi_Flags;      /* see XADFIF_xxx defines */
  446   xadSTRPTR            xfi_FileName;   /* see XAD_OBJNAMESIZE tag */
  447   xadSTRPTR            xfi_Comment;    /* see XAD_OBJCOMMENTSIZE tag */
  448   xadUINT32            xfi_Protection; /* AmigaOS3 bits (including multiuser) */
  449   xadUINT32            xfi_OwnerUID;   /* user ID */
  450   xadUINT32            xfi_OwnerGID;   /* group ID */
  451   xadSTRPTR            xfi_UserName;   /* user name */
  452   xadSTRPTR            xfi_GroupName;  /* group name */
  453   xadSize              xfi_Size;       /* size of this file */
  454   xadSize              xfi_GroupCrSize;/* crunched size of group */
  455   xadSize              xfi_CrunchSize; /* crunched size */
  456   xadSTRPTR            xfi_LinkName;   /* name and path of link */
  457   struct xadDate       xfi_Date;
  458   xadUINT16            xfi_Generation; /* File Generation [0...0xFFFF] (V3) */
  459   xadSize              xfi_DataPos;    /* crunched data position (V3) */
  460   struct xadFileInfo * xfi_MacFork;    /* pointer to 2nd fork for Mac (V7) */
  461   xadUINT16            xfi_UnixProtect;/* protection bits for Unix (V11) */
  462   xadUINT8             xfi_DosProtect; /* protection bits for MS-DOS (V11) */
  463   xadUINT8             xfi_FileType;   /* XADFILETYPE to define type of exe files (V11) */
  464   struct xadSpecial *  xfi_Special;    /* pointer to special data (V11) */
  465 };
  466 
  467 /* These are used for xfi_FileType to define file type. (V11) */
  468 #define XADFILETYPE_DATACRUNCHER     1   /* infile was only one data file */
  469 #define XADFILETYPE_TEXTLINKER       2   /* infile was text-linked */
  470 
  471 #define XADFILETYPE_AMIGAEXECRUNCHER 11  /* infile was an Amiga exe cruncher */
  472 #define XADFILETYPE_AMIGAEXELINKER   12  /* infile was an Amiga exe linker */
  473 #define XADFILETYPE_AMIGATEXTLINKER  13  /* infile was an Amiga text-exe linker */
  474 #define XADFILETYPE_AMIGAADDRESS     14  /* infile was an Amiga address cruncher */
  475 
  476 #define XADFILETYPE_UNIXBLOCKDEVICE  21  /* this file is a block device */
  477 #define XADFILETYPE_UNIXCHARDEVICE   22  /* this file is a character device */
  478 #define XADFILETYPE_UNIXFIFO         23  /* this file is a named pipe */
  479 #define XADFILETYPE_UNIXSOCKET       24  /* this file is a socket */
  480 
  481 #define XADFILETYPE_MSDOSEXECRUNCHER 31  /* infile was an MSDOS exe cruncher */
  482 
  483 #define XADSPECIALTYPE_UNIXDEVICE    1 /* xadSpecial entry is xadSpecialUnixDevice */
  484 #define XADSPECIALTYPE_AMIGAADDRESS  2 /* xadSpecial entry is xadSpecialAmigaAddress */
  485 #define XADSPECIALTYPE_CBM8BIT       3 /* xadSpecial entry is xadSpecialCBM8bit */
  486 
  487 struct xadSpecialUnixDevice
  488 {
  489   xadUINT32 xfis_MajorVersion;    /* major device version */
  490   xadUINT32 xfis_MinorVersion;    /* minor device version */
  491 };
  492 
  493 struct xadSpecialAmigaAddress
  494 {
  495   xadUINT32 xfis_JumpAddress;     /* code execution start address */
  496   xadUINT32 xfis_DecrunchAddress; /* decrunch start of code */
  497 };
  498 
  499 struct xadSpecialCBM8bit
  500 {
  501   xadUINT8 xfis_FileType;        /* File type XADCBM8BITTYPE_xxx */
  502   xadUINT8 xfis_RecordLength;    /* record length if relative file */
  503 };
  504 #define XADCBM8BITTYPE_UNKNOWN  0x00    /*        Unknown / Unused */
  505 #define XADCBM8BITTYPE_BASIC    0x01    /* Tape - BASIC program file */
  506 #define XADCBM8BITTYPE_DATA     0x02    /* Tape - Data block (SEQ file) */
  507 #define XADCBM8BITTYPE_FIXED    0x03    /* Tape - Fixed addres program file */
  508 #define XADCBM8BITTYPE_SEQDATA  0x04    /* Tape - Sequential data file */
  509 #define XADCBM8BITTYPE_SEQ      0x81    /* Disk - Sequential file "SEQ" */
  510 #define XADCBM8BITTYPE_PRG      0x82    /* Disk - Program file "PRG" */
  511 #define XADCBM8BITTYPE_USR      0x83    /* Disk - User-defined file "USR" */
  512 #define XADCBM8BITTYPE_REL      0x84    /* Disk - Relative records file "REL" */
  513 #define XADCBM8BITTYPE_CBM      0x85    /* Disk - CBM (partition) "CBM" */
  514 
  515 struct xadSpecial
  516 {
  517   xadUINT32          xfis_Type; /* XADSPECIALTYPE to define type of block (V11) */
  518   struct xadSpecial *xfis_Next; /* pointer to next entry */
  519   union
  520   {
  521     struct xadSpecialUnixDevice   xfis_UnixDevice;
  522     struct xadSpecialAmigaAddress xfis_AmigaAddress;
  523     struct xadSpecialCBM8bit      xfis_CBM8bit;
  524   } xfis_Data;
  525 };
  526 
  527 /* Multiuser fields (xfi_OwnerUID, xfi_OwnerUID, xfi_UserName, xfi_GroupName)
  528    and multiuser bits (see <dos/dos.h>) are currently not supported with normal
  529    Amiga filesystem. But the clients support them, if archive format holds
  530    such information.
  531 
  532    The protection bits (all 3 fields) should always be set using the
  533    xadConvertProtection procedure. Call it with as much protection information
  534    as possible. It extracts the relevant data at best (and also sets the 2 flags).
  535    DO NOT USE these fields directly, but always through xadConvertProtection
  536    call.
  537 */
  538 
  539 #define XADFIB_CRYPTED          0 /* entry is crypted */
  540 #define XADFIB_DIRECTORY        1 /* entry is a directory */
  541 #define XADFIB_LINK             2 /* entry is a link */
  542 #define XADFIB_INFOTEXT         3 /* file is an information text */
  543 #define XADFIB_GROUPED          4 /* file is in a crunch group */
  544 #define XADFIB_ENDOFGROUP       5 /* crunch group ends here */
  545 #define XADFIB_NODATE           6 /* no date supported, CURRENT date is set */
  546 #define XADFIB_DELETED          7 /* file is marked as deleted (V3) */
  547 #define XADFIB_SEEKDATAPOS      8 /* before unarchiving the datapos is set (V3) */
  548 #define XADFIB_NOFILENAME       9 /* there was no filename, using internal one (V6) */
  549 #define XADFIB_NOUNCRUNCHSIZE  10 /* file size is unknown and thus set to zero (V6) */
  550 #define XADFIB_PARTIALFILE     11 /* file is only partial (V6) */
  551 #define XADFIB_MACDATA         12 /* file is Apple data fork (V7) */
  552 #define XADFIB_MACRESOURCE     13 /* file is Apple resource fork (V7) */
  553 #define XADFIB_EXTRACTONBUILD  14 /* allows extract file during scanning (V10) */
  554 #define XADFIB_UNIXPROTECTION  15 /* UNIX protection bits are present (V11) */
  555 #define XADFIB_DOSPROTECTION   16 /* MSDOS protection bits are present (V11) */
  556 #define XADFIB_ENTRYMAYCHANGE  17 /* this entry may change until GetInfo is finished (V11) */
  557 #define XADFIB_XADSTRFILENAME  18 /* the xfi_FileName fields is an XAD string (V12) */
  558 #define XADFIB_XADSTRLINKNAME  19 /* the xfi_LinkName fields is an XAD string (V12) */
  559 #define XADFIB_XADSTRCOMMENT   20 /* the xfi_Comment fields is an XAD string (V12) */
  560 
  561 #define XADFIF_CRYPTED          (1<<XADFIB_CRYPTED)
  562 #define XADFIF_DIRECTORY        (1<<XADFIB_DIRECTORY)
  563 #define XADFIF_LINK             (1<<XADFIB_LINK)
  564 #define XADFIF_INFOTEXT         (1<<XADFIB_INFOTEXT)
  565 #define XADFIF_GROUPED          (1<<XADFIB_GROUPED)
  566 #define XADFIF_ENDOFGROUP       (1<<XADFIB_ENDOFGROUP)
  567 #define XADFIF_NODATE           (1<<XADFIB_NODATE)
  568 #define XADFIF_DELETED          (1<<XADFIB_DELETED)
  569 #define XADFIF_SEEKDATAPOS      (1<<XADFIB_SEEKDATAPOS)
  570 #define XADFIF_NOFILENAME       (1<<XADFIB_NOFILENAME)
  571 #define XADFIF_NOUNCRUNCHSIZE   (1<<XADFIB_NOUNCRUNCHSIZE)
  572 #define XADFIF_PARTIALFILE      (1<<XADFIB_PARTIALFILE)
  573 #define XADFIF_MACDATA          (1<<XADFIB_MACDATA)
  574 #define XADFIF_MACRESOURCE      (1<<XADFIB_MACRESOURCE)
  575 #define XADFIF_EXTRACTONBUILD   (1<<XADFIB_EXTRACTONBUILD)
  576 #define XADFIF_UNIXPROTECTION   (1<<XADFIB_UNIXPROTECTION)
  577 #define XADFIF_DOSPROTECTION    (1<<XADFIB_DOSPROTECTION)
  578 #define XADFIF_ENTRYMAYCHANGE   (1<<XADFIB_ENTRYMAYCHANGE)
  579 #define XADFIF_XADSTRFILENAME   (1<<XADFIB_XADSTRFILENAME)
  580 #define XADFIF_XADSTRLINKNAME   (1<<XADFIB_XADSTRLINKNAME)
  581 #define XADFIF_XADSTRCOMMENT    (1<<XADFIB_XADSTRCOMMENT)
  582 
  583 /* NOTE: the texts passed with that structure must not always be printable.
  584    Although the clients should add an additional (not counted) zero at the text
  585    end, the whole file may contain other unprintable stuff (e.g. for DMS).
  586    So when printing this texts do it on a byte for byte base including
  587    printability checks.
  588 */
  589 struct xadTextInfo {
  590   struct xadTextInfo *  xti_Next;
  591   xadSize               xti_Size;  /* maybe zero - no text - e.g. when crypted */
  592   xadSTRPTR             xti_Text;  /* and there is no password in xadGetInfo() */
  593   xadUINT32             xti_Flags; /* see XADTIF_xxx defines */
  594 };
  595 
  596 #define XADTIB_CRYPTED          0 /* entry is empty, as data was crypted */
  597 #define XADTIB_BANNER           1 /* text is a banner */
  598 #define XADTIB_FILEDIZ          2 /* text is a file description */
  599 
  600 #define XADTIF_CRYPTED          (1<<XADTIB_CRYPTED)
  601 #define XADTIF_BANNER           (1<<XADTIB_BANNER)
  602 #define XADTIF_FILEDIZ          (1<<XADTIB_FILEDIZ)
  603 
  604 struct xadDiskInfo {
  605   struct xadDiskInfo *  xdi_Next;
  606   xadUINT32             xdi_EntryNumber;  /* number of entry */
  607   xadSTRPTR             xdi_EntryInfo;    /* additional archiver text */
  608   xadPTR                xdi_PrivateInfo;  /* client private, see XAD_OBJPRIVINFOSIZE */
  609   xadUINT32             xdi_Flags;        /* see XADDIF_xxx defines */
  610   xadUINT32             xdi_SectorSize;
  611   xadUINT32             xdi_TotalSectors; /* see devices/trackdisk.h */
  612   xadUINT32             xdi_Cylinders;    /* to find out what these */
  613   xadUINT32             xdi_CylSectors;   /* fields mean, they are equal */
  614   xadUINT32             xdi_Heads;        /* to struct DriveGeometry */
  615   xadUINT32             xdi_TrackSectors;
  616   xadUINT32             xdi_LowCyl;       /* lowest cylinder stored */
  617   xadUINT32             xdi_HighCyl;      /* highest cylinder stored */
  618   xadUINT32             xdi_BlockInfoSize;/* number of BlockInfo entries */
  619   xadUINT8 *            xdi_BlockInfo;    /* see XADBIF_xxx defines and XAD_OBJBLOCKENTRIES tag */
  620   struct xadTextInfo *  xdi_TextInfo;     /* linked list with info texts */
  621   xadSize               xdi_DataPos;      /* crunched data position (V3) */
  622 };
  623 
  624 /* BlockInfo points to a xadUINT8 field for every track from first sector of
  625    lowest cylinder to last sector of highest cylinder. When not used,
  626    pointer must be 0. Do not use it, when there are no entries!
  627    This is just for information. The applications still asks the client
  628    to unarchive whole cylinders and not archived blocks are cleared for
  629    unarchiving.
  630 */
  631 
  632 #define XADDIB_CRYPTED            0 /* entry is crypted */
  633 #define XADDIB_SEEKDATAPOS        1 /* before unarchiving the datapos is set (V3) */
  634 #define XADDIB_SECTORLABELS       2 /* the clients delivers sector labels (V9) */
  635 #define XADDIB_EXTRACTONBUILD     3 /* allows extract disk during scanning (V10) */
  636 #define XADDIB_ENTRYMAYCHANGE     4 /* this entry may change until GetInfo is finished (V11) */
  637 
  638 /* Some of the crunchers do not store all necessary information, so it
  639 may be needed to guess some of them. Set the following flags in that case
  640 and geometry check will ignore these fields. */
  641 #define XADDIB_GUESSSECTORSIZE    5 /* sectorsize is guessed (V10) */
  642 #define XADDIB_GUESSTOTALSECTORS  6 /* totalsectors number is guessed (V10) */
  643 #define XADDIB_GUESSCYLINDERS     7 /* cylinder number is guessed */
  644 #define XADDIB_GUESSCYLSECTORS    8 /* cylsectors is guessed */
  645 #define XADDIB_GUESSHEADS         9 /* number of heads is guessed */
  646 #define XADDIB_GUESSTRACKSECTORS 10 /* tracksectors is guessed */
  647 #define XADDIB_GUESSLOWCYL       11 /* lowcyl is guessed */
  648 #define XADDIB_GUESSHIGHCYL      12 /* highcyl is guessed */
  649 
  650 /* If it is impossible to set some of the fields, you need to set some of
  651 these flags. NOTE: XADDIB_NOCYLINDERS is really important, as this turns
  652 off usage of lowcyl and highcyl keywords. When you have cylinder information,
  653 you should not use these and instead use guess flags and calculate
  654 possible values for the missing fields. */
  655 #define XADDIB_NOCYLINDERS       15 /* cylinder number is not set */
  656 #define XADDIB_NOCYLSECTORS      16 /* cylsectors is not set */
  657 #define XADDIB_NOHEADS           17 /* number of heads is not set */
  658 #define XADDIB_NOTRACKSECTORS    18 /* tracksectors is not set */
  659 #define XADDIB_NOLOWCYL          19 /* lowcyl is not set */
  660 #define XADDIB_NOHIGHCYL         20 /* highcyl is not set */
  661 
  662 #define XADDIF_CRYPTED           (1<<XADDIB_CRYPTED)
  663 #define XADDIF_SEEKDATAPOS       (1<<XADDIB_SEEKDATAPOS)
  664 #define XADDIF_SECTORLABELS      (1<<XADDIB_SECTORLABELS)
  665 #define XADDIF_EXTRACTONBUILD    (1<<XADDIB_EXTRACTONBUILD)
  666 #define XADDIF_ENTRYMAYCHANGE    (1<<XADDIB_ENTRYMAYCHANGE)
  667 
  668 #define XADDIF_GUESSSECTORSIZE   (1<<XADDIB_GUESSSECTORSIZE)
  669 #define XADDIF_GUESSTOTALSECTORS (1<<XADDIB_GUESSTOTALSECTORS)
  670 #define XADDIF_GUESSCYLINDERS    (1<<XADDIB_GUESSCYLINDERS)
  671 #define XADDIF_GUESSCYLSECTORS   (1<<XADDIB_GUESSCYLSECTORS)
  672 #define XADDIF_GUESSHEADS        (1<<XADDIB_GUESSHEADS)
  673 #define XADDIF_GUESSTRACKSECTORS (1<<XADDIB_GUESSTRACKSECTORS)
  674 #define XADDIF_GUESSLOWCYL       (1<<XADDIB_GUESSLOWCYL)
  675 #define XADDIF_GUESSHIGHCYL      (1<<XADDIB_GUESSHIGHCYL)
  676 
  677 #define XADDIF_NOCYLINDERS       (1<<XADDIB_NOCYLINDERS)
  678 #define XADDIF_NOCYLSECTORS      (1<<XADDIB_NOCYLSECTORS)
  679 #define XADDIF_NOHEADS           (1<<XADDIB_NOHEADS)
  680 #define XADDIF_NOTRACKSECTORS    (1<<XADDIB_NOTRACKSECTORS)
  681 #define XADDIF_NOLOWCYL          (1<<XADDIB_NOLOWCYL)
  682 #define XADDIF_NOHIGHCYL         (1<<XADDIB_NOHIGHCYL)
  683 
  684 /* defines for BlockInfo */
  685 #define XADBIB_CLEARED          0 /* this block was cleared for archiving */
  686 #define XADBIB_UNUSED           1 /* this block was not archived */
  687 
  688 #define XADBIF_CLEARED          (1<<XADBIB_CLEARED)
  689 #define XADBIF_UNUSED           (1<<XADBIB_UNUSED)
  690 
  691 /************************************************************************
  692 *                                                                       *
  693 *    progress report stuff                                              *
  694 *                                                                       *
  695 ************************************************************************/
  696 
  697 struct xadProgressInfo {
  698   xadUINT32             xpi_Mode;       /* work modus */
  699   struct xadClient *    xpi_Client;     /* the client doing the work */
  700   struct xadDiskInfo *  xpi_DiskInfo;   /* current diskinfo, for disks */
  701   struct xadFileInfo *  xpi_FileInfo;   /* current info for files */
  702   xadSize               xpi_CurrentSize;/* current filesize */
  703   xadUINT32             xpi_LowCyl;     /* for disks only */
  704   xadUINT32             xpi_HighCyl;    /* for disks only */
  705   xadUINT32             xpi_Status;     /* see XADPIF flags */
  706   xadERROR              xpi_Error;      /* any of the error codes */
  707   xadSTRPTR             xpi_FileName;   /* name of file to overwrite (V2) */
  708   xadSTRPTR             xpi_NewName;    /* new name buffer, passed by hook (V2) */
  709 };
  710 /* NOTE: For disks CurrentSize is Sector*SectorSize, where SectorSize can
  711 be found in xadDiskInfo structure. So you may output the sector value. */
  712 
  713 /* different progress modes */
  714 #define XADPMODE_ASK            1
  715 #define XADPMODE_PROGRESS       2
  716 #define XADPMODE_END            3
  717 #define XADPMODE_ERROR          4
  718 #define XADPMODE_NEWENTRY       5 /* (V10) */
  719 #define XADPMODE_GETINFOEND     6 /* (V11) */
  720 
  721 /* flags for progress hook and ProgressInfo status field */
  722 #define XADPIB_OVERWRITE         0 /* overwrite the file */
  723 #define XADPIB_MAKEDIRECTORY     1 /* create the directory */
  724 #define XADPIB_IGNOREGEOMETRY    2 /* ignore drive geometry */
  725 #define XADPIB_ISDIRECTORY       3 /* destination is a directory (V10) */
  726 #define XADPIB_RENAME           10 /* rename the file (V2) */
  727 #define XADPIB_OK               16 /* all ok, proceed */
  728 #define XADPIB_SKIP             17 /* skip file */
  729 
  730 #define XADPIF_OVERWRITE        (1<<XADPIB_OVERWRITE)
  731 #define XADPIF_MAKEDIRECTORY    (1<<XADPIB_MAKEDIRECTORY)
  732 #define XADPIF_IGNOREGEOMETRY   (1<<XADPIB_IGNOREGEOMETRY)
  733 #define XADPIF_ISDIRECTORY      (1<<XADPIB_ISDIRECTORY)
  734 #define XADPIF_RENAME           (1<<XADPIB_RENAME)
  735 #define XADPIF_OK               (1<<XADPIB_OK)
  736 #define XADPIF_SKIP             (1<<XADPIB_SKIP)
  737 
  738 /************************************************************************
  739 *                                                                       *
  740 *    errors                                                             *
  741 *                                                                       *
  742 ************************************************************************/
  743 
  744 #define XADERR_OK               0x0000 /* no error */
  745 #define XADERR_UNKNOWN          0x0001 /* unknown error */
  746 #define XADERR_INPUT            0x0002 /* input data buffers border exceeded */
  747 #define XADERR_OUTPUT           0x0003 /* output data buffers border exceeded */
  748 #define XADERR_BADPARAMS        0x0004 /* function called with illegal parameters */
  749 #define XADERR_NOMEMORY         0x0005 /* not enough memory available */
  750 #define XADERR_ILLEGALDATA      0x0006 /* data is corrupted */
  751 #define XADERR_NOTSUPPORTED     0x0007 /* command is not supported */
  752 #define XADERR_RESOURCE         0x0008 /* required resource missing */
  753 #define XADERR_DECRUNCH         0x0009 /* error on decrunching */
  754 #define XADERR_FILETYPE         0x000A /* unknown file type */
  755 #define XADERR_OPENFILE         0x000B /* opening file failed */
  756 #define XADERR_SKIP             0x000C /* file, disk has been skipped */
  757 #define XADERR_BREAK            0x000D /* user break in progress hook */
  758 #define XADERR_FILEEXISTS       0x000E /* file already exists */
  759 #define XADERR_PASSWORD         0x000F /* missing or wrong password */
  760 #define XADERR_MAKEDIR          0x0010 /* could not create directory */
  761 #define XADERR_CHECKSUM         0x0011 /* wrong checksum */
  762 #define XADERR_VERIFY           0x0012 /* verify failed (disk hook) */
  763 #define XADERR_GEOMETRY         0x0013 /* wrong drive geometry */
  764 #define XADERR_DATAFORMAT       0x0014 /* unknown data format */
  765 #define XADERR_EMPTY            0x0015 /* source contains no files */
  766 #define XADERR_FILESYSTEM       0x0016 /* unknown filesystem */
  767 #define XADERR_FILEDIR          0x0017 /* name of file exists as directory */
  768 #define XADERR_SHORTBUFFER      0x0018 /* buffer was too short */
  769 #define XADERR_ENCODING         0x0019 /* text encoding was defective */
  770 
  771 /************************************************************************
  772 *                                                                       *
  773 *    characterset and filename conversion                               *
  774 *                                                                       *
  775 ************************************************************************/
  776 
  777 #define CHARSET_HOST                      0 /* this is the ONLY destination setting for clients! */
  778 
  779 #define CHARSET_UNICODE_UCS2_HOST         10 /* 16bit Unicode (usually no source type) */
  780 #define CHARSET_UNICODE_UCS2_BIGENDIAN    11 /* 16bit Unicode big endian storage */
  781 #define CHARSET_UNICODE_UCS2_LITTLEENDIAN 12 /* 16bit Unicode little endian storage */
  782 #define CHARSET_UNICODE_UTF8              13 /* variable size unicode encoding */
  783 
  784 /* all the 1xx types are generic types which also maybe a bit dynamic */
  785 #define CHARSET_AMIGA                   100 /* the default Amiga charset */
  786 #define CHARSET_MSDOS                   101 /* the default MSDOS charset */
  787 #define CHARSET_MACOS                   102 /* the default MacOS charset */
  788 #define CHARSET_C64                     103 /* the default C64 charset */
  789 #define CHARSET_ATARI_ST                104 /* the default Atari ST charset */
  790 #define CHARSET_WINDOWS                 105 /* the default Windows charset */
  791 
  792 /* all the 2xx to 9xx types are real charsets, use them whenever you know
  793    what the data really is */
  794 #define CHARSET_ASCII                   200 /* the lower 7 bits of ASCII charsets */
  795 #define CHARSET_ISO_8859_1              201 /* the base charset */
  796 #define CHARSET_ISO_8859_15             215 /* Euro-sign fixed ISO variant */
  797 #define CHARSET_ATARI_ST_US             300 /* Atari ST (US) charset */
  798 #define CHARSET_PETSCII_C64_LC          301 /* C64 lower case charset */
  799 #define CHARSET_CODEPAGE_437            400 /* IBM Codepage 437 charset */
  800 #define CHARSET_CODEPAGE_1252           401 /* Windows Codepage 1252 charset */
  801 
  802 /************************************************************************
  803 *                                                                       *
  804 *    client related stuff                                               *
  805 *                                                                       *
  806 ************************************************************************/
  807 
  808 struct xadForeman {
  809   xadUINT32          xfm_Security;    /* should be XADFOREMAN_SECURITY */
  810   xadUINT32          xfm_ID;          /* must be XADFOREMAN_ID */
  811   xadUINT16          xfm_Version;     /* set to XADFOREMAN_VERSION */
  812   xadUINT16          xfm_Reserved;
  813   xadSTRPTR          xfm_VersString;  /* pointer to $VER: string */
  814   struct xadClient * xfm_FirstClient; /* pointer to first client */
  815 };
  816 
  817 #define XADFOREMAN_SECURITY     0x70FF4E75 /* MOVEQ #-1,D0 and RTS */
  818 #define XADFOREMAN_ID           0x58414446 /* 'XADF' identification ID */
  819 #define XADFOREMAN_VERSION      1
  820 
  821 struct xadClient {
  822   struct xadClient * xc_Next;
  823   xadUINT16          xc_Version;    /* set to XADCLIENT_VERSION */
  824   xadUINT16          xc_MasterVersion;
  825   xadUINT16          xc_ClientVersion;
  826   xadUINT16          xc_ClientRevision;
  827   xadSize            xc_RecogSize;  /* needed size to recog the type */
  828   xadUINT32          xc_Flags;      /* see XADCF_xxx defines */
  829   xadUINT32          xc_Identifier; /* ID of internal clients */
  830   xadSTRPTR          xc_ArchiverName;
  831   xadBOOL         (* xc_RecogData)();
  832   xadERROR        (* xc_GetInfo)();
  833   xadERROR        (* xc_UnArchive)();
  834   void            (* xc_Free)();
  835 };
  836 
  837 /* function interface
  838 ASM(xadBOOL) xc_RecogData(REG(d0, xadSize size), REG(a0, xadUINT8 *data),
  839                 REG(a6, struct xadMasterBase *xadMasterBase));
  840 ASM(xadERROR) xc_GetInfo(REG(a0, struct xadArchiveInfo *ai),
  841                 REG(a6, struct xadMasterBase *xadMasterBase));
  842 ASM(xadERROR) xc_UnArchive(REG(a0, struct xadArchiveInfo *ai),
  843                 REG(a6, struct xadMasterBase *xadMasterBase));
  844 ASM(void) xc_Free(REG(a0, struct xadArchiveInfo *ai),
  845                 REG(a6, struct xadMasterBase *xadMasterBase));
  846 */
  847 
  848 /* xc_RecogData returns 1 when recognized and 0 when not, all the others
  849    return 0 when ok and XADERR values on error. xc_Free has no return
  850    value.
  851 
  852    Filesystem clients need to clear xc_RecogSize and xc_RecogData. The
  853    recognition is automatically done by GetInfo. XADERR_FILESYSTEM is
  854    returned in case of unknown format. If it is known detection should
  855    go on and any other code may be returned, if it fails.
  856    The field xc_ArchiverName means xc_FileSystemName for filesystem
  857    clients.
  858 */
  859 
  860 #define XADCLIENT_VERSION       1
  861 
  862 #define XADCB_FILEARCHIVER       0 /* archiver is a file archiver */
  863 #define XADCB_DISKARCHIVER       1 /* archiver is a disk archiver */
  864 #define XADCB_EXTERN             2 /* external client, set by xadmaster */
  865 #define XADCB_FILESYSTEM         3 /* filesystem clients (V5) */
  866 #define XADCB_NOCHECKSIZE        4 /* do not check size for recog call (V6) */
  867 #define XADCB_DATACRUNCHER       5 /* file archiver is plain data file (V11) */
  868 #define XADCB_EXECRUNCHER        6 /* file archiver is executable file (V11) */
  869 #define XADCB_ADDRESSCRUNCHER    7 /* file archiver is address crunched file (V11) */
  870 #define XADCB_LINKER             8 /* file archiver is a linker file (V11) */
  871 #define XADCB_FREEXADSTRINGS    25 /* master frees XAD strings (V12) */
  872 #define XADCB_FREESPECIALINFO   26 /* master frees xadSpecial  structures (V11) */
  873 #define XADCB_FREESKIPINFO      27 /* master frees xadSkipInfo structures (V3) */
  874 #define XADCB_FREETEXTINFO      28 /* master frees xadTextInfo structures (V2) */
  875 #define XADCB_FREETEXTINFOTEXT  29 /* master frees xadTextInfo text block (V2) */
  876 #define XADCB_FREEFILEINFO      30 /* master frees xadFileInfo structures (V2) */
  877 #define XADCB_FREEDISKINFO      31 /* master frees xadDiskInfo structures (V2) */
  878 
  879 #define XADCF_FILEARCHIVER      (1UL<<XADCB_FILEARCHIVER)
  880 #define XADCF_DISKARCHIVER      (1UL<<XADCB_DISKARCHIVER)
  881 #define XADCF_EXTERN            (1UL<<XADCB_EXTERN)
  882 #define XADCF_FILESYSTEM        (1UL<<XADCB_FILESYSTEM)
  883 #define XADCF_NOCHECKSIZE       (1UL<<XADCB_NOCHECKSIZE)
  884 #define XADCF_DATACRUNCHER      (1UL<<XADCB_DATACRUNCHER)
  885 #define XADCF_EXECRUNCHER       (1UL<<XADCB_EXECRUNCHER)
  886 #define XADCF_ADDRESSCRUNCHER   (1UL<<XADCB_ADDRESSCRUNCHER)
  887 #define XADCF_LINKER            (1UL<<XADCB_LINKER)
  888 #define XADCF_FREEXADSTRINGS    (1UL<<XADCB_FREEXADSTRINGS)
  889 #define XADCF_FREESPECIALINFO   (1UL<<XADCB_FREESPECIALINFO)
  890 #define XADCF_FREESKIPINFO      (1UL<<XADCB_FREESKIPINFO)
  891 #define XADCF_FREETEXTINFO      (1UL<<XADCB_FREETEXTINFO)
  892 #define XADCF_FREETEXTINFOTEXT  (1UL<<XADCB_FREETEXTINFOTEXT)
  893 #define XADCF_FREEFILEINFO      (1UL<<XADCB_FREEFILEINFO)
  894 #define XADCF_FREEDISKINFO      (1UL<<XADCB_FREEDISKINFO)
  895 
  896 /* The types 5 to 9 always need XADCB_FILEARCHIVER set also. These only specify
  897 the type of the archiver somewhat better. Do not mix real archivers and these
  898 single file data clients. */
  899 
  900 /************************************************************************
  901 *                                                                       *
  902 *    client ID's                                                        *
  903 *                                                                       *
  904 ************************************************************************/
  905 
  906 /* If an external client has set the xc_Identifier field, the internal
  907 client is replaced. */
  908 
  909 /* disk archivers start with 1000 */
  910 #define XADCID_XMASH                    1000
  911 #define XADCID_SUPERDUPER3              1001
  912 #define XADCID_XDISK                    1002
  913 #define XADCID_PACKDEV                  1003
  914 #define XADCID_ZOOM                     1004
  915 #define XADCID_ZOOM5                    1005
  916 #define XADCID_CRUNCHDISK               1006
  917 #define XADCID_PACKDISK                 1007
  918 #define XADCID_MDC                      1008
  919 #define XADCID_COMPDISK                 1009
  920 #define XADCID_LHWARP                   1010
  921 #define XADCID_SAVAGECOMPRESSOR         1011
  922 #define XADCID_WARP                     1012
  923 #define XADCID_GDC                      1013
  924 #define XADCID_DCS                      1014
  925 #define XADCID_MSA                      1015
  926 #define XADCID_COP                      1016
  927 #define XADCID_DIMP                     1017
  928 #define XADCID_DIMPSFX                  1018
  929 
  930 /* file archivers start with 5000 */
  931 #define XADCID_TAR                      5000
  932 #define XADCID_SDSSFX                   5001
  933 #define XADCID_LZX                      5002
  934 #define XADCID_MXMSIMPLEARC             5003
  935 #define XADCID_LHPAK                    5004
  936 #define XADCID_AMIGAPLUSUNPACK          5005
  937 #define XADCID_AMIPACK                  5006
  938 #define XADCID_LHA                      5007
  939 #define XADCID_LHASFX                   5008
  940 #define XADCID_PCOMPARC                 5009
  941 #define XADCID_SOMNI                    5010
  942 #define XADCID_LHSFX                    5011
  943 #define XADCID_XPKARCHIVE               5012
  944 #define XADCID_SHRINK                   5013
  945 #define XADCID_SPACK                    5014
  946 #define XADCID_SPACKSFX                 5015
  947 #define XADCID_ZIP                      5016
  948 #define XADCID_WINZIPEXE                5017
  949 #define XADCID_GZIP                     5018
  950 #define XADCID_ARC                      5019
  951 #define XADCID_ZOO                      5020
  952 #define XADCID_LHAEXE                   5021
  953 #define XADCID_ARJ                      5022
  954 #define XADCID_ARJEXE                   5023
  955 #define XADCID_ZIPEXE                   5024
  956 #define XADCID_LHF                      5025
  957 #define XADCID_COMPRESS                 5026
  958 #define XADCID_ACE                      5027
  959 #define XADCID_ACEEXE                   5028
  960 #define XADCID_GZIPSFX                  5029
  961 #define XADCID_HA                       5030
  962 #define XADCID_SQ                       5031
  963 #define XADCID_LHAC64SFX                5032
  964 #define XADCID_SIT                      5033
  965 #define XADCID_SIT5                     5034
  966 #define XADCID_SIT5EXE                  5035
  967 #define XADCID_MACBINARY                5036
  968 #define XADCID_CPIO                     5037
  969 #define XADCID_PACKIT                   5038
  970 #define XADCID_CRUNCH                   5039
  971 #define XADCID_ARCCBM                   5040
  972 #define XADCID_ARCCBMSFX                5041
  973 #define XADCID_CAB                      5042
  974 #define XADCID_CABMSEXE                 5043
  975 #define XADCID_RPM                      5044
  976 #define XADCID_BZIP2                    5045
  977 #define XADCID_BZIP2SFX                 5046
  978 #define XADCID_BZIP                     5047
  979 #define XADCID_IDPAK                    5048
  980 #define XADCID_IDWAD                    5049
  981 #define XADCID_IDWAD2                   5050
  982 
  983 /* filesystem client start with 8000 */
  984 #define XADCID_FSAMIGA                  8000
  985 #define XADCID_FSSANITYOS               8001
  986 #define XADCID_FSFAT                    8002
  987 #define XADCID_FSTRDOS                  8003
  988 
  989 /* mixed archivers start with 9000 */
  990 #define XADCID_DMS                      9000
  991 #define XADCID_DMSSFX                   9001
  992 
  993 #ifdef __cplusplus
  994 }
  995 #endif
  996 
  997 #endif /* LIBRARIES_XADMASTER_H */