Blame examples/ppdx.h

Packit 2fc92b
/*
Packit 2fc92b
 * Header for PPD data encoding example code.
Packit 2fc92b
 *
Packit 2fc92b
 * Copyright 2012 by Apple Inc.
Packit 2fc92b
 *
Packit 2fc92b
 * These coded instructions, statements, and computer programs are the
Packit 2fc92b
 * property of Apple Inc. and are protected by Federal copyright
Packit 2fc92b
 * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
Packit 2fc92b
 * which should have been included with this file.  If this file is
Packit 2fc92b
 * missing or damaged, see the license at "http://www.cups.org/".
Packit 2fc92b
 *
Packit 2fc92b
 * This file is subject to the Apple OS-Developed Software exception.
Packit 2fc92b
 */
Packit 2fc92b
Packit 2fc92b
#ifndef _PPDX_H_
Packit 2fc92b
#  define _PPDX_H_
Packit 2fc92b
Packit 2fc92b
Packit 2fc92b
/*
Packit 2fc92b
 * Include necessary headers...
Packit 2fc92b
 */
Packit 2fc92b
Packit 2fc92b
#  include <cups/ppd.h>
Packit 2fc92b
Packit 2fc92b
Packit 2fc92b
/*
Packit 2fc92b
 * C++ magic...
Packit 2fc92b
 */
Packit 2fc92b
Packit 2fc92b
#  ifdef __cplusplus
Packit 2fc92b
extern "C" {
Packit 2fc92b
#  endif /* __cplusplus */
Packit 2fc92b
Packit 2fc92b
Packit 2fc92b
/*
Packit 2fc92b
 * Maximum amount of data to encode/decode...
Packit 2fc92b
 */
Packit 2fc92b
Packit 2fc92b
#  define PPDX_MAX_STATUS	1024	/* Limit on log messages in 10.6 */
Packit 2fc92b
#  define PPDX_MAX_DATA		16777216/* 16MiB */
Packit 2fc92b
Packit 2fc92b
Packit 2fc92b
/*
Packit 2fc92b
 * 'ppdxReadData()' - Read encoded data from a ppd_file_t *.
Packit 2fc92b
 *
Packit 2fc92b
 * Reads chunked data in the PPD file "ppd" using the prefix "name".  Returns
Packit 2fc92b
 * an allocated pointer to the data (which is nul-terminated for convenience)
Packit 2fc92b
 * along with the length of the data in the variable pointed to by "datasize",
Packit 2fc92b
 * which can be NULL to indicate the caller doesn't need the length.
Packit 2fc92b
 *
Packit 2fc92b
 * Returns NULL if no data is present in the PPD with the prefix.
Packit 2fc92b
 */
Packit 2fc92b
Packit 2fc92b
extern void	*ppdxReadData(ppd_file_t *ppd, const char *name,
Packit 2fc92b
		              size_t *datasize);
Packit 2fc92b
Packit 2fc92b
Packit 2fc92b
/*
Packit 2fc92b
 * 'ppdxWriteData()' - Writes encoded data to stderr using PPD: messages.
Packit 2fc92b
 *
Packit 2fc92b
 * Writes chunked data to the PPD file using PPD: messages sent to stderr for
Packit 2fc92b
 * cupsd.  "name" must be a valid PPD keyword string whose length is less than
Packit 2fc92b
 * 37 characters to allow for chunk numbering.  "data" provides a pointer to the
Packit 2fc92b
 * data to be written, and "datasize" provides the length.
Packit 2fc92b
 */
Packit 2fc92b
Packit 2fc92b
extern void	ppdxWriteData(const char *name, const void *data,
Packit 2fc92b
			      size_t datasize);
Packit 2fc92b
Packit 2fc92b
Packit 2fc92b
#  ifdef __cplusplus
Packit 2fc92b
}
Packit 2fc92b
#  endif /* __cplusplus */
Packit 2fc92b
Packit 2fc92b
#endif /* !_PPDX_H */