00001 /* 00002 ** mouse:~ppr/src/include/libppr_int.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 #ifndef LIBPPR_INT_H 00032 #define LIBPPR_INT_H 1 00033 00034 #include "gu.h" 00035 00036 /* 00037 ** This is a structure into which interface arguments are stored for handy 00038 ** reference later. The storing is done by interface_parse_argv(). To the 00039 ** right of each member is a sample of what it might contain. If you want a 00040 ** real explaination of the significance of the interface options, looks at 00041 ** the section "Printer Interface Programs" in "The PPR Hackers Guide". 00042 */ 00043 struct INT_CMDLINE 00044 { 00045 gu_boolean probe; /* TRUE if --probe used */ 00046 const char *int_name; /* example: "interfaces/atalk" */ 00047 const char *int_basename; /* example: "atalk" */ 00048 const char *printer; /* example: "myprn" */ 00049 const char *address; /* example: "My Laser Printer:LaserWriter@Computing Center" */ 00050 const char *options; /* example: "idle_status_interval=60 open_retries=5" */ 00051 int jobbreak; /* example: 1 (signal) */ 00052 gu_boolean feedback; /* example: 1 (True) */ 00053 int codes; /* example: 3 (Binary) */ 00054 const char *jobname; /* example: "mouse:myprn-1001.0(mouse)" */ 00055 const char *routing; /* example: "Call David Chappell at 2114 when ready" */ 00056 const char *forline; /* example: "David Chappell" */ 00057 const char *barbarlang; /* example: "" (PostScript) */ 00058 const char *title; /* example: "My Print Job" */ 00059 } ; 00060 00061 extern struct INT_CMDLINE int_cmdline; 00062 00063 /* 00064 ** This stuff is for interfaces that use TCP to connect to the printer. It 00065 ** is include only if the necessary IP include files have already been 00066 ** included. 00067 */ 00068 #ifdef INADDR_NONE 00069 struct TCP_CONNECT_OPTIONS 00070 { 00071 int timeout; 00072 int sndbuf_size; 00073 int refused_retries; 00074 gu_boolean refused_engaged; 00075 }; 00076 00077 int int_tcp_connect_option(const char name[], const char value[], struct OPTIONS_STATE *o, struct TCP_CONNECT_OPTIONS *options); 00078 void int_tcp_parse_address(const char address[], int default_port, struct sockaddr_in *printer_addr); 00079 int int_tcp_open_connexion(const char address[], struct sockaddr_in *printer_addr, struct TCP_CONNECT_OPTIONS *options, void (*status_function)(void *), void *status_obj); 00080 int int_tcp_probe(const struct sockaddr_in *printer_address, const char snmp_community[]); 00081 #endif 00082 00083 /* 00084 ** Prototypes for other functions in libppr which are used 00085 ** only by interfaces. 00086 */ 00087 int int_main(int argc, char *argv[]); 00088 void int_cmdline_set(int argc, char *argv[]); 00089 void int_addrcache_save(const char printer[], const char interface[], const char address[], const char resolution[]); 00090 char *int_addrcache_load(const char printer[], const char interface[], const char address[], int *age); 00091 void int_copy_job(int portfd, int idle_status_interval, void (*fatal_prn_err)(int err), void (*send_eoj_funct)(int fd), void (*snmp_function)(void *address), void *address, int snmp_status_interval); 00092 void print_pap_status(const unsigned char *status); 00093 void int_exit(int exitvalue) 00094 #ifdef __GNUC__ 00095 __attribute__ (( noreturn )) 00096 #endif 00097 ; 00098 void int_debug(const char format[], ...) 00099 #ifdef __GNUC__ 00100 __attribute__ ((format (printf, 1, 2))) 00101 #endif 00102 ; 00103 00104 #endif 00105 00106 /* end of file */ 00107