]>
Commit | Line | Data |
---|---|---|
a29fd7dd | 1 | /* |
503b54c9 | 2 | * Header for PPD data encoding example code. |
a29fd7dd | 3 | * |
503b54c9 | 4 | * Copyright 2012 by Apple Inc. |
a29fd7dd | 5 | * |
503b54c9 MS |
6 | * These coded instructions, statements, and computer programs are the |
7 | * property of Apple Inc. and are protected by Federal copyright | |
8 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
9 | * which should have been included with this file. If this file is | |
10 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
a29fd7dd | 11 | * |
503b54c9 | 12 | * This file is subject to the Apple OS-Developed Software exception. |
a29fd7dd MS |
13 | */ |
14 | ||
15 | #ifndef _PPDX_H_ | |
16 | # define _PPDX_H_ | |
17 | ||
18 | ||
19 | /* | |
20 | * Include necessary headers... | |
21 | */ | |
22 | ||
23 | # include <cups/ppd.h> | |
24 | ||
25 | ||
26 | /* | |
27 | * C++ magic... | |
28 | */ | |
29 | ||
30 | # ifdef __cplusplus | |
31 | extern "C" { | |
32 | # endif /* __cplusplus */ | |
33 | ||
34 | ||
35 | /* | |
36 | * Maximum amount of data to encode/decode... | |
37 | */ | |
38 | ||
39 | # define PPDX_MAX_STATUS 1024 /* Limit on log messages in 10.6 */ | |
40 | # define PPDX_MAX_DATA 16777216/* 16MiB */ | |
41 | ||
42 | ||
43 | /* | |
44 | * 'ppdxReadData()' - Read encoded data from a ppd_file_t *. | |
45 | * | |
46 | * Reads chunked data in the PPD file "ppd" using the prefix "name". Returns | |
47 | * an allocated pointer to the data (which is nul-terminated for convenience) | |
48 | * along with the length of the data in the variable pointed to by "datasize", | |
49 | * which can be NULL to indicate the caller doesn't need the length. | |
50 | * | |
51 | * Returns NULL if no data is present in the PPD with the prefix. | |
52 | */ | |
53 | ||
54 | extern void *ppdxReadData(ppd_file_t *ppd, const char *name, | |
55 | size_t *datasize); | |
56 | ||
57 | ||
58 | /* | |
59 | * 'ppdxWriteData()' - Writes encoded data to stderr using PPD: messages. | |
60 | * | |
61 | * Writes chunked data to the PPD file using PPD: messages sent to stderr for | |
62 | * cupsd. "name" must be a valid PPD keyword string whose length is less than | |
63 | * 37 characters to allow for chunk numbering. "data" provides a pointer to the | |
64 | * data to be written, and "datasize" provides the length. | |
65 | */ | |
66 | ||
67 | extern void ppdxWriteData(const char *name, const void *data, | |
68 | size_t datasize); | |
69 | ||
70 | ||
71 | # ifdef __cplusplus | |
72 | } | |
73 | # endif /* __cplusplus */ | |
74 | ||
75 | #endif /* !_PPDX_H */ |