1pappl-resource(3)          pappl resource functions          pappl-resource(3)
2
3
4

NAME

6       pappl-resource - pappl resource functions
7

LIBRARY

9       Printer  Application  Framework  (libpappl, "pkg-config --cflags --libs
10       pappl")
11

SYNOPSIS

13       #include <pappl/pappl.h>
14
15       typedef struct _pappl_printer_s pappl_printer_t;
16
17       typedef struct _pappl_system_s pappl_system_t;
18
19       void
20       papplPrinterAddLink(pappl_printer_t *printer, const char *label,  const
21       char *path_or_url, bool secure);
22
23       void
24       papplSystemAddLink(pappl_system_t  *system,  const  char  *label, const
25       char *path_or_url, bool secure);
26
27       void
28       papplSystemAddResourceCallback(pappl_system_t   *system,   const   char
29       *path, const char *format, pappl_resource_cb_t cb, void *data);
30
31       void
32       papplSystemAddResourceData(pappl_system_t  *system,  const  char *path,
33       const char *format, const void *data, size_t datalen);
34
35       void
36       papplSystemAddResourceDirectory(pappl_system_t  *system,   const   char
37       *basepath, const char *directory);
38
39       void
40       papplSystemAddResourceFile(pappl_system_t  *system,  const  char *path,
41       const char *format, const char *filename);
42
43       void
44       papplSystemAddResourceString(pappl_system_t *system, const char  *path,
45       const char *format, const char *data);
46
47       void
48       papplSystemAddStringsData(pappl_system_t  *system,  const  char  *path,
49       const char *language, const char *data);
50
51       void
52       papplSystemAddStringsFile(pappl_system_t  *system,  const  char  *path,
53       const char *language, const char *filename);
54
55       void
56       papplSystemRemoveResource(pappl_system_t *system, const char *path);
57
58

DESCRIPTION

60       The  PAPPL  resource  functions  manage  resource files, callbacks, and
61       links in the printer application.
62

FUNCTIONS

64   papplPrinterAddLink
65       Add a printer link to the navigation header.
66
67       void papplPrinterAddLink (
68           pappl_printer_t *printer,
69           const char *label,
70           const char *path_or_url,
71           pappl_loptions_t options
72       );
73
74       This function adds a navigation link for a printer.  The  "path_or_url"
75       argument specifies a absolute path such as "/ipp/print/example/page" or
76       an absolute URL such as "https://www.example.com/".  The "options"  ar‐
77       gument  specifies  where  the link is shown and whether the link should
78       redirect an absolute path to the secure ("https://.../path") web inter‐
79       face.
80
81   papplPrinterRemoveLink
82       Remove a printer link from the navigation header.
83
84       void papplPrinterRemoveLink (
85           pappl_printer_t *printer,
86           const char *label
87       );
88
89       This function removes the named link for the printer.
90
91   papplSystemAddLink
92       Add a link to the navigation header.
93
94       void papplSystemAddLink (
95           pappl_system_t *system,
96           const char *label,
97           const char *path_or_url,
98           pappl_loptions_t options
99       );
100
101       This function adds a navigation link for the system.  The "path_or_url"
102       argument specifies a absolute path such as "/page" or an  absolute  URL
103       such  as  "https://www.example.com/".  The "options" argument specifies
104       where the link is shown and whether the link should redirect  an  abso‐
105       lute path to the secure ("https://.../path") web interface.
106
107   papplSystemAddResourceCallback
108       Add a dynamic resource that uses a
109                                            callback function.
110
111       void papplSystemAddResourceCallback (
112           pappl_system_t *system,
113           const char *path,
114           const char *format,
115           pappl_resource_cb_t cb,
116           void *data
117       );
118
119       This  function  adds  a dynamic resource at the specified path.  When a
120       client GET or POST request is received at the specified path, the  "cb"
121       function  will  be called with the client pointer and "data" pointer to
122       respond to it.
123
124       Resource callbacks are most often used to implement custom web pages.
125
126       5      Note: Any custom web page that is added prior to calling the
127
128       5      papplSystemRun function will replace the corresponding  standard
129              web
130
131       5      page at the same path.
132
133   papplSystemAddResourceData
134       Add a static data resource.
135
136       void papplSystemAddResourceData (
137           pappl_system_t *system,
138           const char *path,
139           const char *format,
140           const void *data,
141           size_t datalen
142       );
143
144       This  function  adds a static resource at the specified path.  The pro‐
145       vided data is not copied to the resource and must remain stable for  as
146       long as the resource is added to the system.
147
148       5      Note:  Any resource that is added prior to calling the papplSys‐
149              temRun
150
151       5      function will replace the corresponding standard resource at the
152              same path.
153
154   papplSystemAddResourceDirectory
155       Add external files in a directory as
156                                             resources.
157
158       void papplSystemAddResourceDirectory (
159           pappl_system_t *system,
160           const char *basepath,
161           const char *directory
162       );
163
164       This  function adds static resources from the specified directory under
165       the specified path.  The directory is  scanned  and  only  those  files
166       present at the time of the call are available, and those files must re‐
167       main stable for as long as the resources are added to the system..
168
169       5      Note: Any resource that is added prior to calling the  papplSys‐
170              temRun
171
172       5      function will replace the corresponding standard resource at the
173              same path.
174
175   papplSystemAddResourceFile
176       Add an external file as a resource.
177
178       void papplSystemAddResourceFile (
179           pappl_system_t *system,
180           const char *path,
181           const char *format,
182           const char *filename
183       );
184
185       This function adds a static resource at the specified path.   The  pro‐
186       vided  file is not copied to the resource and must remain stable for as
187       long as the resource is added to the system.
188
189       5      Note: Any resource that is added prior to calling the  papplSys‐
190              temRun
191
192       5      function will replace the corresponding standard resource at the
193              same path.
194
195   papplSystemAddResourceString
196       Add a static data resource as a C string.
197
198       void papplSystemAddResourceString (
199           pappl_system_t *system,
200           const char *path,
201           const char *format,
202           const char *data
203       );
204
205       This function adds a static resource at the specified path.   The  pro‐
206       vided  data is not copied to the resource and must remain stable for as
207       long as the resource is added to the system.
208
209       5      Note: Any resource that is added prior to calling the  papplSys‐
210              temRun
211
212       5      function will replace the corresponding standard resource at the
213              same path.
214
215   papplSystemAddStringsData
216       Add a static localization file resource.
217
218       void papplSystemAddStringsData (
219           pappl_system_t *system,
220           const char *path,
221           const char *language,
222           const char *data
223       );
224
225       This function adds a static  localization  resource  at  the  specified
226       path.   Localization  files  use  the NeXTStep strings ("text/strings")
227       format defined in PWG Candidate Standard  5100.13-2013.   The  provided
228       data  is  not copied to the resource and must remain stable for as long
229       as the resource is added to the system.
230
231       5      Note: Any resource that is added prior to calling the  papplSys‐
232              temRun
233
234       5      function will replace the corresponding standard resource at the
235              same path.
236
237   papplSystemAddStringsFile
238       Add an external localization file resource.
239
240       void papplSystemAddStringsFile (
241           pappl_system_t *system,
242           const char *path,
243           const char *language,
244           const char *filename
245       );
246
247       This function adds a static  localization  resource  at  the  specified
248       path.   Localization  files  use  the NeXTStep strings ("text/strings")
249       format defined in PWG Candidate Standard  5100.13-2013.   The  provided
250       file  is  not copied to the resource and must remain stable for as long
251       as the resource is added to the system.
252
253       5      Note: Any resource that is added prior to calling the  papplSys‐
254              temRun
255
256       5      function will replace the corresponding standard resource at the
257              same path.
258
259   papplSystemRemoveLink
260       Remove a link from the navigation header.
261
262       void papplSystemRemoveLink (
263           pappl_system_t *system,
264           const char *label
265       );
266
267       This function removes the named link for the system.
268
269   papplSystemRemoveResource
270       Remove a resource at the specified path.
271
272       void papplSystemRemoveResource (
273           pappl_system_t *system,
274           const char *path
275       );
276
277       This function removes a resource at the specified path.
278

SEE ALSO

280       pappl(1), pappl-client(3), pappl-device(3), pappl-job(3), pappl-log(3),
281       pappl-mainline(3),  pappl-makeresheader(1), pappl-printer(3), pappl-re‐
282       source(3), pappl-system(3), https://www.msweet.org/pappl
283
285       Copyright © 2019-2022 by Michael R Sweet.
286
287       PAPPL is licensed under the Apache License Version  2.0  with  an  (op‐
288       tional)  exception  to  allow linking against GPL2/LGPL2 software (like
289       older versions of CUPS), so it can be used freely in any project  you'd
290       like.   See the files "LICENSE" and "NOTICE" in the source distribution
291       for more information.
292
293
294
2952022-11-07                 pappl resource functions          pappl-resource(3)
Impressum