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