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 callback function.
109
110       void papplSystemAddResourceCallback (
111           pappl_system_t *system,
112           const char *path,
113           const char *format,
114           pappl_resource_cb_t cb,
115           void *data
116       );
117
118       This  function  adds  a dynamic resource at the specified path.  When a
119       client GET or POST request is received at the specified path, the  "cb"
120       function  will  be called with the client pointer and "data" pointer to
121       respond to it.
122
123       Resource callbacks are most often used to implement custom web pages.
124
125       5      Note: Any custom web page that is added prior to calling the
126
127       5      papplSystemRun function will replace the corresponding  standard
128              web
129
130       5      page at the same path.
131
132   papplSystemAddResourceData
133       Add a static data resource.
134
135       void papplSystemAddResourceData (
136           pappl_system_t *system,
137           const char *path,
138           const char *format,
139           const void *data,
140           size_t datalen
141       );
142
143       This  function  adds a static resource at the specified path.  The pro‐
144       vided data is not copied to the resource and must remain stable for  as
145       long as the resource is added to the system.
146
147       5      Note:  Any resource that is added prior to calling the papplSys‐
148              temRun
149
150       5      function will replace the corresponding standard resource at the
151              same path.
152
153   papplSystemAddResourceDirectory
154       Add external files in a directory as resources.
155
156       void papplSystemAddResourceDirectory (
157           pappl_system_t *system,
158           const char *basepath,
159           const char *directory
160       );
161
162       This  function adds static resources from the specified directory under
163       the specified path.  The directory is  scanned  and  only  those  files
164       present at the time of the call are available, and those files must re‐
165       main stable for as long as the resources are added to the system..
166
167       5      Note: Any resource that is added prior to calling the  papplSys‐
168              temRun
169
170       5      function will replace the corresponding standard resource at the
171              same path.
172
173   papplSystemAddResourceFile
174       Add an external file as a resource.
175
176       void papplSystemAddResourceFile (
177           pappl_system_t *system,
178           const char *path,
179           const char *format,
180           const char *filename
181       );
182
183       This function adds a static resource at the specified path.   The  pro‐
184       vided  file is not copied to the resource and must remain stable for as
185       long as the resource is added to the system.
186
187       5      Note: Any resource that is added prior to calling the  papplSys‐
188              temRun
189
190       5      function will replace the corresponding standard resource at the
191              same path.
192
193   papplSystemAddResourceString
194       Add a static data resource as a C string.
195
196       void papplSystemAddResourceString (
197           pappl_system_t *system,
198           const char *path,
199           const char *format,
200           const char *data
201       );
202
203       This function adds a static resource at the specified path.   The  pro‐
204       vided  data is not copied to the resource and must remain stable for as
205       long as the resource is added to the system.
206
207       5      Note: Any resource that is added prior to calling the  papplSys‐
208              temRun
209
210       5      function will replace the corresponding standard resource at the
211              same path.
212
213   papplSystemAddStringsData
214       Add a static localization file resource.
215
216       void papplSystemAddStringsData (
217           pappl_system_t *system,
218           const char *path,
219           const char *language,
220           const char *data
221       );
222
223       This function adds a static  localization  resource  at  the  specified
224       path.   Localization  files  use  the NeXTStep strings ("text/strings")
225       format defined in PWG Candidate Standard  5100.13-2013.   The  provided
226       data  is  not copied to the resource and must remain stable for as long
227       as the resource is added to the system.
228
229       5      Note: Any resource that is added prior to calling the  papplSys‐
230              temRun
231
232       5      function will replace the corresponding standard resource at the
233              same path.
234
235   papplSystemAddStringsFile
236       Add an external localization file resource.
237
238       void papplSystemAddStringsFile (
239           pappl_system_t *system,
240           const char *path,
241           const char *language,
242           const char *filename
243       );
244
245       This function adds a static  localization  resource  at  the  specified
246       path.   Localization  files  use  the NeXTStep strings ("text/strings")
247       format defined in PWG Candidate Standard  5100.13-2013.   The  provided
248       file  is  not copied to the resource and must remain stable for as long
249       as the resource is added to the system.
250
251       5      Note: Any resource that is added prior to calling the  papplSys‐
252              temRun
253
254       5      function will replace the corresponding standard resource at the
255              same path.
256
257   papplSystemRemoveLink
258       Remove a link from the navigation header.
259
260       void papplSystemRemoveLink (
261           pappl_system_t *system,
262           const char *label
263       );
264
265       This function removes the named link for the system.
266
267   papplSystemRemoveResource
268       Remove a resource at the specified path.
269
270       void papplSystemRemoveResource (
271           pappl_system_t *system,
272           const char *path
273       );
274
275       This function removes a resource at the specified path.
276

SEE ALSO

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