1 /* 2 * IPP Everywhere/Apple Raster/IPP legacy PPD generator header file 3 * 4 * Copyright 2016 by Till Kamppeter. 5 * 6 * The PPD generator is based on the PPD generator for the CUPS 7 * "lpadmin -m everywhere" functionality in the cups/ppd-cache.c 8 * file. The copyright of this file is: 9 * 10 * Copyright 2010-2016 by Apple Inc. 11 * 12 * These coded instructions, statements, and computer programs are the 13 * property of Apple Inc. and are protected by Federal copyright 14 * law. Distribution and use rights are outlined in the file "COPYING" 15 * which should have been included with this file. 16 */ 17 18 #ifndef _CUPS_FILTERS_PPDGENERATOR_H_ 19 # define _CUPS_FILTERS_PPDGENERATOR_H_ 20 21 # ifdef __cplusplus 22 extern "C" { 23 # endif /* __cplusplus */ 24 25 /* 26 * Include necessary headers... 27 */ 28 29 # include <stdio.h> 30 # include <stdlib.h> 31 # include <time.h> 32 # include <math.h> 33 34 # if defined(WIN32) || defined(__EMX__) 35 # include <io.h> 36 # else 37 # include <unistd.h> 38 # include <fcntl.h> 39 # endif /* WIN32 || __EMX__ */ 40 41 # include <cups/cups.h> 42 # include <cups/raster.h> 43 44 #include <config.h> 45 #include <cups/cups.h> 46 #if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) 47 #define HAVE_CUPS_1_6 1 48 #endif 49 50 /* 51 * Prototypes... 52 */ 53 54 #ifdef HAVE_CUPS_1_6 55 56 extern char ppdgenerator_msg[1024]; 57 58 /* Data structure for resolution (X x Y dpi) */ 59 typedef struct res_s { 60 int x, y; 61 } res_t; 62 63 char *ppdCreateFromIPP(char *buffer, size_t bufsize, 64 ipp_t *response, const char *make_model, 65 const char *pdl, int color, int duplex); 66 char *ppdCreateFromIPP2(char *buffer, size_t bufsize, 67 ipp_t *response, const char *make_model, 68 const char *pdl, int color, int duplex, 69 cups_array_t* conflicts, 70 cups_array_t *sizes,char* default_pagesize, 71 const char *default_cluster_color); 72 int compare_resolutions(void *resolution_a, void *resolution_b, 73 void *user_data); 74 void free_resolution(void *resolution, void *user_data); 75 res_t * ippResolutionToRes(ipp_attribute_t *attr, int index); 76 res_t * resolutionNew(int x, int y); 77 cups_array_t * resolutionArrayNew(); 78 cups_array_t* generate_sizes(ipp_t *response, 79 ipp_attribute_t **defattr, 80 int *min_length, 81 int* min_width, 82 int* max_length, 83 int* max_width, 84 int* bottom, 85 int* left, 86 int* right, 87 int* top, 88 char* ppdname); 89 #endif /* HAVE_CUPS_1_6 */ 90 91 # ifdef __cplusplus 92 } 93 # endif /* __cplusplus */ 94 95 #endif /* !_CUPS_FILTERS_PPDGENERATOR_H_ */ 96