Main Page | Data Structures | File List | Globals

libuprint/uprint_private.h

00001 /*
00002 ** mouse:~ppr/src/include/uprint_private.h
00003 ** Copyright 1995--2003, 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 3 August 2003.
00029 */
00030 
00031 /* Do not turn this on when linking with lprsrv!  Such
00032    operation is not supported yet. */
00033 #if 0
00034 #define DEBUG 1
00035 #endif
00036 
00037 #ifdef DEBUG
00038 #define DODEBUG(a) uprint_debug a
00039 void uprint_debug(const char *string, ...);
00040 #else
00041 #define DODEBUG(a)
00042 #endif
00043 
00044 /* Time to wait for connect() to finish: */
00045 #define LPR_CONNECT_TIMEOUT 20
00046 
00047 /* The file we use to get the next lpr jobid: */
00048 #define LPR_PREVID_FILE RUNDIR"/lastid_uprint_lpr"
00049 
00050 /* The file we use for a log: */
00051 #define UPRINT_LOGFILE LOGDIR"/uprint"
00052 
00053 /* The correct value for the signiture field in struct UPRINT: */
00054 #define UPRINT_SIGNITURE 0x8391
00055 
00056 /* uprint_sys5_to_bsd.c: */
00057 int uprint_parse_lp_interface_options(void *p);
00058 int uprint_parse_lp_filter_modes(void *p);
00059 
00060 /* Some internal str_*[] length limits. */
00061 #define MAX_MAILADDR 127
00062 #define MAX_PRINCIPAL 127
00063 #define MAX_FOR 127
00064 
00065 /* This is our setuid root helper. */
00066 #define UPRINT_RFC1179 HOMEDIR"/lib/uprint_rfc1179"
00067 
00068 /* A structure to describe a print job: */
00069 struct UPRINT
00070         {
00071         int signiture;
00072 
00073         const char *fakername;          /* which fake program was used? */
00074         const char **argv;              /* argv[] from origional command */
00075         int argc;
00076 
00077         const char *dest;               /* the printer */
00078         const char **files;             /* list of files to print */
00079 
00080         uid_t uid;                      /* user id number */
00081         gid_t gid;
00082         const char *user;               /* user name */
00083         const char *from_format;        /* queue display from field format */
00084         const char *lpr_mailto;         /* lpr style address to send email to */
00085         const char *lpr_mailto_host;    /* @ host */
00086         const char *fromhost;           /* lpr style host name */
00087         const char *proxy_class;        /* string for after "@" sign in -X argument */
00088         const char *lpr_class;          /* lpr -C switch */
00089         const char *jobname;            /* lpr -J switch, lp -t switch */
00090         const char *pr_title;           /* title for pr (lpr -T switch) */
00091 
00092         const char *content_type_lp;    /* argument for lp -T or "raw" for -r */
00093         char content_type_lpr;          /* lpr switch such as -f, -c, or -d */
00094         int copies;                     /* number of copies */
00095         gu_boolean banner;              /* should we ask for a banner page? */
00096         gu_boolean nobanner;            /* should we ask for suppression? */
00097         gu_boolean filebreak;
00098         int priority;                   /* queue priority */
00099         gu_boolean immediate_copy;      /* should we copy file before exiting? */
00100 
00101         const char *form;               /* form name */
00102         const char *charset;            /* job character set */
00103         const char *width;
00104         const char *length;
00105         const char *indent;
00106         const char *cpi;
00107         const char *lpi;
00108         const char *troff_1;
00109         const char *troff_2;
00110         const char *troff_3;
00111         const char *troff_4;
00112 
00113         /* System V lp style options: */
00114         char *lp_interface_options;     /* lp -o switch */
00115         char *lp_filter_modes;          /* lp -y switch */
00116         const char *lp_pagelist;        /* lp -P switch */
00117         const char *lp_handling;        /* lp -H switch */
00118 
00119         /* DEC OSF/1 style options: */
00120         const char *osf_LT_inputtray;
00121         const char *osf_GT_outputtray;
00122         const char *osf_O_orientation;  /* portrait or landscape */
00123         const char *osf_K_duplex;
00124         int nup;                        /* N-Up setting */
00125 
00126         gu_boolean unlink;              /* should job files be unlinked? */
00127         gu_boolean show_jobid;          /* should be announce the jobid? */
00128         gu_boolean notify_email;        /* send mail when job complete? */
00129         gu_boolean notify_write;        /* use write(1) when job complete? */
00130 
00131         /* PPR options: */
00132         const char *ppr_responder;
00133         const char *ppr_responder_address;
00134         const char *ppr_responder_options;
00135 
00136         /* Scratch space: */
00137         char str_numcopies[5];
00138         char str_typeswitch[3];
00139         char str_mailaddr[MAX_MAILADDR + 1];
00140         char str_principal[MAX_PRINCIPAL + 1];          /* argument for ppr -X switch */
00141         char str_for[MAX_FOR + 1];                      /* argument for ppr -f switch */
00142         char str_pr_title[11 + (LPR_MAX_T * 2) + 1];    /* space for "pr-title=\"my title\"" */
00143         char str_width[12];
00144         char str_length[12];
00145         char str_lpi[12];
00146         char str_cpi[12];
00147         char str_priority[3];
00148         char str_inputtray[sizeof("*InputSlot ") + LPR_MAX_DEC + 1];
00149         char str_outputtray[sizeof("*OutputBin ") + LPR_MAX_DEC + 1];
00150         char str_orientation[sizeof("orientation=") + LPR_MAX_DEC + 1];
00151         char str_nup[4];
00152         } ;
00153 
00154 /* Description of a table which translates lpr to lp types: */
00155 struct LP_LPR_TYPE_XLATE
00156         {
00157         const char *lpname;
00158         char lprcode;
00159         } ;
00160 
00161 extern struct LP_LPR_TYPE_XLATE lp_lpr_type_xlate[];
00162 
00163 /* uprint_conf.c */
00164 const char *uprint_lpr_printcap(void);
00165 const char *uprint_lp_printers(void);
00166 const char *uprint_lp_classes(void);
00167 gu_boolean uprint_lp_printers_conf(void);
00168 
00169 /* uprint_print_bsd.c */
00170 char uprint_get_content_type_lpr(void *p);
00171 
00172 /* uprint_run_rfc1179.c */
00173 int uprint_run_rfc1179(const char exepath[], const char *const argv[]);
00174 
00175 /* end of file */
00176 

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