1 /* foomaticrip.h 2 * 3 * Copyright (C) 2008 Till Kamppeter <till.kamppeter@gmail.com> 4 * Copyright (C) 2008 Lars Karlitski (formerly Uebernickel) <lars@karlitski.net> 5 * 6 * This file is part of foomatic-rip. 7 * 8 * Foomatic-rip is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * Foomatic-rip is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the 20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 21 * Boston, MA 02111-1307, USA. 22 */ 23 24 #ifndef foomatic_h 25 #define foomatic_h 26 27 #ifndef _GNU_SOURCE 28 #define _GNU_SOURCE 29 #endif 30 31 #include "config.h" 32 33 #include <stddef.h> 34 #include <stdio.h> 35 #include <time.h> 36 #include <limits.h> 37 38 /* This is the location of the debug logfile (and also the copy of the 39 * processed PostScript data) in case you have enabled debugging above. 40 * The logfile will get the extension ".log", the PostScript data ".ps". 41 */ 42 #ifndef LOG_FILE 43 #define LOG_FILE "/tmp/foomatic-rip" 44 #endif 45 46 47 /* Constants used by this filter 48 * 49 * Error codes, as some spoolers behave different depending on the reason why 50 * the RIP failed, we return an error code. 51 */ 52 #define EXIT_PRINTED 0 /* file was printed normally */ 53 #define EXIT_PRNERR 1 /* printer error occured */ 54 #define EXIT_PRNERR_NORETRY 2 /* printer error with no hope of retry */ 55 #define EXIT_JOBERR 3 /* job is defective */ 56 #define EXIT_SIGNAL 4 /* terminated after catching signal */ 57 #define EXIT_ENGAGED 5 /* printer is otherwise engaged (connection refused) */ 58 #define EXIT_STARVED 6 /* starved for system resources */ 59 #define EXIT_PRNERR_NORETRY_ACCESS_DENIED 7 /* bad password? bad port permissions? */ 60 #define EXIT_PRNERR_NOT_RESPONDING 8 /* just doesn't answer at all (turned off?) */ 61 #define EXIT_PRNERR_NORETRY_BAD_SETTINGS 9 /* interface settings are invalid */ 62 #define EXIT_PRNERR_NO_SUCH_ADDRESS 10 /* address lookup failed, may be transient */ 63 #define EXIT_PRNERR_NORETRY_NO_SUCH_ADDRESS 11 /* address lookup failed, not transient */ 64 #define EXIT_INCAPABLE 50 /* printer wants (lacks) features or resources */ 65 66 67 /* Supported spoolers are currently: 68 * 69 * cups - CUPS - Common Unix Printing System 70 * direct - Direct, spooler-less printing 71 */ 72 #define SPOOLER_CUPS 1 73 #define SPOOLER_DIRECT 2 74 75 /* The spooler from which foomatic-rip was called. set in main() */ 76 extern int spooler; 77 78 #ifndef PATH_MAX 79 #define PATH_MAX 4096 80 #endif 81 #define CMDLINE_MAX 65536 82 83 typedef struct { 84 char printer[256]; 85 char id[128]; 86 char user[128]; 87 char host[128]; 88 char title[2048]; 89 char ppdfile[2048]; 90 char copies[128]; 91 int rbinumcopies; 92 struct dstr *optstr; 93 time_t time; 94 } jobparams_t; 95 96 97 jobparams_t * get_current_job(); 98 99 void _log(const char* msg, ...); 100 int redirect_log_to_stderr(); 101 void rip_die(int status, const char *msg, ...); 102 103 const char * get_modern_shell(); 104 FILE * open_postpipe(); 105 106 extern struct dstr *currentcmd; 107 extern struct dstr *jclappend; 108 extern char **jclprepend; 109 extern int jobhasjcl; 110 extern char cupsfilterpath[PATH_MAX]; 111 extern int debug; 112 extern int do_docs; 113 extern char printer_model[]; 114 extern int dontparse; 115 extern int pdfconvertedtops; 116 extern char gspath[PATH_MAX]; 117 extern char echopath[PATH_MAX]; 118 119 #endif 120 121