<h2 class='title'>Introduction</h2>
-<p>The CUPS APIs provide...</p>
+<p>The CUPS library provides a whole collection of interfaces
+needed to support the internal needs of the CUPS software as well
+as the needs of applications, filters, printer drivers, and
+backends.</p>
+
+<p>Unlike the rest of CUPS, the CUPS API library is provided
+under the GNU Library General Public License. This means that you
+can use the CUPS API library in both proprietary and open-source
+programs.</p>
<h2 class='title'>General Usage</h2>
<li><a href='#cupsAddDest'><tt>cupsAddDest()</tt></a> </li>
<li><a href='#cupsAddOption'><tt>cupsAddOption()</tt></a> </li>
<li><a href='#cupsCancelJob'><tt>cupsCancelJob()</tt></a> </li>
- <li><a href='#cupsDoAuthentication'><tt>cupsDoAuthentication()</tt></a> <span class='info'> CUPS 1.1.20 </span></li>
- <li><a href='#cupsDoFileRequest'><tt>cupsDoFileRequest()</tt></a> </li>
- <li><a href='#cupsEncodeOptions'><tt>cupsEncodeOptions()</tt></a> </li>
- <li><a href='#cupsEncodeOptions2'><tt>cupsEncodeOptions2()</tt></a> <span class='info'> CUPS 1.2 </span></li>
<li><a href='#cupsEncryption'><tt>cupsEncryption()</tt></a> </li>
<li><a href='#cupsFreeDests'><tt>cupsFreeDests()</tt></a> </li>
<li><a href='#cupsFreeJobs'><tt>cupsFreeJobs()</tt></a> </li>
<pre>
int
cupsAddDest(
- const <a href='#char'>char</a> * name,
- const <a href='#char'>char</a> * instance,
+ const char * name,
+ const char * instance,
int num_dests,
<a href='#cups_dest_t'>cups_dest_t</a> ** dests);
</pre>
<pre>
int
cupsAddOption(
- const <a href='#char'>char</a> * name,
- const <a href='#char'>char</a> * value,
+ const char * name,
+ const char * value,
int num_options,
<a href='#cups_option_t'>cups_option_t</a> ** options);
</pre>
<pre>
int
cupsCancelJob(
- const <a href='#char'>char</a> * name,
+ const char * name,
int job);
</pre>
<h4>Arguments</h4>
<h4>Returns</h4>
<p>1 on success, 0 on failure</p>
<!-- NEW PAGE -->
-<h3 class='title'><span class='info'> CUPS 1.1.20 </span><a name='cupsDoAuthentication'>cupsDoAuthentication()</a></h3>
-<h4>Description</h4>
-<p>Authenticate a request.
-
-This function should be called in response to a HTTP_UNAUTHORIZED
-status, prior to resubmitting your request.
-
-</p>
-<h4>Syntax</h4>
-<pre>
-int
-cupsDoAuthentication(
- http_t * http,
- const <a href='#char'>char</a> * method,
- const <a href='#char'>char</a> * resource);
-</pre>
-<h4>Arguments</h4>
-<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
-<thead><tr><th>Name</th><th>Description</th></tr></thead>
-<tbody>
-<tr><td><tt>http</tt></td><td>HTTP connection to server</td></tr>
-<tr><td><tt>method</tt></td><td>Request method (GET, POST, PUT)</td></tr>
-<tr><td><tt>resource</tt></td><td>Resource path</td></tr>
-</tbody></table></div>
-<h4>Returns</h4>
-<p>0 on success, -1 on error</p>
-<!-- NEW PAGE -->
-<h3 class='title'><a name='cupsDoFileRequest'>cupsDoFileRequest()</a></h3>
-<h4>Description</h4>
-<p>Do an IPP request.
-
-This function sends any IPP request to the specified server, retrying
-and authenticating as necessary.</p>
-<h4>Syntax</h4>
-<pre>
-ipp_t *
-cupsDoFileRequest(
- http_t * http,
- ipp_t * request,
- const <a href='#char'>char</a> * resource,
- const <a href='#char'>char</a> * filename);
-</pre>
-<h4>Arguments</h4>
-<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
-<thead><tr><th>Name</th><th>Description</th></tr></thead>
-<tbody>
-<tr><td><tt>http</tt></td><td>HTTP connection to server</td></tr>
-<tr><td><tt>request</tt></td><td>IPP request</td></tr>
-<tr><td><tt>resource</tt></td><td>HTTP resource for POST</td></tr>
-<tr><td><tt>filename</tt></td><td>File to send or NULL for none</td></tr>
-</tbody></table></div>
-<h4>Returns</h4>
-<p>Response data</p>
-<!-- NEW PAGE -->
-<h3 class='title'><a name='cupsEncodeOptions'>cupsEncodeOptions()</a></h3>
-<h4>Description</h4>
-<p>Encode printer options into IPP attributes.
-
-This function adds operation, job, and then subscription attributes,
-in that order. Use the cupsEncodeOptions2() function to add attributes
-for a single group.</p>
-<h4>Syntax</h4>
-<pre>
-void
-cupsEncodeOptions(
- ipp_t * ipp,
- int num_options,
- <a href='#cups_option_t'>cups_option_t</a> * options);
-</pre>
-<h4>Arguments</h4>
-<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
-<thead><tr><th>Name</th><th>Description</th></tr></thead>
-<tbody>
-<tr><td><tt>ipp</tt></td><td>Request to add to</td></tr>
-<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
-<tr><td><tt>options</tt></td><td>Options</td></tr>
-</tbody></table></div>
-<h4>Returns</h4>
-<p>Nothing.</p>
-<!-- NEW PAGE -->
-<h3 class='title'><span class='info'> CUPS 1.2 </span><a name='cupsEncodeOptions2'>cupsEncodeOptions2()</a></h3>
-<h4>Description</h4>
-<p>Encode printer options into IPP attributes for a group.
-
-This function only adds attributes for a single group. Call this
-function multiple times for each group, or use cupsEncodeOptions()
-to add the standard groups.
-
-</p>
-<h4>Syntax</h4>
-<pre>
-void
-cupsEncodeOptions2(
- ipp_t * ipp,
- int num_options,
- <a href='#cups_option_t'>cups_option_t</a> * options,
- ipp_tag_t group_tag);
-</pre>
-<h4>Arguments</h4>
-<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
-<thead><tr><th>Name</th><th>Description</th></tr></thead>
-<tbody>
-<tr><td><tt>ipp</tt></td><td>Request to add to</td></tr>
-<tr><td><tt>num_options</tt></td><td>Number of options</td></tr>
-<tr><td><tt>options</tt></td><td>Options</td></tr>
-<tr><td><tt>group_tag</tt></td><td>Group to encode</td></tr>
-</tbody></table></div>
-<h4>Returns</h4>
-<p>Nothing.</p>
-<!-- NEW PAGE -->
<h3 class='title'><a name='cupsEncryption'>cupsEncryption()</a></h3>
<h4>Description</h4>
<p>Get the default encryption settings.
<pre>
int
cupsGetClasses(
- <a href='#char'>char</a> *** classes);
+ char *** classes);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
support the lpoptions-defined default printer.</p>
<h4>Syntax</h4>
<pre>
-const <a href='#char'>char</a> *
+const char *
cupsGetDefault(void);
</pre>
<h4>Arguments</h4>
</p>
<h4>Syntax</h4>
<pre>
-const <a href='#char'>char</a> *
+const char *
cupsGetDefault2(
http_t * http);
</pre>
<pre>
<a href='#cups_dest_t'>cups_dest_t</a> *
cupsGetDest(
- const <a href='#char'>char</a> * name,
- const <a href='#char'>char</a> * instance,
+ const char * name,
+ const char * instance,
int num_dests,
<a href='#cups_dest_t'>cups_dest_t</a> * dests);
</pre>
<!-- NEW PAGE -->
<h3 class='title'><a name='cupsGetDests'>cupsGetDests()</a></h3>
<h4>Description</h4>
-<p>Get the list of destinations from the default server.</p>
+<p>Get the list of destinations from the default server.
+
+Starting with CUPS 1.2, the returned list of destinations include the
+printer-info, printer-is-accepting-jobs, printer-is-shared,
+printer-make-and-model, printer-state, printer-state-change-time,
+printer-state-reasons, and printer-type attributes as options.</p>
<h4>Syntax</h4>
<pre>
int
<h4>Description</h4>
<p>Get the list of destinations from the specified server.
+Starting with CUPS 1.2, the returned list of destinations include the
+printer-info, printer-is-accepting-jobs, printer-is-shared,
+printer-make-and-model, printer-state, printer-state-change-time,
+printer-state-reasons, and printer-type attributes as options.
+
</p>
<h4>Syntax</h4>
<pre>
http_status_t
cupsGetFd(
http_t * http,
- const <a href='#char'>char</a> * resource,
+ const char * resource,
int fd);
</pre>
<h4>Arguments</h4>
<tr><td><tt>fd</tt></td><td>File descriptor</td></tr>
</tbody></table></div>
<h4>Returns</h4>
-<p>Status</p>
+<p>HTTP status</p>
<!-- NEW PAGE -->
<h3 class='title'><span class='info'> CUPS 1.1.20 </span><a name='cupsGetFile'>cupsGetFile()</a></h3>
<h4>Description</h4>
http_status_t
cupsGetFile(
http_t * http,
- const <a href='#char'>char</a> * resource,
- const <a href='#char'>char</a> * filename);
+ const char * resource,
+ const char * filename);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
<tr><td><tt>filename</tt></td><td>Filename</td></tr>
</tbody></table></div>
<h4>Returns</h4>
-<p>Status</p>
+<p>HTTP status</p>
<!-- NEW PAGE -->
<h3 class='title'><a name='cupsGetJobs'>cupsGetJobs()</a></h3>
<h4>Description</h4>
int
cupsGetJobs(
<a href='#cups_job_t'>cups_job_t</a> ** jobs,
- const <a href='#char'>char</a> * mydest,
+ const char * mydest,
int myjobs,
int completed);
</pre>
<thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody>
<tr><td><tt>jobs</tt></td><td>Job data</td></tr>
-<tr><td><tt>mydest</tt></td><td>Only show jobs for dest?</td></tr>
-<tr><td><tt>myjobs</tt></td><td>Only show my jobs?</td></tr>
-<tr><td><tt>completed</tt></td><td>Only show completed jobs?</td></tr>
+<tr><td><tt>mydest</tt></td><td>NULL = all destinations, *
+otherwise show jobs for mydest</td></tr>
+<tr><td><tt>myjobs</tt></td><td>0 = all users, 1 = mine</td></tr>
+<tr><td><tt>completed</tt></td><td>-1 = show all, 0 = active, *
+1 = completed jobs</td></tr>
</tbody></table></div>
<h4>Returns</h4>
<p>Number of jobs</p>
cupsGetJobs2(
http_t * http,
<a href='#cups_job_t'>cups_job_t</a> ** jobs,
- const <a href='#char'>char</a> * mydest,
+ const char * mydest,
int myjobs,
int completed);
</pre>
<tbody>
<tr><td><tt>http</tt></td><td>HTTP connection</td></tr>
<tr><td><tt>jobs</tt></td><td>Job data</td></tr>
-<tr><td><tt>mydest</tt></td><td>Only show jobs for dest?</td></tr>
-<tr><td><tt>myjobs</tt></td><td>Only show my jobs?</td></tr>
-<tr><td><tt>completed</tt></td><td>Only show completed jobs?</td></tr>
+<tr><td><tt>mydest</tt></td><td>NULL = all destinations, *
+otherwise show jobs for mydest</td></tr>
+<tr><td><tt>myjobs</tt></td><td>0 = all users, 1 = mine</td></tr>
+<tr><td><tt>completed</tt></td><td>-1 = show all, 0 = active, *
+1 = completed jobs</td></tr>
</tbody></table></div>
<h4>Returns</h4>
<p>Number of jobs</p>
<p>Get an option value.</p>
<h4>Syntax</h4>
<pre>
-const <a href='#char'>char</a> *
+const char *
cupsGetOption(
- const <a href='#char'>char</a> * name,
+ const char * name,
int num_options,
<a href='#cups_option_t'>cups_option_t</a> * options);
</pre>
in the class.</p>
<h4>Syntax</h4>
<pre>
-const <a href='#char'>char</a> *
+const char *
cupsGetPPD(
- const <a href='#char'>char</a> * name);
+ const char * name);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
</p>
<h4>Syntax</h4>
<pre>
-const <a href='#char'>char</a> *
+const char *
cupsGetPPD2(
http_t * http,
- const <a href='#char'>char</a> * name);
+ const char * name);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
<h4>Description</h4>
<p>Get a password from the user.
-Returns NULL if the user does not provide a password.</p>
+Uses the current password callback function. Returns NULL if the
+user does not provide a password.</p>
<h4>Syntax</h4>
<pre>
-const <a href='#char'>char</a> *
+const char *
cupsGetPassword(
- const <a href='#char'>char</a> * prompt);
+ const char * prompt);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
<pre>
int
cupsGetPrinters(
- <a href='#char'>char</a> *** printers);
+ char *** printers);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
for the given language.</p>
<h4>Syntax</h4>
<pre>
-const <a href='#char'>char</a> *
+const char *
cupsLangEncoding(
cups_lang_t * lang);
</pre>
<pre>
cups_lang_t *
cupsLangGet(
- const <a href='#char'>char</a> * language);
+ const char * language);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
</p>
<h4>Syntax</h4>
<pre>
-const <a href='#char'>char</a> *
+const char *
cupsLastErrorString(void);
</pre>
<h4>Arguments</h4>
<pre>
int
cupsParseOptions(
- const <a href='#char'>char</a> * arg,
+ const char * arg,
int num_options,
<a href='#cups_option_t'>cups_option_t</a> ** options);
</pre>
<pre>
int
cupsPrintFile(
- const <a href='#char'>char</a> * name,
- const <a href='#char'>char</a> * filename,
- const <a href='#char'>char</a> * title,
+ const char * name,
+ const char * filename,
+ const char * title,
int num_options,
<a href='#cups_option_t'>cups_option_t</a> * options);
</pre>
int
cupsPrintFile2(
http_t * http,
- const <a href='#char'>char</a> * name,
- const <a href='#char'>char</a> * filename,
- const <a href='#char'>char</a> * title,
+ const char * name,
+ const char * filename,
+ const char * title,
int num_options,
<a href='#cups_option_t'>cups_option_t</a> * options);
</pre>
<!-- NEW PAGE -->
<h3 class='title'><a name='cupsPrintFiles'>cupsPrintFiles()</a></h3>
<h4>Description</h4>
-<p>Print one or more files to a printer or class on the default server.</p>
+<p>Print one or more files to a printer or class on the
+default server.</p>
<h4>Syntax</h4>
<pre>
int
cupsPrintFiles(
- const <a href='#char'>char</a> * name,
+ const char * name,
int num_files,
- const <a href='#char'>char</a> ** files,
- const <a href='#char'>char</a> * title,
+ const char ** files,
+ const char * title,
int num_options,
<a href='#cups_option_t'>cups_option_t</a> * options);
</pre>
<!-- NEW PAGE -->
<h3 class='title'><span class='info'> CUPS 1.1.21 </span><a name='cupsPrintFiles2'>cupsPrintFiles2()</a></h3>
<h4>Description</h4>
-<p>Print one or more files to a printer or class on the specified server.
+<p>Print one or more files to a printer or class on the
+specified server.
</p>
<h4>Syntax</h4>
int
cupsPrintFiles2(
http_t * http,
- const <a href='#char'>char</a> * name,
+ const char * name,
int num_files,
- const <a href='#char'>char</a> ** files,
- const <a href='#char'>char</a> * title,
+ const char ** files,
+ const char * title,
int num_options,
<a href='#cups_option_t'>cups_option_t</a> * options);
</pre>
http_status_t
cupsPutFd(
http_t * http,
- const <a href='#char'>char</a> * resource,
+ const char * resource,
int fd);
</pre>
<h4>Arguments</h4>
<tr><td><tt>fd</tt></td><td>File descriptor</td></tr>
</tbody></table></div>
<h4>Returns</h4>
-<p>Status</p>
+<p>HTTP status</p>
<!-- NEW PAGE -->
<h3 class='title'><span class='info'> CUPS 1.1.20 </span><a name='cupsPutFile'>cupsPutFile()</a></h3>
<h4>Description</h4>
http_status_t
cupsPutFile(
http_t * http,
- const <a href='#char'>char</a> * resource,
- const <a href='#char'>char</a> * filename);
+ const char * resource,
+ const char * filename);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
<tr><td><tt>filename</tt></td><td>Filename</td></tr>
</tbody></table></div>
<h4>Returns</h4>
-<p>Status</p>
+<p>HTTP status</p>
<!-- NEW PAGE -->
<h3 class='title'><a name='cupsServer'>cupsServer()</a></h3>
<h4>Description</h4>
IPv4 or IPv6 address, or a domain socket pathname.</p>
<h4>Syntax</h4>
<pre>
-const <a href='#char'>char</a> *
+const char *
cupsServer(void);
</pre>
<h4>Arguments</h4>
<pre>
void
cupsSetPasswordCB(
- cups_password_cb_t cb);
+ <a href='#cups_password_cb_t'>cups_password_cb_t</a> cb);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
<pre>
void
cupsSetServer(
- const <a href='#char'>char</a> * server);
+ const char * server);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
<pre>
void
cupsSetUser(
- const <a href='#char'>char</a> * user);
+ const char * user);
</pre>
<h4>Arguments</h4>
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
<pre>
int
cupsTempFd(
- <a href='#char'>char</a> * filename,
+ char * filename,
int len);
</pre>
<h4>Arguments</h4>
</p>
<h4>Syntax</h4>
<pre>
-<a href='#char'>char</a> *
+char *
cupsTempFile(
- <a href='#char'>char</a> * filename,
+ char * filename,
int len);
</pre>
<h4>Arguments</h4>
<pre>
cups_file_t *
cupsTempFile2(
- <a href='#char'>char</a> * filename,
+ char * filename,
int len);
</pre>
<h4>Arguments</h4>
<p>Return the current user's name.</p>
<h4>Syntax</h4>
<pre>
-const <a href='#char'>char</a> *
+const char *
cupsUser(void);
</pre>
<h4>Arguments</h4>
<pre>
struct cups_dest_s
{
- <a href='#char'>char</a> *name, * instance;
+ char *name, * instance;
int is_default;
int num_options;
<a href='#cups_option_t'>cups_option_t</a> * options;
<pre>
struct cups_job_s
{
- <a href='#char'>char</a> *dest, *title, *user, * format;
+ time_t completed_time;
+ time_t creation_time;
+ char * dest;
+ char * format;
int id;
- int size, priority;
- time_t completed_time, creation_time, processing_time;
+ int priority;
+ time_t processing_time;
+ int size;
ipp_jstate_t state;
+ char * title;
+ char * user;
};
</pre>
<h4>Members</h4>
<div class='table'><table align='center' border='1' width='80%'>
<thead><tr><th>Name</th><th>Description</th></tr></thead>
<tbody>
+<tr><td><tt>completed_time</tt> </td><td>Time the job was completed</td></tr>
+<tr><td><tt>creation_time</tt> </td><td>Time the job was created</td></tr>
+<tr><td><tt>dest</tt> </td><td>Printer or class name</td></tr>
<tr><td><tt>format</tt> </td><td>Document format</td></tr>
<tr><td><tt>id</tt> </td><td>The job ID</td></tr>
<tr><td><tt>priority</tt> </td><td>Priority (1-100)</td></tr>
<tr><td><tt>processing_time</tt> </td><td>Time the job was processed</td></tr>
+<tr><td><tt>size</tt> </td><td>Size in kilobytes</td></tr>
<tr><td><tt>state</tt> </td><td>Job state</td></tr>
+<tr><td><tt>title</tt> </td><td>Title/job name</td></tr>
+<tr><td><tt>user</tt> </td><td>User the submitted the job</td></tr>
</tbody></table></div>
<!-- NEW PAGE -->
<h3 class='title'><a name='cups_option_s'>cups_option_s</a></h3>
<h4>Description</h4>
-<p>Types and structures...</p>
+<p>Printer Options</p>
<h4>Definition</h4>
<pre>
struct cups_option_s
{
- <a href='#char'>char</a> * name;
- <a href='#char'>char</a> * value;
+ char * name;
+ char * value;
};
</pre>
<h4>Members</h4>
<!-- NEW PAGE -->
<h2 class='title'><a name='TYPES'>Types</a></h2>
<ul>
- <li><a href='#char'><tt>char</tt></a> </li>
<li><a href='#cups_dest_t'><tt>cups_dest_t</tt></a> </li>
<li><a href='#cups_job_t'><tt>cups_job_t</tt></a> </li>
<li><a href='#cups_option_t'><tt>cups_option_t</tt></a> </li>
+ <li><a href='#cups_password_cb_t'><tt>cups_password_cb_t</tt></a> </li>
<li><a href='#cups_ptype_t'><tt>cups_ptype_t</tt></a> </li>
</ul>
<!-- NEW PAGE -->
-<h3 class='title'><a name='char'>char</a></h3>
-<h4>Description</h4>
-<p>Printer Options</p>
-<h4>Definition</h4>
-<pre>
-typedef const * (*charcups_password_cb_t)(const <a href='#char'>char</a> *);
-</pre>
-<!-- NEW PAGE -->
<h3 class='title'><a name='cups_dest_t'>cups_dest_t</a></h3>
<h4>Description</h4>
<p>Destination</p>
<!-- NEW PAGE -->
<h3 class='title'><a name='cups_option_t'>cups_option_t</a></h3>
<h4>Description</h4>
-<p>Types and structures...</p>
+<p>Printer Options</p>
<h4>Definition</h4>
<pre>
typedef struct <a href='#cups_option_s'>cups_option_s</a> cups_option_t;
</pre>
<!-- NEW PAGE -->
+<h3 class='title'><a name='cups_password_cb_t'>cups_password_cb_t</a></h3>
+<h4>Description</h4>
+<p>Password callback</p>
+<h4>Definition</h4>
+<pre>
+typedef const char * (*cups_password_cb_t)(const char *);
+</pre>
+<!-- NEW PAGE -->
<h3 class='title'><a name='cups_ptype_t'>cups_ptype_t</a></h3>
<h4>Description</h4>
<p>Printer Type/Capability Bits</p>