Main Page | Data Structures | File List | Globals

include/global_structs.h

00001 /*
00002 ** mouse:~ppr/src/include/global_structs.h
00003 ** Copyright 1995--2004, Trinity College Computing Center.
00004 ** Written by David Chappell.
00005 **
00006 ** Redistribution and use in source and binary forms, with or without
00007 ** modification, are permitted provided that the following conditions are met:
00008 ** 
00009 ** * Redistributions of source code must retain the above copyright notice,
00010 ** this list of conditions and the following disclaimer.
00011 ** 
00012 ** * Redistributions in binary form must reproduce the above copyright
00013 ** notice, this list of conditions and the following disclaimer in the
00014 ** documentation and/or other materials provided with the distribution.
00015 ** 
00016 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00019 ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE 
00020 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00021 ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00022 ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00023 ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00024 ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
00025 ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
00026 ** POSSIBILITY OF SUCH DAMAGE.
00027 **
00028 ** Last modified 12 February 2004.
00029 */
00030 
00031 /* =================== destined for libppr_queueentry.h =====================*/
00032 
00033 #define CACHE_PRIORITY_AUTO -1
00034 #define CACHE_PRIORITY_LOW 0
00035 #define CACHE_PRIORITY_HIGH 1
00036 
00037 /*
00038 ** A record which describes a printer commentator which
00039 ** should be fed information about what is going on with
00040 ** the printer.
00041 **
00042 ** This structure is included in struct QFileEntry.      It is also
00043 ** used to store "Commentator:" lines from the printer configuration
00044 ** file.  The "next" member is only used in the latter instance.
00045 */
00046 struct COMMENTATOR
00047                 {
00048                 int interests;                                  /* bitmask telling which events to invoke for */
00049                 const char *progname;                   /* "file" or program to invoke */
00050                 const char *address;                    /* first parameter to feed to it */
00051                 const char *options;                    /* second parameter to feed to it */
00052                 struct COMMENTATOR *next;
00053                 } ;
00054 
00055 /*
00056 ** This structure can hold the contents of a queue file.
00057 */
00058 struct QFileEntry
00059         {
00060         float PPRVersion;                                       /* version number of PPR that created queue entry */
00061 
00062         const char *destnode;                           /* node this job will be sent to */
00063         const char *destname;                           /* destination (group or printer) */
00064         short int id;                                           /* queue id number */
00065         short int subid;                                        /* fractional part of id number */
00066         const char *homenode;                           /* the node this job origionated on */
00067 
00068         SHORT_INT status;                                       /* job status */
00069         short unsigned int flags;                       /* job flags */
00070         const char *magic_cookie;                       /* secret about this job */
00071 
00072         int priority;                                           /* priority number (0-39) */
00073         long time;                                                      /* time job was submitted (don't use time_t) */
00074         long user;                                                      /* id of user who submitted it (don't use uid_t) */
00075         const char *username;                           /* text version of "user" */
00076         const char *proxy_for;                          /* -X switch string */
00077         const char *lc_messages;                        /* language setting for messages */
00078         const char *For;                                        /* %%For: line for PostScript header */
00079         const char *charge_to;                          /* charge account to debit */
00080         const char *Routing;                            /* %%Routing: line for PostScript header */
00081         const char *Title;                                      /* %%Title: for Postscript header */
00082         const char *Creator;                            /* application which created it */
00083         const char *lpqFileName;                        /* name of input file */
00084         const char *responder;                          /* program for sending messages to user */
00085         const char *responder_address;          /* address for errors, possibly NULL */
00086         const char *responder_options;          /* name=value list of responder options */
00087         int commentary;                                         /* bitmask of commentary to send thru the responder */
00088         int nmedia;                                                     /* number of media types */
00089         int media[MAX_DOCMEDIA];                        /* list of required media types */
00090         int do_banner;                                          /* should we print a banner page? */
00091         int do_trailer;                                         /* should we print a trailer page? */
00092         struct {                                                        /* various attributes */
00093                 int langlevel;                                  /* PostScript language level */
00094                 int extensions;                                 /* bit fields of extension to level 1 */
00095                 float DSClevel;                                 /* DSC comments version */
00096                 int pages;                                              /* number of pages, -1 means unknown */
00097                 int pageorder;                                  /* -1 (reverse), 0 (special), or 1 (normal) */
00098                 int pagefactor;                                 /* virtual pages per physical sheet */
00099                 gu_boolean prolog;                              /* true if valid prolog section present */
00100                 gu_boolean docsetup;                    /* true if valid document setup section present */
00101                 gu_boolean script;                              /* delineated pages present */
00102                 int proofmode;                                  /* desired proofmode value */
00103                 int orientation;                                /* one of ORIENTATION_* */
00104                 long input_bytes;                               /* Size of input file in bytes */
00105                 long postscript_bytes;                  /* Size of input PostScript code in bytes */
00106                 int parts;                                              /* number of sub jobs job was divided into */
00107                 int docdata;                                    /* Clean7Bit, Clean8Bit, Binary */
00108                 } attr;
00109         struct {
00110                 gu_boolean binselect;                   /* do automatic bin selection */
00111                 int copies;                                             /* number of copies to print, -1=unspecified */
00112                 gu_boolean collate;                             /* TRUE if we should collate copies */
00113                 gu_boolean keep_badfeatures;    /* keep Feature code we can not replace from PPD file */
00114                 unsigned int hacks;                             /* enables code to deal with problems */
00115                 gu_boolean resume;                              /* TRUE if should try to resume jobs in the middle */
00116                 } opts;
00117         struct {                                                        /* N Up parameters */
00118                 int N;                                                  /* virtual pages per physical side */
00119                 gu_boolean borders;                             /* TRUE or false, should we print borders */
00120                 int sigsheets;                                  /* Number of sheets to user per signiture */
00121                 int sigpart;                                    /* fronts, backs, both */
00122                 } N_Up;
00123         const char *draft_notice;                       /* `Draft' string */
00124         const char *PassThruPDL;                        /* "pcl", "hpgl2", etc., NULL for PostScript */
00125         const char *Filters;                            /* filter chain: "pcl", "gzip pcl", etc. */
00126         const char *PJL;                                        /* HP PJL lines, newline separated */
00127         int CachePriority;
00128         gu_boolean StripPrinter;                        /* Strip resources that printer has? */
00129         struct {
00130                 char *mask;                                             /* which pages should be printed? */
00131                 int count;                                              /* how many 1's in the mask? */
00132                 } page_list;
00133         const char *question;                           /* partial URL for question */
00134         const char *ripopts;                            /* name=value pairs for Ghostscript and such */
00135         } ;
00136 
00137 /* Possible values for orientation member of struct QFileEntry. */
00138 #define ORIENTATION_UNKNOWN 0
00139 #define ORIENTATION_PORTRAIT 1
00140 #define ORIENTATION_LANDSCAPE 2
00141 
00142 /* Bitfield values for opts.hacks. */
00143 #define HACK_KEEPINFILE 1
00144 #define HACK_TRANSPARENT 2
00145 #define HACK_BADEPS 4
00146 #define HACK_EDITPS 8
00147 #define HACK_DEFAULT_HACKS 0                    /* none by default */
00148 
00149 /* "%%ProofMode:" values. */
00150 #define PROOFMODE_NOTIFYME -1
00151 #define PROOFMODE_SUBSTITUTE 0                  /* default mode */
00152 #define PROOFMODE_TRUSTME 1
00153 
00154 /* Signiture part values. */
00155 #define SIG_FRONTS 1
00156 #define SIG_BACKS 2
00157 #define SIG_BOTH (SIG_FRONTS | SIG_BACKS)
00158 
00159 /* "%%PageOrder:" settings. */
00160 #define PAGEORDER_ASCEND 1
00161 #define PAGEORDER_DESCEND -1
00162 #define PAGEORDER_SPECIAL 0
00163 
00164 /*
00165 ** Job status values.
00166 ** A positive value is the ID of a printer which
00167 ** is currently printing the job.
00168 */
00169 #define STATUS_WAITING -1                               /* waiting for printer */
00170 #define STATUS_HELD -2                                  /* put on hold by user */
00171 #define STATUS_WAITING4MEDIA -3                 /* proper media not mounted */
00172 #define STATUS_ARRESTED -4                              /* automaticaly put on hold because of a job error */
00173 #define STATUS_CANCEL -5                                /* being canceled */
00174 #define STATUS_SEIZING -6                               /* going from printing to held (get rid of this) */
00175 #define STATUS_STRANDED -7                              /* no printer can print it */
00176 #define STATUS_FINISHED -8                              /* job has been printed */
00177 #define STATUS_FUNDS -9                                 /* insufficient funds to print it */
00178 
00179 /* First end of file marker in a transmitted queue file. */
00180 #define QF_ENDTAG1 "..\n"
00181 #define QF_ENDTAG2 ".\n"
00182 #define CHOPT_QF_ENDTAG1 ".."
00183 #define CHOPT_QF_ENDTAG2 "."
00184 
00185 /* Values used in ppop -> pprd communication: */
00186 #define NODEID_WILDCARD -1
00187 #define NODEID_NOTFOUND -2
00188 #define NODEID_LOCALHOST 0
00189 #define QUEUEID_WILDCARD -1
00190 #define WILDCARD_JOBID -1
00191 #define WILDCARD_SUBID -1
00192 
00193 int read_struct_QFileEntry(FILE *qfile, struct QFileEntry *job);
00194 int write_struct_QFileEntry(FILE *Qfile, const struct QFileEntry *qentry);
00195 void destroy_struct_QFileEntry(struct QFileEntry *job);
00196 int parse_qfname(char *buffer, const char **destnode, const char **destname, short int *id, short int *subid, const char **homenode);
00197 int pagemask_encode(struct QFileEntry *job, const char pages[]);
00198 void  pagemask_print(const struct QFileEntry *job);
00199 int pagemask_get_bit(const struct QFileEntry *job, int page);
00200 int pagemask_count(const struct QFileEntry *job);
00201 
00202 /* ======================== Media file format =========================== */
00203 struct Media
00204         {
00205         char medianame[MAX_MEDIANAME];  /* from PostScript comment */
00206         double width;                                   /* width in 72nds of an inch */
00207         double height;                                  /* height in 72nds of an inch */
00208         double weight;                                  /* weight grams per square metre */
00209         char colour[MAX_COLOURNAME];    /* colour name */
00210         char type[MAX_TYPENAME];                /* type string, preprinted forms */
00211         int flag_suitability;                   /* rank on scale of 1 to 10 */
00212         } ;
00213 
00214 /* ============= money charged for printing ================= */
00215 
00216 struct COMPUTED_CHARGE
00217                 {
00218                 int duplex_sheets;
00219                 int per_duplex;
00220                 int simplex_sheets;
00221                 int per_simplex;
00222                 int total;
00223                 } ;
00224 
00225 void compute_charge(struct COMPUTED_CHARGE *charge, int per_duplex_sheet, int per_simplex_sheet, int vpages,
00226                 int n_up_n, int vpages_per_sheet, int sigsheets, int sigpart, int copies);
00227 
00228 /* end of file */
00229 

Generated on Fri Feb 20 15:17:46 2004 for PPR Libraries by doxygen 1.3.5