Main Page | Data Structures | File List | Globals

include/uprint.h

00001 /*
00002 ** mouse:~ppr/src/include/uprint.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 /* Maximum lengths of control file fields. */
00032 #define LPR_MAX_QUEUE 31                /* my guess */
00033 #define LPR_MAX_P 31                    /* RFC 1179 */
00034 #define LPR_MAX_C 31                    /* RFC 1179 */
00035 #define LPR_MAX_H 31                    /* RFC 1179 */
00036 #define LPR_MAX_J 99                    /* RFC 1179 */
00037 #define LPR_MAX_L 31                    /* my guess */
00038 #define LPR_MAX_M 31                    /* my guess */
00039 #define LPR_MAX_N 131                   /* RFC 1179 */
00040 #define LPR_MAX_P 31                    /* RFC 1179 */
00041 #define LPR_MAX_T 79                    /* RFC 1179 */
00042 #define LPR_MAX_I 8                             /* my guess */
00043 #define LPR_MAX_W 8                             /* my guess */
00044 #define LPR_MAX_1 131                   /* my guess */
00045 #define LPR_MAX_2 131                   /* my guess */
00046 #define LPR_MAX_3 131                   /* my guess */
00047 #define LPR_MAX_4 131                   /* my guess */
00048 
00049 /* DEC OSF extensions, my guess */
00050 #define LPR_MAX_DEC 31
00051 
00052 /* Solaris 2.6 extension, arbitrary limits */
00053 #define LPR_MAX_5f 31
00054 #define LPR_MAX_5H 31
00055 #define LPR_MAX_O 131
00056 #define LPR_MAX_5P 131
00057 #define LPR_MAX_5S 31
00058 #define LPR_MAX_5T 31
00059 #define LPR_MAX_5y 131
00060 
00061 /* Structure to describe a remote queue selected
00062    by claim_printdest_remote(). */
00063 struct REMOTEDEST
00064         {
00065         char *node;                                                     /* DNS name of remote node */
00066         char printer[LPR_MAX_QUEUE + 1];        /* name of remote printer */
00067         gu_boolean osf_extensions;                      /* send OSF/1 control file extensions */
00068         gu_boolean solaris_extensions;                          /* send Solaris control file extensions */
00069         gu_boolean ppr_extensions;                      /* send PPR control file extensions */
00070         } ;
00071 
00072 /* Provided by the caller: */
00073 #ifdef __GNUC__
00074 void uprint_error_callback(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
00075 #endif
00076 void uprint_error_callback(const char *format, ...);
00077 
00078 /* lpr_connect.c: */
00079 int uprint_lpr_make_connection(const char address[]);
00080 int uprint_lpr_make_connection_with_failover(const char address[]);
00081 int uprint_lpr_send_cmd(int fd, const char text[], int length);
00082 int uprint_lpr_response(int fd, int timeout);
00083 
00084 /* lpr_sendfile.c: */
00085 const char *uprint_lpr_nodename(void);
00086 int uprint_lpr_nextid(void);
00087 int uprint_file_stdin(int *length);
00088 int uprint_lpr_send_data_file(int sourcefd, int sockfd);
00089 
00090 /* claim_*.c: */
00091 gu_boolean printdest_claim_ppr(const char dest[]);
00092 gu_boolean printdest_claim_sysv(const char dest[]);
00093 gu_boolean printdest_claim_bsd(const char dest[]);
00094 gu_boolean printdest_claim_remote(const char dest[], struct REMOTEDEST *scratchpad);
00095 
00096 /* uprint.c (object atributes): */
00097 extern int uprint_errno;
00098 extern const char *uprint_arrest_interest_interval;
00099 void *uprint_new(const char *fakername, int argc, const char *argv[]);
00100 int uprint_delete(void *p);
00101 
00102 const char *uprint_set_dest(void *p, const char *dest);
00103 const char *uprint_get_dest(void *p);
00104 int uprint_set_files(void *p, const char *files[]);
00105 
00106 const char *uprint_set_user(void *p, uid_t uid, gid_t gid, const char *user);
00107 const char *uprint_get_user(void *p);
00108 const char *uprint_set_from_format(void *p, const char *from_format);
00109 const char *uprint_set_lpr_mailto(void *p, const char *lpr_mailto);
00110 const char *uprint_set_lpr_mailto_host(void *p, const char *lpr_mailto_host);
00111 const char *uprint_set_fromhost(void *p, const char *fromhost);
00112 const char *uprint_set_proxy_class(void *p, const char *proxy_class);
00113 const char *uprint_set_pr_title(void *p, const char *title);
00114 const char *uprint_set_lpr_class(void *p, const char *lpr_class);
00115 const char *uprint_set_jobname(void *p, const char *lpr_jobname);
00116 
00117 const char *uprint_set_content_type_lp(void *p, const char *content_type);
00118 int uprint_set_content_type_lpr(void *p, char content_type);
00119 int uprint_set_copies(void *p, int copies);
00120 gu_boolean uprint_set_banner(void *p, gu_boolean banner);
00121 gu_boolean uprint_set_nobanner(void *p, gu_boolean nobanner);
00122 gu_boolean uprint_set_filebreak(void *p, gu_boolean filebreak);
00123 int uprint_set_priority(void *p, int priority);
00124 gu_boolean uprint_set_immediate_copy(void *p, gu_boolean val);
00125 
00126 const char *uprint_set_form(void *p, const char *formname);
00127 const char *uprint_set_charset(void *p, const char *charset);
00128 int uprint_set_length(void *p, const char *length);
00129 int uprint_set_width(void *p, const char *width);
00130 int uprint_set_indent(void *p, const char *indent);
00131 int uprint_set_lpi(void *p, const char *lpi);
00132 int uprint_set_cpi(void *p, const char *cpi);
00133 const char *uprint_set_troff_1(void *p, const char *font);
00134 const char *uprint_set_troff_2(void *p, const char *font);
00135 const char *uprint_set_troff_3(void *p, const char *font);
00136 const char *uprint_set_troff_4(void *p, const char *font);
00137 
00138 const char *uprint_set_lp_interface_options(void *p, const char *lp_interface_options);
00139 const char *uprint_set_lp_filter_modes(void *p, const char *lp_filter_options);
00140 const char *uprint_set_lp_pagelist(void *p, const char *lp_pagelist);
00141 const char *uprint_set_lp_handling(void *p, const char *lp_handling);
00142 const char *uprint_set_osf_LT_inputtray(void *p, const char *inputtray);
00143 const char *uprint_set_osf_GT_outputtray(void *p, const char *outputtray);
00144 const char *uprint_set_osf_O_orientation(void *p, const char *orientation);
00145 const char *uprint_set_osf_K_duplex(void *p, const char *duplex);
00146 int uprint_set_nup(void *p, int nup);
00147 
00148 gu_boolean uprint_set_unlink(void *p, gu_boolean do_unlink);
00149 gu_boolean uprint_set_notify_email(void *p, gu_boolean notify_email);
00150 gu_boolean uprint_set_notify_write(void *p, gu_boolean notify_write);
00151 gu_boolean uprint_set_show_jobid(void *p, gu_boolean say_jobid);
00152 
00153 const char *uprint_set_ppr_responder(void *p, const char *ppr_responder);
00154 const char *uprint_set_ppr_responder_address(void *p, const char *ppr_responder_address);
00155 const char *uprint_set_ppr_responder_options(void *p, const char *ppr_responder_options);
00156 
00157 /* uprint_loop.c: */
00158 int uprint_loop_check(const char *myname);
00159 
00160 /* uprint_run.c: */
00161 int uprint_run(uid_t uid, gid_t gid, const char *exepath, const char *const argv[]);
00162 
00163 /* uprint_strerror.c: */
00164 const char *uprint_strerror(int errnum);
00165 
00166 /* uprint_print.c, uprint_print_*.c: */
00167 int uprint_print(void *p, gu_boolean remote_too);
00168 int uprint_print_argv_sysv(void *p, const char **argv, int argv_len);
00169 int uprint_print_argv_bsd(void *p, const char **argv, int argv_len);
00170 int uprint_print_argv_ppr(void *p, const char **argv, int argv_len);
00171 int uprint_print_rfc1179(void *p, struct REMOTEDEST *scratchpad);
00172 
00173 /* uprint_lpq.c: */
00174 int uprint_lpq(uid_t uid, gid_t gid, const char agent[], const char queue[], int format, const char *arglist[], gu_boolean remote_too);
00175 
00176 /* uprint_lpq_rfc1179.c: */
00177 int uprint_lpq_rfc1179(const char *queue, int format, const char **arglist, struct REMOTEDEST *scratchpad);
00178 
00179 /* uprint_lprm.c: */
00180 int uprint_lprm(uid_t uid, gid_t gid, const char agent[], const char proxy_class[], const char queue[], const char **arglist, gu_boolean remote_too);
00181 
00182 /* uprint_lprm_rfc1179.c: */
00183 int uprint_lprm_rfc1179(const char *user, const char *athost, const char *queue, const char **arglist, struct REMOTEDEST *scratchpad);
00184 
00185 /* uprint_conf.c: */
00186 const char *uprint_default_destinations_lpr(void);
00187 const char *uprint_default_destinations_lp(void);
00188 const char *uprint_path_lpr(void);
00189 const char *uprint_path_lpq(void);
00190 const char *uprint_path_lprm(void);
00191 const char *uprint_path_lpc(void);
00192 const char *uprint_path_lp(void);
00193 const char *uprint_path_lpstat(void);
00194 const char *uprint_path_cancel(void);
00195 gu_boolean uprint_lpr_installed(void);
00196 gu_boolean uprint_lp_installed(void);
00197 
00198 /* Values for uprint_errno: */
00199 #define UPE_NONE 0              /* not an error */
00200 #define UPE_MALLOC 1    /* malloc(), calloc(), etc. failed */
00201 #define UPE_BADARG 2    /* bad argument */
00202 #define UPE_FORK 3              /* fork() failed */
00203 #define UPE_CORE 4              /* child dumped core */
00204 #define UPE_KILLED 5    /* child killed */
00205 #define UPE_WAIT 6              /* wait() failed */
00206 #define UPE_EXEC 7              /* execl() failed */
00207 #define UPE_CHILD 8             /* child did non-zero exit */
00208 #define UPE_NODEST 9    /* no print destination specified */
00209 #define UPE_UNDEST 10   /* unknown print destination specified */
00210 #define UPE_TOOMANY 11  /* too many files to print */
00211 #define UPE_BADSYS 12   /* unknown remote system */
00212 #define UPE_TEMPFAIL 13 /* temporary failure */
00213 #define UPE_NOSPACE 14  /* not enough spool room for file */
00214 #define UPE_INTERNAL 15 /* internal library error */
00215 #define UPE_DENIED 16   /* permission denied */
00216 #define UPE_NOFILE 17   /* file not found */
00217 #define UPE_BADORDER 18 /* functions called in wrong order */
00218 #define UPE_BADCONFIG 19 /* error in configuration file */
00219 #define UPE_SETUID 20   /* setuid(), seteuid(), setreuid(), etc. failed */
00220 
00221 /* end of file */

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