Scroll to navigation

pappl-resource(3) pappl resource functions pappl-resource(3)

NAME

pappl-resource - pappl resource functions

LIBRARY

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

SYNOPSIS

#include <pappl/pappl.h>

typedef struct _pappl_printer_s pappl_printer_t;

typedef struct _pappl_system_s pappl_system_t;

void
papplPrinterAddLink(pappl_printer_t *printer, const char *label, const char *path_or_url, bool secure);

void
papplSystemAddLink(pappl_system_t *system, const char *label, const char *path_or_url, bool secure);

void
papplSystemAddResourceCallback(pappl_system_t *system, const char *path, const char *format, pappl_resource_cb_t cb, void *data);

void
papplSystemAddResourceData(pappl_system_t *system, const char *path, const char *format, const void *data, size_t datalen);

void
papplSystemAddResourceDirectory(pappl_system_t *system, const char *basepath, const char *directory);

void
papplSystemAddResourceFile(pappl_system_t *system, const char *path, const char *format, const char *filename);

void
papplSystemAddResourceString(pappl_system_t *system, const char *path, const char *format, const char *data);

void
papplSystemAddStringsData(pappl_system_t *system, const char *path, const char *language, const char *data);

void
papplSystemAddStringsFile(pappl_system_t *system, const char *path, const char *language, const char *filename);

void
papplSystemRemoveResource(pappl_system_t *system, const char *path);

DESCRIPTION

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

FUNCTIONS

Add a printer link to the navigation header.

void papplPrinterAddLink (

pappl_printer_t *printer,
const char *label,
const char *path_or_url,
pappl_loptions_t options );

This function adds a navigation link for a printer. The "path_or_url" argument specifies a absolute path such as "/ipp/print/example/page" or an absolute URL such as "https://www.example.com/". The "options" argument specifies where the link is shown and whether the link should redirect an absolute path to the secure ("https://.../path") web interface.

Remove a printer link from the navigation header.

void papplPrinterRemoveLink (

pappl_printer_t *printer,
const char *label );

This function removes the named link for the printer.

Add a link to the navigation header.

void papplSystemAddLink (

pappl_system_t *system,
const char *label,
const char *path_or_url,
pappl_loptions_t options );

This function adds a navigation link for the system. The "path_or_url" argument specifies a absolute path such as "/page" or an absolute URL such as "https://www.example.com/". The "options" argument specifies where the link is shown and whether the link should redirect an absolute path to the secure ("https://.../path") web interface.

papplSystemAddResourceCallback

Add a dynamic resource that uses a
callback function.

void papplSystemAddResourceCallback (

pappl_system_t *system,
const char *path,
const char *format,
pappl_resource_cb_t cb,
void *data );

This function adds a dynamic resource at the specified path. When a client GET or POST request is received at the specified path, the "cb" function will be called with the client pointer and "data" pointer to respond to it.

Resource callbacks are most often used to implement custom web pages.

5
Note: Any custom web page that is added prior to calling the
5
papplSystemRun function will replace the corresponding standard web
5
page at the same path.

papplSystemAddResourceData

Add a static data resource.

void papplSystemAddResourceData (

pappl_system_t *system,
const char *path,
const char *format,
const void *data,
size_t datalen );

This function adds a static resource at the specified path. The provided data is not copied to the resource and must remain stable for as long as the resource is added to the system.

5
Note: Any resource that is added prior to calling the papplSystemRun
5
function will replace the corresponding standard resource at the same path.

papplSystemAddResourceDirectory

Add external files in a directory as
resources.

void papplSystemAddResourceDirectory (

pappl_system_t *system,
const char *basepath,
const char *directory );

This function adds static resources from the specified directory under the specified path. The directory is scanned and only those files present at the time of the call are available, and those files must remain stable for as long as the resources are added to the system..

5
Note: Any resource that is added prior to calling the papplSystemRun
5
function will replace the corresponding standard resource at the same path.

papplSystemAddResourceFile

Add an external file as a resource.

void papplSystemAddResourceFile (

pappl_system_t *system,
const char *path,
const char *format,
const char *filename );

This function adds a static resource at the specified path. The provided file is not copied to the resource and must remain stable for as long as the resource is added to the system.

5
Note: Any resource that is added prior to calling the papplSystemRun
5
function will replace the corresponding standard resource at the same path.

papplSystemAddResourceString

Add a static data resource as a C string.

void papplSystemAddResourceString (

pappl_system_t *system,
const char *path,
const char *format,
const char *data );

This function adds a static resource at the specified path. The provided data is not copied to the resource and must remain stable for as long as the resource is added to the system.

5
Note: Any resource that is added prior to calling the papplSystemRun
5
function will replace the corresponding standard resource at the same path.

papplSystemAddStringsData

Add a static localization file resource.

void papplSystemAddStringsData (

pappl_system_t *system,
const char *path,
const char *language,
const char *data );

This function adds a static localization resource at the specified path. Localization files use the NeXTStep strings ("text/strings") format defined in PWG Candidate Standard 5100.13-2013. The provided data is not copied to the resource and must remain stable for as long as the resource is added to the system.

5
Note: Any resource that is added prior to calling the papplSystemRun
5
function will replace the corresponding standard resource at the same path.

papplSystemAddStringsFile

Add an external localization file resource.

void papplSystemAddStringsFile (

pappl_system_t *system,
const char *path,
const char *language,
const char *filename );

This function adds a static localization resource at the specified path. Localization files use the NeXTStep strings ("text/strings") format defined in PWG Candidate Standard 5100.13-2013. The provided file is not copied to the resource and must remain stable for as long as the resource is added to the system.

5
Note: Any resource that is added prior to calling the papplSystemRun
5
function will replace the corresponding standard resource at the same path.

Remove a link from the navigation header.

void papplSystemRemoveLink (

pappl_system_t *system,
const char *label );

This function removes the named link for the system.

papplSystemRemoveResource

Remove a resource at the specified path.

void papplSystemRemoveResource (

pappl_system_t *system,
const char *path );

This function removes a resource at the specified path.

SEE ALSO

pappl(1), pappl-client(3), pappl-device(3), pappl-job(3), pappl-log(3), pappl-mainline(3), pappl-makeresheader(1), pappl-printer(3), pappl-resource(3), pappl-system(3), https://www.msweet.org/pappl

COPYRIGHT

Copyright © 2019-2022 by Michael R Sweet.

PAPPL is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GPL2/LGPL2 software (like older versions of CUPS), so it can be used freely in any project you'd like. See the files "LICENSE" and "NOTICE" in the source distribution for more information.

pappl resource functions 2024-01-22