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