uudeview.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of uudeview, the simple and friendly multi-part multi-
00003  * file uudecoder program (c) 1994-2001 by Frank Pilhofer. The author may
00004  * be contacted at [email protected]
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  * GNU General Public License for more details.
00015  */
00016 
00017 #ifndef __UUDEVIEW_H__
00018 #define __UUDEVIEW_H__
00019 
00020 /*
00021  * This include file features all the definitions that should
00022  * be externally visible. This isn't much.
00023  *
00024  * $Id: uudeview.h 2 2006-10-02 20:45:58Z csk $
00025  */
00026 
00027 #ifndef _ANSI_ARGS_
00028 #ifdef PROTOTYPES
00029 #define _ANSI_ARGS_(c) c
00030 #else
00031 #define _ANSI_ARGS_(c) ()
00032 #endif
00033 #endif
00034 
00035 /*
00036  * Message Types
00037  */
00038 
00039 #define UUMSG_MESSAGE (0) /* just a message, nothing important */
00040 #define UUMSG_NOTE (1) /* something that should be noticed */
00041 #define UUMSG_WARNING (2) /* important msg, processing continues */
00042 #define UUMSG_ERROR (3) /* processing has been terminated */
00043 #define UUMSG_FATAL (4) /* decoder cannot process further requests */
00044 #define UUMSG_PANIC (5) /* recovery impossible, app must terminate */
00045 
00046 /*
00047  * Return Values
00048  */
00049 
00050 #define UURET_OK (0) /* everything went fine */
00051 #define UURET_IOERR (1) /* I/O Error - examine errno */
00052 #define UURET_NOMEM (2) /* not enough memory */
00053 #define UURET_ILLVAL (3) /* illegal value for operation */
00054 #define UURET_NODATA (4) /* decoder didn't find any data */
00055 #define UURET_NOEND (5) /* encoded data wasn't ended properly */
00056 #define UURET_UNSUP (6) /* unsupported function (encoding) */
00057 #define UURET_EXISTS (7) /* file exists (decoding) */
00058 #define UURET_CONT (8) /* continue -- special from ScanPart */
00059 #define UURET_CANCEL (9) /* operation canceled */
00060 
00061 /*
00062  * File states, may be OR'ed
00063  */
00064 
00065 #define UUFILE_READ (0) /* Read in, but not further processed */
00066 #define UUFILE_MISPART (1) /* Missing Part(s) detected */
00067 #define UUFILE_NOBEGIN (2) /* No 'begin' found */
00068 #define UUFILE_NOEND (4) /* No 'end' found */
00069 #define UUFILE_NODATA (8) /* File does not contain valid uudata */
00070 #define UUFILE_OK (16) /* All Parts found, ready to decode */
00071 #define UUFILE_ERROR (32) /* Error while decoding */
00072 #define UUFILE_DECODED (64) /* Successfully decoded */
00073 #define UUFILE_TMPFILE (128) /* Temporary decoded file exists */
00074 
00075 /*
00076  * Encoding Types
00077  */
00078 
00079 #define UU_ENCODED (1) /* UUencoded data */
00080 #define B64ENCODED (2) /* Mime-Base64 data */
00081 #define XX_ENCODED (3) /* XXencoded data */
00082 #define BH_ENCODED (4) /* Binhex encoded */
00083 #define PT_ENCODED (5) /* Plain-Text encoded (MIME) */
00084 #define QP_ENCODED (6) /* Quoted-Printable (MIME) */
00085 #define YENC_ENCODED (7) /* yEnc encoded */
00086 
00087 /*
00088  * Option indices for GetOption / SetOption
00089  */
00090 
00091 #define UUOPT_VERSION (0) /* version number MAJOR.MINORplPATCH (ro) */
00092 #define UUOPT_FAST (1) /* assumes only one part per file */
00093 #define UUOPT_DUMBNESS (2) /* switch off the program's intelligence */
00094 #define UUOPT_BRACKPOL (3) /* give numbers in [] higher precendence */
00095 #define UUOPT_VERBOSE (4) /* generate informative messages */
00096 #define UUOPT_DESPERATE (5) /* try to decode incomplete files */
00097 #define UUOPT_IGNREPLY (6) /* ignore RE:plies (off by default) */
00098 #define UUOPT_OVERWRITE (7) /* whether it's OK to overwrite ex. files */
00099 #define UUOPT_SAVEPATH (8) /* prefix to save-files on disk */
00100 #define UUOPT_IGNMODE (9) /* ignore the original file mode */
00101 #define UUOPT_DEBUG (10) /* print messages with FILE/LINE info */
00102 #define UUOPT_ERRNO (14) /* get last error code for UURET_IOERR (ro) */
00103 #define UUOPT_PROGRESS (15) /* retrieve progress information */
00104 #define UUOPT_USETEXT (16) /* handle text messages */
00105 #define UUOPT_PREAMB (17) /* handle Mime preambles/epilogues */
00106 #define UUOPT_TINYB64 (18) /* detect short B64 outside of Mime */
00107 #define UUOPT_ENCEXT (19) /* extension for single-part encoded files */
00108 #define UUOPT_REMOVE (20) /* remove input files after decoding */
00109 #define UUOPT_MOREMIME (21) /* strict MIME adherence */
00110 
00111 /*
00112  * Code for the "action" in the progress structure
00113  */
00114 
00115 #define UUACT_IDLE (0) /* we don't do anything */
00116 #define UUACT_SCANNING (1) /* scanning an input file */
00117 #define UUACT_DECODING (2) /* decoding into a temp file */
00118 #define UUACT_COPYING (3) /* copying temp to target */
00119 #define UUACT_ENCODING (4) /* encoding a file */
00120 
00121 /*
00122  * forward definition
00123  */
00124 
00125 struct _uufile;
00126 
00127 /*
00128  * Structure for holding the list of files that have been found
00129  * uufile items are inserted into this list with UUInsertPartToList
00130  * After inserting a bunch of files, UUCheckGlobalList must be called
00131  * to update the states.
00132  */
00133 
00134 typedef struct _uulist {
00135   short    state;               /* Status as described by the macros above */
00136   short    mode;                /* file mode as found on begin line */
00137 
00138   int      begin;               /* part number where begin was detected */
00139   int      end;                 /* part number where end was detected */
00140 
00141   short    uudet;               /* Encoding type (see macros above) */
00142   int      flags;               /* flags, especially for single-part files */
00143 
00144   long     size;                /* approximate size of resulting file */
00145   char    *filename;            /* malloc'ed file name */
00146   char    *subfname;            /* malloc'ed ID from subject line */
00147   char    *mimeid;              /* malloc'ed MIME-ID, if available */
00148   char    *mimetype;            /* malloc'ed Content-Type, if available */
00149 
00150   char    *binfile;             /* name of temp file, if already decoded */
00151 
00152   struct _uufile *thisfile;     /* linked list of this file's parts */
00153 
00154   int     *haveparts;           /* the parts we have (max. 256 are listed) */
00155   int     *misparts;            /* list of missing parts (max. 256) */
00156 
00157   struct _uulist *NEXT;         /* next item of the list */
00158   struct _uulist *PREV;         /* previous item of the list */
00159 } uulist;
00160 
00161 /*
00162  * The "progress" structure which is passed to the Busy Callback
00163  */
00164 
00165 typedef struct {
00166   int  action;                  /* see UUACT_* definitions above */
00167   char curfile[256];            /* the file we are working on, incl. path */
00168   int  partno;                  /* part we're currently decoding */
00169   int  numparts;                /* total number of parts of this file */
00170   long fsize;                   /* size of the current file */
00171   int  percent;                 /* % of _current part_ */
00172   long foffset;                 /* file offset -- internal use only */
00173   long totsize;                 /* file total size -- internal use only */
00174 } uuprogress;
00175   
00176 
00177 /*
00178  * Externally visible Functions
00179  */
00180 
00181 #ifndef UUEXPORT
00182 #define UUEXPORT
00183 #endif
00184 
00185 #ifdef __cplusplus
00186 extern "C" {
00187 #endif
00188 
00189 int     UUEXPORT UUInitialize           _ANSI_ARGS_((void));
00190 int     UUEXPORT UUGetOption            _ANSI_ARGS_((int, int *, char *, int));
00191 int     UUEXPORT UUSetOption            _ANSI_ARGS_((int, int, char *));
00192 char *  UUEXPORT UUstrerror             _ANSI_ARGS_((int));
00193 int     UUEXPORT UUSetMsgCallback       _ANSI_ARGS_((void *,
00194                                                      void (*) (void *, 
00195                                                                char *,
00196                                                                int)));
00197 int     UUEXPORT UUSetBusyCallback      _ANSI_ARGS_((void *,
00198                                                      int (*) (void *,
00199                                                               uuprogress *),
00200                                                      long));
00201 int     UUEXPORT UUSetFileCallback      _ANSI_ARGS_((void *,
00202                                                      int (*) (void *, char *,
00203                                                               char *, int)));
00204 int     UUEXPORT UUSetFNameFilter       _ANSI_ARGS_((void *,
00205                                                      char * (*) (void *,
00206                                                                  char *)));
00207 char *  UUEXPORT UUFNameFilter          _ANSI_ARGS_((char *));
00208 int     UUEXPORT UULoadFile             _ANSI_ARGS_((char *, char *, int));
00209 int     UUEXPORT UULoadFileWithPartNo   _ANSI_ARGS_((char *, char *, int, int));
00210 uulist *UUEXPORT UUGetFileListItem      _ANSI_ARGS_((int));
00211 int     UUEXPORT UURenameFile           _ANSI_ARGS_((uulist *, char *));
00212 int     UUEXPORT UUDecodeToTemp         _ANSI_ARGS_((uulist *));
00213 int     UUEXPORT UURemoveTemp           _ANSI_ARGS_((uulist *));
00214 int     UUEXPORT UUDecodeFile           _ANSI_ARGS_((uulist *, char *));
00215 int     UUEXPORT UUInfoFile             _ANSI_ARGS_((uulist *, void *,
00216                                                      int (*) (void *, 
00217                                                               char *)));
00218 int     UUEXPORT UUSmerge               _ANSI_ARGS_((int));
00219 int     UUEXPORT UUCleanUp              _ANSI_ARGS_((void));
00220 
00221 int     UUEXPORT UUQuickDecode          _ANSI_ARGS_((FILE *, FILE *,
00222                                                      char *, long));
00223 
00224 int     UUEXPORT UUEncodeMulti          _ANSI_ARGS_((FILE *, FILE *,
00225                                                      char *, int,
00226                                                      char *, char *, int));
00227 int     UUEXPORT UUEncodePartial        _ANSI_ARGS_((FILE *, FILE *,
00228                                                      char *, int,
00229                                                      char *, char *,
00230                                                      int, int, long,
00231                                                      unsigned long*));
00232 int     UUEXPORT UUEncodeToStream       _ANSI_ARGS_((FILE *, FILE *,
00233                                                      char *, int,
00234                                                      char *, int));
00235 int     UUEXPORT UUEncodeToFile         _ANSI_ARGS_((FILE *, char *, int,
00236                                                      char *, char *, long));
00237 int     UUEXPORT UUE_PrepSingle         _ANSI_ARGS_((FILE *, FILE *,
00238                                                      char *, int,
00239                                                      char *, int,
00240                                                      char *, char *,
00241                                                      char *, int));
00242 int     UUEXPORT UUE_PrepPartial        _ANSI_ARGS_((FILE *, FILE *,
00243                                                      char *, int,
00244                                                      char *, int,
00245                                                      int, long, long, char *,
00246                                                      char *, char *, int));
00247 
00248 int     UUEXPORT UUE_PrepSingleExt      _ANSI_ARGS_((FILE *, FILE *,
00249                                                      char *, int,
00250                                                      char *, int,
00251                                                      char *, char *,
00252                                                      char *, char *,
00253                                                      int));
00254 int     UUEXPORT UUE_PrepPartialExt     _ANSI_ARGS_((FILE *, FILE *,
00255                                                      char *, int,
00256                                                      char *, int,
00257                                                      int, long, long, char *,
00258                                                      char *, char *, char *,
00259                                                      int));
00260 #ifdef __cplusplus
00261 }
00262 #endif
00263 #endif

Generated on Sun Oct 12 01:45:30 2008 for NNTPGrab by  1.5.4