1 /* 2 * Header for PPD data encoding example code. 3 * 4 * Copyright 2012 by Apple Inc. 5 * 6 * Licensed under Apache License v2.0. See the file "LICENSE" for more information. 7 */ 8 9 #ifndef _PPDX_H_ 10 # define _PPDX_H_ 11 12 13 /* 14 * Include necessary headers... 15 */ 16 17 # include <cups/ppd.h> 18 19 20 /* 21 * C++ magic... 22 */ 23 24 # ifdef __cplusplus 25 extern "C" { 26 # endif /* __cplusplus */ 27 28 29 /* 30 * Maximum amount of data to encode/decode... 31 */ 32 33 # define PPDX_MAX_STATUS 1024 /* Limit on log messages in 10.6 */ 34 # define PPDX_MAX_DATA 16777216/* 16MiB */ 35 36 37 /* 38 * 'ppdxReadData()' - Read encoded data from a ppd_file_t *. 39 * 40 * Reads chunked data in the PPD file "ppd" using the prefix "name". Returns 41 * an allocated pointer to the data (which is nul-terminated for convenience) 42 * along with the length of the data in the variable pointed to by "datasize", 43 * which can be NULL to indicate the caller doesn't need the length. 44 * 45 * Returns NULL if no data is present in the PPD with the prefix. 46 */ 47 48 extern void *ppdxReadData(ppd_file_t *ppd, const char *name, 49 size_t *datasize); 50 51 52 /* 53 * 'ppdxWriteData()' - Writes encoded data to stderr using PPD: messages. 54 * 55 * Writes chunked data to the PPD file using PPD: messages sent to stderr for 56 * cupsd. "name" must be a valid PPD keyword string whose length is less than 57 * 37 characters to allow for chunk numbering. "data" provides a pointer to the 58 * data to be written, and "datasize" provides the length. 59 */ 60 61 extern void ppdxWriteData(const char *name, const void *data, 62 size_t datasize); 63 64 65 # ifdef __cplusplus 66 } 67 # endif /* __cplusplus */ 68 69 #endif /* !_PPDX_H */ 70