Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| c08fe166d8 |
@@ -1,109 +1,6 @@
|
||||
CHANGES.txt - 2006-11-16
|
||||
CHANGES.txt - 2006-09-21
|
||||
------------------------
|
||||
|
||||
CHANGES IN CUPS V1.2.7
|
||||
|
||||
- Documentation updates (STR #2089)
|
||||
- Added an Italian translation (STR #2105)
|
||||
- The PostScript filter now rotates the bounding box
|
||||
values as needed (STR #2079)
|
||||
- The scheduler no longer loads the remote printer cache
|
||||
when browsing is disabled (STR #2084)
|
||||
- The scheduler no longer writes a new launchd
|
||||
configuration file if it doesn't have to (STR #2083)
|
||||
- Updated the USB and PAP backends for Mac OS X (STR
|
||||
#2086)
|
||||
- The scheduler now picks up on changes to IPv6 and DNS
|
||||
configuration on Mac OS X (STR #2085)
|
||||
- The lpstat program could still hang (STR #2098)
|
||||
- Fixed an inefficiency in the SNMP IPP detection code
|
||||
(STR #2100)
|
||||
- The SSL negotiation code did not implement short
|
||||
timeouts (STR #2091)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.2.6
|
||||
|
||||
- The web interface was not localized on Mac OS X (STR
|
||||
#2075)
|
||||
- "lpc status" did not show the number of queued jobs for
|
||||
disabled queues (STR #2069)
|
||||
- The lpstat program could hang (STR #2073)
|
||||
- The serial backend did not support the new USB serial
|
||||
filenames on Linux (STR #2061)
|
||||
- The parallel backend did not support bidirectional I/O
|
||||
properly (STR #2056)
|
||||
- The network backends now log the numeric address that
|
||||
is being used (STR #2046)
|
||||
- Fixed a compile error when using libpaper.
|
||||
- Fixed a compile error when compiling on Solaris with
|
||||
threading enabled (STR #2049, STR #2050)
|
||||
- Missing printer-state-changed event for
|
||||
printer-state-message updates (STR #2047)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.2.5
|
||||
|
||||
- Documentation updates (STR #2038)
|
||||
- The SNMP backend no longer uses IPP for Epson printers
|
||||
(STR #2028)
|
||||
- Updated the configure script for Tru64 UNIX 5.1 (STR
|
||||
#2033)
|
||||
- Tru64 5.1B's getaddrinfo() and getnameinfo() functions
|
||||
leak file descriptors (STR #2034)
|
||||
- cupsAddDest() didn't add the parent destination's
|
||||
options and attributes.
|
||||
- ppdConflicts() did not handle custom option
|
||||
constraints.
|
||||
- Raw printing of gzip'd files did not work (STR #2009)
|
||||
- The scheduler no longer preserves default option
|
||||
choices when the new PPD no longer provides the old
|
||||
default choice (STR #1929)
|
||||
- The Linux SCSI backend is now only built if the SCSI
|
||||
development headers are installed.
|
||||
- USB printing to Minolta printers did not work (STR
|
||||
#2019)
|
||||
- Windows clients could not monitor the queue status (STR
|
||||
#2006)
|
||||
- The scheduler didn't log the operation name in the
|
||||
access_log file for Create-Job and Print-Job requests.
|
||||
- The PostScript filter now separates collated copies
|
||||
with any required JCL commands so that JCL-based
|
||||
finishing options act on the individual copies and not
|
||||
all of the copies as a single document.
|
||||
- The PostScript filter now disables duplex printing when
|
||||
printing a 1-page document.
|
||||
- cups-lpd didn't pass the correct
|
||||
job-originating-host-name value (STR #2023)
|
||||
- Fixed some speling errors in the German message catalog
|
||||
(STR #2012)
|
||||
- cupstestppd did not catch PPD files with bad
|
||||
UIConstraints values (STR #2016)
|
||||
- The USB backend did not work with the current udev-
|
||||
created printers if the first printer was disconnected
|
||||
(STR #2017)
|
||||
- Mirrored and rotated printing did not work with some
|
||||
documents (STR #2004)
|
||||
- 2-sided printing with banners did not work properly on
|
||||
some printers (STR #2018)
|
||||
- Updated the raw type rule to handle PJL within the
|
||||
first 4k of a print job (STR #1969)
|
||||
- Added an Estonian translation (STR #1957)
|
||||
- Clarified the documentation for the cupsd.conf @LOCAL
|
||||
and @IF(name) allow/deny functionality (STR #1992)
|
||||
- The PostScript filters did not escape the Title and For
|
||||
comments in the print job header (STR #1988)
|
||||
- The scheduler would use 100% CPU if browsing was
|
||||
disabled and the cupsd.conf file contained BrowsePoll
|
||||
lines (STR #1994)
|
||||
- The cupsDirRead() function did not work properly on
|
||||
non-POSIX-compliant systems (STR #2001)
|
||||
- The cupsFile functions didn't handle read/write errors
|
||||
properly (STR #1996)
|
||||
- The DBUS support now works with older versions of the
|
||||
DBUS library.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.2.4
|
||||
|
||||
- The --with-printcap configure option did not work (STR
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CREDITS.txt - 2006-10-02
|
||||
CREDITS.txt - 2006-04-17
|
||||
------------------------
|
||||
|
||||
Few projects are completed by one person, and CUPS is no exception. We'd
|
||||
@@ -20,7 +20,6 @@ like to thank the following individuals for their contributions:
|
||||
testing.
|
||||
Kiko - Bug fixes.
|
||||
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
|
||||
Marek Laane - Estonian translation.
|
||||
Mark Lawrence - Microsoft interoperability testing.
|
||||
Jeff Licquia - Bug fixes, beta testing, evangelism.
|
||||
Jason McMullan - Original CUPS RPM distributions.
|
||||
@@ -29,9 +28,8 @@ like to thank the following individuals for their contributions:
|
||||
Giulio Orsero - Bug fixes and testing.
|
||||
Michal Osowiecki - Polish localization.
|
||||
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
|
||||
Vincenzo Reale - Italian localization.
|
||||
Petter Reinholdtsen - HP-UX compiler stuff.
|
||||
Juan Pablo González Riopedre - Spanish localization.
|
||||
Juan Pablo González Riopedre - Spanish localization
|
||||
Stuart Stevens - HP JetDirect IPP information.
|
||||
Andrea Suatoni - IRIX desktop integration and testing.
|
||||
Tomohiro Kato - Japanese localization.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
INSTALL - CUPS v1.2.7 - 2006-11-16
|
||||
INSTALL - CUPS v1.2.0 - 2006-05-08
|
||||
----------------------------------
|
||||
|
||||
This file describes how to compile and install CUPS from source
|
||||
|
||||
@@ -17,12 +17,12 @@ General Public License ("LGPL"), Version 2, with exceptions for
|
||||
Apple operating systems and the OpenSSL toolkit. A copy of the
|
||||
exceptions and licenses follow this introduction.
|
||||
|
||||
The GNU LGPL applies to the CUPS and CUPS Imaging libraries
|
||||
located in the "cups" and "filter" subdirectories of the CUPS
|
||||
source distribution and in the "cups" include directory and
|
||||
library files in the binary distributions. The GNU GPL applies to
|
||||
the remainder of the CUPS distribution, including the "pdftops"
|
||||
filter which is based upon Xpdf.
|
||||
The GNU LGPL applies to the CUPS API library, located in the
|
||||
"cups" subdirectory of the CUPS source distribution and in the
|
||||
"cups" include directory and library files in the binary
|
||||
distributions. The GNU GPL applies to the remainder of the CUPS
|
||||
distribution, including the "pdftops" filter which is based upon
|
||||
Xpdf and the CUPS imaging library.
|
||||
|
||||
For those not familiar with the GNU GPL, the license basically
|
||||
allows you to:
|
||||
@@ -32,19 +32,22 @@ allows you to:
|
||||
binary form.
|
||||
- Sell verbatim copies of the software for a media fee, or
|
||||
sell support for the software.
|
||||
- Distribute or sell printer drivers and filters that use
|
||||
CUPS so long as source code is made available under the
|
||||
GPL.
|
||||
|
||||
What this license *does not* allow you to do is make changes or
|
||||
add features to CUPS and then sell a binary distribution without
|
||||
source code. You must provide source for any changes or additions
|
||||
to the software, and all code must be provided under the GPL or
|
||||
LGPL as appropriate. The only exceptions to this are the portions
|
||||
of the CUPS software covered by the Apple operating system
|
||||
license exceptions outlined later in this license agreement.
|
||||
source code. You must provide source for any new drivers,
|
||||
changes, or additions to the software, and all code must be
|
||||
provided under the GPL or LGPL as appropriate. The only
|
||||
exceptions to this are the portions of the CUPS software covered
|
||||
by the Apple operating system license exceptions outlined later
|
||||
in this license agreement.
|
||||
|
||||
The GNU LGPL relaxes the "link-to" restriction, allowing you to
|
||||
develop applications that use the CUPS and CUPS Imaging libraries
|
||||
under other licenses and/or conditions as appropriate for your
|
||||
application, driver, or filter.
|
||||
develop applications that use the CUPS API library under other
|
||||
licenses and/or conditions as appropriate for your application.
|
||||
|
||||
|
||||
LICENSE EXCEPTIONS
|
||||
@@ -116,9 +119,9 @@ BINARY DISTRIBUTION RIGHTS
|
||||
|
||||
Easy Software Products also sells rights to the CUPS source code
|
||||
under a binary distribution license for vendors that are unable
|
||||
to release source code for their additions and modifications to
|
||||
CUPS under the GNU GPL and LGPL. For information please contact
|
||||
us at the address shown above.
|
||||
to release source code for their drivers, additions, and
|
||||
modifications to CUPS under the GNU GPL and LGPL. For
|
||||
information please contact us at the address shown above.
|
||||
|
||||
The Common UNIX Printing System provides a "pdftops" filter that
|
||||
is based on the Xpdf software. For binary distribution licensing
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
README - CUPS v1.2.7 - 2006-11-16
|
||||
README - CUPS v1.2.3 - 2006-08-28
|
||||
---------------------------------
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt"
|
||||
|
||||
@@ -46,7 +46,7 @@ all: $(TARGETS)
|
||||
#
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(TARGETS) $(LIBOBJS) http
|
||||
$(RM) $(OBJS) $(TARGETS) http
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -107,7 +107,6 @@ main(int argc, /* I - Number of command-line args */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info */
|
||||
resource[1024], /* Resource info (printer name) */
|
||||
addrname[256], /* Address name */
|
||||
*optptr, /* Pointer to URI options */
|
||||
name[255], /* Name of option */
|
||||
value[255], /* Value of option */
|
||||
@@ -575,18 +574,6 @@ main(int argc, /* I - Number of command-line args */
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
fprintf(stderr, "INFO: Connected to %s...\n", hostname);
|
||||
|
||||
#ifdef AF_INET6
|
||||
if (http->hostaddr->addr.sa_family == AF_INET6)
|
||||
fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6)...\n",
|
||||
httpAddrString(http->hostaddr, addrname, sizeof(addrname)),
|
||||
ntohs(http->hostaddr->ipv6.sin6_port));
|
||||
else
|
||||
#endif /* AF_INET6 */
|
||||
if (http->hostaddr->addr.sa_family == AF_INET)
|
||||
fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4)...\n",
|
||||
httpAddrString(http->hostaddr, addrname, sizeof(addrname)),
|
||||
ntohs(http->hostaddr->ipv4.sin_port));
|
||||
|
||||
/*
|
||||
* Build a URI for the printer and fill the standard IPP attributes for
|
||||
* an IPP_PRINT_FILE request. We can't use the URI in argv[0] because it
|
||||
|
||||
@@ -582,7 +582,6 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
*cptr; /* Pointer into control file string */
|
||||
char status; /* Status byte from command */
|
||||
char portname[255]; /* Port name */
|
||||
char addrname[256]; /* Address name */
|
||||
http_addrlist_t *addrlist, /* Address list */
|
||||
*addr; /* Socket address */
|
||||
int copy; /* Copies written */
|
||||
@@ -821,18 +820,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
fprintf(stderr, "INFO: Connected to %s...\n", hostname);
|
||||
|
||||
#ifdef AF_INET6
|
||||
if (addr->addr.addr.sa_family == AF_INET6)
|
||||
fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6) (local port %d)...\n",
|
||||
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
|
||||
ntohs(addr->addr.ipv6.sin6_port), lport);
|
||||
else
|
||||
#endif /* AF_INET6 */
|
||||
if (addr->addr.addr.sa_family == AF_INET)
|
||||
fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4) (local port %d)...\n",
|
||||
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
|
||||
ntohs(addr->addr.ipv4.sin_port), lport);
|
||||
fprintf(stderr, "DEBUG: Connected on ports %d (local %d)...\n", port,
|
||||
lport);
|
||||
|
||||
/*
|
||||
* Next, open the print file and figure out its size...
|
||||
|
||||
@@ -42,35 +42,31 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* This program implements the Printer Access Protocol (PAP) on top of AppleTalk
|
||||
* Transaction Protocol (ATP). If it were to use the blocking pap functions of
|
||||
* the AppleTalk library it would need seperate threads for reading, writing
|
||||
* and status.
|
||||
* This program implements the Printer Access Protocol (PAP) on top of AppleTalk Transaction
|
||||
* Protocol (ATP). If it were to use the blocking pap functions of the AppleTalk library it
|
||||
* would need seperate threads for reading, writing and status.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* main() - Send a file to the specified Appletalk printer.
|
||||
* listDevices() - List all LaserWriter printers in the local zone.
|
||||
* printFile() - Print file.
|
||||
* printFile() - Print from a file descriptor to an NBP specified printer.
|
||||
* papOpen() - Open a pap session to a printer.
|
||||
* papClose() - Close a pap session.
|
||||
* papClose() - Close a pap session after cleaning up pending transactions.
|
||||
* papWrite() - Write bytes to a printer.
|
||||
* papCloseResp() - Send a pap close response.
|
||||
* papCloseResp() - Send a pap close response in the rare case we receive a close connection request.
|
||||
* papSendRequest() - Fomrat and send a pap packet.
|
||||
* papCancelRequest() - Cancel a pending pap request.
|
||||
* statusUpdate() - Print printer status to stderr.
|
||||
* parseUri() - Extract the print name and zone from a uri.
|
||||
* addPercentEscapes() - Encode a string with percent escapes.
|
||||
* removePercentEscapes - Remove percent escape sequences from a string.
|
||||
* removePercentEscapes - Returns a string with any percent escape sequences replaced with their equivalent.
|
||||
* nbptuple_compare() - Compare routine for qsort.
|
||||
* okayToUseAppleTalk() - Returns true if AppleTalk is available and enabled.
|
||||
* packet_name() - Returns packet name string.
|
||||
* connectTimeout() - Returns the connect timeout preference value.
|
||||
* signalHandler() - handle SIGINT to close the session before quiting.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
@@ -90,8 +86,7 @@
|
||||
#include <netat/nbp.h>
|
||||
#include <netat/pap.h>
|
||||
|
||||
#include <cups/cups.h>
|
||||
#include <cups/backend.h>
|
||||
#include <cups/http.h>
|
||||
|
||||
#include <libkern/OSByteOrder.h>
|
||||
|
||||
@@ -100,25 +95,19 @@
|
||||
#else
|
||||
/* These definitions come from at_proto.h... */
|
||||
# define ZIP_DEF_INTERFACE NULL
|
||||
enum { RUNNING, NOTLOADED, LOADED, OTHERERROR };
|
||||
enum { RUNNING, NOTLOADED, LOADED, OTHERERROR }; /* Appletalk Stack status Function. */
|
||||
|
||||
extern int atp_abort(int fd, at_inet_t *dest, u_short tid);
|
||||
extern int atp_close(int fd);
|
||||
extern int atp_getreq(int fd, at_inet_t *src, char *buf, int *len, int *userdata,
|
||||
int *xo, u_short *tid, u_char *bitmap, int nowait);
|
||||
extern int atp_getreq(int fd, at_inet_t *src, char *buf, int *len, int *userdata, int *xo, u_short *tid, u_char *bitmap, int nowait);
|
||||
extern int atp_getresp(int fd, u_short *tid, at_resp_t *resp);
|
||||
extern int atp_look(int fd);
|
||||
extern int atp_open(at_socket *sock);
|
||||
extern int atp_sendreq(int fd, at_inet_t *dest, char *buf, int len,
|
||||
int userdata, int xo, int xo_relt, u_short *tid,
|
||||
at_resp_t *resp, at_retry_t *retry, int nowait);
|
||||
extern int atp_sendrsp(int fd, at_inet_t *dest, int xo, u_short tid,
|
||||
at_resp_t *resp);
|
||||
extern int atp_sendreq(int fd, at_inet_t *dest, char *buf, int len, int userdata, int xo, int xo_relt, u_short *tid, at_resp_t *resp, at_retry_t *retry, int nowait);
|
||||
extern int atp_sendrsp(int fd, at_inet_t *dest, int xo, u_short tid, at_resp_t *resp);
|
||||
extern int checkATStack();
|
||||
extern int nbp_lookup(at_entity_t *entity, at_nbptuple_t *buf, int max,
|
||||
at_retry_t *retry);
|
||||
extern int nbp_make_entity(at_entity_t *entity, char *obj, char *type,
|
||||
char *zone);
|
||||
extern int nbp_lookup(at_entity_t *entity, at_nbptuple_t *buf, int max, at_retry_t *retry);
|
||||
extern int nbp_make_entity(at_entity_t *entity, char *obj, char *type, char *zone);
|
||||
extern int zip_getmyzone(char *ifName, at_nvestr_t *zone);
|
||||
#endif /* HAVE_APPLETALK_AT_PROTO_H */
|
||||
|
||||
@@ -127,7 +116,7 @@ extern int zip_getmyzone(char *ifName, at_nvestr_t *zone);
|
||||
#include <CoreFoundation/CFPreferences.h>
|
||||
|
||||
/* Defines */
|
||||
#define MAX_PRINTERS 500 /* Max number of printers we can lookup */
|
||||
#define MAX_PRINTERS 500 /* Max number of printers we can lookup in listDevices */
|
||||
#define PAP_CONNID 0
|
||||
#define PAP_TYPE 1
|
||||
#define PAP_EOF 2
|
||||
@@ -137,35 +126,43 @@ extern int zip_getmyzone(char *ifName, at_nvestr_t *zone);
|
||||
#define SEQUENCE_NUM(p) (((u_char *)&p)[2])
|
||||
#define IS_PAP_EOF(p) (((u_char *)&p)[2])
|
||||
|
||||
#define PAPPacketStr(x) \
|
||||
((x) == AT_PAP_TYPE_OPEN_CONN) ? "PAP_OPEN_CONN" : \
|
||||
((x) == AT_PAP_TYPE_OPEN_CONN_REPLY) ? "PAP_OPEN_CONN_REPLY" : \
|
||||
((x) == AT_PAP_TYPE_SEND_DATA) ? "PAP_SEND_DATA" : \
|
||||
((x) == AT_PAP_TYPE_DATA) ? "PAP_DATA" : \
|
||||
((x) == AT_PAP_TYPE_TICKLE) ? "PAP_TICKLE" : \
|
||||
((x) == AT_PAP_TYPE_CLOSE_CONN) ? "PAP_CLOSE_CONN" : \
|
||||
((x) == AT_PAP_TYPE_CLOSE_CONN_REPLY) ? "PAP_CLOSE_CONN_REPLY" : \
|
||||
((x) == AT_PAP_TYPE_SEND_STATUS) ? "PAP_SEND_STATUS" : \
|
||||
((x) == AT_PAP_TYPE_SEND_STS_REPLY) ? "PAP_SEND_STS_REPLY" : \
|
||||
((x) == AT_PAP_TYPE_READ_LW) ? "PAP_READ_LW" : \
|
||||
"<Unknown>"
|
||||
|
||||
#ifndef true
|
||||
#define true 1
|
||||
#define false 0
|
||||
#endif
|
||||
|
||||
/* Globals */
|
||||
int gSockfd = 0; /* Socket descriptor */
|
||||
at_inet_t gSessionAddr = { 0 }; /* Address of the session responding socket */
|
||||
u_char gConnID = 0; /* PAP session connection id */
|
||||
u_short gSendDataID = 0; /* Transaction id of pending send-data request */
|
||||
u_short gTickleID = 0; /* Transaction id of outstanding tickle request*/
|
||||
int gWaitEOF = false; /* Option: wait for a remote's EOF */
|
||||
int gSockfd = 0; /* Socket descriptor */
|
||||
at_inet_t gSessionAddr = { 0 }; /* Address of the session responding socket */
|
||||
u_char gConnID = 0; /* PAP session connection id */
|
||||
u_short gSendDataID = 0; /* Transaction id of our pending send-data request */
|
||||
u_short gTickleID = 0; /* Transaction id of our outstanding tickle request*/
|
||||
int gWaitEOF = false; /* Option: causes us to wait for a remote's EOF */
|
||||
int gStatusInterval= 5; /* Option: 0=off else seconds between status requests*/
|
||||
int gErrorlogged = false; /* If an error was logged don't send any more INFO messages */
|
||||
int gDebug = 0; /* Option: emit debugging info */
|
||||
int gDebug = 0; /* Option: causes us to emit debugging info */
|
||||
|
||||
/* Local functions */
|
||||
static int listDevices(void);
|
||||
static int printFile(char* name, char* type, char* zone, int fdin, int fdout,
|
||||
int fderr, int copies, int argc);
|
||||
static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
|
||||
at_inet_t* pap_to, u_char* flowQuantum);
|
||||
static int papClose();
|
||||
static int papWrite(int sockfd, at_inet_t* dest, u_short tid, u_char connID,
|
||||
u_char flowQuantum, char* data, int len, int eof);
|
||||
static int papCloseResp(int sockfd, at_inet_t* dest, int xo, u_short tid,
|
||||
u_char connID);
|
||||
static int papSendRequest(int sockfd, at_inet_t* dest, u_char connID,
|
||||
int function, u_char bitmap, int xo, int seqno);
|
||||
static int printFile(char* name, char* type, char* zone, int fdin, int fdout, int fderr, int copies, int argc);
|
||||
static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd, at_inet_t* pap_to, u_char* flowQuantum);
|
||||
static int papClose(int abortflag);
|
||||
static int papWrite(int sockfd, at_inet_t* dest, u_short tid, u_char connID, u_char flowQuantum, char* data, int len, int eof);
|
||||
static int papCloseResp(int sockfd, at_inet_t* dest, int xo, u_short tid, u_char connID);
|
||||
static int papSendRequest(int sockfd, at_inet_t* dest, u_char connID, int function, u_char bitmap, int xo, int seqno);
|
||||
static int papCancelRequest(int sockfd, u_short tid);
|
||||
static void statusUpdate(char* status, u_char statusLen);
|
||||
static int parseUri(const char* argv0, char* name, char* type, char* zone);
|
||||
@@ -173,7 +170,6 @@ static int addPercentEscapes(const char* src, char* dst, int dstMax);
|
||||
static int removePercentEscapes(const char* src, char* dst, int dstMax);
|
||||
static int nbptuple_compare(const void *p1, const void *p2);
|
||||
static int okayToUseAppleTalk(void);
|
||||
static const char *packet_name(u_char x);
|
||||
static int connectTimeout(void);
|
||||
static void signalHandler(int sigraised);
|
||||
|
||||
@@ -203,13 +199,10 @@ int main (int argc, const char * argv[])
|
||||
|
||||
if (argc == 1 || (argc == 2 && strcmp(argv[1], "-discover") == 0))
|
||||
{
|
||||
/* If listDevices() didn't find any devices or returns an error output a
|
||||
* legacy style announcement.
|
||||
*
|
||||
/* Ignore errors returned by listDevices - they may be transitory
|
||||
* and we don't want cupsd to think that pap is forever unusable.
|
||||
*/
|
||||
if (listDevices() <= 0)
|
||||
puts("network pap \"Unknown\" \"AppleTalk Printer Access Protocol (pap)\"");
|
||||
|
||||
listDevices();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -246,9 +239,9 @@ int main (int argc, const char * argv[])
|
||||
}
|
||||
|
||||
/* Extract the device name and options from the URI... */
|
||||
parseUri(cupsBackendDeviceURI((char **)argv), name, type, zone);
|
||||
parseUri(argv[0], name, type, zone);
|
||||
|
||||
err = printFile(name, type, zone, fileno(fp), STDOUT_FILENO, STDERR_FILENO, copies, argc);
|
||||
err = printFile(name, type, zone, fileno(fp), 3, STDERR_FILENO, copies, argc);
|
||||
|
||||
if (fp != stdin)
|
||||
fclose(fp);
|
||||
@@ -270,7 +263,7 @@ int main (int argc, const char * argv[])
|
||||
static int listDevices(void)
|
||||
{
|
||||
int err = noErr;
|
||||
int i;
|
||||
int ind;
|
||||
int numberFound;
|
||||
|
||||
at_nvestr_t at_zone;
|
||||
@@ -294,13 +287,10 @@ static int listDevices(void)
|
||||
perror("ERROR: Unable to get default AppleTalk zone");
|
||||
return -2;
|
||||
}
|
||||
|
||||
memcpy(zone, at_zone.str, MIN(at_zone.len, sizeof(zone)-1));
|
||||
zone[MIN(at_zone.len, sizeof(zone)-1)] = '\0';
|
||||
|
||||
fprintf(stderr, "INFO: Using default AppleTalk zone \"%s\"\n", zone);
|
||||
|
||||
addPercentEscapes(zone, encodedZone, sizeof(encodedZone));
|
||||
err = addPercentEscapes(zone, encodedZone, sizeof(encodedZone));
|
||||
|
||||
/* Look up all the printers in our zone */
|
||||
nbp_make_entity(&entity, "=", "LaserWriter", zone);
|
||||
@@ -320,10 +310,10 @@ static int listDevices(void)
|
||||
/* Not required but sort them so they look nice */
|
||||
qsort(buf, numberFound, sizeof(at_nbptuple_t), nbptuple_compare);
|
||||
|
||||
for (i = 0; i < numberFound; i++)
|
||||
for (ind = 0; ind < numberFound; ind++)
|
||||
{
|
||||
memcpy(name, buf[i].enu_entity.object.str, MIN(buf[i].enu_entity.object.len, sizeof(name)-1));
|
||||
name[MIN(buf[i].enu_entity.object.len, sizeof(name)-1)] = '\0';
|
||||
memcpy(name, buf[ind].enu_entity.object.str, MIN(buf[ind].enu_entity.object.len, sizeof(name)-1));
|
||||
name[MIN(buf[ind].enu_entity.object.len, sizeof(name)-1)] = '\0';
|
||||
|
||||
if (addPercentEscapes(name, encodedName, sizeof(encodedName)) == 0)
|
||||
{
|
||||
@@ -381,7 +371,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
int err;
|
||||
int rc;
|
||||
int val;
|
||||
int len, i;
|
||||
int len, ind;
|
||||
|
||||
char fileBuffer[4096]; /* File buffer */
|
||||
int fileBufferNbytes;
|
||||
@@ -400,19 +390,20 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
int userdata, xo, reqlen;
|
||||
u_short tid;
|
||||
u_char bitmap;
|
||||
int maxfdp1,
|
||||
nbp_failures = 0;
|
||||
int maxfdp1;
|
||||
struct timeval timeout, *timeoutPtr;
|
||||
u_char flowQuantum = 1;
|
||||
u_short recvSequence = 0;
|
||||
time_t now,
|
||||
start_time,
|
||||
connect_time,
|
||||
elasped_time,
|
||||
sleep_time,
|
||||
connect_timeout = -1,
|
||||
nextStatusTime = 0;
|
||||
at_entity_t entity;
|
||||
at_retry_t retry;
|
||||
Boolean recoverableErrShown = false;
|
||||
|
||||
|
||||
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
|
||||
struct sigaction action; /* Actions for POSIX signals */
|
||||
@@ -429,60 +420,51 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
* Remember when we started looking for the printer.
|
||||
*/
|
||||
|
||||
start_time = time(NULL);
|
||||
connect_time = time(NULL);
|
||||
|
||||
retry.interval = 1;
|
||||
retry.retries = 5;
|
||||
retry.backoff = 0;
|
||||
|
||||
fprintf(stderr, "STATE: +connecting-to-device\n");
|
||||
|
||||
/* Loop forever trying to get an open session with the printer. */
|
||||
for (;;)
|
||||
{
|
||||
/* Make sure it's okay to use appletalk */
|
||||
if (okayToUseAppleTalk())
|
||||
{
|
||||
/* Clear this printer-state-reason in case we've set it */
|
||||
fprintf(stderr, "STATE: -apple-appletalk-disabled-warning\n");
|
||||
|
||||
/* Resolve the name into an address. Returns the number found or an error */
|
||||
if ((err = nbp_lookup(&entity, &tuple, 1, &retry)) > 0)
|
||||
{
|
||||
if (err > 1)
|
||||
fprintf(stderr, "DEBUG: Found more than one printer with the name \"%s\"\n", name);
|
||||
|
||||
if (nbp_failures)
|
||||
{
|
||||
fprintf(stderr, "STATE: -apple-nbp-lookup-warning\n");
|
||||
nbp_failures = 0;
|
||||
if (recoverableErrShown)
|
||||
{
|
||||
fprintf(stderr, "INFO: recovered: \n");
|
||||
sleep(5);
|
||||
recoverableErrShown = false;
|
||||
}
|
||||
|
||||
/* Open a connection to the device */
|
||||
if ((err = papOpen(&tuple, &gConnID, &gSockfd, &gSessionAddr, &flowQuantum)) == 0)
|
||||
break;
|
||||
|
||||
fprintf(stderr, "WARNING: Unable to open \"%s:%s\": %s\n", name, zone, strerror(err));
|
||||
fprintf(stderr, "WARNING: Unable to open \"%s:%s\": %s\n", name, zone, strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It's not unusual to have to call nbp_lookup() twice before it's sucessful... */
|
||||
if (++nbp_failures > 2)
|
||||
{
|
||||
retry.interval = 2;
|
||||
retry.retries = 3;
|
||||
fprintf(stderr, "STATE: +apple-nbp-lookup-warning\n");
|
||||
fprintf(stderr, "WARNING: Printer not responding\n");
|
||||
}
|
||||
fprintf(stderr, "WARNING: recoverable: Printer not responding\n");
|
||||
recoverableErrShown = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "STATE: +apple-appletalk-disabled-warning\n");
|
||||
fprintf(stderr, "INFO: AppleTalk disabled in System Preferences.\n");
|
||||
fprintf(stderr, "WARNING: recoverable: AppleTalk disabled in System Preferences.\n");
|
||||
recoverableErrShown = true;
|
||||
}
|
||||
|
||||
elasped_time = time(NULL) - start_time;
|
||||
retry.retries = 3;
|
||||
elasped_time = time(NULL) - connect_time;
|
||||
|
||||
if (connect_timeout == -1)
|
||||
connect_timeout = connectTimeout();
|
||||
@@ -493,9 +475,9 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
err = ETIMEDOUT;
|
||||
goto Exit; /* Waiting too long... */
|
||||
}
|
||||
else if (elasped_time < (30 * 60))
|
||||
else if (elasped_time < 30 /*(30 * 60)*/)
|
||||
sleep_time = 10; /* Waiting < 30 minutes */
|
||||
else if (elasped_time < (24 * 60 * 60))
|
||||
else if (elasped_time < 60 /*(24 * 60 * 60)*/)
|
||||
sleep_time = 30; /* Waiting < 24 hours */
|
||||
else
|
||||
sleep_time = 60; /* Waiting > 24 hours */
|
||||
@@ -504,8 +486,6 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
sleep(sleep_time);
|
||||
}
|
||||
|
||||
fprintf(stderr, "STATE: -connecting-to-device\n");
|
||||
|
||||
/*
|
||||
* Now that we are connected to the printer ignore SIGTERM so that we
|
||||
* can finish out any page data the driver sends (e.g. to eject the
|
||||
@@ -556,6 +536,21 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
val = fcntl(fdin, F_GETFL, 0);
|
||||
fcntl(fdin, F_SETFL, val | O_NONBLOCK);
|
||||
|
||||
/* Set non-blocking mode on our data destination descriptor */
|
||||
val = fcntl(fdout, F_GETFL, 0);
|
||||
if (val < 0)
|
||||
{
|
||||
/*
|
||||
* Map output to stdout if we don't have the backchannel pipe
|
||||
* available on file descriptor 3...
|
||||
*/
|
||||
|
||||
if (fdout == 3 && errno == EBADF)
|
||||
fdout = 1;
|
||||
}
|
||||
else
|
||||
fcntl(fdout, F_SETFL, val | O_NONBLOCK);
|
||||
|
||||
fileBufferNbytes = 0;
|
||||
fileTbytes = 0;
|
||||
fileEOFRead = fileEOFSent = false;
|
||||
@@ -671,7 +666,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: <- %s\n", packet_name(TYPE_OF(userdata)));
|
||||
fprintf(stderr, "DEBUG: <- %s\n", PAPPacketStr(TYPE_OF(userdata)));
|
||||
|
||||
switch (TYPE_OF(userdata))
|
||||
{
|
||||
@@ -712,10 +707,10 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
break;
|
||||
|
||||
case AT_PAP_TYPE_DATA: /* Data packet */
|
||||
for (len=0, i=0; i < ATP_TRESP_MAX; i++)
|
||||
for (len=0, ind=0; ind < ATP_TRESP_MAX; ind++)
|
||||
{
|
||||
if (resp.bitmap & (1 << i))
|
||||
len += resp.resp[i].iov_len;
|
||||
if (resp.bitmap & (1 << ind))
|
||||
len += resp.resp[ind].iov_len;
|
||||
}
|
||||
|
||||
fprintf(stderr, "DEBUG: <- PAP_DATA %d bytes %s\n", len, IS_PAP_EOF(userdata) ? "with EOF" : "");
|
||||
@@ -727,7 +722,7 @@ static int printFile(char* name, char* type, char* zone, int fdin, int fdout, in
|
||||
char logstr[512];
|
||||
int logstrlen;
|
||||
|
||||
cupsBackChannelWrite(sockBuffer, len, 1.0);
|
||||
write(fdout, sockBuffer, len);
|
||||
|
||||
sockBuffer[len] = '\0'; /* We always reserve room for the nul so we can use strstr() below*/
|
||||
pLineBegin = sockBuffer;
|
||||
@@ -840,7 +835,7 @@ Exit:
|
||||
/*
|
||||
* Close the socket and return...
|
||||
*/
|
||||
papClose();
|
||||
papClose(false);
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -859,35 +854,37 @@ Exit:
|
||||
*
|
||||
* @result A non-zero return value for errors
|
||||
*/
|
||||
static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
|
||||
at_inet_t* sessionAddr, u_char* flowQuantum)
|
||||
static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd, at_inet_t* sessionAddr, u_char* flowQuantum)
|
||||
{
|
||||
int result,
|
||||
open_result,
|
||||
userdata,
|
||||
atp_err;
|
||||
time_t tm,
|
||||
waitTime;
|
||||
char data[10],
|
||||
rdata[ATP_DATA_SIZE];
|
||||
u_char *puserdata;
|
||||
at_socket socketfd;
|
||||
openResult;
|
||||
long tm;
|
||||
char data[10], rdata[ATP_DATA_SIZE];
|
||||
int userdata;
|
||||
u_char *puserdata = (u_char *)&userdata;
|
||||
at_socket sock = 0;
|
||||
u_short waitTime;
|
||||
int status;
|
||||
at_resp_t resp;
|
||||
at_retry_t retry;
|
||||
|
||||
result = 0;
|
||||
socketfd = 0;
|
||||
puserdata = (u_char *)&userdata;
|
||||
if (tuple == NULL)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fprintf(stderr, "INFO: Opening connection\n");
|
||||
|
||||
if ((*fd = atp_open(&socketfd)) < 0)
|
||||
errno = 0;
|
||||
result = 0;
|
||||
|
||||
*fd = atp_open(&sock);
|
||||
if (*fd < 0)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Build the open connection request packet.
|
||||
/* Build the open connection request packet.
|
||||
*/
|
||||
|
||||
tm = time(NULL);
|
||||
srand(tm);
|
||||
|
||||
@@ -904,67 +901,64 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
|
||||
resp.resp[0].iov_base = rdata;
|
||||
resp.resp[0].iov_len = sizeof(rdata);
|
||||
|
||||
data[0] = socketfd;
|
||||
data[0] = sock;
|
||||
data[1] = 8;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
waitTime = time(NULL) - tm;
|
||||
OSWriteBigInt16(&data[2], 0, (u_short)waitTime);
|
||||
waitTime = (u_short)(time(NULL) - tm);
|
||||
OSWriteBigInt16(&data[2], 0, waitTime);
|
||||
|
||||
fprintf(stderr, "DEBUG: -> %s\n", packet_name(AT_PAP_TYPE_OPEN_CONN));
|
||||
fprintf(stderr, "DEBUG: -> %s\n", PAPPacketStr(AT_PAP_TYPE_OPEN_CONN));
|
||||
|
||||
if ((atp_err = atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0,
|
||||
0, &resp, &retry, 0)) < 0)
|
||||
status = atp_sendreq(*fd, &tuple->enu_addr, data, 4, userdata, 1, 0, 0, &resp, &retry, 0);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
statusUpdate("Destination unreachable", 23);
|
||||
result = EHOSTUNREACH;
|
||||
break;
|
||||
errno = EHOSTUNREACH;
|
||||
sleep(1);
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
puserdata = (u_char *)&resp.userdata[0];
|
||||
open_result = OSReadBigInt16(&rdata[2], 0);
|
||||
|
||||
fprintf(stderr, "DEBUG: <- %s, status %d\n", packet_name(puserdata[1]),
|
||||
open_result);
|
||||
|
||||
/*
|
||||
* Just for the sake of our sanity check the other fields in the packet
|
||||
*/
|
||||
|
||||
if (puserdata[1] != AT_PAP_TYPE_OPEN_CONN_REPLY ||
|
||||
(open_result == 0 && (puserdata[0] & 0xff) != *connID))
|
||||
else
|
||||
{
|
||||
result = EINVAL;
|
||||
break;
|
||||
puserdata = (u_char *)&resp.userdata[0];
|
||||
openResult = OSReadBigInt16(&rdata[2], 0);
|
||||
|
||||
fprintf(stderr, "DEBUG: <- %s, status %d\n", PAPPacketStr(puserdata[1]), openResult);
|
||||
|
||||
/* Just for the sake of our sanity check the other fields in the packet
|
||||
*/
|
||||
if (puserdata[1] != AT_PAP_TYPE_OPEN_CONN_REPLY ||
|
||||
(openResult == 0 && (puserdata[0] & 0xff) != *connID))
|
||||
{
|
||||
result = EINVAL;
|
||||
errno = EINVAL;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
statusUpdate(&rdata[5], rdata[4] & 0xff);
|
||||
|
||||
if (openResult == 0)
|
||||
break; /* Connection established okay, exit from the loop */
|
||||
}
|
||||
|
||||
statusUpdate(&rdata[5], rdata[4] & 0xff);
|
||||
|
||||
/*
|
||||
* if the connection established okay exit from the loop
|
||||
*/
|
||||
|
||||
if (open_result == 0)
|
||||
break;
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
/* Update the session address
|
||||
*/
|
||||
sessionAddr->net = tuple->enu_addr.net;
|
||||
sessionAddr->node = tuple->enu_addr.node;
|
||||
sessionAddr->socket = rdata[0];
|
||||
*flowQuantum = rdata[1];
|
||||
}
|
||||
else
|
||||
/* Update the session address
|
||||
*/
|
||||
sessionAddr->net = tuple->enu_addr.net;
|
||||
sessionAddr->node = tuple->enu_addr.node;
|
||||
sessionAddr->socket = rdata[0];
|
||||
*flowQuantum = rdata[1];
|
||||
|
||||
Exit:
|
||||
if (result != 0)
|
||||
{
|
||||
atp_close(*fd);
|
||||
*fd = 0;
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -976,9 +970,12 @@ static int papOpen(at_nbptuple_t* tuple, u_char* connID, int* fd,
|
||||
* @abstract End a PAP session by canceling outstanding send-data & tickle
|
||||
* transactions and sending a PAP close request.
|
||||
*
|
||||
* @param abort If we're aborting then send the close request
|
||||
* with 0 retries (not yet implemented)
|
||||
*
|
||||
* @result A non-zero return value for errors
|
||||
*/
|
||||
static int papClose()
|
||||
static int papClose(int abortflag)
|
||||
{
|
||||
int fd;
|
||||
u_short tmpID;
|
||||
@@ -1021,7 +1018,7 @@ static int papClose()
|
||||
if (gWaitEOF == false)
|
||||
sleep(2);
|
||||
|
||||
fprintf(stderr, "DEBUG: -> %s\n", packet_name(AT_PAP_TYPE_CLOSE_CONN));
|
||||
fprintf(stderr, "DEBUG: -> %s\n", PAPPacketStr(AT_PAP_TYPE_CLOSE_CONN));
|
||||
|
||||
puserdata[0] = gConnID;
|
||||
puserdata[1] = AT_PAP_TYPE_CLOSE_CONN;
|
||||
@@ -1061,7 +1058,7 @@ static int papClose()
|
||||
static int papWrite(int sockfd, at_inet_t* dest, u_short tid, u_char connID, u_char flowQuantum, char* data, int len, int eof)
|
||||
{
|
||||
int result;
|
||||
int i;
|
||||
int ind;
|
||||
u_char* puserdata;
|
||||
at_resp_t resp;
|
||||
|
||||
@@ -1079,26 +1076,26 @@ static int papWrite(int sockfd, at_inet_t* dest, u_short tid, u_char connID, u_c
|
||||
* response packets to reply to an incoming
|
||||
* PAP 'SENDDATA' request
|
||||
*/
|
||||
for (i = 0; i < flowQuantum; i++)
|
||||
for (ind = 0; ind < flowQuantum; ind++)
|
||||
{
|
||||
resp.userdata[i] = 0;
|
||||
puserdata = (u_char *)&resp.userdata[i];
|
||||
resp.userdata[ind] = 0;
|
||||
puserdata = (u_char *)&resp.userdata[ind];
|
||||
|
||||
puserdata[PAP_CONNID] = connID;
|
||||
puserdata[PAP_TYPE] = AT_PAP_TYPE_DATA;
|
||||
puserdata[PAP_EOF] = eof ? 1 : 0;
|
||||
|
||||
resp.resp[i].iov_base = (caddr_t)data;
|
||||
resp.resp[ind].iov_base = (caddr_t)data;
|
||||
|
||||
if (data)
|
||||
data += AT_PAP_DATA_SIZE;
|
||||
|
||||
resp.resp[i].iov_len = MIN((int)len, (int)AT_PAP_DATA_SIZE);
|
||||
len -= resp.resp[i].iov_len;
|
||||
resp.resp[ind].iov_len = MIN((int)len, (int)AT_PAP_DATA_SIZE);
|
||||
len -= resp.resp[ind].iov_len;
|
||||
if (len == 0)
|
||||
break;
|
||||
}
|
||||
resp.bitmap = (1 << (i + 1)) - 1;
|
||||
resp.bitmap = (1 << (ind + 1)) - 1;
|
||||
|
||||
/*
|
||||
* Write out the data as a PAP 'DATA' response
|
||||
@@ -1171,7 +1168,7 @@ static int papSendRequest(int sockfd, at_inet_t* dest, u_char connID, int functi
|
||||
at_resp_t resp;
|
||||
static u_short pap_send_count = 0;
|
||||
|
||||
fprintf(stderr, "DEBUG: -> %s\n", packet_name(function));
|
||||
fprintf(stderr, "DEBUG: -> %s\n", PAPPacketStr(function));
|
||||
|
||||
puserdata[0] = connID;
|
||||
puserdata[1] = function;
|
||||
@@ -1277,7 +1274,7 @@ void statusUpdate(char* status, u_char statusLen)
|
||||
*/
|
||||
static int parseUri(const char* argv0, char* name, char* type, char* zone)
|
||||
{
|
||||
char method[255], /* Method in URI */
|
||||
char scheme[255], /* Scheme in URI */
|
||||
hostname[1024], /* Hostname */
|
||||
username[255], /* Username info (not used) */
|
||||
resource[1024], /* Resource info (device and options) */
|
||||
@@ -1293,10 +1290,8 @@ static int parseUri(const char* argv0, char* name, char* type, char* zone)
|
||||
/*
|
||||
* Extract the device name and options from the URI...
|
||||
*/
|
||||
method[0] = username[0] = hostname[0] = resource[0] = '\0';
|
||||
port = 0;
|
||||
|
||||
httpSeparateURI(HTTP_URI_CODING_NONE, argv0, method, sizeof(method),
|
||||
httpSeparateURI(HTTP_URI_CODING_NONE, argv0, scheme, sizeof(scheme),
|
||||
username, sizeof(username),
|
||||
hostname, sizeof(hostname), &port,
|
||||
resource, sizeof(resource));
|
||||
@@ -1532,31 +1527,6 @@ static int okayToUseAppleTalk()
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* @function packet_name
|
||||
* @abstract Returns packet name string.
|
||||
*
|
||||
* @result A string
|
||||
*/
|
||||
static const char *packet_name(u_char x)
|
||||
{
|
||||
switch (x)
|
||||
{
|
||||
case AT_PAP_TYPE_OPEN_CONN: return "PAP_OPEN_CONN";
|
||||
case AT_PAP_TYPE_OPEN_CONN_REPLY: return "PAP_OPEN_CONN_REPLY";
|
||||
case AT_PAP_TYPE_SEND_DATA: return "PAP_SEND_DATA";
|
||||
case AT_PAP_TYPE_DATA: return "PAP_DATA";
|
||||
case AT_PAP_TYPE_TICKLE: return "PAP_TICKLE";
|
||||
case AT_PAP_TYPE_CLOSE_CONN: return "PAP_CLOSE_CONN";
|
||||
case AT_PAP_TYPE_CLOSE_CONN_REPLY: return "PAP_CLOSE_CONN_REPLY";
|
||||
case AT_PAP_TYPE_SEND_STATUS: return "PAP_SEND_STATUS";
|
||||
case AT_PAP_TYPE_SEND_STS_REPLY: return "PAP_SEND_STS_REPLY";
|
||||
case AT_PAP_TYPE_READ_LW: return "PAP_READ_LW";
|
||||
}
|
||||
return "<Unknown>";
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* @function connectTimeout
|
||||
* @abstract Returns the connect timeout preference value.
|
||||
@@ -1592,7 +1562,7 @@ static void signalHandler(int sigraised)
|
||||
{
|
||||
fprintf(stderr, "ERROR: There was a timeout error while sending data to the printer\n");
|
||||
|
||||
papClose();
|
||||
papClose(true);
|
||||
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
@@ -88,8 +88,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
*options; /* Pointer to options */
|
||||
int port; /* Port number (not used) */
|
||||
int print_fd, /* Print file */
|
||||
device_fd, /* Parallel device */
|
||||
use_bc; /* Read back-channel data? */
|
||||
device_fd; /* Parallel device */
|
||||
int copies; /* Number of copies to print */
|
||||
size_t tbytes; /* Total number of bytes written */
|
||||
struct termios opts; /* Parallel port options */
|
||||
@@ -189,26 +188,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
do
|
||||
{
|
||||
#ifdef __linux
|
||||
/*
|
||||
* The Linux parallel port driver currently is broken WRT select()
|
||||
* and bidirection I/O...
|
||||
*/
|
||||
|
||||
device_fd = open(resource, O_WRONLY | O_EXCL);
|
||||
use_bc = 0;
|
||||
|
||||
#else
|
||||
if ((device_fd = open(resource, O_RDWR | O_EXCL)) < 0)
|
||||
{
|
||||
device_fd = open(resource, O_WRONLY | O_EXCL);
|
||||
use_bc = 0;
|
||||
}
|
||||
else
|
||||
use_bc = 1;
|
||||
#endif /* __linux */
|
||||
|
||||
if (device_fd == -1)
|
||||
if ((device_fd = open(resource, O_WRONLY | O_EXCL)) == -1)
|
||||
{
|
||||
if (getenv("CLASS") != NULL)
|
||||
{
|
||||
@@ -284,7 +264,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
lseek(print_fd, 0, SEEK_SET);
|
||||
}
|
||||
|
||||
tbytes = backendRunLoop(print_fd, device_fd, use_bc);
|
||||
tbytes = backendRunLoop(print_fd, device_fd, 1);
|
||||
|
||||
if (print_fd != 0 && tbytes >= 0)
|
||||
fprintf(stderr, "INFO: Sent print file, " CUPS_LLFMT " bytes...\n",
|
||||
|
||||
@@ -80,7 +80,7 @@ void list_devices(void);
|
||||
int print_device(const char *resource, int fd, int copies);
|
||||
|
||||
|
||||
#if defined(__linux__) && defined(HAVE_SCSI_SG_H)
|
||||
#ifdef __linux__
|
||||
# include "scsi-linux.c"
|
||||
#elif defined(__sgi)
|
||||
# include "scsi-irix.c"
|
||||
@@ -90,7 +90,7 @@ int print_device(const char *resource, int fd, int copies);
|
||||
*/
|
||||
void list_devices(void) {}
|
||||
int print_device(const char *resource, int fd, int copies) { return (CUPS_BACKEND_FAILED); }
|
||||
#endif /* __linux && HAVE_SCSI_SG_H */
|
||||
#endif /* __linux */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -778,14 +778,6 @@ list_devices(void)
|
||||
printf("serial serial:%s?baud=230400 \"Unknown\" \"USB Serial Port #%d\"\n",
|
||||
device, i + 1);
|
||||
}
|
||||
|
||||
sprintf(device, "/dev/ttyUSB%d", i);
|
||||
if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
|
||||
{
|
||||
close(fd);
|
||||
printf("serial serial:%s?baud=230400 \"Unknown\" \"USB Serial Port #%d\"\n",
|
||||
device, i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 64; i ++)
|
||||
|
||||
@@ -1126,7 +1126,7 @@ asn1_set_packed(unsigned char **buffer, /* IO - Pointer in buffer */
|
||||
{
|
||||
if (integer > 0xfffffff)
|
||||
{
|
||||
**buffer = (integer >> 28) & 0x7f;
|
||||
**buffer = (integer >> 14) & 0x7f;
|
||||
(*buffer) ++;
|
||||
}
|
||||
|
||||
@@ -1728,14 +1728,13 @@ probe_device(snmp_cache_t *device) /* I - Device */
|
||||
debug_printf("DEBUG: %.3f Probing %s...\n", run_time(), device->addrname);
|
||||
|
||||
if (device->make_and_model &&
|
||||
(!strncasecmp(device->make_and_model, "Epson", 5) ||
|
||||
!strncasecmp(device->make_and_model, "Kyocera", 7) ||
|
||||
(!strncasecmp(device->make_and_model, "Kyocera", 7) ||
|
||||
!strncasecmp(device->make_and_model, "Lexmark", 7) ||
|
||||
!strncasecmp(device->make_and_model, "Tektronix", 9) ||
|
||||
!strncasecmp(device->make_and_model, "Xerox", 5)))
|
||||
{
|
||||
/*
|
||||
* Epson, Kyocera, Lexmark, Tektronix, and Xerox printers often lock up on
|
||||
* Kyocera, Lexmark, Tektronix, and Xerox printers often lock up on
|
||||
* IPP probes, so exclude them from the IPP connection test...
|
||||
*/
|
||||
|
||||
@@ -1752,7 +1751,7 @@ probe_device(snmp_cache_t *device) /* I - Device */
|
||||
alarm(0);
|
||||
}
|
||||
|
||||
if (http)
|
||||
if (http);
|
||||
{
|
||||
/*
|
||||
* IPP is supported...
|
||||
|
||||
@@ -78,9 +78,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
int delay; /* Delay for retries... */
|
||||
int device_fd; /* AppSocket */
|
||||
int error; /* Error code (if any) */
|
||||
http_addrlist_t *addrlist, /* Address list */
|
||||
*addr; /* Connected address */
|
||||
char addrname[256]; /* Address name */
|
||||
http_addrlist_t *addrlist; /* Address list */
|
||||
ssize_t tbytes; /* Total number of bytes written */
|
||||
struct timeval timeout; /* Timeout for select() */
|
||||
fd_set input; /* Input set for select() */
|
||||
@@ -247,7 +245,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
|
||||
for (delay = 5;;)
|
||||
{
|
||||
if ((addr = httpAddrConnect(addrlist, &device_fd)) == NULL)
|
||||
if (!httpAddrConnect(addrlist, &device_fd))
|
||||
{
|
||||
error = errno;
|
||||
device_fd = -1;
|
||||
@@ -295,19 +293,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
|
||||
}
|
||||
|
||||
fputs("STATE: -connecting-to-device\n", stderr);
|
||||
fprintf(stderr, "INFO: Connected to %s...\n", hostname);
|
||||
|
||||
#ifdef AF_INET6
|
||||
if (addr->addr.addr.sa_family == AF_INET6)
|
||||
fprintf(stderr, "DEBUG: Connected to [%s]:%d (IPv6)...\n",
|
||||
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
|
||||
ntohs(addr->addr.ipv6.sin6_port));
|
||||
else
|
||||
#endif /* AF_INET6 */
|
||||
if (addr->addr.addr.sa_family == AF_INET)
|
||||
fprintf(stderr, "DEBUG: Connected to %s:%d (IPv4)...\n",
|
||||
httpAddrString(&addr->addr, addrname, sizeof(addrname)),
|
||||
ntohs(addr->addr.ipv4.sin_port));
|
||||
|
||||
/*
|
||||
* Print everything...
|
||||
|
||||
@@ -198,13 +198,12 @@ static void copy_deviceinfo(CFStringRef deviceIDString, CFStringRef *make, CFStr
|
||||
static void release_deviceinfo(CFStringRef *make, CFStringRef *model, CFStringRef *serial);
|
||||
static kern_return_t load_classdriver(CFStringRef driverPath, printer_interface_t intf, classdriver_context_t ***driver);
|
||||
static kern_return_t unload_classdriver(classdriver_context_t ***classDriver);
|
||||
static kern_return_t load_printerdriver(printer_data_t *printer, CFStringRef *driverBundlePath);
|
||||
static kern_return_t registry_open(printer_data_t *printer, CFStringRef *driverBundlePath);
|
||||
static kern_return_t load_printerdriver(printer_data_t *printer);
|
||||
static kern_return_t registry_open(printer_data_t *printer);
|
||||
static kern_return_t registry_close(printer_data_t *printer);
|
||||
static OSStatus copy_deviceid(classdriver_context_t **printer, CFStringRef *deviceID);
|
||||
static void copy_devicestring(io_service_t usbInterface, CFStringRef *deviceID, UInt32 *deviceLocation);
|
||||
static CFStringRef copy_value_for_key(CFStringRef deviceID, CFStringRef *keys);
|
||||
static CFStringRef cfstr_create_and_trim(const char *cstr);
|
||||
static void parse_options(const char *options, char *serial, UInt32 *location, Boolean *waitEOF);
|
||||
static void setup_cfLanguage(void);
|
||||
static void *read_thread(void *reference);
|
||||
@@ -256,7 +255,6 @@ print_device(const char *uri, /* I - Device URI */
|
||||
int countdown = INITIAL_LOG_INTERVAL; /* Logging interval */
|
||||
pthread_cond_t *readCompleteConditionPtr = NULL; /* Read complete condition */
|
||||
pthread_mutex_t *readMutexPtr = NULL; /* Read mutex */
|
||||
CFStringRef driverBundlePath; /* Class driver path */
|
||||
|
||||
setup_cfLanguage();
|
||||
parse_options(options, serial, &printer_data.location, &printer_data.waitEOF);
|
||||
@@ -265,10 +263,9 @@ print_device(const char *uri, /* I - Device URI */
|
||||
resource++;
|
||||
|
||||
printer_data.uri = uri;
|
||||
|
||||
printer_data.make = cfstr_create_and_trim(hostname);
|
||||
printer_data.model = cfstr_create_and_trim(resource);
|
||||
printer_data.serial = cfstr_create_and_trim(serial);
|
||||
printer_data.make = CFStringCreateWithCString(NULL, hostname, kCFStringEncodingUTF8);
|
||||
printer_data.model = CFStringCreateWithCString(NULL, resource, kCFStringEncodingUTF8);
|
||||
printer_data.serial = CFStringCreateWithCString(NULL, serial, kCFStringEncodingUTF8);
|
||||
|
||||
fputs("STATE: +connecting-to-device\n", stderr);
|
||||
|
||||
@@ -284,9 +281,7 @@ print_device(const char *uri, /* I - Device URI */
|
||||
iterate_printers(find_device_callback, &printer_data);
|
||||
|
||||
fprintf(stderr, "INFO: Opening Connection\n");
|
||||
|
||||
driverBundlePath = NULL;
|
||||
status = registry_open(&printer_data, &driverBundlePath);
|
||||
status = registry_open(&printer_data);
|
||||
#if defined(__i386__)
|
||||
/*
|
||||
* If we were unable to load the class drivers for this printer it's probably because they're ppc-only.
|
||||
@@ -297,26 +292,6 @@ print_device(const char *uri, /* I - Device URI */
|
||||
/* Never returns here */
|
||||
}
|
||||
#endif /* __i386__ */
|
||||
if (status == -2) {
|
||||
/*
|
||||
* If we still were unable to load the class drivers for this printer log
|
||||
* the error and stop the queue...
|
||||
*/
|
||||
|
||||
if (driverBundlePath == NULL || !CFStringGetCString(driverBundlePath, buffer, sizeof(buffer), kCFStringEncodingUTF8))
|
||||
strlcpy(buffer, "USB class driver", sizeof(buffer));
|
||||
|
||||
fprintf(stderr, "STATE: +apple-missing-usbclassdriver-error\n" \
|
||||
"FATAL: Could not load %s\n", buffer);
|
||||
|
||||
if (driverBundlePath)
|
||||
CFRelease(driverBundlePath);
|
||||
|
||||
return CUPS_BACKEND_STOP;
|
||||
}
|
||||
|
||||
if (driverBundlePath)
|
||||
CFRelease(driverBundlePath);
|
||||
|
||||
if (status != noErr) {
|
||||
sleep( PRINTER_POLLING_INTERVAL );
|
||||
@@ -533,7 +508,7 @@ static Boolean find_device_callback(void *refcon, io_service_t obj)
|
||||
if (CFStringCompare(make, userData->make, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
||||
if (CFStringCompare(model, userData->model, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
||||
if (userData->serial != NULL) {
|
||||
if (serial != NULL && CFStringCompare(serial, userData->serial, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
||||
if (serial != NULL && CFStringCompare(model, userData->model, kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
|
||||
IOObjectRetain(obj);
|
||||
userData->printerObj = obj;
|
||||
keepLooking = false;
|
||||
@@ -753,11 +728,9 @@ static kern_return_t unload_classdriver(classdriver_context_t ***classDriver)
|
||||
|
||||
/*
|
||||
* 'load_printerdriver()' - Load a vendor's (or generic) classdriver.
|
||||
*
|
||||
* If driverBundlePath is not NULL on return it is the callers responsbility to release it!
|
||||
*/
|
||||
|
||||
static kern_return_t load_printerdriver(printer_data_t *printer, CFStringRef *driverBundlePath)
|
||||
static kern_return_t load_printerdriver(printer_data_t *printer)
|
||||
{
|
||||
IOCFPlugInInterface **iodev = NULL;
|
||||
SInt32 score;
|
||||
@@ -771,10 +744,11 @@ static kern_return_t load_printerdriver(printer_data_t *printer, CFStringRef *dr
|
||||
|
||||
kr = IORegistryEntryCreateCFProperties(printer->printerObj, &properties, NULL, kNilOptions);
|
||||
if (kr == kIOReturnSuccess) {
|
||||
CFStringRef driverBundlePath = NULL;
|
||||
if (properties != NULL) {
|
||||
*driverBundlePath = (CFStringRef) CFDictionaryGetValue(properties, kUSBClassDriverProperty);
|
||||
driverBundlePath = (CFStringRef) CFDictionaryGetValue(properties, kUSBClassDriverProperty);
|
||||
}
|
||||
kr = load_classdriver(*driverBundlePath, intf, &printer->printerDriver);
|
||||
kr = load_classdriver(driverBundlePath, intf, &printer->printerDriver);
|
||||
}
|
||||
|
||||
if (kr != kIOReturnSuccess)
|
||||
@@ -790,9 +764,9 @@ static kern_return_t load_printerdriver(printer_data_t *printer, CFStringRef *dr
|
||||
* 'registry_open()' - Open a connection to the printer.
|
||||
*/
|
||||
|
||||
static kern_return_t registry_open(printer_data_t *printer, CFStringRef *driverBundlePath)
|
||||
static kern_return_t registry_open(printer_data_t *printer)
|
||||
{
|
||||
kern_return_t kr = load_printerdriver(printer, driverBundlePath);
|
||||
kern_return_t kr = load_printerdriver(printer);
|
||||
if (kr != kIOReturnSuccess) {
|
||||
kr = -2;
|
||||
}
|
||||
@@ -1001,27 +975,6 @@ static CFStringRef copy_value_for_key(CFStringRef deviceID, CFStringRef *keys)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cfstr_create_and_trim()' - Create a CFString from a c-string and
|
||||
* trim it's whitespace characters.
|
||||
*/
|
||||
|
||||
CFStringRef cfstr_create_and_trim(const char *cstr)
|
||||
{
|
||||
CFStringRef cfstr;
|
||||
CFMutableStringRef cfmutablestr = NULL;
|
||||
|
||||
if ((cfstr = CFStringCreateWithCString(NULL, cstr, kCFStringEncodingUTF8)) != NULL)
|
||||
{
|
||||
if ((cfmutablestr = CFStringCreateMutableCopy(NULL, 1024, cfstr)) != NULL)
|
||||
CFStringTrimWhitespace(cfmutablestr);
|
||||
|
||||
CFRelease(cfstr);
|
||||
}
|
||||
return (CFStringRef) cfmutablestr;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
/*
|
||||
* 'parse_options()' - Parse uri options.
|
||||
@@ -1391,6 +1344,7 @@ static void *read_thread(void *reference)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
@@ -79,12 +79,12 @@ print_device(const char *uri, /* I - Device URI */
|
||||
do
|
||||
{
|
||||
/*
|
||||
* Disable backchannel data when printing to Canon or Minolta USB
|
||||
* printers - apparently these printers will return the IEEE-1284
|
||||
* device ID over and over and over when they get a read request...
|
||||
* Disable backchannel data when printing to Canon USB printers - apparently
|
||||
* Canon printers will return the IEEE-1284 device ID over and over and over
|
||||
* when they get a read request...
|
||||
*/
|
||||
|
||||
use_bc = strcasecmp(hostname, "Canon") && !strstr(hostname, "Minolta");
|
||||
use_bc = strcasecmp(hostname, "Canon") != 0;
|
||||
|
||||
if ((device_fd = open_device(uri, &use_bc)) == -1)
|
||||
{
|
||||
@@ -185,52 +185,44 @@ void
|
||||
list_devices(void)
|
||||
{
|
||||
#ifdef __linux
|
||||
int i; /* Looping var */
|
||||
int fd; /* File descriptor */
|
||||
char device[255], /* Device filename */
|
||||
device_id[1024], /* Device ID string */
|
||||
device_uri[1024], /* Device URI string */
|
||||
make_model[1024]; /* Make and model */
|
||||
int i; /* Looping var */
|
||||
int fd; /* File descriptor */
|
||||
char format[255], /* Format for device filename */
|
||||
device[255], /* Device filename */
|
||||
device_id[1024], /* Device ID string */
|
||||
device_uri[1024], /* Device URI string */
|
||||
make_model[1024]; /* Make and model */
|
||||
|
||||
|
||||
/*
|
||||
* Try to open each USB device...
|
||||
* First figure out which USB printer filename to use...
|
||||
*/
|
||||
|
||||
if (!access("/dev/usblp0", 0))
|
||||
strcpy(format, "/dev/usblp%d");
|
||||
else if (!access("/dev/usb/usblp0", 0))
|
||||
strcpy(format, "/dev/usb/usblp%d");
|
||||
else
|
||||
strcpy(format, "/dev/usb/lp%d");
|
||||
|
||||
/*
|
||||
* Then open each USB device...
|
||||
*/
|
||||
|
||||
for (i = 0; i < 16; i ++)
|
||||
{
|
||||
/*
|
||||
* Linux has a long history of changing the standard filenames used
|
||||
* for USB printer devices. We get the honor of trying them all...
|
||||
*/
|
||||
sprintf(device, format, i);
|
||||
|
||||
sprintf(device, "/dev/usblp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
continue;
|
||||
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
"usb", device_uri, sizeof(device_uri)))
|
||||
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
|
||||
make_model, make_model, i + 1, device_id);
|
||||
|
||||
sprintf(device, "/dev/usb/lp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
continue;
|
||||
|
||||
sprintf(device, "/dev/usb/usblp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
|
||||
continue;
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
|
||||
if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
"usb", device_uri, sizeof(device_uri)))
|
||||
printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
|
||||
make_model, make_model, i + 1, device_id);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
#elif defined(__sgi)
|
||||
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
|
||||
@@ -317,41 +309,35 @@ open_device(const char *uri, /* I - Device URI */
|
||||
|
||||
int i; /* Looping var */
|
||||
int busy; /* Are any ports busy? */
|
||||
char device[255], /* Device filename */
|
||||
char format[255], /* Format for device filename */
|
||||
device[255], /* Device filename */
|
||||
device_id[1024], /* Device ID string */
|
||||
make_model[1024], /* Make and model */
|
||||
device_uri[1024]; /* Device URI string */
|
||||
|
||||
|
||||
/*
|
||||
* Find the correct USB device...
|
||||
* First figure out which USB printer filename to use...
|
||||
*/
|
||||
|
||||
if (!access("/dev/usblp0", 0))
|
||||
strcpy(format, "/dev/usblp%d");
|
||||
else if (!access("/dev/usb/usblp0", 0))
|
||||
strcpy(format, "/dev/usb/usblp%d");
|
||||
else
|
||||
strcpy(format, "/dev/usb/lp%d");
|
||||
|
||||
/*
|
||||
* Then find the correct USB device...
|
||||
*/
|
||||
|
||||
do
|
||||
{
|
||||
for (busy = 0, i = 0; i < 16; i ++)
|
||||
{
|
||||
/*
|
||||
* Linux has a long history of changing the standard filenames used
|
||||
* for USB printer devices. We get the honor of trying them all...
|
||||
*/
|
||||
sprintf(device, format, i);
|
||||
|
||||
sprintf(device, "/dev/usblp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
|
||||
{
|
||||
sprintf(device, "/dev/usb/lp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
|
||||
{
|
||||
sprintf(device, "/dev/usb/usblp%d", i);
|
||||
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (fd >= 0)
|
||||
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
|
||||
{
|
||||
backendGetDeviceID(fd, device_id, sizeof(device_id),
|
||||
make_model, sizeof(make_model),
|
||||
|
||||
@@ -237,8 +237,10 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
const char *dests) /* I - Destinations */
|
||||
{
|
||||
ipp_t *request, /* IPP Request */
|
||||
*response; /* IPP Response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
*response, /* IPP Response */
|
||||
*jobs; /* IPP Get Jobs response */
|
||||
ipp_attribute_t *attr, /* Current attribute */
|
||||
*jattr; /* Current job attribute */
|
||||
cups_lang_t *language; /* Default language */
|
||||
char *printer, /* Printer name */
|
||||
*device, /* Device URI */
|
||||
@@ -249,13 +251,14 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
const char *dptr, /* Pointer into destination list */
|
||||
*ptr; /* Pointer into printer name */
|
||||
int match; /* Non-zero if this job matches */
|
||||
char printer_uri[HTTP_MAX_URI];
|
||||
/* Printer URI */
|
||||
static const char *requested[] = /* Requested attributes */
|
||||
{
|
||||
"device-uri",
|
||||
"printer-is-accepting-jobs",
|
||||
"printer-name",
|
||||
"device-uri",
|
||||
"printer-state",
|
||||
"queued-job-count"
|
||||
"printer-is-accepting-jobs"
|
||||
};
|
||||
|
||||
|
||||
@@ -326,21 +329,21 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
|
||||
{
|
||||
if (!strcmp(attr->name, "printer-name") &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
printer = attr->values[0].string.text;
|
||||
|
||||
if (!strcmp(attr->name, "device-uri") &&
|
||||
attr->value_tag == IPP_TAG_URI)
|
||||
device = attr->values[0].string.text;
|
||||
else if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
|
||||
attr->value_tag == IPP_TAG_BOOLEAN)
|
||||
accepting = attr->values[0].boolean;
|
||||
else if (!strcmp(attr->name, "printer-name") &&
|
||||
attr->value_tag == IPP_TAG_NAME)
|
||||
printer = attr->values[0].string.text;
|
||||
else if (!strcmp(attr->name, "printer-state") &&
|
||||
attr->value_tag == IPP_TAG_ENUM)
|
||||
|
||||
if (!strcmp(attr->name, "printer-state") &&
|
||||
attr->value_tag == IPP_TAG_ENUM)
|
||||
pstate = (ipp_pstate_t)attr->values[0].integer;
|
||||
else if (!strcmp(attr->name, "queued-job-count") &&
|
||||
attr->value_tag == IPP_TAG_INTEGER)
|
||||
jobcount = attr->values[0].integer;
|
||||
|
||||
if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
|
||||
attr->value_tag == IPP_TAG_BOOLEAN)
|
||||
accepting = attr->values[0].boolean;
|
||||
|
||||
attr = attr->next;
|
||||
}
|
||||
@@ -392,8 +395,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
|
||||
ptr ++, dptr ++);
|
||||
|
||||
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' ||
|
||||
isspace(*dptr & 255)))
|
||||
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' || isspace(*dptr & 255)))
|
||||
{
|
||||
match = 1;
|
||||
break;
|
||||
@@ -419,6 +421,53 @@ show_status(http_t *http, /* I - HTTP connection to server */
|
||||
|
||||
if (match)
|
||||
{
|
||||
/*
|
||||
* Build an IPP_GET_JOBS request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
* limit
|
||||
*/
|
||||
|
||||
request = ippNew();
|
||||
|
||||
request->request.op.operation_id = IPP_GET_JOBS;
|
||||
request->request.op.request_id = 1;
|
||||
|
||||
language = cupsLangDefault();
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
|
||||
"attributes-charset", NULL,
|
||||
cupsLangEncoding(language));
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
|
||||
"attributes-natural-language", NULL,
|
||||
language->language);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri),
|
||||
"ipp", NULL, "localhost", 631, "/printers/%s",
|
||||
printer);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
|
||||
"printer-uri", NULL, printer_uri);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
|
||||
"requested-attributes", NULL, "job-id");
|
||||
|
||||
if ((jobs = cupsDoRequest(http, request, "/")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Grab the number of jobs for the printer.
|
||||
*/
|
||||
|
||||
for (jattr = jobs->attrs; jattr != NULL; jattr = jattr->next)
|
||||
if (jattr->name && !strcmp(jattr->name, "job-id"))
|
||||
jobcount ++;
|
||||
|
||||
ippDelete(jobs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Display it...
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: mime.types 6003 2006-10-02 16:26:04Z mike $"
|
||||
# "$Id: mime.types 5402 2006-04-14 19:21:03Z mike $"
|
||||
#
|
||||
# MIME types file for the Common UNIX Printing System (CUPS).
|
||||
#
|
||||
@@ -154,8 +154,8 @@ application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR")
|
||||
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
|
||||
string(0,<1B>@) \
|
||||
(contains(0,128,<1B>%-12345X) + \
|
||||
(contains(0,4096,"LANGUAGE=PCL") \
|
||||
contains(0,4096,"LANGUAGE = PCL")))
|
||||
(contains(0,1024,"LANGUAGE=PCL") \
|
||||
contains(0,1024,"LANGUAGE = PCL")))
|
||||
|
||||
########################################################################
|
||||
#
|
||||
@@ -167,5 +167,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
|
||||
application/octet-stream
|
||||
|
||||
#
|
||||
# End of "$Id: mime.types 6003 2006-10-02 16:26:04Z mike $".
|
||||
# End of "$Id: mime.types 5402 2006-04-14 19:21:03Z mike $".
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-common.m4 6092 2006-11-14 16:36:36Z mike $"
|
||||
dnl "$Id: cups-common.m4 5930 2006-09-07 19:49:34Z mike $"
|
||||
dnl
|
||||
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -28,9 +28,12 @@ AC_PREREQ(2.50)
|
||||
dnl Set the name of the config header file...
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl Version number information...
|
||||
CUPS_VERSION="1.2.7"
|
||||
dnl Versio number information...
|
||||
CUPS_VERSION="1.2.4"
|
||||
CUPS_REVISION=""
|
||||
if test -z "$CUPS_REVISION" -a -d .svn; then
|
||||
CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
|
||||
fi
|
||||
|
||||
AC_SUBST(CUPS_VERSION)
|
||||
AC_SUBST(CUPS_REVISION)
|
||||
@@ -129,7 +132,6 @@ AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
|
||||
AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
|
||||
AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
|
||||
AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
|
||||
AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
|
||||
|
||||
dnl Checks for string functions.
|
||||
AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)
|
||||
@@ -229,13 +231,12 @@ case $uname in
|
||||
AC_MSG_CHECKING(for DBUS)
|
||||
if $PKGCONFIG --exists dbus-1; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_DBUS)
|
||||
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
|
||||
CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
|
||||
DBUSDIR="/etc/dbus-1/system.d"
|
||||
AC_CHECK_LIB(dbus-1,
|
||||
dbus_message_iter_init_append,
|
||||
AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
|
||||
AC_DEFINE(HAVE_DBUS)
|
||||
CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1` -DDBUS_API_SUBJECT_TO_CHANGE"
|
||||
CUPSDLIBS="`$PKGCONFIG --libs dbus-1`"
|
||||
DBUSDIR="/etc/dbus-1/system.d")
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
@@ -264,5 +265,5 @@ AC_SUBST(DEFAULT_IPP_PORT)
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-common.m4 6092 2006-11-14 16:36:36Z mike $".
|
||||
dnl End of "$Id: cups-common.m4 5930 2006-09-07 19:49:34Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-compiler.m4 6049 2006-10-20 15:07:21Z mike $"
|
||||
dnl "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z mike $"
|
||||
dnl
|
||||
dnl Compiler stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -93,7 +93,6 @@ PIEFLAGS=""
|
||||
AC_SUBST(PIEFLAGS)
|
||||
|
||||
if test -n "$GCC"; then
|
||||
# Add GCC-specific compiler options...
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
# Default to optimize-for-size and debug
|
||||
@@ -274,7 +273,6 @@ if test -n "$GCC"; then
|
||||
;;
|
||||
esac
|
||||
else
|
||||
# Add vendor-specific compiler options...
|
||||
case $uname in
|
||||
AIX*)
|
||||
if test -z "$OPTIM"; then
|
||||
@@ -360,16 +358,6 @@ else
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
OSF*)
|
||||
# Tru64 UNIX aka Digital UNIX aka OSF/1
|
||||
if test -z "$OPTIM"; then
|
||||
if test "x$with_optim" = x; then
|
||||
OPTIM="-O"
|
||||
else
|
||||
OPTIM="$with_optim"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
SunOS*)
|
||||
# Solaris
|
||||
if test -z "$OPTIM"; then
|
||||
@@ -461,25 +449,16 @@ else
|
||||
esac
|
||||
fi
|
||||
|
||||
# Add general compiler options per platform...
|
||||
case $uname in
|
||||
HP-UX*)
|
||||
# HP-UX 10.20 (at least) needs this definition to get the
|
||||
# h_errno global...
|
||||
OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
|
||||
if test $uname = HP-UX; then
|
||||
# HP-UX 10.20 (at least) needs this definition to get the
|
||||
# h_errno global...
|
||||
OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
|
||||
|
||||
# HP-UX 11.00 (at least) needs this definition to get the
|
||||
# u_short type used by the IP headers...
|
||||
OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
|
||||
;;
|
||||
|
||||
OSF*)
|
||||
# Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
|
||||
# to be POSIX-compliant...
|
||||
OPTIM="$OPTIM -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE"
|
||||
;;
|
||||
esac
|
||||
# HP-UX 11.00 (at least) needs this definition to get the
|
||||
# u_short type used by the IP headers...
|
||||
OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-compiler.m4 6049 2006-10-20 15:07:21Z mike $".
|
||||
dnl End of "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-defaults.m4 6118 2006-11-16 13:34:44Z mike $"
|
||||
dnl "$Id: cups-defaults.m4 5980 2006-09-21 19:01:55Z mike $"
|
||||
dnl
|
||||
dnl Default cupsd configuration settings for the Common UNIX Printing System
|
||||
dnl (CUPS).
|
||||
@@ -28,7 +28,7 @@ AC_ARG_WITH(languages, [ --with-languages set installed languages, defau
|
||||
if test "x$withval" != xno; then
|
||||
LANGUAGES="$withval"
|
||||
fi,
|
||||
LANGUAGES="de es et it ja pl sv")
|
||||
LANGUAGES="de es ja pl sv")
|
||||
AC_SUBST(LANGUAGES)
|
||||
|
||||
dnl Default ConfigFilePerm
|
||||
@@ -252,5 +252,5 @@ fi
|
||||
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP")
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-defaults.m4 6118 2006-11-16 13:34:44Z mike $".
|
||||
dnl End of "$Id: cups-defaults.m4 5980 2006-09-21 19:01:55Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-network.m4 6049 2006-10-20 15:07:21Z mike $"
|
||||
dnl "$Id: cups-network.m4 5634 2006-06-06 17:48:27Z mike $"
|
||||
dnl
|
||||
dnl Networking stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -24,17 +24,12 @@ dnl
|
||||
|
||||
AC_SEARCH_LIBS(socket, socket)
|
||||
AC_SEARCH_LIBS(gethostbyaddr, nsl)
|
||||
AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO))
|
||||
AC_SEARCH_LIBS(getifaddrs, nsl, AC_DEFINE(HAVE_GETIFADDRS))
|
||||
AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO))
|
||||
AC_SEARCH_LIBS(hstrerror, nsl socket resolv, AC_DEFINE(HAVE_HSTRERROR))
|
||||
AC_SEARCH_LIBS(rresvport_af, nsl, AC_DEFINE(HAVE_RRESVPORT_AF))
|
||||
|
||||
# Tru64 5.1b leaks file descriptors with these functions; disable until
|
||||
# we can come up with a test for this...
|
||||
if test "$uname" != "OSF1"; then
|
||||
AC_SEARCH_LIBS(getaddrinfo, nsl, AC_DEFINE(HAVE_GETADDRINFO))
|
||||
AC_SEARCH_LIBS(getnameinfo, nsl, AC_DEFINE(HAVE_GETNAMEINFO))
|
||||
fi
|
||||
|
||||
AC_CHECK_MEMBER(struct sockaddr.sa_len,,, [#include <sys/socket.h>])
|
||||
AC_CHECK_HEADER(sys/sockio.h, AC_DEFINE(HAVE_SYS_SOCKIO_H))
|
||||
|
||||
@@ -90,5 +85,5 @@ AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET)
|
||||
AC_SUBST(CUPS_LISTEN_DOMAINSOCKET)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-network.m4 6049 2006-10-20 15:07:21Z mike $".
|
||||
dnl End of "$Id: cups-network.m4 5634 2006-06-06 17:48:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
dnl
|
||||
dnl "$Id: cups-threads.m4 6061 2006-10-23 00:26:52Z mike $"
|
||||
dnl "$Id: cups-threads.m4 5466 2006-04-26 19:52:27Z mike $"
|
||||
dnl
|
||||
dnl Threading stuff for the Common UNIX Printing System (CUPS).
|
||||
dnl
|
||||
@@ -44,12 +44,6 @@ if test "x$enable_threads" != xno; then
|
||||
|
||||
if test $have_pthread = yes; then
|
||||
PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
|
||||
|
||||
# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
|
||||
# be POSIX-compliant... :(
|
||||
if test $uname = SunOS; then
|
||||
PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
@@ -59,5 +53,5 @@ fi
|
||||
AC_SUBST(PTHREAD_FLAGS)
|
||||
|
||||
dnl
|
||||
dnl End of "$Id: cups-threads.m4 6061 2006-10-23 00:26:52Z mike $".
|
||||
dnl End of "$Id: cups-threads.m4 5466 2006-04-26 19:52:27Z mike $".
|
||||
dnl
|
||||
|
||||
@@ -147,13 +147,6 @@
|
||||
#undef HAVE_CRYPT_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have <scsi/sg.h>?
|
||||
*/
|
||||
|
||||
#undef HAVE_SCSI_SG_H
|
||||
|
||||
|
||||
/*
|
||||
* Use <string.h>, <strings.h>, and/or <bstring.h>?
|
||||
*/
|
||||
@@ -420,13 +413,6 @@
|
||||
#undef HAVE_CFBUNDLEPRIV_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have CFLocaleCreateCanonicalLocaleIdentifierFromString()?
|
||||
*/
|
||||
|
||||
#undef HAVE_CF_LOCALE_ID
|
||||
|
||||
|
||||
/*
|
||||
* Do we have MacOSX 10.4's mbr_XXX functions()?
|
||||
*/
|
||||
@@ -448,7 +434,6 @@
|
||||
*/
|
||||
|
||||
#undef HAVE_DBUS
|
||||
#undef HAVE_DBUS_MESSAGE_ITER_INIT_APPEND
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -61,10 +61,10 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 1.0207
|
||||
# define CUPS_VERSION 1.0204
|
||||
# define CUPS_VERSION_MAJOR 1
|
||||
# define CUPS_VERSION_MINOR 2
|
||||
# define CUPS_VERSION_PATCH 7
|
||||
# define CUPS_VERSION_PATCH 4
|
||||
# define CUPS_DATE_ANY -1
|
||||
|
||||
|
||||
|
||||
@@ -64,31 +64,21 @@ static int cups_get_sdests(http_t *http, ipp_op_t op, int num_dests,
|
||||
/*
|
||||
* 'cupsAddDest()' - Add a destination to the list of destinations.
|
||||
*
|
||||
* This function cannot be used to add a new class or printer queue,
|
||||
* it only adds a new container of saved options for the named
|
||||
* destination or instance.
|
||||
*
|
||||
* If the named destination already exists, the destination list is
|
||||
* returned unchanged. Adding a new instance of a destination creates
|
||||
* a copy of that destination's options.
|
||||
*
|
||||
* Use the cupsSaveDests() function to save the updated list of
|
||||
* destinations to the user's lpoptions file.
|
||||
* Use the cupsSaveDests() function to save the updated list of destinations
|
||||
* to the user's lpoptions file.
|
||||
*/
|
||||
|
||||
int /* O - New number of destinations */
|
||||
cupsAddDest(const char *name, /* I - Destination name */
|
||||
const char *instance, /* I - Instance name or NULL for none/primary */
|
||||
cupsAddDest(const char *name, /* I - Name of destination */
|
||||
const char *instance, /* I - Instance of destination or NULL for none/primary */
|
||||
int num_dests, /* I - Number of destinations */
|
||||
cups_dest_t **dests) /* IO - Destinations */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
cups_dest_t *dest; /* Destination pointer */
|
||||
cups_dest_t *parent; /* Parent destination */
|
||||
cups_option_t *option; /* Current option */
|
||||
|
||||
|
||||
if (!name || !dests)
|
||||
if (name == NULL || dests == NULL)
|
||||
return (0);
|
||||
|
||||
if ((dest = cupsGetDest(name, instance, num_dests, *dests)) != NULL)
|
||||
@@ -108,53 +98,27 @@ cupsAddDest(const char *name, /* I - Destination name */
|
||||
|
||||
*dests = dest;
|
||||
|
||||
/*
|
||||
* Find where to insert the destination...
|
||||
*/
|
||||
|
||||
for (i = num_dests; i > 0; i --, dest ++)
|
||||
if (strcasecmp(name, dest->name) < 0)
|
||||
break;
|
||||
else if (!instance && dest->instance)
|
||||
break;
|
||||
else if (!strcasecmp(name, dest->name) &&
|
||||
instance && dest->instance &&
|
||||
instance != NULL && dest->instance != NULL &&
|
||||
strcasecmp(instance, dest->instance) < 0)
|
||||
break;
|
||||
|
||||
if (i > 0)
|
||||
memmove(dest + 1, dest, i * sizeof(cups_dest_t));
|
||||
|
||||
/*
|
||||
* Initialize the destination...
|
||||
*/
|
||||
|
||||
dest->name = strdup(name);
|
||||
dest->is_default = 0;
|
||||
dest->num_options = 0;
|
||||
dest->options = (cups_option_t *)0;
|
||||
|
||||
if (!instance)
|
||||
if (instance == NULL)
|
||||
dest->instance = NULL;
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Copy options from the primary instance...
|
||||
*/
|
||||
|
||||
dest->instance = strdup(instance);
|
||||
|
||||
if ((parent = cupsGetDest(name, NULL, num_dests + 1, *dests)) != NULL)
|
||||
{
|
||||
for (i = parent->num_options, option = parent->options;
|
||||
i > 0;
|
||||
i --, option ++)
|
||||
dest->num_options = cupsAddOption(option->name, option->value,
|
||||
dest->num_options,
|
||||
&(dest->options));
|
||||
}
|
||||
}
|
||||
|
||||
return (num_dests + 1);
|
||||
}
|
||||
|
||||
@@ -196,18 +160,18 @@ cupsFreeDests(int num_dests, /* I - Number of destinations */
|
||||
*/
|
||||
|
||||
cups_dest_t * /* O - Destination pointer or NULL */
|
||||
cupsGetDest(const char *name, /* I - Destination name or NULL for the default destination */
|
||||
const char *instance, /* I - Instance name or NULL */
|
||||
cupsGetDest(const char *name, /* I - Name of destination */
|
||||
const char *instance, /* I - Instance of destination */
|
||||
int num_dests, /* I - Number of destinations */
|
||||
cups_dest_t *dests) /* I - Destinations */
|
||||
{
|
||||
int comp; /* Result of comparison */
|
||||
|
||||
|
||||
if (num_dests <= 0 || !dests)
|
||||
if (num_dests == 0 || dests == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (!name)
|
||||
if (name == NULL)
|
||||
{
|
||||
/*
|
||||
* NULL name for default printer.
|
||||
@@ -234,9 +198,9 @@ cupsGetDest(const char *name, /* I - Destination name or NULL for the default
|
||||
return (NULL);
|
||||
else if (comp == 0)
|
||||
{
|
||||
if ((!instance && !dests->instance) ||
|
||||
if ((instance == NULL && dests->instance == NULL) ||
|
||||
(instance != NULL && dests->instance != NULL &&
|
||||
!strcasecmp(instance, dests->instance)))
|
||||
strcasecmp(instance, dests->instance) == 0))
|
||||
return (dests);
|
||||
}
|
||||
|
||||
@@ -256,9 +220,6 @@ cupsGetDest(const char *name, /* I - Destination name or NULL for the default
|
||||
* 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.
|
||||
*
|
||||
* Use the cupsFreeDests() function to free the destination list and
|
||||
* the cupsGetDest() function to find a particular destination.
|
||||
*/
|
||||
|
||||
int /* O - Number of destinations */
|
||||
@@ -291,9 +252,6 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
|
||||
* printer-make-and-model, printer-state, printer-state-change-time,
|
||||
* printer-state-reasons, and printer-type attributes as options.
|
||||
*
|
||||
* Use the cupsFreeDests() function to free the destination list and
|
||||
* the cupsGetDest() function to find a particular destination.
|
||||
*
|
||||
* @since CUPS 1.1.21@
|
||||
*/
|
||||
|
||||
|
||||
@@ -347,12 +347,10 @@ cupsDirOpen(const char *directory) /* I - Directory name */
|
||||
cups_dentry_t * /* O - Directory entry */
|
||||
cupsDirRead(cups_dir_t *dp) /* I - Directory */
|
||||
{
|
||||
struct dirent *entry; /* Pointer to entry */
|
||||
char filename[1024]; /* Full filename */
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
char buffer[sizeof(struct dirent) + 1024];
|
||||
/* Directory entry buffer */
|
||||
# endif /* HAVE_PTHREAD_H */
|
||||
struct dirent *entry; /* Pointer to entry */
|
||||
char filename[1024]; /* Full filename */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsDirRead(dp=%p)\n", dp));
|
||||
@@ -370,11 +368,6 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
/*
|
||||
* Read the next entry using the reentrant version of readdir...
|
||||
*/
|
||||
|
||||
if (readdir_r(dp->dir, (struct dirent *)buffer, &entry))
|
||||
{
|
||||
DEBUG_printf((" readdir_r() failed - %s\n", strerror(errno)));
|
||||
@@ -389,25 +382,6 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory */
|
||||
|
||||
DEBUG_printf((" readdir_r() returned \"%s\"...\n", entry->d_name));
|
||||
|
||||
# else
|
||||
/*
|
||||
* Read the next entry using the original version of readdir...
|
||||
*/
|
||||
|
||||
if ((entry = readdir(dp->dir)) == NULL)
|
||||
{
|
||||
DEBUG_puts(" readdir() returned a NULL pointer!");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
DEBUG_printf((" readdir() returned \"%s\"...\n", entry->d_name));
|
||||
|
||||
# endif /* HAVE_PTHREAD_H */
|
||||
|
||||
/*
|
||||
* Skip "." and ".."...
|
||||
*/
|
||||
|
||||
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ cupsFileFind(const char *filename, /* I - File to find */
|
||||
int /* O - 0 on success, -1 on error */
|
||||
cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
|
||||
{
|
||||
ssize_t bytes; /* Bytes to write */
|
||||
size_t bytes; /* Bytes to write */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileFlush(fp=%p)\n", fp));
|
||||
@@ -991,7 +991,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
|
||||
...) /* I - Additional args as necessary */
|
||||
{
|
||||
va_list ap; /* Argument list */
|
||||
ssize_t bytes; /* Formatted size */
|
||||
size_t bytes; /* Formatted size */
|
||||
char buf[8192]; /* Formatted text */
|
||||
|
||||
|
||||
@@ -1090,7 +1090,7 @@ int /* O - Number of bytes written or -1 */
|
||||
cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
|
||||
const char *s) /* I - String to write */
|
||||
{
|
||||
ssize_t bytes; /* Bytes to write */
|
||||
size_t bytes; /* Bytes to write */
|
||||
|
||||
|
||||
/*
|
||||
@@ -1149,8 +1149,8 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
|
||||
char *buf, /* O - Buffer */
|
||||
size_t bytes) /* I - Number of bytes to read */
|
||||
{
|
||||
size_t total; /* Total bytes read */
|
||||
ssize_t count; /* Bytes read */
|
||||
size_t total, /* Total bytes read */
|
||||
count; /* Bytes read */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileRead(fp=%p, buf=%p, bytes=%ld)\n", fp, buf,
|
||||
@@ -1274,7 +1274,7 @@ off_t /* O - New file position or -1 */
|
||||
cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
|
||||
off_t pos) /* I - Position in file */
|
||||
{
|
||||
ssize_t bytes; /* Number bytes in buffer */
|
||||
size_t bytes; /* Number bytes in buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFileSeek(fp=%p, pos=" CUPS_LLFMT ")\n", fp, pos));
|
||||
@@ -2030,8 +2030,8 @@ cups_write(cups_file_t *fp, /* I - CUPS file */
|
||||
const char *buf, /* I - Buffer */
|
||||
size_t bytes) /* I - Number bytes */
|
||||
{
|
||||
size_t total; /* Total bytes written */
|
||||
ssize_t count; /* Count this time */
|
||||
size_t total, /* Total bytes written */
|
||||
count; /* Count this time */
|
||||
|
||||
|
||||
DEBUG_printf(("cups_write(fp=%p, buf=%p, bytes=%ld)\n", fp, buf,
|
||||
|
||||
@@ -98,7 +98,11 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
/* language.c */
|
||||
cups_lang_t *lang_default; /* Default language */
|
||||
# ifdef __APPLE__
|
||||
# ifdef HAVE_CF_LOCALE_ID
|
||||
char language[32]; /* Cached language */
|
||||
# else
|
||||
const char *language; /* Cached language */
|
||||
# endif /* HAVE_CF_LOCALE_ID */
|
||||
# endif /* __APPLE__ */
|
||||
|
||||
/* ppd.c */
|
||||
|
||||
@@ -70,8 +70,7 @@ typedef int socklen_t;
|
||||
# if defined HAVE_LIBSSL
|
||||
/*
|
||||
* The OpenSSL library provides its own SSL/TLS context structure for its
|
||||
* IO and protocol management. However, we need to provide our own BIO
|
||||
* (basic IO) implementation to do timeouts...
|
||||
* IO and protocol management...
|
||||
*/
|
||||
|
||||
# include <openssl/err.h>
|
||||
@@ -80,8 +79,6 @@ typedef int socklen_t;
|
||||
|
||||
typedef SSL http_tls_t;
|
||||
|
||||
extern BIO_METHOD *_httpBIOMethods(void);
|
||||
|
||||
# elif defined HAVE_GNUTLS
|
||||
/*
|
||||
* The GNU TLS library is more of a "bare metal" SSL/TLS library...
|
||||
@@ -94,11 +91,6 @@ typedef struct
|
||||
void *credentials; /* GNU TLS credentials object */
|
||||
} http_tls_t;
|
||||
|
||||
extern ssize_t _httpReadGNUTLS(gnutls_transport_ptr ptr, void *data,
|
||||
size_t length);
|
||||
extern ssize_t _httpWriteGNUTLS(gnutls_transport_ptr ptr, const void *data,
|
||||
size_t length);
|
||||
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
/*
|
||||
* Darwin's Security framework provides its own SSL/TLS context structure
|
||||
@@ -113,6 +105,15 @@ typedef struct /**** CDSA connection information ****/
|
||||
CFArrayRef certsArray; /* Certificates array */
|
||||
} http_tls_t;
|
||||
|
||||
typedef union _cdsa_conn_ref_u /**** CDSA Connection reference union
|
||||
**** used to resolve 64-bit casting
|
||||
**** warnings.
|
||||
****/
|
||||
{
|
||||
SSLConnectionRef connection; /* SSL connection pointer */
|
||||
int sock; /* Socket */
|
||||
} cdsa_conn_ref_t;
|
||||
|
||||
extern OSStatus _httpReadCDSA(SSLConnectionRef connection, void *data,
|
||||
size_t *dataLength);
|
||||
extern OSStatus _httpWriteCDSA(SSLConnectionRef connection, const void *data,
|
||||
|
||||
@@ -595,14 +595,8 @@ httpEncode64_2(char *out, /* I - String to write to */
|
||||
|
||||
if (outptr < outend)
|
||||
*outptr ++ = base64[(in[0] & 255) >> 2];
|
||||
|
||||
if (outptr < outend)
|
||||
{
|
||||
if (inlen > 1)
|
||||
*outptr ++ = base64[(((in[0] & 255) << 4) | ((in[1] & 255) >> 4)) & 63];
|
||||
else
|
||||
*outptr ++ = base64[((in[0] & 255) << 4) & 63];
|
||||
}
|
||||
*outptr ++ = base64[(((in[0] & 255) << 4) | ((in[1] & 255) >> 4)) & 63];
|
||||
|
||||
in ++;
|
||||
inlen --;
|
||||
@@ -616,12 +610,7 @@ httpEncode64_2(char *out, /* I - String to write to */
|
||||
}
|
||||
|
||||
if (outptr < outend)
|
||||
{
|
||||
if (inlen > 1)
|
||||
*outptr ++ = base64[(((in[0] & 255) << 2) | ((in[1] & 255) >> 6)) & 63];
|
||||
else
|
||||
*outptr ++ = base64[((in[0] & 255) << 2) & 63];
|
||||
}
|
||||
*outptr ++ = base64[(((in[0] & 255) << 2) | ((in[1] & 255) >> 6)) & 63];
|
||||
|
||||
in ++;
|
||||
inlen --;
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _httpBIOMethods() - Get the OpenSSL BIO methods for HTTP connections.
|
||||
* httpBlocking() - Set blocking/non-blocking behavior on a connection.
|
||||
* httpCheck() - Check to see if there is a pending response from
|
||||
* the server.
|
||||
@@ -61,8 +60,7 @@
|
||||
* httpPut() - Send a PUT request to the server.
|
||||
* httpRead() - Read data from a HTTP connection.
|
||||
* httpRead2() - Read data from a HTTP connection.
|
||||
* _httpReadCDSA() - Read function for the CDSA library.
|
||||
* _httpReadGNUTLS() - Read function for the GNU TLS library.
|
||||
* _httpReadCDSA() - Read function for CDSA decryption code.
|
||||
* httpReconnect() - Reconnect to a HTTP server...
|
||||
* httpSetCookie() - Set the cookie value(s)...
|
||||
* httpSetExpect() - Set the Expect: header in a request.
|
||||
@@ -73,14 +71,7 @@
|
||||
* httpWait() - Wait for data available on a connection.
|
||||
* httpWrite() - Write data to a HTTP connection.
|
||||
* httpWrite2() - Write data to a HTTP connection.
|
||||
* _httpWriteCDSA() - Write function for the CDSA library.
|
||||
* _httpWriteGNUTLS() - Write function for the GNU TLS library.
|
||||
* http_bio_ctrl() - Control the HTTP connection.
|
||||
* http_bio_free() - Free OpenSSL data.
|
||||
* http_bio_new() - Initialize an OpenSSL BIO structure.
|
||||
* http_bio_puts() - Send a string for OpenSSL.
|
||||
* http_bio_read() - Read data for OpenSSL.
|
||||
* http_bio_write() - Write data for OpenSSL.
|
||||
* _httpWriteCDSA() - Write function for CDSA encryption code.
|
||||
* http_field() - Return the field index for a field name.
|
||||
* http_read_ssl() - Read from a SSL/TLS connection.
|
||||
* http_send() - Send a request with all fields and the trailing
|
||||
@@ -127,7 +118,7 @@
|
||||
static http_field_t http_field(const char *name);
|
||||
static int http_send(http_t *http, http_state_t request,
|
||||
const char *uri);
|
||||
static int http_wait(http_t *http, int msec, int usessl);
|
||||
static int http_wait(http_t *http, int msec);
|
||||
static int http_write(http_t *http, const char *buffer,
|
||||
int length);
|
||||
static int http_write_chunk(http_t *http, const char *buffer,
|
||||
@@ -177,45 +168,6 @@ static const char * const http_fields[] =
|
||||
};
|
||||
|
||||
|
||||
#if defined(HAVE_SSL) && defined(HAVE_LIBSSL)
|
||||
/*
|
||||
* BIO methods for OpenSSL...
|
||||
*/
|
||||
|
||||
static int http_bio_write(BIO *h, const char *buf, int num);
|
||||
static int http_bio_read(BIO *h, char *buf, int size);
|
||||
static int http_bio_puts(BIO *h, const char *str);
|
||||
static long http_bio_ctrl(BIO *h, int cmd, long arg1, void *arg2);
|
||||
static int http_bio_new(BIO *h);
|
||||
static int http_bio_free(BIO *data);
|
||||
|
||||
static BIO_METHOD http_bio_methods =
|
||||
{
|
||||
BIO_TYPE_SOCKET,
|
||||
"http",
|
||||
http_bio_write,
|
||||
http_bio_read,
|
||||
http_bio_puts,
|
||||
NULL, /* http_bio_gets, */
|
||||
http_bio_ctrl,
|
||||
http_bio_new,
|
||||
http_bio_free,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* '_httpBIOMethods()' - Get the OpenSSL BIO methods for HTTP connections.
|
||||
*/
|
||||
|
||||
BIO_METHOD * /* O - BIO methods for OpenSSL */
|
||||
_httpBIOMethods(void)
|
||||
{
|
||||
return (&http_bio_methods);
|
||||
}
|
||||
#endif /* HAVE_SSL && HAVE_LIBSSL */
|
||||
|
||||
|
||||
/*
|
||||
* 'httpBlocking()' - Set blocking/non-blocking behavior on a connection.
|
||||
*/
|
||||
@@ -917,7 +869,7 @@ httpGets(char *line, /* I - Line to read into */
|
||||
* No newline; see if there is more data to be read...
|
||||
*/
|
||||
|
||||
if (!http->blocking && !http_wait(http, 10000, 1))
|
||||
if (!http->blocking && !http_wait(http, 10000))
|
||||
{
|
||||
DEBUG_puts("httpGets: Timed out!");
|
||||
http->error = ETIMEDOUT;
|
||||
@@ -1439,7 +1391,7 @@ httpRead2(http_t *http, /* I - HTTP connection */
|
||||
|
||||
#if defined(HAVE_SSL) && defined(HAVE_CDSASSL)
|
||||
/*
|
||||
* '_httpReadCDSA()' - Read function for the CDSA library.
|
||||
* '_httpReadCDSA()' - Read function for CDSA decryption code.
|
||||
*/
|
||||
|
||||
OSStatus /* O - -1 on error, 0 on success */
|
||||
@@ -1448,36 +1400,19 @@ _httpReadCDSA(
|
||||
void *data, /* I - Data buffer */
|
||||
size_t *dataLength) /* IO - Number of bytes */
|
||||
{
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
http_t *http; /* HTTP connection */
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
cdsa_conn_ref_t u; /* Connection reference union */
|
||||
|
||||
|
||||
http = (http_t *)connection;
|
||||
|
||||
if (!http->blocking)
|
||||
{
|
||||
/*
|
||||
* Make sure we have data before we read...
|
||||
*/
|
||||
|
||||
if (!http_wait(http, 10000, 0))
|
||||
{
|
||||
http->error = ETIMEDOUT;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
u.connection = connection;
|
||||
|
||||
do
|
||||
{
|
||||
bytes = recv(http->fd, data, *dataLength, 0);
|
||||
}
|
||||
bytes = recv(u.sock, data, *dataLength, 0);
|
||||
while (bytes == -1 && errno == EINTR);
|
||||
|
||||
if (bytes == *dataLength)
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
else if (bytes > 0)
|
||||
{
|
||||
*dataLength = bytes;
|
||||
@@ -1495,45 +1430,11 @@ _httpReadCDSA(
|
||||
result = errSSLClosedAbort;
|
||||
}
|
||||
|
||||
return (result);
|
||||
return result;
|
||||
}
|
||||
#endif /* HAVE_SSL && HAVE_CDSASSL */
|
||||
|
||||
|
||||
#if defined(HAVE_SSL) && defined(HAVE_GNUTLS)
|
||||
/*
|
||||
* '_httpReadGNUTLS()' - Read function for the GNU TLS library.
|
||||
*/
|
||||
|
||||
ssize_t /* O - Number of bytes read or -1 on error */
|
||||
_httpReadGNUTLS(
|
||||
gnutls_transport_ptr ptr, /* I - HTTP connection */
|
||||
void *data, /* I - Buffer */
|
||||
size_t length) /* I - Number of bytes to read */
|
||||
{
|
||||
http_t *http; /* HTTP connection */
|
||||
|
||||
|
||||
http = (http_t *)ptr;
|
||||
|
||||
if (!http->blocking)
|
||||
{
|
||||
/*
|
||||
* Make sure we have data before we read...
|
||||
*/
|
||||
|
||||
if (!http_wait(http, 10000, 0))
|
||||
{
|
||||
http->error = ETIMEDOUT;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
return (recv(http->fd, data, length, 0));
|
||||
}
|
||||
#endif /* HAVE_SSL && HAVE_GNUTLS */
|
||||
|
||||
|
||||
/*
|
||||
* 'httpReconnect()' - Reconnect to a HTTP server.
|
||||
*/
|
||||
@@ -1929,7 +1830,7 @@ httpWait(http_t *http, /* I - HTTP connection */
|
||||
* If not, check the SSL/TLS buffers and do a select() on the connection...
|
||||
*/
|
||||
|
||||
return (http_wait(http, msec, 1));
|
||||
return (http_wait(http, msec));
|
||||
}
|
||||
|
||||
|
||||
@@ -2076,7 +1977,7 @@ httpWrite2(http_t *http, /* I - HTTP connection */
|
||||
|
||||
#if defined(HAVE_SSL) && defined(HAVE_CDSASSL)
|
||||
/*
|
||||
* '_httpWriteCDSA()' - Write function for the CDSA library.
|
||||
* '_httpWriteCDSA()' - Write function for CDSA encryption code.
|
||||
*/
|
||||
|
||||
OSStatus /* O - -1 on error, 0 on success */
|
||||
@@ -2085,23 +1986,19 @@ _httpWriteCDSA(
|
||||
const void *data, /* I - Data buffer */
|
||||
size_t *dataLength) /* IO - Number of bytes */
|
||||
{
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
http_t *http; /* HTTP connection */
|
||||
OSStatus result; /* Return value */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
cdsa_conn_ref_t u; /* Connection reference union */
|
||||
|
||||
|
||||
http = (http_t *)connection;
|
||||
u.connection = connection;
|
||||
|
||||
do
|
||||
{
|
||||
bytes = write(http->fd, data, *dataLength);
|
||||
}
|
||||
bytes = write(u.sock, data, *dataLength);
|
||||
while (bytes == -1 && errno == EINTR);
|
||||
|
||||
if (bytes == *dataLength)
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
else if (bytes >= 0)
|
||||
{
|
||||
*dataLength = bytes;
|
||||
@@ -2117,164 +2014,11 @@ _httpWriteCDSA(
|
||||
result = errSSLClosedAbort;
|
||||
}
|
||||
|
||||
return (result);
|
||||
return result;
|
||||
}
|
||||
#endif /* HAVE_SSL && HAVE_CDSASSL */
|
||||
|
||||
|
||||
#if defined(HAVE_SSL) && defined(HAVE_GNUTLS)
|
||||
/*
|
||||
* '_httpWriteGNUTLS()' - Write function for the GNU TLS library.
|
||||
*/
|
||||
|
||||
ssize_t /* O - Number of bytes written or -1 on error */
|
||||
_httpWriteGNUTLS(
|
||||
gnutls_transport_ptr ptr, /* I - HTTP connection */
|
||||
const void *data, /* I - Data buffer */
|
||||
size_t length) /* I - Number of bytes to write */
|
||||
{
|
||||
return (send(((http_t *)ptr)->fd, data, length, 0));
|
||||
}
|
||||
#endif /* HAVE_SSL && HAVE_GNUTLS */
|
||||
|
||||
|
||||
#if defined(HAVE_SSL) && defined(HAVE_LIBSSL)
|
||||
/*
|
||||
* 'http_bio_ctrl()' - Control the HTTP connection.
|
||||
*/
|
||||
|
||||
static long /* O - Result/data */
|
||||
http_bio_ctrl(BIO *h, /* I - BIO data */
|
||||
int cmd, /* I - Control command */
|
||||
long arg1, /* I - First argument */
|
||||
void *arg2) /* I - Second argument */
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
default :
|
||||
return (0);
|
||||
|
||||
case BIO_CTRL_RESET :
|
||||
h->ptr = NULL;
|
||||
return (0);
|
||||
|
||||
case BIO_C_SET_FILE_PTR :
|
||||
h->ptr = arg2;
|
||||
h->init = 1;
|
||||
return (1);
|
||||
|
||||
case BIO_C_GET_FILE_PTR :
|
||||
if (arg2)
|
||||
{
|
||||
*((void **)arg2) = h->ptr;
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
return (0);
|
||||
|
||||
case BIO_CTRL_DUP :
|
||||
case BIO_CTRL_FLUSH :
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'http_bio_free()' - Free OpenSSL data.
|
||||
*/
|
||||
|
||||
static int /* O - 1 on success, 0 on failure */
|
||||
http_bio_free(BIO *h) /* I - BIO data */
|
||||
{
|
||||
if (!h)
|
||||
return (0);
|
||||
|
||||
if (h->shutdown)
|
||||
{
|
||||
h->init = 0;
|
||||
h->flags = 0;
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'http_bio_new()' - Initialize an OpenSSL BIO structure.
|
||||
*/
|
||||
|
||||
static int /* O - 1 on success, 0 on failure */
|
||||
http_bio_new(BIO *h) /* I - BIO data */
|
||||
{
|
||||
if (!h)
|
||||
return (0);
|
||||
|
||||
h->init = 0;
|
||||
h->num = 0;
|
||||
h->ptr = NULL;
|
||||
h->flags = 0;
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'http_bio_puts()' - Send a string for OpenSSL.
|
||||
*/
|
||||
|
||||
static int /* O - Bytes written */
|
||||
http_bio_puts(BIO *h, /* I - BIO data */
|
||||
const char *str) /* I - String to write */
|
||||
{
|
||||
return (send(((http_t *)h->ptr)->fd, str, strlen(str), 0));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'http_bio_read()' - Read data for OpenSSL.
|
||||
*/
|
||||
|
||||
static int /* O - Bytes read */
|
||||
http_bio_read(BIO *h, /* I - BIO data */
|
||||
char *buf, /* I - Buffer */
|
||||
int size) /* I - Number of bytes to read */
|
||||
{
|
||||
http_t *http; /* HTTP connection */
|
||||
|
||||
|
||||
http = (http_t *)h->ptr;
|
||||
|
||||
if (!http->blocking)
|
||||
{
|
||||
/*
|
||||
* Make sure we have data before we read...
|
||||
*/
|
||||
|
||||
if (!http_wait(http, 10000, 0))
|
||||
{
|
||||
http->error = ETIMEDOUT;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
return (recv(http->fd, buf, size, 0));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'http_bio_write()' - Write data for OpenSSL.
|
||||
*/
|
||||
|
||||
static int /* O - Bytes written */
|
||||
http_bio_write(BIO *h, /* I - BIO data */
|
||||
const char *buf, /* I - Buffer to write */
|
||||
int num) /* I - Number of bytes to write */
|
||||
{
|
||||
return (send(((http_t *)h->ptr)->fd, buf, num, 0));
|
||||
}
|
||||
#endif /* HAVE_SSL && HAVE_LIBSSL */
|
||||
|
||||
|
||||
/*
|
||||
* 'http_field()' - Return the field index for a field name.
|
||||
*/
|
||||
@@ -2503,7 +2247,6 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
|
||||
# ifdef HAVE_LIBSSL
|
||||
SSL_CTX *context; /* Context for encryption */
|
||||
SSL *conn; /* Connection for encryption */
|
||||
BIO *bio; /* BIO data */
|
||||
# elif defined(HAVE_GNUTLS)
|
||||
http_tls_t *conn; /* TLS session object */
|
||||
gnutls_certificate_client_credentials *credentials;
|
||||
@@ -2511,6 +2254,7 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
OSStatus error; /* Error code */
|
||||
http_tls_t *conn; /* CDSA connection information */
|
||||
cdsa_conn_ref_t u; /* Connection reference union */
|
||||
# endif /* HAVE_LIBSSL */
|
||||
|
||||
|
||||
@@ -2521,12 +2265,9 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
|
||||
|
||||
SSL_CTX_set_options(context, SSL_OP_NO_SSLv2); /* Only use SSLv3 or TLS */
|
||||
|
||||
bio = BIO_new(_httpBIOMethods());
|
||||
BIO_ctrl(bio, BIO_C_SET_FILE_PTR, 0, (char *)http);
|
||||
|
||||
conn = SSL_new(context);
|
||||
SSL_set_bio(conn, bio, bio);
|
||||
|
||||
SSL_set_fd(conn, http->fd);
|
||||
if (SSL_connect(conn) != 1)
|
||||
{
|
||||
# ifdef DEBUG
|
||||
@@ -2575,9 +2316,8 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
|
||||
gnutls_init(&(conn->session), GNUTLS_CLIENT);
|
||||
gnutls_set_default_priority(conn->session);
|
||||
gnutls_credentials_set(conn->session, GNUTLS_CRD_CERTIFICATE, *credentials);
|
||||
gnutls_transport_set_ptr(conn->session, (gnutls_transport_ptr)http);
|
||||
gnutls_transport_set_pull_function(conn->session, _httpReadGNUTLS);
|
||||
gnutls_transport_set_push_function(conn->session, _httpWriteGNUTLS);
|
||||
gnutls_transport_set_ptr(conn->session,
|
||||
(gnutls_transport_ptr)((long)http->fd));
|
||||
|
||||
if ((gnutls_handshake(conn->session)) != GNUTLS_E_SUCCESS)
|
||||
{
|
||||
@@ -2608,7 +2348,9 @@ http_setup_ssl(http_t *http) /* I - HTTP connection */
|
||||
* Use a union to resolve warnings about int/pointer size mismatches...
|
||||
*/
|
||||
|
||||
error = SSLSetConnection(conn->session, http);
|
||||
u.connection = NULL;
|
||||
u.sock = http->fd;
|
||||
error = SSLSetConnection(conn->session, u.connection);
|
||||
|
||||
if (!error)
|
||||
error = SSLSetIOFuncs(conn->session, _httpReadCDSA, _httpWriteCDSA);
|
||||
@@ -2802,8 +2544,7 @@ http_upgrade(http_t *http) /* I - HTTP connection */
|
||||
|
||||
static int /* O - 1 if data is available, 0 otherwise */
|
||||
http_wait(http_t *http, /* I - HTTP connection */
|
||||
int msec, /* I - Milliseconds to wait */
|
||||
int usessl) /* I - Use SSL context? */
|
||||
int msec) /* I - Milliseconds to wait */
|
||||
{
|
||||
#ifndef WIN32
|
||||
struct rlimit limit; /* Runtime limit */
|
||||
@@ -2823,7 +2564,7 @@ http_wait(http_t *http, /* I - HTTP connection */
|
||||
*/
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
if (http->tls && usessl)
|
||||
if (http->tls)
|
||||
{
|
||||
# ifdef HAVE_LIBSSL
|
||||
if (SSL_pending((SSL *)(http->tls)))
|
||||
|
||||
@@ -995,7 +995,6 @@ appleLangDefault(void)
|
||||
/* List of localization data */
|
||||
CFStringRef languageName; /* Current name */
|
||||
CFStringRef localeName; /* Canonical from of name */
|
||||
char *lang; /* LANG environment variable */
|
||||
_cups_globals_t *cg = _cupsGlobals();
|
||||
/* Pointer to library globals */
|
||||
|
||||
@@ -1006,43 +1005,38 @@ appleLangDefault(void)
|
||||
|
||||
if (!cg->language[0])
|
||||
{
|
||||
if ((lang = getenv("LANG")))
|
||||
strlcpy(cg->language, lang, sizeof(cg->language));
|
||||
else
|
||||
localizationList =
|
||||
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
|
||||
kCFPreferencesCurrentApplication);
|
||||
|
||||
if (localizationList != NULL)
|
||||
{
|
||||
localizationList =
|
||||
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
|
||||
kCFPreferencesCurrentApplication);
|
||||
|
||||
if (localizationList != NULL)
|
||||
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
|
||||
CFArrayGetCount(localizationList) > 0)
|
||||
{
|
||||
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
|
||||
CFArrayGetCount(localizationList) > 0)
|
||||
{
|
||||
languageName = CFArrayGetValueAtIndex(localizationList, 0);
|
||||
languageName = CFArrayGetValueAtIndex(localizationList, 0);
|
||||
|
||||
if (languageName != NULL &&
|
||||
CFGetTypeID(languageName) == CFStringGetTypeID())
|
||||
{
|
||||
localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString(
|
||||
kCFAllocatorDefault, languageName);
|
||||
if (languageName != NULL &&
|
||||
CFGetTypeID(languageName) == CFStringGetTypeID())
|
||||
{
|
||||
localeName = CFLocaleCreateCanonicalLocaleIdentifierFromString(
|
||||
kCFAllocatorDefault, languageName);
|
||||
|
||||
if (localeName != NULL)
|
||||
{
|
||||
CFStringGetCString(localeName, cg->language, sizeof(cg->language),
|
||||
kCFStringEncodingASCII);
|
||||
CFRelease(localeName);
|
||||
if (localeName != NULL)
|
||||
{
|
||||
CFStringGetCString(localeName, cg->language, sizeof(cg->language),
|
||||
kCFStringEncodingASCII);
|
||||
CFRelease(localeName);
|
||||
|
||||
if (!strcmp(cg->language, "en"))
|
||||
strlcpy(cg->language, "en_US.UTF-8", sizeof(cg->language));
|
||||
else if (strchr(cg->language, '.') == NULL)
|
||||
strlcat(cg->language, ".UTF-8", sizeof(cg->language));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(localizationList);
|
||||
if (!strcmp(cg->language, "en"))
|
||||
strlcpy(cg->language, "en_US.UTF-8", sizeof(cg->language));
|
||||
else if (strchr(cg->language, '.') == NULL)
|
||||
strlcat(cg->language, ".UTF-8", sizeof(cg->language));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(localizationList);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1150,66 +1144,59 @@ appleLangDefault(void)
|
||||
char buff[256]; /* Temporary buffer */
|
||||
_cups_globals_t *cg = _cupsGlobals();
|
||||
/* Pointer to library globals */
|
||||
char *lang; /* LANG environment variable */
|
||||
|
||||
|
||||
/*
|
||||
* Only do the lookup and translation the first time.
|
||||
*/
|
||||
|
||||
if (!cg->language[0])
|
||||
if (cg->language == NULL)
|
||||
{
|
||||
if ((lang = getenv("LANG")))
|
||||
strlcpy(cg->language, lang, sizeof(cg->language));
|
||||
else
|
||||
localizationList =
|
||||
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
|
||||
kCFPreferencesCurrentApplication);
|
||||
|
||||
if (localizationList != NULL)
|
||||
{
|
||||
localizationList =
|
||||
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
|
||||
kCFPreferencesCurrentApplication);
|
||||
|
||||
if (localizationList != NULL)
|
||||
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
|
||||
CFArrayGetCount(localizationList) > 0)
|
||||
{
|
||||
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
|
||||
CFArrayGetCount(localizationList) > 0)
|
||||
localizationName = CFArrayGetValueAtIndex(localizationList, 0);
|
||||
|
||||
if (localizationName != NULL &&
|
||||
CFGetTypeID(localizationName) == CFStringGetTypeID())
|
||||
{
|
||||
localizationName = CFArrayGetValueAtIndex(localizationList, 0);
|
||||
CFIndex length = CFStringGetLength(localizationName);
|
||||
|
||||
if (localizationName != NULL &&
|
||||
CFGetTypeID(localizationName) == CFStringGetTypeID())
|
||||
if (length <= sizeof(buff) &&
|
||||
CFStringGetCString(localizationName, buff, sizeof(buff),
|
||||
kCFStringEncodingASCII))
|
||||
{
|
||||
CFIndex length = CFStringGetLength(localizationName);
|
||||
buff[sizeof(buff) - 1] = '\0';
|
||||
|
||||
if (length <= sizeof(buff) &&
|
||||
CFStringGetCString(localizationName, buff, sizeof(buff),
|
||||
kCFStringEncodingASCII))
|
||||
for (i = 0;
|
||||
i < sizeof(apple_name_locale) / sizeof(apple_name_locale[0]);
|
||||
i++)
|
||||
{
|
||||
buff[sizeof(buff) - 1] = '\0';
|
||||
|
||||
for (i = 0;
|
||||
i < sizeof(apple_name_locale) / sizeof(apple_name_locale[0]);
|
||||
i++)
|
||||
if (!strcasecmp(buff, apple_name_locale[i].name))
|
||||
{
|
||||
if (!strcasecmp(buff, apple_name_locale[i].name))
|
||||
{
|
||||
strlcpy(cg->language, apple_name_locale[i].locale,
|
||||
sizeof(cg->language));
|
||||
break;
|
||||
}
|
||||
cg->language = apple_name_locale[i].locale;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(localizationList);
|
||||
}
|
||||
|
||||
CFRelease(localizationList);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we didn't find the language, default to en_US...
|
||||
*/
|
||||
|
||||
if (!cg->language[0])
|
||||
strlcpy(cg->language, apple_name_locale[0].locale, sizeof(cg->language));
|
||||
if (cg->language == NULL)
|
||||
cg->language = apple_name_locale[0].locale;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -28,7 +28,6 @@ _cups_freeifaddrs
|
||||
_cups_strcpy
|
||||
_cups_strlcat
|
||||
_cups_strlcpy
|
||||
_httpBIOMethods
|
||||
_ippAddAttr
|
||||
_ippFreeAttr
|
||||
_ppdGetEncoding
|
||||
|
||||
@@ -62,14 +62,15 @@ static void ppd_defaults(ppd_file_t *ppd, ppd_group_t *g);
|
||||
int /* O - Number of conflicts found */
|
||||
ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
{
|
||||
int i, j, /* Looping variables */
|
||||
int i, j, k, /* Looping variables */
|
||||
conflicts; /* Number of conflicts */
|
||||
ppd_const_t *c; /* Current constraint */
|
||||
ppd_group_t *g, *sg; /* Groups */
|
||||
ppd_option_t *o1, *o2; /* Options */
|
||||
ppd_choice_t *c1, *c2; /* Choices */
|
||||
|
||||
|
||||
if (!ppd)
|
||||
if (ppd == NULL)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
@@ -78,8 +79,15 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
|
||||
conflicts = 0;
|
||||
|
||||
for (o1 = ppdFirstOption(ppd); o1; o1 = ppdNextOption(ppd))
|
||||
o1->conflicted = 0;
|
||||
for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++)
|
||||
{
|
||||
for (j = g->num_options, o1 = g->options; j > 0; j --, o1 ++)
|
||||
o1->conflicted = 0;
|
||||
|
||||
for (j = g->num_subgroups, sg = g->subgroups; j > 0; j --, sg ++)
|
||||
for (k = sg->num_options, o1 = sg->options; k > 0; k --, o1 ++)
|
||||
o1->conflicted = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop through all of the UI constraints and flag any options
|
||||
@@ -94,9 +102,9 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
|
||||
o1 = ppdFindOption(ppd, c->option1);
|
||||
|
||||
if (!o1)
|
||||
if (o1 == NULL)
|
||||
continue;
|
||||
else if (c->choice1[0])
|
||||
else if (c->choice1[0] != '\0')
|
||||
{
|
||||
/*
|
||||
* This constraint maps to a specific choice.
|
||||
@@ -114,10 +122,10 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
if (c1->marked)
|
||||
break;
|
||||
|
||||
if (!j ||
|
||||
!strcasecmp(c1->choice, "None") ||
|
||||
!strcasecmp(c1->choice, "Off") ||
|
||||
!strcasecmp(c1->choice, "False"))
|
||||
if (j == 0 ||
|
||||
strcasecmp(c1->choice, "None") == 0 ||
|
||||
strcasecmp(c1->choice, "Off") == 0 ||
|
||||
strcasecmp(c1->choice, "False") == 0)
|
||||
c1 = NULL;
|
||||
}
|
||||
|
||||
@@ -127,9 +135,9 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
|
||||
o2 = ppdFindOption(ppd, c->option2);
|
||||
|
||||
if (!o2)
|
||||
if (o2 == NULL)
|
||||
continue;
|
||||
else if (c->choice2[0])
|
||||
else if (c->choice2[0] != '\0')
|
||||
{
|
||||
/*
|
||||
* This constraint maps to a specific choice.
|
||||
@@ -147,10 +155,10 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
if (c2->marked)
|
||||
break;
|
||||
|
||||
if (!j ||
|
||||
!strcasecmp(c2->choice, "None") ||
|
||||
!strcasecmp(c2->choice, "Off") ||
|
||||
!strcasecmp(c2->choice, "False"))
|
||||
if (j == 0 ||
|
||||
strcasecmp(c2->choice, "None") == 0 ||
|
||||
strcasecmp(c2->choice, "Off") == 0 ||
|
||||
strcasecmp(c2->choice, "False") == 0)
|
||||
c2 = NULL;
|
||||
}
|
||||
|
||||
@@ -158,7 +166,8 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
|
||||
* If both options are marked then there is a conflict...
|
||||
*/
|
||||
|
||||
if (c1 && c1->marked && c2 && c2->marked)
|
||||
if (c1 != NULL && c1->marked &&
|
||||
c2 != NULL && c2->marked)
|
||||
{
|
||||
DEBUG_printf(("%s->%s conflicts with %s->%s (%s %s %s %s)\n",
|
||||
o1->keyword, c1->choice, o2->keyword, c2->choice,
|
||||
|
||||
@@ -1549,18 +1549,6 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
goto error;
|
||||
|
||||
case 2 : /* Two options... */
|
||||
/*
|
||||
* Check for broken constraints like "* Option"...
|
||||
*/
|
||||
|
||||
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
|
||||
(!strcmp(constraint->option1, "*") ||
|
||||
!strcmp(constraint->choice1, "*")))
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following strcpy's are safe, as optionN and
|
||||
* choiceN are all the same size (size defined by PPD spec...)
|
||||
@@ -1568,38 +1556,17 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
|
||||
if (constraint->option1[0] == '*')
|
||||
_cups_strcpy(constraint->option1, constraint->option1 + 1);
|
||||
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (constraint->choice1[0] == '*')
|
||||
_cups_strcpy(constraint->option2, constraint->choice1 + 1);
|
||||
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
else
|
||||
_cups_strcpy(constraint->option2, constraint->choice1);
|
||||
|
||||
constraint->choice1[0] = '\0';
|
||||
constraint->choice2[0] = '\0';
|
||||
break;
|
||||
|
||||
case 3 : /* Two options, one choice... */
|
||||
/*
|
||||
* Check for broken constraints like "* Option"...
|
||||
*/
|
||||
|
||||
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
|
||||
(!strcmp(constraint->option1, "*") ||
|
||||
!strcmp(constraint->choice1, "*") ||
|
||||
!strcmp(constraint->option2, "*")))
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following _cups_strcpy's are safe, as optionN and
|
||||
* choiceN are all the same size (size defined by PPD spec...)
|
||||
@@ -1607,21 +1574,9 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
|
||||
if (constraint->option1[0] == '*')
|
||||
_cups_strcpy(constraint->option1, constraint->option1 + 1);
|
||||
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (constraint->choice1[0] == '*')
|
||||
{
|
||||
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
|
||||
constraint->option2[0] == '*')
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
|
||||
_cups_strcpy(constraint->choice2, constraint->option2);
|
||||
_cups_strcpy(constraint->option2, constraint->choice1 + 1);
|
||||
constraint->choice1[0] = '\0';
|
||||
@@ -1630,85 +1585,20 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */
|
||||
{
|
||||
if (constraint->option2[0] == '*')
|
||||
_cups_strcpy(constraint->option2, constraint->option2 + 1);
|
||||
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
|
||||
constraint->choice2[0] = '\0';
|
||||
}
|
||||
break;
|
||||
|
||||
case 4 : /* Two options, two choices... */
|
||||
/*
|
||||
* Check for broken constraints like "* Option"...
|
||||
*/
|
||||
|
||||
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
|
||||
(!strcmp(constraint->option1, "*") ||
|
||||
!strcmp(constraint->choice1, "*") ||
|
||||
!strcmp(constraint->option2, "*") ||
|
||||
!strcmp(constraint->choice2, "*")))
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (constraint->option1[0] == '*')
|
||||
_cups_strcpy(constraint->option1, constraint->option1 + 1);
|
||||
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
|
||||
constraint->choice1[0] == '*')
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (constraint->option2[0] == '*')
|
||||
_cups_strcpy(constraint->option2, constraint->option2 + 1);
|
||||
else if (cg->ppd_conform == PPD_CONFORM_STRICT)
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (cg->ppd_conform == PPD_CONFORM_STRICT &&
|
||||
constraint->choice2[0] == '*')
|
||||
{
|
||||
cg->ppd_status = PPD_BAD_UI_CONSTRAINTS;
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle CustomFoo option constraints...
|
||||
*/
|
||||
|
||||
if (!strncasecmp(constraint->option1, "Custom", 6) &&
|
||||
!strcasecmp(constraint->choice1, "True"))
|
||||
{
|
||||
_cups_strcpy(constraint->option1, constraint->option1 + 6);
|
||||
strcpy(constraint->choice1, "Custom");
|
||||
}
|
||||
|
||||
if (!strncasecmp(constraint->option2, "Custom", 6) &&
|
||||
!strcasecmp(constraint->choice2, "True"))
|
||||
{
|
||||
_cups_strcpy(constraint->option2, constraint->option2 + 6);
|
||||
strcpy(constraint->choice2, "Custom");
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't add this one as an attribute...
|
||||
*/
|
||||
|
||||
ppd_free(string);
|
||||
string = NULL;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Temp file utilities for the Common UNIX Printing System (CUPS).
|
||||
*
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Easy Software Products and are protected by Federal
|
||||
@@ -25,9 +25,9 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsTempFd() - Creates a temporary file.
|
||||
* cupsTempFile() - Generates a temporary filename.
|
||||
* cupsTempFile2() - Creates a temporary CUPS file.
|
||||
* cupsTempFd() - Create a temporary file.
|
||||
* cupsTempFile() - Generate a temporary filename.
|
||||
* cupsTempFile2() - Create a temporary CUPS file.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -48,13 +48,12 @@
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsTempFd()' - Creates a temporary file.
|
||||
* 'cupsTempFd()' - Create a temporary file.
|
||||
*
|
||||
* The temporary filename is returned in the filename buffer.
|
||||
* The temporary file is opened for reading and writing.
|
||||
* The temporary filename is stored in the filename buffer.
|
||||
*/
|
||||
|
||||
int /* O - New file descriptor or -1 on error */
|
||||
int /* O - New file descriptor */
|
||||
cupsTempFd(char *filename, /* I - Pointer to buffer */
|
||||
int len) /* I - Size of buffer */
|
||||
{
|
||||
@@ -159,16 +158,16 @@ cupsTempFd(char *filename, /* I - Pointer to buffer */
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsTempFile()' - Generates a temporary filename.
|
||||
* 'cupsTempFile()' - Generate a temporary filename.
|
||||
*
|
||||
* The temporary filename is returned in the filename buffer.
|
||||
* The temporary filename is stored in the filename buffer.
|
||||
* This function is deprecated - use cupsTempFd() or cupsTempFile2()
|
||||
* instead.
|
||||
*
|
||||
* @deprecated@
|
||||
*/
|
||||
|
||||
char * /* O - Filename or NULL on error */
|
||||
char * /* O - Filename */
|
||||
cupsTempFile(char *filename, /* I - Pointer to buffer */
|
||||
int len) /* I - Size of buffer */
|
||||
{
|
||||
@@ -208,10 +207,9 @@ cupsTempFile(char *filename, /* I - Pointer to buffer */
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsTempFile2()' - Creates a temporary CUPS file.
|
||||
* 'cupsTempFile2()' - Create a temporary CUPS file.
|
||||
*
|
||||
* The temporary filename is returned in the filename buffer.
|
||||
* The temporary file is opened for writing.
|
||||
* The temporary filename is stored in the filename buffer.
|
||||
*
|
||||
* @since CUPS 1.2@
|
||||
*/
|
||||
|
||||
@@ -84,8 +84,6 @@ static uri_test_t uri_tests[] = /* URI test data */
|
||||
"http", "username:password", "server", "/", 8080, 8080 },
|
||||
{ HTTP_URI_OK, "http://username:passwor%64@server:8080/directory/filename",
|
||||
"http", "username:password", "server", "/directory/filename", 8080, 8080 },
|
||||
{ HTTP_URI_OK, "http://[2000::10:100]:631/ipp",
|
||||
"http", "", "2000::10:100", "/ipp", 631, 631 },
|
||||
{ HTTP_URI_OK, "https://username:passwor%64@server/directory/filename",
|
||||
"https", "username:password", "server", "/directory/filename", 443, 0 },
|
||||
{ HTTP_URI_OK, "ipp://username:passwor%64@[::1]/ipp",
|
||||
|
||||
@@ -295,38 +295,6 @@ cupsCharsetToUTF8(
|
||||
return (strlen((char *)dest));
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle ISO-8859-1 to UTF-8 directly...
|
||||
*/
|
||||
|
||||
if (encoding == CUPS_ISO8859_1)
|
||||
{
|
||||
int ch; /* Character from string */
|
||||
cups_utf8_t *destptr, /* Pointer into UTF-8 buffer */
|
||||
*destend; /* End of UTF-8 buffer */
|
||||
|
||||
|
||||
destptr = dest;
|
||||
destend = dest + maxout - 2;
|
||||
|
||||
while (*src && destptr < destend)
|
||||
{
|
||||
ch = *src++ & 255;
|
||||
|
||||
if (ch & 128)
|
||||
{
|
||||
*destptr++ = 0xc0 | (ch >> 6);
|
||||
*destptr++ = 0x80 | (ch & 0x3f);
|
||||
}
|
||||
else
|
||||
*destptr++ = ch;
|
||||
}
|
||||
|
||||
*destptr = '\0';
|
||||
|
||||
return (destptr - dest);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert input legacy charset to UTF-8...
|
||||
*/
|
||||
@@ -395,45 +363,6 @@ cupsUTF8ToCharset(
|
||||
return (strlen(dest));
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle UTF-8 to ISO-8859-1 directly...
|
||||
*/
|
||||
|
||||
if (encoding == CUPS_ISO8859_1)
|
||||
{
|
||||
int ch; /* Character from string */
|
||||
char *destptr, /* Pointer into ISO-8859-1 buffer */
|
||||
*destend; /* End of ISO-8859-1 buffer */
|
||||
|
||||
|
||||
destptr = dest;
|
||||
destend = dest + maxout - 1;
|
||||
|
||||
while (*src && destptr < destend)
|
||||
{
|
||||
ch = *src++;
|
||||
|
||||
if ((ch & 0xe0) == 0xc0)
|
||||
{
|
||||
ch = ((ch & 0x1f) << 6) | (*src++ & 0x3f);
|
||||
|
||||
if (ch < 256)
|
||||
*destptr++ = ch;
|
||||
else
|
||||
*destptr++ = '?';
|
||||
}
|
||||
else if ((ch & 0xf0) == 0xe0 ||
|
||||
(ch & 0xf8) == 0xf0)
|
||||
*destptr++ = '?';
|
||||
else if (!(ch & 0x80))
|
||||
*destptr++ = ch;
|
||||
}
|
||||
|
||||
*destptr = '\0';
|
||||
|
||||
return (destptr - dest);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert input UTF-8 to legacy charset...
|
||||
*/
|
||||
@@ -516,7 +445,6 @@ cupsUTF8ToUTF32(
|
||||
*/
|
||||
|
||||
*dest++ = ch;
|
||||
continue;
|
||||
}
|
||||
else if ((ch & 0xe0) == 0xc0)
|
||||
{
|
||||
@@ -612,7 +540,7 @@ cupsUTF8ToUTF32(
|
||||
* Check for UTF-16 surrogate (illegal UTF-8)...
|
||||
*/
|
||||
|
||||
if (ch32 >= 0xd800 && ch32 <= 0xdfff)
|
||||
if (*dest >= 0xd800 && *dest <= 0xdfff)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,10 @@ X-DCOP-ServiceType=
|
||||
X-KDE-SubstituteUID=false
|
||||
X-KDE-Username=
|
||||
Name=Manage Printing
|
||||
Comment=CUPS Web Interface
|
||||
Name[en_US]=Manage Printing
|
||||
Comment=CUPS Web Interface
|
||||
Comment[en_US]=CUPS Web Interface
|
||||
Name[es]=Administrar impresión
|
||||
Comment[es]=Interfaz Web de CUPS
|
||||
Name[et]=Trükkimise haldur
|
||||
Comment[et]=CUPS-i veebiliides
|
||||
Name[pl]=Zarządzanie drukowaniem
|
||||
Comment[pl]=Interfejs WWW CUPS
|
||||
Name[it]=Gestione stampa
|
||||
Comment[it]=Interfaccia web di CUPS
|
||||
|
Antes Largura: | Altura: | Tamanho: 595 B |
|
Antes Largura: | Altura: | Tamanho: 443 B |
|
Antes Largura: | Altura: | Tamanho: 472 B |
|
Antes Largura: | Altura: | Tamanho: 563 B |
|
Antes Largura: | Altura: | Tamanho: 636 B |
|
Antes Largura: | Altura: | Tamanho: 513 B |
|
Antes Largura: | Altura: | Tamanho: 612 B |
|
Antes Largura: | Altura: | Tamanho: 644 B |
|
Antes Largura: | Altura: | Tamanho: 419 B |
|
Antes Largura: | Altura: | Tamanho: 355 B |
|
Antes Largura: | Altura: | Tamanho: 506 B |
|
Antes Largura: | Altura: | Tamanho: 522 B |
|
Antes Largura: | Altura: | Tamanho: 721 B |
|
Antes Largura: | Altura: | Tamanho: 874 B |
|
Antes Largura: | Altura: | Tamanho: 313 B |
|
Antes Largura: | Altura: | Tamanho: 451 B |
|
Antes Largura: | Altura: | Tamanho: 523 B |
|
Antes Largura: | Altura: | Tamanho: 450 B |
|
Antes Largura: | Altura: | Tamanho: 571 B |
|
Antes Largura: | Altura: | Tamanho: 541 B |
|
Antes Largura: | Altura: | Tamanho: 537 B |
|
Antes Largura: | Altura: | Tamanho: 552 B |
|
Antes Largura: | Altura: | Tamanho: 475 B |
|
Antes Largura: | Altura: | Tamanho: 606 B |
|
Antes Largura: | Altura: | Tamanho: 768 B |
|
Antes Largura: | Altura: | Tamanho: 630 B |
|
Antes Largura: | Altura: | Tamanho: 560 B |
|
Antes Largura: | Altura: | Tamanho: 649 B |
|
Antes Largura: | Altura: | Tamanho: 534 B |
|
Antes Largura: | Altura: | Tamanho: 551 B |
|
Antes Largura: | Altura: | Tamanho: 709 B |
|
Antes Largura: | Altura: | Tamanho: 329 B |
|
Antes Largura: | Altura: | Tamanho: 753 B |
|
Antes Largura: | Altura: | Tamanho: 742 B |
|
Antes Largura: | Altura: | Tamanho: 696 B |
|
Antes Largura: | Altura: | Tamanho: 683 B |
|
Antes Largura: | Altura: | Tamanho: 567 B |
|
Antes Largura: | Altura: | Tamanho: 683 B |
|
Antes Largura: | Altura: | Tamanho: 556 B |
|
Antes Largura: | Altura: | Tamanho: 529 B |
|
Antes Largura: | Altura: | Tamanho: 607 B |
|
Antes Largura: | Altura: | Tamanho: 624 B |
|
Antes Largura: | Altura: | Tamanho: 537 B |
|
Antes Largura: | Altura: | Tamanho: 567 B |
|
Antes Largura: | Altura: | Tamanho: 491 B |
|
Antes Largura: | Altura: | Tamanho: 500 B |
|
Antes Largura: | Altura: | Tamanho: 638 B |
|
Antes Largura: | Altura: | Tamanho: 903 B |
|
Antes Largura: | Altura: | Tamanho: 687 B |
|
Antes Largura: | Altura: | Tamanho: 550 B |
|
Antes Largura: | Altura: | Tamanho: 576 B |
|
Antes Largura: | Altura: | Tamanho: 758 B |
@@ -1,141 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||
<TITLE>Kodu - CUPS @CUPS_VERSION@@CUPS_REVISION@</TITLE>
|
||||
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/cups.css">
|
||||
<LINK REL="SHORTCUT ICON" HREF="/favicon.ico" TYPE="image/x-icon">
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<TABLE WIDTH="100%" STYLE="height: 100%;" BORDER="0" CELLSPACING="0" CELLPADDING="0" SUMMARY="Common UNIX Printing System @CUPS_VERSION@">
|
||||
<TR CLASS="header">
|
||||
<TD VALIGN="TOP" WIDTH="15" ROWSPAN="2"><IMG SRC="/images/top-left.gif" WIDTH="15" HEIGHT="80" ALT=""></TD>
|
||||
<TD VALIGN="TOP" WIDTH="55" ROWSPAN="2"><IMG SRC="/images/top-middle.gif" WIDTH="55" HEIGHT="80" ALT=""></TD>
|
||||
<TD WIDTH="100%" HEIGHT="60"><H1>Common UNIX Printing System @CUPS_VERSION@@CUPS_REVISION@</H1></TD>
|
||||
<TD ALIGN="RIGHT" VALIGN="TOP" WIDTH="15" ROWSPAN="2"><IMG
|
||||
SRC="/images/top-right.gif" WIDTH="15" HEIGHT="15" ALT=""></TD>
|
||||
</TR>
|
||||
<TR CLASS="header"><TD WIDTH="100%" VALIGN="BOTTOM" NOWRAP>
|
||||
|
||||
<A CLASS="sel" HREF="/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Kodu <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
<A CLASS="unsel" HREF="/admin/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Haldus <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
<A CLASS="unsel" HREF="/classes/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Klassid <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
<A CLASS="unsel" HREF="/help/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Dokumentatsioon/Abi <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
<A CLASS="unsel" HREF="/jobs/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Tööd <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
<A CLASS="unsel" HREF="/printers/"><IMG SRC="/images/tab-left.gif" WIDTH="4"
|
||||
HEIGHT="4" ALIGN="TOP" BORDER="0"
|
||||
ALT=""> Printerid <IMG
|
||||
SRC="/images/tab-right.gif" WIDTH="4" HEIGHT="4" ALIGN="TOP"
|
||||
BORDER="0" ALT=""></A>
|
||||
|
||||
</TD></TR>
|
||||
<TR CLASS="page">
|
||||
<TD WIDTH="15"> </TD>
|
||||
<TD COLSPAN="2" WIDTH="100%" VALIGN="TOP" CLASS="page">
|
||||
|
||||
<H2 CLASS="title">Tere tulemast!</H2>
|
||||
|
||||
<P>Käesolevad veebileheküljed võimaldavad Teil jälgida oma printereid ja töid
|
||||
ning süsteemi hallata. Klõpsake vajalike ülesannete sooritamiseks mõnele
|
||||
ülal paiknevale sakile või all asuvale nupule.</P>
|
||||
|
||||
<P>
|
||||
<A HREF="/help/"><IMG SRC="/images/button-help.gif" CLASS="button" ALT="Abi"></A>
|
||||
<A HREF="/admin?OP=add-class"><IMG SRC="/images/button-add-class.gif" CLASS="button" ALT="Lisa klass"></A>
|
||||
<A HREF="/admin?OP=add-printer"><IMG SRC="/images/button-add-printer.gif" CLASS="button" ALT="Lisa printer"></A>
|
||||
<A HREF="/classes"><IMG SRC="/images/button-manage-classes.gif" CLASS="button" ALT="Halda klasse"></A>
|
||||
<A HREF="/jobs"><IMG SRC="/images/button-manage-jobs.gif" CLASS="button" ALT="Halda töid"></A>
|
||||
<A HREF="/printers"><IMG SRC="/images/button-manage-printers.gif" CLASS="button" ALT="Halda printereid"></A>
|
||||
<A HREF="/admin"><IMG SRC="/images/button-manage-server.gif" CLASS="button" ALT="Halda serverit"></A>
|
||||
</P>
|
||||
|
||||
<P><I>Kui Teie käest päritakse kasutajanime ja parooli, sisestage enda
|
||||
või administraatori (root) kasutajanimi ja parool.</I></P>
|
||||
|
||||
<H2 CLASS="title">CUPS-i info</H2>
|
||||
|
||||
<P>
|
||||
<IMG SRC="/images/happy.gif" ALIGN="LEFT" WIDTH="196" HEIGHT="144"
|
||||
STYLE="padding-right: 10px;" ALT="Happy Computer and Printer">
|
||||
|
||||
<A HREF="http://www.easysw.com/"><IMG SRC="/images/esp-logo.gif"
|
||||
ALIGN="RIGHT" WIDTH="110" HEIGHT="68" BORDER="0"
|
||||
STYLE="padding-left: 10px; padding-bottom: 10px;"
|
||||
ALT="Easy Software Products"></A>
|
||||
|
||||
CUPS pakub porditavat trükkimiskihti
|
||||
UNIX<SUP>®</SUP> põhistele operatsioonisüsteemidele. CUPS-i töötas
|
||||
välja ja hooldab <A HREF="http://www.easysw.com">Easy Software
|
||||
Products</a>, selle siht on edendada standardseid trükkimislahendusi. CUPS on
|
||||
standardne trükkimissüsteem, mida kasutavad MacOS<SUP>®</SUP> X ja
|
||||
suurem osa Linux<SUP>®</SUP> distributsioone.</P>
|
||||
|
||||
<P>CUPS kasutab <A HREF="http://www.pwg.org/ipp/"
|
||||
TARGET="_blank"> Interneti trükkimisprotokolli ("IPP")</A>
|
||||
trükitööde ja järjekordade haldamiseks, lisades sellele
|
||||
võrguprinterite kasutamise ning PostScript-printerikirjelduste ("PPD")
|
||||
põhise trükkimise võimalused trükkimise maksimaalseks hõlbustamiseks.<BR CLEAR="ALL"></P>
|
||||
|
||||
<H2 CLASS="title">Printeridraiveritest ja abist</H2>
|
||||
|
||||
<P>Printeridraiverite ja muu abi leidmiseks külastage CUPS-i
|
||||
ametlikku veebilehekülge:</P>
|
||||
|
||||
<PRE>
|
||||
<A HREF="http://www.cups.org/" TARGET="_blank">www.cups.org</A>
|
||||
</PRE>
|
||||
|
||||
<P>Kommertstoetus ja CUPS-i täiustatud versioon nimetusega <A
|
||||
HREF="http://www.easysw.com/printpro/">ESP Print Pro</A> on
|
||||
saadaval aadressil:</P>
|
||||
|
||||
<PRE>
|
||||
<A HREF="http://www.easysw.com/" TARGET="_blank">www.easysw.com</A>
|
||||
</PRE>
|
||||
|
||||
</TD>
|
||||
<TD WIDTH="15"> </TD>
|
||||
</TR>
|
||||
<TR CLASS="header">
|
||||
<TD VALIGN="BOTTOM" WIDTH="15"><IMG SRC="/images/bottom-left.gif"
|
||||
WIDTH="15" HEIGHT="15" ALT=""></TD>
|
||||
<TD COLSPAN="2" WIDTH="100%" STYLE="padding: 5;">
|
||||
|
||||
<P><SMALL>Common UNIX Printing System, CUPS ja CUPS-i logo on
|
||||
firma <A HREF="http://www.easysw.com">Easy Software
|
||||
Products</A> kaubamärgid. CUPS-i autoriõigus 1997-2006: Easy Software Products,
|
||||
kõik õigused kaitstud.</SMALL></P>
|
||||
|
||||
</TD>
|
||||
|
||||
<TD ALIGN="RIGHT" VALIGN="BOTTOM" WIDTH="15"><IMG SRC="/images/bottom-right.gif"
|
||||
WIDTH="15" HEIGHT="15" ALT=""></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -176,16 +176,8 @@ CUPS 1.1 or higher.</p>
|
||||
<h4>Description</h4>
|
||||
<p>Add a destination to the list of destinations.
|
||||
|
||||
This function cannot be used to add a new class or printer queue,
|
||||
it only adds a new container of saved options for the named
|
||||
destination or instance.
|
||||
|
||||
If the named destination already exists, the destination list is
|
||||
returned unchanged. Adding a new instance of a destination creates
|
||||
a copy of that destination's options.
|
||||
|
||||
Use the cupsSaveDests() function to save the updated list of
|
||||
destinations to the user's lpoptions file.</p>
|
||||
Use the cupsSaveDests() function to save the updated list of destinations
|
||||
to the user's lpoptions file.</p>
|
||||
<h4>Syntax</h4>
|
||||
<pre>
|
||||
int
|
||||
@@ -199,8 +191,8 @@ cupsAddDest(
|
||||
<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>name</tt></td><td>Destination name</td></tr>
|
||||
<tr><td><tt>instance</tt></td><td>Instance name or NULL for none/primary</td></tr>
|
||||
<tr><td><tt>name</tt></td><td>Name of destination</td></tr>
|
||||
<tr><td><tt>instance</tt></td><td>Instance of destination or NULL for none/primary</td></tr>
|
||||
<tr><td><tt>num_dests</tt></td><td>Number of destinations</td></tr>
|
||||
<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
|
||||
</tbody></table></div>
|
||||
@@ -420,8 +412,8 @@ cupsGetDest(
|
||||
<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>name</tt></td><td>Destination name or NULL for the default destination</td></tr>
|
||||
<tr><td><tt>instance</tt></td><td>Instance name or NULL</td></tr>
|
||||
<tr><td><tt>name</tt></td><td>Name of destination</td></tr>
|
||||
<tr><td><tt>instance</tt></td><td>Instance of destination</td></tr>
|
||||
<tr><td><tt>num_dests</tt></td><td>Number of destinations</td></tr>
|
||||
<tr><td><tt>dests</tt></td><td>Destinations</td></tr>
|
||||
</tbody></table></div>
|
||||
@@ -435,10 +427,7 @@ cupsGetDest(
|
||||
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.
|
||||
|
||||
Use the cupsFreeDests() function to free the destination list and
|
||||
the cupsGetDest() function to find a particular destination.</p>
|
||||
printer-state-reasons, and printer-type attributes as options.</p>
|
||||
<h4>Syntax</h4>
|
||||
<pre>
|
||||
int
|
||||
@@ -463,9 +452,6 @@ 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.
|
||||
|
||||
Use the cupsFreeDests() function to free the destination list and
|
||||
the cupsGetDest() function to find a particular destination.
|
||||
|
||||
</p>
|
||||
<h4>Syntax</h4>
|
||||
<pre>
|
||||
@@ -1206,10 +1192,9 @@ cupsSetUser(
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cupsTempFd'>cupsTempFd()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Creates a temporary file.
|
||||
<p>Create a temporary file.
|
||||
|
||||
The temporary filename is returned in the filename buffer.
|
||||
The temporary file is opened for reading and writing.</p>
|
||||
The temporary filename is stored in the filename buffer.</p>
|
||||
<h4>Syntax</h4>
|
||||
<pre>
|
||||
int
|
||||
@@ -1225,13 +1210,13 @@ cupsTempFd(
|
||||
<tr><td><tt>len</tt></td><td>Size of buffer</td></tr>
|
||||
</tbody></table></div>
|
||||
<h4>Returns</h4>
|
||||
<p>New file descriptor or -1 on error</p>
|
||||
<p>New file descriptor</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><span class='info'> DEPRECATED </span><a name='cupsTempFile'>cupsTempFile()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Generates a temporary filename.
|
||||
<p>Generate a temporary filename.
|
||||
|
||||
The temporary filename is returned in the filename buffer.
|
||||
The temporary filename is stored in the filename buffer.
|
||||
This function is deprecated - use cupsTempFd() or cupsTempFile2()
|
||||
instead.
|
||||
|
||||
@@ -1251,14 +1236,13 @@ cupsTempFile(
|
||||
<tr><td><tt>len</tt></td><td>Size of buffer</td></tr>
|
||||
</tbody></table></div>
|
||||
<h4>Returns</h4>
|
||||
<p>Filename or NULL on error</p>
|
||||
<p>Filename</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><span class='info'> CUPS 1.2 </span><a name='cupsTempFile2'>cupsTempFile2()</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Creates a temporary CUPS file.
|
||||
<p>Create a temporary CUPS file.
|
||||
|
||||
The temporary filename is returned in the filename buffer.
|
||||
The temporary file is opened for writing.
|
||||
The temporary filename is stored in the filename buffer.
|
||||
|
||||
</p>
|
||||
<h4>Syntax</h4>
|
||||
|
||||
@@ -112,7 +112,6 @@ require CUPS 1.1 or higher.</p>
|
||||
<thead><tr><th>Name</th><th>Description</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><tt>HTTP_ENCODE_CHUNKED</tt> </td><td>Data is chunked</td></tr>
|
||||
<tr><td><tt>HTTP_ENCODE_FIELDS</tt> </td><td>Sending HTTP fields</td></tr>
|
||||
<tr><td><tt>HTTP_ENCODE_LENGTH</tt> </td><td>Data is sent with Content-Length</td></tr>
|
||||
</tbody></table></div>
|
||||
<!-- NEW PAGE -->
|
||||
@@ -257,7 +256,7 @@ require CUPS 1.1 or higher.</p>
|
||||
<tr><td><tt>IPP_DOCUMENT_ACCESS_ERROR</tt> </td><td>client-error-document-access-error</td></tr>
|
||||
<tr><td><tt>IPP_DOCUMENT_FORMAT</tt> </td><td>client-error-document-format-not-supported</td></tr>
|
||||
<tr><td><tt>IPP_DOCUMENT_FORMAT_ERROR</tt> </td><td>client-error-document-format-error</td></tr>
|
||||
<tr><td><tt>IPP_ERROR_JOB_CANCELED</tt> </td><td>server-error-job-canceled</td></tr>
|
||||
<tr><td><tt>IPP_ERROR_JOB_CANCELLED</tt> </td><td>server-error-job-canceled</td></tr>
|
||||
<tr><td><tt>IPP_FORBIDDEN</tt> </td><td>client-error-forbidden</td></tr>
|
||||
<tr><td><tt>IPP_GONE</tt> </td><td>client-error-gone</td></tr>
|
||||
<tr><td><tt>IPP_IGNORED_ALL_NOTIFICATIONS</tt> </td><td>client-error-ignored-all-notifications</td></tr>
|
||||
|
||||
@@ -72,7 +72,7 @@ CUPS 1.1 or higher.</p>
|
||||
<h2 class='title'>Licensing</h2>
|
||||
|
||||
<p>The CUPS raster API is provided under the terms of the GNU
|
||||
Library General Public License, with exceptions for MacOS X-based
|
||||
General Public License, with exceptions for MacOS X-based
|
||||
programs. Please see the CUPS license agreement for more
|
||||
information.</p>
|
||||
<h2 class='title'>Contents</h2>
|
||||
@@ -85,31 +85,10 @@ information.</p>
|
||||
<!-- NEW PAGE -->
|
||||
<h2 class='title'><a name='ENUMERATIONS'>Enumerations</a></h2>
|
||||
<ul>
|
||||
<li><a href='#cups_adv_e'><tt>cups_adv_e</tt></a> </li>
|
||||
<li><a href='#cups_bool_e'><tt>cups_bool_e</tt></a> </li>
|
||||
<li><a href='#cups_cspace_e'><tt>cups_cspace_e</tt></a> </li>
|
||||
<li><a href='#cups_cut_e'><tt>cups_cut_e</tt></a> </li>
|
||||
<li><a href='#cups_edge_e'><tt>cups_edge_e</tt></a> </li>
|
||||
<li><a href='#cups_jog_e'><tt>cups_jog_e</tt></a> </li>
|
||||
<li><a href='#cups_mode_e'><tt>cups_mode_e</tt></a> </li>
|
||||
<li><a href='#cups_order_e'><tt>cups_order_e</tt></a> </li>
|
||||
<li><a href='#cups_orient_e'><tt>cups_orient_e</tt></a> </li>
|
||||
</ul>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_adv_e'>cups_adv_e</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p></p>
|
||||
<h4>Values</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>CUPS_ADVANCE_FILE</tt> </td><td>Advance the roll after this file</td></tr>
|
||||
<tr><td><tt>CUPS_ADVANCE_JOB</tt> </td><td>Advance the roll after this job</td></tr>
|
||||
<tr><td><tt>CUPS_ADVANCE_NONE</tt> </td><td>Never advance the roll</td></tr>
|
||||
<tr><td><tt>CUPS_ADVANCE_PAGE</tt> </td><td>Advance the roll after this page</td></tr>
|
||||
<tr><td><tt>CUPS_ADVANCE_SET</tt> </td><td>Advance the roll after this set</td></tr>
|
||||
</tbody></table></div>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_bool_e'>cups_bool_e</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Types...</p>
|
||||
@@ -121,89 +100,6 @@ information.</p>
|
||||
<tr><td><tt>CUPS_TRUE</tt> </td><td>Logical true</td></tr>
|
||||
</tbody></table></div>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_cspace_e'>cups_cspace_e</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p></p>
|
||||
<h4>Values</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>CUPS_CSPACE_CIELab</tt> <span class='info'> CUPS 1.1.19 </span></td><td>CIE Lab </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_CIEXYZ</tt> <span class='info'> CUPS 1.1.19 </span></td><td>CIE XYZ </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_CMY</tt> </td><td>Cyan, magenta, yellow</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_CMYK</tt> </td><td>Cyan, magenta, yellow, black</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_GMCK</tt> </td><td>Gold, magenta, yellow, black</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_GMCS</tt> </td><td>Gold, magenta, yellow, silver</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_GOLD</tt> </td><td>Gold foil</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICC1</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 1 color </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICC2</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 2 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICC3</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 3 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICC4</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 4 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICC5</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 5 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICC6</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 6 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICC7</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 7 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICC8</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 8 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICC9</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 9 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICCA</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 10 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICCB</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 11 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICCC</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 12 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICCD</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 13 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICCE</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 14 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_ICCF</tt> <span class='info'> CUPS 1.1.19 </span></td><td>ICC-based, 15 colors </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_K</tt> </td><td>Black</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_KCMY</tt> </td><td>Black, cyan, magenta, yellow</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_KCMYcm</tt> </td><td>Black, cyan, magenta, yellow, *
|
||||
light-cyan, light-magenta</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_RGB</tt> </td><td>Red, green, blue</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_RGBA</tt> </td><td>Red, green, blue, alpha</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_RGBW</tt> <span class='info'> CUPS 1.2 </span></td><td>Red, green, blue, white </td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_SILVER</tt> </td><td>Silver foil</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_W</tt> </td><td>Luminance</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_WHITE</tt> </td><td>White ink (as black)</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_YMC</tt> </td><td>Yellow, magenta, cyan</td></tr>
|
||||
<tr><td><tt>CUPS_CSPACE_YMCK</tt> </td><td>Yellow, magenta, cyan, black</td></tr>
|
||||
</tbody></table></div>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_cut_e'>cups_cut_e</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p></p>
|
||||
<h4>Values</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>CUPS_CUT_FILE</tt> </td><td>Cut the roll after this file</td></tr>
|
||||
<tr><td><tt>CUPS_CUT_JOB</tt> </td><td>Cut the roll after this job</td></tr>
|
||||
<tr><td><tt>CUPS_CUT_NONE</tt> </td><td>Never cut the roll</td></tr>
|
||||
<tr><td><tt>CUPS_CUT_PAGE</tt> </td><td>Cut the roll after this page</td></tr>
|
||||
<tr><td><tt>CUPS_CUT_SET</tt> </td><td>Cut the roll after this set</td></tr>
|
||||
</tbody></table></div>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_edge_e'>cups_edge_e</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p></p>
|
||||
<h4>Values</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>CUPS_EDGE_BOTTOM</tt> </td><td>Leading edge is the bottom of the page</td></tr>
|
||||
<tr><td><tt>CUPS_EDGE_LEFT</tt> </td><td>Leading edge is the left of the page</td></tr>
|
||||
<tr><td><tt>CUPS_EDGE_RIGHT</tt> </td><td>Leading edge is the right of the page</td></tr>
|
||||
<tr><td><tt>CUPS_EDGE_TOP</tt> </td><td>Leading edge is the top of the page</td></tr>
|
||||
</tbody></table></div>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_jog_e'>cups_jog_e</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p></p>
|
||||
<h4>Values</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>CUPS_JOG_FILE</tt> </td><td>Move pages after this file</td></tr>
|
||||
<tr><td><tt>CUPS_JOG_JOB</tt> </td><td>Move pages after this job</td></tr>
|
||||
<tr><td><tt>CUPS_JOG_NONE</tt> </td><td>Never move pages</td></tr>
|
||||
<tr><td><tt>CUPS_JOG_SET</tt> </td><td>Move pages after this set</td></tr>
|
||||
</tbody></table></div>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_mode_e'>cups_mode_e</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Raster modes</p>
|
||||
@@ -215,31 +111,6 @@ light-cyan, light-magenta</td></tr>
|
||||
<tr><td><tt>CUPS_RASTER_WRITE</tt> </td><td>Open stream for writing</td></tr>
|
||||
</tbody></table></div>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_order_e'>cups_order_e</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p></p>
|
||||
<h4>Values</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>CUPS_ORDER_BANDED</tt> </td><td>CCC MMM YYY KKK ...</td></tr>
|
||||
<tr><td><tt>CUPS_ORDER_CHUNKED</tt> </td><td>CMYK CMYK CMYK ...</td></tr>
|
||||
<tr><td><tt>CUPS_ORDER_PLANAR</tt> </td><td>CCC ... MMM ... YYY ... KKK ...</td></tr>
|
||||
</tbody></table></div>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_orient_e'>cups_orient_e</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p></p>
|
||||
<h4>Values</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>CUPS_ORIENT_0</tt> </td><td>Don't rotate the page</td></tr>
|
||||
<tr><td><tt>CUPS_ORIENT_180</tt> </td><td>Turn the page upside down</td></tr>
|
||||
<tr><td><tt>CUPS_ORIENT_270</tt> </td><td>Rotate the page clockwise</td></tr>
|
||||
<tr><td><tt>CUPS_ORIENT_90</tt> </td><td>Rotate the page counter-clockwise</td></tr>
|
||||
</tbody></table></div>
|
||||
<!-- NEW PAGE -->
|
||||
<h2 class='title'><a name='FUNCTIONS'>Functions</a></h2>
|
||||
<ul>
|
||||
<li><a href='#cupsRasterClose'><tt>cupsRasterClose()</tt></a> </li>
|
||||
@@ -280,12 +151,6 @@ and "options" arguments. Instead, mark the options prior to calling
|
||||
cupsRasterInterpretPPD() - this allows you to do per-page options
|
||||
without manipulating the options array.
|
||||
|
||||
The "func" argument specifies an optional callback function that is
|
||||
called prior to the computation of the final raster data. The function
|
||||
can make changes to the cups_page_header2_t data as needed to use a
|
||||
supported raster format and then returns 0 on success and -1 if the
|
||||
requested attributes cannot be supported.
|
||||
|
||||
</p>
|
||||
<h4>Syntax</h4>
|
||||
<pre>
|
||||
@@ -294,8 +159,7 @@ cupsRasterInterpretPPD(
|
||||
<a href='#cups_page_header2_t'>cups_page_header2_t</a> * h,
|
||||
ppd_file_t * ppd,
|
||||
int num_options,
|
||||
cups_option_t * options,
|
||||
<a href='#cups_interpret_cb_t'>cups_interpret_cb_t</a> func);
|
||||
cups_option_t * options);
|
||||
</pre>
|
||||
<h4>Arguments</h4>
|
||||
<div class='table'><table align='center' border='1' width='80%' cellpadding='5' cellspacing='0'>
|
||||
@@ -305,7 +169,6 @@ cupsRasterInterpretPPD(
|
||||
<tr><td><tt>ppd</tt></td><td>PPD file</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>func</tt></td><td>Optional page header callback</td></tr>
|
||||
</tbody></table></div>
|
||||
<h4>Returns</h4>
|
||||
<p>0 on success, -1 on failure</p>
|
||||
@@ -585,7 +448,7 @@ factor not applied) </td></tr>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_page_header_s'>cups_page_header_s</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p></p>
|
||||
<p>Version 1 Page Header</p>
|
||||
<h4>Definition</h4>
|
||||
<pre>
|
||||
struct cups_page_header_s
|
||||
@@ -678,19 +541,11 @@ struct cups_page_header_s
|
||||
<!-- NEW PAGE -->
|
||||
<h2 class='title'><a name='TYPES'>Types</a></h2>
|
||||
<ul>
|
||||
<li><a href='#cups_interpret_cb_t'><tt>cups_interpret_cb_t</tt></a> </li>
|
||||
<li><a href='#cups_page_header2_t'><tt>cups_page_header2_t</tt></a> <span class='info'> CUPS 1.2 </span></li>
|
||||
<li><a href='#cups_page_header_t'><tt>cups_page_header_t</tt></a> </li>
|
||||
<li><a href='#cups_raster_t'><tt>cups_raster_t</tt></a> </li>
|
||||
</ul>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_interpret_cb_t'>cups_interpret_cb_t</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Prototypes...</p>
|
||||
<h4>Definition</h4>
|
||||
<pre>
|
||||
typedef int (*cups_interpret_cb_t)(<a href='#cups_page_header2_t'>cups_page_header2_t</a> *header, int preferred_bits);
|
||||
</pre>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><span class='info'> CUPS 1.2 </span><a name='cups_page_header2_t'>cups_page_header2_t</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Version 2 Page Header </p>
|
||||
@@ -699,6 +554,14 @@ typedef int (*cups_interpret_cb_t)(<a href='#cups_page_header2_t'>cups_page_head
|
||||
typedef struct <a href='#cups_page_header2_s'>cups_page_header2_s</a> cups_page_header2_t;
|
||||
</pre>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_page_header_t'>cups_page_header_t</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Version 1 Page Header</p>
|
||||
<h4>Definition</h4>
|
||||
<pre>
|
||||
typedef struct <a href='#cups_page_header_s'>cups_page_header_s</a> cups_page_header_t;
|
||||
</pre>
|
||||
<!-- NEW PAGE -->
|
||||
<h3 class='title'><a name='cups_raster_t'>cups_raster_t</a></h3>
|
||||
<h4>Description</h4>
|
||||
<p>Raster stream data</p>
|
||||
|
||||
@@ -22,12 +22,12 @@ Version 2, with exceptions for Apple operating systems and the
|
||||
OpenSSL toolkit. A copy of the exceptions and licenses follow
|
||||
this introduction.</P>
|
||||
|
||||
<P>The GNU LGPL applies to the CUPS and CUPS Imaging libraries
|
||||
located in the "cups" and "filter" subdirectories of the CUPS
|
||||
source distribution and in the "cups" include directory and
|
||||
library files in the binary distributions. The GNU GPL applies to
|
||||
the remainder of the CUPS distribution, including the "pdftops"
|
||||
filter which is based upon Xpdf.</P>
|
||||
<P>The GNU LGPL applies to the CUPS API library, located in the
|
||||
"cups" subdirectory of the CUPS source distribution and in the
|
||||
"cups" include directory and library files in the binary
|
||||
distributions. The GNU GPL applies to the remainder of the CUPS
|
||||
distribution, including the "pdftops" filter which is based upon
|
||||
Xpdf and the CUPS imaging library.</P>
|
||||
|
||||
<P>For those not familiar with the GNU GPL, the license basically
|
||||
allows you to:</P>
|
||||
@@ -42,21 +42,25 @@ allows you to:</P>
|
||||
<LI>Sell verbatim copies of the software for a media
|
||||
fee, or sell support for the software.</LI>
|
||||
|
||||
<LI>Distribute or sell printer drivers and filters that
|
||||
use CUPS so long as source code is made available under
|
||||
the GPL.</LI>
|
||||
|
||||
</UL>
|
||||
|
||||
<P>What this license <EM>does not</EM> allow you to do is make
|
||||
changes or add features to CUPS and then sell a binary
|
||||
distribution without source code. You must provide source for any
|
||||
changes or additions to the software, and all code must be
|
||||
provided under the GPL or LGPL as appropriate. The only
|
||||
new drivers, changes, or additions to the software, and all code
|
||||
must be provided under the GPL or LGPL as appropriate. The only
|
||||
exceptions to this are the portions of the CUPS software covered
|
||||
by the Apple operating system license exceptions outlined later
|
||||
in this license agreement.</P>
|
||||
|
||||
<P>The GNU LGPL relaxes the "link-to" restriction, allowing you
|
||||
to develop applications that use the CUPS and CUPS Imaging
|
||||
libraries under other licenses and/or conditions as appropriate
|
||||
for your application, driver, or filter.</P>
|
||||
to develop applications that use the CUPS API library under other
|
||||
licenses and/or conditions as appropriate for your
|
||||
application.</P>
|
||||
|
||||
|
||||
<H2 CLASS="title"><A NAME="EXCEPTIONS">License Exceptions</A></H2>
|
||||
@@ -146,7 +150,7 @@ same high-quality standards as the original.</P>
|
||||
|
||||
<P>Easy Software Products also sells rights to the CUPS source
|
||||
code under a binary distribution license for vendors that are
|
||||
unable to release source code for their additions and
|
||||
unable to release source code for their drivers, additions, and
|
||||
modifications to CUPS under the GNU GPL and LGPL. For information
|
||||
please contact us at the address shown above.</P>
|
||||
|
||||
|
||||
@@ -139,10 +139,7 @@ specifies a CIDR netmask, as shown in Table 1.</P>
|
||||
|
||||
<P>The <CODE>@LOCAL</CODE> name will allow access from all local
|
||||
interfaces. The <CODE>@IF(name)</CODE> name will allow access
|
||||
from the named interface. In both cases, CUPS only allows access
|
||||
from the network that the interface(s) are configured for -
|
||||
requests arriving on the interface from a foreign network will
|
||||
<em>not</em> be accepted.</P>
|
||||
from the named interface.</P>
|
||||
|
||||
<P>The <CODE>Allow</CODE> directive must appear inside a <A
|
||||
HREF="#Location"><CODE>Location</CODE></A> or <A
|
||||
@@ -356,10 +353,7 @@ or bit count.</P>
|
||||
|
||||
<P>The <CODE>@LOCAL</CODE> name will allow browse data from all
|
||||
local interfaces. The <CODE>@IF(name)</CODE> name will allow
|
||||
browse data from the named interface. In both cases, CUPS only
|
||||
allows data from the network that the interface(s) are configured
|
||||
for - data arriving on the interface from a foreign network will
|
||||
<em>not</em> be allowed.</P>
|
||||
browse data from the named interface.</P>
|
||||
|
||||
|
||||
<H2 CLASS="title"><A NAME="BrowseDeny">BrowseDeny</A></H2>
|
||||
@@ -394,10 +388,7 @@ or bit count.</P>
|
||||
|
||||
<P>The <CODE>@LOCAL</CODE> name will block browse data from all
|
||||
local interfaces. The <CODE>@IF(name)</CODE> name will block
|
||||
browse data from the named interface. In both cases, CUPS only
|
||||
blocks data from the network that the interface(s) are configured
|
||||
for - data arriving on the interface from a foreign network will
|
||||
<em>not</em> be blocked.</P>
|
||||
browse data from the named interface.</P>
|
||||
|
||||
|
||||
<H2 CLASS="title"><A NAME="BrowseInterval">BrowseInterval</A></H2>
|
||||
@@ -990,10 +981,7 @@ specifies a CIDR netmask, a shown in <A HREF="TABLE1">Table
|
||||
|
||||
<P>The <CODE>@LOCAL</CODE> name will deny access from all local
|
||||
interfaces. The <CODE>@IF(name)</CODE> name will deny access from
|
||||
the named interface. In both cases, CUPS only denies access from
|
||||
the network that the interface(s) are configured for - requests
|
||||
arriving on the interface from a foreign network will
|
||||
<em>not</em> be denied.</P>
|
||||
the named interface.</P>
|
||||
|
||||
<P>The <CODE>Deny</CODE> directive must appear inside a <A
|
||||
HREF="#Location"><CODE>Location</CODE></A> or <A
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<!--
|
||||
"$Id: spec-ppd.html 6096 2006-11-14 17:06:28Z mike $"
|
||||
"$Id: spec-ppd.html 5496 2006-05-05 19:26:23Z mike $"
|
||||
|
||||
CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
|
||||
|
||||
@@ -95,35 +95,17 @@ for this printer driver.</p>
|
||||
<p>This boolean attribute notifies the RIP filters that the
|
||||
destination printer does not require the top and bottom margins
|
||||
of the <tt>ImageableArea</tt> swapped for the back page. The
|
||||
default is <tt>true</tt> when <tt>cupsFlipDuplex</tt> is <tt>true</tt> and <tt>false</tt> otherwise.</p>
|
||||
default value is <code>true</code>.</p>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre class='command'>
|
||||
<em>*% Flip the back side images</em>
|
||||
*cupsFlipDuplex: true
|
||||
|
||||
<em>*% Don't swap the top and bottom margins for the back side</em>
|
||||
*APDuplexRequiresFlippedMargin: false
|
||||
</pre>
|
||||
|
||||
<p>Also see the related <tt>cupsFlipDuplex</tt> attribute.</p>
|
||||
|
||||
<h3>cupsEvenDuplex</h3>
|
||||
|
||||
<p class='summary'>*cupsEvenDuplex: boolean</p>
|
||||
|
||||
<p>This boolean attribute notifies the RIP filters that the
|
||||
destination printer requires an even number of pages when 2-sided
|
||||
printing is selected. The default value is <code>false</code>.</p>
|
||||
|
||||
<p>Example:</p>
|
||||
|
||||
<pre class='command'>
|
||||
<em>*% Always send an even number of pages when duplexing</em>
|
||||
*cupsEvenDuplex: true
|
||||
</pre>
|
||||
|
||||
<h3>cupsFilter</h3>
|
||||
|
||||
<p class='summary'>*cupsFilter: "source/type cost program"</p>
|
||||
@@ -161,8 +143,7 @@ page. The default value is <code>false</code>.</p>
|
||||
*cupsFlipDuplex: true
|
||||
</pre>
|
||||
|
||||
<p>Also see the related <tt>APDuplexRequiresFlippedMargins</tt>
|
||||
attribute.</p>
|
||||
<p>Also see the related <tt>APDuplexRequiresFlippedMargins</tt> attribute.</p>
|
||||
|
||||
<h3>cupsIPPReason</h3>
|
||||
|
||||
|
||||
|
Antes Largura: | Altura: | Tamanho: 667 B |