summaryrefslogtreecommitdiff
path: root/doc/help/api-filter.html
blob: 308d0ce07a14999016e977f819b5b9244ae47a54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<!-- SECTION: Programming -->
<head>
	<title>Filter and Backend APIs</title>
	<meta name='keywords' content='Programming'>
	<meta name='creator' content='Mini-XML v2.3'>
	<style type='text/css'><!--
	h1, h2, h3, p { font-family: sans-serif; text-align: justify; }
	tt, pre a:link, pre a:visited, tt a:link, tt a:visited { font-weight: bold; color: #7f0000; }
	pre { font-weight: bold; color: #7f0000; margin-left: 2em; }
	span.info { background: #000000; border: solid thin #000000; color: #ffffff; font-size: 80%; font-style: italic; font-weight: bold; white-space: nowrap; }
	h3 span.info { float: right; font-size: 100%; }
	h1.title, h2.title, h3.title { border-bottom: solid 2px #000000; }
	--></style>
</head>
<body>
<!--
  "$Id$"

  Filter and backend API introduction for the Common UNIX Printing System (CUPS).

  Copyright 1997-2006 by Easy Software Products.

  These coded instructions, statements, and computer programs are the
  property of Easy Software Products and are protected by Federal
  copyright law.  Distribution and use rights are outlined in the file
  "LICENSE.txt" which should have been included with this file.  If this
  file is missing or damaged please contact Easy Software Products
  at:

      Attn: CUPS Licensing Information
      Easy Software Products
      44141 Airport View Drive, Suite 204
      Hollywood, Maryland 20636 USA

      Voice: (301) 373-9600
      EMail: cups-info@cups.org
	WWW: http://www.cups.org
-->

<h2 class='title'>Introduction</h2>

<p>The CUPS filter and backend APIs define standard exit codes
and provide access to the backchannel data stream. They are only
used when writing backends, filters, and port monitors.</p>

<h2 class='title'>General Usage</h2>

<p>The <var>&lt;cups/backend.h&gt;</var> and
<var>&lt;cups/cups.h&gt;</var> header files must be included to
use the <tt>CUPS_BACKEND_</tt> constants and
<tt>cupsBackChannel</tt> functions, respectively.</p>

<p>Programs using these functions must be linked to the CUPS
library: <var>libcups.a</var>, <var>libcups.so.2</var>,
<var>libcups.2.dylib</var>, <var>libcups_s.a</var>, or
<var>libcups2.lib</var> depending on the platform. The following
command compiles <var>myprogram.c</var> using GCC and the CUPS
library:</p>

<pre class='command'>
<kbd>gcc -o myprogram myprogram.c -lcups</kbd>
</pre>

<h2 class='title'>Compatibility</h2>

<p>All of these functions require CUPS 1.2 or higher.</p>
<h2 class='title'>Contents</h2>
<ul>
	<li><a href='#FUNCTIONS'>Functions</a></li>
</ul>
<!-- NEW PAGE -->
<h2 class='title'><a name='FUNCTIONS'>Functions</a></h2>
<ul>
	<li><a href='#cupsBackChannelRead'><tt>cupsBackChannelRead()</tt></a> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></li>
	<li><a href='#cupsBackChannelWrite'><tt>cupsBackChannelWrite()</tt></a> <span class='info'>&nbsp;CUPS 1.2&nbsp;</span></li>
</ul>
<!-- NEW PAGE -->
<h3 class='title'><span class='info'>&nbsp;CUPS 1.2&nbsp;</span><a name='cupsBackChannelRead'>cupsBackChannelRead()</a></h3>
<h4>Description</h4>
<p>Read data from the backchannel.

Reads up to &quot;bytes&quot; bytes from the backchannel. The &quot;timeout&quot;
parameter controls how many seconds to wait for the data - use
0.0 to return immediately if there is no data, -1.0 to wait
for data indefinitely.

</p>
<h4>Syntax</h4>
<pre>
ssize_t
cupsBackChannelRead(
    char * buffer,
    size_t bytes,
    double timeout);
</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>buffer</tt></td><td>Buffer to read</td></tr>
<tr><td><tt>bytes</tt></td><td>Bytes to read</td></tr>
<tr><td><tt>timeout</tt></td><td>Timeout in seconds</td></tr>
</tbody></table></div>
<h4>Returns</h4>
<p>Bytes read or -1 on error</p>
<!-- NEW PAGE -->
<h3 class='title'><span class='info'>&nbsp;CUPS 1.2&nbsp;</span><a name='cupsBackChannelWrite'>cupsBackChannelWrite()</a></h3>
<h4>Description</h4>
<p>Write data to the backchannel.

Writes &quot;bytes&quot; bytes to the backchannel. The &quot;timeout&quot; parameter
controls how many seconds to wait for the data to be written - use
0.0 to return immediately if the data cannot be written, -1.0 to wait
indefinitely.

</p>
<h4>Syntax</h4>
<pre>
ssize_t
cupsBackChannelWrite(
    const char * buffer,
    size_t bytes,
    double timeout);
</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>buffer</tt></td><td>Buffer to write</td></tr>
<tr><td><tt>bytes</tt></td><td>Bytes to write</td></tr>
<tr><td><tt>timeout</tt></td><td>Timeout in seconds</td></tr>
</tbody></table></div>
<h4>Returns</h4>
<p>Bytes written or -1 on error</p>
</body>
</html>