pappl-resource - Man Page

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

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.

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

Referenced By

pappl(1), pappl-client(3), pappl-device(3), pappl-job(3), pappl-log(3), pappl-mainloop(3), pappl-printer(3), pappl-system(3).

2021-02-15 pappl resource functions