From a74454a757c35671e1cbf71870231a3d51945858 Mon Sep 17 00:00:00 2001 From: jlovell Date: Fri, 5 May 2006 19:18:41 +0000 Subject: [PATCH] Load cups into easysw/current. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@145 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES.txt | 47 +- Makedefs.in | 7 +- backend/Makefile | 17 +- backend/ipp.c | 6 +- backend/lpd.c | 6 +- backend/pap.c | 1568 ++++ backend/snmp.c | 22 +- backend/usb-darwin.c | 20 +- cgi-bin/template.c | 37 +- config-scripts/cups-common.m4 | 4 +- config-scripts/cups-compiler.m4 | 18 +- config-scripts/cups-defaults.m4 | 6 +- config-scripts/cups-directories.m4 | 4 +- config-scripts/cups-image.m4 | 4 +- config-scripts/cups-launchd.m4 | 4 +- config-scripts/cups-ldap.m4 | 4 +- config-scripts/cups-libtool.m4 | 4 +- config-scripts/cups-manpages.m4 | 4 +- config-scripts/cups-network.m4 | 4 +- config-scripts/cups-opsys.m4 | 4 +- config-scripts/cups-pam.m4 | 4 +- config-scripts/cups-pap.m4 | 37 + config-scripts/cups-pdf.m4 | 4 +- config-scripts/cups-scripting.m4 | 4 +- config-scripts/cups-sharedlibs.m4 | 4 +- config-scripts/cups-slp.m4 | 4 +- config-scripts/cups-ssl.m4 | 4 +- config-scripts/cups-threads.m4 | 4 +- config.h.in | 11 +- configure.in | 5 +- cups/Makefile | 6 +- cups/array.c | 9 +- cups/getifaddrs.c | 8 +- cups/http-private.h | 11 +- cups/libcups_s.exp | 3 +- cups/request.c | 6 +- cups/string.h | 9 +- cups/testppd.c | 122 +- doc/help/ref-cupsd-conf.html | 38 + doc/help/whatsnew.html | 23 +- doc/pl/images/button-publish-printer.gif | Bin 638 -> 579 bytes doc/pl/images/button-start-class.gif | Bin 475 -> 544 bytes doc/pl/images/button-start-printer.gif | Bin 490 -> 606 bytes doc/pl/images/button-unpublish-printer.gif | Bin 702 -> 613 bytes filter/Makefile | 16 +- filter/imagetoraster.c | 514 +- filter/interpret.c | 48 +- filter/raster.h | 9 +- man/Makefile | 7 +- man/subscriptions.conf.man | 98 + packaging/cups.list.in | 8 +- pdftops/Decrypt.cxx | 6 + pdftops/Makefile | 25 +- pdftops/Splash.cxx | 3191 ------- pdftops/Splash.h | 204 - pdftops/SplashBitmap.cxx | 243 - pdftops/SplashBitmap.h | 55 - pdftops/SplashClip.cxx | 270 - pdftops/SplashClip.h | 97 - pdftops/SplashErrorCodes.h | 32 - pdftops/SplashFTFont.cxx | 320 - pdftops/SplashFTFont.h | 55 - pdftops/SplashFTFontEngine.cxx | 144 - pdftops/SplashFTFontEngine.h | 61 - pdftops/SplashFTFontFile.cxx | 111 - pdftops/SplashFTFontFile.h | 70 - pdftops/SplashFont.cxx | 172 - pdftops/SplashFont.h | 97 - pdftops/SplashFontEngine.cxx | 253 - pdftops/SplashFontEngine.h | 86 - pdftops/SplashFontFile.cxx | 55 - pdftops/SplashFontFile.h | 60 - pdftops/SplashFontFileID.cxx | 23 - pdftops/SplashFontFileID.h | 30 - pdftops/SplashGlyphBitmap.h | 26 - pdftops/SplashMath.h | 78 - pdftops/SplashOutputDev.cxx | 2640 ------ pdftops/SplashOutputDev.h | 222 - pdftops/SplashPath.cxx | 178 - pdftops/SplashPath.h | 112 - pdftops/SplashPattern.cxx | 68 - pdftops/SplashPattern.h | 90 - pdftops/SplashScreen.cxx | 141 - pdftops/SplashScreen.h | 50 - pdftops/SplashState.cxx | 110 - pdftops/SplashState.h | 91 - pdftops/SplashT1Font.cxx | 264 - pdftops/SplashT1Font.h | 53 - pdftops/SplashT1FontEngine.cxx | 124 - pdftops/SplashT1FontEngine.h | 53 - pdftops/SplashT1FontFile.cxx | 96 - pdftops/SplashT1FontFile.h | 57 - pdftops/SplashTypes.h | 139 - pdftops/SplashXPath.cxx | 414 - pdftops/SplashXPath.h | 92 - pdftops/SplashXPathScanner.cxx | 285 - pdftops/SplashXPathScanner.h | 74 - scheduler/auth.c | 5 +- scheduler/client.c | 32 +- scheduler/conf.c | 23 +- scheduler/filter.c | 137 +- scheduler/job.c | 35 +- scheduler/log.c | 36 +- scheduler/main.c | 14 +- scheduler/mime.c | 18 +- scheduler/mime.h | 5 +- scheduler/printers.c | 6 +- scheduler/server.c | 8 +- standards/rfc1213.txt | 3923 ++++++++ standards/rfc2578.txt | 2541 ++++++ standards/rfc3805.txt | 9579 ++++++++++++++++++++ templates/classes.tmpl | 22 +- templates/edit-config.tmpl.in | 2 +- templates/es/classes.tmpl | 22 +- templates/es/edit-config.tmpl.in | 2 +- templates/es/printers.tmpl | 26 +- templates/ja/classes.tmpl | 22 +- templates/ja/edit-config.tmpl.in | 2 +- templates/ja/printers.tmpl | 26 +- templates/pl/admin.tmpl | 2 +- templates/pl/classes.tmpl | 28 +- templates/pl/edit-config.tmpl.in | 2 +- templates/pl/printers.tmpl | 32 +- templates/printers.tmpl | 26 +- templates/sv/classes.tmpl | 22 +- templates/sv/edit-config.tmpl.in | 2 +- templates/sv/printers.tmpl | 26 +- test/4.2-cups-printer-ops.test | 8 +- test/4.3-job-ops.test | 8 +- test/run-stp-tests.sh | 70 +- 130 files changed, 18717 insertions(+), 11918 deletions(-) create mode 100644 backend/pap.c create mode 100644 config-scripts/cups-pap.m4 create mode 100644 man/subscriptions.conf.man delete mode 100644 pdftops/Splash.cxx delete mode 100644 pdftops/Splash.h delete mode 100644 pdftops/SplashBitmap.cxx delete mode 100644 pdftops/SplashBitmap.h delete mode 100644 pdftops/SplashClip.cxx delete mode 100644 pdftops/SplashClip.h delete mode 100644 pdftops/SplashErrorCodes.h delete mode 100644 pdftops/SplashFTFont.cxx delete mode 100644 pdftops/SplashFTFont.h delete mode 100644 pdftops/SplashFTFontEngine.cxx delete mode 100644 pdftops/SplashFTFontEngine.h delete mode 100644 pdftops/SplashFTFontFile.cxx delete mode 100644 pdftops/SplashFTFontFile.h delete mode 100644 pdftops/SplashFont.cxx delete mode 100644 pdftops/SplashFont.h delete mode 100644 pdftops/SplashFontEngine.cxx delete mode 100644 pdftops/SplashFontEngine.h delete mode 100644 pdftops/SplashFontFile.cxx delete mode 100644 pdftops/SplashFontFile.h delete mode 100644 pdftops/SplashFontFileID.cxx delete mode 100644 pdftops/SplashFontFileID.h delete mode 100644 pdftops/SplashGlyphBitmap.h delete mode 100644 pdftops/SplashMath.h delete mode 100644 pdftops/SplashOutputDev.cxx delete mode 100644 pdftops/SplashOutputDev.h delete mode 100644 pdftops/SplashPath.cxx delete mode 100644 pdftops/SplashPath.h delete mode 100644 pdftops/SplashPattern.cxx delete mode 100644 pdftops/SplashPattern.h delete mode 100644 pdftops/SplashScreen.cxx delete mode 100644 pdftops/SplashScreen.h delete mode 100644 pdftops/SplashState.cxx delete mode 100644 pdftops/SplashState.h delete mode 100644 pdftops/SplashT1Font.cxx delete mode 100644 pdftops/SplashT1Font.h delete mode 100644 pdftops/SplashT1FontEngine.cxx delete mode 100644 pdftops/SplashT1FontEngine.h delete mode 100644 pdftops/SplashT1FontFile.cxx delete mode 100644 pdftops/SplashT1FontFile.h delete mode 100644 pdftops/SplashTypes.h delete mode 100644 pdftops/SplashXPath.cxx delete mode 100644 pdftops/SplashXPath.h delete mode 100644 pdftops/SplashXPathScanner.cxx delete mode 100644 pdftops/SplashXPathScanner.h create mode 100644 standards/rfc1213.txt create mode 100644 standards/rfc2578.txt create mode 100644 standards/rfc3805.txt diff --git a/CHANGES.txt b/CHANGES.txt index 64fc2de68..017c0de68 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,51 @@ -CHANGES.txt - 2006-04-24 +CHANGES.txt - 2006-05-05 ------------------------ +CHANGES IN CUPS V1.2 + + - Documentation updates (STR #1618, STR #1620, STR #1622, + STR #1637) + - Static file copy buffers reduced from 64k to 32k to + work around bogus MallocDebug library assumptions (STR + #1660) + - The scheduler did not decode the backend exit code + properly (STR #1648) + - The MacOS X USB backend did not report the 1284 device ID, + nor did it fix device IDs returned by HP printers. + - The scheduler started more slowly than 1.1.x with large + numbers of printers (STR #1653) + - cupsRasterInterpretPPD() didn't support the + cupsPreferredBitsPerColor attribute, and imagetoraster + didn't use the new API. + - The "make test" script did not create all of the necessary + subdirectories for testing (STR #1638) + - The scheduler did not prevent rotation of logs + redirected to /dev/null (STR #1651) + - "make test" did not include the SNMP backend in the + test environment (STR #1625) + - The EPM packaging files did not work (STR #1621) + - "Use Default Configuration" inserted a broken + configuration file (STR #1624) + - Redirects in the web interface did not always preserve + the encrypted status of a connection (STR #1603) + - Added the Apple "pap" backend. + - Added CUPS library to CUPS Image shared library + linkage to support Linux --as-needed linker option + (STR #1606) + - Fixed support for --enable-pie (STR #1609) + - The pdftops filter did not validate the length of the + encryption key (STR #1608) + - Updated the Polish localization. + - "Encryption Required" in the cupsd.conf file now only + requires encryption when the connection is not over the + loopback interface or domain socket. + - Printer names containing "+" were not quoted properly in + the web interface (STR #1600) + - The SNMP backend now reports the make and model in the + information string so that the auto-generated printer + name is more useful than just an IP address. + + CHANGES IN CUPS V1.2rc3 - The cups-lpd program always did reverse lookups on the diff --git a/Makedefs.in b/Makedefs.in index b415a0c2d..29d2de84a 100644 --- a/Makedefs.in +++ b/Makedefs.in @@ -1,5 +1,5 @@ # -# "$Id: Makedefs.in 5384 2006-04-07 18:03:16Z mike $" +# "$Id: Makedefs.in 5468 2006-04-27 13:40:30Z mike $" # # Common makefile definitions for the Common UNIX Printing System (CUPS). # @@ -130,13 +130,14 @@ DSOLIBS = @DSOLIBS@ $(COMMONLIBS) IMGLIBS = @IMGLIBS@ -lm IMGFILTERS = @IMGFILTERS@ LDFLAGS = -L../cups -L../filter $(RC_CFLAGS) $(ARCHFLAGS) \ - @LDFLAGS@ $(OPTIM) + @LDFLAGS@ @PIEFLAGS@ $(OPTIM) LINKCUPS = @LINKCUPS@ $(SSLLIBS) LINKCUPSIMAGE = @LINKCUPSIMAGE@ LIBS = $(LINKCUPS) $(COMMONLIBS) OPTIM = @OPTIM@ OPTIONS = PAMLIBS = @PAMLIBS@ +PAP = @PAP@ PDFTOPS = @PDFTOPS@ PHPDIR = @PHPDIR@ SSLFLAGS = @SSLFLAGS@ @@ -260,5 +261,5 @@ DBUSDIR = @DBUSDIR@ # -# End of "$Id: Makedefs.in 5384 2006-04-07 18:03:16Z mike $" +# End of "$Id: Makedefs.in 5468 2006-04-27 13:40:30Z mike $" # diff --git a/backend/Makefile b/backend/Makefile index 807a78efd..2a1de0437 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 5429 2006-04-18 21:18:51Z mike $" +# "$Id: Makefile 5469 2006-04-27 13:58:43Z mike $" # # Backend makefile for the Common UNIX Printing System (CUPS). # @@ -27,9 +27,9 @@ include ../Makedefs RBACKENDS = ipp lpd -UBACKENDS = parallel scsi serial snmp socket usb +UBACKENDS = $(PAP) parallel scsi serial snmp socket usb TARGETS = betest test1284 $(RBACKENDS) $(UBACKENDS) -OBJS = betest.o ipp.o lpd.o parallel.o scsi.o \ +OBJS = betest.o ipp.o lpd.o pap.o parallel.o scsi.o \ serial.o snmp.o socket.o test1284.o usb.o @@ -136,6 +136,15 @@ lpd: lpd.o ../cups/$(LIBCUPS) $(CC) $(LDFLAGS) -o lpd lpd.o $(LIBS) +# +# pap +# + +pap: pap.o ../cups/$(LIBCUPS) + echo Linking $@... + $(CC) $(LDFLAGS) -o pap pap.o $(BACKLIBS) $(LIBS) -framework AppleTalk + + # # parallel # @@ -201,5 +210,5 @@ include Dependencies # -# End of "$Id: Makefile 5429 2006-04-18 21:18:51Z mike $". +# End of "$Id: Makefile 5469 2006-04-27 13:58:43Z mike $". # diff --git a/backend/ipp.c b/backend/ipp.c index c3b3e7176..a2ca39e32 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp.c 5261 2006-03-09 20:47:49Z mike $" + * "$Id: ipp.c 5495 2006-05-05 17:58:07Z mike $" * * IPP backend for the Common UNIX Printing System (CUPS). * @@ -1215,7 +1215,7 @@ compress_files(int num_files, /* I - Number of files */ *out; /* Output file */ struct stat outinfo; /* Output file information */ char filename[1024], /* Temporary filename */ - buffer[65536]; /* Copy buffer */ + buffer[32768]; /* Copy buffer */ fprintf(stderr, "DEBUG: Compressing %d job files...\n", num_files); @@ -1619,5 +1619,5 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: ipp.c 5261 2006-03-09 20:47:49Z mike $". + * End of "$Id: ipp.c 5495 2006-05-05 17:58:07Z mike $". */ diff --git a/backend/lpd.c b/backend/lpd.c index 5a2f1c313..ef7ef05d3 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -1,5 +1,5 @@ /* - * "$Id: lpd.c 5241 2006-03-07 22:07:44Z mike $" + * "$Id: lpd.c 5495 2006-05-05 17:58:07Z mike $" * * Line Printer Daemon backend for the Common UNIX Printing System (CUPS). * @@ -590,7 +590,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ #endif /* __APPLE__ */ size_t nbytes; /* Number of bytes written */ off_t tbytes; /* Total bytes written */ - char buffer[65536]; /* Output buffer */ + char buffer[32768]; /* Output buffer */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) struct sigaction action; /* Actions for POSIX signals */ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */ @@ -1230,5 +1230,5 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: lpd.c 5241 2006-03-07 22:07:44Z mike $". + * End of "$Id: lpd.c 5495 2006-05-05 17:58:07Z mike $". */ diff --git a/backend/pap.c b/backend/pap.c new file mode 100644 index 000000000..f5eadae33 --- /dev/null +++ b/backend/pap.c @@ -0,0 +1,1568 @@ +/* +* "$Id: pap.c 5480 2006-05-02 15:17:04Z mike $" +* +* © Copyright 2004 Apple Computer, Inc. All rights reserved. +* +* IMPORTANT: This Apple software is supplied to you by Apple Computer, +* Inc. ("Apple") in consideration of your agreement to the following +* terms, and your use, installation, modification or redistribution of +* this Apple software constitutes acceptance of these terms. If you do +* not agree with these terms, please do not use, install, modify or +* redistribute this Apple software. +* +* In consideration of your agreement to abide by the following terms, and +* subject to these terms, Apple grants you a personal, non-exclusive +* license, under AppleÕs copyrights in this original Apple software (the +* "Apple Software"), to use, reproduce, modify and redistribute the Apple +* Software, with or without modifications, in source and/or binary forms; +* provided that if you redistribute the Apple Software in its entirety and +* without modifications, you must retain this notice and the following +* text and disclaimers in all such redistributions of the Apple Software. +* Neither the name, trademarks, service marks or logos of Apple Computer, +* Inc. may be used to endorse or promote products derived from the Apple +* Software without specific prior written permission from Apple. Except +* as expressly stated in this notice, no other rights or licenses, express +* or implied, are granted by Apple herein, including but not limited to +* any patent rights that may be infringed by your derivative works or by +* other works in which the Apple Software may be incorporated. +* +* The Apple Software is provided by Apple on an "AS IS" basis. APPLE +* MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION +* THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS +* FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND +* OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. +* +* IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL +* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, +* MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED +* AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), +* STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE +* 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. +* +* Contents: +* +* main() - Send a file to the specified Appletalk printer. +* listDevices() - List all LaserWriter printers in the local zone. +* printFile() - Print from a file descriptor to an NBP specified printer. +* papOpen() - Open a pap session to a printer. +* papClose() - Close a pap session after cleaning up pending transactions. +* papWrite() - Write bytes to a printer. +* 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 - 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. +* connectTimeout() - Returns the connect timeout preference value. +* signalHandler() - handle SIGINT to close the session before quiting. +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#ifdef HAVE_APPLETALK_AT_PROTO_H +# include +#else +/* These definitions come from at_proto.h... */ +# define ZIP_DEF_INTERFACE NULL +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_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 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 zip_getmyzone(char *ifName, at_nvestr_t *zone); +#endif /* HAVE_APPLETALK_AT_PROTO_H */ + +#include +#include +#include + +/* Defines */ +#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 + +#define CONNID_OF(p) (((u_char *)&p)[0]) +#define TYPE_OF(p) (((u_char *)&p)[1]) +#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" : \ + "" + +#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 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: 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(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); +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 int connectTimeout(void); +static void signalHandler(int sigraised); + + +/*! + * @function main + * @abstract Send a file to the specified AppleTalk PAP address. + * + * Usage: printer-uri job-id user title copies options [file] + * + * @param argc # of arguments + * @param argv array of arguments + * + * @result A non-zero return value for errors + */ +int main (int argc, const char * argv[]) +{ + int err = 0; + FILE *fp; /* Print file */ + int copies; /* Number of copies to print */ + char name[NBP_NVE_STR_SIZE + 1]; /* +1 for a nul */ + char type[NBP_NVE_STR_SIZE + 1]; /* +1 for a nul */ + char zone[NBP_NVE_STR_SIZE + 1]; /* +1 for a nul */ + + /* Make sure status messages are not buffered... */ + setbuf(stderr, NULL); + + if (argc == 1 || (argc == 2 && strcmp(argv[1], "-discover") == 0)) + { + /* Ignore errors returned by listDevices - they may be transitory + * and we don't want cupsd to think that pap is forever unusable. + */ + listDevices(); + return 0; + } + + if (argc < 6 || argc > 7) + { + fprintf(stderr, "argc = %d\n", argc); + for (err = 0; err < argc; err++) { + fprintf(stderr, "%02d:%s\n", err, argv[err]); + } + fprintf(stderr, "Usage: pap job-id user title copies options [file]\n"); + exit(EINVAL); + } + + /* If we have 7 arguments, print the file named on the command-line. + * Otherwise, send stdin instead... + */ + if (argc == 6) + { + fp = stdin; + copies = 1; + } + else + { + fprintf(stderr, "DEBUG: opening print file \"%s\"\n", argv[6]); + + /* Try to open the print file... */ + if ((fp = fopen(argv[6], "rb")) == NULL) + { + fprintf(stderr, "ERROR: unable to open print file \"%s\": %s\n", argv[6], strerror(errno)); + return (1); + } + + copies = atoi(argv[4]); + } + + /* Extract the device name and options from the URI... */ + parseUri(argv[0], name, type, zone); + + err = printFile(name, type, zone, fileno(fp), 3, STDERR_FILENO, copies, argc); + + if (fp != stdin) + fclose(fp); + + /* Only clear the last status if there wasn't an error */ + if (err == noErr && !gErrorlogged) + fprintf(stderr, "INFO:\n"); + + return err; +} + + +/*! + * @function listDevices + * @abstract Print a list of all LaserWriter type devices registered in the default zone. + * + * @result A non-zero return value for errors + */ +static int listDevices(void) +{ + int err = noErr; + int ind; + int numberFound; + + at_nvestr_t at_zone; + at_entity_t entity; + at_nbptuple_t buf[MAX_PRINTERS]; + at_retry_t retry; + char name[NBP_NVE_STR_SIZE+1]; + char encodedName[(3 * NBP_NVE_STR_SIZE) + 1]; + char zone[NBP_NVE_STR_SIZE+1]; + char encodedZone[(3 * NBP_NVE_STR_SIZE) + 1]; + + /* Make sure it's okay to use appletalk */ + if (!okayToUseAppleTalk()) + { + fprintf(stderr, "ERROR: AppleTalk disabled in System Preferences\n"); + return -1; /* Network is down */ + } + + if ((err = zip_getmyzone(ZIP_DEF_INTERFACE, &at_zone)) != 0) + { + 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'; + + err = addPercentEscapes(zone, encodedZone, sizeof(encodedZone)); + + /* Look up all the printers in our zone */ + nbp_make_entity(&entity, "=", "LaserWriter", zone); + retry.retries = 1; + retry.interval = 1; + retry.backoff = 1; + + if ((numberFound = nbp_lookup(&entity, buf, MAX_PRINTERS, &retry)) < 0) + { + perror("ERROR: Unable to lookup AppleTalk printers"); + return numberFound; + } + + if (numberFound >= MAX_PRINTERS) + fprintf(stderr, "WARNING: Adding only the first %d printers found", MAX_PRINTERS); + + /* Not required but sort them so they look nice */ + qsort(buf, numberFound, sizeof(at_nbptuple_t), nbptuple_compare); + + for (ind = 0; ind < numberFound; ind++) + { + 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) + { + /* Each line is of the form: "class URI "make model" "info" */ + char make_model[128], /* Make and model */ + *ptr; + + + if ((ptr = strchr(name, ' ')) != NULL) + { + /* + * If the printer name contains spaces, it is probably a make and + * model... + */ + + if (!strncmp(name, "ET00", 4)) + { + /* + * Drop leading ethernet address info... + */ + + strlcpy(make_model, ptr + 1, sizeof(make_model)); + } + else + strlcpy(make_model, name, sizeof(make_model)); + } + else + strcpy(make_model, "Unknown"); + + printf("network pap://%s/%s/LaserWriter \"%s\" \"%s AppleTalk\"\n", + encodedZone, encodedName, make_model, name); + } + } + return numberFound; +} + + +/*! + * @function printFile + * @abstract Open a PAP session and send the data from the input socket to the printer. + * + * @param name NBP name + * @param zone NBP zone + * @param type NBP type + * @param fdin File descriptor to read data from + * @param fdout File descriptor to write printer responses to + * @param fderr File descriptor to write printer status to + * @param copies # of copies to send (in case in the converter couldn't handle this for us). + * @param argc # of command line arguments. + * + * @result A non-zero return value for errors + */ +static int printFile(char* name, char* type, char* zone, int fdin, int fdout, int fderr, int copies, int argc) +{ + int err; + int rc; + int val; + int len, ind; + + char fileBuffer[4096]; /* File buffer */ + int fileBufferNbytes; + off_t fileTbytes; + int fileEOFRead; + int fileEOFSent; + + char sockBuffer[4096 + 1]; /* Socket buffer with room for nul */ + char atpReqBuf[AT_PAP_DATA_SIZE]; + fd_set readSet; + + at_nbptuple_t tuple; + at_inet_t sendDataAddr; + at_inet_t src; + at_resp_t resp; + int userdata, xo, reqlen; + u_short tid; + u_char bitmap; + int maxfdp1; + struct timeval timeout, *timeoutPtr; + u_char flowQuantum = 1; + u_short recvSequence = 0; + time_t now, + 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 */ +#endif /* HAVE_SIGACTION && !HAVE_SIGSET */ + + /* try to find our printer */ + if ((err = nbp_make_entity(&entity, name, type, zone)) != noErr) + { + fprintf(stderr, "ERROR: Unable to make AppleTalk address: %s\n", strerror(errno)); + goto Exit; + } + + /* + * Remember when we started looking for the printer. + */ + + connect_time = time(NULL); + + retry.interval = 1; + retry.retries = 5; + retry.backoff = 0; + + /* Loop forever trying to get an open session with the printer. */ + for (;;) + { + /* Make sure it's okay to use appletalk */ + if (okayToUseAppleTalk()) + { + /* 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 (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(errno)); + } + else + { + fprintf(stderr, "WARNING: recoverable: Printer not responding\n"); + recoverableErrShown = true; + } + } + else + { + fprintf(stderr, "WARNING: recoverable: AppleTalk disabled in System Preferences.\n"); + recoverableErrShown = true; + } + + retry.retries = 3; + elasped_time = time(NULL) - connect_time; + + if (connect_timeout == -1) + connect_timeout = connectTimeout(); + + if (connect_timeout && elasped_time > connect_timeout) + { + fprintf(stderr, "ERROR: Printer not responding\n"); + err = ETIMEDOUT; + goto Exit; /* Waiting too long... */ + } + else if (elasped_time < 30 /*(30 * 60)*/) + sleep_time = 10; /* Waiting < 30 minutes */ + else if (elasped_time < 60 /*(24 * 60 * 60)*/) + sleep_time = 30; /* Waiting < 24 hours */ + else + sleep_time = 60; /* Waiting > 24 hours */ + + fprintf(stderr, "DEBUG: sleeping %d seconds...\n", (int)sleep_time); + sleep(sleep_time); + } + + /* + * 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 + * current page... if we are printing data from a file then catch the + * signal so we can send a PAP Close packet (otherwise you can't cancel + * raw jobs...) + */ + +#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */ + sigset(SIGTERM, (argc < 7) ? SIG_IGN : signalHandler); +#elif defined(HAVE_SIGACTION) + memset(&action, 0, sizeof(action)); + + sigemptyset(&action.sa_mask); + action.sa_handler = (argc < 7) ? SIG_IGN : signalHandler; + sigaction(SIGTERM, &action, NULL); +#else + signal(SIGTERM, (argc < 7) ? SIG_IGN : signalHandler); + +#ifdef DEBUG + /* Makes debugging easier; otherwise printer will be busy for several minutes */ + signal(SIGINT, signalHandler); +#endif /* DEBUG */ + +#endif /* HAVE_SIGSET */ + + fprintf(stderr, "INFO: Sending data\n"); + + sendDataAddr = tuple.enu_addr; + + /* Start the tickle packets and set a timeout alarm */ + if ((err = papSendRequest(gSockfd, &gSessionAddr, gConnID, AT_PAP_TYPE_TICKLE, 0, false, false)) < 0) + { + perror("ERROR: Unable to send PAP tickle request"); + goto Exit; + } + signal(SIGALRM, signalHandler); + alarm(PAP_TIMEOUT); + + /* Prime the pump with an initial send-data packet */ + if ((err = papSendRequest(gSockfd, &gSessionAddr, gConnID, AT_PAP_TYPE_SEND_DATA, 0xFF, true, true)) < 0) + { + perror("ERROR: Unable to send initial PAP send data request"); + goto Exit; + } + + /* Set non-blocking mode on our data source descriptor */ + 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; + maxfdp1 = MAX(fdin, gSockfd) + 1; + + if (gStatusInterval != 0) + { + timeout.tv_usec = 0; + nextStatusTime = time(NULL) + gStatusInterval; + timeoutPtr = &timeout; + } + else + timeoutPtr = NULL; + + + for (;;) + { + /* Set up our descriptors for the select */ + FD_ZERO(&readSet); + FD_SET(gSockfd, &readSet); + + if (fileBufferNbytes == 0 && fileEOFRead == false) + FD_SET(fdin, &readSet); + + /* Set the select timeout value based on the next status interval */ + if (gStatusInterval != 0) + { + now = time(NULL); + timeout.tv_sec = (nextStatusTime > now) ? nextStatusTime - now : 1; + } + + /* Wait here for something interesting to happen */ + if ((err = select(maxfdp1, &readSet, 0, 0, timeoutPtr)) < 0) + { + perror("ERROR: select"); + break; + } + + if (err == 0 || (gStatusInterval != 0 && time(NULL) >= nextStatusTime)) + { + /* Time to send a status request */ + if ((err = papSendRequest(gSockfd, &tuple.enu_addr, 0, AT_PAP_TYPE_SEND_STATUS, 0x01, false, false)) < 0) + perror("WARNING: Unable to send PAP status request"); + + if (gStatusInterval) + nextStatusTime = time(NULL) + gStatusInterval; + } + + /* Was there an event on the input stream? */ + if (FD_ISSET(fdin, &readSet)) + { + FD_CLR(fdin, &readSet); + + assert(fileBufferNbytes == 0); + fileBufferNbytes = read(fdin, fileBuffer, MIN(sizeof(fileBuffer), AT_PAP_DATA_SIZE * flowQuantum)); + if (fileBufferNbytes == 0) + fileEOFRead = true; + + if (fileEOFSent == false && fileBufferNbytes >= 0 && gSendDataID != 0) + { + fprintf(stderr, "DEBUG: -> PAP_DATA %d bytes %s\n", fileBufferNbytes, fileEOFRead ? "with EOF" : ""); + papWrite(gSockfd, &sendDataAddr, gSendDataID, gConnID, flowQuantum, fileBuffer, fileBufferNbytes, fileEOFRead); + + fileTbytes += fileBufferNbytes; + if (argc > 6 && !gErrorlogged) + fprintf(stderr, "DEBUG: Sending print file, %qd bytes\n", (off_t)fileTbytes); + + fileBufferNbytes = 0; + gSendDataID = 0; + if (fileEOFRead) + { + fileEOFSent = true; + if (gWaitEOF == false || fileTbytes == 0) + { + err = 0; + goto Exit; + } + } + } + } + + /* Was there an event on the output stream? */ + if (FD_ISSET(gSockfd, &readSet)) + { + if ((rc = atp_look(gSockfd)) < 0) + { + perror("ERROR: Unable to look for PAP response"); + break; + } + + if (rc > 0) + { + /* It's an ATP response */ + resp.resp[0].iov_base = sockBuffer; + resp.resp[0].iov_len = sizeof(sockBuffer) - 1; + resp.bitmap = 0x01; + + if ((err = atp_getresp(gSockfd, &tid, &resp)) < 0) + { + perror("ERROR: Unable to get PAP response"); + break; + } + userdata = resp.userdata[0]; + } + else + { + /* It's an ATP request */ + reqlen = sizeof(atpReqBuf); + if ((err = atp_getreq(gSockfd, &src, atpReqBuf, &reqlen, &userdata, &xo, &tid, &bitmap, 0)) < 0) + { + perror("ERROR: Unable to get PAP request"); + break; + } + } + + fprintf(stderr, "DEBUG: <- %s\n", PAPPacketStr(TYPE_OF(userdata))); + + switch (TYPE_OF(userdata)) + { + case AT_PAP_TYPE_SEND_STS_REPLY: /* Send-Status-Reply packet */ + if (resp.bitmap & 1) + { + char *iov_base = (char *)resp.resp[0].iov_base; + statusUpdate(&iov_base[5], iov_base[4]); + } + break; + + case AT_PAP_TYPE_SEND_DATA: /* Send-Data packet */ + sendDataAddr.socket = src.socket; + gSendDataID = tid; + recvSequence = OSReadBigInt16(&SEQUENCE_NUM(userdata), 0); + + if ((fileBufferNbytes > 0 || fileEOFRead) && fileEOFSent == false) + { + fprintf(stderr, "DEBUG: -> PAP_DATA %d bytes %s\n", fileBufferNbytes, fileEOFRead ? "with EOF" : ""); + papWrite(gSockfd, &sendDataAddr, gSendDataID, gConnID, flowQuantum, fileBuffer, fileBufferNbytes, fileEOFRead); + + fileTbytes += fileBufferNbytes; + if (argc > 6 && !gErrorlogged) + fprintf(stderr, "DEBUG: Sending print file, %qd bytes\n", (off_t)fileTbytes); + + fileBufferNbytes = 0; + gSendDataID = 0; + if (fileEOFRead) + { + fileEOFSent = true; + if (gWaitEOF == false) + { + err = 0; + goto Exit; + } + } + } + break; + + case AT_PAP_TYPE_DATA: /* Data packet */ + for (len=0, ind=0; ind < ATP_TRESP_MAX; ind++) + { + 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" : ""); + + if (len > 0) + { + char *pLineBegin, *pCommentEnd, *pChar; + char *logLevel; + char logstr[512]; + int logstrlen; + + write(fdout, sockBuffer, len); + + sockBuffer[len] = '\0'; /* We always reserve room for the nul so we can use strstr() below*/ + pLineBegin = sockBuffer; + + /* If there are PostScript status comments in the buffer log them. + * + * This logic shouldn't be in the backend but until we get backchannel + * data in CUPS 1.2 it has to live here. + */ + while (pLineBegin < sockBuffer + len && + (pLineBegin = strstr(pLineBegin, "%%[")) != NULL && + (pCommentEnd = strstr(pLineBegin, "]%%")) != NULL) + { + pCommentEnd += 3; /* Skip past "]%%" */ + *pCommentEnd = '\0'; /* There's always room for the nul */ + + /* Strip the CRs & LFs before writing it to stderr */ + for (pChar = pLineBegin; pChar < pCommentEnd; pChar++) + if (*pChar == '\r' || *pChar == '\n') + *pChar = ' '; + + if (strncasecmp(pLineBegin, "%%[ Error:", 10) == 0) + { + /* logLevel should be "ERROR" here but this causes PrintCenter + * to pause the queue which in turn clears this error, which + * restarts the job. So the job ends up in an infinite loop with + * the queue being held/un-held. Just make it DEBUG for now until + * we fix notifications later. + */ + logLevel = "DEBUG"; + gErrorlogged = true; + } + else if (strncasecmp(pLineBegin, "%%[ Flushing", 12) == 0) + logLevel = "DEBUG"; + else + logLevel = "INFO"; + + if ((logstrlen = snprintf(logstr, sizeof(logstr), "%s: %s\n", logLevel, pLineBegin)) >= sizeof(logstr)) + { + /* If the string was trucnated make sure it has a linefeed before the nul */ + logstrlen = sizeof(logstr) - 1; + logstr[logstrlen - 1] = '\n'; + } + + write(fderr, logstr, logstrlen); + + pLineBegin = pCommentEnd + 1; + } + } + + if (IS_PAP_EOF(userdata) != 0) + { + /* If this is EOF then were we expecting it? */ + if (fileEOFSent == true) + goto Exit; + else + { + fprintf(stderr, "WARNING: Printer sent unexpected EOF\n"); + } + } + + if ((err = papSendRequest(gSockfd, &gSessionAddr, gConnID, AT_PAP_TYPE_SEND_DATA, 0xFF, true, true)) < 0) + { + fprintf(stderr, "ERROR: Error %d sending PAPSendData resuest: %s\n", err, strerror(errno)); + goto Exit; + } + break; + + case AT_PAP_TYPE_TICKLE: /* Tickle packet */ + break; + + case AT_PAP_TYPE_CLOSE_CONN: /* Close-Connection packet */ + /* We shouldn't normally see this. */ + papCloseResp(gSockfd, &gSessionAddr, xo, tid, gConnID); + + /* If this is EOF then were we expecting it? */ + if (fileEOFSent == true) + { + fprintf(stderr, "WARNING: Printer sent unexpected EOF\n"); + } + else + { + fprintf(stderr, "ERROR: Printer sent unexpected EOF\n"); + } + goto Exit; + break; + + case AT_PAP_TYPE_OPEN_CONN: /* Open-Connection packet */ + case AT_PAP_TYPE_OPEN_CONN_REPLY: /* Open-Connection-Reply packet */ + case AT_PAP_TYPE_SEND_STATUS: /* Send-Status packet */ + case AT_PAP_TYPE_CLOSE_CONN_REPLY: /* Close-Connection-Reply packet */ + fprintf(stderr, "WARNING: Unexpected PAP packet of type %d\n", TYPE_OF(userdata)); + break; + + default: + fprintf(stderr, "WARNING: Unknown PAP packet of type %d\n", TYPE_OF(userdata)); + break; + } + + if (CONNID_OF(userdata) == gConnID) + { + /* Reset tickle timer */ + alarm(0); + alarm(PAP_TIMEOUT); + } + } + } + +Exit: + /* + * Close the socket and return... + */ + papClose(false); + + return err; +} + + +#pragma mark - +/*! + * @function papOpen + * @abstract Open a pap session to a printer. + * + * @param tuple nbp address of printer + * @param connID returned pap connection id + * @param fd returned socket descriptor + * @param sessionAddr returned session address + * @param flowQuantum returned flow quantum (usually 8) + * + * @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) +{ + int result, + 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; + + if (tuple == NULL) + { + errno = EINVAL; + return -1; + } + + fprintf(stderr, "INFO: Opening connection\n"); + + errno = 0; + result = 0; + + *fd = atp_open(&sock); + if (*fd < 0) + return -1; + + /* Build the open connection request packet. + */ + tm = time(NULL); + srand(tm); + + *connID = (rand()&0xff) | 0x01; + puserdata[0] = *connID; + puserdata[1] = AT_PAP_TYPE_OPEN_CONN; + puserdata[2] = 0; + puserdata[3] = 0; + + retry.interval = 2; + retry.retries = 5; + + resp.bitmap = 0x01; + resp.resp[0].iov_base = rdata; + resp.resp[0].iov_len = sizeof(rdata); + + data[0] = sock; + data[1] = 8; + + for (;;) + { + waitTime = (u_short)(time(NULL) - tm); + OSWriteBigInt16(&data[2], 0, waitTime); + + fprintf(stderr, "DEBUG: -> %s\n", PAPPacketStr(AT_PAP_TYPE_OPEN_CONN)); + + 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; + errno = EHOSTUNREACH; + sleep(1); + goto Exit; + } + else + { + 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 */ + } + + sleep(1); + } + + /* 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; + } + + return result; +} + + +/*! + * @function papClose + * @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(int abortflag) +{ + int fd; + u_short tmpID; + int result; + unsigned char rdata[ATP_DATA_SIZE]; + int userdata; + u_char *puserdata = (u_char *)&userdata; + at_resp_t resp; + at_retry_t retry; + + if (gSockfd != 0) + { + fd = gSockfd; + gSockfd = 0; + + alarm(0); + + /* Cancel the pending send-data and tickle trnsactions + */ + if (gSendDataID) + { + tmpID = gSendDataID; + gSendDataID = 0; + papCancelRequest(fd, tmpID); + } + + if (gTickleID) + { + tmpID = gTickleID; + gTickleID = 0; + papCancelRequest(fd, tmpID); + } + + /* This is a workaround for bug #2735145. The problem is papWrite() + * returns before the ATP TRel arrives for it. If we send the pap close packet + * before this release then the printer can drop the last data packets. + * The effect on an Epson printer is the last page doesn't print, on HP it + * doesn't close the pap session. + */ + if (gWaitEOF == false) + sleep(2); + + fprintf(stderr, "DEBUG: -> %s\n", PAPPacketStr(AT_PAP_TYPE_CLOSE_CONN)); + + puserdata[0] = gConnID; + puserdata[1] = AT_PAP_TYPE_CLOSE_CONN; + puserdata[2] = 0; + puserdata[3] = 0; + + retry.interval = 2; + retry.retries = 5; + + resp.bitmap = 0x01; + resp.resp[0].iov_base = rdata; + resp.resp[0].iov_len = sizeof(rdata); + + result = atp_sendreq(fd, &gSessionAddr, 0, 0, userdata, 1, 0, 0, &resp, &retry, 0); + + result = close(fd); + } + return noErr; +} + + +/*! + * @function papWrite + * @abstract Write bytes to a printer. + * + * @param sockfd socket descriptor + * @param dest destination address + * @param tid transaction id + * @param connID connection id + * @param flowQuantum returned flow quantum (usually 8) + * @param data pointer to the data + * @param len number of bytes to send + * @param eof pap eof flag + * + * @result A non-zero return value for errors + */ +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 ind; + u_char* puserdata; + at_resp_t resp; + + /* fprintf(stderr, "DEBUG: papWrite(%d%s) to %d,%d,%d; %d\n", len, eof ? " EOF":"", dest->net, dest->node, dest->socket, connID); */ + + if (len > AT_PAP_DATA_SIZE * flowQuantum) + { + fprintf(stderr, "DEBUG: papWrite() len of %d is too big!\n", len); + errno = E2BIG; + return -1; + } + + /* + * Break up the outgoing data into a set of + * response packets to reply to an incoming + * PAP 'SENDDATA' request + */ + for (ind = 0; ind < flowQuantum; ind++) + { + 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[ind].iov_base = (caddr_t)data; + + if (data) + data += AT_PAP_DATA_SIZE; + + 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 << (ind + 1)) - 1; + + /* + * Write out the data as a PAP 'DATA' response + */ + errno = 0; + if ((result = atp_sendrsp(sockfd, dest, true, tid, &resp)) < 0) + { + fprintf(stderr, "DEBUG: atp_sendrsp() returns %d, errno %d \"%s\"\n", result, errno, strerror(errno)); + return -1; + } + return(0); +} + + +/*! + * @function papCloseResp + * @abstract Send a pap close response in the rare case we receive a close connection request. + * + * @param sockfd socket descriptor + * @param dest destination address + * @param tid transaction id + * @param connID connection id + * + * @result A non-zero return value for errors + */ +static int papCloseResp(int sockfd, at_inet_t* dest, int xo, u_short tid, u_char connID) +{ + int result; + at_resp_t resp; + + resp.bitmap = 1; + resp.userdata[0] = 0; + + ((u_char*)&resp.userdata[0])[PAP_CONNID] = connID; + ((u_char*)&resp.userdata[0])[PAP_TYPE] = AT_PAP_TYPE_CLOSE_CONN_REPLY; + + resp.resp[0].iov_base = NULL; + resp.resp[0].iov_len = 0; + + if ((result = atp_sendrsp(sockfd, dest, xo, tid, &resp)) < 0) + { + fprintf(stderr, "DEBUG: atp_sendrsp() returns %d, errno %d \"%s\"\n", result, errno, strerror(errno)); + return -1; + } + return 0; +} + + +/*! + * @function papSendRequest + * @abstract Send a pap close response in the rare case we receive a close connection request. + * + * @param sockfd socket descriptor + * @param dest destination address + * @param function pap function + * @param bitmap bitmap + * @param xo exactly once + * @param seqno sequence number + * + * @result A non-zero return value for errors + */ +static int papSendRequest(int sockfd, at_inet_t* dest, u_char connID, int function, u_char bitmap, int xo, int seqno) +{ + u_short tid; + int err; + sigset_t sv, osv; + int userdata; + u_char *puserdata = (u_char *)&userdata; + at_retry_t retry; + at_resp_t resp; + static u_short pap_send_count = 0; + + fprintf(stderr, "DEBUG: -> %s\n", PAPPacketStr(function)); + + puserdata[0] = connID; + puserdata[1] = function; + resp.bitmap = bitmap; + retry.interval = 10; + retry.retries = -1; /* was ATP_INFINITE_RETRIES */ + if (seqno) + { + pap_send_count++; + if (pap_send_count == 0) + pap_send_count = 1; + + OSWriteBigInt16(&puserdata[2], 0, pap_send_count); + } + else + OSWriteBigInt16(&puserdata[2], 0, 0); + + sigemptyset(&sv); + sigaddset(&sv, SIGIO); + sigprocmask(SIG_SETMASK, &sv, &osv); + + err = atp_sendreq(sockfd, dest, 0, 0, userdata, xo, 0, &tid, &resp, &retry, 1); + + sigprocmask(SIG_SETMASK, &osv, NULL); + + return err; +} + + +/*! + * @function papCancelRequest + * @abstract Cancel a pending pap request. + * + * @param sockfd socket descriptor + * @param tid transaction ID + * + * @result A non-zero return value for errors + */ +int papCancelRequest(int sockfd, u_short tid) +{ + sigset_t sv, osv; + + sigemptyset(&sv); + sigaddset(&sv, SIGIO); + sigprocmask(SIG_SETMASK, &sv, &osv); + + if (atp_abort(sockfd, NULL, tid) < 0) + { + sigprocmask(SIG_SETMASK, &osv, NULL); + return -1; + } + sigprocmask(SIG_SETMASK, &osv, NULL); + + return 0; +} + + +#pragma mark - +/*! + * @function statusUpdate + * @abstract Format and print a PAP status response to stderr. + * + * @param status The status response string + * @param statusLen The length of the status response string + */ +void statusUpdate(char* status, u_char statusLen) +{ + static char status_str[255]; + static u_char last_statusLen = 0xFF; + + /* Only send this if the status has changed */ + if (statusLen != last_statusLen || memcmp(status, status_str, statusLen) != 0) + { + if (statusLen > sizeof(status_str)-1) + statusLen = sizeof(status_str)-1; + last_statusLen = statusLen; + memcpy(status_str, status, statusLen); + status_str[(int)statusLen] = '\0'; + + /* + * Make sure the status string is in the form of a PostScript comment. + */ + + if (statusLen > 3 && memcmp(status, "%%[", 3) == 0) + fprintf(stderr, "INFO: %s\n", status_str); + else + fprintf(stderr, "INFO: %%%%[ %s ]%%%%\n", status_str); + } + return; +} + + +/*! + * @function parseUri + * @abstract Parse a PAP URI into it's NBP components. + * + * @param argv0 The PAP URI to parse + * @param name NBP name + * @param zone NBP zone + * @param type NBP type + * + * @result A non-zero return value for errors + */ +static int parseUri(const char* argv0, char* name, char* type, char* zone) +{ + char scheme[255], /* Scheme in URI */ + hostname[1024], /* Hostname */ + username[255], /* Username info (not used) */ + resource[1024], /* Resource info (device and options) */ + *resourcePtr, + *typePtr, + *options, /* Pointer to options */ + optionName[255], /* Name of option */ + value[255], /* Value of option */ + *ptr; /* Pointer into name or value */ + int port; /* Port number (not used) */ + int statusInterval; /* */ + + /* + * Extract the device name and options from the URI... + */ + + httpSeparateURI(HTTP_URI_CODING_NONE, argv0, scheme, sizeof(scheme), + username, sizeof(username), + hostname, sizeof(hostname), &port, + resource, sizeof(resource)); + + /* + * See if there are any options... + */ + if ((options = strchr(resource, '?')) != NULL) + { + /* + * Yup, terminate the device name string and move to the first + * character of the options... + */ + *options++ = '\0'; + + while (*options != '\0') + { + /* + * Get the name... + */ + for (ptr = optionName; *options && *options != '=' && *options != '+'; ) + *ptr++ = *options++; + + *ptr = '\0'; + value[0] = '\0'; + + if (*options == '=') + { + /* + * Get the value... + */ + + options ++; + + for (ptr = value; *options && *options != '+';) + *ptr++ = *options++; + + *ptr = '\0'; + + if (*options == '+') + options ++; + } + else if (*options == '+') + { + options ++; + } + + /* + * Process the option... + */ + if (strcasecmp(optionName, "waiteof") == 0) + { + /* + * Set the banner... + */ + if (strcasecmp(value, "on") == 0 || + strcasecmp(value, "yes") == 0 || + strcasecmp(value, "true") == 0) + { + gWaitEOF = true; + } + else if (strcasecmp(value, "off") == 0 || + strcasecmp(value, "no") == 0 || + strcasecmp(value, "false") == 0) + { + gWaitEOF = false; + } + else + { + fprintf(stderr, "WARNING: Boolean expected for waiteof option \"%s\"\n", value); + } + } + else if (strcasecmp(optionName, "status") == 0) + { + statusInterval = atoi(value); + if (value[0] < '0' || value[0] > '9' || + statusInterval < 0) + { + fprintf(stderr, "WARNING: number expected for status option \"%s\"\n", value); + } + else + { + gStatusInterval = statusInterval; + } + } + } + } + + resourcePtr = resource; + + if (*resourcePtr == '/') + resourcePtr++; + + /* If the resource has a slash we assume the slash seperates the AppleTalk object + * name from the AppleTalk type. If the slash is not present we assume the AppleTalk + * type is LaserWriter. + */ + typePtr = strchr(resourcePtr, '/'); + if (typePtr != NULL) { + *typePtr++ = '\0'; + } else { + typePtr = "LaserWriter"; + } + + removePercentEscapes(hostname, zone, NBP_NVE_STR_SIZE + 1); + removePercentEscapes(resourcePtr, name, NBP_NVE_STR_SIZE + 1); + removePercentEscapes(typePtr, type, NBP_NVE_STR_SIZE + 1); + + return 0; +} + + +/*! + * @function addPercentEscapes + * @abstract Encode a string with percent escapes + * + * @param src The source C string + * @param dst Desination buffer + * @param dstMax Size of desination buffer + * + * @result A non-zero return value for errors + */ +static int addPercentEscapes(const char* src, char* dst, int dstMax) +{ + char c; + char *dstEnd = dst + dstMax - 1; /* -1 to leave room for the NUL */ + + while (*src) + { + c = *src++; + + if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || (c == '.' || c == '-' || c == '*' || c == '_')) + { + if (dst >= dstEnd) + return -1; + + *dst++ = c; + } + else + { + if (dst >= dstEnd - 2) + return -1; + + snprintf(dst, dstEnd - dst, "%%%02x", c); + dst += 3; + } + } + + *dst = '\0'; + return 0; +} + + +/*! + * @function removePercentEscapes + * @abstract Returns a string with any percent escape sequences replaced with their equivalent character + * + * @param src Source buffer + * @param srclen Number of bytes in source buffer + * @param dst Desination buffer + * @param dstMax Size of desination buffer + * + * @result A non-zero return value for errors + */ +static int removePercentEscapes(const char* src, char* dst, int dstMax) +{ + int c; + const char *dstEnd = dst + dstMax; + + while (*src && dst < dstEnd) + { + c = *src++; + + if (c == '%') + { + sscanf(src, "%02x", &c); + src += 2; + } + *dst++ = (char)c; + } + + if (dst >= dstEnd) + return -1; + + *dst = '\0'; + return 0; +} + + +/*! + * @function nbptuple_compare + * @abstract An NBP comparator for qsort. + * + * @result p1p2: 1 + */ +int nbptuple_compare(const void *p1, const void *p2) +{ + int result; + int len = MIN(((at_nbptuple_t*)p1)->enu_entity.object.len, + ((at_nbptuple_t*)p2)->enu_entity.object.len); + + if ((result = memcmp(((at_nbptuple_t*)p1)->enu_entity.object.str, ((at_nbptuple_t*)p2)->enu_entity.object.str, len)) == 0) + { + if (((at_nbptuple_t*)p1)->enu_entity.object.len < ((at_nbptuple_t*)p2)->enu_entity.object.len) + result = -1; + else if (((at_nbptuple_t*)p1)->enu_entity.object.len > ((at_nbptuple_t*)p2)->enu_entity.object.len) + result = 1; + else + result = 0; + } + return result; +} + + +/*! + * @function okayToUseAppleTalk + * @abstract Returns true if AppleTalk is available and enabled. + * + * @result non-zero if AppleTalk is enabled + */ +static int okayToUseAppleTalk() +{ + int atStatus = checkATStack(); + + /* I think the test should be: + * return atStatus == RUNNING || atStatus == LOADED; + * but when I disable AppleTalk from the network control panel and + * reboot, AppleTalk shows up as loaded. The test empirically becomes + * the following: + */ + return atStatus == RUNNING; +} + + +/*! + * @function connectTimeout + * @abstract Returns the connect timeout preference value. + */ +static int connectTimeout() +{ + CFPropertyListRef value; + SInt32 connect_timeout = (7 * 24 * 60 * 60); /* Default timeout is one week... */ + + value = CFPreferencesCopyValue(CFSTR("timeout"), CFSTR("com.apple.print.backends"), + kCFPreferencesAnyUser, kCFPreferencesCurrentHost); + if (value != NULL) + { + if (CFGetTypeID(value) == CFNumberGetTypeID()) + CFNumberGetValue(value, kCFNumberSInt32Type, &connect_timeout); + + CFRelease(value); + } + + return connect_timeout; +} + + +/*! + * @function signalHandler + * @abstract A signal handler so we can clean up the pap session before exiting. + * + * @param sigraised The signal raised + * + * @result Never returns + */ +static void signalHandler(int sigraised) +{ + fprintf(stderr, "ERROR: There was a timeout error while sending data to the printer\n"); + + papClose(true); + + _exit(1); +} diff --git a/backend/snmp.c b/backend/snmp.c index d571bf105..478dc5abd 100644 --- a/backend/snmp.c +++ b/backend/snmp.c @@ -1,5 +1,5 @@ /* - * "$Id: snmp.c 5453 2006-04-23 12:08:18Z mike $" + * "$Id: snmp.c 5479 2006-05-02 15:03:17Z mike $" * * SNMP discovery backend for the Common UNIX Printing System (CUPS). * @@ -1244,7 +1244,7 @@ fix_make_model( const char *old_make_model, /* I - Old make-and-model string */ int make_model_size) /* I - Size of new string buffer */ { - const char *mmptr; /* Pointer into make-and-model string */ + char *mmptr; /* Pointer into make-and-model string */ /* @@ -1259,7 +1259,7 @@ fix_make_model( * with a single HP manufacturer prefix... */ - mmptr = old_make_model + 15; + mmptr = (char *)old_make_model + 15; while (isspace(*mmptr & 255)) mmptr ++; @@ -1292,7 +1292,16 @@ fix_make_model( * becomes "Tektronix Phaser 560"... */ - _cups_strcpy((char *)mmptr, mmptr + 7); + _cups_strcpy(mmptr, mmptr + 7); + } + + if ((mmptr = strchr(make_model, ',')) != NULL) + { + /* + * Drop anything after a trailing comma... + */ + + *mmptr = '\0'; } } @@ -1433,9 +1442,10 @@ list_devices(void) cache; cache = (snmp_cache_t *)cupsArrayNext(Devices)) if (cache->uri) - printf("network %s \"%s\" \"%s\" \"%s\"\n", + printf("network %s \"%s\" \"%s %s\" \"%s\"\n", cache->uri, cache->make_and_model ? cache->make_and_model : "Unknown", + cache->make_and_model ? cache->make_and_model : "Unknown", cache->addrname, cache->id ? cache->id : ""); } @@ -2202,5 +2212,5 @@ update_cache(snmp_cache_t *device, /* I - Device */ /* - * End of "$Id: snmp.c 5453 2006-04-23 12:08:18Z mike $". + * End of "$Id: snmp.c 5479 2006-05-02 15:03:17Z mike $". */ diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index 39edff1ee..3f9f2c066 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -1,5 +1,5 @@ /* - * "$Id: usb-darwin.c 5373 2006-04-06 20:03:32Z mike $" + * "$Id: usb-darwin.c 5488 2006-05-03 19:39:30Z mike $" * * © Copyright 2005-2006 Apple Computer, Inc. All rights reserved. * @@ -228,7 +228,6 @@ static void parse_pserror (char *sockBuffer, int len); void list_devices() { - puts("direct usb \"Unknown\" \"USB Printer (usb)\""); iterate_printers(list_device_callback, NULL); } @@ -442,14 +441,26 @@ static Boolean list_device_callback(void *refcon, io_service_t obj) if (deviceIDString != NULL) { CFStringRef make = NULL, model = NULL, serial = NULL; char uristr[1024], makestr[1024], modelstr[1024], serialstr[1024], optionsstr[1024]; + char idstr[1024]; copy_deviceinfo(deviceIDString, &make, &model, &serial); modelstr[0] = '/'; + CFStringGetCString(deviceIDString, idstr, sizeof(idstr), kCFStringEncodingUTF8); CFStringGetCString(make, makestr, sizeof(makestr), kCFStringEncodingUTF8); CFStringGetCString(model, &modelstr[1], sizeof(modelstr)-1, kCFStringEncodingUTF8); + /* + * Fix common HP 1284 bug... + */ + + if (!strcasecmp(makestr, "Hewlett-Packard")) + strcpy(makestr, "HP"); + + if (!strncasecmp(modelstr + 1, "hp ", 3)) + _cups_strcpy(modelstr + 1, modelstr + 4); + optionsstr[0] = '\0'; if (serial != NULL) { @@ -464,7 +475,8 @@ static Boolean list_device_callback(void *refcon, io_service_t obj) httpAssembleURI(HTTP_URI_CODING_ALL, uristr, sizeof(uristr), "usb", NULL, makestr, 0, modelstr); strncat(uristr, optionsstr, sizeof(uristr)); - printf("direct %s \"%s %s\" \"%s\"\n", uristr, makestr, &modelstr[1], &modelstr[1]); + printf("direct %s \"%s %s\" \"%s %s USB\" \"%s\"\n", uristr, makestr, + &modelstr[1], makestr, &modelstr[1], idstr); release_deviceinfo(&make, &model, &serial); CFRelease(deviceIDString); @@ -1334,5 +1346,5 @@ static void *read_thread(void *reference) /* - * End of "$Id: usb-darwin.c 5373 2006-04-06 20:03:32Z mike $". + * End of "$Id: usb-darwin.c 5488 2006-05-03 19:39:30Z mike $". */ diff --git a/cgi-bin/template.c b/cgi-bin/template.c index 229c599c3..f6f213fef 100644 --- a/cgi-bin/template.c +++ b/cgi-bin/template.c @@ -1,5 +1,5 @@ /* - * "$Id: template.c 5352 2006-03-29 16:26:38Z mike $" + * "$Id: template.c 5461 2006-04-25 17:15:45Z mike $" * * CGI template function. * @@ -44,6 +44,7 @@ static void cgi_copy(FILE *out, FILE *in, int element, char term, int indent); static void cgi_puts(const char *s, FILE *out); +static void cgi_puturi(const char *s, FILE *out); /* @@ -235,6 +236,7 @@ cgi_copy(FILE *out, /* I - Output file */ char outval[1024], /* Formatted output string */ compare[1024]; /* Comparison string */ int result; /* Result of comparison */ + int uriencode; /* Encode as URI */ fprintf(stderr, "DEBUG: %*sStarting at file position %ld...\n", indent, "", @@ -253,9 +255,13 @@ cgi_copy(FILE *out, /* I - Output file */ * Get a variable name... */ + uriencode = 0; + for (s = name; (ch = getc(in)) != EOF;) if (strchr("}]<>=! \t\n", ch)) break; + else if (s == name && ch == '%') + uriencode = 1; else if (s > name && ch == '?') break; else if (s < (name + sizeof(name) - 1)) @@ -399,7 +405,12 @@ cgi_copy(FILE *out, /* I - Output file */ */ if (out) - cgi_puts(outptr, out); + { + if (uriencode) + cgi_puturi(outptr, out); + else + cgi_puts(outptr, out); + } continue; } @@ -638,5 +649,25 @@ cgi_puts(const char *s, /* I - String to output */ /* - * End of "$Id: template.c 5352 2006-03-29 16:26:38Z mike $". + * 'cgi_puturi()' - Put a URI string to the output file, quoting as needed... + */ + +static void +cgi_puturi(const char *s, /* I - String to output */ + FILE *out) /* I - Output file */ +{ + while (*s) + { + if (strchr("%&+ <>#=", *s) || *s & 128) + fprintf(out, "%%%02X", *s & 255); + else + putc(*s, out); + + s ++; + } +} + + +/* + * End of "$Id: template.c 5461 2006-04-25 17:15:45Z mike $". */ diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index 0da11e4ea..5495beaa0 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-common.m4 5354 2006-03-29 20:55:15Z mike $" +dnl "$Id: cups-common.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl Common configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -265,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 5354 2006-03-29 20:55:15Z mike $". +dnl End of "$Id: cups-common.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-compiler.m4 b/config-scripts/cups-compiler.m4 index a7f99169f..c3b82a852 100644 --- a/config-scripts/cups-compiler.m4 +++ b/config-scripts/cups-compiler.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-compiler.m4 5288 2006-03-14 02:38:07Z mike $" +dnl "$Id: cups-compiler.m4 5473 2006-05-01 15:51:09Z mike $" dnl dnl Compiler stuff for the Common UNIX Printing System (CUPS). dnl @@ -73,12 +73,15 @@ AC_SUBST(LIB64DIR) AC_SUBST(UNINSTALL64) dnl Position-Independent Executable support on Linux and *BSD... -AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fpie option, default=no]) +AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no]) dnl Update compiler options... CXXLIBS="" AC_SUBST(CXXLIBS) +PIEFLAGS="" +AC_SUBST(PIEFLAGS) + if test -n "$GCC"; then if test -z "$OPTIM"; then if test "x$with_optim" = x; then @@ -96,8 +99,13 @@ if test -n "$GCC"; then case $uname in Linux*) if test x$enable_pie = xyes; then - OPTIM="$OPTIM -fpie" - LDFLAGS="$LDFLAGS -pie" + PIEFLAGS="-pie -fPIE" + fi + ;; + + *) + if test x$enable_pie = xyes; then + echo "Sorry, --enable-pie is not supported on this OS!" fi ;; esac @@ -467,5 +475,5 @@ if test $uname = HP-UX; then fi dnl -dnl End of "$Id: cups-compiler.m4 5288 2006-03-14 02:38:07Z mike $". +dnl End of "$Id: cups-compiler.m4 5473 2006-05-01 15:51:09Z mike $". dnl diff --git a/config-scripts/cups-defaults.m4 b/config-scripts/cups-defaults.m4 index e327fe28c..663ce1e73 100644 --- a/config-scripts/cups-defaults.m4 +++ b/config-scripts/cups-defaults.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id$" +dnl "$Id: cups-defaults.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl Default cupsd configuration settings for the Common UNIX Printing System dnl (CUPS). @@ -219,7 +219,7 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GROUP, "$CUPS_GROUP") AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SYSTEM_GROUPS, "$CUPS_SYSTEM_GROUPS") dnl Default printcap file... -AC_ARG_WITH(printcap, [ --with-printcap set default printcap file], +AC_ARG_WITH(printcap, [ --with-printcap set default printcap file], default_printcap="$withval", default_printcap="/etc/printcap") @@ -236,5 +236,5 @@ fi AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTCAP, "$CUPS_DEFAULT_PRINTCAP") dnl -dnl End of "$Id$". +dnl End of "$Id: cups-defaults.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-directories.m4 b/config-scripts/cups-directories.m4 index a4db002b9..39a787a98 100644 --- a/config-scripts/cups-directories.m4 +++ b/config-scripts/cups-directories.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-directories.m4 5314 2006-03-20 19:06:50Z mike $" +dnl "$Id: cups-directories.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl Directory stuff for the Common UNIX Printing System (CUPS). dnl @@ -300,5 +300,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups") AC_SUBST(CUPS_STATEDIR) dnl -dnl End of "$Id: cups-directories.m4 5314 2006-03-20 19:06:50Z mike $". +dnl End of "$Id: cups-directories.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-image.m4 b/config-scripts/cups-image.m4 index e6f9644bb..c5204ee22 100644 --- a/config-scripts/cups-image.m4 +++ b/config-scripts/cups-image.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-image.m4 5451 2006-04-22 21:54:49Z mike $" +dnl "$Id: cups-image.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl Image library/filter stuff for the Common UNIX Printing System (CUPS). dnl @@ -110,5 +110,5 @@ AC_SUBST(EXPORT_LIBZ) AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H)) dnl -dnl End of "$Id: cups-image.m4 5451 2006-04-22 21:54:49Z mike $". +dnl End of "$Id: cups-image.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-launchd.m4 b/config-scripts/cups-launchd.m4 index 1da73934f..ded893b07 100644 --- a/config-scripts/cups-launchd.m4 +++ b/config-scripts/cups-launchd.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id$" +dnl "$Id: cups-launchd.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl launchd stuff for the Common UNIX Printing System (CUPS). dnl @@ -49,5 +49,5 @@ AC_SUBST(DEFAULT_LAUNCHD_CONF) AC_SUBST(LAUNCHDLIBS) dnl -dnl End of "$Id$". +dnl End of "$Id: cups-launchd.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-ldap.m4 b/config-scripts/cups-ldap.m4 index 3c3e8ed1d..69bbb0a3e 100644 --- a/config-scripts/cups-ldap.m4 +++ b/config-scripts/cups-ldap.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id$" +dnl "$Id: cups-ldap.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl LDAP configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -46,5 +46,5 @@ AC_SUBST(LIBLDAP) dnl -dnl End of "$Id$". +dnl End of "$Id: cups-ldap.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-libtool.m4 b/config-scripts/cups-libtool.m4 index 0d8673c79..5b68a7080 100644 --- a/config-scripts/cups-libtool.m4 +++ b/config-scripts/cups-libtool.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-libtool.m4 4494 2005-02-18 02:18:11Z mike $" +dnl "$Id: cups-libtool.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl Libtool stuff for the Common UNIX Printing System (CUPS). dnl @@ -45,5 +45,5 @@ if test x$LIBTOOL != x; then fi dnl -dnl End of "$Id: cups-libtool.m4 4494 2005-02-18 02:18:11Z mike $". +dnl End of "$Id: cups-libtool.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-manpages.m4 b/config-scripts/cups-manpages.m4 index 0c2c25161..1e6ae44de 100644 --- a/config-scripts/cups-manpages.m4 +++ b/config-scripts/cups-manpages.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-manpages.m4 5099 2006-02-13 02:46:10Z mike $" +dnl "$Id: cups-manpages.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl Manpage stuff for the Common UNIX Printing System (CUPS). dnl @@ -103,5 +103,5 @@ AC_SUBST(MAN8EXT) AC_SUBST(MAN8DIR) dnl -dnl End of "$Id: cups-manpages.m4 5099 2006-02-13 02:46:10Z mike $". +dnl End of "$Id: cups-manpages.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-network.m4 b/config-scripts/cups-network.m4 index e5abc8ba9..264efdfb5 100644 --- a/config-scripts/cups-network.m4 +++ b/config-scripts/cups-network.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-network.m4 4873 2005-12-07 01:46:54Z mike $" +dnl "$Id: cups-network.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl Networking stuff for the Common UNIX Printing System (CUPS). dnl @@ -85,5 +85,5 @@ AC_SUBST(CUPS_DEFAULT_DOMAINSOCKET) AC_SUBST(CUPS_LISTEN_DOMAINSOCKET) dnl -dnl End of "$Id: cups-network.m4 4873 2005-12-07 01:46:54Z mike $". +dnl End of "$Id: cups-network.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-opsys.m4 b/config-scripts/cups-opsys.m4 index c5ce0335c..b47f473a7 100644 --- a/config-scripts/cups-opsys.m4 +++ b/config-scripts/cups-opsys.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-opsys.m4 5075 2006-02-05 01:00:29Z mike $" +dnl "$Id: cups-opsys.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl Operating system stuff for the Common UNIX Printing System (CUPS). dnl @@ -39,5 +39,5 @@ case "$uname" in esac dnl -dnl "$Id: cups-opsys.m4 5075 2006-02-05 01:00:29Z mike $" +dnl "$Id: cups-opsys.m4 5466 2006-04-26 19:52:27Z mike $" dnl diff --git a/config-scripts/cups-pam.m4 b/config-scripts/cups-pam.m4 index c86ae292e..df445a2b7 100644 --- a/config-scripts/cups-pam.m4 +++ b/config-scripts/cups-pam.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-pam.m4 4913 2006-01-11 01:42:04Z mike $" +dnl "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl PAM stuff for the Common UNIX Printing System (CUPS). dnl @@ -94,5 +94,5 @@ AC_SUBST(PAMLIBS) AC_SUBST(PAMMOD) dnl -dnl End of "$Id: cups-pam.m4 4913 2006-01-11 01:42:04Z mike $". +dnl End of "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-pap.m4 b/config-scripts/cups-pap.m4 new file mode 100644 index 000000000..2fbed6776 --- /dev/null +++ b/config-scripts/cups-pap.m4 @@ -0,0 +1,37 @@ +dnl +dnl "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $" +dnl +dnl PAP (AppleTalk) stuff for the Common UNIX Printing System (CUPS). +dnl +dnl Copyright 2006 by Easy Software Products, all rights reserved. +dnl +dnl These coded instructions, statements, and computer programs are the +dnl property of Easy Software Products and are protected by Federal +dnl copyright law. Distribution and use rights are outlined in the file +dnl "LICENSE.txt" which should have been included with this file. If this +dnl file is missing or damaged please contact Easy Software Products +dnl at: +dnl +dnl Attn: CUPS Licensing Information +dnl Easy Software Products +dnl 44141 Airport View Drive, Suite 204 +dnl Hollywood, Maryland 20636 USA +dnl +dnl Voice: (301) 373-9600 +dnl EMail: cups-info@cups.org +dnl WWW: http://www.cups.org +dnl + +# Currently the PAP backend is only supported on MacOS X with the AppleTalk +# SDK installed... +PAP="" +if test $uname = Darwin; then + PAP="pap" + AC_CHECK_HEADER(AppleTalk/at_proto.h) +fi + +AC_SUBST(PAP) + +dnl +dnl End of "$Id: cups-pam.m4 5466 2006-04-26 19:52:27Z mike $". +dnl diff --git a/config-scripts/cups-pdf.m4 b/config-scripts/cups-pdf.m4 index d905ada0e..f76974883 100644 --- a/config-scripts/cups-pdf.m4 +++ b/config-scripts/cups-pdf.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id$" +dnl "$Id: cups-pdf.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl PDF filter configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -39,5 +39,5 @@ fi AC_SUBST(PDFTOPS) dnl -dnl End of "$Id$". +dnl End of "$Id: cups-pdf.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-scripting.m4 b/config-scripts/cups-scripting.m4 index 68221a91e..ee00b8a2e 100644 --- a/config-scripts/cups-scripting.m4 +++ b/config-scripts/cups-scripting.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-scripting.m4 5176 2006-02-25 18:14:10Z mike $" +dnl "$Id: cups-scripting.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl Scripting configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -100,5 +100,5 @@ if test "x$CUPS_PYTHON" != x; then fi dnl -dnl End of "$Id: cups-scripting.m4 5176 2006-02-25 18:14:10Z mike $". +dnl End of "$Id: cups-scripting.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-sharedlibs.m4 b/config-scripts/cups-sharedlibs.m4 index 2e52b2436..05dc479b7 100644 --- a/config-scripts/cups-sharedlibs.m4 +++ b/config-scripts/cups-sharedlibs.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-sharedlibs.m4 5112 2006-02-16 04:41:59Z mike $" +dnl "$Id: cups-sharedlibs.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl Shared library support for the Common UNIX Printing System (CUPS). dnl @@ -152,5 +152,5 @@ AC_SUBST(IMGLIBS) AC_SUBST(EXPORT_LDFLAGS) dnl -dnl End of "$Id: cups-sharedlibs.m4 5112 2006-02-16 04:41:59Z mike $". +dnl End of "$Id: cups-sharedlibs.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-slp.m4 b/config-scripts/cups-slp.m4 index 1b32e009d..0afbbca31 100644 --- a/config-scripts/cups-slp.m4 +++ b/config-scripts/cups-slp.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-openslp.m4 4494 2005-02-18 02:18:11Z mike $" +dnl "$Id: cups-slp.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl OpenSLP configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -44,5 +44,5 @@ AC_SUBST(LIBSLP) dnl -dnl End of "$Id: cups-openslp.m4 4494 2005-02-18 02:18:11Z mike $". +dnl End of "$Id: cups-slp.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-ssl.m4 b/config-scripts/cups-ssl.m4 index 22ab754d5..6147b3e8c 100644 --- a/config-scripts/cups-ssl.m4 +++ b/config-scripts/cups-ssl.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-ssl.m4 5457 2006-04-24 15:36:12Z mike $" +dnl "$Id: cups-ssl.m4 5466 2006-04-26 19:52:27Z mike $" dnl dnl OpenSSL/GNUTLS stuff for the Common UNIX Printing System (CUPS). dnl @@ -113,5 +113,5 @@ AC_SUBST(EXPORT_SSLLIBS) dnl -dnl End of "$Id: cups-ssl.m4 5457 2006-04-24 15:36:12Z mike $". +dnl End of "$Id: cups-ssl.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config-scripts/cups-threads.m4 b/config-scripts/cups-threads.m4 index 639eb7414..47f76e2ae 100644 --- a/config-scripts/cups-threads.m4 +++ b/config-scripts/cups-threads.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id$" +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 @@ -53,5 +53,5 @@ fi AC_SUBST(PTHREAD_FLAGS) dnl -dnl End of "$Id$". +dnl End of "$Id: cups-threads.m4 5466 2006-04-26 19:52:27Z mike $". dnl diff --git a/config.h.in b/config.h.in index b7de6e72a..48281040d 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,5 @@ /* - * "$Id: config.h.in 5373 2006-04-06 20:03:32Z mike $" + * "$Id: config.h.in 5474 2006-05-02 14:20:26Z mike $" * * Configuration file for the Common UNIX Printing System (CUPS). * @@ -429,8 +429,15 @@ #undef HAVE_DBUS +/* + * Do we have the AppleTalk/at_proto.h header? + */ + +#undef HAVE_APPLETALK_AT_PROTO_H + + #endif /* !_CUPS_CONFIG_H_ */ /* - * End of "$Id: config.h.in 5373 2006-04-06 20:03:32Z mike $". + * End of "$Id: config.h.in 5474 2006-05-02 14:20:26Z mike $". */ diff --git a/configure.in b/configure.in index eb1137f24..823c453d7 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl -dnl "$Id: configure.in 5413 2006-04-17 14:50:45Z mike $" +dnl "$Id: configure.in 5468 2006-04-27 13:40:30Z mike $" dnl dnl Configuration script for the Common UNIX Printing System (CUPS). dnl @@ -43,6 +43,7 @@ sinclude(config-scripts/cups-threads.m4) sinclude(config-scripts/cups-largefile.m4) sinclude(config-scripts/cups-launchd.m4) sinclude(config-scripts/cups-defaults.m4) +sinclude(config-scripts/cups-pap.m4) sinclude(config-scripts/cups-pdf.m4) sinclude(config-scripts/cups-scripting.m4) @@ -67,5 +68,5 @@ AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh init/cups-lpd cups-config chmod +x cups-config dnl -dnl End of "$Id: configure.in 5413 2006-04-17 14:50:45Z mike $". +dnl End of "$Id: configure.in 5468 2006-04-27 13:40:30Z mike $". dnl diff --git a/cups/Makefile b/cups/Makefile index 1570e1861..51b396b2a 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 5428 2006-04-18 20:45:30Z mike $" +# "$Id: Makefile 5491 2006-05-04 20:53:35Z mike $" # # API library Makefile for the Common UNIX Printing System (CUPS). # @@ -271,7 +271,7 @@ libcups.2.dylib: $(LIBOBJS) # libcups_s.a # -libcups_s.a: $(LIBOBJS) +libcups_s.a: $(LIBOBJS) libcups_s.exp echo Creating $@... $(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o $(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) -lm $(RM) $@ @@ -442,5 +442,5 @@ include Dependencies # -# End of "$Id: Makefile 5428 2006-04-18 20:45:30Z mike $". +# End of "$Id: Makefile 5491 2006-05-04 20:53:35Z mike $". # diff --git a/cups/array.c b/cups/array.c index f301b5c24..b05168031 100644 --- a/cups/array.c +++ b/cups/array.c @@ -1,5 +1,5 @@ /* - * "$Id: array.c 5258 2006-03-09 15:40:56Z mike $" + * "$Id: array.c 5493 2006-05-05 16:33:57Z mike $" * * Sorted array routines for the Common UNIX Printing System (CUPS). * @@ -939,11 +939,14 @@ cups_array_find(cups_array_t *a, /* I - Array */ DEBUG_puts("cups_array_find: linear search"); - diff = 0; + diff = 1; for (current = 0; current < a->num_elements; current ++) if (a->elements[current] == e) + { + diff = 0; break; + } } /* @@ -959,5 +962,5 @@ cups_array_find(cups_array_t *a, /* I - Array */ /* - * End of "$Id: array.c 5258 2006-03-09 15:40:56Z mike $". + * End of "$Id: array.c 5493 2006-05-05 16:33:57Z mike $". */ diff --git a/cups/getifaddrs.c b/cups/getifaddrs.c index 6cb448d61..0daf59b85 100644 --- a/cups/getifaddrs.c +++ b/cups/getifaddrs.c @@ -1,5 +1,5 @@ /* - * "$Id: getifaddrs.c 5428 2006-04-18 20:45:30Z mike $" + * "$Id: getifaddrs.c 5466 2006-04-26 19:52:27Z mike $" * * Network interface functions for the Common UNIX Printing System * (CUPS) scheduler. @@ -40,7 +40,7 @@ * '_cups_getifaddrs()' - Get a list of network interfaces on the system. */ -static int /* O - 0 on success, -1 on error */ +int /* O - 0 on success, -1 on error */ _cups_getifaddrs(struct ifaddrs **addrs)/* O - List of interfaces */ { int sock; /* Socket */ @@ -216,7 +216,7 @@ _cups_getifaddrs(struct ifaddrs **addrs)/* O - List of interfaces */ * '_cups_freeifaddrs()' - Free an interface list... */ -static void +void _cups_freeifaddrs(struct ifaddrs *addrs)/* I - Interface list to free */ { struct ifaddrs *next; /* Next interface in list */ @@ -271,5 +271,5 @@ _cups_freeifaddrs(struct ifaddrs *addrs)/* I - Interface list to free */ /* - * End of "$Id: getifaddrs.c 5428 2006-04-18 20:45:30Z mike $". + * End of "$Id: getifaddrs.c 5466 2006-04-26 19:52:27Z mike $". */ diff --git a/cups/http-private.h b/cups/http-private.h index d74f2beea..3a32b8da2 100644 --- a/cups/http-private.h +++ b/cups/http-private.h @@ -1,5 +1,5 @@ /* - * "$Id: http-private.h 5428 2006-04-18 20:45:30Z mike $" + * "$Id: http-private.h 5466 2006-04-26 19:52:27Z mike $" * * Private HTTP definitions for the Common UNIX Printing System (CUPS). * @@ -31,7 +31,8 @@ * Include necessary headers... */ -# include "config.h" +# include +# include # ifdef __sun /* @@ -165,14 +166,14 @@ struct ifaddrs /**** Interface Structure ****/ void *ifa_data; /* Interface statistics */ }; -static int _cups_getifaddrs(struct ifaddrs **addrs); +extern int _cups_getifaddrs(struct ifaddrs **addrs); # define getifaddrs _cups_getifaddrs -static void _cups_freeifaddrs(struct ifaddrs *addrs); +extern void _cups_freeifaddrs(struct ifaddrs *addrs); # define freeifaddrs _cups_freeifaddrs # endif /* HAVE_GETIFADDRS */ #endif /* !_CUPS_HTTP_PRIVATE_H_ */ /* - * End of "$Id: http-private.h 5428 2006-04-18 20:45:30Z mike $". + * End of "$Id: http-private.h 5466 2006-04-26 19:52:27Z mike $". */ diff --git a/cups/libcups_s.exp b/cups/libcups_s.exp index 5d8f1dfd4..a7afc43d1 100644 --- a/cups/libcups_s.exp +++ b/cups/libcups_s.exp @@ -6,7 +6,6 @@ _cupsCharmapGet _cupsEncodingName _cupsGetPassword _cupsGlobals -_cupsLangFlush _cupsLangPrintf _cupsLangPuts _cupsLangString @@ -23,6 +22,8 @@ _cupsStrFormatd _cupsStrFree _cupsStrScand _cupsStrStatistics +_cups_getifaddrs +_cups_freeifaddrs _cups_strcpy _cups_strlcat _cups_strlcpy diff --git a/cups/request.c b/cups/request.c index 9a9161d3d..93d08885e 100644 --- a/cups/request.c +++ b/cups/request.c @@ -1,5 +1,5 @@ /* - * "$Id: request.c 5447 2006-04-21 20:07:51Z mike $" + * "$Id: request.c 5495 2006-05-05 17:58:07Z mike $" * * IPP utilities for the Common UNIX Printing System (CUPS). * @@ -69,7 +69,7 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */ FILE *file; /* File to send */ struct stat fileinfo; /* File information */ int bytes; /* Number of bytes read/written */ - char buffer[65536]; /* Output buffer */ + char buffer[32768]; /* Output buffer */ DEBUG_printf(("cupsDoFileRequest(%p, %p, \'%s\', \'%s\')\n", @@ -469,5 +469,5 @@ _cupsSetError(ipp_status_t status, /* I - IPP status code */ /* - * End of "$Id: request.c 5447 2006-04-21 20:07:51Z mike $". + * End of "$Id: request.c 5495 2006-05-05 17:58:07Z mike $". */ diff --git a/cups/string.h b/cups/string.h index 6c5ae823f..79ebd774b 100644 --- a/cups/string.h +++ b/cups/string.h @@ -1,5 +1,5 @@ /* - * "$Id: string.h 5366 2006-04-02 16:11:04Z mike $" + * "$Id: string.h 5466 2006-04-26 19:52:27Z mike $" * * String definitions for the Common UNIX Printing System (CUPS). * @@ -31,13 +31,14 @@ * Include necessary headers... */ -# include - # include +# include # include # include # include +# include + # ifdef HAVE_STRING_H # include # endif /* HAVE_STRING_H */ @@ -157,5 +158,5 @@ extern double _cupsStrScand(const char *buf, char **bufptr, #endif /* !_CUPS_STRING_H_ */ /* - * End of "$Id: string.h 5366 2006-04-02 16:11:04Z mike $". + * End of "$Id: string.h 5466 2006-04-26 19:52:27Z mike $". */ diff --git a/cups/testppd.c b/cups/testppd.c index b2efe3b06..7e59a4276 100644 --- a/cups/testppd.c +++ b/cups/testppd.c @@ -1,5 +1,5 @@ /* - * "$Id: testppd.c 5261 2006-03-09 20:47:49Z mike $" + * "$Id: testppd.c 5484 2006-05-02 20:38:12Z mike $" * * PPD test program for the Common UNIX Printing System (CUPS). * @@ -78,55 +78,99 @@ main(int argc, /* I - Number of command-line arguments */ status = 0; - fputs("ppdOpenFile: ", stdout); - - if ((ppd = ppdOpenFile("test.ppd")) != NULL) - puts("PASS"); - else + if (argc == 1) { - ppd_status_t err; /* Last error in file */ - int line; /* Line number in file */ - - - status ++; - err = ppdLastError(&line); + fputs("ppdOpenFile: ", stdout); + + if ((ppd = ppdOpenFile("test.ppd")) != NULL) + puts("PASS"); + else + { + ppd_status_t err; /* Last error in file */ + int line; /* Line number in file */ + + + status ++; + err = ppdLastError(&line); + + printf("FAIL (%s on line %d)\n", ppdErrorString(err), line); + } + + fputs("ppdMarkDefaults: ", stdout); + ppdMarkDefaults(ppd); + + if ((conflicts = ppdConflicts(ppd)) == 0) + puts("PASS"); + else + { + status ++; + printf("FAIL (%d conflicts)\n", conflicts); + } + + fputs("ppdEmitString: ", stdout); + if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL && + !strcmp(s, default_code)) + puts("PASS"); + else + { + printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0, + (int)strlen(default_code)); + + if (s) + puts(s); + } - printf("FAIL (%s on line %d)\n", ppdErrorString(err), line); - } - - fputs("ppdMarkDefaults: ", stdout); - ppdMarkDefaults(ppd); + if (s) + free(s); - if ((conflicts = ppdConflicts(ppd)) == 0) - puts("PASS"); - else - { - status ++; - printf("FAIL (%d conflicts)\n", conflicts); + ppdClose(ppd); } - - fputs("ppdEmitString: ", stdout); - if ((s = ppdEmitString(ppd, PPD_ORDER_ANY, 0.0)) != NULL && - !strcmp(s, default_code)) - puts("PASS"); else { - printf("FAIL (%d bytes instead of %d)\n", s ? (int)strlen(s) : 0, - (int)strlen(default_code)); - - if (s) - puts(s); + if ((ppd = ppdOpenFile(argv[1])) == NULL) + { + ppd_status_t err; /* Last error in file */ + int line; /* Line number in file */ + + + status ++; + err = ppdLastError(&line); + + printf("%s: %s on line %d\n", argv[1], ppdErrorString(err), line); + } + else + { + int i, j, k; /* Looping vars */ + ppd_group_t *group; /* Option group */ + ppd_option_t *option; /* Option */ + + + ppdLocalize(ppd); + + for (i = ppd->num_groups, group = ppd->groups; + i > 0; + i --, group ++) + { + printf("%s (%s):\n", group->name, group->text); + + for (j = group->num_options, option = group->options; + j > 0; + j --, option ++) + { + printf(" %s (%s):\n", option->keyword, option->text); + + for (k = 0; k < option->num_choices; k ++) + printf(" - %s (%s)\n", option->choices[k].choice, + option->choices[k].text); + } + } + } } - if (s) - free(s); - - ppdClose(ppd); - return (status); } /* - * End of "$Id: testppd.c 5261 2006-03-09 20:47:49Z mike $". + * End of "$Id: testppd.c 5484 2006-05-02 20:38:12Z mike $". */ diff --git a/doc/help/ref-cupsd-conf.html b/doc/help/ref-cupsd-conf.html index 33dd55012..c8ac57cf8 100644 --- a/doc/help/ref-cupsd-conf.html +++ b/doc/help/ref-cupsd-conf.html @@ -929,6 +929,22 @@ policy to use for IPP operation. The default is default.

+

CUPS 1.2DefaultShared

+ +

Examples

+ +
+DefaultShared yes
+DefaultShared no
+
+ +

Description

+ +

The DefaultShared directive specifies whether +printers are shared (published) by default. The default is +yes.

+ +

Deny

Examples

@@ -2667,6 +2683,28 @@ to wait before an active HTTP or IPP request times out. The default timeout is 300 seconds.

+

CUPS 1.2UseNetworkDefault

+ +

Examples

+ +
+UseNetworkDefault yes
+UseNetworkDefault no
+
+ +

Description

+ +

The UseNetworkDefault directive controls whether +the client will use a network/remote printer as a default +printer. If enabled, the default printer of a server is used as +the default printer on a client. When multiple servers are +advertising a default printer, the client's default printer is +set to the first discovered printer, or to the implicit class for +the same printer available from multiple servers.

+ +

The default is yes.

+ +

User

Examples

diff --git a/doc/help/whatsnew.html b/doc/help/whatsnew.html index 2a97dfe1a..d61308f14 100644 --- a/doc/help/whatsnew.html +++ b/doc/help/whatsnew.html @@ -31,11 +31,14 @@ HREF="overview.html">"Overview of CUPS" document instead.

SSL-encrypted, and TLS-encrypted connections over a single port +
  • Network Printer Discovery; CUPS can + now find printers on the LAN using SNMP
  • +
    Browsing
    -
      +
      1. LDAP Support; CUPS now supports printer sharing via the Lightweight Directory @@ -76,7 +79,7 @@ HREF="overview.html">"Overview of CUPS" document instead.

        Web Interface
        -
          +
          1. Improved Look and Feel; The web interface has improved readability and a more @@ -169,7 +172,7 @@ HREF="overview.html">"Overview of CUPS" document instead.

            IPP Support
            -
              +
              1. IPP Notifications; CUPS now supports the complete IPP notification specification to @@ -269,7 +272,7 @@ HREF="overview.html">"Overview of CUPS" document instead.

                Scheduler
                -
                  +
                  1. Remote Printer Caching; The scheduler now maintains a remote printer cache so that @@ -376,7 +379,7 @@ HREF="overview.html">"Overview of CUPS" document instead.

                    LPD Client Support
                    -
                      +
                      1. Performance Improvements; CUPS no longer loads every available printer before @@ -393,7 +396,7 @@ HREF="overview.html">"Overview of CUPS" document instead.

                        Localization and Internationalization
                        -
                          +
                          1. Command-Line Programs; All command-line programs are now fully @@ -411,7 +414,7 @@ HREF="overview.html">"Overview of CUPS" document instead.

                            Printer Drivers
                            -
                              +
                              1. New Drivers; CUPS 1.2 adds Zebra CPCL and EPL label printer drivers
                              2. @@ -446,7 +449,7 @@ HREF="overview.html">"Overview of CUPS" document instead.

                                CUPS API
                                -
                                  +
                                  1. Thread Safety; All of the CUPS API is now thread-safe on systems that support POSIX @@ -503,7 +506,7 @@ HREF="overview.html">"Overview of CUPS" document instead.

                                    CUPS Imaging API
                                    -
                                      +
                                      1. Image API; The new image API provides access to image files of arbitrary size @@ -519,7 +522,7 @@ HREF="overview.html">"Overview of CUPS" document instead.

                                      Scripting Support
                                      -
                                        +
                                        1. PHP Bindings; The PHP language bindings have been revamped to be more consistent diff --git a/doc/pl/images/button-publish-printer.gif b/doc/pl/images/button-publish-printer.gif index 5c026a873ff221536090c114209e700ee6266634..c12abe87e6d1bc8ffe9fea6393a8e11384ef64bd 100644 GIT binary patch delta 536 zc-jFN0_Xky1j7V9M@dFFIbnhT6aa(}0BB_}YiT)jazlK4QH6(Ji-}j4m1C2Ya-^Yv ztg4T-w3@)dtIp27=;z0XsWJk>%MR- z&vYvkWImpC@BhG{OrR4Pgvg|F*)rsg%&2rabB>gcRu-_`&b&-;P2AhP9%#pcr){gq zJ@i98@WEyG84&{84ipS$ZYgr78o%o(i0- zTh1%V4c6EI+W-mI0Sl-vy)0RX3JTE70K&|j0|A7r#PNsG`NaVCS_J5XFCZ))^MuH0 zkYFD{dh`-JbBJ#R7-|(Ma*;S~L4#cnH%@=#A_q+jb^gIT-GhiCfVY2K2q2)PGNZH< z3eZ7YSxhEP01XrjKo;_W&lC<&+9&`_MFRwg7IYyHAix211h*_W01N5>sTuLLTNL(b zRDxSkIG`#3K~WTGag`eo=mn0ZDF|eG+J(U!1uL_*WYAErEVp4v%~>!KjA6da0uW3F zpepFwLz4q2*wujR3lU1G)EFpQ%A-AeN&^Xi;H7FMYhjRp@|p(ck+p*y*yX~?2->-W a3-4V7Lg?Yhsh}=i;&}4sKyDNX0RTHJ%;1y& delta 596 zc-jF}0;~PQ1pWj)M@dFFIboLo6aa(}0BB_}YiT)jazcE3P=$tFi-}j4m1C5bbflqy zt*el=w3@)dtJKoM=jPq-@$UWq{E0XsWJk>%MR- z&vZQt1*wmx?f<}_aJUleLAIuw9CQ*HAbJ z(83c#TLBw*_{wM%4<8kbO&Om;bRB;k8x1F2XQbq`Uojz#Mc1TOFfVS ipj==%@4mkMAoF!hzt6w__9G%7)87by_2F%MR- z&-8l|WIm#G@BhG{E1(kYVGjs_ z3_O1U35Gl`CVirC36-z_40izpc@GK#0i`Jl2qy>%u>l4TvIPw-4g#LCaJ0$23dH~k zvXBcgC$B1_w9<*J;{X9+4yX>}=#O&`<>H~><^k*g4eQaK$jdU_gK} zn%*=JCO|=$1j26Wq7`h|HIp4v)CoEOX+EAl;n?)W4O@al;j_W!!P4!~-tpb%_UZio`jJ5_kx&GYZ4G~202BZK1^yr;j?fSQXsWJk>%MUO z1_No2r>yUM4+l39!AC3_V+7mq$ZQ&uBd2t_!_5$lha*u)J$hf(K;d|BsWKo0rYM{Q zgoPI@cDMs^w5$Ys)XUs(?f11Jv!Spb4zC;MXmZ!D0%aYA=$^ZclsR$?t z2U0W#4ABAz3}v@~EU<`y(ag-1VF3*R)WpMd%nS#ig}!TsHHeyz`(U1hh8io zU@AZXUML(Kk~pn^z7!Ny46t)zfTKzbx`1Q5btr%Vh|^gZ_=-^j#=|lVXrsAPm!*s+FtWRBG`|1LU ZSFmV%n6=?Ft=nlqY=nB7mPU{e06Y9Cu|WU; diff --git a/doc/pl/images/button-start-printer.gif b/doc/pl/images/button-start-printer.gif index b39d67e96f7dca8f140808a2b072002085c6fbce..cd1734cce7bcf8107c18ea34ac9fecb1119d6b34 100644 GIT binary patch delta 563 zc-jFo0?hsD1KtEZM@dFFIbn(b6aa(}005Z)0G$mOr5P-&FhQ_9SF=V_yHj7kUvI{5 zg3N%G)t0y7xY+O4<@D$B`0xGy{E%MR- z&vZ?n1gVdx?f<}_P#D;W3d5vw$+Q)8$fk5k9X?0Z*CU(U0=+>V44fi=tB-U;A^4eV zZ(9)(GskWBE+8;KFxq%Qc{C+;EM5-=3|nMg0}Boh3kCoW2a5~@DFF%&4hlUF1Pl%b zqYi(RhbsvRDv67gD~Kuy2PumWnPrNMw6*~W4U#=CCWf+Q38BaU3kNt0m23fiDGCTD ztjPfc56T4$Eo1@>uF7T1UIzm#)Zvxqu>k8S3Cf(UFek^Z=>7i=i22*&r9qDX<>UqM zvQXTLh6CmK+cH3)3W$vWR8+y>V8R#s#t?tQ$ZVp;jFsFD&Kme;+((oX5dcadKmh|` zE6d1~m8NHmkS`dpOEKVGBVt}Us`_VeQ$jFM9n#7tG37r|2sGVFP?4l70$Eiwy`lAm zfdv&Gr6R)sTTL$su;fhQ6r)YARvL#h;8{QSg9bD0}}xbz06Tr6 B?P>r3 delta 446 zc-jHJ0YU!W1nL7lM@dFFIbmx66aa(}005Z)0G%MR- z$H73}<2mnq@Be@RPDB72k4PWkR!lmdP}Fi1t;QZe>`L3py#ffvqmd}2xHB~B!6plQ z>RlWrguoPqlYpQ&_u^Ut1`KaJb25i7B`^;+RuZ_u6!Sge^D#i(fo$o#^RW zGk_V2fd#oeXlM)`iyC(bya`YsL5c>I98_}RXb=U+EhuON9AL08#R47OmBW+CLNn7Cc~ZvzY<|0FEBOnc}L&6(XKl8B6vH om9l8lrXbNot=lS7MznoP_ek6uV(aRqG33U$y?|5H7!m>iJ7aIc2LJ#7 diff --git a/doc/pl/images/button-unpublish-printer.gif b/doc/pl/images/button-unpublish-printer.gif index 60a5b14ebb3ef4607be4cc2cd0c00198062d093c..2842a3e1806fcf40b2d28af24d42f4863783f3dc 100644 GIT binary patch delta 570 zc-jFv0>%Bl1?2=iM@dFFIboFm6aa(}0BB_}YiT)jazcE3QH6(Ji-}i~lyR4pW2K>i ztgDc^6&ls{E0XsWJk>%MR- z&vYFN1*wmx?f<}_aF`P8L59)5HJr61Sx+mT>}aXYj!J%GFt%y2@Q2Kl8QbhgaZu$XQL)3@jdnGiK$+zFwsLHa232@l@usg zN6X;3EdxZ&6Von50E*tMMQm|#B7lwaw4i@L;D}b7le**LG^obV<}071ep1Ofyw(90x>1qKM(Wn>j0qoic&-X#SXg@e2T5Rh*D z8(64{9BNT8Xn3hmWt?kc)%~*BfdYwsoieD#_L$_eZuSHv(|R0XsWJk>%MR- z&vb3ytx%Bsc;djIa7ZlT1U-?#$ZR^F(3OF=j9RbQENeQ#J+!GWODraqU1wvOwqB=v zug5~=hNbKF79I?E_#F!aH+yk5NDy`m1Yv_KgnE#CXaE5N2@OANK#waWb^{FoC}b%L z4iA3}nT&L!m#9ByWCsneqqYD945thSeSUsn2(%50eJQjL#G`F033H>fU$M6U3J563 z%6-wsDAwIBCV2}9w_*tj0s#xptnLr#>(A4D3F^+~*a!guxheK`{Ug1{Z&h z*!b}t9eGd?pmj@uy?#qq9AGeT058S?1SAOEV4qep1o#20>Y1Ov1-%YSbP!tr0>i8- zDY$y3b)^LoamVca8>@1lEOul@!62ur(<~62a&T=_bq5M&Zcf&`&-d_E0k~>V&M9!F z(IUTJ_5e^>pyOLh48WjVd<8jm!(T{yFo@8W7Mw^u5(7~R7I6q74JO#&Pz6m$1PN70 uBB6yToT3efKyWcah9H(`;u9kBaNvn7wkX4cNr)hhi!|1lf(}W90029y%Muj; diff --git a/filter/Makefile b/filter/Makefile index 79b7fecb2..57c8625ad 100644 --- a/filter/Makefile +++ b/filter/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 5354 2006-03-29 20:55:15Z mike $" +# "$Id: Makefile 5491 2006-05-04 20:53:35Z mike $" # # Filter makefile for the Common UNIX Printing System (CUPS). # @@ -205,7 +205,8 @@ hpgltops: $(HPGLOBJS) common.o ../cups/$(LIBCUPS) libcupsimage.so.2 libcupsimage.sl.2: $(IMAGEOBJS) echo Linking $@... - $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(IMAGEOBJS) $(DSOLIBS) -lm + $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(IMAGEOBJS) $(DSOLIBS) \ + -L../cups $(LINKCUPS) -lm $(RM) `basename $@ .2` $(LN) $@ `basename $@ .2` @@ -216,7 +217,8 @@ libcupsimage.so.2 libcupsimage.sl.2: $(IMAGEOBJS) libcupsimage.32.so.2: $(IMAGE32OBJS) echo Linking 32-bit $@... - $(DSO) $(ARCH32FLAGS) $(DSOFLAGS) -o $@ $(IMAGE32OBJS) $(DSOLIBS) -lm + $(DSO) $(ARCH32FLAGS) $(DSOFLAGS) -o $@ $(IMAGE32OBJS) $(DSOLIBS) \ + -L../cups $(LINKCUPS) -lm # @@ -225,7 +227,8 @@ libcupsimage.32.so.2: $(IMAGE32OBJS) libcupsimage.64.so.2: $(IMAGE64OBJS) echo Linking 64-bit $@... - $(DSO) $(ARCH64FLAGS) $(DSOFLAGS) -o $@ $(IMAGE64OBJS) $(DSOLIBS) -lm + $(DSO) $(ARCH64FLAGS) $(DSOFLAGS) -o $@ $(IMAGE64OBJS) $(DSOLIBS) \ + -L../cups $(LINKCUPS) -lm # @@ -247,7 +250,7 @@ libcupsimage.2.dylib: $(IMAGEOBJS) # libcupsimage_s.a # -libcupsimage_s.a: $(IMAGEOBJS) +libcupsimage_s.a: $(IMAGEOBJS) libcupsimage_s.exp echo Linking $@... $(DSO) $(DSOFLAGS) -Wl,-berok,-bexport:libcupsimage_s.exp \ -o libcupsimage_s.o $(IMAGEOBJS) $(DSOLIBS) -lm @@ -262,6 +265,7 @@ libcupsimage_s.a: $(IMAGEOBJS) libcupsimage.la: $(IMAGEOBJS) echo Linking $@... $(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(IMAGEOBJS:.o=.lo) $(DSOLIBS) \ + -L../cups $(LINKCUPS) \ -rpath $(LIBDIR) -version-info 2:2 @@ -371,5 +375,5 @@ include Dependencies # -# End of "$Id: Makefile 5354 2006-03-29 20:55:15Z mike $". +# End of "$Id: Makefile 5491 2006-05-04 20:53:35Z mike $". # diff --git a/filter/imagetoraster.c b/filter/imagetoraster.c index affac6c0a..0c7d705a2 100644 --- a/filter/imagetoraster.c +++ b/filter/imagetoraster.c @@ -1,5 +1,5 @@ /* - * "$Id: imagetoraster.c 5191 2006-02-27 02:47:56Z mike $" + * "$Id: imagetoraster.c 5485 2006-05-02 23:59:56Z mike $" * * Image file to raster filter for the Common UNIX Printing System (CUPS). * @@ -26,8 +26,6 @@ * Contents: * * main() - Main entry... - * exec_code() - Execute PostScript setpagedevice commands as - * appropriate. * format_CMY() - Convert image data to CMY. * format_CMYK() - Convert image data to CMYK. * format_K() - Convert image data to black. @@ -38,6 +36,7 @@ * format_YMC() - Convert image data to YMC. * format_YMCK() - Convert image data to YMCK. * make_lut() - Make a lookup table given gamma and brightness values. + * raster_cb() - Validate the page header. */ /* @@ -172,7 +171,6 @@ int Planes[] = /* Number of planes for each colorspace */ * Local functions... */ -static void exec_code(cups_page_header2_t *header, const char *code); static void format_CMY(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1); static void format_CMYK(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1); static void format_K(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1); @@ -184,6 +182,7 @@ static void format_W(cups_page_header2_t *header, unsigned char *row, int y, int static void format_YMC(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1); static void format_YMCK(cups_page_header2_t *header, unsigned char *row, int y, int z, int xsize, int ysize, int yerr0, int yerr1, cups_ib_t *r0, cups_ib_t *r1); static void make_lut(cups_ib_t *, int, float, float); +static int raster_cb(cups_page_header2_t *header, int preferred_bits); /* @@ -212,12 +211,10 @@ main(int argc, /* I - Number of command-line arguments */ xtemp, /* Bitmap width in pixels */ ytemp, /* Bitmap height in pixels */ page; /* Current page number */ - int xc0, yc0, /* Corners of the page in image coords */ + int xc0, yc0, /* Corners of the page in image coords */ xc1, yc1; ppd_file_t *ppd; /* PPD file */ - ppd_choice_t *choice, /* PPD option choice */ - **choices; /* List of marked choices */ - int count; /* Number of marked choices */ + ppd_choice_t *choice; /* PPD option choice */ char *resolution, /* Output resolution */ *media_type; /* Media type */ ppd_profile_t *profile; /* Color profile */ @@ -506,31 +503,11 @@ main(int argc, /* I - Number of command-line arguments */ * Set the needed options in the page header... */ - memset(&header, 0, sizeof(header)); - header.HWResolution[0] = 100; - header.HWResolution[1] = 100; - header.cupsBitsPerColor = 1; - header.cupsColorOrder = CUPS_ORDER_CHUNKED; - header.cupsColorSpace = CUPS_CSPACE_K; - - if (ppd && ppd->patches) - exec_code(&header, ppd->patches); - - if ((count = ppdCollect(ppd, PPD_ORDER_DOCUMENT, &choices)) > 0) - for (i = 0; i < count; i ++) - exec_code(&header, choices[i]->code); - - if ((count = ppdCollect(ppd, PPD_ORDER_ANY, &choices)) > 0) - for (i = 0; i < count; i ++) - exec_code(&header, choices[i]->code); - - if ((count = ppdCollect(ppd, PPD_ORDER_PROLOG, &choices)) > 0) - for (i = 0; i < count; i ++) - exec_code(&header, choices[i]->code); - - if ((count = ppdCollect(ppd, PPD_ORDER_PAGE, &choices)) > 0) - for (i = 0; i < count; i ++) - exec_code(&header, choices[i]->code); + if (cupsRasterInterpretPPD(&header, ppd, num_options, options, raster_cb)) + { + fputs("ERROR: Bad page setup!\n", stderr); + return (1); + } /* * Get the media type and resolution that have been chosen... @@ -555,7 +532,6 @@ main(int argc, /* I - Number of command-line arguments */ case CUPS_CSPACE_W : primary = CUPS_IMAGE_WHITE; secondary = CUPS_IMAGE_WHITE; - header.cupsBitsPerPixel = header.cupsBitsPerColor; break; default : @@ -564,25 +540,6 @@ main(int argc, /* I - Number of command-line arguments */ case CUPS_CSPACE_RGBW : primary = CUPS_IMAGE_RGB; secondary = CUPS_IMAGE_RGB; - - /* - * Ensure that colorimetric colorspaces use at least 8 bits per - * component... - */ - - if (header.cupsColorSpace >= CUPS_CSPACE_CIEXYZ && - header.cupsBitsPerColor < 8) - header.cupsBitsPerColor = 8; - - if (header.cupsColorOrder == CUPS_ORDER_CHUNKED) - { - if (header.cupsBitsPerColor >= 8) - header.cupsBitsPerPixel = header.cupsBitsPerColor * 3; - else - header.cupsBitsPerPixel = header.cupsBitsPerColor * 4; - } - else - header.cupsBitsPerPixel = header.cupsBitsPerColor; break; case CUPS_CSPACE_K : @@ -591,7 +548,6 @@ main(int argc, /* I - Number of command-line arguments */ case CUPS_CSPACE_SILVER : primary = CUPS_IMAGE_BLACK; secondary = CUPS_IMAGE_BLACK; - header.cupsBitsPerPixel = header.cupsBitsPerColor; break; case CUPS_CSPACE_CMYK : @@ -601,27 +557,12 @@ main(int argc, /* I - Number of command-line arguments */ case CUPS_CSPACE_GMCS : primary = CUPS_IMAGE_CMYK; secondary = CUPS_IMAGE_CMYK; - - if (header.cupsColorOrder == CUPS_ORDER_CHUNKED) - header.cupsBitsPerPixel = header.cupsBitsPerColor * 4; - else - header.cupsBitsPerPixel = header.cupsBitsPerColor; break; case CUPS_CSPACE_CMY : case CUPS_CSPACE_YMC : primary = CUPS_IMAGE_CMY; secondary = CUPS_IMAGE_CMY; - - if (header.cupsColorOrder == CUPS_ORDER_CHUNKED) - { - if (header.cupsBitsPerColor >= 8) - header.cupsBitsPerPixel = 24; - else - header.cupsBitsPerPixel = header.cupsBitsPerColor * 4; - } - else - header.cupsBitsPerPixel = header.cupsBitsPerColor; break; case CUPS_CSPACE_KCMYcm : @@ -629,21 +570,11 @@ main(int argc, /* I - Number of command-line arguments */ { primary = CUPS_IMAGE_CMY; secondary = CUPS_IMAGE_CMY; - - if (header.cupsColorOrder == CUPS_ORDER_CHUNKED) - header.cupsBitsPerPixel = 8; - else - header.cupsBitsPerPixel = 1; } else { primary = CUPS_IMAGE_CMYK; secondary = CUPS_IMAGE_CMYK; - - if (header.cupsColorOrder == CUPS_ORDER_CHUNKED) - header.cupsBitsPerPixel = header.cupsBitsPerColor * 4; - else - header.cupsBitsPerPixel = header.cupsBitsPerColor; } break; } @@ -1466,184 +1397,6 @@ main(int argc, /* I - Number of command-line arguments */ } -/* - * 'exec_code()' - Execute PostScript setpagedevice commands as appropriate. - */ - -static void -exec_code(cups_page_header2_t *header, /* I - Page header */ - const char *code) /* I - Option choice to execute */ -{ - char *ptr, /* Pointer into name/value string */ - name[255], /* Name of pagedevice entry */ - value[1024]; /* Value of pagedevice entry */ - - - for (; *code != '\0';) - { - /* - * Search for the start of a dictionary name... - */ - - while (*code != '/' && *code != '\0') - code ++; - - if (*code == '\0') - break; - - /* - * Get the name... - */ - - code ++; - for (ptr = name; isalnum(*code & 255) && (ptr - name) < (sizeof(name) - 1);) - *ptr++ = *code++; - *ptr = '\0'; - - /* - * The parse the value as needed... - */ - - while (isspace(*code & 255)) - code ++; - - if (*code == '\0') - break; - - if (*code == '[') - { - /* - * Read array of values... - */ - - code ++; - for (ptr = value; - *code != ']' && *code != '\0' && - (ptr - value) < (sizeof(value) - 1);) - *ptr++ = *code++; - *ptr = '\0'; - } - else if (*code == '(') - { - /* - * Read string value... - */ - - code ++; - for (ptr = value; - *code != ')' && *code != '\0' && - (ptr - value) < (sizeof(value) - 1);) - if (*code == '\\') - { - code ++; - if (isdigit(*code & 255)) - *ptr++ = (char)strtol(code, (char **)&code, 8); - else - *ptr++ = *code++; - } - else - *ptr++ = *code++; - - *ptr = '\0'; - } - else if (isdigit(*code & 255) || *code == '-') - { - /* - * Read single number... - */ - - for (ptr = value; - (isdigit(*code & 255) || *code == '-') && - (ptr - value) < (sizeof(value) - 1);) - *ptr++ = *code++; - *ptr = '\0'; - } - else - { - /* - * Read a single name... - */ - - for (ptr = value; - (isalnum(*code & 255) || *code == '_') && - (ptr - value) < (sizeof(value) - 1);) - *ptr++ = *code++; - *ptr = '\0'; - } - - /* - * Assign the value as needed... - */ - - if (!strcmp(name, "MediaClass")) - strlcpy(header->MediaClass, value, sizeof(header->MediaClass)); - else if (!strcmp(name, "MediaColor")) - strlcpy(header->MediaColor, value, sizeof(header->MediaColor)); - else if (!strcmp(name, "MediaType")) - strlcpy(header->MediaType, value, sizeof(header->MediaType)); - else if (!strcmp(name, "OutputType")) - strlcpy(header->OutputType, value, sizeof(header->OutputType)); - else if (!strcmp(name, "AdvanceDistance")) - header->AdvanceDistance = atoi(value); - else if (!strcmp(name, "AdvanceMedia")) - header->AdvanceMedia = atoi(value); - else if (!strcmp(name, "Collate")) - header->Collate = !strcmp(value, "true"); - else if (!strcmp(name, "CutMedia")) - header->CutMedia = (cups_cut_t)atoi(value); - else if (!strcmp(name, "Duplex")) - header->Duplex = !strcmp(value, "true"); - else if (!strcmp(name, "HWResolution")) - sscanf(value, "%d%d", header->HWResolution + 0, header->HWResolution + 1); - else if (!strcmp(name, "InsertSheet")) - header->InsertSheet = !strcmp(value, "true"); - else if (!strcmp(name, "Jog")) - header->Jog = atoi(value); - else if (!strcmp(name, "LeadingEdge")) - header->LeadingEdge = atoi(value); - else if (!strcmp(name, "Margins")) - sscanf(value, "%d%d", header->Margins + 0, header->Margins + 1); - else if (!strcmp(name, "ManualFeed")) - header->ManualFeed = !strcmp(value, "true"); - else if (!strcmp(name, "cupsMediaPosition") || /* Compatibility */ - !strcmp(name, "MediaPosition")) - header->MediaPosition = atoi(value); - else if (!strcmp(name, "MediaWeight")) - header->MediaWeight = atoi(value); - else if (!strcmp(name, "MirrorPrint")) - header->MirrorPrint = !strcmp(value, "true"); - else if (!strcmp(name, "NegativePrint")) - header->NegativePrint = !strcmp(value, "true"); - else if (!strcmp(name, "Orientation")) - header->Orientation = atoi(value); - else if (!strcmp(name, "OutputFaceUp")) - header->OutputFaceUp = !strcmp(value, "true"); - else if (!strcmp(name, "Separations")) - header->Separations = !strcmp(value, "true"); - else if (!strcmp(name, "TraySwitch")) - header->TraySwitch = !strcmp(value, "true"); - else if (!strcmp(name, "Tumble")) - header->Tumble = !strcmp(value, "true"); - else if (!strcmp(name, "cupsMediaType")) - header->cupsMediaType = atoi(value); - else if (!strcmp(name, "cupsBitsPerColor")) - header->cupsBitsPerColor = atoi(value); - else if (!strcmp(name, "cupsColorOrder")) - header->cupsColorOrder = (cups_order_t)atoi(value); - else if (!strcmp(name, "cupsColorSpace")) - header->cupsColorSpace = (cups_cspace_t)atoi(value); - else if (!strcmp(name, "cupsCompression")) - header->cupsCompression = atoi(value); - else if (!strcmp(name, "cupsRowCount")) - header->cupsRowCount = atoi(value); - else if (!strcmp(name, "cupsRowFeed")) - header->cupsRowFeed = atoi(value); - else if (!strcmp(name, "cupsRowStep")) - header->cupsRowStep = atoi(value); - } -} - - /* * 'format_CMY()' - Convert image data to CMY. */ @@ -1657,18 +1410,18 @@ format_CMY(cups_page_header2_t *header, /* I - Page header */ int ysize, /* I - Height of image data */ int yerr0, /* I - Top Y error */ int yerr1, /* I - Bottom Y error */ - cups_ib_t *r0, /* I - Primary image data */ - cups_ib_t *r1) /* I - Image data for interpolation */ + cups_ib_t *r0, /* I - Primary image data */ + cups_ib_t *r1) /* I - Image data for interpolation */ { - cups_ib_t *ptr, /* Pointer into row */ - *cptr, /* Pointer into cyan */ - *mptr, /* Pointer into magenta */ - *yptr, /* Pointer into yellow */ - bitmask; /* Current mask for pixel */ - int bitoffset; /* Current offset in line */ - int bandwidth; /* Width of a color band */ - int x, /* Current X coordinate on page */ - *dither; /* Pointer into dither array */ + cups_ib_t *ptr, /* Pointer into row */ + *cptr, /* Pointer into cyan */ + *mptr, /* Pointer into magenta */ + *yptr, /* Pointer into yellow */ + bitmask; /* Current mask for pixel */ + int bitoffset; /* Current offset in line */ + int bandwidth; /* Width of a color band */ + int x, /* Current X coordinate on page */ + *dither; /* Pointer into dither array */ switch (XPosition) @@ -2023,7 +1776,7 @@ format_CMY(cups_page_header2_t *header, /* I - Page header */ */ static void -format_CMYK(cups_page_header2_t *header, /* I - Page header */ +format_CMYK(cups_page_header2_t *header,/* I - Page header */ unsigned char *row, /* IO - Bitmap data for device */ int y, /* I - Current row */ int z, /* I - Current plane */ @@ -2031,19 +1784,19 @@ format_CMYK(cups_page_header2_t *header, /* I - Page header */ int ysize, /* I - Height of image data */ int yerr0, /* I - Top Y error */ int yerr1, /* I - Bottom Y error */ - cups_ib_t *r0, /* I - Primary image data */ - cups_ib_t *r1) /* I - Image data for interpolation */ + cups_ib_t *r0, /* I - Primary image data */ + cups_ib_t *r1) /* I - Image data for interpolation */ { - cups_ib_t *ptr, /* Pointer into row */ - *cptr, /* Pointer into cyan */ - *mptr, /* Pointer into magenta */ - *yptr, /* Pointer into yellow */ - *kptr, /* Pointer into black */ - bitmask; /* Current mask for pixel */ - int bitoffset; /* Current offset in line */ - int bandwidth; /* Width of a color band */ - int x, /* Current X coordinate on page */ - *dither; /* Pointer into dither array */ + cups_ib_t *ptr, /* Pointer into row */ + *cptr, /* Pointer into cyan */ + *mptr, /* Pointer into magenta */ + *yptr, /* Pointer into yellow */ + *kptr, /* Pointer into black */ + bitmask; /* Current mask for pixel */ + int bitoffset; /* Current offset in line */ + int bandwidth; /* Width of a color band */ + int x, /* Current X coordinate on page */ + *dither; /* Pointer into dither array */ switch (XPosition) @@ -2405,14 +2158,14 @@ format_K(cups_page_header2_t *header, /* I - Page header */ int ysize, /* I - Height of image data */ int yerr0, /* I - Top Y error */ int yerr1, /* I - Bottom Y error */ - cups_ib_t *r0, /* I - Primary image data */ - cups_ib_t *r1) /* I - Image data for interpolation */ + cups_ib_t *r0, /* I - Primary image data */ + cups_ib_t *r1) /* I - Image data for interpolation */ { - cups_ib_t *ptr, /* Pointer into row */ - bitmask; /* Current mask for pixel */ - int bitoffset; /* Current offset in line */ - int x, /* Current X coordinate on page */ - *dither; /* Pointer into dither array */ + cups_ib_t *ptr, /* Pointer into row */ + bitmask; /* Current mask for pixel */ + int bitoffset; /* Current offset in line */ + int x, /* Current X coordinate on page */ + *dither; /* Pointer into dither array */ (void)z; @@ -2515,7 +2268,7 @@ format_K(cups_page_header2_t *header, /* I - Page header */ */ static void -format_KCMY(cups_page_header2_t *header, /* I - Page header */ +format_KCMY(cups_page_header2_t *header,/* I - Page header */ unsigned char *row, /* IO - Bitmap data for device */ int y, /* I - Current row */ int z, /* I - Current plane */ @@ -2523,19 +2276,19 @@ format_KCMY(cups_page_header2_t *header, /* I - Page header */ int ysize, /* I - Height of image data */ int yerr0, /* I - Top Y error */ int yerr1, /* I - Bottom Y error */ - cups_ib_t *r0, /* I - Primary image data */ - cups_ib_t *r1) /* I - Image data for interpolation */ + cups_ib_t *r0, /* I - Primary image data */ + cups_ib_t *r1) /* I - Image data for interpolation */ { - cups_ib_t *ptr, /* Pointer into row */ - *cptr, /* Pointer into cyan */ - *mptr, /* Pointer into magenta */ - *yptr, /* Pointer into yellow */ - *kptr, /* Pointer into black */ - bitmask; /* Current mask for pixel */ - int bitoffset; /* Current offset in line */ - int bandwidth; /* Width of a color band */ - int x, /* Current X coordinate on page */ - *dither; /* Pointer into dither array */ + cups_ib_t *ptr, /* Pointer into row */ + *cptr, /* Pointer into cyan */ + *mptr, /* Pointer into magenta */ + *yptr, /* Pointer into yellow */ + *kptr, /* Pointer into black */ + bitmask; /* Current mask for pixel */ + int bitoffset; /* Current offset in line */ + int bandwidth; /* Width of a color band */ + int x, /* Current X coordinate on page */ + *dither; /* Pointer into dither array */ switch (XPosition) @@ -2923,30 +2676,31 @@ format_KCMY(cups_page_header2_t *header, /* I - Page header */ */ static void -format_KCMYcm(cups_page_header2_t *header,/* I - Page header */ - unsigned char *row, /* IO - Bitmap data for device */ - int y, /* I - Current row */ - int z, /* I - Current plane */ - int xsize,/* I - Width of image data */ - int ysize,/* I - Height of image data */ - int yerr0,/* I - Top Y error */ - int yerr1,/* I - Bottom Y error */ - cups_ib_t *r0, /* I - Primary image data */ - cups_ib_t *r1) /* I - Image data for interpolation */ +format_KCMYcm( + cups_page_header2_t *header, /* I - Page header */ + unsigned char *row, /* IO - Bitmap data for device */ + int y, /* I - Current row */ + int z, /* I - Current plane */ + int xsize, /* I - Width of image data */ + int ysize, /* I - Height of image data */ + int yerr0, /* I - Top Y error */ + int yerr1, /* I - Bottom Y error */ + cups_ib_t *r0, /* I - Primary image data */ + cups_ib_t *r1) /* I - Image data for interpolation */ { - int pc, pm, py, pk; /* Cyan, magenta, yellow, and black values */ - cups_ib_t *ptr, /* Pointer into row */ - *cptr, /* Pointer into cyan */ - *mptr, /* Pointer into magenta */ - *yptr, /* Pointer into yellow */ - *kptr, /* Pointer into black */ - *lcptr, /* Pointer into light cyan */ - *lmptr, /* Pointer into light magenta */ - bitmask; /* Current mask for pixel */ - int bitoffset; /* Current offset in line */ - int bandwidth; /* Width of a color band */ - int x, /* Current X coordinate on page */ - *dither; /* Pointer into dither array */ + int pc, pm, py, pk; /* Cyan, magenta, yellow, and black values */ + cups_ib_t *ptr, /* Pointer into row */ + *cptr, /* Pointer into cyan */ + *mptr, /* Pointer into magenta */ + *yptr, /* Pointer into yellow */ + *kptr, /* Pointer into black */ + *lcptr, /* Pointer into light cyan */ + *lmptr, /* Pointer into light magenta */ + bitmask; /* Current mask for pixel */ + int bitoffset; /* Current offset in line */ + int bandwidth; /* Width of a color band */ + int x, /* Current X coordinate on page */ + *dither; /* Pointer into dither array */ switch (XPosition) @@ -3260,7 +3014,7 @@ format_KCMYcm(cups_page_header2_t *header,/* I - Page header */ */ static void -format_RGBA(cups_page_header2_t *header, /* I - Page header */ +format_RGBA(cups_page_header2_t *header,/* I - Page header */ unsigned char *row, /* IO - Bitmap data for device */ int y, /* I - Current row */ int z, /* I - Current plane */ @@ -3268,18 +3022,18 @@ format_RGBA(cups_page_header2_t *header, /* I - Page header */ int ysize, /* I - Height of image data */ int yerr0, /* I - Top Y error */ int yerr1, /* I - Bottom Y error */ - cups_ib_t *r0, /* I - Primary image data */ - cups_ib_t *r1) /* I - Image data for interpolation */ + cups_ib_t *r0, /* I - Primary image data */ + cups_ib_t *r1) /* I - Image data for interpolation */ { - cups_ib_t *ptr, /* Pointer into row */ - *cptr, /* Pointer into cyan */ - *mptr, /* Pointer into magenta */ - *yptr, /* Pointer into yellow */ - bitmask; /* Current mask for pixel */ - int bitoffset; /* Current offset in line */ - int bandwidth; /* Width of a color band */ - int x, /* Current X coordinate on page */ - *dither; /* Pointer into dither array */ + cups_ib_t *ptr, /* Pointer into row */ + *cptr, /* Pointer into cyan */ + *mptr, /* Pointer into magenta */ + *yptr, /* Pointer into yellow */ + bitmask; /* Current mask for pixel */ + int bitoffset; /* Current offset in line */ + int bandwidth; /* Width of a color band */ + int x, /* Current X coordinate on page */ + *dither; /* Pointer into dither array */ switch (XPosition) @@ -3671,14 +3425,14 @@ format_W(cups_page_header2_t *header, /* I - Page header */ int ysize, /* I - Height of image data */ int yerr0, /* I - Top Y error */ int yerr1, /* I - Bottom Y error */ - cups_ib_t *r0, /* I - Primary image data */ - cups_ib_t *r1) /* I - Image data for interpolation */ + cups_ib_t *r0, /* I - Primary image data */ + cups_ib_t *r1) /* I - Image data for interpolation */ { - cups_ib_t *ptr, /* Pointer into row */ - bitmask; /* Current mask for pixel */ - int bitoffset; /* Current offset in line */ - int x, /* Current X coordinate on page */ - *dither; /* Pointer into dither array */ + cups_ib_t *ptr, /* Pointer into row */ + bitmask; /* Current mask for pixel */ + int bitoffset; /* Current offset in line */ + int x, /* Current X coordinate on page */ + *dither; /* Pointer into dither array */ (void)z; @@ -3789,18 +3543,18 @@ format_YMC(cups_page_header2_t *header, /* I - Page header */ int ysize, /* I - Height of image data */ int yerr0, /* I - Top Y error */ int yerr1, /* I - Bottom Y error */ - cups_ib_t *r0, /* I - Primary image data */ - cups_ib_t *r1) /* I - Image data for interpolation */ + cups_ib_t *r0, /* I - Primary image data */ + cups_ib_t *r1) /* I - Image data for interpolation */ { - cups_ib_t *ptr, /* Pointer into row */ - *cptr, /* Pointer into cyan */ - *mptr, /* Pointer into magenta */ - *yptr, /* Pointer into yellow */ - bitmask; /* Current mask for pixel */ - int bitoffset; /* Current offset in line */ - int bandwidth; /* Width of a color band */ - int x, /* Current X coordinate on page */ - *dither; /* Pointer into dither array */ + cups_ib_t *ptr, /* Pointer into row */ + *cptr, /* Pointer into cyan */ + *mptr, /* Pointer into magenta */ + *yptr, /* Pointer into yellow */ + bitmask; /* Current mask for pixel */ + int bitoffset; /* Current offset in line */ + int bandwidth; /* Width of a color band */ + int x, /* Current X coordinate on page */ + *dither; /* Pointer into dither array */ switch (XPosition) @@ -4170,7 +3924,7 @@ format_YMC(cups_page_header2_t *header, /* I - Page header */ */ static void -format_YMCK(cups_page_header2_t *header, /* I - Page header */ +format_YMCK(cups_page_header2_t *header,/* I - Page header */ unsigned char *row, /* IO - Bitmap data for device */ int y, /* I - Current row */ int z, /* I - Current plane */ @@ -4178,19 +3932,19 @@ format_YMCK(cups_page_header2_t *header, /* I - Page header */ int ysize, /* I - Height of image data */ int yerr0, /* I - Top Y error */ int yerr1, /* I - Bottom Y error */ - cups_ib_t *r0, /* I - Primary image data */ - cups_ib_t *r1) /* I - Image data for interpolation */ + cups_ib_t *r0, /* I - Primary image data */ + cups_ib_t *r1) /* I - Image data for interpolation */ { - cups_ib_t *ptr, /* Pointer into row */ - *cptr, /* Pointer into cyan */ - *mptr, /* Pointer into magenta */ - *yptr, /* Pointer into yellow */ - *kptr, /* Pointer into black */ - bitmask; /* Current mask for pixel */ - int bitoffset; /* Current offset in line */ - int bandwidth; /* Width of a color band */ - int x, /* Current X coordinate on page */ - *dither; /* Pointer into dither array */ + cups_ib_t *ptr, /* Pointer into row */ + *cptr, /* Pointer into cyan */ + *mptr, /* Pointer into magenta */ + *yptr, /* Pointer into yellow */ + *kptr, /* Pointer into black */ + bitmask; /* Current mask for pixel */ + int bitoffset; /* Current offset in line */ + int bandwidth; /* Width of a color band */ + int x, /* Current X coordinate on page */ + *dither; /* Pointer into dither array */ switch (XPosition) @@ -4611,5 +4365,29 @@ make_lut(cups_ib_t *lut, /* I - Lookup table */ /* - * End of "$Id: imagetoraster.c 5191 2006-02-27 02:47:56Z mike $". + * 'raster_cb()' - Validate the page header. + */ + +static int /* O - 0 if OK, -1 if not */ +raster_cb( + cups_page_header2_t *header, /* IO - Raster header */ + int preferred_bits) /* I - Preferred bits per color */ +{ + /* + * Ensure that colorimetric colorspaces use at least 8 bits per + * component... + */ + + if ((header->cupsColorSpace == CUPS_CSPACE_CIEXYZ || + header->cupsColorSpace == CUPS_CSPACE_CIELab || + header->cupsColorSpace >= CUPS_CSPACE_ICC1) && + header->cupsBitsPerColor < 8) + header->cupsBitsPerColor = 8; + + return (0); +} + + +/* + * End of "$Id: imagetoraster.c 5485 2006-05-02 23:59:56Z mike $". */ diff --git a/filter/interpret.c b/filter/interpret.c index 8c3408f37..661bbdbea 100644 --- a/filter/interpret.c +++ b/filter/interpret.c @@ -1,5 +1,5 @@ /* - * "$Id: interpret.c 4998 2006-01-26 21:59:54Z mike $" + * "$Id: interpret.c 5490 2006-05-04 19:12:45Z mike $" * * PPD command interpreter for the Common UNIX Printing System (CUPS). * @@ -53,7 +53,8 @@ * Local functions... */ -static int exec_code(cups_page_header2_t *header, const char *code); +static int exec_code(cups_page_header2_t *header, int *preferred_bits, + const char *code); /* @@ -64,6 +65,12 @@ static int exec_code(cups_page_header2_t *header, const char *code); * 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. + * * @since CUPS 1.2@ */ @@ -72,7 +79,8 @@ cupsRasterInterpretPPD( cups_page_header2_t *h, /* O - Page header */ ppd_file_t *ppd, /* I - PPD file */ int num_options, /* I - Number of options */ - cups_option_t *options) /* I - Options */ + cups_option_t *options, /* I - Options */ + cups_interpret_cb_t func) /* I - Optional page header callback */ { int i; /* Looping var */ int status; /* Cummulative status */ @@ -84,6 +92,7 @@ cupsRasterInterpretPPD( bottom, /* Bottom position */ right, /* Right position */ top; /* Top position */ + int preferred_bits; /* Preferred bits per color */ /* @@ -121,7 +130,8 @@ cupsRasterInterpretPPD( * Apply patches and options to the page header... */ - status = 0; + status = 0; + preferred_bits = 0; if (ppd) { @@ -130,7 +140,7 @@ cupsRasterInterpretPPD( */ if (ppd->patches) - status |= exec_code(h, ppd->patches); + status |= exec_code(h, &preferred_bits, ppd->patches); /* * Then apply printer options in the proper order... @@ -139,25 +149,25 @@ cupsRasterInterpretPPD( if ((count = ppdCollect(ppd, PPD_ORDER_DOCUMENT, &choices)) > 0) { for (i = 0; i < count; i ++) - status |= exec_code(h, choices[i]->code); + status |= exec_code(h, &preferred_bits, choices[i]->code); } if ((count = ppdCollect(ppd, PPD_ORDER_ANY, &choices)) > 0) { for (i = 0; i < count; i ++) - status |= exec_code(h, choices[i]->code); + status |= exec_code(h, &preferred_bits, choices[i]->code); } if ((count = ppdCollect(ppd, PPD_ORDER_PROLOG, &choices)) > 0) { for (i = 0; i < count; i ++) - status |= exec_code(h, choices[i]->code); + status |= exec_code(h, &preferred_bits, choices[i]->code); } if ((count = ppdCollect(ppd, PPD_ORDER_PAGE, &choices)) > 0) { for (i = 0; i < count; i ++) - status |= exec_code(h, choices[i]->code); + status |= exec_code(h, &preferred_bits, choices[i]->code); } } @@ -230,6 +240,13 @@ cupsRasterInterpretPPD( h->cupsImagingBBox[2] = right; h->cupsImagingBBox[3] = top; + /* + * Use the callback to validate the page header... + */ + + if (func && (*func)(h, preferred_bits)) + return (-1); + /* * Compute the bitmap parameters... */ @@ -294,6 +311,7 @@ cupsRasterInterpretPPD( */ case CUPS_CSPACE_RGBA : + case CUPS_CSPACE_RGBW : case CUPS_CSPACE_CMYK : case CUPS_CSPACE_YMCK : case CUPS_CSPACE_KCMY : @@ -322,8 +340,10 @@ cupsRasterInterpretPPD( */ static int /* O - 0 on success, -1 on error */ -exec_code(cups_page_header2_t *h, /* O - Page header */ - const char *code) /* I - Option choice to execute */ +exec_code( + cups_page_header2_t *h, /* O - Page header */ + int *preferred_bits,/* O - Preferred bits per color */ + const char *code) /* I - Option choice to execute */ { int i; /* Index into array */ int type; /* Type of value */ @@ -527,6 +547,8 @@ exec_code(cups_page_header2_t *h, /* O - Page header */ h->cupsMediaType = atoi(value); else if (!strcmp(name, "cupsBitsPerColor") && type == CUPS_TYPE_NUMBER) h->cupsBitsPerColor = atoi(value); + else if (!strcmp(name, "cupsPreferredBitsPerColor") && type == CUPS_TYPE_NUMBER) + *preferred_bits = atoi(value); else if (!strcmp(name, "cupsColorOrder") && type == CUPS_TYPE_NUMBER) h->cupsColorOrder = (cups_order_t)atoi(value); else if (!strcmp(name, "cupsColorSpace") && type == CUPS_TYPE_NUMBER) @@ -574,8 +596,6 @@ exec_code(cups_page_header2_t *h, /* O - Page header */ if (sscanf(value, "(%63[^)])", h->cupsRenderingIntent) != 1) return (-1); } - else - return (-1); } /* @@ -587,5 +607,5 @@ exec_code(cups_page_header2_t *h, /* O - Page header */ /* - * End of "$Id: interpret.c 4998 2006-01-26 21:59:54Z mike $". + * End of "$Id: interpret.c 5490 2006-05-04 19:12:45Z mike $". */ diff --git a/filter/raster.h b/filter/raster.h index f970f5578..afd9f7307 100644 --- a/filter/raster.h +++ b/filter/raster.h @@ -1,5 +1,5 @@ /* - * "$Id: raster.h 5192 2006-02-27 03:08:47Z mike $" + * "$Id: raster.h 5485 2006-05-02 23:59:56Z mike $" * * Raster file definitions for the Common UNIX Printing System (CUPS). * @@ -317,6 +317,8 @@ typedef struct _cups_raster_s /**** Raster stream data ****/ *pcurrent; /* Current byte in pixel buffer */ } cups_raster_t; +typedef int (*cups_interpret_cb_t)(cups_page_header2_t *header, int preferred_bits); + /* * Prototypes... @@ -337,7 +339,8 @@ extern unsigned cupsRasterWritePixels(cups_raster_t *r, extern int cupsRasterInterpretPPD(cups_page_header2_t *h, ppd_file_t *ppd, int num_options, - cups_option_t *options); + cups_option_t *options, + cups_interpret_cb_t func); extern unsigned cupsRasterReadHeader2(cups_raster_t *r, cups_page_header2_t *h); extern unsigned cupsRasterWriteHeader2(cups_raster_t *r, @@ -350,5 +353,5 @@ extern unsigned cupsRasterWriteHeader2(cups_raster_t *r, #endif /* !_CUPS_RASTER_H_ */ /* - * End of "$Id: raster.h 5192 2006-02-27 03:08:47Z mike $". + * End of "$Id: raster.h 5485 2006-05-02 23:59:56Z mike $". */ diff --git a/man/Makefile b/man/Makefile index d41bb0efd..6071d57e0 100644 --- a/man/Makefile +++ b/man/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 5428 2006-04-18 20:45:30Z mike $" +# "$Id: Makefile 5472 2006-04-30 16:27:50Z mike $" # # Man page makefile for the Common UNIX Printing System (CUPS). # @@ -46,7 +46,8 @@ MAN5 = classes.conf.$(MAN5EXT) \ cupsd.conf.$(MAN5EXT) \ mime.convs.$(MAN5EXT) \ mime.types.$(MAN5EXT) \ - printers.conf.$(MAN5EXT) + printers.conf.$(MAN5EXT) \ + subscriptions.conf.$(MAN5EXT) MAN7 = backend.$(MAN7EXT) \ filter.$(MAN7EXT) MAN8 = accept.$(MAN8EXT) \ @@ -182,5 +183,5 @@ mantohtml: mantohtml.o # -# End of "$Id: Makefile 5428 2006-04-18 20:45:30Z mike $". +# End of "$Id: Makefile 5472 2006-04-30 16:27:50Z mike $". # diff --git a/man/subscriptions.conf.man b/man/subscriptions.conf.man new file mode 100644 index 000000000..15223a105 --- /dev/null +++ b/man/subscriptions.conf.man @@ -0,0 +1,98 @@ +.\" +.\" "$Id: subscriptions.conf.man 5099 2006-02-13 02:46:10Z mike $" +.\" +.\" subscriptions.conf man page for the Common UNIX Printing System (CUPS). +.\" +.\" Copyright 2006 by Easy Software Products. +.\" +.\" These coded instructions, statements, and computer programs are the +.\" property of Easy Software Products and are protected by Federal +.\" copyright law. Distribution and use rights are outlined in the file +.\" "LICENSE.txt" which should have been included with this file. If this +.\" file is missing or damaged please contact Easy Software Products +.\" at: +.\" +.\" Attn: CUPS Licensing Information +.\" Easy Software Products +.\" 44141 Airport View Drive, Suite 204 +.\" Hollywood, Maryland 20636 USA +.\" +.\" Voice: (301) 373-9600 +.\" EMail: cups-info@cups.org +.\" WWW: http://www.cups.org +.\" +.TH subscriptions.conf 5 "Common UNIX Printing System" "30 April 2006" "Easy Software Products" +.SH NAME +subscriptions.conf \- subscriptions file for cups +.SH DESCRIPTION +The \fIsubscriptions.conf\fR file defines the local subscriptions +that are active. It is normally located in the \fI/etc/cups\fR +directory and is generated automatically by the \fIcupsd(8)\fR +program when subscriptions are created, renewed, or cancelled. +.LP +Each line in the file can be a configuration directive, a blank line, +or a comment. Comment lines start with the # character. +.SH DIRECTIVES +.TP 5 + ... +.br +Defines a subscription. +.TP 5 +Events name [ ... name ] +.br +Specifies the events that are subscribed. +.TP 5 +ExpirationTime unix-time +.br +Specifies the expiration time of a subscription as a UNIX time +value in seconds since January 1st, 1970. +.TP 5 +Interval seconds +.br +Specifies the preferred time interval for event notifications in +seconds. +.TP 5 +JobId job-id +.br +Specifies the job ID associated with the subscription. +.TP 5 +LeaseDuration seconds +.br +Specifies the number of seconds that the subscription is valid +for. If 0, the subscription does not expire. +.TP 5 +NextEventId number +.br +Specifies the next notify-sequence-number to use for the +subscription. +.TP 5 +NextSubscriptionId number +.br +Specifies the next subscription-id to use. +.TP 5 +Owner username +.br +Specifies the user that owns the subscription. +.TP 5 +PrinterName printername +.br +Specifies the printer or class associated with the subscription. +.TP 5 +Recipient uri +.br +Specifies the notify-recipient-uri value for push-type notifications. +.TP 5 +UserData hex-escaped-data +.br +Specifies user data to be included in event notifications. This +is typically the "from" address in mailto: notifications. +.SH SEE ALSO +\fIclasses.conf(5)\fR, \fIcupsd(8)\fR, \fIcupsd.conf(5)\fR, +\fImime.convs(5)\fR, \fImime.types(5)\fR, \fRprinters.conf(5)\fR +.br +http://localhost:631/help +.SH COPYRIGHT +Copyright 1997-2006 by Easy Software Products, All Rights Reserved. +.\" +.\" End of "$Id: subscriptions.conf.man 5099 2006-02-13 02:46:10Z mike $". +.\" diff --git a/packaging/cups.list.in b/packaging/cups.list.in index 9591021d7..863a9281a 100644 --- a/packaging/cups.list.in +++ b/packaging/cups.list.in @@ -1,5 +1,5 @@ # -# "$Id: cups.list.in 5449 2006-04-22 04:05:45Z mike $" +# "$Id: cups.list.in 5472 2006-04-30 16:27:50Z mike $" # # ESP Package Manager (EPM) file list for the Common UNIX Printing # System (CUPS). @@ -28,7 +28,7 @@ %copyright 1993-2006 by Easy Software Products, All Rights Reserved. %vendor Easy Software Products %license LICENSE.txt -%readme packaging/cups.license +%readme packaging/cups.readme %version @CUPS_VERSION@ %description The Common UNIX Printing System provides a portable printing %description layer for UNIX(r) operating systems. It has been developed by @@ -172,7 +172,7 @@ $INSTALLSTATIC=@INSTALLSTATIC@ $MAN1EXT=@MAN1EXT@ $MAN5EXT=@MAN5EXT@ -$MAN8EXT=@MAN8EXT@ +$MAN7EXT=@MAN7EXT@ $MAN8DIR=@MAN8DIR@ $DSOLIBS=@DSOLIBS@ @@ -550,5 +550,5 @@ f 0644 root sys $AMANDIR/man$MAN8DIR/cups-lpd.$MAN8EXT man/cups-lpd.$MAN8EXT i 0755 root sys cups init/cups.sh # -# End of "$Id: cups.list.in 5449 2006-04-22 04:05:45Z mike $". +# End of "$Id: cups.list.in 5472 2006-04-30 16:27:50Z mike $". # diff --git a/pdftops/Decrypt.cxx b/pdftops/Decrypt.cxx index bbe1d34a5..88b62056d 100644 --- a/pdftops/Decrypt.cxx +++ b/pdftops/Decrypt.cxx @@ -140,6 +140,12 @@ GBool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength, int len, i, j; GBool ok; + + // check whether we have non-zero keyLength + if ( keyLength < 5 || keyLength > 16 ) { + return gFalse; + } + // generate file key buf = (Guchar *)gmalloc(72 + fileID->getLength()); if (userPassword) { diff --git a/pdftops/Makefile b/pdftops/Makefile index 139190a85..1cc9e861a 100644 --- a/pdftops/Makefile +++ b/pdftops/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $" +# "$Id: Makefile 5491 2006-05-04 20:53:35Z mike $" # # pdftops filter Makefile for the Common UNIX Printing System (CUPS). # @@ -59,33 +59,12 @@ LIBOBJS = \ PSOutputDev.o \ PSTokenizer.o \ SecurityHandler.o \ - SplashBitmap.o \ - SplashClip.o \ - Splash.o \ - SplashFont.o \ - SplashFontEngine.o \ - SplashFontFile.o \ - SplashFontFileID.o \ - SplashFTFont.o \ - SplashFTFontEngine.o \ - SplashFTFontFile.o \ - SplashOutputDev.o \ - SplashPath.o \ - SplashPattern.o \ - SplashScreen.o \ - SplashState.o \ - SplashT1Font.o \ - SplashT1FontEngine.o \ - SplashT1FontFile.o \ - SplashXPath.o \ - SplashXPathScanner.o \ Stream.o \ UnicodeMap.o \ UnicodeTypeTable.o \ XpdfPluginAPI.o \ XRef.o - OBJS = pdftops.o $(LIBOBJS) TARGETS = libxpdf.a pdftops @@ -164,5 +143,5 @@ include Dependencies # -# End of "$Id: Makefile 5229 2006-03-05 16:48:12Z mike $". +# End of "$Id: Makefile 5491 2006-05-04 20:53:35Z mike $". # diff --git a/pdftops/Splash.cxx b/pdftops/Splash.cxx deleted file mode 100644 index 0132d425e..000000000 --- a/pdftops/Splash.cxx +++ /dev/null @@ -1,3191 +0,0 @@ -//======================================================================== -// -// Splash.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include -#include "gmem.h" -#include "SplashErrorCodes.h" -#include "SplashMath.h" -#include "SplashBitmap.h" -#include "SplashState.h" -#include "SplashPath.h" -#include "SplashXPath.h" -#include "SplashXPathScanner.h" -#include "SplashPattern.h" -#include "SplashScreen.h" -#include "SplashFont.h" -#include "SplashGlyphBitmap.h" -#include "Splash.h" - -//------------------------------------------------------------------------ - -static void blendNormal(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i; - - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - blend[i] = src[i]; - } -} - -//------------------------------------------------------------------------ -// Splash -//------------------------------------------------------------------------ - -Splash::Splash(SplashBitmap *bitmapA) { - bitmap = bitmapA; - state = new SplashState(bitmap->width, bitmap->height); - softMask = NULL; - clearModRegion(); - debugMode = gFalse; -} - -Splash::~Splash() { - while (state->next) { - restoreState(); - } - delete state; - if (softMask) { - delete softMask; - } -} - -//------------------------------------------------------------------------ -// state read -//------------------------------------------------------------------------ - -SplashPattern *Splash::getStrokePattern() { - return state->strokePattern; -} - -SplashPattern *Splash::getFillPattern() { - return state->fillPattern; -} - -SplashScreen *Splash::getScreen() { - return state->screen; -} - -SplashBlendFunc Splash::getBlendFunc() { - return state->blendFunc; -} - -SplashCoord Splash::getStrokeAlpha() { - return state->strokeAlpha; -} - -SplashCoord Splash::getFillAlpha() { - return state->fillAlpha; -} - -SplashCoord Splash::getLineWidth() { - return state->lineWidth; -} - -int Splash::getLineCap() { - return state->lineCap; -} - -int Splash::getLineJoin() { - return state->lineJoin; -} - -SplashCoord Splash::getMiterLimit() { - return state->miterLimit; -} - -SplashCoord Splash::getFlatness() { - return state->flatness; -} - -SplashCoord *Splash::getLineDash() { - return state->lineDash; -} - -int Splash::getLineDashLength() { - return state->lineDashLength; -} - -SplashCoord Splash::getLineDashPhase() { - return state->lineDashPhase; -} - -SplashClip *Splash::getClip() { - return state->clip; -} - -//------------------------------------------------------------------------ -// state write -//------------------------------------------------------------------------ - -void Splash::setStrokePattern(SplashPattern *strokePattern) { - state->setStrokePattern(strokePattern); -} - -void Splash::setFillPattern(SplashPattern *fillPattern) { - state->setFillPattern(fillPattern); -} - -void Splash::setScreen(SplashScreen *screen) { - state->setScreen(screen); -} - -void Splash::setBlendFunc(SplashBlendFunc func) { - state->blendFunc = func; -} - -void Splash::setStrokeAlpha(SplashCoord alpha) { - state->strokeAlpha = alpha; -} - -void Splash::setFillAlpha(SplashCoord alpha) { - state->fillAlpha = alpha; -} - -void Splash::setLineWidth(SplashCoord lineWidth) { - state->lineWidth = lineWidth; -} - -void Splash::setLineCap(int lineCap) { - state->lineCap = lineCap; -} - -void Splash::setLineJoin(int lineJoin) { - state->lineJoin = lineJoin; -} - -void Splash::setMiterLimit(SplashCoord miterLimit) { - state->miterLimit = miterLimit; -} - -void Splash::setFlatness(SplashCoord flatness) { - if (flatness < 1) { - state->flatness = 1; - } else { - state->flatness = flatness; - } -} - -void Splash::setLineDash(SplashCoord *lineDash, int lineDashLength, - SplashCoord lineDashPhase) { - state->setLineDash(lineDash, lineDashLength, lineDashPhase); -} - -void Splash::clipResetToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - state->clip->resetToRect(x0, y0, x1, y1); -} - -SplashError Splash::clipToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - return state->clip->clipToRect(x0, y0, x1, y1); -} - -SplashError Splash::clipToPath(SplashPath *path, GBool eo) { - return state->clip->clipToPath(path, state->flatness, eo); -} - -//------------------------------------------------------------------------ -// state save/restore -//------------------------------------------------------------------------ - -void Splash::saveState() { - SplashState *newState; - - newState = state->copy(); - newState->next = state; - state = newState; -} - -SplashError Splash::restoreState() { - SplashState *oldState; - - if (!state->next) { - return splashErrNoSave; - } - oldState = state; - state = state->next; - delete oldState; - return splashOk; -} - -//------------------------------------------------------------------------ -// soft mask -//------------------------------------------------------------------------ - -void Splash::setSoftMask(SplashBitmap *softMaskA) { - if (softMask) { - delete softMask; - } - softMask = softMaskA; -} - -//------------------------------------------------------------------------ -// modified region -//------------------------------------------------------------------------ - -void Splash::clearModRegion() { - modXMin = bitmap->getWidth(); - modYMin = bitmap->getHeight(); - modXMax = -1; - modYMax = -1; -} - -inline void Splash::updateModX(int x) { - if (x < modXMin) { - modXMin = x; - } - if (x > modXMax) { - modXMax = x; - } -} - -inline void Splash::updateModY(int y) { - if (y < modYMin) { - modYMin = y; - } - if (y > modYMax) { - modYMax = y; - } -} - -//------------------------------------------------------------------------ -// drawing operations -//------------------------------------------------------------------------ - -void Splash::clear(SplashColorPtr color) { - SplashColorPtr row, p; - Guchar mono; - int x, y; - - switch (bitmap->mode) { - case splashModeMono1: - mono = color[0] ? 0xff : 0x00; - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - mono, -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, mono, bitmap->rowSize * bitmap->height); - } - break; - case splashModeMono8: - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - color[0], -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); - } - break; - case splashModeAMono8: - if (color[0] == color[1]) { - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - color[0], -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); - } - } else { - row = bitmap->data; - for (y = 0; y < bitmap->height; ++y) { - p = row; - for (x = 0; x < bitmap->width; ++x) { - *p++ = color[0]; - *p++ = color[1]; - } - row += bitmap->rowSize; - } - } - break; - case splashModeRGB8: - case splashModeBGR8: - if (color[0] == color[1] && color[1] == color[2]) { - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - color[0], -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); - } - } else { - row = bitmap->data; - for (y = 0; y < bitmap->height; ++y) { - p = row; - for (x = 0; x < bitmap->width; ++x) { - *p++ = color[0]; - *p++ = color[1]; - *p++ = color[2]; - } - row += bitmap->rowSize; - } - } - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - if (color[0] == color[1] && color[1] == color[2] && color[2] == color[3]) { - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - color[0], -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); - } - } else { - row = bitmap->data; - for (y = 0; y < bitmap->height; ++y) { - p = row; - for (x = 0; x < bitmap->width; ++x) { - *p++ = color[0]; - *p++ = color[1]; - *p++ = color[2]; - *p++ = color[3]; - } - row += bitmap->rowSize; - } - } - break; -#if SPLASH_CMYK - case splashModeACMYK8: - if (color[0] == color[1] && color[1] == color[2] && - color[2] == color[3] && color[3] == color[4]) { - if (bitmap->rowSize < 0) { - memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), - color[0], -bitmap->rowSize * bitmap->height); - } else { - memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); - } - } else { - row = bitmap->data; - for (y = 0; y < bitmap->height; ++y) { - p = row; - for (x = 0; x < bitmap->width; ++x) { - *p++ = color[0]; - *p++ = color[1]; - *p++ = color[2]; - *p++ = color[3]; - *p++ = color[4]; - } - row += bitmap->rowSize; - } - } - break; -#endif - } - - updateModX(0); - updateModY(0); - updateModX(bitmap->width - 1); - updateModY(bitmap->height - 1); -} - -SplashError Splash::stroke(SplashPath *path) { - SplashXPath *xPath, *xPath2; - - if (debugMode) { - printf("stroke [dash:%d] [width:%.2f]:\n", - state->lineDashLength, (double)state->lineWidth); - dumpPath(path); - } - opClipRes = splashClipAllOutside; - if (path->length == 0) { - return splashErrEmptyPath; - } - xPath = new SplashXPath(path, state->flatness, gFalse); - if (xPath->length == 0) { - delete xPath; - return splashErrEmptyPath; - } - if (state->lineDashLength > 0) { - xPath2 = makeDashedPath(xPath); - delete xPath; - xPath = xPath2; - } - if (state->lineWidth <= 1) { - strokeNarrow(xPath); - } else { - strokeWide(xPath); - } - delete xPath; - return splashOk; -} - -void Splash::strokeNarrow(SplashXPath *xPath) { - SplashXPathSeg *seg; - int x0, x1, x2, x3, y0, y1, x, y, t; - SplashCoord dx, dy, dxdy; - SplashClipResult clipRes; - int nClipRes[3]; - int i; - - for (i = 0, seg = xPath->segs; i < xPath->length; ++i, ++seg) { - - x0 = splashFloor(seg->x0); - x1 = splashFloor(seg->x1); - y0 = splashFloor(seg->y0); - y1 = splashFloor(seg->y1); - - // horizontal segment - if (y0 == y1) { - if (x0 > x1) { - t = x0; x0 = x1; x1 = t; - } - if ((clipRes = state->clip->testSpan(x0, x1, y0)) - != splashClipAllOutside) { - drawSpan(x0, x1, y0, state->strokePattern, state->strokeAlpha, - clipRes == splashClipAllInside); - } - - // segment with |dx| > |dy| - } else if (splashAbs(seg->dxdy) > 1) { - dx = seg->x1 - seg->x0; - dy = seg->y1 - seg->y0; - dxdy = seg->dxdy; - if (y0 > y1) { - t = y0; y0 = y1; y1 = t; - t = x0; x0 = x1; x1 = t; - dx = -dx; - dy = -dy; - } - if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0, - x0 <= x1 ? x1 : x0, y1)) - != splashClipAllOutside) { - if (dx > 0) { - x2 = x0; - x3 = splashFloor(seg->x0 + ((SplashCoord)y0 + 1 - seg->y0) * dxdy); - drawSpan(x2, (x2 <= x3 - 1) ? x3 - 1 : x2, y0, state->strokePattern, - state->strokeAlpha, clipRes == splashClipAllInside); - x2 = x3; - for (y = y0 + 1; y <= y1 - 1; ++y) { - x3 = splashFloor(seg->x0 + ((SplashCoord)y + 1 - seg->y0) * dxdy); - drawSpan(x2, x3 - 1, y, state->strokePattern, - state->strokeAlpha, clipRes == splashClipAllInside); - x2 = x3; - } - drawSpan(x2, x2 <= x1 ? x1 : x2, y1, state->strokePattern, - state->strokeAlpha, clipRes == splashClipAllInside); - } else { - x2 = x0; - x3 = splashFloor(seg->x0 + ((SplashCoord)y0 + 1 - seg->y0) * dxdy); - drawSpan((x3 + 1 <= x2) ? x3 + 1 : x2, x2, y0, state->strokePattern, - state->strokeAlpha, clipRes == splashClipAllInside); - x2 = x3; - for (y = y0 + 1; y <= y1 - 1; ++y) { - x3 = splashFloor(seg->x0 + ((SplashCoord)y + 1 - seg->y0) * dxdy); - drawSpan(x3 + 1, x2, y, state->strokePattern, - state->strokeAlpha, clipRes == splashClipAllInside); - x2 = x3; - } - drawSpan(x1, (x1 <= x2) ? x2 : x1, y1, state->strokePattern, - state->strokeAlpha, clipRes == splashClipAllInside); - } - } - - // segment with |dy| > |dx| - } else { - dxdy = seg->dxdy; - if (y0 > y1) { - t = x0; x0 = x1; x1 = t; - t = y0; y0 = y1; y1 = t; - } - if ((clipRes = state->clip->testRect(x0 <= x1 ? x0 : x1, y0, - x0 <= x1 ? x1 : x0, y1)) - != splashClipAllOutside) { - drawPixel(x0, y0, state->strokePattern, state->strokeAlpha, - clipRes == splashClipAllInside); - for (y = y0 + 1; y <= y1 - 1; ++y) { - x = splashFloor(seg->x0 + ((SplashCoord)y - seg->y0) * dxdy); - drawPixel(x, y, state->strokePattern, state->strokeAlpha, - clipRes == splashClipAllInside); - } - drawPixel(x1, y1, state->strokePattern, state->strokeAlpha, - clipRes == splashClipAllInside); - } - } - ++nClipRes[clipRes]; - } - if (nClipRes[splashClipPartial] || - (nClipRes[splashClipAllInside] && nClipRes[splashClipAllOutside])) { - opClipRes = splashClipPartial; - } else if (nClipRes[splashClipAllInside]) { - opClipRes = splashClipAllInside; - } else { - opClipRes = splashClipAllOutside; - } -} - -void Splash::strokeWide(SplashXPath *xPath) { - SplashXPathSeg *seg, *seg2; - SplashPath *widePath; - SplashCoord d, dx, dy, wdx, wdy, dxPrev, dyPrev, wdxPrev, wdyPrev; - SplashCoord dotprod, miter; - int i, j; - - dx = dy = wdx = wdy = 0; // make gcc happy - dxPrev = dyPrev = wdxPrev = wdyPrev = 0; // make gcc happy - - for (i = 0, seg = xPath->segs; i < xPath->length; ++i, ++seg) { - - // save the deltas for the previous segment; if this is the first - // segment on a subpath, compute the deltas for the last segment - // on the subpath (which may be used to draw a line join) - if (seg->flags & splashXPathFirst) { - for (j = i + 1, seg2 = &xPath->segs[j]; j < xPath->length; ++j, ++seg2) { - if (seg2->flags & splashXPathLast) { - d = splashDist(seg2->x0, seg2->y0, seg2->x1, seg2->y1); - if (d == 0) { - //~ not clear what the behavior should be for joins with d==0 - dxPrev = 0; - dyPrev = 1; - } else { - d = (SplashCoord)1 / d; - dxPrev = d * (seg2->x1 - seg2->x0); - dyPrev = d * (seg2->y1 - seg2->y0); - } - wdxPrev = (SplashCoord)0.5 * state->lineWidth * dxPrev; - wdyPrev = (SplashCoord)0.5 * state->lineWidth * dyPrev; - break; - } - } - } else { - dxPrev = dx; - dyPrev = dy; - wdxPrev = wdx; - wdyPrev = wdy; - } - - // compute deltas for this line segment - d = splashDist(seg->x0, seg->y0, seg->x1, seg->y1); - if (d == 0) { - // we need to draw end caps on zero-length lines - //~ not clear what the behavior should be for splashLineCapButt with d==0 - dx = 0; - dy = 1; - } else { - d = (SplashCoord)1 / d; - dx = d * (seg->x1 - seg->x0); - dy = d * (seg->y1 - seg->y0); - } - wdx = (SplashCoord)0.5 * state->lineWidth * dx; - wdy = (SplashCoord)0.5 * state->lineWidth * dy; - - // initialize the path (which will be filled) - widePath = new SplashPath(); - widePath->moveTo(seg->x0 - wdy, seg->y0 + wdx); - - // draw the start cap - if (seg->flags & splashXPathEnd0) { - switch (state->lineCap) { - case splashLineCapButt: - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - break; - case splashLineCapRound: - widePath->arcCWTo(seg->x0 + wdy, seg->y0 - wdx, seg->x0, seg->y0); - break; - case splashLineCapProjecting: - widePath->lineTo(seg->x0 - wdx - wdy, seg->y0 + wdx - wdy); - widePath->lineTo(seg->x0 - wdx + wdy, seg->y0 - wdx - wdy); - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - break; - } - } else { - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - } - - // draw the left side of the segment - widePath->lineTo(seg->x1 + wdy, seg->y1 - wdx); - - // draw the end cap - if (seg->flags & splashXPathEnd1) { - switch (state->lineCap) { - case splashLineCapButt: - widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx); - break; - case splashLineCapRound: - widePath->arcCWTo(seg->x1 - wdy, seg->y1 + wdx, seg->x1, seg->y1); - break; - case splashLineCapProjecting: - widePath->lineTo(seg->x1 + wdx + wdy, seg->y1 - wdx + wdy); - widePath->lineTo(seg->x1 + wdx - wdy, seg->y1 + wdx + wdy); - widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx); - break; - } - } else { - widePath->lineTo(seg->x1 - wdy, seg->y1 + wdx); - } - - // draw the right side of the segment - widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx); - - // fill the segment - fillWithPattern(widePath, gTrue, state->strokePattern, state->strokeAlpha); - delete widePath; - - // draw the line join - if (!(seg->flags & splashXPathEnd0)) { - widePath = NULL; - switch (state->lineJoin) { - case splashLineJoinMiter: - dotprod = -(dx * dxPrev + dy * dyPrev); - if (splashAbs(splashAbs(dotprod) - 1) > 0.01) { - widePath = new SplashPath(); - widePath->moveTo(seg->x0, seg->y0); - miter = (SplashCoord)2 / ((SplashCoord)1 - dotprod); - if (splashSqrt(miter) <= state->miterLimit) { - miter = splashSqrt(miter - 1); - if (dy * dxPrev > dx * dyPrev) { - widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev); - widePath->lineTo(seg->x0 + wdy - miter * wdx, - seg->y0 - wdx - miter * wdy); - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - } else { - widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev); - widePath->lineTo(seg->x0 - wdy - miter * wdx, - seg->y0 + wdx - miter * wdy); - widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx); - } - } else { - if (dy * dxPrev > dx * dyPrev) { - widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev); - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - } else { - widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev); - widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx); - } - } - } - break; - case splashLineJoinRound: - widePath = new SplashPath(); - widePath->moveTo(seg->x0 + wdy, seg->y0 - wdx); - widePath->arcCWTo(seg->x0 + wdy, seg->y0 - wdx, seg->x0, seg->y0); - break; - case splashLineJoinBevel: - widePath = new SplashPath(); - widePath->moveTo(seg->x0, seg->y0); - if (dy * dxPrev > dx * dyPrev) { - widePath->lineTo(seg->x0 + wdyPrev, seg->y0 - wdxPrev); - widePath->lineTo(seg->x0 + wdy, seg->y0 - wdx); - } else { - widePath->lineTo(seg->x0 - wdyPrev, seg->y0 + wdxPrev); - widePath->lineTo(seg->x0 - wdy, seg->y0 + wdx); - } - break; - } - if (widePath) { - fillWithPattern(widePath, gTrue, state->strokePattern, - state->strokeAlpha); - delete widePath; - } - } - } -} - -SplashXPath *Splash::makeDashedPath(SplashXPath *xPath) { - SplashXPath *dPath; - GBool lineDashStartOn, lineDashOn; - GBool atSegStart, atSegEnd, atDashStart, atDashEnd; - int lineDashStartIdx, lineDashIdx, subpathStart; - SplashCoord lineDashTotal, lineDashStartPhase, lineDashDist; - int segIdx; - SplashXPathSeg *seg; - SplashCoord sx0, sy0, sx1, sy1, ax0, ay0, ax1, ay1, dist; - int i; - - dPath = new SplashXPath(); - - lineDashTotal = 0; - for (i = 0; i < state->lineDashLength; ++i) { - lineDashTotal += state->lineDash[i]; - } - lineDashStartPhase = state->lineDashPhase; - i = splashFloor(lineDashStartPhase / lineDashTotal); - lineDashStartPhase -= (SplashCoord)i * lineDashTotal; - lineDashStartOn = gTrue; - lineDashStartIdx = 0; - while (lineDashStartPhase >= state->lineDash[lineDashStartIdx]) { - lineDashStartOn = !lineDashStartOn; - lineDashStartPhase -= state->lineDash[lineDashStartIdx]; - ++lineDashStartIdx; - } - - segIdx = 0; - seg = xPath->segs; - sx0 = seg->x0; - sy0 = seg->y0; - sx1 = seg->x1; - sy1 = seg->y1; - dist = splashDist(sx0, sy0, sx1, sy1); - lineDashOn = lineDashStartOn; - lineDashIdx = lineDashStartIdx; - lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase; - atSegStart = gTrue; - atDashStart = gTrue; - subpathStart = dPath->length; - - while (segIdx < xPath->length) { - - ax0 = sx0; - ay0 = sy0; - if (dist <= lineDashDist) { - ax1 = sx1; - ay1 = sy1; - lineDashDist -= dist; - dist = 0; - atSegEnd = gTrue; - atDashEnd = lineDashDist == 0 || (seg->flags & splashXPathLast); - } else { - ax1 = sx0 + (lineDashDist / dist) * (sx1 - sx0); - ay1 = sy0 + (lineDashDist / dist) * (sy1 - sy0); - sx0 = ax1; - sy0 = ay1; - dist -= lineDashDist; - lineDashDist = 0; - atSegEnd = gFalse; - atDashEnd = gTrue; - } - - if (lineDashOn) { - dPath->addSegment(ax0, ay0, ax1, ay1, - atDashStart, atDashEnd, - atDashStart, atDashEnd); - // end of closed subpath - if (atSegEnd && - (seg->flags & splashXPathLast) && - !(seg->flags & splashXPathEnd1)) { - dPath->segs[subpathStart].flags &= ~splashXPathEnd0; - dPath->segs[dPath->length - 1].flags &= ~splashXPathEnd1; - } - } - - if (atDashEnd) { - lineDashOn = !lineDashOn; - if (++lineDashIdx == state->lineDashLength) { - lineDashIdx = 0; - } - lineDashDist = state->lineDash[lineDashIdx]; - atDashStart = gTrue; - } else { - atDashStart = gFalse; - } - if (atSegEnd) { - if (++segIdx < xPath->length) { - ++seg; - sx0 = seg->x0; - sy0 = seg->y0; - sx1 = seg->x1; - sy1 = seg->y1; - dist = splashDist(sx0, sy0, sx1, sy1); - if (seg->flags & splashXPathFirst) { - lineDashOn = lineDashStartOn; - lineDashIdx = lineDashStartIdx; - lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase; - atDashStart = gTrue; - subpathStart = dPath->length; - } - } - atSegStart = gTrue; - } else { - atSegStart = gFalse; - } - } - - return dPath; -} - -SplashError Splash::fill(SplashPath *path, GBool eo) { - if (debugMode) { - printf("fill [eo:%d]:\n", eo); - dumpPath(path); - } - return fillWithPattern(path, eo, state->fillPattern, state->fillAlpha); -} - -SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, - SplashPattern *pattern, - SplashCoord alpha) { - SplashXPath *xPath; - SplashXPathScanner *scanner; - int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y; - SplashClipResult clipRes, clipRes2; - - if (path->length == 0) { - return splashErrEmptyPath; - } - xPath = new SplashXPath(path, state->flatness, gTrue); - xPath->sort(); - scanner = new SplashXPathScanner(xPath, eo); - - // get the min and max x and y values - scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI); - - // check clipping - if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) - != splashClipAllOutside) { - - // limit the y range - if (yMinI < state->clip->getYMin()) { - yMinI = state->clip->getYMin(); - } - if (yMaxI > state->clip->getYMax()) { - yMaxI = state->clip->getYMax(); - } - - // draw the spans - for (y = yMinI; y <= yMaxI; ++y) { - while (scanner->getNextSpan(y, &x0, &x1)) { - if (clipRes == splashClipAllInside) { - drawSpan(x0, x1, y, pattern, alpha, gTrue); - } else { - // limit the x range - if (x0 < state->clip->getXMin()) { - x0 = state->clip->getXMin(); - } - if (x1 > state->clip->getXMax()) { - x1 = state->clip->getXMax(); - } - clipRes2 = state->clip->testSpan(x0, x1, y); - drawSpan(x0, x1, y, pattern, alpha, clipRes2 == splashClipAllInside); - } - } - } - } - opClipRes = clipRes; - - delete scanner; - delete xPath; - return splashOk; -} - -SplashError Splash::xorFill(SplashPath *path, GBool eo) { - SplashXPath *xPath; - SplashXPathScanner *scanner; - int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y; - SplashClipResult clipRes, clipRes2; - - if (path->length == 0) { - return splashErrEmptyPath; - } - xPath = new SplashXPath(path, state->flatness, gTrue); - xPath->sort(); - scanner = new SplashXPathScanner(xPath, eo); - - // get the min and max x and y values - scanner->getBBox(&xMinI, &yMinI, &xMaxI, &yMaxI); - - // check clipping - if ((clipRes = state->clip->testRect(xMinI, yMinI, xMaxI, yMaxI)) - != splashClipAllOutside) { - - // limit the y range - if (yMinI < state->clip->getYMin()) { - yMinI = state->clip->getYMin(); - } - if (yMaxI > state->clip->getYMax()) { - yMaxI = state->clip->getYMax(); - } - - // draw the spans - for (y = yMinI; y <= yMaxI; ++y) { - while (scanner->getNextSpan(y, &x0, &x1)) { - if (clipRes == splashClipAllInside) { - xorSpan(x0, x1, y, state->fillPattern, gTrue); - } else { - // limit the x range - if (x0 < state->clip->getXMin()) { - x0 = state->clip->getXMin(); - } - if (x1 > state->clip->getXMax()) { - x1 = state->clip->getXMax(); - } - clipRes2 = state->clip->testSpan(x0, x1, y); - xorSpan(x0, x1, y, state->fillPattern, - clipRes2 == splashClipAllInside); - } - } - } - } - opClipRes = clipRes; - - delete scanner; - delete xPath; - return splashOk; -} - -void Splash::drawPixel(int x, int y, SplashColorPtr color, - SplashCoord alpha, GBool noClip) { - SplashBlendFunc blendFunc; - SplashColorPtr p; - SplashColor dest, blend; - int alpha2, ialpha2; - Guchar t; - - if (noClip || state->clip->test(x, y)) { - if (alpha != 1 || softMask || state->blendFunc) { - blendFunc = state->blendFunc ? state->blendFunc : &blendNormal; - if (softMask) { - alpha2 = (int)(alpha * softMask->data[y * softMask->rowSize + x]); - } else { - alpha2 = (int)(alpha * 255); - } - ialpha2 = 255 - alpha2; - switch (bitmap->mode) { - case splashModeMono1: - p = &bitmap->data[y * bitmap->rowSize + (x >> 3)]; - dest[0] = (*p >> (7 - (x & 7))) & 1; - (*blendFunc)(color, dest, blend, bitmap->mode); - t = (alpha2 * blend[0] + ialpha2 * dest[0]) >> 8; - if (t) { - *p |= 0x80 >> (x & 7); - } else { - *p &= ~(0x80 >> (x & 7)); - } - break; - case splashModeMono8: - p = &bitmap->data[y * bitmap->rowSize + x]; - (*blendFunc)(color, p, blend, bitmap->mode); - // note: floor(x / 255) = x >> 8 (for 16-bit x) - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - break; - case splashModeAMono8: - p = &bitmap->data[y * bitmap->rowSize + 2 * x]; - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - break; - case splashModeRGB8: - case splashModeBGR8: - p = &bitmap->data[y * bitmap->rowSize + 3 * x]; - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - p = &bitmap->data[y * bitmap->rowSize + 4 * x]; - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - p[3] = (alpha2 * blend[3] + ialpha2 * p[3]) >> 8; - break; -#if SPLASH_CMYK - case splashModeACMYK8: - p = &bitmap->data[y * bitmap->rowSize + 5 * x]; - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - p[3] = (alpha2 * blend[3] + ialpha2 * p[3]) >> 8; - p[4] = (alpha2 * blend[4] + ialpha2 * p[4]) >> 8; - break; -#endif - } - } else { - switch (bitmap->mode) { - case splashModeMono1: - p = &bitmap->data[y * bitmap->rowSize + (x >> 3)]; - if (color[0]) { - *p |= 0x80 >> (x & 7); - } else { - *p &= ~(0x80 >> (x & 7)); - } - break; - case splashModeMono8: - p = &bitmap->data[y * bitmap->rowSize + x]; - p[0] = color[0]; - break; - case splashModeAMono8: - p = &bitmap->data[y * bitmap->rowSize + 2 * x]; - p[0] = color[0]; - p[1] = color[1]; - break; - case splashModeRGB8: - case splashModeBGR8: - p = &bitmap->data[y * bitmap->rowSize + 3 * x]; - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - p = &bitmap->data[y * bitmap->rowSize + 4 * x]; - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - p[3] = color[3]; - break; -#if SPLASH_CMYK - case splashModeACMYK8: - p = &bitmap->data[y * bitmap->rowSize + 5 * x]; - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - p[3] = color[3]; - p[4] = color[4]; - break; -#endif - } - } - updateModX(x); - updateModY(y); - } -} - -void Splash::drawPixel(int x, int y, SplashPattern *pattern, - SplashCoord alpha, GBool noClip) { - SplashBlendFunc blendFunc; - SplashColor color; - SplashColorPtr p; - SplashColor dest, blend; - int alpha2, ialpha2; - Guchar t; - - if (noClip || state->clip->test(x, y)) { - if (alpha != 1 || softMask || state->blendFunc) { - blendFunc = state->blendFunc ? state->blendFunc : &blendNormal; - pattern->getColor(x, y, color); - if (softMask) { - alpha2 = (int)(alpha * softMask->data[y * softMask->rowSize + x]); - } else { - alpha2 = (int)(alpha * 255); - } - ialpha2 = 255 - alpha2; - switch (bitmap->mode) { - case splashModeMono1: - p = &bitmap->data[y * bitmap->rowSize + (x >> 3)]; - dest[0] = (*p >> (7 - (x & 7))) & 1; - (*blendFunc)(color, dest, blend, bitmap->mode); - t = (alpha2 * blend[0] + ialpha2 * dest[0]) >> 8; - if (t) { - *p |= 0x80 >> (x & 7); - } else { - *p &= ~(0x80 >> (x & 7)); - } - break; - case splashModeMono8: - p = &bitmap->data[y * bitmap->rowSize + x]; - (*blendFunc)(color, p, blend, bitmap->mode); - // note: floor(x / 255) = x >> 8 (for 16-bit x) - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - break; - case splashModeAMono8: - p = &bitmap->data[y * bitmap->rowSize + 2 * x]; - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - break; - case splashModeRGB8: - case splashModeBGR8: - p = &bitmap->data[y * bitmap->rowSize + 3 * x]; - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - p = &bitmap->data[y * bitmap->rowSize + 4 * x]; - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - p[3] = (alpha2 * blend[3] + ialpha2 * p[3]) >> 8; - break; -#if SPLASH_CMYK - case splashModeACMYK8: - p = &bitmap->data[y * bitmap->rowSize + 5 * x]; - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - p[3] = (alpha2 * blend[3] + ialpha2 * p[3]) >> 8; - p[4] = (alpha2 * blend[4] + ialpha2 * p[4]) >> 8; - break; -#endif - } - } else { - pattern->getColor(x, y, color); - switch (bitmap->mode) { - case splashModeMono1: - p = &bitmap->data[y * bitmap->rowSize + (x >> 3)]; - if (color[0]) { - *p |= 0x80 >> (x & 7); - } else { - *p &= ~(0x80 >> (x & 7)); - } - break; - case splashModeMono8: - p = &bitmap->data[y * bitmap->rowSize + x]; - p[0] = color[0]; - break; - case splashModeAMono8: - p = &bitmap->data[y * bitmap->rowSize + 2 * x]; - p[0] = color[0]; - p[1] = color[1]; - break; - case splashModeRGB8: - case splashModeBGR8: - p = &bitmap->data[y * bitmap->rowSize + 3 * x]; - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - p = &bitmap->data[y * bitmap->rowSize + 4 * x]; - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - p[3] = color[3]; - break; -#if SPLASH_CMYK - case splashModeACMYK8: - p = &bitmap->data[y * bitmap->rowSize + 5 * x]; - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - p[3] = color[3]; - p[4] = color[4]; - break; -#endif - } - } - updateModX(x); - updateModY(y); - } -} - -void Splash::drawSpan(int x0, int x1, int y, SplashPattern *pattern, - SplashCoord alpha, GBool noClip) { - SplashBlendFunc blendFunc; - SplashColor color; - SplashColorPtr p; - SplashColor dest, blend; - Guchar mask, t; - int alpha2, ialpha2; - int i, j, n; - - n = x1 - x0 + 1; - - if (noClip) { - updateModX(x0); - updateModX(x1); - updateModY(y); - } - - if (alpha != 1 || softMask || state->blendFunc) { - blendFunc = state->blendFunc ? state->blendFunc : &blendNormal; - if (softMask) { - alpha2 = ialpha2 = 0; // make gcc happy - } else { - alpha2 = (int)(alpha * 255); - ialpha2 = 255 - alpha2; - } - switch (bitmap->mode) { - case splashModeMono1: - p = &bitmap->data[y * bitmap->rowSize + (x0 >> 3)]; - i = 0; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - if ((j = x0 & 7)) { - mask = 0x80 >> j; - for (; j < 8 && i < n; ++i, ++j) { - if (noClip || state->clip->test(x0 + i, y)) { - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - dest[0] = (*p >> (7 - j)) & 1; - (*blendFunc)(color, dest, blend, bitmap->mode); - t = (alpha2 * blend[0] + ialpha2 * dest[0]) >> 8; - if (t) { - *p |= mask; - } else { - *p &= ~mask; - } - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - mask >>= 1; - } - ++p; - } - while (i < n) { - mask = 0x80; - for (j = 0; j < 8 && i < n; ++i, ++j) { - if (noClip || state->clip->test(x0 + i, y)) { - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - dest[0] = (*p >> (7 - j)) & 1; - (*blendFunc)(color, dest, blend, bitmap->mode); - t = (alpha2 * blend[0] + ialpha2 * dest[0]) >> 8; - if (t) { - *p |= mask; - } else { - *p &= ~mask; - } - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - mask >>= 1; - } - ++p; - } - } else { - if ((j = x0 & 7)) { - mask = 0x80 >> j; - for (; j < 8 && i < n; ++i, ++j) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - dest[0] = (*p >> (7 - j)) & 1; - (*blendFunc)(color, dest, blend, bitmap->mode); - t = (alpha2 * blend[0] + ialpha2 * dest[0]) >> 8; - if (t) { - *p |= mask; - } else { - *p &= ~mask; - } - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - mask >>= 1; - } - ++p; - } - while (i < n) { - mask = 0x80; - for (j = 0; j < 8 && i < n; ++i, ++j) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - dest[0] = (*p >> (7 - j)) & 1; - (*blendFunc)(color, dest, blend, bitmap->mode); - t = (alpha2 * blend[0] + ialpha2 * dest[0]) >> 8; - if (t) { - *p |= mask; - } else { - *p &= ~mask; - } - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - mask >>= 1; - } - ++p; - } - } - break; - - case splashModeMono8: - p = &bitmap->data[y * bitmap->rowSize + x0]; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - (*blendFunc)(color, p, blend, bitmap->mode); - *p = (alpha2 * blend[0] + ialpha2 * *p) >> 8; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - ++p; - } - } else { - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - (*blendFunc)(color, p, blend, bitmap->mode); - *p = (alpha2 * blend[0] + ialpha2 * *p) >> 8; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - ++p; - } - } - break; - - case splashModeAMono8: - p = &bitmap->data[y * bitmap->rowSize + 2 * x0]; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 2; - } - } else { - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 2; - } - } - break; - - case splashModeRGB8: - case splashModeBGR8: - p = &bitmap->data[y * bitmap->rowSize + 3 * x0]; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 3; - } - } else { - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 3; - } - } - break; - - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - p = &bitmap->data[y * bitmap->rowSize + 4 * x0]; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - p[3] = (alpha2 * blend[3] + ialpha2 * p[3]) >> 8; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 4; - } - } else { - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - p[3] = (alpha2 * blend[3] + ialpha2 * p[3]) >> 8; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 4; - } - } - break; -#if SPLASH_CMYK - case splashModeACMYK8: - p = &bitmap->data[y * bitmap->rowSize + 5 * x0]; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - p[3] = (alpha2 * blend[3] + ialpha2 * p[3]) >> 8; - p[4] = (alpha2 * blend[4] + ialpha2 * p[4]) >> 8; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 4; - } - } else { - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (softMask) { - alpha2 = (int)(alpha * - softMask->data[y * softMask->rowSize + x0 + i]); - ialpha2 = 255 - alpha2; - } - (*blendFunc)(color, p, blend, bitmap->mode); - p[0] = (alpha2 * blend[0] + ialpha2 * p[0]) >> 8; - p[1] = (alpha2 * blend[1] + ialpha2 * p[1]) >> 8; - p[2] = (alpha2 * blend[2] + ialpha2 * p[2]) >> 8; - p[3] = (alpha2 * blend[3] + ialpha2 * p[3]) >> 8; - p[4] = (alpha2 * blend[4] + ialpha2 * p[4]) >> 8; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 4; - } - } - break; -#endif - } - - } else { - switch (bitmap->mode) { - case splashModeMono1: - p = &bitmap->data[y * bitmap->rowSize + (x0 >> 3)]; - i = 0; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - if ((j = x0 & 7)) { - mask = 0x80 >> j; - for (; j < 8 && i < n; ++i, ++j) { - if (noClip || state->clip->test(x0 + i, y)) { - if (color[0]) { - *p |= mask; - } else { - *p &= ~mask; - } - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - mask >>= 1; - } - ++p; - } - while (i < n) { - mask = 0x80; - for (j = 0; j < 8 && i < n; ++i, ++j) { - if (noClip || state->clip->test(x0 + i, y)) { - if (color[0]) { - *p |= mask; - } else { - *p &= ~mask; - } - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - mask >>= 1; - } - ++p; - } - } else { - if ((j = x0 & 7)) { - mask = 0x80 >> j; - for (; j < 8 && i < n; ++i, ++j) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (color[0]) { - *p |= mask; - } else { - *p &= ~mask; - } - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - mask >>= 1; - } - ++p; - } - while (i < n) { - mask = 0x80; - for (j = 0; j < 8 && i < n; ++i, ++j) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (color[0]) { - *p |= mask; - } else { - *p &= ~mask; - } - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - mask >>= 1; - } - ++p; - } - } - break; - - case splashModeMono8: - p = &bitmap->data[y * bitmap->rowSize + x0]; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - *p = color[0]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - ++p; - } - } else { - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - *p = color[0]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - ++p; - } - } - break; - - case splashModeAMono8: - p = &bitmap->data[y * bitmap->rowSize + 2 * x0]; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - p[0] = color[0]; - p[1] = color[1]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 2; - } - } else { - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - p[0] = color[0]; - p[1] = color[1]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 2; - } - } - break; - - case splashModeRGB8: - case splashModeBGR8: - p = &bitmap->data[y * bitmap->rowSize + 3 * x0]; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 3; - } - } else { - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 3; - } - } - break; - - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - p = &bitmap->data[y * bitmap->rowSize + 4 * x0]; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - p[3] = color[3]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 4; - } - } else { - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - p[3] = color[3]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 4; - } - } - break; -#if SPLASH_CMYK - case splashModeACMYK8: - p = &bitmap->data[y * bitmap->rowSize + 5 * x0]; - if (pattern->isStatic()) { - pattern->getColor(0, 0, color); - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - p[3] = color[3]; - p[4] = color[4]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 4; - } - } else { - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - p[0] = color[0]; - p[1] = color[1]; - p[2] = color[2]; - p[3] = color[3]; - p[4] = color[4]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 4; - } - } - break; -#endif - } - } -} - -void Splash::xorSpan(int x0, int x1, int y, SplashPattern *pattern, - GBool noClip) { - SplashColor color; - SplashColorPtr p; - Guchar mask; - int i, j, n; - - n = x1 - x0 + 1; - - if (noClip) { - updateModX(x0); - updateModX(x1); - updateModY(y); - } - - switch (bitmap->mode) { - case splashModeMono1: - p = &bitmap->data[y * bitmap->rowSize + (x0 >> 3)]; - i = 0; - if ((j = x0 & 7)) { - mask = 0x80 >> j; - for (; j < 8 && i < n; ++i, ++j) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (color[0]) { - *p ^= mask; - } - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - mask >>= 1; - } - ++p; - } - while (i < n) { - mask = 0x80; - for (j = 0; j < 8 && i < n; ++i, ++j) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - if (color[0]) { - *p ^= mask; - } - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - mask >>= 1; - } - ++p; - } - break; - - case splashModeMono8: - p = &bitmap->data[y * bitmap->rowSize + x0]; - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - *p ^= color[0]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - ++p; - } - break; - - case splashModeAMono8: - p = &bitmap->data[y * bitmap->rowSize + 2 * x0]; - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - p[0] ^= color[0]; - p[1] ^= color[1]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 2; - } - break; - - case splashModeRGB8: - case splashModeBGR8: - p = &bitmap->data[y * bitmap->rowSize + 3 * x0]; - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - p[0] ^= color[0]; - p[1] ^= color[1]; - p[2] ^= color[2]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 3; - } - break; - - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - p = &bitmap->data[y * bitmap->rowSize + 4 * x0]; - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - p[0] ^= color[0]; - p[1] ^= color[1]; - p[2] ^= color[2]; - p[3] ^= color[3]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 4; - } - break; -#if SPLASH_CMYK - case splashModeACMYK8: - p = &bitmap->data[y * bitmap->rowSize + 5 * x0]; - for (i = 0; i < n; ++i) { - if (noClip || state->clip->test(x0 + i, y)) { - pattern->getColor(x0 + i, y, color); - p[0] ^= color[0]; - p[1] ^= color[1]; - p[2] ^= color[2]; - p[3] ^= color[3]; - p[4] ^= color[4]; - if (!noClip) { - updateModX(x0 + i); - updateModY(y); - } - } - p += 4; - } - break; -#endif - } -} - -SplashError Splash::fillChar(SplashCoord x, SplashCoord y, - int c, SplashFont *font) { - SplashGlyphBitmap glyph; - int x0, y0, xFrac, yFrac; - SplashError err; - - if (debugMode) { - printf("fillChar: x=%.2f y=%.2f c=%3d=0x%02x='%c'\n", - (double)x, (double)y, c, c, c); - } - x0 = splashFloor(x); - xFrac = splashFloor((x - x0) * splashFontFraction); - y0 = splashFloor(y); - yFrac = splashFloor((y - y0) * splashFontFraction); - if (!font->getGlyph(c, xFrac, yFrac, &glyph)) { - return splashErrNoGlyph; - } - err = fillGlyph(x, y, &glyph); - if (glyph.freeData) { - gfree(glyph.data); - } - return err; -} - -SplashError Splash::fillGlyph(SplashCoord x, SplashCoord y, - SplashGlyphBitmap *glyph) { - SplashBlendFunc blendFunc; - int alpha0, alpha, ialpha; - Guchar *p; - SplashColor fg, dest, blend; - SplashColorPtr pix; - SplashClipResult clipRes; - GBool noClip; - Guchar t; - int x0, y0, x1, y1, xx, xx1, yy; - - x0 = splashFloor(x); - y0 = splashFloor(y); - - if ((clipRes = state->clip->testRect(x0 - glyph->x, - y0 - glyph->y, - x0 - glyph->x + glyph->w - 1, - y0 - glyph->y + glyph->h - 1)) - != splashClipAllOutside) { - noClip = clipRes == splashClipAllInside; - - if (noClip) { - updateModX(x0 - glyph->x); - updateModX(x0 - glyph->x + glyph->w - 1); - updateModY(y0 - glyph->y); - updateModY(y0 - glyph->y + glyph->h - 1); - } - - //~ optimize this - if (state->fillAlpha != 1 || softMask || state->blendFunc) { - blendFunc = state->blendFunc ? state->blendFunc : &blendNormal; - if (glyph->aa) { - p = glyph->data; - for (yy = 0, y1 = y0 - glyph->y; yy < glyph->h; ++yy, ++y1) { - for (xx = 0, x1 = x0 - glyph->x; xx < glyph->w; ++xx, ++x1) { - alpha = *p++; - if (softMask) { - alpha = (int)(alpha * state->fillAlpha * - softMask->data[y1 * softMask->rowSize + x1]); - } else { - alpha = (int)(alpha * state->fillAlpha); - } - if (alpha > 0) { - if (noClip || state->clip->test(x1, y1)) { - ialpha = 255 - alpha; - state->fillPattern->getColor(x1, y1, fg); - switch (bitmap->mode) { - case splashModeMono1: - pix = &bitmap->data[y1 * bitmap->rowSize + (x1 >> 3)]; - dest[0] = (*pix >> (7 - (x1 & 7))) & 1; - (*blendFunc)(fg, dest, blend, bitmap->mode); - t = (alpha * blend[0] + ialpha * dest[0]) >> 8; - if (t) { - *pix |= 0x80 >> (x1 & 7); - } else { - *pix &= ~(0x80 >> (x1 & 7)); - } - break; - case splashModeMono8: - pix = &bitmap->data[y1 * bitmap->rowSize + x1]; - (*blendFunc)(fg, pix, blend, bitmap->mode); - // note: floor(x / 255) = x >> 8 (for 16-bit x) - pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8; - break; - case splashModeAMono8: - pix = &bitmap->data[y1 * bitmap->rowSize + 2 * x1]; - (*blendFunc)(fg, pix, blend, bitmap->mode); - pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8; - break; - case splashModeRGB8: - case splashModeBGR8: - pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1]; - (*blendFunc)(fg, pix, blend, bitmap->mode); - pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8; - pix[2] = (alpha * blend[2] + ialpha * pix[2]) >> 8; - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1]; - (*blendFunc)(fg, pix, blend, bitmap->mode); - pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8; - pix[2] = (alpha * blend[2] + ialpha * pix[2]) >> 8; - pix[3] = (alpha * blend[3] + ialpha * pix[3]) >> 8; - break; -#if SPLASH_CMYK - case splashModeACMYK8: - pix = &bitmap->data[y1 * bitmap->rowSize + 5 * x1]; - (*blendFunc)(fg, pix, blend, bitmap->mode); - pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8; - pix[2] = (alpha * blend[2] + ialpha * pix[2]) >> 8; - pix[3] = (alpha * blend[3] + ialpha * pix[3]) >> 8; - pix[4] = (alpha * blend[4] + ialpha * pix[4]) >> 8; - break; -#endif - } - if (!noClip) { - updateModX(x1); - updateModY(y1); - } - } - } - } - } - - } else { - p = glyph->data; - for (yy = 0, y1 = y0 - glyph->y; yy < glyph->h; ++yy, ++y1) { - for (xx = 0, x1 = x0 - glyph->x; xx < glyph->w; xx += 8) { - alpha0 = *p++; - for (xx1 = 0; xx1 < 8 && xx + xx1 < glyph->w; ++xx1, ++x1) { - if (alpha0 & 0x80) { - if (noClip || state->clip->test(x1, y1)) { - if (softMask) { - alpha = (int)(state->fillAlpha * - softMask->data[y1 * softMask->rowSize + x1]); - } else { - alpha = (int)(state->fillAlpha * 255); - } - ialpha = 255 - alpha; - state->fillPattern->getColor(x1, y1, fg); - switch (bitmap->mode) { - case splashModeMono1: - pix = &bitmap->data[y1 * bitmap->rowSize + (x1 >> 3)]; - dest[0] = (*pix >> (7 - (x1 & 7))) & 1; - (*blendFunc)(fg, dest, blend, bitmap->mode); - t = (alpha * blend[0] + ialpha * dest[0]) >> 8; - if (t) { - *pix |= 0x80 >> (x1 & 7); - } else { - *pix &= ~(0x80 >> (x1 & 7)); - } - break; - case splashModeMono8: - pix = &bitmap->data[y1 * bitmap->rowSize + x1]; - (*blendFunc)(fg, pix, blend, bitmap->mode); - // note: floor(x / 255) = x >> 8 (for 16-bit x) - pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8; - break; - case splashModeAMono8: - pix = &bitmap->data[y1 * bitmap->rowSize + 2 * x1]; - (*blendFunc)(fg, pix, blend, bitmap->mode); - pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8; - break; - case splashModeRGB8: - case splashModeBGR8: - pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1]; - (*blendFunc)(fg, pix, blend, bitmap->mode); - pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8; - pix[2] = (alpha * blend[2] + ialpha * pix[2]) >> 8; - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1]; - (*blendFunc)(fg, pix, blend, bitmap->mode); - pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8; - pix[2] = (alpha * blend[2] + ialpha * pix[2]) >> 8; - pix[3] = (alpha * blend[3] + ialpha * pix[3]) >> 8; - break; -#if SPLASH_CMYK - case splashModeACMYK8: - pix = &bitmap->data[y1 * bitmap->rowSize + 5 * x1]; - (*blendFunc)(fg, pix, blend, bitmap->mode); - pix[0] = (alpha * blend[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * blend[1] + ialpha * pix[1]) >> 8; - pix[2] = (alpha * blend[2] + ialpha * pix[2]) >> 8; - pix[3] = (alpha * blend[3] + ialpha * pix[3]) >> 8; - pix[4] = (alpha * blend[4] + ialpha * pix[4]) >> 8; - break; -#endif - } - if (!noClip) { - updateModX(x1); - updateModY(y1); - } - } - } - alpha0 <<= 1; - } - } - } - } - - } else { - if (glyph->aa) { - p = glyph->data; - for (yy = 0, y1 = y0 - glyph->y; yy < glyph->h; ++yy, ++y1) { - for (xx = 0, x1 = x0 - glyph->x; xx < glyph->w; ++xx, ++x1) { - alpha = *p++; - if (alpha > 0) { - if (noClip || state->clip->test(x1, y1)) { - ialpha = 255 - alpha; - state->fillPattern->getColor(x1, y1, fg); - switch (bitmap->mode) { - case splashModeMono1: - if (alpha >= 0x80) { - pix = &bitmap->data[y1 * bitmap->rowSize + (x1 >> 3)]; - if (fg[0]) { - *pix |= 0x80 >> (x1 & 7); - } else { - *pix &= ~(0x80 >> (x1 & 7)); - } - } - break; - case splashModeMono8: - pix = &bitmap->data[y1 * bitmap->rowSize + x1]; - // note: floor(x / 255) = x >> 8 (for 16-bit x) - pix[0] = (alpha * fg[0] + ialpha * pix[0]) >> 8; - break; - case splashModeAMono8: - pix = &bitmap->data[y1 * bitmap->rowSize + 2 * x1]; - pix[0] = (alpha * fg[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * fg[1] + ialpha * pix[1]) >> 8; - break; - case splashModeRGB8: - case splashModeBGR8: - pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1]; - pix[0] = (alpha * fg[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * fg[1] + ialpha * pix[1]) >> 8; - pix[2] = (alpha * fg[2] + ialpha * pix[2]) >> 8; - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1]; - pix[0] = (alpha * fg[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * fg[1] + ialpha * pix[1]) >> 8; - pix[2] = (alpha * fg[2] + ialpha * pix[2]) >> 8; - pix[3] = (alpha * fg[3] + ialpha * pix[3]) >> 8; - break; -#if SPLASH_CMYK - case splashModeACMYK8: - pix = &bitmap->data[y1 * bitmap->rowSize + 5 * x1]; - pix[0] = (alpha * fg[0] + ialpha * pix[0]) >> 8; - pix[1] = (alpha * fg[1] + ialpha * pix[1]) >> 8; - pix[2] = (alpha * fg[2] + ialpha * pix[2]) >> 8; - pix[3] = (alpha * fg[3] + ialpha * pix[3]) >> 8; - pix[4] = (alpha * fg[4] + ialpha * pix[4]) >> 8; - break; -#endif - } - if (!noClip) { - updateModX(x1); - updateModY(y1); - } - } - } - } - } - - } else { - p = glyph->data; - for (yy = 0, y1 = y0 - glyph->y; yy < glyph->h; ++yy, ++y1) { - for (xx = 0, x1 = x0 - glyph->x; xx < glyph->w; xx += 8) { - alpha0 = *p++; - for (xx1 = 0; xx1 < 8 && xx + xx1 < glyph->w; ++xx1, ++x1) { - if (alpha0 & 0x80) { - if (noClip || state->clip->test(x1, y1)) { - state->fillPattern->getColor(x1, y1, fg); - switch (bitmap->mode) { - case splashModeMono1: - pix = &bitmap->data[y1 * bitmap->rowSize + (x1 >> 3)]; - if (fg[0]) { - *pix |= 0x80 >> (x1 & 7); - } else { - *pix &= ~(0x80 >> (x1 & 7)); - } - break; - case splashModeMono8: - pix = &bitmap->data[y1 * bitmap->rowSize + x1]; - pix[0] = fg[0]; - break; - case splashModeAMono8: - pix = &bitmap->data[y1 * bitmap->rowSize + 2 * x1]; - pix[0] = fg[0]; - pix[1] = fg[1]; - break; - case splashModeRGB8: - case splashModeBGR8: - pix = &bitmap->data[y1 * bitmap->rowSize + 3 * x1]; - pix[0] = fg[0]; - pix[1] = fg[1]; - pix[2] = fg[2]; - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - pix = &bitmap->data[y1 * bitmap->rowSize + 4 * x1]; - pix[0] = fg[0]; - pix[1] = fg[1]; - pix[2] = fg[2]; - pix[3] = fg[3]; - break; -#if SPLASH_CMYK - case splashModeACMYK8: - pix = &bitmap->data[y1 * bitmap->rowSize + 5 * x1]; - pix[0] = fg[0]; - pix[1] = fg[1]; - pix[2] = fg[2]; - pix[3] = fg[3]; - pix[4] = fg[4]; - break; -#endif - } - if (!noClip) { - updateModX(x1); - updateModY(y1); - } - } - } - alpha0 <<= 1; - } - } - } - } - } - } - opClipRes = clipRes; - - return splashOk; -} - -SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData, - int w, int h, SplashCoord *mat) { - GBool rot; - SplashCoord xScale, yScale, xShear, yShear, yShear1; - int tx, tx2, ty, ty2, scaledWidth, scaledHeight, xSign, ySign; - int ulx, uly, llx, lly, urx, ury, lrx, lry; - int ulx1, uly1, llx1, lly1, urx1, ury1, lrx1, lry1; - int xMin, xMax, yMin, yMax; - SplashClipResult clipRes, clipRes2; - int yp, yq, yt, yStep, lastYStep; - int xp, xq, xt, xStep, xSrc; - int k1, spanXMin, spanXMax, spanY; - SplashColorPtr pixBuf, p; - int pixAcc; - SplashCoord alpha; - int x, y, x1, x2, y2; - SplashCoord y1; - int n, m, i, j; - - if (debugMode) { - printf("fillImageMask: w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n", - w, h, (double)mat[0], (double)mat[1], (double)mat[2], - (double)mat[3], (double)mat[4], (double)mat[5]); - } - - // check for singular matrix - if (splashAbs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.000001) { - return splashErrSingularMatrix; - } - - // compute scale, shear, rotation, translation parameters - rot = splashAbs(mat[1]) > splashAbs(mat[0]); - if (rot) { - xScale = -mat[1]; - yScale = mat[2] - (mat[0] * mat[3]) / mat[1]; - xShear = -mat[3] / yScale; - yShear = -mat[0] / mat[1]; - } else { - xScale = mat[0]; - yScale = mat[3] - (mat[1] * mat[2]) / mat[0]; - xShear = mat[2] / yScale; - yShear = mat[1] / mat[0]; - } - // the +/-0.01 in these computations is to avoid floating point - // precision problems which can lead to gaps between image stripes - // (it can cause image stripes to overlap, but that's a much less - // visible problem) - if (xScale >= 0) { - tx = splashRound(mat[4] - 0.01); - tx2 = splashRound(mat[4] + xScale + 0.01) - 1; - } else { - tx = splashRound(mat[4] + 0.01) - 1; - tx2 = splashRound(mat[4] + xScale - 0.01); - } - scaledWidth = abs(tx2 - tx) + 1; - if (scaledWidth == 0) { - // technically, this should draw nothing, but it generally seems - // better to draw a one-pixel-wide stripe rather than throwing it - // away - scaledWidth = 1; - } - if (yScale >= 0) { - ty = splashRound(mat[5] - 0.01); - ty2 = splashRound(mat[5] + yScale + 0.01) - 1; - } else { - ty = splashRound(mat[5] + 0.01) - 1; - ty2 = splashRound(mat[5] + yScale - 0.01); - } - scaledHeight = abs(ty2 - ty) + 1; - if (scaledHeight == 0) { - // technically, this should draw nothing, but it generally seems - // better to draw a one-pixel-wide stripe rather than throwing it - // away - scaledHeight = 1; - } - xSign = (xScale < 0) ? -1 : 1; - ySign = (yScale < 0) ? -1 : 1; - yShear1 = (SplashCoord)xSign * yShear; - - // clipping - ulx1 = 0; - uly1 = 0; - urx1 = xSign * (scaledWidth - 1); - ury1 = (int)(yShear * urx1); - llx1 = splashRound(xShear * ySign * (scaledHeight - 1)); - lly1 = ySign * (scaledHeight - 1) + (int)(yShear * llx1); - lrx1 = xSign * (scaledWidth - 1) + - splashRound(xShear * ySign * (scaledHeight - 1)); - lry1 = ySign * (scaledHeight - 1) + (int)(yShear * lrx1); - if (rot) { - ulx = tx + uly1; uly = ty - ulx1; - urx = tx + ury1; ury = ty - urx1; - llx = tx + lly1; lly = ty - llx1; - lrx = tx + lry1; lry = ty - lrx1; - } else { - ulx = tx + ulx1; uly = ty + uly1; - urx = tx + urx1; ury = ty + ury1; - llx = tx + llx1; lly = ty + lly1; - lrx = tx + lrx1; lry = ty + lry1; - } - xMin = (ulx < urx) ? (ulx < llx) ? (ulx < lrx) ? ulx : lrx - : (llx < lrx) ? llx : lrx - : (urx < llx) ? (urx < lrx) ? urx : lrx - : (llx < lrx) ? llx : lrx; - xMax = (ulx > urx) ? (ulx > llx) ? (ulx > lrx) ? ulx : lrx - : (llx > lrx) ? llx : lrx - : (urx > llx) ? (urx > lrx) ? urx : lrx - : (llx > lrx) ? llx : lrx; - yMin = (uly < ury) ? (uly < lly) ? (uly < lry) ? uly : lry - : (lly < lry) ? lly : lry - : (ury < lly) ? (ury < lry) ? ury : lry - : (lly < lry) ? lly : lry; - yMax = (uly > ury) ? (uly > lly) ? (uly > lry) ? uly : lry - : (lly > lry) ? lly : lry - : (ury > lly) ? (ury > lry) ? ury : lry - : (lly > lry) ? lly : lry; - clipRes = state->clip->testRect(xMin, yMin, xMax, yMax); - opClipRes = clipRes; - - // compute Bresenham parameters for x and y scaling - yp = h / scaledHeight; - yq = h % scaledHeight; - xp = w / scaledWidth; - xq = w % scaledWidth; - - // allocate pixel buffer - pixBuf = (SplashColorPtr)gmalloc((yp + 1) * w); - - // init y scale Bresenham - yt = 0; - lastYStep = 1; - - for (y = 0; y < scaledHeight; ++y) { - - // y scale Bresenham - yStep = yp; - yt += yq; - if (yt >= scaledHeight) { - yt -= scaledHeight; - ++yStep; - } - - // read row(s) from image - n = (yp > 0) ? yStep : lastYStep; - if (n > 0) { - p = pixBuf; - for (i = 0; i < n; ++i) { - (*src)(srcData, p); - p += w; - } - } - lastYStep = yStep; - - // loop-invariant constants - k1 = splashRound(xShear * ySign * y); - - // clipping test - if (clipRes != splashClipAllInside && - !rot && - (int)(yShear * k1) == - (int)(yShear * (xSign * (scaledWidth - 1) + k1))) { - if (xSign > 0) { - spanXMin = tx + k1; - spanXMax = spanXMin + (scaledWidth - 1); - } else { - spanXMax = tx + k1; - spanXMin = spanXMax - (scaledWidth - 1); - } - spanY = ty + ySign * y + (int)(yShear * k1); - clipRes2 = state->clip->testSpan(spanXMin, spanXMax, spanY); - if (clipRes2 == splashClipAllOutside) { - continue; - } - } else { - clipRes2 = clipRes; - } - - // init x scale Bresenham - xt = 0; - xSrc = 0; - - // x shear - x1 = k1; - - // y shear - y1 = (SplashCoord)ySign * y + yShear * x1; - // this is a kludge: if yShear1 is negative, then (int)y1 would - // change immediately after the first pixel, which is not what we - // want - if (yShear1 < 0) { - y1 += 0.999; - } - - // loop-invariant constants - n = yStep > 0 ? yStep : 1; - - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the alpha value for (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - p = pixBuf + xSrc; - pixAcc = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc += *p++; - } - p += w - m; - } - - // blend fill color with background - if (pixAcc != 0) { - if (pixAcc == n * m) { - drawPixel(tx + x2, ty + y2, state->fillPattern, state->fillAlpha, - clipRes2 == splashClipAllInside); - } else { - alpha = (SplashCoord)pixAcc / (SplashCoord)(n * m); - drawPixel(tx + x2, ty + y2, state->fillPattern, - state->fillAlpha * alpha, - clipRes2 == splashClipAllInside); - } - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - } - - // free memory - gfree(pixBuf); - - return splashOk; -} - -SplashError Splash::drawImage(SplashImageSource src, void *srcData, - SplashColorMode srcMode, - int w, int h, SplashCoord *mat) { - GBool ok, rot, halftone, srcAlpha; - SplashCoord xScale, yScale, xShear, yShear, yShear1; - int tx, tx2, ty, ty2, scaledWidth, scaledHeight, xSign, ySign; - int ulx, uly, llx, lly, urx, ury, lrx, lry; - int ulx1, uly1, llx1, lly1, urx1, ury1, lrx1, lry1; - int xMin, xMax, yMin, yMax; - SplashClipResult clipRes, clipRes2; - int yp, yq, yt, yStep, lastYStep; - int xp, xq, xt, xStep, xSrc; - int k1, spanXMin, spanXMax, spanY; - SplashColorPtr pixBuf, p; - SplashColor pix; -#if SPLASH_CMYK - int pixAcc0, pixAcc1, pixAcc2, pixAcc3; -#else - int pixAcc0, pixAcc1, pixAcc2; -#endif - int alphaAcc; - SplashCoord pixMul, alphaMul, alpha; - int x, y, x1, x2, y2; - SplashCoord y1; - int nComps, n, m, i, j; - - if (debugMode) { - printf("drawImage: srcMode=%d w=%d h=%d mat=[%.2f %.2f %.2f %.2f %.2f %.2f]\n", - srcMode, w, h, (double)mat[0], (double)mat[1], (double)mat[2], - (double)mat[3], (double)mat[4], (double)mat[5]); - } - - // check color modes - ok = gFalse; // make gcc happy - nComps = 0; // make gcc happy - halftone = gFalse; - srcAlpha = gFalse; - switch (bitmap->mode) { - case splashModeMono1: - ok = srcMode == splashModeMono1 || srcMode == splashModeMono8 || - srcMode == splashModeAMono8; - halftone = srcMode == splashModeMono8 || srcMode == splashModeAMono8; - srcAlpha = srcMode == splashModeAMono8; - nComps = srcAlpha ? 2 : 1; - break; - case splashModeMono8: - ok = srcMode == splashModeMono8 || srcMode == splashModeAMono8; - srcAlpha = srcMode == splashModeAMono8; - nComps = srcAlpha ? 2 : 1; - break; - case splashModeAMono8: - //~ not implemented yet - ok = gFalse; - nComps = 2; - break; - case splashModeRGB8: - ok = srcMode == splashModeRGB8 || srcMode == splashModeARGB8; - srcAlpha = srcMode == splashModeARGB8; - nComps = srcAlpha ? 4 : 3; - break; - case splashModeBGR8: - ok = srcMode == splashModeBGR8 || srcMode == splashModeBGRA8; - srcAlpha = srcMode == splashModeBGRA8; - nComps = srcAlpha ? 4 : 3; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - ok = srcMode == splashModeCMYK8 || srcMode == splashModeACMYK8; - srcAlpha = srcMode == splashModeACMYK8; - nComps = srcAlpha ? 5 : 4; - break; -#endif - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeACMYK8: -#endif - //~ not implemented yet - ok = gFalse; - nComps = 4; - break; - } - if (!ok) { - return splashErrModeMismatch; - } - - // check for singular matrix - if (splashAbs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.000001) { - return splashErrSingularMatrix; - } - - // compute scale, shear, rotation, translation parameters - rot = splashAbs(mat[1]) > splashAbs(mat[0]); - if (rot) { - xScale = -mat[1]; - yScale = mat[2] - (mat[0] * mat[3]) / mat[1]; - xShear = -mat[3] / yScale; - yShear = -mat[0] / mat[1]; - } else { - xScale = mat[0]; - yScale = mat[3] - (mat[1] * mat[2]) / mat[0]; - xShear = mat[2] / yScale; - yShear = mat[1] / mat[0]; - } - // the +/-0.01 in these computations is to avoid floating point - // precision problems which can lead to gaps between image stripes - // (it can cause image stripes to overlap, but that's a much less - // visible problem) - if (xScale >= 0) { - tx = splashRound(mat[4] - 0.01); - tx2 = splashRound(mat[4] + xScale + 0.01) - 1; - } else { - tx = splashRound(mat[4] + 0.01) - 1; - tx2 = splashRound(mat[4] + xScale - 0.01); - } - scaledWidth = abs(tx2 - tx) + 1; - if (scaledWidth == 0) { - // technically, this should draw nothing, but it generally seems - // better to draw a one-pixel-wide stripe rather than throwing it - // away - scaledWidth = 1; - } - if (yScale >= 0) { - ty = splashRound(mat[5] - 0.01); - ty2 = splashRound(mat[5] + yScale + 0.01) - 1; - } else { - ty = splashRound(mat[5] + 0.01) - 1; - ty2 = splashRound(mat[5] + yScale - 0.01); - } - scaledHeight = abs(ty2 - ty) + 1; - if (scaledHeight == 0) { - // technically, this should draw nothing, but it generally seems - // better to draw a one-pixel-wide stripe rather than throwing it - // away - scaledHeight = 1; - } - xSign = (xScale < 0) ? -1 : 1; - ySign = (yScale < 0) ? -1 : 1; - yShear1 = (SplashCoord)xSign * yShear; - - // clipping - ulx1 = 0; - uly1 = 0; - urx1 = xSign * (scaledWidth - 1); - ury1 = (int)(yShear * urx1); - llx1 = splashRound(xShear * ySign * (scaledHeight - 1)); - lly1 = ySign * (scaledHeight - 1) + (int)(yShear * llx1); - lrx1 = xSign * (scaledWidth - 1) + - splashRound(xShear * ySign * (scaledHeight - 1)); - lry1 = ySign * (scaledHeight - 1) + (int)(yShear * lrx1); - if (rot) { - ulx = tx + uly1; uly = ty - ulx1; - urx = tx + ury1; ury = ty - urx1; - llx = tx + lly1; lly = ty - llx1; - lrx = tx + lry1; lry = ty - lrx1; - } else { - ulx = tx + ulx1; uly = ty + uly1; - urx = tx + urx1; ury = ty + ury1; - llx = tx + llx1; lly = ty + lly1; - lrx = tx + lrx1; lry = ty + lry1; - } - xMin = (ulx < urx) ? (ulx < llx) ? (ulx < lrx) ? ulx : lrx - : (llx < lrx) ? llx : lrx - : (urx < llx) ? (urx < lrx) ? urx : lrx - : (llx < lrx) ? llx : lrx; - xMax = (ulx > urx) ? (ulx > llx) ? (ulx > lrx) ? ulx : lrx - : (llx > lrx) ? llx : lrx - : (urx > llx) ? (urx > lrx) ? urx : lrx - : (llx > lrx) ? llx : lrx; - yMin = (uly < ury) ? (uly < lly) ? (uly < lry) ? uly : lry - : (lly < lry) ? lly : lry - : (ury < lly) ? (ury < lry) ? ury : lry - : (lly < lry) ? lly : lry; - yMax = (uly > ury) ? (uly > lly) ? (uly > lry) ? uly : lry - : (lly > lry) ? lly : lry - : (ury > lly) ? (ury > lry) ? ury : lry - : (lly > lry) ? lly : lry; - clipRes = state->clip->testRect(xMin, yMin, xMax, yMax); - opClipRes = clipRes; - if (clipRes == splashClipAllOutside) { - return splashOk; - } - - // compute Bresenham parameters for x and y scaling - yp = h / scaledHeight; - yq = h % scaledHeight; - xp = w / scaledWidth; - xq = w % scaledWidth; - - // allocate pixel buffer - pixBuf = (SplashColorPtr)gmalloc((yp + 1) * w * nComps); - - pixAcc0 = pixAcc1 = pixAcc2 = 0; // make gcc happy -#if SPLASH_CMYK - pixAcc3 = 0; // make gcc happy -#endif - - if (srcAlpha) { - - // init y scale Bresenham - yt = 0; - lastYStep = 1; - - for (y = 0; y < scaledHeight; ++y) { - - // y scale Bresenham - yStep = yp; - yt += yq; - if (yt >= scaledHeight) { - yt -= scaledHeight; - ++yStep; - } - - // read row(s) from image - n = (yp > 0) ? yStep : lastYStep; - if (n > 0) { - p = pixBuf; - for (i = 0; i < n; ++i) { - (*src)(srcData, p); - p += w * nComps; - } - } - lastYStep = yStep; - - // loop-invariant constants - k1 = splashRound(xShear * ySign * y); - - // clipping test - if (clipRes != splashClipAllInside && - !rot && - (int)(yShear * k1) == - (int)(yShear * (xSign * (scaledWidth - 1) + k1))) { - if (xSign > 0) { - spanXMin = tx + k1; - spanXMax = spanXMin + (scaledWidth - 1); - } else { - spanXMax = tx + k1; - spanXMin = spanXMax - (scaledWidth - 1); - } - spanY = ty + ySign * y + (int)(yShear * k1); - clipRes2 = state->clip->testSpan(spanXMin, spanXMax, spanY); - if (clipRes2 == splashClipAllOutside) { - continue; - } - } else { - clipRes2 = clipRes; - } - - // init x scale Bresenham - xt = 0; - xSrc = 0; - - // x shear - x1 = k1; - - // y shear - y1 = (SplashCoord)ySign * y + yShear * x1; - // this is a kludge: if yShear1 is negative, then (int)y1 would - // change immediately after the first pixel, which is not what - // we want - if (yShear1 < 0) { - y1 += 0.999; - } - - // loop-invariant constants - n = yStep > 0 ? yStep : 1; - - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the filtered pixel at (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - alphaAcc = 0; - switch (srcMode) { - case splashModeAMono8: - p = pixBuf + xSrc * 2; - pixAcc0 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - alphaAcc += *p++; - pixAcc0 += *p++; - } - p += 2 * (w - m); - } - break; - case splashModeARGB8: - p = pixBuf + xSrc * 4; - pixAcc0 = pixAcc1 = pixAcc2 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - alphaAcc += *p++; - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - } - p += 4 * (w - m); - } - break; - case splashModeBGRA8: - p = pixBuf + xSrc * 4; - pixAcc0 = pixAcc1 = pixAcc2 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - alphaAcc += *p++; - } - p += 4 * (w - m); - } - break; -#if SPLASH_CMYK - case splashModeACMYK8: - p = pixBuf + xSrc * 5; - pixAcc0 = pixAcc1 = pixAcc2 = pixAcc3 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - alphaAcc += *p++; - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - pixAcc3 += *p++; - } - p += 5 * (w - m); - } - break; -#endif - default: // make gcc happy - break; - } - pixMul = (SplashCoord)1 / (SplashCoord)(n * m); - alphaMul = pixMul * (1.0 / 256.0); - alpha = (SplashCoord)alphaAcc * alphaMul; - - if (alpha > 0) { - // mono8 -> mono1 conversion, with halftoning - if (halftone) { - pix[0] = state->screen->test(tx + x2, ty + y2, - (SplashCoord)pixAcc0 * pixMul * (1.0 / 256.0)); - - // no conversion, no halftoning - } else { - switch (bitmap->mode) { -#if SPLASH_CMYK - case splashModeCMYK8: - pix[3] = (int)((SplashCoord)pixAcc3 * pixMul); - // fall through -#endif - case splashModeRGB8: - case splashModeBGR8: - pix[2] = (int)((SplashCoord)pixAcc2 * pixMul); - pix[1] = (int)((SplashCoord)pixAcc1 * pixMul); - // fall through - case splashModeMono1: - case splashModeMono8: - pix[0] = (int)((SplashCoord)pixAcc0 * pixMul); - break; - default: // make gcc happy - break; - } - } - - // set pixel - drawPixel(tx + x2, ty + y2, pix, alpha * state->fillAlpha, - clipRes2 == splashClipAllInside); - } - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - } - - } else { - - // init y scale Bresenham - yt = 0; - lastYStep = 1; - - for (y = 0; y < scaledHeight; ++y) { - - // y scale Bresenham - yStep = yp; - yt += yq; - if (yt >= scaledHeight) { - yt -= scaledHeight; - ++yStep; - } - - // read row(s) from image - n = (yp > 0) ? yStep : lastYStep; - if (n > 0) { - p = pixBuf; - for (i = 0; i < n; ++i) { - (*src)(srcData, p); - p += w * nComps; - } - } - lastYStep = yStep; - - // loop-invariant constants - k1 = splashRound(xShear * ySign * y); - - // clipping test - if (clipRes != splashClipAllInside && - !rot && - (int)(yShear * k1) == - (int)(yShear * (xSign * (scaledWidth - 1) + k1))) { - if (xSign > 0) { - spanXMin = tx + k1; - spanXMax = spanXMin + (scaledWidth - 1); - } else { - spanXMax = tx + k1; - spanXMin = spanXMax - (scaledWidth - 1); - } - spanY = ty + ySign * y + (int)(yShear * k1); - clipRes2 = state->clip->testSpan(spanXMin, spanXMax, spanY); - if (clipRes2 == splashClipAllOutside) { - continue; - } - } else { - clipRes2 = clipRes; - } - - // init x scale Bresenham - xt = 0; - xSrc = 0; - - // x shear - x1 = k1; - - // y shear - y1 = (SplashCoord)ySign * y + yShear * x1; - // this is a kludge: if yShear1 is negative, then (int)y1 would - // change immediately after the first pixel, which is not what - // we want - if (yShear1 < 0) { - y1 += 0.999; - } - - // loop-invariant constants - n = yStep > 0 ? yStep : 1; - - for (x = 0; x < scaledWidth; ++x) { - - // x scale Bresenham - xStep = xp; - xt += xq; - if (xt >= scaledWidth) { - xt -= scaledWidth; - ++xStep; - } - - // rotation - if (rot) { - x2 = (int)y1; - y2 = -x1; - } else { - x2 = x1; - y2 = (int)y1; - } - - // compute the filtered pixel at (x,y) after the x and y scaling - // operations - m = xStep > 0 ? xStep : 1; - switch (srcMode) { - case splashModeMono1: - case splashModeMono8: - p = pixBuf + xSrc; - pixAcc0 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - } - p += w - m; - } - break; - case splashModeRGB8: - case splashModeBGR8: - p = pixBuf + xSrc * 3; - pixAcc0 = pixAcc1 = pixAcc2 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - } - p += 3 * (w - m); - } - break; -#if SPLASH_CMYK - case splashModeCMYK8: - p = pixBuf + xSrc * 4; - pixAcc0 = pixAcc1 = pixAcc2 = pixAcc3 = 0; - for (i = 0; i < n; ++i) { - for (j = 0; j < m; ++j) { - pixAcc0 += *p++; - pixAcc1 += *p++; - pixAcc2 += *p++; - pixAcc3 += *p++; - } - p += 4 * (w - m); - } - break; -#endif - default: // make gcc happy - break; - } - pixMul = (SplashCoord)1 / (SplashCoord)(n * m); - - // mono8 -> mono1 conversion, with halftoning - if (halftone) { - pix[0] = state->screen->test(tx + x2, ty + y2, - (SplashCoord)pixAcc0 * pixMul * (1.0 / 256.0)); - - // no conversion, no halftoning - } else { - switch (bitmap->mode) { -#if SPLASH_CMYK - case splashModeCMYK8: - pix[3] = (int)((SplashCoord)pixAcc3 * pixMul); - // fall through -#endif - case splashModeRGB8: - case splashModeBGR8: - pix[2] = (int)((SplashCoord)pixAcc2 * pixMul); - pix[1] = (int)((SplashCoord)pixAcc1 * pixMul); - // fall through - case splashModeMono1: - case splashModeMono8: - pix[0] = (int)((SplashCoord)pixAcc0 * pixMul); - break; - default: // make gcc happy - break; - } - } - - // set pixel - drawPixel(tx + x2, ty + y2, pix, state->fillAlpha, - clipRes2 == splashClipAllInside); - - // x scale Bresenham - xSrc += xStep; - - // x shear - x1 += xSign; - - // y shear - y1 += yShear1; - } - } - - } - - gfree(pixBuf); - - return splashOk; -} - -void Splash::dumpPath(SplashPath *path) { - int i; - - for (i = 0; i < path->length; ++i) { - printf(" %3d: x=%8.2f y=%8.2f%s%s%s%s%s\n", - i, (double)path->pts[i].x, (double)path->pts[i].y, - (path->flags[i] & splashPathFirst) ? " first" : "", - (path->flags[i] & splashPathLast) ? " last" : "", - (path->flags[i] & splashPathClosed) ? " closed" : "", - (path->flags[i] & splashPathCurve) ? " curve" : "", - (path->flags[i] & splashPathArcCW) ? " arcCW" : ""); - } -} - -void Splash::dumpXPath(SplashXPath *path) { - int i; - - for (i = 0; i < path->length; ++i) { - printf(" %4d: x0=%8.2f y0=%8.2f x1=%8.2f y1=%8.2f %s%s%s%s%s%s%s\n", - i, (double)path->segs[i].x0, (double)path->segs[i].y0, - (double)path->segs[i].x1, (double)path->segs[i].y1, - (path->segs[i].flags & splashXPathFirst) ? "F" : " ", - (path->segs[i].flags & splashXPathLast) ? "L" : " ", - (path->segs[i].flags & splashXPathEnd0) ? "0" : " ", - (path->segs[i].flags & splashXPathEnd1) ? "1" : " ", - (path->segs[i].flags & splashXPathHoriz) ? "H" : " ", - (path->segs[i].flags & splashXPathVert) ? "V" : " ", - (path->segs[i].flags & splashXPathFlip) ? "P" : " "); - } -} diff --git a/pdftops/Splash.h b/pdftops/Splash.h deleted file mode 100644 index 1b179d106..000000000 --- a/pdftops/Splash.h +++ /dev/null @@ -1,204 +0,0 @@ -//======================================================================== -// -// Splash.h -// -//======================================================================== - -#ifndef SPLASH_H -#define SPLASH_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" -#include "SplashClip.h" - -class SplashBitmap; -struct SplashGlyphBitmap; -class SplashState; -class SplashPattern; -class SplashScreen; -class SplashPath; -class SplashXPath; -class SplashFont; - -//------------------------------------------------------------------------ - -// Retrieves the next line of pixels in an image mask. Normally, -// fills in * and returns true. If the image stream is -// exhausted, returns false. -typedef GBool (*SplashImageMaskSource)(void *data, SplashColorPtr pixel); - -// Retrieves the next line of pixels in an image. Normally, fills in -// * and returns true. If the image stream is exhausted, -// returns false. -typedef GBool (*SplashImageSource)(void *data, SplashColorPtr line); - -//------------------------------------------------------------------------ -// Splash -//------------------------------------------------------------------------ - -class Splash { -public: - - // Create a new rasterizer object. - Splash(SplashBitmap *bitmapA); - - ~Splash(); - - //----- state read - - SplashPattern *getStrokePattern(); - SplashPattern *getFillPattern(); - SplashScreen *getScreen(); - SplashBlendFunc getBlendFunc(); - SplashCoord getStrokeAlpha(); - SplashCoord getFillAlpha(); - SplashCoord getLineWidth(); - int getLineCap(); - int getLineJoin(); - SplashCoord getMiterLimit(); - SplashCoord getFlatness(); - SplashCoord *getLineDash(); - int getLineDashLength(); - SplashCoord getLineDashPhase(); - SplashClip *getClip(); - - //----- state write - - void setStrokePattern(SplashPattern *strokeColor); - void setFillPattern(SplashPattern *fillColor); - void setScreen(SplashScreen *screen); - void setBlendFunc(SplashBlendFunc func); - void setStrokeAlpha(SplashCoord alpha); - void setFillAlpha(SplashCoord alpha); - void setLineWidth(SplashCoord lineWidth); - void setLineCap(int lineCap); - void setLineJoin(int lineJoin); - void setMiterLimit(SplashCoord miterLimit); - void setFlatness(SplashCoord flatness); - // the array will be copied - void setLineDash(SplashCoord *lineDash, int lineDashLength, - SplashCoord lineDashPhase); - void clipResetToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1); - SplashError clipToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1); - SplashError clipToPath(SplashPath *path, GBool eo); - - //----- state save/restore - - void saveState(); - SplashError restoreState(); - - //----- soft mask - - void setSoftMask(SplashBitmap *softMaskA); - - //----- drawing operations - - // Fill the bitmap with . This is not subject to clipping. - void clear(SplashColorPtr color); - - // Stroke a path using the current stroke pattern. - SplashError stroke(SplashPath *path); - - // Fill a path using the current fill pattern. - SplashError fill(SplashPath *path, GBool eo); - - // Fill a path, XORing with the current fill pattern. - SplashError xorFill(SplashPath *path, GBool eo); - - // Draw a character, using the current fill pattern. - SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font); - - // Draw a glyph, using the current fill pattern. This function does - // not free any data, i.e., it ignores glyph->freeData. - SplashError fillGlyph(SplashCoord x, SplashCoord y, - SplashGlyphBitmap *glyph); - - // Draws an image mask using the fill color. This will read - // lines of pixels from , starting with the top line. "1" - // pixels will be drawn with the current fill color; "0" pixels are - // transparent. The matrix: - // [ mat[0] mat[1] 0 ] - // [ mat[2] mat[3] 0 ] - // [ mat[4] mat[5] 1 ] - // maps a unit square to the desired destination for the image, in - // PostScript style: - // [x' y' 1] = [x y 1] * mat - // Note that the Splash y axis points downward, and the image source - // is assumed to produce pixels in raster order, starting from the - // top line. - SplashError fillImageMask(SplashImageMaskSource src, void *srcData, - int w, int h, SplashCoord *mat); - - // Draw an image. This will read lines of pixels from - // , starting with the top line. These pixels are assumed to - // be in the source mode, . The following combinations of - // source and target modes are supported: - // source target - // ------ ------ - // Mono1 Mono1 - // Mono8 Mono1 -- with dithering - // Mono8 Mono8 - // RGB8 RGB8 - // BGR8 BGR8 - // ARGB8 RGB8 -- with source alpha (masking) - // BGRA8 BGR8 -- with source alpha (masking) - // The matrix behaves as for fillImageMask. - SplashError drawImage(SplashImageSource src, void *srcData, - SplashColorMode srcMode, - int w, int h, SplashCoord *mat); - - //----- misc - - // Return the associated bitmap. - SplashBitmap *getBitmap() { return bitmap; } - - // Get a bounding box which includes all modifications since the - // last call to clearModRegion. - void getModRegion(int *xMin, int *yMin, int *xMax, int *yMax) - { *xMin = modXMin; *yMin = modYMin; *xMax = modXMax; *yMax = modYMax; } - - // Clear the modified region bounding box. - void clearModRegion(); - - // Get clipping status for the last drawing operation subject to - // clipping. - SplashClipResult getClipRes() { return opClipRes; } - - // Toggle debug mode on or off. - void setDebugMode(GBool debugModeA) { debugMode = debugModeA; } - -private: - - void updateModX(int x); - void updateModY(int y); - void strokeNarrow(SplashXPath *xPath); - void strokeWide(SplashXPath *xPath); - SplashXPath *makeDashedPath(SplashXPath *xPath); - SplashError fillWithPattern(SplashPath *path, GBool eo, - SplashPattern *pattern, SplashCoord alpha); - void drawPixel(int x, int y, SplashColorPtr color, - SplashCoord alpha, GBool noClip); - void drawPixel(int x, int y, SplashPattern *pattern, - SplashCoord alpha, GBool noClip); - void drawSpan(int x0, int x1, int y, SplashPattern *pattern, - SplashCoord alpha, GBool noClip); - void xorSpan(int x0, int x1, int y, SplashPattern *pattern, GBool noClip); - void dumpPath(SplashPath *path); - void dumpXPath(SplashXPath *path); - - SplashBitmap *bitmap; - SplashState *state; - SplashBitmap *softMask; - int modXMin, modYMin, modXMax, modYMax; - SplashClipResult opClipRes; - GBool debugMode; -}; - -#endif diff --git a/pdftops/SplashBitmap.cxx b/pdftops/SplashBitmap.cxx deleted file mode 100644 index 6b2442c9e..000000000 --- a/pdftops/SplashBitmap.cxx +++ /dev/null @@ -1,243 +0,0 @@ -//======================================================================== -// -// SplashBitmap.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include "gmem.h" -#include "SplashErrorCodes.h" -#include "SplashBitmap.h" - -//------------------------------------------------------------------------ -// SplashBitmap -//------------------------------------------------------------------------ - -SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPad, - SplashColorMode modeA, GBool topDown) { - width = widthA; - height = heightA; - mode = modeA; - switch (mode) { - case splashModeMono1: - rowSize = (width + 7) >> 3; - break; - case splashModeMono8: - rowSize = width; - break; - case splashModeAMono8: - rowSize = width * 2; - break; - case splashModeRGB8: - case splashModeBGR8: - rowSize = width * 3; - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - rowSize = width * 4; - break; -#if SPLASH_CMYK - case splashModeACMYK8: - rowSize = width * 5; - break; -#endif - } - rowSize += rowPad - 1; - rowSize -= rowSize % rowPad; - data = (SplashColorPtr)gmalloc(rowSize * height); - if (!topDown) { - data += (height - 1) * rowSize; - rowSize = -rowSize; - } -} - - -SplashBitmap::~SplashBitmap() { - if (rowSize < 0) { - gfree(data + (height - 1) * rowSize); - } else { - gfree(data); - } -} - -SplashError SplashBitmap::writePNMFile(char *fileName) { - FILE *f; - SplashColorPtr row, p; - int x, y; - - if (!(f = fopen(fileName, "wb"))) { - return splashErrOpenFile; - } - - switch (mode) { - - case splashModeMono1: - fprintf(f, "P4\n%d %d\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; x += 8) { - fputc(*p ^ 0xff, f); - ++p; - } - row += rowSize; - } - break; - - case splashModeMono8: - fprintf(f, "P5\n%d %d\n255\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; ++x) { - fputc(*p, f); - ++p; - } - row += rowSize; - } - break; - - case splashModeAMono8: - fprintf(f, "P5\n%d %d\n255\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; ++x) { - fputc(splashAMono8M(p), f); - p += 2; - } - row += rowSize; - } - break; - - case splashModeRGB8: - fprintf(f, "P6\n%d %d\n255\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; ++x) { - fputc(splashRGB8R(p), f); - fputc(splashRGB8G(p), f); - fputc(splashRGB8B(p), f); - p += 3; - } - row += rowSize; - } - break; - - case splashModeBGR8: - fprintf(f, "P6\n%d %d\n255\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; ++x) { - fputc(splashBGR8R(p), f); - fputc(splashBGR8G(p), f); - fputc(splashBGR8B(p), f); - p += 3; - } - row += rowSize; - } - break; - - case splashModeARGB8: - fprintf(f, "P6\n%d %d\n255\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; ++x) { - fputc(splashARGB8R(p), f); - fputc(splashARGB8G(p), f); - fputc(splashARGB8B(p), f); - p += 4; - } - row += rowSize; - } - break; - - case splashModeBGRA8: - fprintf(f, "P6\n%d %d\n255\n", width, height); - row = data; - for (y = 0; y < height; ++y) { - p = row; - for (x = 0; x < width; ++x) { - fputc(splashBGRA8R(p), f); - fputc(splashBGRA8G(p), f); - fputc(splashBGRA8B(p), f); - p += 4; - } - row += rowSize; - } - break; - -#if SPLASH_CMYK - case splashModeCMYK8: - case splashModeACMYK8: - // PNM doesn't support CMYK - break; -#endif - } - - fclose(f); - return splashOk; -} - -void SplashBitmap::getPixel(int x, int y, SplashColorPtr pixel) { - SplashColorPtr p; - - if (y < 0 || y >= height || x < 0 || x >= width) { - return; - } - switch (mode) { - case splashModeMono1: - p = &data[y * rowSize + (x >> 3)]; - pixel[0] = (p[0] >> (7 - (x & 7))) & 1; - break; - case splashModeMono8: - p = &data[y * rowSize + x]; - pixel[0] = p[0]; - break; - case splashModeAMono8: - p = &data[y * rowSize + 2 * x]; - pixel[0] = p[0]; - pixel[1] = p[1]; - break; - case splashModeRGB8: - case splashModeBGR8: - p = &data[y * rowSize + 3 * x]; - pixel[0] = p[0]; - pixel[1] = p[1]; - pixel[2] = p[2]; - break; - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeCMYK8: -#endif - p = &data[y * rowSize + 4 * x]; - pixel[0] = p[0]; - pixel[1] = p[1]; - pixel[2] = p[2]; - pixel[3] = p[3]; - break; -#if SPLASH_CMYK - case splashModeACMYK8: - p = &data[y * rowSize + 5 * x]; - pixel[0] = p[0]; - pixel[1] = p[1]; - pixel[2] = p[2]; - pixel[3] = p[3]; - pixel[4] = p[4]; - break; -#endif - } -} diff --git a/pdftops/SplashBitmap.h b/pdftops/SplashBitmap.h deleted file mode 100644 index e3e5109ca..000000000 --- a/pdftops/SplashBitmap.h +++ /dev/null @@ -1,55 +0,0 @@ -//======================================================================== -// -// SplashBitmap.h -// -//======================================================================== - -#ifndef SPLASHBITMAP_H -#define SPLASHBITMAP_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -//------------------------------------------------------------------------ -// SplashBitmap -//------------------------------------------------------------------------ - -class SplashBitmap { -public: - - // Create a new bitmap. It will have x pixels in - // color mode . Rows will be padded out to a multiple of - // bytes. If is false, the bitmap will be stored - // upside-down, i.e., with the last row first in memory. - SplashBitmap(int widthA, int heightA, int rowPad, - SplashColorMode modeA, GBool topDown = gTrue); - - ~SplashBitmap(); - - int getWidth() { return width; } - int getHeight() { return height; } - int getRowSize() { return rowSize; } - SplashColorMode getMode() { return mode; } - SplashColorPtr getDataPtr() { return data; } - - SplashError writePNMFile(char *fileName); - - void getPixel(int x, int y, SplashColorPtr pixel); - -private: - - int width, height; // size of bitmap - int rowSize; // size of one row of data, in bytes - // - negative for bottom-up bitmaps - SplashColorMode mode; // color mode - SplashColorPtr data; // pointer to row zero of the bitmap data - - friend class Splash; -}; - -#endif diff --git a/pdftops/SplashClip.cxx b/pdftops/SplashClip.cxx deleted file mode 100644 index 6d4bf89f1..000000000 --- a/pdftops/SplashClip.cxx +++ /dev/null @@ -1,270 +0,0 @@ -//======================================================================== -// -// SplashClip.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include -#include "gmem.h" -#include "SplashErrorCodes.h" -#include "SplashMath.h" -#include "SplashPath.h" -#include "SplashXPath.h" -#include "SplashXPathScanner.h" -#include "SplashClip.h" - -//------------------------------------------------------------------------ -// SplashClip.flags -//------------------------------------------------------------------------ - -#define splashClipEO 0x01 // use even-odd rule - -//------------------------------------------------------------------------ -// SplashClip -//------------------------------------------------------------------------ - -SplashClip::SplashClip(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - if (x0 < x1) { - xMin = splashFloor(x0); - xMax = splashFloor(x1); - } else { - xMin = splashFloor(x1); - xMax = splashFloor(x0); - } - if (y0 < y1) { - yMin = splashFloor(y0); - yMax = splashFloor(y1); - } else { - yMin = splashFloor(y1); - yMax = splashFloor(y0); - } - paths = NULL; - flags = NULL; - scanners = NULL; - length = size = 0; -} - -SplashClip::SplashClip(SplashClip *clip) { - int i; - - xMin = clip->xMin; - yMin = clip->yMin; - xMax = clip->xMax; - yMax = clip->yMax; - length = clip->length; - size = clip->size; - paths = (SplashXPath **)gmallocn(size, sizeof(SplashXPath *)); - flags = (Guchar *)gmallocn(size, sizeof(Guchar)); - scanners = (SplashXPathScanner **) - gmallocn(size, sizeof(SplashXPathScanner *)); - for (i = 0; i < length; ++i) { - paths[i] = clip->paths[i]->copy(); - flags[i] = clip->flags[i]; - scanners[i] = new SplashXPathScanner(paths[i], flags[i] & splashClipEO); - } -} - -SplashClip::~SplashClip() { - int i; - - for (i = 0; i < length; ++i) { - delete paths[i]; - delete scanners[i]; - } - gfree(paths); - gfree(flags); - gfree(scanners); -} - -void SplashClip::grow(int nPaths) { - if (length + nPaths > size) { - if (size == 0) { - size = 32; - } - while (size < length + nPaths) { - size *= 2; - } - paths = (SplashXPath **)greallocn(paths, size, sizeof(SplashXPath *)); - flags = (Guchar *)greallocn(flags, size, sizeof(Guchar)); - scanners = (SplashXPathScanner **) - greallocn(scanners, size, sizeof(SplashXPathScanner *)); - } -} - -void SplashClip::resetToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - int i; - - for (i = 0; i < length; ++i) { - delete paths[i]; - delete scanners[i]; - } - gfree(paths); - gfree(flags); - gfree(scanners); - paths = NULL; - flags = NULL; - scanners = NULL; - length = size = 0; - - if (x0 < x1) { - xMin = splashFloor(x0); - xMax = splashFloor(x1); - } else { - xMin = splashFloor(x1); - xMax = splashFloor(x0); - } - if (y0 < y1) { - yMin = splashFloor(y0); - yMax = splashFloor(y1); - } else { - yMin = splashFloor(y1); - yMax = splashFloor(y0); - } -} - -SplashError SplashClip::clipToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - int x0I, y0I, x1I, y1I; - - if (x0 < x1) { - x0I = splashFloor(x0); - x1I = splashFloor(x1); - } else { - x0I = splashFloor(x1); - x1I = splashFloor(x0); - } - if (x0I > xMin) { - xMin = x0I; - } - if (x1I < xMax) { - xMax = x1I; - } - if (y0 < y1) { - y0I = splashFloor(y0); - y1I = splashFloor(y1); - } else { - y0I = splashFloor(y1); - y1I = splashFloor(y0); - } - if (y0I > yMin) { - yMin = y0I; - } - if (y1I < yMax) { - yMax = y1I; - } - return splashOk; -} - -SplashError SplashClip::clipToPath(SplashPath *path, SplashCoord flatness, - GBool eo) { - SplashXPath *xPath; - - xPath = new SplashXPath(path, flatness, gTrue); - - // check for an empty path - if (xPath->length == 0) { - xMax = xMin - 1; - yMax = yMin - 1; - delete xPath; - - // check for a rectangle - } else if (xPath->length == 4 && - ((xPath->segs[0].x0 == xPath->segs[0].x1 && - xPath->segs[0].x0 == xPath->segs[1].x0 && - xPath->segs[0].x0 == xPath->segs[3].x1 && - xPath->segs[2].x0 == xPath->segs[2].x1 && - xPath->segs[2].x0 == xPath->segs[1].x1 && - xPath->segs[2].x0 == xPath->segs[3].x0 && - xPath->segs[1].y0 == xPath->segs[1].y1 && - xPath->segs[1].y0 == xPath->segs[0].y1 && - xPath->segs[1].y0 == xPath->segs[2].y0 && - xPath->segs[3].y0 == xPath->segs[3].y1 && - xPath->segs[3].y0 == xPath->segs[0].y0 && - xPath->segs[3].y0 == xPath->segs[2].y1) || - (xPath->segs[0].y0 == xPath->segs[0].y1 && - xPath->segs[0].y0 == xPath->segs[1].y0 && - xPath->segs[0].y0 == xPath->segs[3].y1 && - xPath->segs[2].y0 == xPath->segs[2].y1 && - xPath->segs[2].y0 == xPath->segs[1].y1 && - xPath->segs[2].y0 == xPath->segs[3].y0 && - xPath->segs[1].x0 == xPath->segs[1].x1 && - xPath->segs[1].x0 == xPath->segs[0].x1 && - xPath->segs[1].x0 == xPath->segs[2].x0 && - xPath->segs[3].x0 == xPath->segs[3].x1 && - xPath->segs[3].x0 == xPath->segs[0].x0 && - xPath->segs[3].x0 == xPath->segs[2].x1))) { - clipToRect(xPath->segs[0].x0, xPath->segs[0].y0, - xPath->segs[2].x0, xPath->segs[2].y0); - delete xPath; - - } else { - grow(1); - xPath->sort(); - paths[length] = xPath; - flags[length] = eo ? splashClipEO : 0; - scanners[length] = new SplashXPathScanner(xPath, eo); - ++length; - } - - return splashOk; -} - -GBool SplashClip::test(int x, int y) { - int i; - - // check the rectangle - if (x < xMin || x > xMax || y < yMin || y > yMax) { - return gFalse; - } - - // check the paths - for (i = 0; i < length; ++i) { - if (!scanners[i]->test(x, y)) { - return gFalse; - } - } - - return gTrue; -} - -SplashClipResult SplashClip::testRect(int rectXMin, int rectYMin, - int rectXMax, int rectYMax) { - if (rectXMax < xMin || rectXMin > xMax || - rectYMax < yMin || rectYMin > yMax) { - return splashClipAllOutside; - } - if (rectXMin >= xMin && rectXMax <= xMax && - rectYMin >= yMin && rectYMax <= yMax && - length == 0) { - return splashClipAllInside; - } - return splashClipPartial; -} - -SplashClipResult SplashClip::testSpan(int spanXMin, int spanXMax, int spanY) { - int i; - - if (spanXMax < xMin || spanXMin > xMax || - spanY < yMin || spanY > yMax) { - return splashClipAllOutside; - } - if (!(spanXMin >= xMin && spanXMax <= xMax && - spanY >= yMin && spanY <= yMax)) { - return splashClipPartial; - } - for (i = 0; i < length; ++i) { - if (!scanners[i]->testSpan(xMin, xMax, spanY)) { - return splashClipPartial; - } - } - return splashClipAllInside; -} diff --git a/pdftops/SplashClip.h b/pdftops/SplashClip.h deleted file mode 100644 index 09a862747..000000000 --- a/pdftops/SplashClip.h +++ /dev/null @@ -1,97 +0,0 @@ -//======================================================================== -// -// SplashClip.h -// -//======================================================================== - -#ifndef SPLASHCLIP_H -#define SPLASHCLIP_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -class SplashPath; -class SplashXPath; -class SplashXPathScanner; - -//------------------------------------------------------------------------ - -enum SplashClipResult { - splashClipAllInside, - splashClipAllOutside, - splashClipPartial -}; - -//------------------------------------------------------------------------ -// SplashClip -//------------------------------------------------------------------------ - -class SplashClip { -public: - - // Create a clip, for the given rectangle. - SplashClip(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1); - - // Copy a clip. - SplashClip *copy() { return new SplashClip(this); } - - ~SplashClip(); - - // Reset the clip to a rectangle. - void resetToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1); - - // Intersect the clip with a rectangle. - SplashError clipToRect(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1); - - // Interesect the clip with . - SplashError clipToPath(SplashPath *path, SplashCoord flatness, - GBool eo); - - // Returns true if (,) is inside the clip. - GBool test(int x, int y); - - // Tests a rectangle against the clipping region. Returns one of: - // - splashClipAllInside if the entire rectangle is inside the - // clipping region, i.e., all pixels in the rectangle are - // visible - // - splashClipAllOutside if the entire rectangle is outside the - // clipping region, i.e., all the pixels in the rectangle are - // clipped - // - splashClipPartial if the rectangle is part inside and part - // outside the clipping region - SplashClipResult testRect(int rectXMin, int rectYMin, - int rectXMax, int rectYMax); - - // Similar to testRect, but tests a horizontal span. - SplashClipResult testSpan(int spanXMin, int spanXMax, int spanY); - - // Get the rectangle part of the clip region. - int getXMin() { return xMin; } - int getXMax() { return xMax; } - int getYMin() { return yMin; } - int getYMax() { return yMax; } - - // Get the number of arbitrary paths used by the clip region. - int getNumPaths() { return length; } - -private: - - SplashClip(SplashClip *clip); - void grow(int nPaths); - - int xMin, yMin, xMax, yMax; - SplashXPath **paths; - Guchar *flags; - SplashXPathScanner **scanners; - int length, size; -}; - -#endif diff --git a/pdftops/SplashErrorCodes.h b/pdftops/SplashErrorCodes.h deleted file mode 100644 index 145c07fad..000000000 --- a/pdftops/SplashErrorCodes.h +++ /dev/null @@ -1,32 +0,0 @@ -//======================================================================== -// -// SplashErrorCodes.h -// -//======================================================================== - -#ifndef SPLASHERRORCODES_H -#define SPLASHERRORCODES_H - -#include - -//------------------------------------------------------------------------ - -#define splashOk 0 // no error - -#define splashErrNoCurPt 1 // no current point - -#define splashErrEmptyPath 2 // zero points in path - -#define splashErrBogusPath 3 // only one point in subpath - -#define splashErrNoSave 4 // state stack is empty - -#define splashErrOpenFile 5 // couldn't open file - -#define splashErrNoGlyph 6 // couldn't get the requested glyph - -#define splashErrModeMismatch 7 // invalid combination of color modes - -#define splashErrSingularMatrix 8 // matrix is singular - -#endif diff --git a/pdftops/SplashFTFont.cxx b/pdftops/SplashFTFont.cxx deleted file mode 100644 index 174dedd8a..000000000 --- a/pdftops/SplashFTFont.cxx +++ /dev/null @@ -1,320 +0,0 @@ -//======================================================================== -// -// SplashFTFont.cc -// -//======================================================================== - -#include - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include FT_OUTLINE_H -#include FT_INTERNAL_OBJECTS_H // needed for FT_New_Size decl -#include "gmem.h" -#include "SplashMath.h" -#include "SplashGlyphBitmap.h" -#include "SplashPath.h" -#include "SplashFTFontEngine.h" -#include "SplashFTFontFile.h" -#include "SplashFTFont.h" - -//------------------------------------------------------------------------ - -static int glyphPathMoveTo(FT_Vector *pt, void *path); -static int glyphPathLineTo(FT_Vector *pt, void *path); -static int glyphPathConicTo(FT_Vector *ctrl, FT_Vector *pt, void *path); -static int glyphPathCubicTo(FT_Vector *ctrl1, FT_Vector *ctrl2, - FT_Vector *pt, void *path); - -//------------------------------------------------------------------------ -// SplashFTFont -//------------------------------------------------------------------------ - -SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA): - SplashFont(fontFileA, matA, fontFileA->engine->aa) -{ - FT_Face face; - SplashCoord size, div; - int x, y; - - face = fontFileA->face; - if (FT_New_Size(face, &sizeObj)) { - return; - } - face->size = sizeObj; - size = splashSqrt(mat[2]*mat[2] + mat[3]*mat[3]); - if (FT_Set_Pixel_Sizes(face, 0, (int)size)) { - return; - } - - div = face->bbox.xMax > 20000 ? 65536 : 1; - - // transform the four corners of the font bounding box -- the min - // and max values form the bounding box of the transformed font - x = (int)((mat[0] * face->bbox.xMin + mat[2] * face->bbox.yMin) / - (div * face->units_per_EM)); - xMin = xMax = x; - y = (int)((mat[1] * face->bbox.xMin + mat[3] * face->bbox.yMin) / - (div * face->units_per_EM)); - yMin = yMax = y; - x = (int)((mat[0] * face->bbox.xMin + mat[2] * face->bbox.yMax) / - (div * face->units_per_EM)); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)((mat[1] * face->bbox.xMin + mat[3] * face->bbox.yMax) / - (div * face->units_per_EM)); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - x = (int)((mat[0] * face->bbox.xMax + mat[2] * face->bbox.yMin) / - (div * face->units_per_EM)); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)((mat[1] * face->bbox.xMax + mat[3] * face->bbox.yMin) / - (div * face->units_per_EM)); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - x = (int)((mat[0] * face->bbox.xMax + mat[2] * face->bbox.yMax) / - (div * face->units_per_EM)); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)((mat[1] * face->bbox.xMax + mat[3] * face->bbox.yMax) / - (div * face->units_per_EM)); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - // This is a kludge: some buggy PDF generators embed fonts with - // zero bounding boxes. - if (xMax == xMin) { - xMin = 0; - xMax = (int)size; - } - if (yMax == yMin) { - yMin = 0; - yMax = (int)((SplashCoord)1.2 * size); - } - - // compute the transform matrix -#if USE_FIXEDPOINT - matrix.xx = (FT_Fixed)((mat[0] / size).getRaw()); - matrix.yx = (FT_Fixed)((mat[1] / size).getRaw()); - matrix.xy = (FT_Fixed)((mat[2] / size).getRaw()); - matrix.yy = (FT_Fixed)((mat[3] / size).getRaw()); -#else - matrix.xx = (FT_Fixed)((mat[0] / size) * 65536); - matrix.yx = (FT_Fixed)((mat[1] / size) * 65536); - matrix.xy = (FT_Fixed)((mat[2] / size) * 65536); - matrix.yy = (FT_Fixed)((mat[3] / size) * 65536); -#endif -} - -SplashFTFont::~SplashFTFont() { -} - -GBool SplashFTFont::getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap) { - return SplashFont::getGlyph(c, xFrac, 0, bitmap); -} - -GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap) { - SplashFTFontFile *ff; - FT_Vector offset; - FT_GlyphSlot slot; - FT_UInt gid; - int rowSize; - Guchar *p, *q; - int i; - - ff = (SplashFTFontFile *)fontFile; - - ff->face->size = sizeObj; - offset.x = (FT_Pos)(int)((SplashCoord)xFrac * splashFontFractionMul * 64); - offset.y = 0; - FT_Set_Transform(ff->face, &matrix, &offset); - slot = ff->face->glyph; - - if (ff->codeToGID && c < ff->codeToGIDLen) { - gid = (FT_UInt)ff->codeToGID[c]; - } else { - gid = (FT_UInt)c; - } - - // if we have the FT2 bytecode interpreter, autohinting won't be used -#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER - if (FT_Load_Glyph(ff->face, gid, - aa ? FT_LOAD_NO_BITMAP : FT_LOAD_DEFAULT)) { - return gFalse; - } -#else - // FT2's autohinting doesn't always work very well (especially with - // font subsets), so turn it off if anti-aliasing is enabled; if - // anti-aliasing is disabled, this seems to be a tossup - some fonts - // look better with hinting, some without, so leave hinting on - if (FT_Load_Glyph(ff->face, gid, - aa ? FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP - : FT_LOAD_DEFAULT)) { - return gFalse; - } -#endif - if (FT_Render_Glyph(slot, aa ? ft_render_mode_normal - : ft_render_mode_mono)) { - return gFalse; - } - - bitmap->x = -slot->bitmap_left; - bitmap->y = slot->bitmap_top; - bitmap->w = slot->bitmap.width; - bitmap->h = slot->bitmap.rows; - bitmap->aa = aa; - if (aa) { - rowSize = bitmap->w; - } else { - rowSize = (bitmap->w + 7) >> 3; - } - bitmap->data = (Guchar *)gmalloc(rowSize * bitmap->h); - bitmap->freeData = gTrue; - for (i = 0, p = bitmap->data, q = slot->bitmap.buffer; - i < bitmap->h; - ++i, p += rowSize, q += slot->bitmap.pitch) { - memcpy(p, q, rowSize); - } - - return gTrue; -} - -struct SplashFTFontPath { - SplashPath *path; - GBool needClose; -}; - -SplashPath *SplashFTFont::getGlyphPath(int c) { - static FT_Outline_Funcs outlineFuncs = { - &glyphPathMoveTo, - &glyphPathLineTo, - &glyphPathConicTo, - &glyphPathCubicTo, - 0, 0 - }; - SplashFTFontFile *ff; - SplashFTFontPath path; - FT_GlyphSlot slot; - FT_UInt gid; - FT_Glyph glyph; - - ff = (SplashFTFontFile *)fontFile; - ff->face->size = sizeObj; - FT_Set_Transform(ff->face, &matrix, NULL); - slot = ff->face->glyph; - if (ff->codeToGID && c < ff->codeToGIDLen) { - gid = ff->codeToGID[c]; - } else { - gid = (FT_UInt)c; - } - if (FT_Load_Glyph(ff->face, gid, FT_LOAD_NO_BITMAP)) { - return NULL; - } - if (FT_Get_Glyph(slot, &glyph)) { - return NULL; - } - path.path = new SplashPath(); - path.needClose = gFalse; - FT_Outline_Decompose(&((FT_OutlineGlyph)glyph)->outline, - &outlineFuncs, &path); - if (path.needClose) { - path.path->close(); - } - FT_Done_Glyph(glyph); - return path.path; -} - -static int glyphPathMoveTo(FT_Vector *pt, void *path) { - SplashFTFontPath *p = (SplashFTFontPath *)path; - - if (p->needClose) { - p->path->close(); - p->needClose = gFalse; - } - p->path->moveTo(pt->x / 64.0, -pt->y / 64.0); - return 0; -} - -static int glyphPathLineTo(FT_Vector *pt, void *path) { - SplashFTFontPath *p = (SplashFTFontPath *)path; - - p->path->lineTo(pt->x / 64.0, -pt->y / 64.0); - p->needClose = gTrue; - return 0; -} - -static int glyphPathConicTo(FT_Vector *ctrl, FT_Vector *pt, void *path) { - SplashFTFontPath *p = (SplashFTFontPath *)path; - SplashCoord x0, y0, x1, y1, x2, y2, x3, y3, xc, yc; - - if (!p->path->getCurPt(&x0, &y0)) { - return 0; - } - xc = ctrl->x / 64.0; - yc = -ctrl->y / 64.0; - x3 = pt->x / 64.0; - y3 = -pt->y / 64.0; - - // A second-order Bezier curve is defined by two endpoints, p0 and - // p3, and one control point, pc: - // - // p(t) = (1-t)^2*p0 + t*(1-t)*pc + t^2*p3 - // - // A third-order Bezier curve is defined by the same two endpoints, - // p0 and p3, and two control points, p1 and p2: - // - // p(t) = (1-t)^3*p0 + 3t*(1-t)^2*p1 + 3t^2*(1-t)*p2 + t^3*p3 - // - // Applying some algebra, we can convert a second-order curve to a - // third-order curve: - // - // p1 = (1/3) * (p0 + 2pc) - // p2 = (1/3) * (2pc + p3) - - x1 = (SplashCoord)(1.0 / 3.0) * (x0 + (SplashCoord)2 * xc); - y1 = (SplashCoord)(1.0 / 3.0) * (y0 + (SplashCoord)2 * yc); - x2 = (SplashCoord)(1.0 / 3.0) * ((SplashCoord)2 * xc + x3); - y2 = (SplashCoord)(1.0 / 3.0) * ((SplashCoord)2 * yc + y3); - - p->path->curveTo(x1, y1, x2, y2, x3, y3); - p->needClose = gTrue; - return 0; -} - -static int glyphPathCubicTo(FT_Vector *ctrl1, FT_Vector *ctrl2, - FT_Vector *pt, void *path) { - SplashFTFontPath *p = (SplashFTFontPath *)path; - - p->path->curveTo(ctrl1->x / 64.0, -ctrl1->y / 64.0, - ctrl2->x / 64.0, -ctrl2->y / 64.0, - pt->x / 64.0, -pt->y / 64.0); - p->needClose = gTrue; - return 0; -} - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/pdftops/SplashFTFont.h b/pdftops/SplashFTFont.h deleted file mode 100644 index 380cbbdb4..000000000 --- a/pdftops/SplashFTFont.h +++ /dev/null @@ -1,55 +0,0 @@ -//======================================================================== -// -// SplashFTFont.h -// -//======================================================================== - -#ifndef SPLASHFTFONT_H -#define SPLASHFTFONT_H - -#include - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include -#include FT_FREETYPE_H -#include "SplashFont.h" - -class SplashFTFontFile; - -//------------------------------------------------------------------------ -// SplashFTFont -//------------------------------------------------------------------------ - -class SplashFTFont: public SplashFont { -public: - - SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA); - - virtual ~SplashFTFont(); - - // Munge xFrac and yFrac before calling SplashFont::getGlyph. - virtual GBool getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap); - - // Rasterize a glyph. The and values are the same - // as described for getGlyph. - virtual GBool makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap); - - // Return the path for a glyph. - virtual SplashPath *getGlyphPath(int c); - -private: - - FT_Size sizeObj; - FT_Matrix matrix; -}; - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#endif diff --git a/pdftops/SplashFTFontEngine.cxx b/pdftops/SplashFTFontEngine.cxx deleted file mode 100644 index 8ae3d0aea..000000000 --- a/pdftops/SplashFTFontEngine.cxx +++ /dev/null @@ -1,144 +0,0 @@ -//======================================================================== -// -// SplashFTFontEngine.cc -// -//======================================================================== - -#include - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#ifndef WIN32 -# include -#endif -#include "gmem.h" -#include "GString.h" -#include "gfile.h" -#include "FoFiTrueType.h" -#include "FoFiType1C.h" -#include "SplashFTFontFile.h" -#include "SplashFTFontEngine.h" - -#ifdef VMS -#if (__VMS_VER < 70000000) -extern "C" int unlink(char *filename); -#endif -#endif - -//------------------------------------------------------------------------ - -static void fileWrite(void *stream, char *data, int len) { - fwrite(data, 1, len, (FILE *)stream); -} - -//------------------------------------------------------------------------ -// SplashFTFontEngine -//------------------------------------------------------------------------ - -SplashFTFontEngine::SplashFTFontEngine(GBool aaA, FT_Library libA) { - FT_Int major, minor, patch; - - aa = aaA; - lib = libA; - - // as of FT 2.1.8, CID fonts are indexed by CID instead of GID - FT_Library_Version(lib, &major, &minor, &patch); - useCIDs = major > 2 || - (major == 2 && (minor > 1 || (minor == 1 && patch > 7))); -} - -SplashFTFontEngine *SplashFTFontEngine::init(GBool aaA) { - FT_Library libA; - - if (FT_Init_FreeType(&libA)) { - return NULL; - } - return new SplashFTFontEngine(aaA, libA); -} - -SplashFTFontEngine::~SplashFTFontEngine() { - FT_Done_FreeType(lib); -} - -SplashFontFile *SplashFTFontEngine::loadType1Font(SplashFontFileID *idA, - char *fileName, - GBool deleteFile, - char **enc) { - return SplashFTFontFile::loadType1Font(this, idA, fileName, deleteFile, enc); -} - -SplashFontFile *SplashFTFontEngine::loadType1CFont(SplashFontFileID *idA, - char *fileName, - GBool deleteFile, - char **enc) { - return SplashFTFontFile::loadType1Font(this, idA, fileName, deleteFile, enc); -} - -SplashFontFile *SplashFTFontEngine::loadCIDFont(SplashFontFileID *idA, - char *fileName, - GBool deleteFile) { - FoFiType1C *ff; - Gushort *cidToGIDMap; - int nCIDs; - SplashFontFile *ret; - - // check for a CFF font - if (useCIDs) { - cidToGIDMap = NULL; - nCIDs = 0; - } else if ((ff = FoFiType1C::load(fileName))) { - cidToGIDMap = ff->getCIDToGIDMap(&nCIDs); - delete ff; - } else { - cidToGIDMap = NULL; - nCIDs = 0; - } - ret = SplashFTFontFile::loadCIDFont(this, idA, fileName, deleteFile, - cidToGIDMap, nCIDs); - if (!ret) { - gfree(cidToGIDMap); - } - return ret; -} - -SplashFontFile *SplashFTFontEngine::loadTrueTypeFont(SplashFontFileID *idA, - char *fileName, - GBool deleteFile, - Gushort *codeToGID, - int codeToGIDLen) { - FoFiTrueType *ff; - GString *tmpFileName; - FILE *tmpFile; - SplashFontFile *ret; - - if (!(ff = FoFiTrueType::load(fileName))) { - return NULL; - } - tmpFileName = NULL; - if (!openTempFile(&tmpFileName, &tmpFile, "wb", NULL)) { - delete ff; - return NULL; - } - ff->writeTTF(&fileWrite, tmpFile); - delete ff; - fclose(tmpFile); - ret = SplashFTFontFile::loadTrueTypeFont(this, idA, - tmpFileName->getCString(), - gTrue, codeToGID, codeToGIDLen); - if (ret) { - if (deleteFile) { - unlink(fileName); - } - } else { - unlink(tmpFileName->getCString()); - } - delete tmpFileName; - return ret; -} - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/pdftops/SplashFTFontEngine.h b/pdftops/SplashFTFontEngine.h deleted file mode 100644 index e386478e1..000000000 --- a/pdftops/SplashFTFontEngine.h +++ /dev/null @@ -1,61 +0,0 @@ -//======================================================================== -// -// SplashFTFontEngine.h -// -//======================================================================== - -#ifndef SPLASHFTFONTENGINE_H -#define SPLASHFTFONTENGINE_H - -#include - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include -#include FT_FREETYPE_H -#include "gtypes.h" - -class SplashFontFile; -class SplashFontFileID; - -//------------------------------------------------------------------------ -// SplashFTFontEngine -//------------------------------------------------------------------------ - -class SplashFTFontEngine { -public: - - static SplashFTFontEngine *init(GBool aaA); - - ~SplashFTFontEngine(); - - // Load fonts. - SplashFontFile *loadType1Font(SplashFontFileID *idA, char *fileName, - GBool deleteFile, char **enc); - SplashFontFile *loadType1CFont(SplashFontFileID *idA, char *fileName, - GBool deleteFile, char **enc); - SplashFontFile *loadCIDFont(SplashFontFileID *idA, char *fileName, - GBool deleteFile); - SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, char *fileName, - GBool deleteFile, - Gushort *codeToGID, int codeToGIDLen); - -private: - - SplashFTFontEngine(GBool aaA, FT_Library libA); - - GBool aa; - FT_Library lib; - GBool useCIDs; - - friend class SplashFTFontFile; - friend class SplashFTFont; -}; - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#endif diff --git a/pdftops/SplashFTFontFile.cxx b/pdftops/SplashFTFontFile.cxx deleted file mode 100644 index 73d31555c..000000000 --- a/pdftops/SplashFTFontFile.cxx +++ /dev/null @@ -1,111 +0,0 @@ -//======================================================================== -// -// SplashFTFontFile.cc -// -//======================================================================== - -#include - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include "gmem.h" -#include "SplashFTFontEngine.h" -#include "SplashFTFont.h" -#include "SplashFTFontFile.h" - -//------------------------------------------------------------------------ -// SplashFTFontFile -//------------------------------------------------------------------------ - -SplashFontFile *SplashFTFontFile::loadType1Font(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - char *fileNameA, - GBool deleteFileA, - char **encA) { - FT_Face faceA; - Gushort *codeToGIDA; - char *name; - int i; - - if (FT_New_Face(engineA->lib, fileNameA, 0, &faceA)) { - return NULL; - } - codeToGIDA = (Gushort *)gmallocn(256, sizeof(int)); - for (i = 0; i < 256; ++i) { - codeToGIDA[i] = 0; - if ((name = encA[i])) { - codeToGIDA[i] = (Gushort)FT_Get_Name_Index(faceA, name); - } - } - - return new SplashFTFontFile(engineA, idA, fileNameA, deleteFileA, - faceA, codeToGIDA, 256); -} - -SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - char *fileNameA, - GBool deleteFileA, - Gushort *codeToGIDA, - int codeToGIDLenA) { - FT_Face faceA; - - if (FT_New_Face(engineA->lib, fileNameA, 0, &faceA)) { - return NULL; - } - - return new SplashFTFontFile(engineA, idA, fileNameA, deleteFileA, - faceA, codeToGIDA, codeToGIDLenA); -} - -SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - char *fileNameA, - GBool deleteFileA, - Gushort *codeToGIDA, - int codeToGIDLenA) { - FT_Face faceA; - - if (FT_New_Face(engineA->lib, fileNameA, 0, &faceA)) { - return NULL; - } - - return new SplashFTFontFile(engineA, idA, fileNameA, deleteFileA, - faceA, codeToGIDA, codeToGIDLenA); -} - -SplashFTFontFile::SplashFTFontFile(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - char *fileNameA, GBool deleteFileA, - FT_Face faceA, - Gushort *codeToGIDA, int codeToGIDLenA): - SplashFontFile(idA, fileNameA, deleteFileA) -{ - engine = engineA; - face = faceA; - codeToGID = codeToGIDA; - codeToGIDLen = codeToGIDLenA; -} - -SplashFTFontFile::~SplashFTFontFile() { - if (face) { - FT_Done_Face(face); - } - if (codeToGID) { - gfree(codeToGID); - } -} - -SplashFont *SplashFTFontFile::makeFont(SplashCoord *mat) { - SplashFont *font; - - font = new SplashFTFont(this, mat); - font->initCache(); - return font; -} - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H diff --git a/pdftops/SplashFTFontFile.h b/pdftops/SplashFTFontFile.h deleted file mode 100644 index 3e10543f5..000000000 --- a/pdftops/SplashFTFontFile.h +++ /dev/null @@ -1,70 +0,0 @@ -//======================================================================== -// -// SplashFTFontFile.h -// -//======================================================================== - -#ifndef SPLASHFTFONTFILE_H -#define SPLASHFTFONTFILE_H - -#include - -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include -#include FT_FREETYPE_H -#include "SplashFontFile.h" - -class SplashFontFileID; -class SplashFTFontEngine; - -//------------------------------------------------------------------------ -// SplashFTFontFile -//------------------------------------------------------------------------ - -class SplashFTFontFile: public SplashFontFile { -public: - - static SplashFontFile *loadType1Font(SplashFTFontEngine *engineA, - SplashFontFileID *idA, char *fileNameA, - GBool deleteFileA, char **encA); - static SplashFontFile *loadCIDFont(SplashFTFontEngine *engineA, - SplashFontFileID *idA, char *fileNameA, - GBool deleteFileA, - Gushort *codeToCIDA, int codeToGIDLenA); - static SplashFontFile *loadTrueTypeFont(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - char *fileNameA, - GBool deleteFileA, - Gushort *codeToGIDA, - int codeToGIDLenA); - - virtual ~SplashFTFontFile(); - - // Create a new SplashFTFont, i.e., a scaled instance of this font - // file. - virtual SplashFont *makeFont(SplashCoord *mat); - -private: - - SplashFTFontFile(SplashFTFontEngine *engineA, - SplashFontFileID *idA, - char *fileNameA, GBool deleteFileA, - FT_Face faceA, - Gushort *codeToGIDA, int codeToGIDLenA); - - SplashFTFontEngine *engine; - FT_Face face; - Gushort *codeToGID; - int codeToGIDLen; - - friend class SplashFTFont; -}; - -#endif // HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - -#endif diff --git a/pdftops/SplashFont.cxx b/pdftops/SplashFont.cxx deleted file mode 100644 index db89ad0a6..000000000 --- a/pdftops/SplashFont.cxx +++ /dev/null @@ -1,172 +0,0 @@ -//======================================================================== -// -// SplashFont.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include "gmem.h" -#include "SplashMath.h" -#include "SplashGlyphBitmap.h" -#include "SplashFontFile.h" -#include "SplashFont.h" - -//------------------------------------------------------------------------ - -struct SplashFontCacheTag { - int c; - short xFrac, yFrac; // x and y fractions - int mru; // valid bit (0x80000000) and MRU index - int x, y, w, h; // offset and size of glyph -}; - -//------------------------------------------------------------------------ -// SplashFont -//------------------------------------------------------------------------ - -SplashFont::SplashFont(SplashFontFile *fontFileA, SplashCoord *matA, - GBool aaA) { - fontFile = fontFileA; - fontFile->incRefCnt(); - mat[0] = matA[0]; - mat[1] = matA[1]; - mat[2] = matA[2]; - mat[3] = matA[3]; - aa = aaA; - - cache = NULL; - cacheTags = NULL; - - xMin = yMin = xMax = yMax = 0; -} - -void SplashFont::initCache() { - int i; - - // this should be (max - min + 1), but we add some padding to - // deal with rounding errors - glyphW = xMax - xMin + 3; - glyphH = yMax - yMin + 3; - if (aa) { - glyphSize = glyphW * glyphH; - } else { - glyphSize = ((glyphW + 7) >> 3) * glyphH; - } - - // set up the glyph pixmap cache - cacheAssoc = 8; - if (glyphSize <= 256) { - cacheSets = 8; - } else if (glyphSize <= 512) { - cacheSets = 4; - } else if (glyphSize <= 1024) { - cacheSets = 2; - } else { - cacheSets = 1; - } - cache = (Guchar *)gmallocn(cacheSets* cacheAssoc, glyphSize); - cacheTags = (SplashFontCacheTag *)gmallocn(cacheSets * cacheAssoc, - sizeof(SplashFontCacheTag)); - for (i = 0; i < cacheSets * cacheAssoc; ++i) { - cacheTags[i].mru = i & (cacheAssoc - 1); - } -} - -SplashFont::~SplashFont() { - fontFile->decRefCnt(); - if (cache) { - gfree(cache); - } - if (cacheTags) { - gfree(cacheTags); - } -} - -GBool SplashFont::getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap) { - SplashGlyphBitmap bitmap2; - int size; - Guchar *p; - int i, j, k; - - // no fractional coordinates for large glyphs or non-anti-aliased - // glyphs - if (!aa || glyphH > 50) { - xFrac = yFrac = 0; - } - - // check the cache - i = (c & (cacheSets - 1)) * cacheAssoc; - for (j = 0; j < cacheAssoc; ++j) { - if ((cacheTags[i+j].mru & 0x80000000) && - cacheTags[i+j].c == c && - (int)cacheTags[i+j].xFrac == xFrac && - (int)cacheTags[i+j].yFrac == yFrac) { - bitmap->x = cacheTags[i+j].x; - bitmap->y = cacheTags[i+j].y; - bitmap->w = cacheTags[i+j].w; - bitmap->h = cacheTags[i+j].h; - for (k = 0; k < cacheAssoc; ++k) { - if (k != j && - (cacheTags[i+k].mru & 0x7fffffff) < - (cacheTags[i+j].mru & 0x7fffffff)) { - ++cacheTags[i+k].mru; - } - } - cacheTags[i+j].mru = 0x80000000; - bitmap->aa = aa; - bitmap->data = cache + (i+j) * glyphSize; - bitmap->freeData = gFalse; - return gTrue; - } - } - - // generate the glyph bitmap - if (!makeGlyph(c, xFrac, yFrac, &bitmap2)) { - return gFalse; - } - - // if the glyph doesn't fit in the bounding box, return a temporary - // uncached bitmap - if (bitmap2.w > glyphW || bitmap2.h > glyphH) { - *bitmap = bitmap2; - return gTrue; - } - - // insert glyph pixmap in cache - if (aa) { - size = bitmap2.w * bitmap2.h; - } else { - size = ((bitmap2.w + 7) >> 3) * bitmap2.h; - } - p = NULL; // make gcc happy - for (j = 0; j < cacheAssoc; ++j) { - if ((cacheTags[i+j].mru & 0x7fffffff) == cacheAssoc - 1) { - cacheTags[i+j].mru = 0x80000000; - cacheTags[i+j].c = c; - cacheTags[i+j].xFrac = (short)xFrac; - cacheTags[i+j].yFrac = (short)yFrac; - cacheTags[i+j].x = bitmap2.x; - cacheTags[i+j].y = bitmap2.y; - cacheTags[i+j].w = bitmap2.w; - cacheTags[i+j].h = bitmap2.h; - p = cache + (i+j) * glyphSize; - memcpy(p, bitmap2.data, size); - } else { - ++cacheTags[i+j].mru; - } - } - *bitmap = bitmap2; - bitmap->data = p; - bitmap->freeData = gFalse; - if (bitmap2.freeData) { - gfree(bitmap2.data); - } - return gTrue; -} diff --git a/pdftops/SplashFont.h b/pdftops/SplashFont.h deleted file mode 100644 index a9d2adc29..000000000 --- a/pdftops/SplashFont.h +++ /dev/null @@ -1,97 +0,0 @@ -//======================================================================== -// -// SplashFont.h -// -//======================================================================== - -#ifndef SPLASHFONT_H -#define SPLASHFONT_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "gtypes.h" -#include "SplashTypes.h" - -struct SplashGlyphBitmap; -struct SplashFontCacheTag; -class SplashFontFile; -class SplashPath; - -//------------------------------------------------------------------------ - -// Fractional positioning uses this many bits to the right of the -// decimal points. -#define splashFontFractionBits 2 -#define splashFontFraction (1 << splashFontFractionBits) -#define splashFontFractionMul \ - ((SplashCoord)1 / (SplashCoord)splashFontFraction) - -//------------------------------------------------------------------------ -// SplashFont -//------------------------------------------------------------------------ - -class SplashFont { -public: - - SplashFont(SplashFontFile *fontFileA, SplashCoord *matA, GBool aaA); - - // This must be called after the constructor, so that the subclass - // constructor has a chance to compute the bbox. - void initCache(); - - virtual ~SplashFont(); - - SplashFontFile *getFontFile() { return fontFile; } - - // Return true if matches the specified font file and matrix. - GBool matches(SplashFontFile *fontFileA, SplashCoord *matA) { - return fontFileA == fontFile && - matA[0] == mat[0] && matA[1] == mat[1] && - matA[2] == mat[2] && matA[3] == mat[3]; - } - - // Get a glyph - this does a cache lookup first, and if not found, - // creates a new bitmap and adds it to the cache. The and - // values are splashFontFractionBits bits each, representing - // the numerators of fractions in [0, 1), where the denominator is - // splashFontFraction = 1 << splashFontFractionBits. Subclasses - // should override this to zero out xFrac and/or yFrac if they don't - // support fractional coordinates. - virtual GBool getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap); - - // Rasterize a glyph. The and values are the same - // as described for getGlyph. - virtual GBool makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap) = 0; - - // Return the path for a glyph. - virtual SplashPath *getGlyphPath(int c) = 0; - - // Return the font transform matrix. - SplashCoord *getMatrix() { return mat; } - - // Return the glyph bounding box. - void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA) - { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; } - -protected: - - SplashFontFile *fontFile; - SplashCoord mat[4]; // font transform matrix - GBool aa; // anti-aliasing - int xMin, yMin, xMax, yMax; // glyph bounding box - Guchar *cache; // glyph bitmap cache - SplashFontCacheTag * // cache tags - cacheTags; - int glyphW, glyphH; // size of glyph bitmaps - int glyphSize; // size of glyph bitmaps, in bytes - int cacheSets; // number of sets in cache - int cacheAssoc; // cache associativity (glyphs per set) -}; - -#endif diff --git a/pdftops/SplashFontEngine.cxx b/pdftops/SplashFontEngine.cxx deleted file mode 100644 index 87998487e..000000000 --- a/pdftops/SplashFontEngine.cxx +++ /dev/null @@ -1,253 +0,0 @@ -//======================================================================== -// -// SplashFontEngine.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#if HAVE_T1LIB_H -#include -#endif - -#include -#include -#ifndef WIN32 -# include -#endif -#include "gmem.h" -#include "GString.h" -#include "SplashT1FontEngine.h" -#include "SplashFTFontEngine.h" -#include "SplashFontFile.h" -#include "SplashFontFileID.h" -#include "SplashFont.h" -#include "SplashFontEngine.h" - -#ifdef VMS -#if (__VMS_VER < 70000000) -extern "C" int unlink(char *filename); -#endif -#endif - -//------------------------------------------------------------------------ -// SplashFontEngine -//------------------------------------------------------------------------ - -SplashFontEngine::SplashFontEngine( -#if HAVE_T1LIB_H - GBool enableT1lib, -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - GBool enableFreeType, -#endif - GBool aa) { - int i; - - for (i = 0; i < splashFontCacheSize; ++i) { - fontCache[i] = NULL; - } - -#if HAVE_T1LIB_H - if (enableT1lib) { - t1Engine = SplashT1FontEngine::init(aa); - } else { - t1Engine = NULL; - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (enableFreeType) { - ftEngine = SplashFTFontEngine::init(aa); - } else { - ftEngine = NULL; - } -#endif -} - -SplashFontEngine::~SplashFontEngine() { - int i; - - for (i = 0; i < splashFontCacheSize; ++i) { - if (fontCache[i]) { - delete fontCache[i]; - } - } - -#if HAVE_T1LIB_H - if (t1Engine) { - delete t1Engine; - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (ftEngine) { - delete ftEngine; - } -#endif -} - -SplashFontFile *SplashFontEngine::getFontFile(SplashFontFileID *id) { - SplashFontFile *fontFile; - int i; - - for (i = 0; i < splashFontCacheSize; ++i) { - if (fontCache[i]) { - fontFile = fontCache[i]->getFontFile(); - if (fontFile && fontFile->getID()->matches(id)) { - return fontFile; - } - } - } - return NULL; -} - -SplashFontFile *SplashFontEngine::loadType1Font(SplashFontFileID *idA, - char *fileName, - GBool deleteFile, char **enc) { - SplashFontFile *fontFile; - - fontFile = NULL; -#if HAVE_T1LIB_H - if (!fontFile && t1Engine) { - fontFile = t1Engine->loadType1Font(idA, fileName, deleteFile, enc); - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (!fontFile && ftEngine) { - fontFile = ftEngine->loadType1Font(idA, fileName, deleteFile, enc); - } -#endif - -#ifndef WIN32 - // delete the (temporary) font file -- with Unix hard link - // semantics, this will remove the last link; otherwise it will - // return an error, leaving the file to be deleted later (if - // loadXYZFont failed, the file will always be deleted) - if (deleteFile) { - unlink(fontFile ? fontFile->fileName->getCString() : fileName); - } -#endif - - return fontFile; -} - -SplashFontFile *SplashFontEngine::loadType1CFont(SplashFontFileID *idA, - char *fileName, - GBool deleteFile, - char **enc) { - SplashFontFile *fontFile; - - fontFile = NULL; -#if HAVE_T1LIB_H - if (!fontFile && t1Engine) { - fontFile = t1Engine->loadType1CFont(idA, fileName, deleteFile, enc); - } -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (!fontFile && ftEngine) { - fontFile = ftEngine->loadType1CFont(idA, fileName, deleteFile, enc); - } -#endif - -#ifndef WIN32 - // delete the (temporary) font file -- with Unix hard link - // semantics, this will remove the last link; otherwise it will - // return an error, leaving the file to be deleted later (if - // loadXYZFont failed, the file will always be deleted) - if (deleteFile) { - unlink(fontFile ? fontFile->fileName->getCString() : fileName); - } -#endif - - return fontFile; -} - -SplashFontFile *SplashFontEngine::loadCIDFont(SplashFontFileID *idA, - char *fileName, - GBool deleteFile) { - SplashFontFile *fontFile; - - fontFile = NULL; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (!fontFile && ftEngine) { - fontFile = ftEngine->loadCIDFont(idA, fileName, deleteFile); - } -#endif - -#ifndef WIN32 - // delete the (temporary) font file -- with Unix hard link - // semantics, this will remove the last link; otherwise it will - // return an error, leaving the file to be deleted later (if - // loadXYZFont failed, the file will always be deleted) - if (deleteFile) { - unlink(fontFile ? fontFile->fileName->getCString() : fileName); - } -#endif - - return fontFile; -} - -SplashFontFile *SplashFontEngine::loadTrueTypeFont(SplashFontFileID *idA, - char *fileName, - GBool deleteFile, - Gushort *codeToGID, - int codeToGIDLen) { - SplashFontFile *fontFile; - - fontFile = NULL; -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - if (!fontFile && ftEngine) { - fontFile = ftEngine->loadTrueTypeFont(idA, fileName, deleteFile, - codeToGID, codeToGIDLen); - } -#endif - - if (!fontFile) { - gfree(codeToGID); - } - -#ifndef WIN32 - // delete the (temporary) font file -- with Unix hard link - // semantics, this will remove the last link; otherwise it will - // return an error, leaving the file to be deleted later (if - // loadXYZFont failed, the file will always be deleted) - if (deleteFile) { - unlink(fontFile ? fontFile->fileName->getCString() : fileName); - } -#endif - - return fontFile; -} - -SplashFont *SplashFontEngine::getFont(SplashFontFile *fontFile, - SplashCoord *mat) { - SplashFont *font; - int i, j; - - font = fontCache[0]; - if (font && font->matches(fontFile, mat)) { - return font; - } - for (i = 1; i < splashFontCacheSize; ++i) { - font = fontCache[i]; - if (font && font->matches(fontFile, mat)) { - for (j = i; j > 0; --j) { - fontCache[j] = fontCache[j-1]; - } - fontCache[0] = font; - return font; - } - } - font = fontFile->makeFont(mat); - if (fontCache[splashFontCacheSize - 1]) { - delete fontCache[splashFontCacheSize - 1]; - } - for (j = splashFontCacheSize - 1; j > 0; --j) { - fontCache[j] = fontCache[j-1]; - } - fontCache[0] = font; - return font; -} diff --git a/pdftops/SplashFontEngine.h b/pdftops/SplashFontEngine.h deleted file mode 100644 index 4c061eb82..000000000 --- a/pdftops/SplashFontEngine.h +++ /dev/null @@ -1,86 +0,0 @@ -//======================================================================== -// -// SplashFontEngine.h -// -//======================================================================== - -#ifndef SPLASHFONTENGINE_H -#define SPLASHFONTENGINE_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "gtypes.h" - -class SplashT1FontEngine; -class SplashFTFontEngine; -class SplashDTFontEngine; -class SplashDT4FontEngine; -class SplashFontFile; -class SplashFontFileID; -class SplashFont; - -//------------------------------------------------------------------------ - -#define splashFontCacheSize 16 - -//------------------------------------------------------------------------ -// SplashFontEngine -//------------------------------------------------------------------------ - -class SplashFontEngine { -public: - - // Create a font engine. - SplashFontEngine( -#if HAVE_T1LIB_H - GBool enableT1lib, -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - GBool enableFreeType, -#endif - GBool aa); - - ~SplashFontEngine(); - - // Get a font file from the cache. Returns NULL if there is no - // matching entry in the cache. - SplashFontFile *getFontFile(SplashFontFileID *id); - - // Load fonts - these create new SplashFontFile objects. - SplashFontFile *loadType1Font(SplashFontFileID *idA, char *fileName, - GBool deleteFile, char **enc); - SplashFontFile *loadType1CFont(SplashFontFileID *idA, char *fileName, - GBool deleteFile, char **enc); - SplashFontFile *loadCIDFont(SplashFontFileID *idA, char *fileName, - GBool deleteFile); - SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, char *fileName, - GBool deleteFile, - Gushort *codeToGID, int codeToGIDLen); - - // Get a font - this does a cache lookup first, and if not found, - // creates a new SplashFont object and adds it to the cache. The - // matrix: - // [ mat[0] mat[1] ] - // [ mat[2] mat[3] ] - // specifies the font transform in PostScript style: - // [x' y'] = [x y] * mat - // Note that the Splash y axis points downward. - SplashFont *getFont(SplashFontFile *fontFile, SplashCoord *mat); - -private: - - SplashFont *fontCache[splashFontCacheSize]; - -#if HAVE_T1LIB_H - SplashT1FontEngine *t1Engine; -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - SplashFTFontEngine *ftEngine; -#endif -}; - -#endif diff --git a/pdftops/SplashFontFile.cxx b/pdftops/SplashFontFile.cxx deleted file mode 100644 index a06cfc851..000000000 --- a/pdftops/SplashFontFile.cxx +++ /dev/null @@ -1,55 +0,0 @@ -//======================================================================== -// -// SplashFontFile.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#ifndef WIN32 -# include -#endif -#include "GString.h" -#include "SplashFontFile.h" -#include "SplashFontFileID.h" - -#ifdef VMS -#if (__VMS_VER < 70000000) -extern "C" int unlink(char *filename); -#endif -#endif - -//------------------------------------------------------------------------ -// SplashFontFile -//------------------------------------------------------------------------ - -SplashFontFile::SplashFontFile(SplashFontFileID *idA, char *fileNameA, - GBool deleteFileA) { - id = idA; - fileName = new GString(fileNameA); - deleteFile = deleteFileA; - refCnt = 0; -} - -SplashFontFile::~SplashFontFile() { - if (deleteFile) { - unlink(fileName->getCString()); - } - delete fileName; - delete id; -} - -void SplashFontFile::incRefCnt() { - ++refCnt; -} - -void SplashFontFile::decRefCnt() { - if (!--refCnt) { - delete this; - } -} diff --git a/pdftops/SplashFontFile.h b/pdftops/SplashFontFile.h deleted file mode 100644 index 0d6b3a2fa..000000000 --- a/pdftops/SplashFontFile.h +++ /dev/null @@ -1,60 +0,0 @@ -//======================================================================== -// -// SplashFontFile.h -// -//======================================================================== - -#ifndef SPLASHFONTFILE_H -#define SPLASHFONTFILE_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "gtypes.h" -#include "SplashTypes.h" - -class GString; -class SplashFontEngine; -class SplashFont; -class SplashFontFileID; - -//------------------------------------------------------------------------ -// SplashFontFile -//------------------------------------------------------------------------ - -class SplashFontFile { -public: - - virtual ~SplashFontFile(); - - // Create a new SplashFont, i.e., a scaled instance of this font - // file. - virtual SplashFont *makeFont(SplashCoord *mat) = 0; - - // Get the font file ID. - SplashFontFileID *getID() { return id; } - - // Increment the reference count. - void incRefCnt(); - - // Decrement the reference count. If the new value is zero, delete - // the SplashFontFile object. - void decRefCnt(); - -protected: - - SplashFontFile(SplashFontFileID *idA, char *fileNameA, - GBool deleteFileA); - - SplashFontFileID *id; - GString *fileName; - GBool deleteFile; - int refCnt; - - friend class SplashFontEngine; -}; - -#endif diff --git a/pdftops/SplashFontFileID.cxx b/pdftops/SplashFontFileID.cxx deleted file mode 100644 index a66dabf61..000000000 --- a/pdftops/SplashFontFileID.cxx +++ /dev/null @@ -1,23 +0,0 @@ -//======================================================================== -// -// SplashFontFileID.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include "SplashFontFileID.h" - -//------------------------------------------------------------------------ -// SplashFontFileID -//------------------------------------------------------------------------ - -SplashFontFileID::SplashFontFileID() { -} - -SplashFontFileID::~SplashFontFileID() { -} diff --git a/pdftops/SplashFontFileID.h b/pdftops/SplashFontFileID.h deleted file mode 100644 index e69457da5..000000000 --- a/pdftops/SplashFontFileID.h +++ /dev/null @@ -1,30 +0,0 @@ -//======================================================================== -// -// SplashFontFileID.h -// -//======================================================================== - -#ifndef SPLASHFONTFILEID_H -#define SPLASHFONTFILEID_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "gtypes.h" - -//------------------------------------------------------------------------ -// SplashFontFileID -//------------------------------------------------------------------------ - -class SplashFontFileID { -public: - - SplashFontFileID(); - virtual ~SplashFontFileID(); - virtual GBool matches(SplashFontFileID *id) = 0; -}; - -#endif diff --git a/pdftops/SplashGlyphBitmap.h b/pdftops/SplashGlyphBitmap.h deleted file mode 100644 index 379d0aab7..000000000 --- a/pdftops/SplashGlyphBitmap.h +++ /dev/null @@ -1,26 +0,0 @@ -//======================================================================== -// -// SplashGlyphBitmap.h -// -//======================================================================== - -#ifndef SPLASHGLYPHBITMAP_H -#define SPLASHGLYPHBITMAP_H - -#include - -#include "gtypes.h" - -//------------------------------------------------------------------------ -// SplashGlyphBitmap -//------------------------------------------------------------------------ - -struct SplashGlyphBitmap { - int x, y, w, h; // offset and size of glyph - GBool aa; // anti-aliased: true means 8-bit alpha - // bitmap; false means 1-bit - Guchar *data; // bitmap data - GBool freeData; // true if data memory should be freed -}; - -#endif diff --git a/pdftops/SplashMath.h b/pdftops/SplashMath.h deleted file mode 100644 index e280e41e3..000000000 --- a/pdftops/SplashMath.h +++ /dev/null @@ -1,78 +0,0 @@ -//======================================================================== -// -// SplashMath.h -// -//======================================================================== - -#ifndef SPLASHMATH_H -#define SPLASHMATH_H - -#include -#if USE_FIXEDPONT -#include "FixedPoint.h" -#else -#include -#endif -#include "SplashTypes.h" - -static inline SplashCoord splashAbs(SplashCoord x) { -#if USE_FIXEDPOINT - return FixedPoint::abs(x); -#else - return fabs(x); -#endif -} - -static inline int splashFloor(SplashCoord x) { -#if USE_FIXEDPOINT - return FixedPoint::floor(x); -#else - return (int)floor(x); -#endif -} - -static inline int splashCeil(SplashCoord x) { -#if USE_FIXEDPOINT - return FixedPoint::ceil(x); -#else - return (int)ceil(x); -#endif -} - -static inline int splashRound(SplashCoord x) { -#if USE_FIXEDPOINT - return FixedPoint::round(x); -#else - return (int)floor(x + 0.5); -#endif -} - -static inline SplashCoord splashSqrt(SplashCoord x) { -#if USE_FIXEDPOINT - return FixedPoint::sqrt(x); -#else - return sqrt(x); -#endif -} - -static inline SplashCoord splashPow(SplashCoord x, SplashCoord y) { -#if USE_FIXEDPOINT - return FixedPoint::pow(x, y); -#else - return pow(x, y); -#endif -} - -static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1) { - SplashCoord dx, dy; - dx = x1 - x0; - dy = y1 - y0; -#if USE_FIXEDPOINT - return FixedPoint::sqrt(dx * dx + dy * dy); -#else - return sqrt(dx * dx + dy * dy); -#endif -} - -#endif diff --git a/pdftops/SplashOutputDev.cxx b/pdftops/SplashOutputDev.cxx deleted file mode 100644 index 4f0bba580..000000000 --- a/pdftops/SplashOutputDev.cxx +++ /dev/null @@ -1,2640 +0,0 @@ -//======================================================================== -// -// SplashOutputDev.cc -// -// Copyright 2003 Glyph & Cog, LLC -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include -#include "gfile.h" -#include "GlobalParams.h" -#include "Error.h" -#include "Object.h" -#include "GfxFont.h" -#include "Link.h" -#include "CharCodeToUnicode.h" -#include "FontEncodingTables.h" -#include "FoFiTrueType.h" -#include "SplashBitmap.h" -#include "SplashGlyphBitmap.h" -#include "SplashPattern.h" -#include "SplashScreen.h" -#include "SplashPath.h" -#include "SplashState.h" -#include "SplashErrorCodes.h" -#include "SplashFontEngine.h" -#include "SplashFont.h" -#include "SplashFontFile.h" -#include "SplashFontFileID.h" -#include "Splash.h" -#include "SplashOutputDev.h" - -//------------------------------------------------------------------------ -// Blend functions -//------------------------------------------------------------------------ - -static void splashOutBlendMultiply(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i; - - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - // note: floor(x / 255) = x >> 8 (for 16-bit x) - blend[i] = (dest[i] * src[i]) >> 8; - } -} - -static void splashOutBlendScreen(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i; - - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - // note: floor(x / 255) = x >> 8 (for 16-bit x) - blend[i] = dest[i] + src[i] - ((dest[i] * src[i]) >> 8); - } -} - -static void splashOutBlendOverlay(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i; - - //~ not sure if this is right - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - // note: floor(x / 255) = x >> 8 (for 16-bit x) - blend[i] = dest[i] < 0x80 ? ((dest[i] * src[i]) >> 8) - : dest[i] + src[i] - ((dest[i] * src[i]) >> 8); - } -} - -static void splashOutBlendDarken(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i; - - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - blend[i] = dest[i] < src[i] ? dest[i] : src[i]; - } -} - -static void splashOutBlendLighten(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i; - - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - blend[i] = dest[i] > src[i] ? dest[i] : src[i]; - } -} - -static void splashOutBlendColorDodge(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, - SplashColorMode cm) { - int i, x; - - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - x = dest[i] + src[i]; - blend[i] = x <= 255 ? x : 255; - } -} - -static void splashOutBlendColorBurn(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i, x; - - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - x = dest[i] - (255 - src[i]); - blend[i] = x >= 0 ? x : 0; - } -} - -static void splashOutBlendHardLight(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i; - - //~ not sure if this is right - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - // note: floor(x / 255) = x >> 8 (for 16-bit x) - blend[i] = src[i] < 0x80 - ? ((dest[i] * (src[i] * 2)) >> 8) - : 0xff - (((0xff - dest[i]) * (0x1ff - src[i] * 2)) >> 8); - } -} - -static void splashOutBlendSoftLight(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i, x; - - //~ not sure if this is right - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - if (src[i] < 0x80) { - x = dest[i] - (0x80 - src[i]); - blend[i] = x >= 0 ? x : 0; - } else { - x = dest[i] + (src[i] - 0x80); - blend[i] = x <= 255 ? x : 255; - } - } -} - -static void splashOutBlendDifference(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, - SplashColorMode cm) { - int i; - - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - blend[i] = dest[i] < src[i] ? src[i] - dest[i] : dest[i] - src[i]; - } -} - -static void splashOutBlendExclusion(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int i; - - //~ not sure what this is supposed to do - for (i = 0; i < splashColorModeNComps[cm]; ++i) { - blend[i] = dest[i] < src[i] ? src[i] - dest[i] : dest[i] - src[i]; - } -} - -static void cvtRGBToHSV(Guchar r, Guchar g, Guchar b, int *h, int *s, int *v) { - int cmax, cmid, cmin, x; - - if (r >= g) { - if (g >= b) { x = 0; cmax = r; cmid = g; cmin = b; } - else if (b >= r) { x = 4; cmax = b; cmid = r; cmin = g; } - else { x = 5; cmax = r; cmid = b; cmin = g; } - } else { - if (r >= b) { x = 1; cmax = g; cmid = r; cmin = b; } - else if (g >= b) { x = 2; cmax = g; cmid = b; cmin = r; } - else { x = 3; cmax = b; cmid = g; cmin = r; } - } - if (cmax == cmin) { - *h = *s = 0; - } else { - *h = x * 60; - if (x & 1) { - *h += ((cmax - cmid) * 60) / (cmax - cmin); - } else { - *h += ((cmid - cmin) * 60) / (cmax - cmin); - } - *s = (255 * (cmax - cmin)) / cmax; - } - *v = cmax; -} - -static void cvtHSVToRGB(int h, int s, int v, Guchar *r, Guchar *g, Guchar *b) { - int x, f, cmax, cmid, cmin; - - if (s == 0) { - *r = *g = *b = v; - } else { - x = h / 60; - f = h % 60; - cmax = v; - if (x & 1) { - cmid = (v * 255 - ((s * f) / 60)) >> 8; - } else { - cmid = (v * (255 - ((s * (60 - f)) / 60))) >> 8; - } - // note: floor(x / 255) = x >> 8 (for 16-bit x) - cmin = (v * (255 - s)) >> 8; - switch (x) { - case 0: *r = cmax; *g = cmid; *b = cmin; break; - case 1: *g = cmax; *r = cmid; *b = cmin; break; - case 2: *g = cmax; *b = cmid; *r = cmin; break; - case 3: *b = cmax; *g = cmid; *r = cmin; break; - case 4: *b = cmax; *r = cmid; *g = cmin; break; - case 5: *r = cmax; *b = cmid; *g = cmin; break; - } - } -} - -static void splashOutBlendHue(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int hs, ss, vs, hd, sd, vd; -#if SPLASH_CMYK - Guchar r, g, b; -#endif - - switch (cm) { - case splashModeMono1: - case splashModeMono8: - blend[0] = dest[0]; - break; - case splashModeRGB8: - cvtRGBToHSV(src[0], src[1], src[2], &hs, &ss, &vs); - cvtRGBToHSV(dest[0], dest[1], dest[2], &hd, &sd, &vd); - cvtHSVToRGB(hs, sd, vd, &blend[0], &blend[1], &blend[2]); - break; - case splashModeBGR8: - cvtRGBToHSV(src[2], src[1], src[0], &hs, &ss, &vs); - cvtRGBToHSV(dest[2], dest[1], dest[0], &hd, &sd, &vd); - cvtHSVToRGB(hs, sd, vd, &blend[2], &blend[1], &blend[0]); - break; -#if SPLASH_CMYK - case splashModeCMYK8: - //~ (0xff - ...) should be clipped - cvtRGBToHSV(0xff - (src[0] + src[3]), - 0xff - (src[1] + src[3]), - 0xff - (src[2] + src[3]), &hs, &ss, &vs); - cvtRGBToHSV(0xff - (dest[0] + dest[3]), - 0xff - (dest[1] + dest[3]), - 0xff - (dest[2] + dest[3]), &hd, &sd, &vd); - cvtHSVToRGB(hs, sd, vd, &r, &g, &b); - //~ should do black generation - blend[0] = 0xff - r; - blend[0] = 0xff - g; - blend[0] = 0xff - b; - blend[3] = 0; - break; -#endif - default: - //~ unimplemented - break; - } -} - -static void splashOutBlendSaturation(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, - SplashColorMode cm) { - int hs, ss, vs, hd, sd, vd; -#if SPLASH_CMYK - Guchar r, g, b; -#endif - - switch (cm) { - case splashModeMono1: - case splashModeMono8: - blend[0] = dest[0]; - break; - case splashModeRGB8: - cvtRGBToHSV(src[0], src[1], src[2], &hs, &ss, &vs); - cvtRGBToHSV(dest[0], dest[1], dest[2], &hd, &sd, &vd); - cvtHSVToRGB(hd, ss, vd, &blend[0], &blend[1], &blend[2]); - break; - case splashModeBGR8: - cvtRGBToHSV(src[2], src[1], src[0], &hs, &ss, &vs); - cvtRGBToHSV(dest[2], dest[1], dest[0], &hd, &sd, &vd); - cvtHSVToRGB(hd, ss, vd, &blend[2], &blend[1], &blend[0]); - break; -#if SPLASH_CMYK - case splashModeCMYK8: - //~ (0xff - ...) should be clipped - cvtRGBToHSV(0xff - (src[0] + src[3]), - 0xff - (src[1] + src[3]), - 0xff - (src[2] + src[3]), &hs, &ss, &vs); - cvtRGBToHSV(0xff - (dest[0] + dest[3]), - 0xff - (dest[1] + dest[3]), - 0xff - (dest[2] + dest[3]), &hd, &sd, &vd); - cvtHSVToRGB(hd, ss, vd, &r, &g, &b); - //~ should do black generation - blend[0] = 0xff - r; - blend[0] = 0xff - g; - blend[0] = 0xff - b; - blend[3] = 0; - break; -#endif - default: - //~ unimplemented - break; - } -} - -static void splashOutBlendColor(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm) { - int hs, ss, vs, hd, sd, vd; -#if SPLASH_CMYK - Guchar r, g, b; -#endif - - switch (cm) { - case splashModeMono1: - case splashModeMono8: - blend[0] = dest[0]; - break; - case splashModeRGB8: - cvtRGBToHSV(src[0], src[1], src[2], &hs, &ss, &vs); - cvtRGBToHSV(dest[0], dest[1], dest[2], &hd, &sd, &vd); - cvtHSVToRGB(hs, ss, vd, &blend[0], &blend[1], &blend[2]); - break; - case splashModeBGR8: - cvtRGBToHSV(src[2], src[1], src[0], &hs, &ss, &vs); - cvtRGBToHSV(dest[2], dest[1], dest[0], &hd, &sd, &vd); - cvtHSVToRGB(hs, ss, vd, &blend[2], &blend[1], &blend[0]); - break; -#if SPLASH_CMYK - case splashModeCMYK8: - //~ (0xff - ...) should be clipped - cvtRGBToHSV(0xff - (src[0] + src[3]), - 0xff - (src[1] + src[3]), - 0xff - (src[2] + src[3]), &hs, &ss, &vs); - cvtRGBToHSV(0xff - (dest[0] + dest[3]), - 0xff - (dest[1] + dest[3]), - 0xff - (dest[2] + dest[3]), &hd, &sd, &vd); - cvtHSVToRGB(hs, ss, vd, &r, &g, &b); - //~ should do black generation - blend[0] = 0xff - r; - blend[0] = 0xff - g; - blend[0] = 0xff - b; - blend[3] = 0; - break; -#endif - default: - //~ unimplemented - break; - } -} - -static void splashOutBlendLuminosity(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, - SplashColorMode cm) { - int hs, ss, vs, hd, sd, vd; -#if SPLASH_CMYK - Guchar r, g, b; -#endif - - switch (cm) { - case splashModeMono1: - case splashModeMono8: - blend[0] = dest[0]; - break; - case splashModeRGB8: - cvtRGBToHSV(src[0], src[1], src[2], &hs, &ss, &vs); - cvtRGBToHSV(dest[0], dest[1], dest[2], &hd, &sd, &vd); - cvtHSVToRGB(hd, sd, vs, &blend[0], &blend[1], &blend[2]); - break; - case splashModeBGR8: - cvtRGBToHSV(src[2], src[1], src[0], &hs, &ss, &vs); - cvtRGBToHSV(dest[2], dest[1], dest[0], &hd, &sd, &vd); - cvtHSVToRGB(hd, sd, vs, &blend[2], &blend[1], &blend[0]); - break; -#if SPLASH_CMYK - case splashModeCMYK8: - //~ (0xff - ...) should be clipped - cvtRGBToHSV(0xff - (src[0] + src[3]), - 0xff - (src[1] + src[3]), - 0xff - (src[2] + src[3]), &hs, &ss, &vs); - cvtRGBToHSV(0xff - (dest[0] + dest[3]), - 0xff - (dest[1] + dest[3]), - 0xff - (dest[2] + dest[3]), &hd, &sd, &vd); - cvtHSVToRGB(hd, sd, vs, &r, &g, &b); - //~ should do black generation - blend[0] = 0xff - r; - blend[0] = 0xff - g; - blend[0] = 0xff - b; - blend[3] = 0; - break; -#endif - default: - //~ unimplemented - break; - } -} - -// NB: This must match the GfxBlendMode enum defined in GfxState.h. -SplashBlendFunc splashOutBlendFuncs[] = { - NULL, - &splashOutBlendMultiply, - &splashOutBlendScreen, - &splashOutBlendOverlay, - &splashOutBlendDarken, - &splashOutBlendLighten, - &splashOutBlendColorDodge, - &splashOutBlendColorBurn, - &splashOutBlendHardLight, - &splashOutBlendSoftLight, - &splashOutBlendDifference, - &splashOutBlendExclusion, - &splashOutBlendHue, - &splashOutBlendSaturation, - &splashOutBlendColor, - &splashOutBlendLuminosity -}; - -//------------------------------------------------------------------------ -// Font substitutions -//------------------------------------------------------------------------ - -struct SplashOutFontSubst { - char *name; - double mWidth; -}; - -// index: {symbolic:12, fixed:8, serif:4, sans-serif:0} + bold*2 + italic -static SplashOutFontSubst splashOutSubstFonts[16] = { - {"Helvetica", 0.833}, - {"Helvetica-Oblique", 0.833}, - {"Helvetica-Bold", 0.889}, - {"Helvetica-BoldOblique", 0.889}, - {"Times-Roman", 0.788}, - {"Times-Italic", 0.722}, - {"Times-Bold", 0.833}, - {"Times-BoldItalic", 0.778}, - {"Courier", 0.600}, - {"Courier-Oblique", 0.600}, - {"Courier-Bold", 0.600}, - {"Courier-BoldOblique", 0.600}, - {"Symbol", 0.576}, - {"Symbol", 0.576}, - {"Symbol", 0.576}, - {"Symbol", 0.576} -}; - -//------------------------------------------------------------------------ -// SplashOutFontFileID -//------------------------------------------------------------------------ - -class SplashOutFontFileID: public SplashFontFileID { -public: - - SplashOutFontFileID(Ref *rA) { r = *rA; substIdx = -1; } - - ~SplashOutFontFileID() {} - - GBool matches(SplashFontFileID *id) { - return ((SplashOutFontFileID *)id)->r.num == r.num && - ((SplashOutFontFileID *)id)->r.gen == r.gen; - } - - void setSubstIdx(int substIdxA) { substIdx = substIdxA; } - int getSubstIdx() { return substIdx; } - -private: - - Ref r; - int substIdx; -}; - -//------------------------------------------------------------------------ -// T3FontCache -//------------------------------------------------------------------------ - -struct T3FontCacheTag { - Gushort code; - Gushort mru; // valid bit (0x8000) and MRU index -}; - -class T3FontCache { -public: - - T3FontCache(Ref *fontID, double m11A, double m12A, - double m21A, double m22A, - int glyphXA, int glyphYA, int glyphWA, int glyphHA, - GBool aa); - ~T3FontCache(); - GBool matches(Ref *idA, double m11A, double m12A, - double m21A, double m22A) - { return fontID.num == idA->num && fontID.gen == idA->gen && - m11 == m11A && m12 == m12A && m21 == m21A && m22 == m22A; } - - Ref fontID; // PDF font ID - double m11, m12, m21, m22; // transform matrix - int glyphX, glyphY; // pixel offset of glyph bitmaps - int glyphW, glyphH; // size of glyph bitmaps, in pixels - int glyphSize; // size of glyph bitmaps, in bytes - int cacheSets; // number of sets in cache - int cacheAssoc; // cache associativity (glyphs per set) - Guchar *cacheData; // glyph pixmap cache - T3FontCacheTag *cacheTags; // cache tags, i.e., char codes -}; - -T3FontCache::T3FontCache(Ref *fontIDA, double m11A, double m12A, - double m21A, double m22A, - int glyphXA, int glyphYA, int glyphWA, int glyphHA, - GBool aa) { - int i; - - fontID = *fontIDA; - m11 = m11A; - m12 = m12A; - m21 = m21A; - m22 = m22A; - glyphX = glyphXA; - glyphY = glyphYA; - glyphW = glyphWA; - glyphH = glyphHA; - if (aa) { - glyphSize = glyphW * glyphH; - } else { - glyphSize = ((glyphW + 7) >> 3) * glyphH; - } - cacheAssoc = 8; - if (glyphSize <= 256) { - cacheSets = 8; - } else if (glyphSize <= 512) { - cacheSets = 4; - } else if (glyphSize <= 1024) { - cacheSets = 2; - } else { - cacheSets = 1; - } - cacheData = (Guchar *)gmallocn(cacheSets * cacheAssoc, glyphSize); - cacheTags = (T3FontCacheTag *)gmallocn(cacheSets * cacheAssoc, - sizeof(T3FontCacheTag)); - for (i = 0; i < cacheSets * cacheAssoc; ++i) { - cacheTags[i].mru = i & (cacheAssoc - 1); - } -} - -T3FontCache::~T3FontCache() { - gfree(cacheData); - gfree(cacheTags); -} - -struct T3GlyphStack { - Gushort code; // character code - double x, y; // position to draw the glyph - - //----- cache info - T3FontCache *cache; // font cache for the current font - T3FontCacheTag *cacheTag; // pointer to cache tag for the glyph - Guchar *cacheData; // pointer to cache data for the glyph - - //----- saved state - SplashBitmap *origBitmap; - Splash *origSplash; - double origCTM4, origCTM5; - - T3GlyphStack *next; // next object on stack -}; - -//------------------------------------------------------------------------ -// SplashOutputDev -//------------------------------------------------------------------------ - -SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, - int bitmapRowPadA, - GBool reverseVideoA, - SplashColorPtr paperColorA, - GBool bitmapTopDownA, - GBool allowAntialiasA) { - colorMode = colorModeA; - bitmapRowPad = bitmapRowPadA; - bitmapTopDown = bitmapTopDownA; - allowAntialias = allowAntialiasA; - reverseVideo = reverseVideoA; - splashColorCopy(paperColor, paperColorA); - - xref = NULL; - - bitmap = new SplashBitmap(1, 1, bitmapRowPad, colorMode, bitmapTopDown); - splash = new Splash(bitmap); - splash->clear(paperColor); - - fontEngine = NULL; - - nT3Fonts = 0; - t3GlyphStack = NULL; - - font = NULL; - needFontUpdate = gFalse; - textClipPath = NULL; -} - -SplashOutputDev::~SplashOutputDev() { - int i; - - for (i = 0; i < nT3Fonts; ++i) { - delete t3FontCache[i]; - } - if (fontEngine) { - delete fontEngine; - } - if (splash) { - delete splash; - } - if (bitmap) { - delete bitmap; - } -} - -void SplashOutputDev::startDoc(XRef *xrefA) { - int i; - - xref = xrefA; - if (fontEngine) { - delete fontEngine; - } - fontEngine = new SplashFontEngine( -#if HAVE_T1LIB_H - globalParams->getEnableT1lib(), -#endif -#if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H - globalParams->getEnableFreeType(), -#endif - allowAntialias && - globalParams->getAntialias() && - colorMode != splashModeMono1); - for (i = 0; i < nT3Fonts; ++i) { - delete t3FontCache[i]; - } - nT3Fonts = 0; -} - -GBool SplashOutputDev::startPage(int pageNum, GfxState *state) { - int w, h; - SplashColor color; - - w = state ? (int)(state->getPageWidth() + 0.5) : 1; - h = state ? (int)(state->getPageHeight() + 0.5) : 1; - if (splash) { - delete splash; - } - if (!bitmap || w != bitmap->getWidth() || h != bitmap->getHeight()) { - if (bitmap) { - delete bitmap; - } - bitmap = new SplashBitmap(w, h, bitmapRowPad, colorMode, bitmapTopDown); - } - splash = new Splash(bitmap); - switch (colorMode) { - case splashModeMono1: - case splashModeMono8: - color[0] = 0; - break; - case splashModeRGB8: - case splashModeBGR8: - color[0] = color[1] = color[2] = 0; - break; - case splashModeAMono8: - color[0] = 0xff; - color[1] = 0; - break; - case splashModeARGB8: - color[0] = 255; - color[1] = color[2] = color[3] = 0; - break; - case splashModeBGRA8: - color[0] = color[1] = color[2] = 0; - color[3] = 255; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - color[0] = color[1] = color[2] = color[3] = 0; - break; - case splashModeACMYK8: - color[0] = 255; - color[1] = color[2] = color[3] = color[4] = 0; - break; -#endif - } - splash->setStrokePattern(new SplashSolidColor(color)); - splash->setFillPattern(new SplashSolidColor(color)); - splash->setLineCap(splashLineCapButt); - splash->setLineJoin(splashLineJoinMiter); - splash->setLineDash(NULL, 0, 0); - splash->setMiterLimit(10); - splash->setFlatness(1); - splash->clear(paperColor); - - return (gTrue); -} - -void SplashOutputDev::endPage() { -} - -void SplashOutputDev::drawLink(Link *link, Catalog *catalog) { - double x1, y1, x2, y2; - LinkBorderStyle *borderStyle; - double r, g, b; - GfxRGB rgb; - GfxGray gray; -#if SPLASH_CMYK - GfxCMYK cmyk; -#endif - double *dash; - int dashLength; - SplashCoord dashList[20]; - SplashPath *path; - int x, y, i; - - link->getRect(&x1, &y1, &x2, &y2); - borderStyle = link->getBorderStyle(); - if (borderStyle->getWidth() > 0) { - borderStyle->getColor(&r, &g, &b); - rgb.r = dblToCol(r); - rgb.g = dblToCol(g); - rgb.b = dblToCol(b); - gray = dblToCol(0.299 * r + 0.587 * g + 0.114 * b); - if (gray > gfxColorComp1) { - gray = gfxColorComp1; - } -#if SPLASH_CMYK - cmyk.c = gfxColorComp1 - rgb.r; - cmyk.m = gfxColorComp1 - rgb.g; - cmyk.y = gfxColorComp1 - rgb.b; - cmyk.k = 0; - splash->setStrokePattern(getColor(gray, &rgb, &cmyk)); -#else - splash->setStrokePattern(getColor(gray, &rgb)); -#endif - splash->setLineWidth((SplashCoord)borderStyle->getWidth()); - borderStyle->getDash(&dash, &dashLength); - if (borderStyle->getType() == linkBorderDashed && dashLength > 0) { - if (dashLength > 20) { - dashLength = 20; - } - for (i = 0; i < dashLength; ++i) { - dashList[i] = (SplashCoord)dash[i]; - } - splash->setLineDash(dashList, dashLength, 0); - } - path = new SplashPath(); - if (borderStyle->getType() == linkBorderUnderlined) { - cvtUserToDev(x1, y1, &x, &y); - path->moveTo((SplashCoord)x, (SplashCoord)y); - cvtUserToDev(x2, y1, &x, &y); - path->lineTo((SplashCoord)x, (SplashCoord)y); - } else { - cvtUserToDev(x1, y1, &x, &y); - path->moveTo((SplashCoord)x, (SplashCoord)y); - cvtUserToDev(x2, y1, &x, &y); - path->lineTo((SplashCoord)x, (SplashCoord)y); - cvtUserToDev(x2, y2, &x, &y); - path->lineTo((SplashCoord)x, (SplashCoord)y); - cvtUserToDev(x1, y2, &x, &y); - path->lineTo((SplashCoord)x, (SplashCoord)y); - path->close(); - } - splash->stroke(path); - delete path; - } -} - -void SplashOutputDev::saveState(GfxState *state) { - splash->saveState(); -} - -void SplashOutputDev::restoreState(GfxState *state) { - splash->restoreState(); - needFontUpdate = gTrue; -} - -void SplashOutputDev::updateAll(GfxState *state) { - updateLineDash(state); - updateLineJoin(state); - updateLineCap(state); - updateLineWidth(state); - updateFlatness(state); - updateMiterLimit(state); - updateFillColor(state); - updateStrokeColor(state); - needFontUpdate = gTrue; -} - -void SplashOutputDev::updateCTM(GfxState *state, double m11, double m12, - double m21, double m22, - double m31, double m32) { - updateLineDash(state); - updateLineJoin(state); - updateLineCap(state); - updateLineWidth(state); -} - -void SplashOutputDev::updateLineDash(GfxState *state) { - double *dashPattern; - int dashLength; - double dashStart; - SplashCoord dash[20]; - SplashCoord phase; - int i; - - state->getLineDash(&dashPattern, &dashLength, &dashStart); - if (dashLength > 20) { - dashLength = 20; - } - for (i = 0; i < dashLength; ++i) { - dash[i] = (SplashCoord)state->transformWidth(dashPattern[i]); - if (dash[i] < 1) { - dash[i] = 1; - } - } - phase = (SplashCoord)state->transformWidth(dashStart); - splash->setLineDash(dash, dashLength, phase); -} - -void SplashOutputDev::updateFlatness(GfxState *state) { - splash->setFlatness(state->getFlatness()); -} - -void SplashOutputDev::updateLineJoin(GfxState *state) { - splash->setLineJoin(state->getLineJoin()); -} - -void SplashOutputDev::updateLineCap(GfxState *state) { - splash->setLineCap(state->getLineCap()); -} - -void SplashOutputDev::updateMiterLimit(GfxState *state) { - splash->setMiterLimit(state->getMiterLimit()); -} - -void SplashOutputDev::updateLineWidth(GfxState *state) { - splash->setLineWidth(state->getTransformedLineWidth()); -} - -void SplashOutputDev::updateFillColor(GfxState *state) { - GfxGray gray; - GfxRGB rgb; -#if SPLASH_CMYK - GfxCMYK cmyk; -#endif - - state->getFillGray(&gray); - state->getFillRGB(&rgb); -#if SPLASH_CMYK - state->getFillCMYK(&cmyk); - splash->setFillPattern(getColor(gray, &rgb, &cmyk)); -#else - splash->setFillPattern(getColor(gray, &rgb)); -#endif -} - -void SplashOutputDev::updateStrokeColor(GfxState *state) { - GfxGray gray; - GfxRGB rgb; -#if SPLASH_CMYK - GfxCMYK cmyk; -#endif - - state->getStrokeGray(&gray); - state->getStrokeRGB(&rgb); -#if SPLASH_CMYK - state->getStrokeCMYK(&cmyk); - splash->setStrokePattern(getColor(gray, &rgb, &cmyk)); -#else - splash->setStrokePattern(getColor(gray, &rgb)); -#endif -} - -#if SPLASH_CMYK -SplashPattern *SplashOutputDev::getColor(GfxGray gray, GfxRGB *rgb, - GfxCMYK *cmyk) { -#else -SplashPattern *SplashOutputDev::getColor(GfxGray gray, GfxRGB *rgb) { -#endif - SplashPattern *pattern; - SplashColor color0, color1; - GfxColorComp r, g, b; - - if (reverseVideo) { - gray = gfxColorComp1 - gray; - r = gfxColorComp1 - rgb->r; - g = gfxColorComp1 - rgb->g; - b = gfxColorComp1 - rgb->b; - } else { - r = rgb->r; - g = rgb->g; - b = rgb->b; - } - - pattern = NULL; // make gcc happy - switch (colorMode) { - case splashModeMono1: - color0[0] = 0; - color1[0] = 1; - pattern = new SplashHalftone(color0, color1, - splash->getScreen()->copy(), - (SplashCoord)colToDbl(gray)); - break; - case splashModeMono8: - color1[0] = colToByte(gray); - pattern = new SplashSolidColor(color1); - break; - case splashModeAMono8: - color1[0] = 255; - color1[1] = colToByte(gray); - pattern = new SplashSolidColor(color1); - break; - case splashModeRGB8: - color1[0] = colToByte(r); - color1[1] = colToByte(g); - color1[2] = colToByte(b); - pattern = new SplashSolidColor(color1); - break; - case splashModeBGR8: - color1[2] = colToByte(r); - color1[1] = colToByte(g); - color1[0] = colToByte(b); - pattern = new SplashSolidColor(color1); - break; - case splashModeARGB8: - color1[0] = 255; - color1[1] = colToByte(r); - color1[2] = colToByte(g); - color1[3] = colToByte(b); - pattern = new SplashSolidColor(color1); - break; - case splashModeBGRA8: - color1[3] = 255; - color1[2] = colToByte(r); - color1[1] = colToByte(g); - color1[0] = colToByte(b); - pattern = new SplashSolidColor(color1); - break; -#if SPLASH_CMYK - case splashModeCMYK8: - color1[0] = colToByte(cmyk->c); - color1[1] = colToByte(cmyk->m); - color1[2] = colToByte(cmyk->y); - color1[3] = colToByte(cmyk->k); - pattern = new SplashSolidColor(color1); - break; - case splashModeACMYK8: - color1[0] = 255; - color1[1] = colToByte(cmyk->c); - color1[2] = colToByte(cmyk->m); - color1[3] = colToByte(cmyk->y); - color1[4] = colToByte(cmyk->k); - pattern = new SplashSolidColor(color1); - break; -#endif - } - - return pattern; -} - -void SplashOutputDev::updateBlendMode(GfxState *state) { - splash->setBlendFunc(splashOutBlendFuncs[state->getBlendMode()]); -} - -void SplashOutputDev::updateFillOpacity(GfxState *state) { - splash->setFillAlpha((SplashCoord)state->getFillOpacity()); -} - -void SplashOutputDev::updateStrokeOpacity(GfxState *state) { - splash->setStrokeAlpha((SplashCoord)state->getStrokeOpacity()); -} - -void SplashOutputDev::updateFont(GfxState *state) { - GfxFont *gfxFont; - GfxFontType fontType; - SplashOutFontFileID *id; - SplashFontFile *fontFile; - FoFiTrueType *ff; - Ref embRef; - Object refObj, strObj; - GString *tmpFileName, *fileName, *substName; - FILE *tmpFile; - Gushort *codeToGID; - DisplayFontParam *dfp; - CharCodeToUnicode *ctu; - double m11, m12, m21, m22, w1, w2; - SplashCoord mat[4]; - char *name; - Unicode uBuf[8]; - int c, substIdx, n, code, cmap; - - needFontUpdate = gFalse; - font = NULL; - tmpFileName = NULL; - substIdx = -1; - dfp = NULL; - - if (!(gfxFont = state->getFont())) { - goto err1; - } - fontType = gfxFont->getType(); - if (fontType == fontType3) { - goto err1; - } - - // check the font file cache - id = new SplashOutFontFileID(gfxFont->getID()); - if ((fontFile = fontEngine->getFontFile(id))) { - delete id; - - } else { - - // if there is an embedded font, write it to disk - if (gfxFont->getEmbeddedFontID(&embRef)) { - if (!openTempFile(&tmpFileName, &tmpFile, "wb", NULL)) { - error(-1, "Couldn't create temporary font file"); - goto err2; - } - refObj.initRef(embRef.num, embRef.gen); - refObj.fetch(xref, &strObj); - refObj.free(); - strObj.streamReset(); - while ((c = strObj.streamGetChar()) != EOF) { - fputc(c, tmpFile); - } - strObj.streamClose(); - strObj.free(); - fclose(tmpFile); - fileName = tmpFileName; - - // if there is an external font file, use it - } else if (!(fileName = gfxFont->getExtFontFile())) { - - // look for a display font mapping or a substitute font - if (gfxFont->isCIDFont()) { - if (((GfxCIDFont *)gfxFont)->getCollection()) { - dfp = globalParams-> - getDisplayCIDFont(gfxFont->getName(), - ((GfxCIDFont *)gfxFont)->getCollection()); - } - } else { - if (gfxFont->getName()) { - dfp = globalParams->getDisplayFont(gfxFont->getName()); - } - if (!dfp) { - // 8-bit font substitution - if (gfxFont->isFixedWidth()) { - substIdx = 8; - } else if (gfxFont->isSerif()) { - substIdx = 4; - } else { - substIdx = 0; - } - if (gfxFont->isBold()) { - substIdx += 2; - } - if (gfxFont->isItalic()) { - substIdx += 1; - } - substName = new GString(splashOutSubstFonts[substIdx].name); - dfp = globalParams->getDisplayFont(substName); - delete substName; - id->setSubstIdx(substIdx); - } - } - if (!dfp) { - error(-1, "Couldn't find a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); - goto err2; - } - switch (dfp->kind) { - case displayFontT1: - fileName = dfp->t1.fileName; - fontType = gfxFont->isCIDFont() ? fontCIDType0 : fontType1; - break; - case displayFontTT: - fileName = dfp->tt.fileName; - fontType = gfxFont->isCIDFont() ? fontCIDType2 : fontTrueType; - break; - } - } - - // load the font file - switch (fontType) { - case fontType1: - if (!(fontFile = fontEngine->loadType1Font( - id, - fileName->getCString(), - fileName == tmpFileName, - ((Gfx8BitFont *)gfxFont)->getEncoding()))) { - error(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); - goto err2; - } - break; - case fontType1C: - if (!(fontFile = fontEngine->loadType1CFont( - id, - fileName->getCString(), - fileName == tmpFileName, - ((Gfx8BitFont *)gfxFont)->getEncoding()))) { - error(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); - goto err2; - } - break; - case fontTrueType: - if ((ff = FoFiTrueType::load(fileName->getCString()))) { - codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff); - n = 256; - delete ff; - } else { - codeToGID = NULL; - n = 0; - } - if (!(fontFile = fontEngine->loadTrueTypeFont( - id, - fileName->getCString(), - fileName == tmpFileName, - codeToGID, n))) { - error(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); - goto err2; - } - break; - case fontCIDType0: - case fontCIDType0C: - if (!(fontFile = fontEngine->loadCIDFont( - id, - fileName->getCString(), - fileName == tmpFileName))) { - error(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); - goto err2; - } - break; - case fontCIDType2: - codeToGID = NULL; - n = 0; - if (dfp) { - // create a CID-to-GID mapping, via Unicode - if ((ctu = ((GfxCIDFont *)gfxFont)->getToUnicode())) { - if ((ff = FoFiTrueType::load(fileName->getCString()))) { - // look for a Unicode cmap - for (cmap = 0; cmap < ff->getNumCmaps(); ++cmap) { - if ((ff->getCmapPlatform(cmap) == 3 && - ff->getCmapEncoding(cmap) == 1) || - ff->getCmapPlatform(cmap) == 0) { - break; - } - } - if (cmap < ff->getNumCmaps()) { - // map CID -> Unicode -> GID - n = ctu->getLength(); - codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort)); - for (code = 0; code < n; ++code) { - if (ctu->mapToUnicode(code, uBuf, 8) > 0) { - codeToGID[code] = ff->mapCodeToGID(cmap, uBuf[0]); - } else { - codeToGID[code] = 0; - } - } - } - delete ff; - } - ctu->decRefCnt(); - } else { - error(-1, "Couldn't find a mapping to Unicode for font '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); - } - } else { - if (((GfxCIDFont *)gfxFont)->getCIDToGID()) { - n = ((GfxCIDFont *)gfxFont)->getCIDToGIDLen(); - codeToGID = (Gushort *)gmallocn(n, sizeof(Gushort)); - memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(), - n * sizeof(Gushort)); - } - } - if (!(fontFile = fontEngine->loadTrueTypeFont( - id, - fileName->getCString(), - fileName == tmpFileName, - codeToGID, n))) { - error(-1, "Couldn't create a font for '%s'", - gfxFont->getName() ? gfxFont->getName()->getCString() - : "(unnamed)"); - goto err2; - } - break; - default: - // this shouldn't happen - goto err2; - } - } - - // get the font matrix - state->getFontTransMat(&m11, &m12, &m21, &m22); - m11 *= state->getHorizScaling(); - m12 *= state->getHorizScaling(); - - // for substituted fonts: adjust the font matrix -- compare the - // width of 'm' in the original font and the substituted font - substIdx = ((SplashOutFontFileID *)fontFile->getID())->getSubstIdx(); - if (substIdx >= 0) { - for (code = 0; code < 256; ++code) { - if ((name = ((Gfx8BitFont *)gfxFont)->getCharName(code)) && - name[0] == 'm' && name[1] == '\0') { - break; - } - } - if (code < 256) { - w1 = ((Gfx8BitFont *)gfxFont)->getWidth(code); - w2 = splashOutSubstFonts[substIdx].mWidth; - if (!gfxFont->isSymbolic()) { - // if real font is substantially narrower than substituted - // font, reduce the font size accordingly - if (w1 > 0.01 && w1 < 0.9 * w2) { - w1 /= w2; - m11 *= w1; - m21 *= w1; - } - } - } - } - - // create the scaled font - mat[0] = m11; mat[1] = -m12; - mat[2] = m21; mat[3] = -m22; - if (fabs(mat[0] * mat[3] - mat[1] * mat[2]) < 0.01) { - // avoid a singular (or close-to-singular) matrix - mat[0] = 0.01; mat[1] = 0; - mat[2] = 0; mat[3] = 0.01; - } - font = fontEngine->getFont(fontFile, mat); - - if (tmpFileName) { - delete tmpFileName; - } - return; - - err2: - delete id; - err1: - if (tmpFileName) { - delete tmpFileName; - } - return; -} - -void SplashOutputDev::stroke(GfxState *state) { - SplashPath *path; - - path = convertPath(state, state->getPath()); - splash->stroke(path); - delete path; -} - -void SplashOutputDev::fill(GfxState *state) { - SplashPath *path; - - path = convertPath(state, state->getPath()); - splash->fill(path, gFalse); - delete path; -} - -void SplashOutputDev::eoFill(GfxState *state) { - SplashPath *path; - - path = convertPath(state, state->getPath()); - splash->fill(path, gTrue); - delete path; -} - -void SplashOutputDev::clip(GfxState *state) { - SplashPath *path; - - path = convertPath(state, state->getPath()); - splash->clipToPath(path, gFalse); - delete path; -} - -void SplashOutputDev::eoClip(GfxState *state) { - SplashPath *path; - - path = convertPath(state, state->getPath()); - splash->clipToPath(path, gTrue); - delete path; -} - -SplashPath *SplashOutputDev::convertPath(GfxState *state, GfxPath *path) { - SplashPath *sPath; - GfxSubpath *subpath; - double x1, y1, x2, y2, x3, y3; - int i, j; - - sPath = new SplashPath(); - for (i = 0; i < path->getNumSubpaths(); ++i) { - subpath = path->getSubpath(i); - if (subpath->getNumPoints() > 0) { - state->transform(subpath->getX(0), subpath->getY(0), &x1, &y1); - sPath->moveTo((SplashCoord)x1, (SplashCoord)y1); - j = 1; - while (j < subpath->getNumPoints()) { - if (subpath->getCurve(j)) { - state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1); - state->transform(subpath->getX(j+1), subpath->getY(j+1), &x2, &y2); - state->transform(subpath->getX(j+2), subpath->getY(j+2), &x3, &y3); - sPath->curveTo((SplashCoord)x1, (SplashCoord)y1, - (SplashCoord)x2, (SplashCoord)y2, - (SplashCoord)x3, (SplashCoord)y3); - j += 3; - } else { - state->transform(subpath->getX(j), subpath->getY(j), &x1, &y1); - sPath->lineTo((SplashCoord)x1, (SplashCoord)y1); - ++j; - } - } - if (subpath->isClosed()) { - sPath->close(); - } - } - } - return sPath; -} - -void SplashOutputDev::drawChar(GfxState *state, double x, double y, - double dx, double dy, - double originX, double originY, - CharCode code, int nBytes, - Unicode *u, int uLen) { - double x1, y1; - SplashPath *path; - int render; - - if (needFontUpdate) { - updateFont(state); - } - if (!font) { - return; - } - - // check for invisible text -- this is used by Acrobat Capture - render = state->getRender(); - if (render == 3) { - return; - } - - x -= originX; - y -= originY; - state->transform(x, y, &x1, &y1); - - // fill - if (!(render & 1)) { - splash->fillChar((SplashCoord)x1, (SplashCoord)y1, code, font); - } - - // stroke - if ((render & 3) == 1 || (render & 3) == 2) { - if ((path = font->getGlyphPath(code))) { - path->offset((SplashCoord)x1, (SplashCoord)y1); - splash->stroke(path); - delete path; - } - } - - // clip - if (render & 4) { - path = font->getGlyphPath(code); - path->offset((SplashCoord)x1, (SplashCoord)y1); - if (textClipPath) { - textClipPath->append(path); - delete path; - } else { - textClipPath = path; - } - } -} - -GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, - double dx, double dy, - CharCode code, Unicode *u, int uLen) { - GfxFont *gfxFont; - Ref *fontID; - double *ctm, *bbox; - T3FontCache *t3Font; - T3GlyphStack *t3gs; - double x1, y1, xMin, yMin, xMax, yMax, xt, yt; - int i, j; - - if (!(gfxFont = state->getFont())) { - return gFalse; - } - fontID = gfxFont->getID(); - ctm = state->getCTM(); - state->transform(0, 0, &xt, &yt); - - // is it the first (MRU) font in the cache? - if (!(nT3Fonts > 0 && - t3FontCache[0]->matches(fontID, ctm[0], ctm[1], ctm[2], ctm[3]))) { - - // is the font elsewhere in the cache? - for (i = 1; i < nT3Fonts; ++i) { - if (t3FontCache[i]->matches(fontID, ctm[0], ctm[1], ctm[2], ctm[3])) { - t3Font = t3FontCache[i]; - for (j = i; j > 0; --j) { - t3FontCache[j] = t3FontCache[j - 1]; - } - t3FontCache[0] = t3Font; - break; - } - } - if (i >= nT3Fonts) { - - // create new entry in the font cache - if (nT3Fonts == splashOutT3FontCacheSize) { - delete t3FontCache[nT3Fonts - 1]; - --nT3Fonts; - } - for (j = nT3Fonts; j > 0; --j) { - t3FontCache[j] = t3FontCache[j - 1]; - } - ++nT3Fonts; - bbox = gfxFont->getFontBBox(); - if (bbox[0] == 0 && bbox[1] == 0 && bbox[2] == 0 && bbox[3] == 0) { - // broken bounding box -- just take a guess - xMin = xt - 5; - xMax = xMin + 30; - yMax = yt + 15; - yMin = yMax - 45; - } else { - state->transform(bbox[0], bbox[1], &x1, &y1); - xMin = xMax = x1; - yMin = yMax = y1; - state->transform(bbox[0], bbox[3], &x1, &y1); - if (x1 < xMin) { - xMin = x1; - } else if (x1 > xMax) { - xMax = x1; - } - if (y1 < yMin) { - yMin = y1; - } else if (y1 > yMax) { - yMax = y1; - } - state->transform(bbox[2], bbox[1], &x1, &y1); - if (x1 < xMin) { - xMin = x1; - } else if (x1 > xMax) { - xMax = x1; - } - if (y1 < yMin) { - yMin = y1; - } else if (y1 > yMax) { - yMax = y1; - } - state->transform(bbox[2], bbox[3], &x1, &y1); - if (x1 < xMin) { - xMin = x1; - } else if (x1 > xMax) { - xMax = x1; - } - if (y1 < yMin) { - yMin = y1; - } else if (y1 > yMax) { - yMax = y1; - } - } - t3FontCache[0] = new T3FontCache(fontID, ctm[0], ctm[1], ctm[2], ctm[3], - (int)floor(xMin - xt), - (int)floor(yMin - yt), - (int)ceil(xMax) - (int)floor(xMin) + 3, - (int)ceil(yMax) - (int)floor(yMin) + 3, - colorMode != splashModeMono1); - } - } - t3Font = t3FontCache[0]; - - // is the glyph in the cache? - i = (code & (t3Font->cacheSets - 1)) * t3Font->cacheAssoc; - for (j = 0; j < t3Font->cacheAssoc; ++j) { - if ((t3Font->cacheTags[i+j].mru & 0x8000) && - t3Font->cacheTags[i+j].code == code) { - drawType3Glyph(t3Font, &t3Font->cacheTags[i+j], - t3Font->cacheData + (i+j) * t3Font->glyphSize, - xt, yt); - return gTrue; - } - } - - // push a new Type 3 glyph record - t3gs = new T3GlyphStack(); - t3gs->next = t3GlyphStack; - t3GlyphStack = t3gs; - t3GlyphStack->code = code; - t3GlyphStack->x = xt; - t3GlyphStack->y = yt; - t3GlyphStack->cache = t3Font; - t3GlyphStack->cacheTag = NULL; - t3GlyphStack->cacheData = NULL; - - return gFalse; -} - -void SplashOutputDev::endType3Char(GfxState *state) { - T3GlyphStack *t3gs; - double *ctm; - - if (t3GlyphStack->cacheTag) { - memcpy(t3GlyphStack->cacheData, bitmap->getDataPtr(), - t3GlyphStack->cache->glyphSize); - delete bitmap; - delete splash; - bitmap = t3GlyphStack->origBitmap; - splash = t3GlyphStack->origSplash; - ctm = state->getCTM(); - state->setCTM(ctm[0], ctm[1], ctm[2], ctm[3], - t3GlyphStack->origCTM4, t3GlyphStack->origCTM5); - drawType3Glyph(t3GlyphStack->cache, - t3GlyphStack->cacheTag, t3GlyphStack->cacheData, - t3GlyphStack->x, t3GlyphStack->y); - } - t3gs = t3GlyphStack; - t3GlyphStack = t3gs->next; - delete t3gs; -} - -void SplashOutputDev::type3D0(GfxState *state, double wx, double wy) { -} - -void SplashOutputDev::type3D1(GfxState *state, double wx, double wy, - double llx, double lly, double urx, double ury) { - double *ctm; - T3FontCache *t3Font; - SplashColor color; - double xt, yt, xMin, xMax, yMin, yMax, x1, y1; - int i, j; - - t3Font = t3GlyphStack->cache; - - // check for a valid bbox - state->transform(0, 0, &xt, &yt); - state->transform(llx, lly, &x1, &y1); - xMin = xMax = x1; - yMin = yMax = y1; - state->transform(llx, ury, &x1, &y1); - if (x1 < xMin) { - xMin = x1; - } else if (x1 > xMax) { - xMax = x1; - } - if (y1 < yMin) { - yMin = y1; - } else if (y1 > yMax) { - yMax = y1; - } - state->transform(urx, lly, &x1, &y1); - if (x1 < xMin) { - xMin = x1; - } else if (x1 > xMax) { - xMax = x1; - } - if (y1 < yMin) { - yMin = y1; - } else if (y1 > yMax) { - yMax = y1; - } - state->transform(urx, ury, &x1, &y1); - if (x1 < xMin) { - xMin = x1; - } else if (x1 > xMax) { - xMax = x1; - } - if (y1 < yMin) { - yMin = y1; - } else if (y1 > yMax) { - yMax = y1; - } - if (xMin - xt < t3Font->glyphX || - yMin - yt < t3Font->glyphY || - xMax - xt > t3Font->glyphX + t3Font->glyphW || - yMax - yt > t3Font->glyphY + t3Font->glyphH) { - error(-1, "Bad bounding box in Type 3 glyph"); - return; - } - - // allocate a cache entry - i = (t3GlyphStack->code & (t3Font->cacheSets - 1)) * t3Font->cacheAssoc; - for (j = 0; j < t3Font->cacheAssoc; ++j) { - if ((t3Font->cacheTags[i+j].mru & 0x7fff) == t3Font->cacheAssoc - 1) { - t3Font->cacheTags[i+j].mru = 0x8000; - t3Font->cacheTags[i+j].code = t3GlyphStack->code; - t3GlyphStack->cacheTag = &t3Font->cacheTags[i+j]; - t3GlyphStack->cacheData = t3Font->cacheData + (i+j) * t3Font->glyphSize; - } else { - ++t3Font->cacheTags[i+j].mru; - } - } - - // save state - t3GlyphStack->origBitmap = bitmap; - t3GlyphStack->origSplash = splash; - ctm = state->getCTM(); - t3GlyphStack->origCTM4 = ctm[4]; - t3GlyphStack->origCTM5 = ctm[5]; - - // create the temporary bitmap - if (colorMode == splashModeMono1) { - bitmap = new SplashBitmap(t3Font->glyphW, t3Font->glyphH, 1, - splashModeMono1); - splash = new Splash(bitmap); - color[0] = 0; - splash->clear(color); - color[0] = 1; - } else { - bitmap = new SplashBitmap(t3Font->glyphW, t3Font->glyphH, 1, - splashModeMono8); - splash = new Splash(bitmap); - color[0] = 0x00; - splash->clear(color); - color[0] = 0xff; - } - splash->setFillPattern(new SplashSolidColor(color)); - splash->setStrokePattern(new SplashSolidColor(color)); - //~ this should copy other state from t3GlyphStack->origSplash? - state->setCTM(ctm[0], ctm[1], ctm[2], ctm[3], - -t3Font->glyphX, -t3Font->glyphY); -} - -void SplashOutputDev::drawType3Glyph(T3FontCache *t3Font, - T3FontCacheTag *tag, Guchar *data, - double x, double y) { - SplashGlyphBitmap glyph; - - glyph.x = -t3Font->glyphX; - glyph.y = -t3Font->glyphY; - glyph.w = t3Font->glyphW; - glyph.h = t3Font->glyphH; - glyph.aa = colorMode != splashModeMono1; - glyph.data = data; - glyph.freeData = gFalse; - splash->fillGlyph((SplashCoord)x, (SplashCoord)y, &glyph); -} - -void SplashOutputDev::endTextObject(GfxState *state) { - if (textClipPath) { - splash->clipToPath(textClipPath, gFalse); - delete textClipPath; - textClipPath = NULL; - } -} - -struct SplashOutImageMaskData { - ImageStream *imgStr; - GBool invert; - int width, height, y; -}; - -GBool SplashOutputDev::imageMaskSrc(void *data, SplashColorPtr line) { - SplashOutImageMaskData *imgMaskData = (SplashOutImageMaskData *)data; - Guchar *p; - SplashColorPtr q; - int x; - - if (imgMaskData->y == imgMaskData->height) { - return gFalse; - } - for (x = 0, p = imgMaskData->imgStr->getLine(), q = line; - x < imgMaskData->width; - ++x) { - *q++ = *p++ ^ imgMaskData->invert; - } - ++imgMaskData->y; - return gTrue; -} - -void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg) { - double *ctm; - SplashCoord mat[6]; - SplashOutImageMaskData imgMaskData; - - ctm = state->getCTM(); - mat[0] = ctm[0]; - mat[1] = ctm[1]; - mat[2] = -ctm[2]; - mat[3] = -ctm[3]; - mat[4] = ctm[2] + ctm[4]; - mat[5] = ctm[3] + ctm[5]; - - imgMaskData.imgStr = new ImageStream(str, width, 1, 1); - imgMaskData.imgStr->reset(); - imgMaskData.invert = invert ? 0 : 1; - imgMaskData.width = width; - imgMaskData.height = height; - imgMaskData.y = 0; - - splash->fillImageMask(&imageMaskSrc, &imgMaskData, width, height, mat); - if (inlineImg) { - while (imgMaskData.y < height) { - imgMaskData.imgStr->getLine(); - ++imgMaskData.y; - } - } - - delete imgMaskData.imgStr; - str->close(); -} - -struct SplashOutImageData { - ImageStream *imgStr; - GfxImageColorMap *colorMap; - SplashColorPtr lookup; - int *maskColors; - SplashColorMode colorMode; - int width, height, y; -}; - -GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr line) { - SplashOutImageData *imgData = (SplashOutImageData *)data; - Guchar *p; - SplashColorPtr q, col; - GfxRGB rgb; - GfxGray gray; -#if SPLASH_CMYK - GfxCMYK cmyk; -#endif - int nComps, x; - - if (imgData->y == imgData->height) { - return gFalse; - } - - nComps = imgData->colorMap->getNumPixelComps(); - - if (imgData->lookup) { - switch (imgData->colorMode) { - case splashModeMono1: - case splashModeMono8: - for (x = 0, p = imgData->imgStr->getLine(), q = line; - x < imgData->width; - ++x, ++p) { - *q++ = imgData->lookup[*p]; - } - break; - case splashModeRGB8: - case splashModeBGR8: - for (x = 0, p = imgData->imgStr->getLine(), q = line; - x < imgData->width; - ++x, ++p) { - col = &imgData->lookup[3 * *p]; - *q++ = col[0]; - *q++ = col[1]; - *q++ = col[2]; - } - break; -#if SPLASH_CMYK - case splashModeCMYK8: - for (x = 0, p = imgData->imgStr->getLine(), q = line; - x < imgData->width; - ++x, ++p) { - col = &imgData->lookup[4 * *p]; - *q++ = col[0]; - *q++ = col[1]; - *q++ = col[2]; - *q++ = col[3]; - } - break; -#endif - case splashModeAMono8: - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeACMYK8: -#endif - //~ unimplemented - break; - } - } else { - switch (imgData->colorMode) { - case splashModeMono1: - case splashModeMono8: - for (x = 0, p = imgData->imgStr->getLine(), q = line; - x < imgData->width; - ++x, p += nComps) { - imgData->colorMap->getGray(p, &gray); - *q++ = colToByte(gray); - } - break; - case splashModeRGB8: - for (x = 0, p = imgData->imgStr->getLine(), q = line; - x < imgData->width; - ++x, p += nComps) { - imgData->colorMap->getRGB(p, &rgb); - *q++ = colToByte(rgb.r); - *q++ = colToByte(rgb.g); - *q++ = colToByte(rgb.b); - } - break; - case splashModeBGR8: - for (x = 0, p = imgData->imgStr->getLine(), q = line; - x < imgData->width; - ++x, p += nComps) { - imgData->colorMap->getRGB(p, &rgb); - *q++ = colToByte(rgb.b); - *q++ = colToByte(rgb.g); - *q++ = colToByte(rgb.r); - } - break; -#if SPLASH_CMYK - case splashModeCMYK8: - for (x = 0, p = imgData->imgStr->getLine(), q = line; - x < imgData->width; - ++x, p += nComps) { - imgData->colorMap->getCMYK(p, &cmyk); - *q++ = colToByte(cmyk.c); - *q++ = colToByte(cmyk.m); - *q++ = colToByte(cmyk.y); - *q++ = colToByte(cmyk.k); - } - break; -#endif - case splashModeAMono8: - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeACMYK8: -#endif - //~ unimplemented - break; - } - } - - ++imgData->y; - return gTrue; -} - -GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr line) { - SplashOutImageData *imgData = (SplashOutImageData *)data; - Guchar *p; - SplashColorPtr q, col; - GfxRGB rgb; - GfxGray gray; -#if SPLASH_CMYK - GfxCMYK cmyk; -#endif - Guchar alpha; - int nComps, x, i; - - if (imgData->y == imgData->height) { - return gFalse; - } - - nComps = imgData->colorMap->getNumPixelComps(); - - for (x = 0, p = imgData->imgStr->getLine(), q = line; - x < imgData->width; - ++x, p += nComps) { - alpha = 0; - for (i = 0; i < nComps; ++i) { - if (p[i] < imgData->maskColors[2*i] || - p[i] > imgData->maskColors[2*i+1]) { - alpha = 0xff; - break; - } - } - if (imgData->lookup) { - switch (imgData->colorMode) { - case splashModeMono1: - case splashModeMono8: - *q++ = alpha; - *q++ = imgData->lookup[*p]; - break; - case splashModeRGB8: - *q++ = alpha; - col = &imgData->lookup[3 * *p]; - *q++ = col[0]; - *q++ = col[1]; - *q++ = col[2]; - break; - case splashModeBGR8: - col = &imgData->lookup[3 * *p]; - *q++ = col[0]; - *q++ = col[1]; - *q++ = col[2]; - *q++ = alpha; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - *q++ = alpha; - col = &imgData->lookup[4 * *p]; - *q++ = col[0]; - *q++ = col[1]; - *q++ = col[2]; - *q++ = col[3]; - break; -#endif - case splashModeAMono8: - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeACMYK8: -#endif - //~ unimplemented - break; - } - } else { - switch (imgData->colorMode) { - case splashModeMono1: - case splashModeMono8: - imgData->colorMap->getGray(p, &gray); - *q++ = alpha; - *q++ = colToByte(gray); - break; - case splashModeRGB8: - imgData->colorMap->getRGB(p, &rgb); - *q++ = alpha; - *q++ = colToByte(rgb.r); - *q++ = colToByte(rgb.g); - *q++ = colToByte(rgb.b); - break; - case splashModeBGR8: - imgData->colorMap->getRGB(p, &rgb); - *q++ = colToByte(rgb.b); - *q++ = colToByte(rgb.g); - *q++ = colToByte(rgb.r); - *q++ = alpha; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - imgData->colorMap->getCMYK(p, &cmyk); - *q++ = alpha; - *q++ = colToByte(cmyk.c); - *q++ = colToByte(cmyk.m); - *q++ = colToByte(cmyk.y); - *q++ = colToByte(cmyk.k); - break; -#endif - case splashModeAMono8: - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeACMYK8: -#endif - //~ unimplemented - break; - } - } - } - - ++imgData->y; - return gTrue; -} - -void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg) { - double *ctm; - SplashCoord mat[6]; - SplashOutImageData imgData; - SplashColorMode srcMode; - SplashImageSource src; - GfxGray gray; - GfxRGB rgb; -#if SPLASH_CMYK - GfxCMYK cmyk; -#endif - Guchar pix; - int n, i; - - ctm = state->getCTM(); - mat[0] = ctm[0]; - mat[1] = ctm[1]; - mat[2] = -ctm[2]; - mat[3] = -ctm[3]; - mat[4] = ctm[2] + ctm[4]; - mat[5] = ctm[3] + ctm[5]; - - imgData.imgStr = new ImageStream(str, width, - colorMap->getNumPixelComps(), - colorMap->getBits()); - imgData.imgStr->reset(); - imgData.colorMap = colorMap; - imgData.maskColors = maskColors; - imgData.colorMode = colorMode; - imgData.width = width; - imgData.height = height; - imgData.y = 0; - - // special case for one-channel (monochrome/gray/separation) images: - // build a lookup table here - imgData.lookup = NULL; - if (colorMap->getNumPixelComps() == 1) { - n = 1 << colorMap->getBits(); - switch (colorMode) { - case splashModeMono1: - case splashModeMono8: - imgData.lookup = (SplashColorPtr)gmalloc(n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getGray(&pix, &gray); - imgData.lookup[i] = colToByte(gray); - } - break; - case splashModeRGB8: - imgData.lookup = (SplashColorPtr)gmalloc(3 * n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getRGB(&pix, &rgb); - imgData.lookup[3*i] = colToByte(rgb.r); - imgData.lookup[3*i+1] = colToByte(rgb.g); - imgData.lookup[3*i+2] = colToByte(rgb.b); - } - break; - case splashModeBGR8: - imgData.lookup = (SplashColorPtr)gmalloc(3 * n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getRGB(&pix, &rgb); - imgData.lookup[3*i] = colToByte(rgb.b); - imgData.lookup[3*i+1] = colToByte(rgb.g); - imgData.lookup[3*i+2] = colToByte(rgb.r); - } - break; -#if SPLASH_CMYK - case splashModeCMYK8: - imgData.lookup = (SplashColorPtr)gmalloc(4 * n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getCMYK(&pix, &cmyk); - imgData.lookup[4*i] = colToByte(cmyk.c); - imgData.lookup[4*i+1] = colToByte(cmyk.m); - imgData.lookup[4*i+2] = colToByte(cmyk.y); - imgData.lookup[4*i+3] = colToByte(cmyk.k); - } - break; -#endif - default: - //~ unimplemented - break; - } - } - - switch (colorMode) { - case splashModeMono1: - case splashModeMono8: - srcMode = maskColors ? splashModeAMono8 : splashModeMono8; - break; - case splashModeRGB8: - srcMode = maskColors ? splashModeARGB8 : splashModeRGB8; - break; - case splashModeBGR8: - srcMode = maskColors ? splashModeBGRA8 : splashModeBGR8; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - srcMode = maskColors ? splashModeACMYK8 : splashModeCMYK8; - break; -#endif - default: - //~ unimplemented - srcMode = splashModeRGB8; - break; - } - src = maskColors ? &alphaImageSrc : &imageSrc; - splash->drawImage(src, &imgData, srcMode, width, height, mat); - if (inlineImg) { - while (imgData.y < height) { - imgData.imgStr->getLine(); - ++imgData.y; - } - } - - gfree(imgData.lookup); - delete imgData.imgStr; - str->close(); -} - -struct SplashOutMaskedImageData { - ImageStream *imgStr; - GfxImageColorMap *colorMap; - SplashBitmap *mask; - SplashColorPtr lookup; - SplashColorMode colorMode; - int width, height, y; -}; - -GBool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr line) { - SplashOutMaskedImageData *imgData = (SplashOutMaskedImageData *)data; - Guchar *p; - SplashColor maskColor; - SplashColorPtr q, col; - GfxRGB rgb; - GfxGray gray; -#if SPLASH_CMYK - GfxCMYK cmyk; -#endif - Guchar alpha; - int nComps, x; - - if (imgData->y == imgData->height) { - return gFalse; - } - - nComps = imgData->colorMap->getNumPixelComps(); - - for (x = 0, p = imgData->imgStr->getLine(), q = line; - x < imgData->width; - ++x, p += nComps) { - imgData->mask->getPixel(x, imgData->y, maskColor); - alpha = maskColor[0] ? 0xff : 0x00; - if (imgData->lookup) { - switch (imgData->colorMode) { - case splashModeMono1: - case splashModeMono8: - *q++ = alpha; - *q++ = imgData->lookup[*p]; - break; - case splashModeRGB8: - *q++ = alpha; - col = &imgData->lookup[3 * *p]; - *q++ = col[0]; - *q++ = col[1]; - *q++ = col[2]; - break; - case splashModeBGR8: - col = &imgData->lookup[3 * *p]; - *q++ = col[0]; - *q++ = col[1]; - *q++ = col[2]; - *q++ = alpha; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - *q++ = alpha; - col = &imgData->lookup[4 * *p]; - *q++ = col[0]; - *q++ = col[1]; - *q++ = col[2]; - *q++ = col[3]; - break; -#endif - case splashModeAMono8: - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeACMYK8: -#endif - //~ unimplemented - break; - } - } else { - switch (imgData->colorMode) { - case splashModeMono1: - case splashModeMono8: - imgData->colorMap->getGray(p, &gray); - *q++ = alpha; - *q++ = colToByte(gray); - break; - case splashModeRGB8: - imgData->colorMap->getRGB(p, &rgb); - *q++ = alpha; - *q++ = colToByte(rgb.r); - *q++ = colToByte(rgb.g); - *q++ = colToByte(rgb.b); - break; - case splashModeBGR8: - imgData->colorMap->getRGB(p, &rgb); - *q++ = colToByte(rgb.b); - *q++ = colToByte(rgb.g); - *q++ = colToByte(rgb.r); - *q++ = alpha; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - imgData->colorMap->getCMYK(p, &cmyk); - *q++ = alpha; - *q++ = colToByte(cmyk.c); - *q++ = colToByte(cmyk.m); - *q++ = colToByte(cmyk.y); - *q++ = colToByte(cmyk.k); - break; -#endif - case splashModeAMono8: - case splashModeARGB8: - case splashModeBGRA8: -#if SPLASH_CMYK - case splashModeACMYK8: -#endif - //~ unimplemented - break; - } - } - } - - ++imgData->y; - return gTrue; -} - -void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, - Stream *str, int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, int maskWidth, - int maskHeight, GBool maskInvert) { - double *ctm; - SplashCoord mat[6]; - SplashOutMaskedImageData imgData; - SplashOutImageMaskData imgMaskData; - SplashColorMode srcMode; - SplashBitmap *maskBitmap; - Splash *maskSplash; - SplashColor maskColor; - GfxGray gray; - GfxRGB rgb; -#if SPLASH_CMYK - GfxCMYK cmyk; -#endif - Guchar pix; - int n, i; - - //----- scale the mask image to the same size as the source image - - mat[0] = (SplashCoord)width; - mat[1] = 0; - mat[2] = 0; - mat[3] = (SplashCoord)height; - mat[4] = 0; - mat[5] = 0; - imgMaskData.imgStr = new ImageStream(maskStr, maskWidth, 1, 1); - imgMaskData.imgStr->reset(); - imgMaskData.invert = maskInvert ? 0 : 1; - imgMaskData.width = maskWidth; - imgMaskData.height = maskHeight; - imgMaskData.y = 0; - maskBitmap = new SplashBitmap(width, height, 1, splashModeMono1); - maskSplash = new Splash(maskBitmap); - maskColor[0] = 0; - maskSplash->clear(maskColor); - maskColor[0] = 1; - maskSplash->setFillPattern(new SplashSolidColor(maskColor)); - maskSplash->fillImageMask(&imageMaskSrc, &imgMaskData, - maskWidth, maskHeight, mat); - delete imgMaskData.imgStr; - maskStr->close(); - delete maskSplash; - - //----- draw the source image - - ctm = state->getCTM(); - mat[0] = ctm[0]; - mat[1] = ctm[1]; - mat[2] = -ctm[2]; - mat[3] = -ctm[3]; - mat[4] = ctm[2] + ctm[4]; - mat[5] = ctm[3] + ctm[5]; - - imgData.imgStr = new ImageStream(str, width, - colorMap->getNumPixelComps(), - colorMap->getBits()); - imgData.imgStr->reset(); - imgData.colorMap = colorMap; - imgData.mask = maskBitmap; - imgData.colorMode = colorMode; - imgData.width = width; - imgData.height = height; - imgData.y = 0; - - // special case for one-channel (monochrome/gray/separation) images: - // build a lookup table here - imgData.lookup = NULL; - if (colorMap->getNumPixelComps() == 1) { - n = 1 << colorMap->getBits(); - switch (colorMode) { - case splashModeMono1: - case splashModeMono8: - imgData.lookup = (SplashColorPtr)gmalloc(n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getGray(&pix, &gray); - imgData.lookup[i] = colToByte(gray); - } - break; - case splashModeRGB8: - imgData.lookup = (SplashColorPtr)gmalloc(3 * n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getRGB(&pix, &rgb); - imgData.lookup[3*i] = colToByte(rgb.r); - imgData.lookup[3*i+1] = colToByte(rgb.g); - imgData.lookup[3*i+2] = colToByte(rgb.b); - } - break; - case splashModeBGR8: - imgData.lookup = (SplashColorPtr)gmalloc(3 * n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getRGB(&pix, &rgb); - imgData.lookup[3*i] = colToByte(rgb.b); - imgData.lookup[3*i+1] = colToByte(rgb.g); - imgData.lookup[3*i+2] = colToByte(rgb.r); - } - break; -#if SPLASH_CMYK - case splashModeCMYK8: - imgData.lookup = (SplashColorPtr)gmalloc(4 * n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getCMYK(&pix, &cmyk); - imgData.lookup[4*i] = colToByte(cmyk.c); - imgData.lookup[4*i+1] = colToByte(cmyk.m); - imgData.lookup[4*i+2] = colToByte(cmyk.y); - imgData.lookup[4*i+3] = colToByte(cmyk.k); - } - break; -#endif - default: - //~ unimplemented - break; - } - } - - switch (colorMode) { - case splashModeMono1: - case splashModeMono8: - srcMode = splashModeAMono8; - break; - case splashModeRGB8: - srcMode = splashModeARGB8; - break; - case splashModeBGR8: - srcMode = splashModeBGRA8; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - srcMode = splashModeACMYK8; - break; -#endif - default: - //~ unimplemented - srcMode = splashModeARGB8; - break; - } - splash->drawImage(&maskedImageSrc, &imgData, srcMode, width, height, mat); - - delete maskBitmap; - gfree(imgData.lookup); - delete imgData.imgStr; - str->close(); -} - -void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, - Stream *str, int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap) { - double *ctm; - SplashCoord mat[6]; - SplashOutImageData imgData; - SplashOutImageData imgMaskData; - SplashColorMode srcMode; - SplashBitmap *maskBitmap; - Splash *maskSplash; - SplashColor maskColor; - GfxGray gray; - GfxRGB rgb; -#if SPLASH_CMYK - GfxCMYK cmyk; -#endif - Guchar pix; - int n, i; - - ctm = state->getCTM(); - mat[0] = ctm[0]; - mat[1] = ctm[1]; - mat[2] = -ctm[2]; - mat[3] = -ctm[3]; - mat[4] = ctm[2] + ctm[4]; - mat[5] = ctm[3] + ctm[5]; - - //----- set up the soft mask - - imgMaskData.imgStr = new ImageStream(maskStr, maskWidth, - maskColorMap->getNumPixelComps(), - maskColorMap->getBits()); - imgMaskData.imgStr->reset(); - imgMaskData.colorMap = maskColorMap; - imgMaskData.maskColors = NULL; - imgMaskData.colorMode = splashModeMono8; - imgMaskData.width = maskWidth; - imgMaskData.height = maskHeight; - imgMaskData.y = 0; - n = 1 << maskColorMap->getBits(); - imgMaskData.lookup = (SplashColorPtr)gmalloc(n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - maskColorMap->getGray(&pix, &gray); - imgMaskData.lookup[i] = colToByte(gray); - } - maskBitmap = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(), - 1, splashModeMono8); - maskSplash = new Splash(maskBitmap); - maskColor[0] = 0; - maskSplash->clear(maskColor); - maskSplash->drawImage(&imageSrc, &imgMaskData, - splashModeMono8, maskWidth, maskHeight, mat); - delete imgMaskData.imgStr; - maskStr->close(); - gfree(imgMaskData.lookup); - delete maskSplash; - splash->setSoftMask(maskBitmap); - - //----- draw the source image - - imgData.imgStr = new ImageStream(str, width, - colorMap->getNumPixelComps(), - colorMap->getBits()); - imgData.imgStr->reset(); - imgData.colorMap = colorMap; - imgData.maskColors = NULL; - imgData.colorMode = colorMode; - imgData.width = width; - imgData.height = height; - imgData.y = 0; - - // special case for one-channel (monochrome/gray/separation) images: - // build a lookup table here - imgData.lookup = NULL; - if (colorMap->getNumPixelComps() == 1) { - n = 1 << colorMap->getBits(); - switch (colorMode) { - case splashModeMono1: - case splashModeMono8: - imgData.lookup = (SplashColorPtr)gmalloc(n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getGray(&pix, &gray); - imgData.lookup[i] = colToByte(gray); - } - break; - case splashModeRGB8: - imgData.lookup = (SplashColorPtr)gmalloc(3 * n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getRGB(&pix, &rgb); - imgData.lookup[3*i] = colToByte(rgb.r); - imgData.lookup[3*i+1] = colToByte(rgb.g); - imgData.lookup[3*i+2] = colToByte(rgb.b); - } - break; - case splashModeBGR8: - imgData.lookup = (SplashColorPtr)gmalloc(3 * n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getRGB(&pix, &rgb); - imgData.lookup[3*i] = colToByte(rgb.b); - imgData.lookup[3*i+1] = colToByte(rgb.g); - imgData.lookup[3*i+2] = colToByte(rgb.r); - } - break; -#if SPLASH_CMYK - case splashModeCMYK8: - imgData.lookup = (SplashColorPtr)gmalloc(4 * n); - for (i = 0; i < n; ++i) { - pix = (Guchar)i; - colorMap->getCMYK(&pix, &cmyk); - imgData.lookup[4*i] = colToByte(cmyk.c); - imgData.lookup[4*i+1] = colToByte(cmyk.m); - imgData.lookup[4*i+2] = colToByte(cmyk.y); - imgData.lookup[4*i+3] = colToByte(cmyk.k); - } - break; -#endif - default: - //~ unimplemented - break; - } - } - - switch (colorMode) { - case splashModeMono1: - case splashModeMono8: - srcMode = splashModeMono8; - break; - case splashModeRGB8: - srcMode = splashModeRGB8; - break; - case splashModeBGR8: - srcMode = splashModeBGR8; - break; -#if SPLASH_CMYK - case splashModeCMYK8: - srcMode = splashModeCMYK8; - break; -#endif - default: - //~ unimplemented - srcMode = splashModeRGB8; - break; - } - splash->drawImage(&imageSrc, &imgData, srcMode, width, height, mat); - - splash->setSoftMask(NULL); - gfree(imgData.lookup); - delete imgData.imgStr; - str->close(); -} - -void SplashOutputDev::setPaperColor(SplashColorPtr paperColorA) { - splashColorCopy(paperColor, paperColorA); -} - -int SplashOutputDev::getBitmapWidth() { - return bitmap->getWidth(); -} - -int SplashOutputDev::getBitmapHeight() { - return bitmap->getHeight(); -} - -SplashBitmap *SplashOutputDev::takeBitmap() { - SplashBitmap *ret; - - ret = bitmap; - bitmap = new SplashBitmap(1, 1, bitmapRowPad, colorMode, bitmapTopDown); - return ret; -} - -void SplashOutputDev::getModRegion(int *xMin, int *yMin, - int *xMax, int *yMax) { - splash->getModRegion(xMin, yMin, xMax, yMax); -} - -void SplashOutputDev::clearModRegion() { - splash->clearModRegion(); -} - -void SplashOutputDev::setFillColor(int r, int g, int b) { - GfxRGB rgb; - GfxGray gray; -#if SPLASH_CMYK - GfxCMYK cmyk; -#endif - - rgb.r = byteToCol(r); - rgb.g = byteToCol(g); - rgb.b = byteToCol(b); - gray = (GfxColorComp)(0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.g + 0.5); - if (gray > gfxColorComp1) { - gray = gfxColorComp1; - } -#if SPLASH_CMYK - cmyk.c = gfxColorComp1 - rgb.r; - cmyk.m = gfxColorComp1 - rgb.g; - cmyk.y = gfxColorComp1 - rgb.b; - cmyk.k = 0; - splash->setFillPattern(getColor(gray, &rgb, &cmyk)); -#else - splash->setFillPattern(getColor(gray, &rgb)); -#endif -} - -SplashFont *SplashOutputDev::getFont(GString *name, double *mat) { - DisplayFontParam *dfp; - Ref ref; - SplashOutFontFileID *id; - SplashFontFile *fontFile; - SplashFont *fontObj; - FoFiTrueType *ff; - Gushort *codeToGID; - Unicode u; - int cmap, i; - - for (i = 0; i < 16; ++i) { - if (!name->cmp(splashOutSubstFonts[i].name)) { - break; - } - } - if (i == 16) { - return NULL; - } - ref.num = i; - ref.gen = -1; - id = new SplashOutFontFileID(&ref); - - // check the font file cache - if ((fontFile = fontEngine->getFontFile(id))) { - delete id; - - // load the font file - } else { - dfp = globalParams->getDisplayFont(name); - if (dfp && dfp->kind == displayFontT1) { - fontFile = fontEngine->loadType1Font(id, dfp->t1.fileName->getCString(), - gFalse, winAnsiEncoding); - } else if (dfp && dfp->kind == displayFontTT) { - if (!(ff = FoFiTrueType::load(dfp->tt.fileName->getCString()))) { - return NULL; - } - for (cmap = 0; cmap < ff->getNumCmaps(); ++cmap) { - if ((ff->getCmapPlatform(cmap) == 3 && - ff->getCmapEncoding(cmap) == 1) || - ff->getCmapPlatform(cmap) == 0) { - break; - } - } - if (cmap == ff->getNumCmaps()) { - delete ff; - return NULL; - } - codeToGID = (Gushort *)gmallocn(256, sizeof(Gushort)); - for (i = 0; i < 256; ++i) { - codeToGID[i] = 0; - if (winAnsiEncoding[i] && - (u = globalParams->mapNameToUnicode(winAnsiEncoding[i]))) { - codeToGID[i] = ff->mapCodeToGID(cmap, u); - } - } - delete ff; - fontFile = fontEngine->loadTrueTypeFont(id, - dfp->tt.fileName->getCString(), - gFalse, codeToGID, 256); - } else { - return NULL; - } - } - - // create the scaled font - fontObj = fontEngine->getFont(fontFile, (SplashCoord *)mat); - - return fontObj; -} diff --git a/pdftops/SplashOutputDev.h b/pdftops/SplashOutputDev.h deleted file mode 100644 index 266253f65..000000000 --- a/pdftops/SplashOutputDev.h +++ /dev/null @@ -1,222 +0,0 @@ -//======================================================================== -// -// SplashOutputDev.h -// -// Copyright 2003 Glyph & Cog, LLC -// -//======================================================================== - -#ifndef SPLASHOUTPUTDEV_H -#define SPLASHOUTPUTDEV_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "gtypes.h" -#include "SplashTypes.h" -#include "config.h" -#include "OutputDev.h" -#include "GfxState.h" - -class Gfx8BitFont; -class SplashBitmap; -class Splash; -class SplashPath; -class SplashPattern; -class SplashFontEngine; -class SplashFont; -class T3FontCache; -struct T3FontCacheTag; -struct T3GlyphStack; - -//------------------------------------------------------------------------ - -// number of Type 3 fonts to cache -#define splashOutT3FontCacheSize 8 - -//------------------------------------------------------------------------ -// SplashOutputDev -//------------------------------------------------------------------------ - -class SplashOutputDev: public OutputDev { -public: - - // Constructor. - SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, - GBool reverseVideoA, SplashColorPtr paperColorA, - GBool bitmapTopDownA = gTrue, - GBool allowAntialiasA = gTrue); - - // Destructor. - virtual ~SplashOutputDev(); - - //----- get info about output device - - // Does this device use upside-down coordinates? - // (Upside-down means (0,0) is the top left corner of the page.) - virtual GBool upsideDown() { return gTrue; } - - // Does this device use drawChar() or drawString()? - virtual GBool useDrawChar() { return gTrue; } - - // Does this device use beginType3Char/endType3Char? Otherwise, - // text in Type 3 fonts will be drawn with drawChar/drawString. - virtual GBool interpretType3Chars() { return gTrue; } - - //----- initialization and control - - // Start a page. - virtual GBool startPage(int pageNum, GfxState *state); - - // End a page. - virtual void endPage(); - - //----- link borders - virtual void drawLink(Link *link, Catalog *catalog); - - //----- save/restore graphics state - virtual void saveState(GfxState *state); - virtual void restoreState(GfxState *state); - - //----- update graphics state - virtual void updateAll(GfxState *state); - virtual void updateCTM(GfxState *state, double m11, double m12, - double m21, double m22, double m31, double m32); - virtual void updateLineDash(GfxState *state); - virtual void updateFlatness(GfxState *state); - virtual void updateLineJoin(GfxState *state); - virtual void updateLineCap(GfxState *state); - virtual void updateMiterLimit(GfxState *state); - virtual void updateLineWidth(GfxState *state); - virtual void updateFillColor(GfxState *state); - virtual void updateStrokeColor(GfxState *state); - virtual void updateBlendMode(GfxState *state); - virtual void updateFillOpacity(GfxState *state); - virtual void updateStrokeOpacity(GfxState *state); - - //----- update text state - virtual void updateFont(GfxState *state); - - //----- path painting - virtual void stroke(GfxState *state); - virtual void fill(GfxState *state); - virtual void eoFill(GfxState *state); - - //----- path clipping - virtual void clip(GfxState *state); - virtual void eoClip(GfxState *state); - - //----- text drawing - virtual void drawChar(GfxState *state, double x, double y, - double dx, double dy, - double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen); - virtual GBool beginType3Char(GfxState *state, double x, double y, - double dx, double dy, - CharCode code, Unicode *u, int uLen); - virtual void endType3Char(GfxState *state); - virtual void endTextObject(GfxState *state); - - //----- image drawing - virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg); - virtual void drawImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, - int *maskColors, GBool inlineImg); - virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert); - virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, - int width, int height, - GfxImageColorMap *colorMap, - Stream *maskStr, - int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap); - - //----- Type 3 font operators - virtual void type3D0(GfxState *state, double wx, double wy); - virtual void type3D1(GfxState *state, double wx, double wy, - double llx, double lly, double urx, double ury); - - //----- special access - - // Called to indicate that a new PDF document has been loaded. - void startDoc(XRef *xrefA); - - void setPaperColor(SplashColorPtr paperColorA); - - GBool isReverseVideo() { return reverseVideo; } - void setReverseVideo(GBool reverseVideoA) { reverseVideo = reverseVideoA; } - - // Get the bitmap and its size. - SplashBitmap *getBitmap() { return bitmap; } - int getBitmapWidth(); - int getBitmapHeight(); - - // Returns the last rasterized bitmap, transferring ownership to the - // caller. - SplashBitmap *takeBitmap(); - - // Get the Splash object. - Splash *getSplash() { return splash; } - - // Get the modified region. - void getModRegion(int *xMin, int *yMin, int *xMax, int *yMax); - - // Clear the modified region. - void clearModRegion(); - - // Set the Splash fill color. - void setFillColor(int r, int g, int b); - - // Get a font object for a Base-14 font, using the Latin-1 encoding. - SplashFont *getFont(GString *name, double *mat); - - SplashFont *getCurrentFont() { return font; } - -private: - -#if SPLASH_CMYK - SplashPattern *getColor(GfxGray gray, GfxRGB *rgb, GfxCMYK *cmyk); -#else - SplashPattern *getColor(GfxGray gray, GfxRGB *rgb); -#endif - SplashPath *convertPath(GfxState *state, GfxPath *path); - void drawType3Glyph(T3FontCache *t3Font, - T3FontCacheTag *tag, Guchar *data, - double x, double y); - static GBool imageMaskSrc(void *data, SplashColorPtr line); - static GBool imageSrc(void *data, SplashColorPtr line); - static GBool alphaImageSrc(void *data, SplashColorPtr line); - static GBool maskedImageSrc(void *data, SplashColorPtr line); - - SplashColorMode colorMode; - int bitmapRowPad; - GBool bitmapTopDown; - GBool allowAntialias; - GBool reverseVideo; // reverse video mode - SplashColor paperColor; // paper color - - XRef *xref; // xref table for current document - - SplashBitmap *bitmap; - Splash *splash; - SplashFontEngine *fontEngine; - - T3FontCache * // Type 3 font cache - t3FontCache[splashOutT3FontCacheSize]; - int nT3Fonts; // number of valid entries in t3FontCache - T3GlyphStack *t3GlyphStack; // Type 3 glyph context stack - - SplashFont *font; // current font - GBool needFontUpdate; // set when the font needs to be updated - SplashPath *textClipPath; // clipping path built with text object -}; - -#endif diff --git a/pdftops/SplashPath.cxx b/pdftops/SplashPath.cxx deleted file mode 100644 index c392f9761..000000000 --- a/pdftops/SplashPath.cxx +++ /dev/null @@ -1,178 +0,0 @@ -//======================================================================== -// -// SplashPath.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include "gmem.h" -#include "SplashErrorCodes.h" -#include "SplashPath.h" - -//------------------------------------------------------------------------ -// SplashPath -//------------------------------------------------------------------------ - -// A path can be in three possible states: -// -// 1. no current point -- zero or more finished subpaths -// [curSubpath == length] -// -// 2. one point in subpath -// [curSubpath == length - 1] -// -// 3. open subpath with two or more points -// [curSubpath < length - 1] - -SplashPath::SplashPath() { - pts = NULL; - flags = NULL; - length = size = 0; - curSubpath = 0; -} - -SplashPath::SplashPath(SplashPath *path) { - length = path->length; - size = path->size; - pts = (SplashPathPoint *)gmallocn(size, sizeof(SplashPathPoint)); - flags = (Guchar *)gmallocn(size, sizeof(Guchar)); - memcpy(pts, path->pts, length * sizeof(SplashPathPoint)); - memcpy(flags, path->flags, length * sizeof(Guchar)); - curSubpath = path->curSubpath; -} - -SplashPath::~SplashPath() { - gfree(pts); - gfree(flags); -} - -// Add space for more points. -void SplashPath::grow(int nPts) { - if (length + nPts > size) { - if (size == 0) { - size = 32; - } - while (size < length + nPts) { - size *= 2; - } - pts = (SplashPathPoint *)greallocn(pts, size, sizeof(SplashPathPoint)); - flags = (Guchar *)greallocn(flags, size, sizeof(Guchar)); - } -} - -void SplashPath::append(SplashPath *path) { - int i; - - curSubpath = length + path->curSubpath; - grow(path->length); - for (i = 0; i < path->length; ++i) { - pts[length] = path->pts[i]; - flags[length] = path->flags[i]; - ++length; - } -} - -SplashError SplashPath::moveTo(SplashCoord x, SplashCoord y) { - if (onePointSubpath()) { - return splashErrBogusPath; - } - grow(1); - pts[length].x = x; - pts[length].y = y; - flags[length] = splashPathFirst | splashPathLast; - curSubpath = length++; - return splashOk; -} - -SplashError SplashPath::lineTo(SplashCoord x, SplashCoord y) { - if (noCurrentPoint()) { - return splashErrNoCurPt; - } - flags[length-1] &= ~splashPathLast; - grow(1); - pts[length].x = x; - pts[length].y = y; - flags[length] = splashPathLast; - ++length; - return splashOk; -} - -SplashError SplashPath::curveTo(SplashCoord x1, SplashCoord y1, - SplashCoord x2, SplashCoord y2, - SplashCoord x3, SplashCoord y3) { - if (noCurrentPoint()) { - return splashErrNoCurPt; - } - flags[length-1] &= ~splashPathLast; - grow(3); - pts[length].x = x1; - pts[length].y = y1; - flags[length] = splashPathCurve; - ++length; - pts[length].x = x2; - pts[length].y = y2; - flags[length] = splashPathCurve; - ++length; - pts[length].x = x3; - pts[length].y = y3; - flags[length] = splashPathLast; - ++length; - return splashOk; -} - -SplashError SplashPath::arcCWTo(SplashCoord x1, SplashCoord y1, - SplashCoord xc, SplashCoord yc) { - if (noCurrentPoint()) { - return splashErrNoCurPt; - } - flags[length-1] &= ~splashPathLast; - grow(2); - pts[length].x = xc; - pts[length].y = yc; - flags[length] = splashPathArcCW; - ++length; - pts[length].x = x1; - pts[length].y = y1; - flags[length] = splashPathLast; - ++length; - return splashOk; -} - -SplashError SplashPath::close() { - if (noCurrentPoint()) { - return splashErrNoCurPt; - } - if (curSubpath == length - 1 || - pts[length - 1].x != pts[curSubpath].x || - pts[length - 1].y != pts[curSubpath].y) { - lineTo(pts[curSubpath].x, pts[curSubpath].y); - } - flags[curSubpath] |= splashPathClosed; - flags[length - 1] |= splashPathClosed; - curSubpath = length; - return splashOk; -} - -void SplashPath::offset(SplashCoord dx, SplashCoord dy) { - int i; - - for (i = 0; i < length; ++i) { - pts[i].x += dx; - pts[i].y += dy; - } -} - -GBool SplashPath::getCurPt(SplashCoord *x, SplashCoord *y) { - if (noCurrentPoint()) { - return gFalse; - } - *x = pts[length - 1].x; - *y = pts[length - 1].y; - return gTrue; -} diff --git a/pdftops/SplashPath.h b/pdftops/SplashPath.h deleted file mode 100644 index 0e6fffbb7..000000000 --- a/pdftops/SplashPath.h +++ /dev/null @@ -1,112 +0,0 @@ -//======================================================================== -// -// SplashPath.h -// -//======================================================================== - -#ifndef SPLASHPATH_H -#define SPLASHPATH_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -//------------------------------------------------------------------------ -// SplashPathPoint -//------------------------------------------------------------------------ - -struct SplashPathPoint { - SplashCoord x, y; -}; - -//------------------------------------------------------------------------ -// SplashPath.flags -//------------------------------------------------------------------------ - -// first point on each subpath sets this flag -#define splashPathFirst 0x01 - -// last point on each subpath sets this flag -#define splashPathLast 0x02 - -// if the subpath is closed, its first and last points must be -// identical, and must set this flag -#define splashPathClosed 0x04 - -// curve control points set this flag -#define splashPathCurve 0x08 - -// clockwise arc center points set this flag -#define splashPathArcCW 0x10 - -//------------------------------------------------------------------------ -// SplashPath -//------------------------------------------------------------------------ - -class SplashPath { -public: - - // Create an empty path. - SplashPath(); - - // Copy a path. - SplashPath *copy() { return new SplashPath(this); } - - ~SplashPath(); - - // Append to . - void append(SplashPath *path); - - // Start a new subpath. - SplashError moveTo(SplashCoord x, SplashCoord y); - - // Add a line segment to the last subpath. - SplashError lineTo(SplashCoord x, SplashCoord y); - - // Add a third-order (cubic) Bezier curve segment to the last - // subpath. - SplashError curveTo(SplashCoord x1, SplashCoord y1, - SplashCoord x2, SplashCoord y2, - SplashCoord x3, SplashCoord y3); - - // Add a clockwise circular arc with center (xc, yc) and endpoint - // (x1, y1). - SplashError arcCWTo(SplashCoord x1, SplashCoord y1, - SplashCoord xc, SplashCoord yc); - - // Close the last subpath, adding a line segment if necessary. - SplashError close(); - - // Add (, ) to every point on this path. - void offset(SplashCoord dx, SplashCoord dy); - - // Get the points on the path. - int getLength() { return length; } - void getPoint(int i, double *x, double *y, Guchar *f) - { *x = pts[i].x; *y = pts[i].y; *f = flags[i]; } - - // Get the current point. - GBool getCurPt(SplashCoord *x, SplashCoord *y); - -private: - - SplashPath(SplashPath *path); - void grow(int nPts); - GBool noCurrentPoint() { return curSubpath == length; } - GBool onePointSubpath() { return curSubpath == length - 1; } - GBool openSubpath() { return curSubpath < length - 1; } - - SplashPathPoint *pts; // array of points - Guchar *flags; // array of flags - int length, size; // length/size of the pts and flags arrays - int curSubpath; // index of first point in last subpath - - friend class SplashXPath; - friend class Splash; -}; - -#endif diff --git a/pdftops/SplashPattern.cxx b/pdftops/SplashPattern.cxx deleted file mode 100644 index 38f399433..000000000 --- a/pdftops/SplashPattern.cxx +++ /dev/null @@ -1,68 +0,0 @@ -//======================================================================== -// -// SplashPattern.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include "SplashMath.h" -#include "SplashScreen.h" -#include "SplashPattern.h" - -//------------------------------------------------------------------------ -// SplashPattern -//------------------------------------------------------------------------ - -SplashPattern::SplashPattern() { -} - -SplashPattern::~SplashPattern() { -} - -//------------------------------------------------------------------------ -// SplashSolidColor -//------------------------------------------------------------------------ - -SplashSolidColor::SplashSolidColor(SplashColorPtr colorA) { - splashColorCopy(color, colorA); -} - -SplashSolidColor::~SplashSolidColor() { -} - -void SplashSolidColor::getColor(int x, int y, SplashColorPtr c) { - splashColorCopy(c, color); -} - -//------------------------------------------------------------------------ -// SplashHalftone -//------------------------------------------------------------------------ - -SplashHalftone::SplashHalftone(SplashColorPtr color0A, SplashColorPtr color1A, - SplashScreen *screenA, SplashCoord valueA) { - splashColorCopy(color0, color0A); - splashColorCopy(color1, color1A); - screen = screenA; - value = valueA; -} - -SplashPattern *SplashHalftone::copy() { - return new SplashHalftone(color0, color1, screen->copy(), value); -} - -SplashHalftone::~SplashHalftone() { - delete screen; -} - -void SplashHalftone::getColor(int x, int y, SplashColorPtr c) { - splashColorCopy(c, screen->test(x, y, value) ? color1 : color0); -} - -GBool SplashHalftone::isStatic() { - return screen->isStatic(value); -} diff --git a/pdftops/SplashPattern.h b/pdftops/SplashPattern.h deleted file mode 100644 index 1f43986e2..000000000 --- a/pdftops/SplashPattern.h +++ /dev/null @@ -1,90 +0,0 @@ -//======================================================================== -// -// SplashPattern.h -// -//======================================================================== - -#ifndef SPLASHPATTERN_H -#define SPLASHPATTERN_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -class SplashScreen; - -//------------------------------------------------------------------------ -// SplashPattern -//------------------------------------------------------------------------ - -class SplashPattern { -public: - - SplashPattern(); - - virtual SplashPattern *copy() = 0; - - virtual ~SplashPattern(); - - // Return the color value for a specific pixel. - virtual void getColor(int x, int y, SplashColorPtr c) = 0; - - // Returns true if this pattern object will return the same color - // value for all pixels. - virtual GBool isStatic() = 0; - -private: -}; - -//------------------------------------------------------------------------ -// SplashSolidColor -//------------------------------------------------------------------------ - -class SplashSolidColor: public SplashPattern { -public: - - SplashSolidColor(SplashColorPtr colorA); - - virtual SplashPattern *copy() { return new SplashSolidColor(color); } - - virtual ~SplashSolidColor(); - - virtual void getColor(int x, int y, SplashColorPtr c); - - virtual GBool isStatic() { return gTrue; } - -private: - - SplashColor color; -}; - -//------------------------------------------------------------------------ -// SplashHalftone -//------------------------------------------------------------------------ - -class SplashHalftone: public SplashPattern { -public: - - SplashHalftone(SplashColorPtr color0A, SplashColorPtr color1A, - SplashScreen *screenA, SplashCoord valueA); - - virtual SplashPattern *copy(); - - virtual ~SplashHalftone(); - - virtual void getColor(int x, int y, SplashColorPtr c); - - virtual GBool isStatic(); - -private: - - SplashColor color0, color1; - SplashScreen *screen; - SplashCoord value; -}; - -#endif diff --git a/pdftops/SplashScreen.cxx b/pdftops/SplashScreen.cxx deleted file mode 100644 index ca9804de8..000000000 --- a/pdftops/SplashScreen.cxx +++ /dev/null @@ -1,141 +0,0 @@ -//======================================================================== -// -// SplashScreen.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include "gmem.h" -#include "SplashMath.h" -#include "SplashScreen.h" - -//------------------------------------------------------------------------ -// SplashScreen -//------------------------------------------------------------------------ - -// This generates a 45 degree screen using a circular dot spot -// function. DPI = resolution / ((size / 2) * sqrt(2)). -// Gamma correction (gamma = 1 / 1.33) is also computed here. -SplashScreen::SplashScreen(int sizeA) { - SplashCoord *dist; - SplashCoord u, v, d, val; - int size2, x, y, x1, y1, i; - - size2 = sizeA >> 1; - if (size2 < 1) { - size2 = 1; - } - size = size2 << 1; - - // initialize the threshold matrix - mat = (SplashCoord *)gmallocn(size * size, sizeof(SplashCoord)); - for (y = 0; y < size; ++y) { - for (x = 0; x < size; ++x) { - mat[y * size + x] = -1; - } - } - - // build the distance matrix - dist = (SplashCoord *)gmallocn(size * size2, sizeof(SplashCoord)); - for (y = 0; y < size2; ++y) { - for (x = 0; x < size2; ++x) { - if (x + y < size2 - 1) { - u = (SplashCoord)x + 0.5 - 0; - v = (SplashCoord)y + 0.5 - 0; - } else { - u = (SplashCoord)x + 0.5 - (SplashCoord)size2; - v = (SplashCoord)y + 0.5 - (SplashCoord)size2; - } - dist[y * size2 + x] = u*u + v*v; - } - } - for (y = 0; y < size2; ++y) { - for (x = 0; x < size2; ++x) { - if (x < y) { - u = (SplashCoord)x + 0.5 - 0; - v = (SplashCoord)y + 0.5 - (SplashCoord)size2; - } else { - u = (SplashCoord)x + 0.5 - (SplashCoord)size2; - v = (SplashCoord)y + 0.5 - 0; - } - dist[(size2 + y) * size2 + x] = u*u + v*v; - } - } - - // build the threshold matrix - minVal = 1; - maxVal = 0; - x1 = y1 = 0; // make gcc happy - for (i = 1; i <= size * size2; ++i) { - d = size * size2; - for (y = 0; y < size; ++y) { - for (x = 0; x < size2; ++x) { - if (mat[y * size + x] < 0 && - dist[y * size2 + x] < d) { - x1 = x; - y1 = y; - d = dist[y1 * size2 + x1]; - } - } - } - u = (SplashCoord)1 - (SplashCoord)i / (SplashCoord)(size * size2 + 1); - val = splashPow(u, 1.33); - if (val < minVal) { - minVal = val; - } - if (val > maxVal) { - maxVal = val; - } - mat[y1 * size + x1] = val; - if (y1 < size2) { - mat[(y1 + size2) * size + x1 + size2] = val; - } else { - mat[(y1 - size2) * size + x1 + size2] = val; - } - } - - gfree(dist); -} - -SplashScreen::SplashScreen(SplashScreen *screen) { - int n; - - size = screen->size; - n = size * size * sizeof(SplashCoord); - mat = (SplashCoord *)gmalloc(n); - memcpy(mat, screen->mat, n); - minVal = screen->minVal; - maxVal = screen->maxVal; -} - -SplashScreen::~SplashScreen() { - gfree(mat); -} - -int SplashScreen::test(int x, int y, SplashCoord value) { - int xx, yy; - - if (value < minVal) { - return 0; - } - if (value >= maxVal) { - return 1; - } - if ((xx = x % size) < 0) { - xx = -xx; - } - if ((yy = y % size) < 0) { - yy = -yy; - } - return value < mat[yy * size + xx] ? 0 : 1; -} - -GBool SplashScreen::isStatic(SplashCoord value) { - return value < minVal || value >= maxVal; -} diff --git a/pdftops/SplashScreen.h b/pdftops/SplashScreen.h deleted file mode 100644 index d598e2eea..000000000 --- a/pdftops/SplashScreen.h +++ /dev/null @@ -1,50 +0,0 @@ -//======================================================================== -// -// SplashScreen.h -// -//======================================================================== - -#ifndef SPLASHSCREEN_H -#define SPLASHSCREEN_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -//------------------------------------------------------------------------ -// SplashScreen -//------------------------------------------------------------------------ - -class SplashScreen { -public: - - SplashScreen(int sizeA); - SplashScreen(SplashScreen *screen); - ~SplashScreen(); - - SplashScreen *copy() { return new SplashScreen(this); } - - // Return the computed pixel value (0=black, 1=white) for the gray - // level at (, ). - int test(int x, int y, SplashCoord value); - - // Returns true if value is above the white threshold or below the - // black threshold, i.e., if the corresponding halftone will be - // solid white or black. - GBool isStatic(SplashCoord value); - -private: - - SplashCoord *mat; // threshold matrix - int size; // size of the threshold matrix - SplashCoord minVal; // any pixel value below minVal generates - // solid black - SplashCoord maxVal; // any pixel value above maxVal generates - // solid white -}; - -#endif diff --git a/pdftops/SplashState.cxx b/pdftops/SplashState.cxx deleted file mode 100644 index 410ad27d8..000000000 --- a/pdftops/SplashState.cxx +++ /dev/null @@ -1,110 +0,0 @@ -//======================================================================== -// -// SplashState.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include "gmem.h" -#include "SplashPattern.h" -#include "SplashScreen.h" -#include "SplashClip.h" -#include "SplashState.h" - -//------------------------------------------------------------------------ -// SplashState -//------------------------------------------------------------------------ - -// number of components in each color mode -int splashColorModeNComps[] = { - 1, 1, 2, 3, 3, 4, 4 -}; - -SplashState::SplashState(int width, int height) { - SplashColor color; - - memset(&color, 0, sizeof(SplashColor)); - strokePattern = new SplashSolidColor(color); - fillPattern = new SplashSolidColor(color); - screen = new SplashScreen(10); - blendFunc = NULL; - strokeAlpha = 1; - fillAlpha = 1; - lineWidth = 0; - lineCap = splashLineCapButt; - lineJoin = splashLineJoinMiter; - miterLimit = 10; - flatness = 1; - lineDash = NULL; - lineDashLength = 0; - lineDashPhase = 0; - clip = new SplashClip(0, 0, width - 1, height - 1); - next = NULL; -} - -SplashState::SplashState(SplashState *state) { - strokePattern = state->strokePattern->copy(); - fillPattern = state->fillPattern->copy(); - screen = state->screen->copy(); - blendFunc = state->blendFunc; - strokeAlpha = state->strokeAlpha; - fillAlpha = state->fillAlpha; - lineWidth = state->lineWidth; - lineCap = state->lineCap; - lineJoin = state->lineJoin; - miterLimit = state->miterLimit; - flatness = state->flatness; - if (state->lineDash) { - lineDashLength = state->lineDashLength; - lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord)); - memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord)); - } else { - lineDash = NULL; - lineDashLength = 0; - } - lineDashPhase = state->lineDashPhase; - clip = state->clip->copy(); - next = NULL; -} - -SplashState::~SplashState() { - delete strokePattern; - delete fillPattern; - delete screen; - gfree(lineDash); - delete clip; -} - -void SplashState::setStrokePattern(SplashPattern *strokePatternA) { - delete strokePattern; - strokePattern = strokePatternA; -} - -void SplashState::setFillPattern(SplashPattern *fillPatternA) { - delete fillPattern; - fillPattern = fillPatternA; -} - -void SplashState::setScreen(SplashScreen *screenA) { - delete screen; - screen = screenA; -} - -void SplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA, - SplashCoord lineDashPhaseA) { - gfree(lineDash); - lineDashLength = lineDashLengthA; - if (lineDashLength > 0) { - lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord)); - memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord)); - } else { - lineDash = NULL; - } - lineDashPhase = lineDashPhaseA; -} diff --git a/pdftops/SplashState.h b/pdftops/SplashState.h deleted file mode 100644 index 5b886839b..000000000 --- a/pdftops/SplashState.h +++ /dev/null @@ -1,91 +0,0 @@ -//======================================================================== -// -// SplashState.h -// -//======================================================================== - -#ifndef SPLASHSTATE_H -#define SPLASHSTATE_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -class SplashPattern; -class SplashScreen; -class SplashClip; - -//------------------------------------------------------------------------ -// line cap values -//------------------------------------------------------------------------ - -#define splashLineCapButt 0 -#define splashLineCapRound 1 -#define splashLineCapProjecting 2 - -//------------------------------------------------------------------------ -// line join values -//------------------------------------------------------------------------ - -#define splashLineJoinMiter 0 -#define splashLineJoinRound 1 -#define splashLineJoinBevel 2 - -//------------------------------------------------------------------------ -// SplashState -//------------------------------------------------------------------------ - -class SplashState { -public: - - // Create a new state object, initialized with default settings. - SplashState(int width, int height); - - // Copy a state object. - SplashState *copy() { return new SplashState(this); } - - ~SplashState(); - - // Set the stroke pattern. This does not copy . - void setStrokePattern(SplashPattern *strokePatternA); - - // Set the fill pattern. This does not copy . - void setFillPattern(SplashPattern *fillPatternA); - - // Set the screen. This does not copy . - void setScreen(SplashScreen *screenA); - - // Set the line dash pattern. This copies the array. - void setLineDash(SplashCoord *lineDashA, int lineDashLengthA, - SplashCoord lineDashPhaseA); - -private: - - SplashState(SplashState *state); - - SplashPattern *strokePattern; - SplashPattern *fillPattern; - SplashScreen *screen; - SplashBlendFunc blendFunc; - SplashCoord strokeAlpha; - SplashCoord fillAlpha; - SplashCoord lineWidth; - int lineCap; - int lineJoin; - SplashCoord miterLimit; - SplashCoord flatness; - SplashCoord *lineDash; - int lineDashLength; - SplashCoord lineDashPhase; - SplashClip *clip; - - SplashState *next; // used by Splash class - - friend class Splash; -}; - -#endif diff --git a/pdftops/SplashT1Font.cxx b/pdftops/SplashT1Font.cxx deleted file mode 100644 index 10ef116d4..000000000 --- a/pdftops/SplashT1Font.cxx +++ /dev/null @@ -1,264 +0,0 @@ -//======================================================================== -// -// SplashT1Font.cc -// -//======================================================================== - -#include - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include -#include "gmem.h" -#include "SplashMath.h" -#include "SplashGlyphBitmap.h" -#include "SplashPath.h" -#include "SplashT1FontEngine.h" -#include "SplashT1FontFile.h" -#include "SplashT1Font.h" - -//------------------------------------------------------------------------ - -static Guchar bitReverse[256] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - -//------------------------------------------------------------------------ -// SplashT1Font -//------------------------------------------------------------------------ - -SplashT1Font::SplashT1Font(SplashT1FontFile *fontFileA, SplashCoord *matA): - SplashFont(fontFileA, matA, ((SplashT1FontFile *)fontFileA)->engine->aa) -{ - T1_TMATRIX matrix; - BBox bbox; - SplashCoord bbx0, bby0, bbx1, bby1; - int x, y; - - t1libID = T1_CopyFont(fontFileA->t1libID); - - // compute font size - size = (float)splashSqrt(mat[2]*mat[2] + mat[3]*mat[3]); - - // transform the four corners of the font bounding box -- the min - // and max values form the bounding box of the transformed font - bbox = T1_GetFontBBox(t1libID); - bbx0 = 0.001 * bbox.llx; - bby0 = 0.001 * bbox.lly; - bbx1 = 0.001 * bbox.urx; - bby1 = 0.001 * bbox.ury; - // some fonts are completely broken, so we fake it (with values - // large enough that most glyphs should fit) - if (bbx0 == 0 && bby0 == 0 && bbx1 == 0 && bby1 == 0) { - bbx0 = bby0 = -0.5; - bbx1 = bby1 = 1.5; - } - x = (int)(mat[0] * bbx0 + mat[2] * bby0); - xMin = xMax = x; - y = (int)(mat[1] * bbx0 + mat[3] * bby0); - yMin = yMax = y; - x = (int)(mat[0] * bbx0 + mat[2] * bby1); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)(mat[1] * bbx0 + mat[3] * bby1); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - x = (int)(mat[0] * bbx1 + mat[2] * bby0); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)(mat[1] * bbx1 + mat[3] * bby0); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - x = (int)(mat[0] * bbx1 + mat[2] * bby1); - if (x < xMin) { - xMin = x; - } else if (x > xMax) { - xMax = x; - } - y = (int)(mat[1] * bbx1 + mat[3] * bby1); - if (y < yMin) { - yMin = y; - } else if (y > yMax) { - yMax = y; - } - // This is a kludge: some buggy PDF generators embed fonts with - // zero bounding boxes. - if (xMax == xMin) { - xMin = 0; - xMax = (int)size; - } - if (yMax == yMin) { - yMin = 0; - yMax = (int)(1.2 * size); - } - // Another kludge: an unusually large xMin or yMin coordinate is - // probably wrong. - if (xMin > 0) { - xMin = 0; - } - if (yMin > 0) { - yMin = 0; - } - // Another kludge: t1lib doesn't correctly handle fonts with - // real (non-integer) bounding box coordinates. - if (xMax - xMin > 5000) { - xMin = 0; - xMax = (int)size; - } - if (yMax - yMin > 5000) { - yMin = 0; - yMax = (int)(1.2 * size); - } - - // transform the font - matrix.cxx = (double)mat[0] / size; - matrix.cxy = (double)mat[1] / size; - matrix.cyx = (double)mat[2] / size; - matrix.cyy = (double)mat[3] / size; - T1_TransformFont(t1libID, &matrix); -} - -SplashT1Font::~SplashT1Font() { - T1_DeleteFont(t1libID); -} - -GBool SplashT1Font::getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap) { - return SplashFont::getGlyph(c, 0, 0, bitmap); -} - -GBool SplashT1Font::makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap) { - GLYPH *glyph; - int n, i; - - if (aa) { - glyph = T1_AASetChar(t1libID, c, size, NULL); - } else { - glyph = T1_SetChar(t1libID, c, size, NULL); - } - if (!glyph) { - return gFalse; - } - - bitmap->x = -glyph->metrics.leftSideBearing; - bitmap->y = glyph->metrics.ascent; - bitmap->w = glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing; - bitmap->h = glyph->metrics.ascent - glyph->metrics.descent; - bitmap->aa = aa; - if (aa) { - bitmap->data = (Guchar *)glyph->bits; - bitmap->freeData = gFalse; - } else { - n = bitmap->h * ((bitmap->w + 7) >> 3); - bitmap->data = (Guchar *)gmalloc(n); - for (i = 0; i < n; ++i) { - bitmap->data[i] = bitReverse[glyph->bits[i] & 0xff]; - } - bitmap->freeData = gTrue; - } - - return gTrue; -} - -SplashPath *SplashT1Font::getGlyphPath(int c) { - SplashPath *path; - T1_OUTLINE *outline; - T1_PATHSEGMENT *seg; - T1_BEZIERSEGMENT *bez; - SplashCoord x, y, x1, y1; - GBool needClose; - - path = new SplashPath(); - if (!(outline = T1_GetCharOutline(t1libID, c, size, NULL))) { - return path; - } - x = 0; - y = 0; - needClose = gFalse; - for (seg = outline; seg; seg = seg->link) { - switch (seg->type) { - case T1_PATHTYPE_MOVE: - if (needClose) { - path->close(); - needClose = gFalse; - } - x += seg->dest.x / 65536.0; - y += seg->dest.y / 65536.0; - path->moveTo(x, y); - break; - case T1_PATHTYPE_LINE: - x += seg->dest.x / 65536.0; - y += seg->dest.y / 65536.0; - path->lineTo(x, y); - needClose = gTrue; - break; - case T1_PATHTYPE_BEZIER: - bez = (T1_BEZIERSEGMENT *)seg; - x1 = x + bez->dest.x / 65536.0; - y1 = y + bez->dest.y / 65536.0; - path->curveTo(x + bez->B.x / 65536.0, y + bez->B.y / 65536.0, - x + bez->C.x / 65536.0, y + bez->C.y / 65536.0, - x1, y1); - x = x1; - y = y1; - needClose = gTrue; - break; - } - } - if (needClose) { - path->close(); - } - T1_FreeOutline(outline); - return path; -} - -#endif // HAVE_T1LIB_H diff --git a/pdftops/SplashT1Font.h b/pdftops/SplashT1Font.h deleted file mode 100644 index 17dc858d2..000000000 --- a/pdftops/SplashT1Font.h +++ /dev/null @@ -1,53 +0,0 @@ -//======================================================================== -// -// SplashT1Font.h -// -//======================================================================== - -#ifndef SPLASHT1FONT_H -#define SPLASHT1FONT_H - -#include - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashFont.h" - -class SplashT1FontFile; - -//------------------------------------------------------------------------ -// SplashT1Font -//------------------------------------------------------------------------ - -class SplashT1Font: public SplashFont { -public: - - SplashT1Font(SplashT1FontFile *fontFileA, SplashCoord *matA); - - virtual ~SplashT1Font(); - - // Munge xFrac and yFrac before calling SplashFont::getGlyph. - virtual GBool getGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap); - - // Rasterize a glyph. The and values are the same - // as described for getGlyph. - virtual GBool makeGlyph(int c, int xFrac, int yFrac, - SplashGlyphBitmap *bitmap); - - // Return the path for a glyph. - virtual SplashPath *getGlyphPath(int c); - -private: - - int t1libID; // t1lib font ID - float size; -}; - -#endif // HAVE_T1LIB_H - -#endif diff --git a/pdftops/SplashT1FontEngine.cxx b/pdftops/SplashT1FontEngine.cxx deleted file mode 100644 index b88851fab..000000000 --- a/pdftops/SplashT1FontEngine.cxx +++ /dev/null @@ -1,124 +0,0 @@ -//======================================================================== -// -// SplashT1FontEngine.cc -// -//======================================================================== - -#include - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include -#ifndef WIN32 -# include -#endif -#include -#include "GString.h" -#include "gfile.h" -#include "FoFiType1C.h" -#include "SplashT1FontFile.h" -#include "SplashT1FontEngine.h" - -#ifdef VMS -#if (__VMS_VER < 70000000) -extern "C" int unlink(char *filename); -#endif -#endif - -//------------------------------------------------------------------------ - -int SplashT1FontEngine::t1libInitCount = 0; - -//------------------------------------------------------------------------ - -static void fileWrite(void *stream, char *data, int len) { - fwrite(data, 1, len, (FILE *)stream); -} - -//------------------------------------------------------------------------ -// SplashT1FontEngine -//------------------------------------------------------------------------ - -SplashT1FontEngine::SplashT1FontEngine(GBool aaA) { - aa = aaA; -} - -SplashT1FontEngine *SplashT1FontEngine::init(GBool aaA) { - // grayVals[i] = round(i * 255 / 16) - static unsigned long grayVals[17] = { - 0, 16, 32, 48, 64, 80, 96, 112, 128, 143, 159, 175, 191, 207, 223, 239, 255 - }; - - //~ for multithreading: need a mutex here - if (t1libInitCount == 0) { - T1_SetBitmapPad(8); - if (!T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE | - T1_NO_AFM)) { - return NULL; - } - if (aaA) { - T1_AASetBitsPerPixel(8); - T1_AASetLevel(T1_AA_HIGH); - T1_AAHSetGrayValues(grayVals); - } else { - T1_AANSetGrayValues(0, 1); - } - } - ++t1libInitCount; - - return new SplashT1FontEngine(aaA); -} - -SplashT1FontEngine::~SplashT1FontEngine() { - //~ for multithreading: need a mutex here - if (--t1libInitCount == 0) { - T1_CloseLib(); - } -} - -SplashFontFile *SplashT1FontEngine::loadType1Font(SplashFontFileID *idA, - char *fileName, - GBool deleteFile, - char **enc) { - return SplashT1FontFile::loadType1Font(this, idA, fileName, deleteFile, enc); -} - -SplashFontFile *SplashT1FontEngine::loadType1CFont(SplashFontFileID *idA, - char *fileName, - GBool deleteFile, - char **enc) { - FoFiType1C *ff; - GString *tmpFileName; - FILE *tmpFile; - SplashFontFile *ret; - - if (!(ff = FoFiType1C::load(fileName))) { - return NULL; - } - tmpFileName = NULL; - if (!openTempFile(&tmpFileName, &tmpFile, "wb", NULL)) { - delete ff; - return NULL; - } - ff->convertToType1(NULL, gTrue, &fileWrite, tmpFile); - delete ff; - fclose(tmpFile); - ret = SplashT1FontFile::loadType1Font(this, idA, tmpFileName->getCString(), - gTrue, enc); - if (ret) { - if (deleteFile) { - unlink(fileName); - } - } else { - unlink(tmpFileName->getCString()); - } - delete tmpFileName; - return ret; -} - -#endif // HAVE_T1LIB_H diff --git a/pdftops/SplashT1FontEngine.h b/pdftops/SplashT1FontEngine.h deleted file mode 100644 index 139e17610..000000000 --- a/pdftops/SplashT1FontEngine.h +++ /dev/null @@ -1,53 +0,0 @@ -//======================================================================== -// -// SplashT1FontEngine.h -// -//======================================================================== - -#ifndef SPLASHT1FONTENGINE_H -#define SPLASHT1FONTENGINE_H - -#include - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "gtypes.h" - -class SplashFontFile; -class SplashFontFileID; - -//------------------------------------------------------------------------ -// SplashT1FontEngine -//------------------------------------------------------------------------ - -class SplashT1FontEngine { -public: - - static SplashT1FontEngine *init(GBool aaA); - - ~SplashT1FontEngine(); - - // Load fonts. - SplashFontFile *loadType1Font(SplashFontFileID *idA, char *fileName, - GBool deleteFile, char **enc); - SplashFontFile *loadType1CFont(SplashFontFileID *idA, char *fileName, - GBool deleteFile, char **enc); - -private: - - SplashT1FontEngine(GBool aaA); - - static int t1libInitCount; - GBool aa; - - friend class SplashT1FontFile; - friend class SplashT1Font; -}; - -#endif // HAVE_T1LIB_H - -#endif diff --git a/pdftops/SplashT1FontFile.cxx b/pdftops/SplashT1FontFile.cxx deleted file mode 100644 index 5476b7fb8..000000000 --- a/pdftops/SplashT1FontFile.cxx +++ /dev/null @@ -1,96 +0,0 @@ -//======================================================================== -// -// SplashT1FontFile.cc -// -//======================================================================== - -#include - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include -#include "gmem.h" -#include "SplashT1FontEngine.h" -#include "SplashT1Font.h" -#include "SplashT1FontFile.h" - -//------------------------------------------------------------------------ -// SplashT1FontFile -//------------------------------------------------------------------------ - -SplashFontFile *SplashT1FontFile::loadType1Font(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - char *fileNameA, - GBool deleteFileA, - char **encA) { - int t1libIDA; - char **encTmp; - char *encStrTmp; - int encStrSize; - char *encPtr; - int i; - - // load the font file - if ((t1libIDA = T1_AddFont(fileNameA)) < 0) { - return NULL; - } - T1_LoadFont(t1libIDA); - - // reencode it - encStrSize = 0; - for (i = 0; i < 256; ++i) { - if (encA[i]) { - encStrSize += strlen(encA[i]) + 1; - } - } - encTmp = (char **)gmallocn(257, sizeof(char *)); - encStrTmp = (char *)gmallocn(encStrSize, sizeof(char)); - encPtr = encStrTmp; - for (i = 0; i < 256; ++i) { - if (encA[i]) { - strcpy(encPtr, encA[i]); - encTmp[i] = encPtr; - encPtr += strlen(encPtr) + 1; - } else { - encTmp[i] = ".notdef"; - } - } - encTmp[256] = "custom"; - T1_ReencodeFont(t1libIDA, encTmp); - - return new SplashT1FontFile(engineA, idA, fileNameA, deleteFileA, - t1libIDA, encTmp, encStrTmp); -} - -SplashT1FontFile::SplashT1FontFile(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - char *fileNameA, GBool deleteFileA, - int t1libIDA, char **encA, char *encStrA): - SplashFontFile(idA, fileNameA, deleteFileA) -{ - engine = engineA; - t1libID = t1libIDA; - enc = encA; - encStr = encStrA; -} - -SplashT1FontFile::~SplashT1FontFile() { - gfree(encStr); - gfree(enc); - T1_DeleteFont(t1libID); -} - -SplashFont *SplashT1FontFile::makeFont(SplashCoord *mat) { - SplashFont *font; - - font = new SplashT1Font(this, mat); - font->initCache(); - return font; -} - -#endif // HAVE_T1LIB_H diff --git a/pdftops/SplashT1FontFile.h b/pdftops/SplashT1FontFile.h deleted file mode 100644 index d5e490277..000000000 --- a/pdftops/SplashT1FontFile.h +++ /dev/null @@ -1,57 +0,0 @@ -//======================================================================== -// -// SplashT1FontFile.h -// -//======================================================================== - -#ifndef SPLASHT1FONTFILE_H -#define SPLASHT1FONTFILE_H - -#include - -#if HAVE_T1LIB_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashFontFile.h" - -class SplashT1FontEngine; - -//------------------------------------------------------------------------ -// SplashT1FontFile -//------------------------------------------------------------------------ - -class SplashT1FontFile: public SplashFontFile { -public: - - static SplashFontFile *loadType1Font(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - char *fileNameA, GBool deleteFileA, - char **encA); - - virtual ~SplashT1FontFile(); - - // Create a new SplashT1Font, i.e., a scaled instance of this font - // file. - virtual SplashFont *makeFont(SplashCoord *mat); - -private: - - SplashT1FontFile(SplashT1FontEngine *engineA, - SplashFontFileID *idA, - char *fileNameA, GBool deleteFileA, - int t1libIDA, char **encA, char *encStrA); - - SplashT1FontEngine *engine; - int t1libID; // t1lib font ID - char **enc; - char *encStr; - - friend class SplashT1Font; -}; - -#endif // HAVE_T1LIB_H - -#endif diff --git a/pdftops/SplashTypes.h b/pdftops/SplashTypes.h deleted file mode 100644 index 8ebc91368..000000000 --- a/pdftops/SplashTypes.h +++ /dev/null @@ -1,139 +0,0 @@ -//======================================================================== -// -// SplashTypes.h -// -//======================================================================== - -#ifndef SPLASHTYPES_H -#define SPLASHTYPES_H - -#include -#include "gtypes.h" - -//------------------------------------------------------------------------ -// coordinates -//------------------------------------------------------------------------ - -#if USE_FIXEDPOINT -#include "FixedPoint.h" -typedef FixedPoint SplashCoord; -#else -typedef double SplashCoord; -#endif - -//------------------------------------------------------------------------ -// colors -//------------------------------------------------------------------------ - -enum SplashColorMode { - splashModeMono1, // 1 bit per component, 8 pixels per byte, - // MSbit is on the left - splashModeMono8, // 1 byte per component, 1 byte per pixel - splashModeAMono8, // 1 byte per component, 2 bytes per pixel: - // AMAM... - splashModeRGB8, // 1 byte per component, 3 bytes per pixel: - // RGBRGB... - splashModeBGR8, // 1 byte per component, 3 bytes per pixel: - // BGRBGR... - splashModeARGB8, // 1 byte per component, 4 bytes per pixel: - // ARGBARGB... - splashModeBGRA8 // 1 byte per component, 4 bytes per pixel: - // BGRABGRA... -#if SPLASH_CMYK - , - splashModeCMYK8, // 1 byte per component, 4 bytes per pixel: - // CMYKCMYK... - splashModeACMYK8 // 1 byte per component, 5 bytes per pixel: - // ACMYKACMYK -#endif -}; - -// number of components in each color mode -// (defined in SplashState.cc) -extern int splashColorModeNComps[]; - -// max number of components in any SplashColor -#if SPLASH_CMYK -# define splashMaxColorComps 5 -#else -# define splashMaxColorComps 4 -#endif - -typedef Guchar SplashColor[splashMaxColorComps]; -typedef Guchar *SplashColorPtr; - -// AMono8 -static inline Guchar splashAMono8A(SplashColorPtr am8) { return am8[0]; } -static inline Guchar splashAMono8M(SplashColorPtr am8) { return am8[1]; } - -// RGB8 -static inline Guchar splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; } -static inline Guchar splashRGB8G(SplashColorPtr rgb8) { return rgb8[1]; } -static inline Guchar splashRGB8B(SplashColorPtr rgb8) { return rgb8[2]; } - -// BGR8 -static inline Guchar splashBGR8R(SplashColorPtr bgr8) { return bgr8[2]; } -static inline Guchar splashBGR8G(SplashColorPtr bgr8) { return bgr8[1]; } -static inline Guchar splashBGR8B(SplashColorPtr bgr8) { return bgr8[0]; } - -// ARGB8 -static inline Guchar splashARGB8A(SplashColorPtr argb8) { return argb8[0]; } -static inline Guchar splashARGB8R(SplashColorPtr argb8) { return argb8[1]; } -static inline Guchar splashARGB8G(SplashColorPtr argb8) { return argb8[2]; } -static inline Guchar splashARGB8B(SplashColorPtr argb8) { return argb8[3]; } - -// ARGB8 -static inline Guchar splashBGRA8A(SplashColorPtr bgra8) { return bgra8[3]; } -static inline Guchar splashBGRA8R(SplashColorPtr bgra8) { return bgra8[2]; } -static inline Guchar splashBGRA8G(SplashColorPtr bgra8) { return bgra8[1]; } -static inline Guchar splashBGRA8B(SplashColorPtr bgra8) { return bgra8[0]; } - -#if SPLASH_CMYK -// CMYK8 -static inline Guchar splashCMYK8C(SplashColorPtr cmyk8) { return cmyk8[0]; } -static inline Guchar splashCMYK8M(SplashColorPtr cmyk8) { return cmyk8[1]; } -static inline Guchar splashCMYK8Y(SplashColorPtr cmyk8) { return cmyk8[2]; } -static inline Guchar splashCMYK8K(SplashColorPtr cmyk8) { return cmyk8[3]; } - -// ACMYK8 -static inline Guchar splashACMYK8A(SplashColorPtr acmyk8) { return acmyk8[0]; } -static inline Guchar splashACMYK8C(SplashColorPtr acmyk8) { return acmyk8[1]; } -static inline Guchar splashACMYK8M(SplashColorPtr acmyk8) { return acmyk8[2]; } -static inline Guchar splashACMYK8Y(SplashColorPtr acmyk8) { return acmyk8[3]; } -static inline Guchar splashACMYK8K(SplashColorPtr acmyk8) { return acmyk8[4]; } -#endif - -static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) { - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; -#if SPLASH_CMYK - dest[4] = src[4]; -#endif -} - -static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) { - dest[0] ^= src[0]; - dest[1] ^= src[1]; - dest[2] ^= src[2]; - dest[3] ^= src[3]; -#if SPLASH_CMYK - dest[4] ^= src[4]; -#endif -} - -//------------------------------------------------------------------------ -// blend functions -//------------------------------------------------------------------------ - -typedef void (*SplashBlendFunc)(SplashColorPtr src, SplashColorPtr dest, - SplashColorPtr blend, SplashColorMode cm); - -//------------------------------------------------------------------------ -// error results -//------------------------------------------------------------------------ - -typedef int SplashError; - -#endif diff --git a/pdftops/SplashXPath.cxx b/pdftops/SplashXPath.cxx deleted file mode 100644 index 1dd02e2cb..000000000 --- a/pdftops/SplashXPath.cxx +++ /dev/null @@ -1,414 +0,0 @@ -//======================================================================== -// -// SplashXPath.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include -#include "gmem.h" -#include "SplashMath.h" -#include "SplashPath.h" -#include "SplashXPath.h" - -//------------------------------------------------------------------------ - -#define maxCurveSplits (1 << 10) - -//------------------------------------------------------------------------ -// SplashXPath -//------------------------------------------------------------------------ - -SplashXPath::SplashXPath() { - segs = NULL; - length = size = 0; -} - -SplashXPath::SplashXPath(SplashPath *path, SplashCoord flatness, - GBool closeSubpaths) { - SplashCoord xc, yc, dx, dy, r, x0, y0, x1, y1; - int quad0, quad1, quad; - int curSubpath, n, i, j; - - segs = NULL; - length = size = 0; - - i = 0; - curSubpath = 0; - while (i < path->length) { - - // first point in subpath - skip it - if (path->flags[i] & splashPathFirst) { - curSubpath = i; - ++i; - - } else { - - // curve segment - if (path->flags[i] & splashPathCurve) { - addCurve(path->pts[i-1].x, path->pts[i-1].y, - path->pts[i ].x, path->pts[i ].y, - path->pts[i+1].x, path->pts[i+1].y, - path->pts[i+2].x, path->pts[i+2].y, - flatness, - (path->flags[i-1] & splashPathFirst), - (path->flags[i+2] & splashPathLast), - !closeSubpaths && - (path->flags[i-1] & splashPathFirst) && - !(path->flags[i-1] & splashPathClosed), - !closeSubpaths && - (path->flags[i+2] & splashPathLast) && - !(path->flags[i+2] & splashPathClosed)); - i += 3; - - // clockwise circular arc - } else if (path->flags[i] & splashPathArcCW) { - xc = path->pts[i].x; - yc = path->pts[i].y; - dx = path->pts[i+1].x - xc; - dy = path->pts[i+1].y - yc; - r = splashSqrt(dx * dx + dy * dy); - if (path->pts[i-1].x < xc && path->pts[i-1].y <= yc) { - quad0 = 0; - } else if (path->pts[i-1].x >= xc && path->pts[i-1].y < yc) { - quad0 = 1; - } else if (path->pts[i-1].x > xc && path->pts[i-1].y >= yc) { - quad0 = 2; - } else { - quad0 = 3; - } - if (path->pts[i+1].x <= xc && path->pts[i+1].y < yc) { - quad1 = 0; - } else if (path->pts[i+1].x > xc && path->pts[i+1].y <= yc) { - quad1 = 1; - } else if (path->pts[i+1].x >= xc && path->pts[i+1].y > yc) { - quad1 = 2; - } else { - quad1 = 3; - } - n = 0; // make gcc happy - if (quad0 == quad1) { - switch (quad0) { - case 0: - case 1: n = path->pts[i-1].x < path->pts[i+1].x ? 0 : 4; break; - case 2: - case 3: n = path->pts[i-1].x > path->pts[i+1].x ? 0 : 4; break; - } - } else { - n = (quad1 - quad0) & 3; - } - x0 = path->pts[i-1].x; - y0 = path->pts[i-1].y; - x1 = y1 = 0; // make gcc happy - quad = quad0; - for (j = 0; j < n; ++j) { - switch (quad) { - case 0: x1 = xc; y1 = yc - r; break; - case 1: x1 = xc + r; y1 = yc; break; - case 2: x1 = xc; y1 = yc + r; break; - case 3: x1 = xc - r; y1 = yc; break; - } - addArc(x0, y0, x1, y1, - xc, yc, r, quad, flatness, - quad == quad0 && (path->flags[i-1] & splashPathFirst), - gFalse, - quad == quad0 && !closeSubpaths && - (path->flags[i-1] & splashPathFirst) && - !(path->flags[i-1] & splashPathClosed), - gFalse); - x0 = x1; - y0 = y1; - quad = (quad + 1) & 3; - } - addArc(x0, y0, path->pts[i+1].x, path->pts[i+1].y, - xc, yc, r, quad, flatness, - quad == quad0 && (path->flags[i-1] & splashPathFirst), - (path->flags[i+1] & splashPathLast), - quad == quad0 && !closeSubpaths && - (path->flags[i-1] & splashPathFirst) && - !(path->flags[i-1] & splashPathClosed), - !closeSubpaths && - (path->flags[i+1] & splashPathLast) && - !(path->flags[i+1] & splashPathClosed)); - i += 2; - - // line segment - } else { - addSegment(path->pts[i-1].x, path->pts[i-1].y, - path->pts[i].x, path->pts[i].y, - path->flags[i-1] & splashPathFirst, - path->flags[i] & splashPathLast, - !closeSubpaths && - (path->flags[i-1] & splashPathFirst) && - !(path->flags[i-1] & splashPathClosed), - !closeSubpaths && - (path->flags[i] & splashPathLast) && - !(path->flags[i] & splashPathClosed)); - ++i; - } - - // close a subpath - if (closeSubpaths && - (path->flags[i-1] & splashPathLast) && - (path->pts[i-1].x != path->pts[curSubpath].x || - path->pts[i-1].y != path->pts[curSubpath]. y)) { - addSegment(path->pts[i-1].x, path->pts[i-1].y, - path->pts[curSubpath].x, path->pts[curSubpath].y, - gFalse, gTrue, gFalse, gFalse); - } - } - } -} - -SplashXPath::SplashXPath(SplashXPath *xPath) { - length = xPath->length; - size = xPath->size; - segs = (SplashXPathSeg *)gmallocn(size, sizeof(SplashXPathSeg)); - memcpy(segs, xPath->segs, length * sizeof(SplashXPathSeg)); -} - -SplashXPath::~SplashXPath() { - gfree(segs); -} - -// Add space for more segments -void SplashXPath::grow(int nSegs) { - if (length + nSegs > size) { - if (size == 0) { - size = 32; - } - while (size < length + nSegs) { - size *= 2; - } - segs = (SplashXPathSeg *)greallocn(segs, size, sizeof(SplashXPathSeg)); - } -} - -void SplashXPath::addCurve(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - SplashCoord x2, SplashCoord y2, - SplashCoord x3, SplashCoord y3, - SplashCoord flatness, - GBool first, GBool last, GBool end0, GBool end1) { - SplashCoord cx[maxCurveSplits + 1][3]; - SplashCoord cy[maxCurveSplits + 1][3]; - int cNext[maxCurveSplits + 1]; - SplashCoord xl0, xl1, xl2, xr0, xr1, xr2, xr3, xx1, xx2, xh; - SplashCoord yl0, yl1, yl2, yr0, yr1, yr2, yr3, yy1, yy2, yh; - SplashCoord dx, dy, mx, my, d1, d2, flatness2; - int p1, p2, p3; - - flatness2 = flatness * flatness; - - // initial segment - p1 = 0; - p2 = maxCurveSplits; - cx[p1][0] = x0; cy[p1][0] = y0; - cx[p1][1] = x1; cy[p1][1] = y1; - cx[p1][2] = x2; cy[p1][2] = y2; - cx[p2][0] = x3; cy[p2][0] = y3; - cNext[p1] = p2; - - while (p1 < maxCurveSplits) { - - // get the next segment - xl0 = cx[p1][0]; yl0 = cy[p1][0]; - xx1 = cx[p1][1]; yy1 = cy[p1][1]; - xx2 = cx[p1][2]; yy2 = cy[p1][2]; - p2 = cNext[p1]; - xr3 = cx[p2][0]; yr3 = cy[p2][0]; - - // compute the distances from the control points to the - // midpoint of the straight line (this is a bit of a hack, but - // it's much faster than computing the actual distances to the - // line) - mx = (xl0 + xr3) * 0.5; - my = (yl0 + yr3) * 0.5; - dx = xx1 - mx; - dy = yy1 - my; - d1 = dx*dx + dy*dy; - dx = xx2 - mx; - dy = yy2 - my; - d2 = dx*dx + dy*dy; - - // if the curve is flat enough, or no more subdivisions are - // allowed, add the straight line segment - if (p2 - p1 == 1 || (d1 <= flatness2 && d2 <= flatness2)) { - addSegment(xl0, yl0, xr3, yr3, - p1 == 0 && first, - p2 == maxCurveSplits && last, - p1 == 0 && end0, - p2 == maxCurveSplits && end1); - p1 = p2; - - // otherwise, subdivide the curve - } else { - xl1 = (xl0 + xx1) * 0.5; - yl1 = (yl0 + yy1) * 0.5; - xh = (xx1 + xx2) * 0.5; - yh = (yy1 + yy2) * 0.5; - xl2 = (xl1 + xh) * 0.5; - yl2 = (yl1 + yh) * 0.5; - xr2 = (xx2 + xr3) * 0.5; - yr2 = (yy2 + yr3) * 0.5; - xr1 = (xh + xr2) * 0.5; - yr1 = (yh + yr2) * 0.5; - xr0 = (xl2 + xr1) * 0.5; - yr0 = (yl2 + yr1) * 0.5; - // add the new subdivision points - p3 = (p1 + p2) / 2; - cx[p1][1] = xl1; cy[p1][1] = yl1; - cx[p1][2] = xl2; cy[p1][2] = yl2; - cNext[p1] = p3; - cx[p3][0] = xr0; cy[p3][0] = yr0; - cx[p3][1] = xr1; cy[p3][1] = yr1; - cx[p3][2] = xr2; cy[p3][2] = yr2; - cNext[p3] = p2; - } - } -} - -void SplashXPath::addArc(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - SplashCoord xc, SplashCoord yc, - SplashCoord r, int quad, - SplashCoord flatness, - GBool first, GBool last, GBool end0, GBool end1) { - SplashCoord px[maxCurveSplits + 1]; - SplashCoord py[maxCurveSplits + 1]; - int pNext[maxCurveSplits + 1]; - SplashCoord r2, flatness2; - SplashCoord xx0, yy0, xx1, yy1, xm, ym, t, dx, dy; - int p1, p2, p3; - - r2 = r * r; - flatness2 = flatness * flatness; - - // initial segment - p1 = 0; - p2 = maxCurveSplits; - px[p1] = x0; py[p1] = y0; - px[p2] = x1; py[p2] = y1; - pNext[p1] = p2; - - while (p1 < maxCurveSplits) { - - // get the next segment - xx0 = px[p1]; yy0 = py[p1]; - p2 = pNext[p1]; - xx1 = px[p2]; yy1 = py[p2]; - - // compute the arc midpoint - t = (xx0 - xc) * (xx1 - xc) - (yy0 - yc) * (yy1 - yc); - xm = splashSqrt((SplashCoord)0.5 * (r2 + t)); - ym = splashSqrt((SplashCoord)0.5 * (r2 - t)); - switch (quad) { - case 0: xm = xc - xm; ym = yc - ym; break; - case 1: xm = xc + xm; ym = yc - ym; break; - case 2: xm = xc + xm; ym = yc + ym; break; - case 3: xm = xc - xm; ym = yc + ym; break; - } - - // compute distance from midpoint of straight segment to midpoint - // of arc - dx = (SplashCoord)0.5 * (xx0 + xx1) - xm; - dy = (SplashCoord)0.5 * (yy0 + yy1) - ym; - - // if the arc is flat enough, or no more subdivisions are allowed, - // add the straight line segment - if (p2 - p1 == 1 || dx * dx + dy * dy <= flatness2) { - addSegment(xx0, yy0, xx1, yy1, - p1 == 0 && first, - p2 == maxCurveSplits && last, - p1 == 0 && end0, - p2 == maxCurveSplits && end1); - p1 = p2; - - // otherwise, subdivide the arc - } else { - p3 = (p1 + p2) / 2; - px[p3] = xm; - py[p3] = ym; - pNext[p1] = p3; - pNext[p3] = p2; - } - } -} - -void SplashXPath::addSegment(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - GBool first, GBool last, GBool end0, GBool end1) { - grow(1); - segs[length].x0 = x0; - segs[length].y0 = y0; - segs[length].x1 = x1; - segs[length].y1 = y1; - segs[length].flags = 0; - if (first) { - segs[length].flags |= splashXPathFirst; - } - if (last) { - segs[length].flags |= splashXPathLast; - } - if (end0) { - segs[length].flags |= splashXPathEnd0; - } - if (end1) { - segs[length].flags |= splashXPathEnd1; - } - if (y1 == y0) { - segs[length].dxdy = segs[length].dydx = 0; - segs[length].flags |= splashXPathHoriz; - if (x1 == x0) { - segs[length].flags |= splashXPathVert; - } - } else if (x1 == x0) { - segs[length].dxdy = segs[length].dydx = 0; - segs[length].flags |= splashXPathVert; - } else { - segs[length].dxdy = (x1 - x0) / (y1 - y0); - segs[length].dydx = (SplashCoord)1 / segs[length].dxdy; - } - if (y0 > y1) { - segs[length].flags |= splashXPathFlip; - } - ++length; -} - -static int cmpXPathSegs(const void *arg0, const void *arg1) { - SplashXPathSeg *seg0 = (SplashXPathSeg *)arg0; - SplashXPathSeg *seg1 = (SplashXPathSeg *)arg1; - SplashCoord x0, y0, x1, y1; - - if (seg0->flags & splashXPathFlip) { - x0 = seg0->x1; - y0 = seg0->y1; - } else { - x0 = seg0->x0; - y0 = seg0->y0; - } - if (seg1->flags & splashXPathFlip) { - x1 = seg1->x1; - y1 = seg1->y1; - } else { - x1 = seg1->x0; - y1 = seg1->y0; - } - if (y0 != y1) { - return (y0 > y1) ? 1 : -1; - } - if (x0 != x1) { - return (x0 > x1) ? 1 : -1; - } - return 0; -} - -void SplashXPath::sort() { - qsort(segs, length, sizeof(SplashXPathSeg), &cmpXPathSegs); -} diff --git a/pdftops/SplashXPath.h b/pdftops/SplashXPath.h deleted file mode 100644 index 910e3e024..000000000 --- a/pdftops/SplashXPath.h +++ /dev/null @@ -1,92 +0,0 @@ -//======================================================================== -// -// SplashXPath.h -// -//======================================================================== - -#ifndef SPLASHXPATH_H -#define SPLASHXPATH_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -class SplashPath; - -//------------------------------------------------------------------------ -// SplashXPathSeg -//------------------------------------------------------------------------ - -struct SplashXPathSeg { - SplashCoord x0, y0; // first endpoint - SplashCoord x1, y1; // second endpoint - SplashCoord dxdy; // slope: delta-x / delta-y - SplashCoord dydx; // slope: delta-y / delta-x - Guint flags; -}; - -#define splashXPathFirst 0x01 // first segment of a subpath -#define splashXPathLast 0x02 // last segment of a subpath -#define splashXPathEnd0 0x04 // first endpoint is end of an open subpath -#define splashXPathEnd1 0x08 // second endpoint is end of an open subpath -#define splashXPathHoriz 0x10 // segment is vertical (y0 == y1) - // (dxdy is undef) -#define splashXPathVert 0x20 // segment is horizontal (x0 == x1) - // (dydx is undef) -#define splashXPathFlip 0x40 // y0 > y1 - -//------------------------------------------------------------------------ -// SplashXPath -//------------------------------------------------------------------------ - -class SplashXPath { -public: - - // Expands (converts to segments) and flattens (converts curves to - // lines) . If is true, closes all open - // subpaths. - SplashXPath(SplashPath *path, SplashCoord flatness, - GBool closeSubpaths); - - // Copy an expanded path. - SplashXPath *copy() { return new SplashXPath(this); } - - ~SplashXPath(); - - // Sort by upper coordinate (lower y), in y-major order. - void sort(); - -private: - - SplashXPath(); - SplashXPath(SplashXPath *xPath); - void grow(int nSegs); - void addCurve(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - SplashCoord x2, SplashCoord y2, - SplashCoord x3, SplashCoord y3, - SplashCoord flatness, - GBool first, GBool last, GBool end0, GBool end1); - void addArc(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - SplashCoord xc, SplashCoord yc, - SplashCoord r, int quad, - SplashCoord flatness, - GBool first, GBool last, GBool end0, GBool end1); - void addSegment(SplashCoord x0, SplashCoord y0, - SplashCoord x1, SplashCoord y1, - GBool first, GBool last, GBool end0, GBool end1); - - SplashXPathSeg *segs; - int length, size; // length and size of segs array - - friend class SplashXPathScanner; - friend class SplashClip; - friend class Splash; -}; - -#endif diff --git a/pdftops/SplashXPathScanner.cxx b/pdftops/SplashXPathScanner.cxx deleted file mode 100644 index d5b3048f6..000000000 --- a/pdftops/SplashXPathScanner.cxx +++ /dev/null @@ -1,285 +0,0 @@ -//======================================================================== -// -// SplashXPathScanner.cc -// -//======================================================================== - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include -#include "gmem.h" -#include "SplashMath.h" -#include "SplashXPath.h" -#include "SplashXPathScanner.h" - -//------------------------------------------------------------------------ - -struct SplashIntersect { - int x0, x1; // intersection of segment with [y, y+1) - int count; // EO/NZWN counter increment -}; - -static int cmpIntersect(const void *p0, const void *p1) { - return ((SplashIntersect *)p0)->x0 - ((SplashIntersect *)p1)->x0; -} - -//------------------------------------------------------------------------ -// SplashXPathScanner -//------------------------------------------------------------------------ - -SplashXPathScanner::SplashXPathScanner(SplashXPath *xPathA, GBool eoA) { - SplashXPathSeg *seg; - SplashCoord xMinFP, yMinFP, xMaxFP, yMaxFP; - int i; - - xPath = xPathA; - eo = eoA; - - // compute the bbox - if (xPath->length == 0) { - xMin = yMin = 1; - xMax = yMax = 0; - } else { - seg = &xPath->segs[0]; - if (seg->x0 <= seg->x1) { - xMinFP = seg->x0; - xMaxFP = seg->x1; - } else { - xMinFP = seg->x1; - xMaxFP = seg->x0; - } - if (seg->flags & splashXPathFlip) { - yMinFP = seg->y1; - yMaxFP = seg->y0; - } else { - yMinFP = seg->y0; - yMaxFP = seg->y1; - } - for (i = 1; i < xPath->length; ++i) { - seg = &xPath->segs[i]; - if (seg->x0 < xMinFP) { - xMinFP = seg->x0; - } else if (seg->x0 > xMaxFP) { - xMaxFP = seg->x0; - } - if (seg->x1 < xMinFP) { - xMinFP = seg->x1; - } else if (seg->x1 > xMaxFP) { - xMaxFP = seg->x1; - } - if (seg->flags & splashXPathFlip) { - if (seg->y0 > yMaxFP) { - yMaxFP = seg->y0; - } - } else { - if (seg->y1 > yMaxFP) { - yMaxFP = seg->y1; - } - } - } - xMin = splashFloor(xMinFP); - xMax = splashFloor(xMaxFP); - yMin = splashFloor(yMinFP); - yMax = splashFloor(yMaxFP); - } - - interY = yMin - 1; - xPathIdx = 0; - inter = NULL; - interLen = interSize = 0; -} - -SplashXPathScanner::~SplashXPathScanner() { - gfree(inter); -} - -void SplashXPathScanner::getSpanBounds(int y, int *spanXMin, int *spanXMax) { - if (interY != y) { - computeIntersections(y); - } - if (interLen > 0) { - *spanXMin = inter[0].x0; - *spanXMax = inter[interLen - 1].x1; - } else { - *spanXMin = xMax + 1; - *spanXMax = xMax; - } -} - -GBool SplashXPathScanner::test(int x, int y) { - int count, i; - - if (interY != y) { - computeIntersections(y); - } - count = 0; - for (i = 0; i < interLen && inter[i].x0 <= x; ++i) { - if (x <= inter[i].x1) { - return gTrue; - } - count += inter[i].count; - } - return eo ? (count & 1) : (count != 0); -} - -GBool SplashXPathScanner::testSpan(int x0, int x1, int y) { - int count, xx1, i; - - if (interY != y) { - computeIntersections(y); - } - - count = 0; - for (i = 0; i < interLen && inter[i].x1 < x0; ++i) { - count += inter[i].count; - } - - // invariant: the subspan [x0,xx1] is inside the path - xx1 = x0 - 1; - while (xx1 < x1) { - if (i >= interLen) { - return gFalse; - } - if (inter[i].x0 > xx1 + 1 && - !(eo ? (count & 1) : (count != 0))) { - return gFalse; - } - if (inter[i].x1 > xx1) { - xx1 = inter[i].x1; - } - count += inter[i].count; - ++i; - } - - return gTrue; -} - -GBool SplashXPathScanner::getNextSpan(int y, int *x0, int *x1) { - int xx0, xx1; - - if (interY != y) { - computeIntersections(y); - } - if (interIdx >= interLen) { - return gFalse; - } - xx0 = inter[interIdx].x0; - xx1 = inter[interIdx].x1; - interCount += inter[interIdx].count; - ++interIdx; - while (interIdx < interLen && - (inter[interIdx].x0 <= xx1 || - (eo ? (interCount & 1) : (interCount != 0)))) { - if (inter[interIdx].x1 > xx1) { - xx1 = inter[interIdx].x1; - } - interCount += inter[interIdx].count; - ++interIdx; - } - *x0 = xx0; - *x1 = xx1; - return gTrue; -} - -void SplashXPathScanner::computeIntersections(int y) { - SplashCoord xSegMin, xSegMax, ySegMin, ySegMax, xx0, xx1; - SplashXPathSeg *seg; - int i, j; - - // find the first segment that intersects [y, y+1) - i = (y >= interY) ? xPathIdx : 0; - while (i < xPath->length && - xPath->segs[i].y0 < y && xPath->segs[i].y1 < y) { - ++i; - } - xPathIdx = i; - - // find all of the segments that intersect [y, y+1) and create an - // Intersect element for each one - interLen = 0; - for (j = i; j < xPath->length; ++j) { - seg = &xPath->segs[j]; - if (seg->flags & splashXPathFlip) { - ySegMin = seg->y1; - ySegMax = seg->y0; - } else { - ySegMin = seg->y0; - ySegMax = seg->y1; - } - - // ensure that: ySegMin < y+1 - // y <= ySegMax - if (ySegMin >= y + 1) { - break; - } - if (ySegMax < y) { - continue; - } - - if (interLen == interSize) { - if (interSize == 0) { - interSize = 16; - } else { - interSize *= 2; - } - inter = (SplashIntersect *)greallocn(inter, interSize, - sizeof(SplashIntersect)); - } - - if (seg->flags & splashXPathHoriz) { - xx0 = seg->x0; - xx1 = seg->x1; - } else if (seg->flags & splashXPathVert) { - xx0 = xx1 = seg->x0; - } else { - if (seg->x0 < seg->x1) { - xSegMin = seg->x0; - xSegMax = seg->x1; - } else { - xSegMin = seg->x1; - xSegMax = seg->x0; - } - // intersection with top edge - xx0 = seg->x0 + ((SplashCoord)y - seg->y0) * seg->dxdy; - // intersection with bottom edge - xx1 = seg->x0 + ((SplashCoord)y + 1 - seg->y0) * seg->dxdy; - // the segment may not actually extend to the top and/or bottom edges - if (xx0 < xSegMin) { - xx0 = xSegMin; - } else if (xx0 > xSegMax) { - xx0 = xSegMax; - } - if (xx1 < xSegMin) { - xx1 = xSegMin; - } else if (xx1 > xSegMax) { - xx1 = xSegMax; - } - } - if (xx0 < xx1) { - inter[interLen].x0 = splashFloor(xx0); - inter[interLen].x1 = splashFloor(xx1); - } else { - inter[interLen].x0 = splashFloor(xx1); - inter[interLen].x1 = splashFloor(xx0); - } - if (ySegMin <= y && - (SplashCoord)y < ySegMax && - !(seg->flags & splashXPathHoriz)) { - inter[interLen].count = eo ? 1 - : (seg->flags & splashXPathFlip) ? 1 : -1; - } else { - inter[interLen].count = 0; - } - ++interLen; - } - - qsort(inter, interLen, sizeof(SplashIntersect), &cmpIntersect); - - interY = y; - interIdx = 0; - interCount = 0; -} diff --git a/pdftops/SplashXPathScanner.h b/pdftops/SplashXPathScanner.h deleted file mode 100644 index 6b65203d9..000000000 --- a/pdftops/SplashXPathScanner.h +++ /dev/null @@ -1,74 +0,0 @@ -//======================================================================== -// -// SplashXPathScanner.h -// -//======================================================================== - -#ifndef SPLASHXPATHSCANNER_H -#define SPLASHXPATHSCANNER_H - -#include - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "SplashTypes.h" - -class SplashXPath; -struct SplashIntersect; - -//------------------------------------------------------------------------ -// SplashXPathScanner -//------------------------------------------------------------------------ - -class SplashXPathScanner { -public: - - // Create a new SplashXPathScanner object. must be sorted. - SplashXPathScanner(SplashXPath *xPathA, GBool eoA); - - ~SplashXPathScanner(); - - // Return the path's bounding box. - void getBBox(int *xMinA, int *yMinA, int *xMaxA, int *yMaxA) - { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; } - - // Return the min/max x values for the span at . - void getSpanBounds(int y, int *spanXMin, int *spanXMax); - - // Returns true if (,) is inside the path. - GBool test(int x, int y); - - // Returns true if the entire span ([,], ) is inside the - // path. - GBool testSpan(int x0, int x1, int y); - - // Returns the next span inside the path at . If is - // different than the previous call to getNextSpan, this returns the - // first span at ; otherwise it returns the next span (relative - // to the previous call to getNextSpan). Returns false if there are - // no more spans at . - GBool getNextSpan(int y, int *x0, int *x1); - -private: - - void computeIntersections(int y); - - SplashXPath *xPath; - GBool eo; - int xMin, yMin, xMax, yMax; - - int interY; // current y value - int interIdx; // current index into - used by - // getNextSpan - int interCount; // current EO/NZWN counter - used by - // getNextSpan - int xPathIdx; // current index into - used by - // computeIntersections - SplashIntersect *inter; // intersections array for - int interLen; // number of intersections in - int interSize; // size of the array -}; - -#endif diff --git a/scheduler/auth.c b/scheduler/auth.c index e87f201e0..78e82d52e 100644 --- a/scheduler/auth.c +++ b/scheduler/auth.c @@ -1,5 +1,5 @@ /* - * "$Id: auth.c 5442 2006-04-20 14:00:02Z mike $" + * "$Id: auth.c 5464 2006-04-26 01:34:14Z mike $" * * Authorization routines for the Common UNIX Printing System (CUPS). * @@ -1621,6 +1621,7 @@ cupsdIsAuthorized(cupsd_client_t *con, /* I - Connection */ */ if (best->encryption >= HTTP_ENCRYPT_REQUIRED && !con->http.tls && + strcasecmp(con->http.hostname, "localhost") && best->satisfy == AUTH_SATISFY_ALL) { cupsdLogMessage(CUPSD_LOG_DEBUG2, @@ -2166,5 +2167,5 @@ to64(char *s, /* O - Output string */ /* - * End of "$Id: auth.c 5442 2006-04-20 14:00:02Z mike $". + * End of "$Id: auth.c 5464 2006-04-26 01:34:14Z mike $". */ diff --git a/scheduler/client.c b/scheduler/client.c index ffd3e8f61..e174223db 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -1,5 +1,5 @@ /* - * "$Id: client.c 5416 2006-04-17 21:24:17Z mike $" + * "$Id: client.c 5491 2006-05-04 20:53:35Z mike $" * * Client routines for the Common UNIX Printing System (CUPS) scheduler. * @@ -42,7 +42,7 @@ * is_path_absolute() - Is a path absolute and free of relative elements. * make_certificate() - Make a self-signed SSL/TLS certificate. * pipe_command() - Pipe the output of a command to the remote client. - * send_file() - Send a file via HTTP. + * write_file() - Send a file via HTTP. */ /* @@ -83,9 +83,9 @@ static void make_certificate(void); #endif /* HAVE_GNUTLS */ static int pipe_command(cupsd_client_t *con, int infile, int *outfile, char *command, char *options, int root); -static int send_file(cupsd_client_t *con, http_status_t code, - char *filename, char *type, - struct stat *filestats); +static int write_file(cupsd_client_t *con, http_status_t code, + char *filename, char *type, + struct stat *filestats); /* @@ -1264,7 +1264,7 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ else snprintf(line, sizeof(line), "%s/%s", type->super, type->type); - if (!send_file(con, HTTP_OK, filename, line, &filestats)) + if (!write_file(con, HTTP_OK, filename, line, &filestats)) return (cupsdCloseClient(con)); } } @@ -3701,7 +3701,7 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */ * Tell the CGI if we are using encryption... */ - if (con->http.encryption == HTTP_ENCRYPT_ALWAYS) + if (con->http.tls) envp[envc ++] = "HTTPS=ON"; /* @@ -3772,19 +3772,19 @@ pipe_command(cupsd_client_t *con, /* I - Client connection */ /* - * 'send_file()' - Send a file via HTTP. + * 'write_file()' - Send a file via HTTP. */ static int /* O - 0 on failure, 1 on success */ -send_file(cupsd_client_t *con, /* I - Client connection */ - http_status_t code, /* I - HTTP status */ - char *filename, /* I - Filename */ - char *type, /* I - File type */ - struct stat *filestats) /* O - File information */ +write_file(cupsd_client_t *con, /* I - Client connection */ + http_status_t code, /* I - HTTP status */ + char *filename, /* I - Filename */ + char *type, /* I - File type */ + struct stat *filestats) /* O - File information */ { con->file = open(filename, O_RDONLY); - cupsdLogMessage(CUPSD_LOG_DEBUG, "send_file: %d file=%d", con->http.fd, + cupsdLogMessage(CUPSD_LOG_DEBUG, "write_file: %d file=%d", con->http.fd, con->file); if (con->file < 0) @@ -3815,7 +3815,7 @@ send_file(cupsd_client_t *con, /* I - Client connection */ con->http._data_remaining = INT_MAX; cupsdLogMessage(CUPSD_LOG_DEBUG2, - "send_file: Adding fd %d to OutputSet...", con->http.fd); + "write_file: Adding fd %d to OutputSet...", con->http.fd); FD_SET(con->http.fd, OutputSet); @@ -3824,5 +3824,5 @@ send_file(cupsd_client_t *con, /* I - Client connection */ /* - * End of "$Id: client.c 5416 2006-04-17 21:24:17Z mike $". + * End of "$Id: client.c 5491 2006-05-04 20:53:35Z mike $". */ diff --git a/scheduler/conf.c b/scheduler/conf.c index 4b2fc5da3..69c013de7 100644 --- a/scheduler/conf.c +++ b/scheduler/conf.c @@ -1,5 +1,5 @@ /* - * "$Id: conf.c 5373 2006-04-06 20:03:32Z mike $" + * "$Id: conf.c 5482 2006-05-02 18:13:40Z mike $" * * Configuration routines for the Common UNIX Printing System (CUPS). * @@ -2949,6 +2949,11 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ switch (var->type) { case CUPSD_VARTYPE_INTEGER : + if (!value) + cupsdLogMessage(CUPSD_LOG_ERROR, + "Missing integer value for %s on line %d!", + line, linenum); + else { int n; /* Number */ char *units; /* Units */ @@ -2973,11 +2978,15 @@ read_configuration(cups_file_t *fp) /* I - File to read from */ break; case CUPSD_VARTYPE_BOOLEAN : - if (!strcasecmp(value, "true") || - !strcasecmp(value, "on") || - !strcasecmp(value, "enabled") || - !strcasecmp(value, "yes") || - atoi(value) != 0) + if (!value) + cupsdLogMessage(CUPSD_LOG_ERROR, + "Missing boolean value for %s on line %d!", + line, linenum); + else if (!strcasecmp(value, "true") || + !strcasecmp(value, "on") || + !strcasecmp(value, "enabled") || + !strcasecmp(value, "yes") || + atoi(value) != 0) *((int *)var->ptr) = TRUE; else if (!strcasecmp(value, "false") || !strcasecmp(value, "off") || @@ -3252,5 +3261,5 @@ read_policy(cups_file_t *fp, /* I - Configuration file */ /* - * End of "$Id: conf.c 5373 2006-04-06 20:03:32Z mike $". + * End of "$Id: conf.c 5482 2006-05-02 18:13:40Z mike $". */ diff --git a/scheduler/filter.c b/scheduler/filter.c index 92d68f862..bb6390072 100644 --- a/scheduler/filter.c +++ b/scheduler/filter.c @@ -1,5 +1,5 @@ /* - * "$Id: filter.c 5196 2006-02-27 21:23:00Z mike $" + * "$Id: filter.c 5493 2006-05-05 16:33:57Z mike $" * * File type conversion routines for the Common UNIX Printing System (CUPS). * @@ -60,6 +60,7 @@ typedef struct _mime_typelist_s /**** List of source types ****/ */ static int compare_filters(mime_filter_t *, mime_filter_t *); +static int compare_srcs(mime_filter_t *, mime_filter_t *); static cups_array_t *find_filters(mime_t *mime, mime_type_t *src, mime_type_t *dst, int *cost, _mime_typelist_t *visited); @@ -167,6 +168,23 @@ mimeFilter(mime_t *mime, /* I - MIME database */ if (!mime || !src || !dst) return (NULL); + /* + * (Re)build the source lookup array as needed... + */ + + if (!mime->srcs) + { + mime_filter_t *current; /* Current filter */ + + + mime->srcs = cupsArrayNew((cups_array_func_t)compare_srcs, NULL); + + for (current = mimeFirstFilter(mime); + current; + current = mimeNextFilter(mime)) + cupsArrayAdd(mime->srcs, current); + } + /* * Find the filters... */ @@ -195,6 +213,24 @@ compare_filters(mime_filter_t *f0, /* I - First filter */ } +/* + * 'compare_srcs()' - Compare two srcs... + */ + +static int /* O - Comparison result */ +compare_srcs(mime_filter_t *f0, /* I - First filter */ + mime_filter_t *f1) /* I - Second filter */ +{ + int i; /* Result of comparison */ + + + if ((i = strcmp(f0->src->super, f1->src->super)) == 0) + i = strcmp(f0->src->type, f1->src->type); + + return (i); +} + + /* * 'find_filters()' - Find the filters to convert from one type to another. */ @@ -210,7 +246,8 @@ find_filters(mime_t *mime, /* I - MIME database */ mincost; /* Current minimum */ cups_array_t *temp, /* Temporary filter */ *mintemp; /* Current minimum */ - mime_filter_t *current; /* Current filter */ + mime_filter_t *current, /* Current filter */ + srckey; /* Source type key */ _mime_typelist_t listnode, /* New list node */ *listptr; /* Pointer in list */ @@ -238,6 +275,9 @@ find_filters(mime_t *mime, /* I - MIME database */ mincost = current->cost; + if (!cost) + return (mintemp); + DEBUG_puts(" Found direct filter:"); DEBUG_printf((" %s (cost=%d)\n", current->filter, mincost)); } @@ -261,58 +301,67 @@ find_filters(mime_t *mime, /* I - MIME database */ * OK, now look for filters from the source type to any other type... */ - for (current = (mime_filter_t *)cupsArrayFirst(mime->filters); - current; - current = (mime_filter_t *)cupsArrayNext(mime->filters)) - if (current->src == src) - { - /* - * See if we have already tried the destination type as a source - * type (this avoids extra filter looping...) - */ + srckey.src = src; - for (listptr = list; listptr; listptr = listptr->next) - if (current->dst == listptr->src) - break; + for (current = (mime_filter_t *)cupsArrayFind(mime->srcs, &srckey); + current && current->src == src; + current = (mime_filter_t *)cupsArrayNext(mime->srcs)) + { + /* + * See if we have already tried the destination type as a source + * type (this avoids extra filter looping...) + */ - if (listptr) - continue; + mime_type_t *current_dst; /* Current destination type */ - /* - * See if we have any filters that can convert from the destination type - * of this filter to the final type... - */ - listnode.src = current->src; + for (listptr = list, current_dst = current->dst; + listptr; + listptr = listptr->next) + if (current_dst == listptr->src) + break; + + if (listptr) + continue; - cupsArraySave(mime->filters); - temp = find_filters(mime, current->dst, dst, &tempcost, &listnode); - cupsArrayRestore(mime->filters); + /* + * See if we have any filters that can convert from the destination type + * of this filter to the final type... + */ + + listnode.src = current->src; - if (!temp) - continue; + cupsArraySave(mime->srcs); + temp = find_filters(mime, current->dst, dst, &tempcost, &listnode); + cupsArrayRestore(mime->srcs); + + if (!temp) + continue; + + if (!cost) + return (temp); + + /* + * Found a match; see if this one is less costly than the last (if + * any...) + */ + + if (tempcost < mincost) + { + cupsArrayDelete(mintemp); /* - * Found a match; see if this one is less costly than the last (if - * any...) + * Hey, we got a match! Add the current filter to the beginning of the + * filter list... */ - if (tempcost < mincost) - { - cupsArrayDelete(mintemp); - - /* - * Hey, we got a match! Add the current filter to the beginning of the - * filter list... - */ - - mintemp = temp; - mincost = tempcost + current->cost; - cupsArrayInsert(mintemp, current); - } - else - cupsArrayDelete(temp); + mintemp = temp; + mincost = tempcost + current->cost; + cupsArrayInsert(mintemp, current); } + else + cupsArrayDelete(temp); + } if (mintemp) { @@ -360,5 +409,5 @@ lookup(mime_t *mime, /* I - MIME database */ /* - * End of "$Id: filter.c 5196 2006-02-27 21:23:00Z mike $". + * End of "$Id: filter.c 5493 2006-05-05 16:33:57Z mike $". */ diff --git a/scheduler/job.c b/scheduler/job.c index 2f3f5bc54..dae836158 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -1,5 +1,5 @@ /* - * "$Id: job.c 5452 2006-04-22 22:17:32Z mike $" + * "$Id: job.c 5494 2006-05-05 17:44:36Z mike $" * * Job management routines for the Common UNIX Printing System (CUPS). * @@ -467,7 +467,36 @@ cupsdFinishJob(cupsd_job_t *job) /* I - Job */ * Backend had errors; stop it... */ - switch (-job->status) + int exit_code; /* Exit code from backend */ + + + /* + * Convert the status to an exit code. Due to the way the W* macros are + * implemented on MacOS X (bug?), we have to store the exit status in a + * variable first and then convert... + */ + + exit_code = -job->status; + if (WIFEXITED(exit_code)) + exit_code = WEXITSTATUS(exit_code); + else + exit_code = job->status; + + cupsdLogMessage(CUPSD_LOG_INFO, "[Job %d] Backend returned status %d (%s)", + job->id, exit_code, + exit_code == CUPS_BACKEND_FAILED ? "failed" : + exit_code == CUPS_BACKEND_AUTH_REQUIRED ? + "authentication required" : + exit_code == CUPS_BACKEND_HOLD ? "hold job" : + exit_code == CUPS_BACKEND_STOP ? "stop printer" : + exit_code == CUPS_BACKEND_CANCEL ? "cancel job" : + exit_code < 0 ? "crashed" : "unknown"); + + /* + * Do what needs to be done... + */ + + switch (exit_code) { default : case CUPS_BACKEND_FAILED : @@ -3411,5 +3440,5 @@ unload_job(cupsd_job_t *job) /* I - Job */ /* - * End of "$Id: job.c 5452 2006-04-22 22:17:32Z mike $". + * End of "$Id: job.c 5494 2006-05-05 17:44:36Z mike $". */ diff --git a/scheduler/log.c b/scheduler/log.c index 52a61132b..a53029f55 100644 --- a/scheduler/log.c +++ b/scheduler/log.c @@ -1,9 +1,9 @@ /* - * "$Id: log.c 5194 2006-02-27 20:57:07Z mike $" + * "$Id: log.c 5493 2006-05-05 16:33:57Z mike $" * * Log file routines for the Common UNIX Printing System (CUPS). * - * Copyright 1997-2005 by Easy Software Products, all rights reserved. + * Copyright 1997-2006 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the * property of Easy Software Products and are protected by Federal @@ -23,11 +23,11 @@ * * Contents: * - * cupsdGetDateTime() - Returns a pointer to a date/time string. - * cupsdLogMessage() - Log a message to the error log file. - * cupsdLogPage() - Log a page to the page log file. - * cupsdLogRequest() - Log an HTTP request in Common Log Format. - * check_log_file() - Open/rotate a log file if it needs it. + * cupsdGetDateTime() - Returns a pointer to a date/time string. + * cupsdLogMessage() - Log a message to the error log file. + * cupsdLogPage() - Log a page to the page log file. + * cupsdLogRequest() - Log an HTTP request in Common Log Format. + * check_log_file() - Open/rotate a log file if it needs it. */ /* @@ -425,7 +425,9 @@ check_log_file(cups_file_t **lf, /* IO - Log file */ * Format the filename as needed... */ - if (!*lf || (cupsFileTell(*lf) > MaxLogSize && MaxLogSize > 0)) + if (!*lf || + (strncmp(logname, "/dev/", 5) && cupsFileTell(*lf) > MaxLogSize && + MaxLogSize > 0)) { /* * Handle format strings... @@ -508,7 +510,8 @@ check_log_file(cups_file_t **lf, /* IO - Log file */ * Do we need to rotate the log? */ - if (cupsFileTell(*lf) > MaxLogSize && MaxLogSize > 0) + if (strncmp(logname, "/dev/", 5) && cupsFileTell(*lf) > MaxLogSize && + MaxLogSize > 0) { /* * Rotate log file... @@ -530,15 +533,12 @@ check_log_file(cups_file_t **lf, /* IO - Log file */ return (0); } - if (strncmp(filename, "/dev/", 5)) - { - /* - * Change ownership and permissions of non-device logs... - */ + /* + * Change ownership and permissions of non-device logs... + */ - fchown(cupsFileNumber(*lf), RunUser, Group); - fchmod(cupsFileNumber(*lf), LogFilePerm); - } + fchown(cupsFileNumber(*lf), RunUser, Group); + fchmod(cupsFileNumber(*lf), LogFilePerm); } return (1); @@ -546,5 +546,5 @@ check_log_file(cups_file_t **lf, /* IO - Log file */ /* - * End of "$Id: log.c 5194 2006-02-27 20:57:07Z mike $". + * End of "$Id: log.c 5493 2006-05-05 16:33:57Z mike $". */ diff --git a/scheduler/main.c b/scheduler/main.c index e9e1a1c23..fa297b919 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -1,5 +1,5 @@ /* - * "$Id: main.c 5448 2006-04-22 03:57:26Z mike $" + * "$Id: main.c 5491 2006-05-04 20:53:35Z mike $" * * Scheduler main loop for the Common UNIX Printing System (CUPS). * @@ -219,6 +219,12 @@ main(int argc, /* I - Number of command-line args */ #endif /* HAVE_LAUNCHD */ break; + case 'p' : /* Stop immediately for profiling */ + puts("Warning: -p option is for internal testing use only!"); + stop_scheduler = 1; + fg = 1; + break; + default : /* Unknown option */ _cupsLangPrintf(stderr, _("cupsd: Unknown option \"%c\" - " "aborting!\n"), *opt); @@ -703,7 +709,7 @@ main(int argc, /* I - Number of command-line args */ sptr += strlen(sptr); } - cupsdLogMessage(CUPSD_LOG_EMERG, s); + cupsdLogMessage(CUPSD_LOG_EMERG, "%s", s); strcpy(s, "OutputSet ="); slen = 11; @@ -717,7 +723,7 @@ main(int argc, /* I - Number of command-line args */ sptr += strlen(sptr); } - cupsdLogMessage(CUPSD_LOG_EMERG, s); + cupsdLogMessage(CUPSD_LOG_EMERG, "%s", s); for (i = 0, con = (cupsd_client_t *)cupsArrayFirst(Clients); con; @@ -2247,5 +2253,5 @@ usage(int status) /* O - Exit status */ /* - * End of "$Id: main.c 5448 2006-04-22 03:57:26Z mike $". + * End of "$Id: main.c 5491 2006-05-04 20:53:35Z mike $". */ diff --git a/scheduler/mime.c b/scheduler/mime.c index 9c298e6fc..fc1f3fac7 100644 --- a/scheduler/mime.c +++ b/scheduler/mime.c @@ -1,5 +1,5 @@ /* - * "$Id: mime.c 5394 2006-04-14 18:20:04Z mike $" + * "$Id: mime.c 5495 2006-05-05 17:58:07Z mike $" * * MIME database file routines for the Common UNIX Printing System (CUPS). * @@ -120,6 +120,7 @@ mimeDelete(mime_t *mime) /* I - MIME database */ cupsArrayDelete(mime->types); cupsArrayDelete(mime->filters); + cupsArrayDelete(mime->srcs); free(mime); } @@ -137,6 +138,17 @@ mimeDeleteFilter(mime_t *mime, /* I - MIME database */ cupsArrayRemove(mime->filters, filter); free(filter); + + /* + * Deleting a filter invalidates the source lookup cache used by + * mimeFilter()... + */ + + if (mime->srcs) + { + cupsArrayDelete(mime->srcs); + mime->srcs = NULL; + } } @@ -628,7 +640,7 @@ load_types(mime_t *mime, /* I - MIME database */ { cups_file_t *fp; /* Types file */ int linelen; /* Length of line */ - char line[65536], /* Input line from file */ + char line[32768], /* Input line from file */ *lineptr, /* Current position in line */ super[MIME_MAX_SUPER], /* Super-type name */ type[MIME_MAX_TYPE], /* Type name */ @@ -711,5 +723,5 @@ load_types(mime_t *mime, /* I - MIME database */ /* - * End of "$Id: mime.c 5394 2006-04-14 18:20:04Z mike $". + * End of "$Id: mime.c 5495 2006-05-05 17:58:07Z mike $". */ diff --git a/scheduler/mime.h b/scheduler/mime.h index 7ccaa70e1..9c5aa6448 100644 --- a/scheduler/mime.h +++ b/scheduler/mime.h @@ -1,5 +1,5 @@ /* - * "$Id: mime.h 5061 2006-02-03 16:32:18Z mike $" + * "$Id: mime.h 5487 2006-05-03 19:28:29Z mike $" * * MIME type/conversion database definitions for the Common UNIX Printing System (CUPS). * @@ -111,6 +111,7 @@ typedef struct _mime_s /**** MIME Database ****/ { cups_array_t *types; /* File types */ cups_array_t *filters; /* Type conversion filters */ + cups_array_t *srcs; /* Filters sorted by source type */ } mime_t; @@ -152,5 +153,5 @@ extern int mimeNumFilters(mime_t *mime); #endif /* !_CUPS_MIME_H_ */ /* - * End of "$Id: mime.h 5061 2006-02-03 16:32:18Z mike $". + * End of "$Id: mime.h 5487 2006-05-03 19:28:29Z mike $". */ diff --git a/scheduler/printers.c b/scheduler/printers.c index 86b4f7931..b5a715d3a 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c 5373 2006-04-06 20:03:32Z mike $" + * "$Id: printers.c 5491 2006-05-04 20:53:35Z mike $" * * Printer routines for the Common UNIX Printing System (CUPS). * @@ -1220,7 +1220,7 @@ cupsdRenamePrinter( * Rename the printer... */ - cupsdSetStringf(&p->name, name); + cupsdSetString(&p->name, name); /* * Reset printer attributes... @@ -3278,5 +3278,5 @@ write_irix_state(cupsd_printer_t *p) /* I - Printer to update */ /* - * End of "$Id: printers.c 5373 2006-04-06 20:03:32Z mike $". + * End of "$Id: printers.c 5491 2006-05-04 20:53:35Z mike $". */ diff --git a/scheduler/server.c b/scheduler/server.c index 226848796..bcc3c71e6 100644 --- a/scheduler/server.c +++ b/scheduler/server.c @@ -1,5 +1,5 @@ /* - * "$Id: server.c 5373 2006-04-06 20:03:32Z mike $" + * "$Id: server.c 5493 2006-05-05 16:33:57Z mike $" * * Server start/stop routines for the Common UNIX Printing System (CUPS). * @@ -146,9 +146,9 @@ cupsdStopServer(void) cupsdSaveRemoteCache(); cupsdDeleteAllCerts(); - if (Clients != NULL) + if (Clients) { - free(Clients); + cupsArrayDelete(Clients); Clients = NULL; } @@ -211,5 +211,5 @@ cupsdStopServer(void) /* - * End of "$Id: server.c 5373 2006-04-06 20:03:32Z mike $". + * End of "$Id: server.c 5493 2006-05-05 16:33:57Z mike $". */ diff --git a/standards/rfc1213.txt b/standards/rfc1213.txt new file mode 100644 index 000000000..50a26f54f --- /dev/null +++ b/standards/rfc1213.txt @@ -0,0 +1,3923 @@ + + + + + + +Network Working Group K. McCloghrie +Request for Comments: 1213 Hughes LAN Systems, Inc. +Obsoletes: RFC 1158 M. Rose + Performance Systems International + Editors + March 1991 + + + Management Information Base for Network Management + of TCP/IP-based internets: + MIB-II + +Status of this Memo + + This memo defines the second version of the Management Information + Base (MIB-II) for use with network management protocols in TCP/IP- + based internets. This RFC specifies an IAB standards track protocol + for the Internet community, and requests discussion and suggestions + for improvements. Please refer to the current edition of the "IAB + Official Protocol Standards" for the standardization state and status + of this protocol. Distribution of this memo is unlimited. + +Table of Contents + + 1. Abstract............................................... 2 + 2. Introduction .......................................... 2 + 3. Changes from RFC 1156 ................................. 3 + 3.1 Deprecated Objects ................................... 3 + 3.2 Display Strings ...................................... 4 + 3.3 Physical Addresses ................................... 4 + 3.4 The System Group ..................................... 5 + 3.5 The Interfaces Group ................................. 5 + 3.6 The Address Translation Group ........................ 6 + 3.7 The IP Group ......................................... 6 + 3.8 The ICMP Group ....................................... 7 + 3.9 The TCP Group ........................................ 7 + 3.10 The UDP Group ....................................... 7 + 3.11 The EGP Group ....................................... 7 + 3.12 The Transmission Group .............................. 8 + 3.13 The SNMP Group ...................................... 8 + 3.14 Changes from RFC 1158 ................. ............. 9 + 4. Objects ............................................... 10 + 4.1 Format of Definitions ................................ 10 + 5. Overview .............................................. 10 + 6. Definitions ........................................... 12 + 6.1 Textual Conventions .................................. 12 + 6.2 Groups in MIB-II ..................................... 13 + 6.3 The System Group ..................................... 13 + + + +SNMP Working Group [Page 1] + +RFC 1213 MIB-II March 1991 + + + 6.4 The Interfaces Group ................................. 16 + 6.5 The Address Translation Group ........................ 23 + 6.6 The IP Group ......................................... 26 + 6.7 The ICMP Group ....................................... 41 + 6.8 The TCP Group ........................................ 46 + 6.9 The UDP Group ........................................ 52 + 6.10 The EGP Group ....................................... 54 + 6.11 The Transmission Group .............................. 60 + 6.12 The SNMP Group ...................................... 60 + 7. Acknowledgements ...................................... 67 + 8. References ............................................ 69 + 9. Security Considerations ............................... 70 + 10. Authors' Addresses ................................... 70 + +1. Abstract + + This memo defines the second version of the Management Information + Base (MIB-II) for use with network management protocols in TCP/IP- + based internets. In particular, together with its companion memos + which describe the structure of management information (RFC 1155) + along with the network management protocol (RFC 1157) for TCP/IP- + based internets, these documents provide a simple, workable + architecture and system for managing TCP/IP-based internets and in + particular the Internet community. + +2. Introduction + + As reported in RFC 1052, IAB Recommendations for the Development of + Internet Network Management Standards [1], a two-prong strategy for + network management of TCP/IP-based internets was undertaken. In the + short-term, the Simple Network Management Protocol (SNMP) was to be + used to manage nodes in the Internet community. In the long-term, + the use of the OSI network management framework was to be examined. + Two documents were produced to define the management information: RFC + 1065, which defined the Structure of Management Information (SMI) + [2], and RFC 1066, which defined the Management Information Base + (MIB) [3]. Both of these documents were designed so as to be + compatible with both the SNMP and the OSI network management + framework. + + This strategy was quite successful in the short-term: Internet-based + network management technology was fielded, by both the research and + commercial communities, within a few months. As a result of this, + portions of the Internet community became network manageable in a + timely fashion. + + As reported in RFC 1109, Report of the Second Ad Hoc Network + Management Review Group [4], the requirements of the SNMP and the OSI + + + +SNMP Working Group [Page 2] + +RFC 1213 MIB-II March 1991 + + + network management frameworks were more different than anticipated. + As such, the requirement for compatibility between the SMI/MIB and + both frameworks was suspended. This action permitted the operational + network management framework, the SNMP, to respond to new operational + needs in the Internet community by producing this document. + + As such, the current network management framework for TCP/IP- based + internets consists of: Structure and Identification of Management + Information for TCP/IP-based internets, RFC 1155 [12], which + describes how managed objects contained in the MIB are defined; + Management Information Base for Network Management of TCP/IP-based + internets: MIB-II, this memo, which describes the managed objects + contained in the MIB (and supercedes RFC 1156 [13]); and, the Simple + Network Management Protocol, RFC 1098 [5], which defines the protocol + used to manage these objects. + +3. Changes from RFC 1156 + + Features of this MIB include: + + (1) incremental additions to reflect new operational + requirements; + + (2) upwards compatibility with the SMI/MIB and the SNMP; + + (3) improved support for multi-protocol entities; and, + + (4) textual clean-up of the MIB to improve clarity and + readability. + + The objects defined in MIB-II have the OBJECT IDENTIFIER prefix: + + mib-2 OBJECT IDENTIFIER ::= { mgmt 1 } + + which is identical to the prefix used in MIB-I. + +3.1. Deprecated Objects + + In order to better prepare implementors for future changes in the + MIB, a new term "deprecated" may be used when describing an object. + A deprecated object in the MIB is one which must be supported, but + one which will most likely be removed from the next version of the + MIB (e.g., MIB-III). + + MIB-II marks one object as being deprecated: + + atTable + + + + +SNMP Working Group [Page 3] + +RFC 1213 MIB-II March 1991 + + + As a result of deprecating the atTable object, the entire Address + Translation group is deprecated. + + Note that no functionality is lost with the deprecation of these + objects: new objects providing equivalent or superior functionality + are defined in MIB-II. + +3.2. Display Strings + + In the past, there have been misinterpretations of the MIB as to when + a string of octets should contain printable characters, meant to be + displayed to a human. As a textual convention in the MIB, the + datatype + + DisplayString ::= + OCTET STRING + + is introduced. A DisplayString is restricted to the NVT ASCII + character set, as defined in pages 10-11 of [6]. + + The following objects are now defined in terms of DisplayString: + + sysDescr + ifDescr + + It should be noted that this change has no effect on either the + syntax nor semantics of these objects. The use of the DisplayString + notation is merely an artifact of the explanatory method used in + MIB-II and future MIBs. + + Further it should be noted that any object defined in terms of OCTET + STRING may contain arbitrary binary data, in which each octet may + take any value from 0 to 255 (decimal). + +3.3. Physical Addresses + + As a further, textual convention in the MIB, the datatype + + PhysAddress ::= + OCTET STRING + + is introduced to represent media- or physical-level addresses. + + The following objects are now defined in terms of PhysAddress: + + ifPhysAddress + atPhysAddress + ipNetToMediaPhysAddress + + + +SNMP Working Group [Page 4] + +RFC 1213 MIB-II March 1991 + + + It should be noted that this change has no effect on either the + syntax nor semantics of these objects. The use of the PhysAddress + notation is merely an artifact of the explanatory method used in + MIB-II and future MIBs. + +3.4. The System Group + + Four new objects are added to this group: + + sysContact + sysName + sysLocation + sysServices + + These provide contact, administrative, location, and service + information regarding the managed node. + +3.5. The Interfaces Group + + The definition of the ifNumber object was incorrect, as it required + all interfaces to support IP. (For example, devices without IP, such + as MAC-layer bridges, could not be managed if this definition was + strictly followed.) The description of the ifNumber object is + changed accordingly. + + The ifTable object was mistaken marked as read-write, it has been + (correctly) re-designated as not-accessible. In addition, several + new values have been added to the ifType column in the ifTable + object: + + ppp(23) + softwareLoopback(24) + eon(25) + ethernet-3Mbit(26) + nsip(27) + slip(28) + ultra(29) + ds3(30) + sip(31) + frame-relay(32) + + Finally, a new column has been added to the ifTable object: + + ifSpecific + + which provides information about information specific to the media + being used to realize the interface. + + + + +SNMP Working Group [Page 5] + +RFC 1213 MIB-II March 1991 + + +3.6. The Address Translation Group + + In MIB-I this group contained a table which permitted mappings from + network addresses (e.g., IP addresses) to physical addresses (e.g., + MAC addresses). Experience has shown that efficient implementations + of this table make two assumptions: a single network protocol + environment, and mappings occur only from network address to physical + address. + + The need to support multi-protocol nodes (e.g., those with both the + IP and CLNP active), and the need to support the inverse mapping + (e.g., for ES-IS), have invalidated both of these assumptions. As + such, the atTable object is declared deprecated. + + In order to meet both the multi-protocol and inverse mapping + requirements, MIB-II and its successors will allocate up to two + address translation tables inside each network protocol group. That + is, the IP group will contain one address translation table, for + going from IP addresses to physical addresses. Similarly, when a + document defining MIB objects for the CLNP is produced (e.g., [7]), + it will contain two tables, for mappings in both directions, as this + is required for full functionality. + + It should be noted that the choice of two tables (one for each + direction of mapping) provides for ease of implementation in many + cases, and does not introduce undue burden on implementations which + realize the address translation abstraction through a single internal + table. + +3.7. The IP Group + + The access attribute of the variable ipForwarding has been changed + from read-only to read-write. + + In addition, there is a new column to the ipAddrTable object, + + ipAdEntReasmMaxSize + + which keeps track of the largest IP datagram that can be re-assembled + on a particular interface. + + The descriptor of the ipRoutingTable object has been changed to + ipRouteTable for consistency with the other IP routing objects. + There are also three new columns in the ipRouteTable object, + + ipRouteMask + ipRouteMetric5 + ipRouteInfo + + + +SNMP Working Group [Page 6] + +RFC 1213 MIB-II March 1991 + + + the first is used for IP routing subsystems that support arbitrary + subnet masks, and the latter two are IP routing protocol-specific. + + Two new objects are added to the IP group: + + ipNetToMediaTable + ipRoutingDiscards + + the first is the address translation table for the IP group + (providing identical functionality to the now deprecated atTable in + the address translation group), and the latter provides information + when routes are lost due to a lack of buffer space. + +3.8. The ICMP Group + + There are no changes to this group. + +3.9. The TCP Group + + Two new variables are added: + + tcpInErrs + tcpOutRsts + + which keep track of the number of incoming TCP segments in error and + the number of resets generated by a TCP. + +3.10. The UDP Group + + A new table: + + udpTable + + is added. + +3.11. The EGP Group + + Experience has indicated a need for additional objects that are + useful in EGP monitoring. In addition to making several additions to + the egpNeighborTable object, i.e., + + egpNeighAs + egpNeighInMsgs + egpNeighInErrs + egpNeighOutMsgs + egpNeighOutErrs + egpNeighInErrMsgs + egpNeighOutErrMsgs + + + +SNMP Working Group [Page 7] + +RFC 1213 MIB-II March 1991 + + + egpNeighStateUps + egpNeighStateDowns + egpNeighIntervalHello + egpNeighIntervalPoll + egpNeighMode + egpNeighEventTrigger + + a new variable is added: + + egpAs + + which gives the autonomous system associated with this EGP entity. + +3.12. The Transmission Group + + MIB-I was lacking in that it did not distinguish between different + types of transmission media. A new group, the Transmission group, is + allocated for this purpose: + + transmission OBJECT IDENTIFIER ::= { mib-2 10 } + + When Internet-standard definitions for managing transmission media + are defined, the transmission group is used to provide a prefix for + the names of those objects. + + Typically, such definitions reside in the experimental portion of the + MIB until they are "proven", then as a part of the Internet + standardization process, the definitions are accordingly elevated and + a new object identifier, under the transmission group is defined. By + convention, the name assigned is: + + type OBJECT IDENTIFIER ::= { transmission number } + + where "type" is the symbolic value used for the media in the ifType + column of the ifTable object, and "number" is the actual integer + value corresponding to the symbol. + +3.13. The SNMP Group + + The application-oriented working groups of the IETF have been tasked + to be receptive towards defining MIB variables specific to their + respective applications. + + For the SNMP, it is useful to have statistical information. A new + group, the SNMP group, is allocated for this purpose: + + snmp OBJECT IDENTIFIER ::= { mib-2 11 } + + + + +SNMP Working Group [Page 8] + +RFC 1213 MIB-II March 1991 + + +3.14. Changes from RFC 1158 + + Features of this MIB include: + + (1) The managed objects in this document have been defined + using the conventions defined in the Internet-standard + SMI, as amended by the extensions specified in [14]. It + must be emphasized that definitions made using these + extensions are semantically identically to those in RFC + 1158. + + (2) The PhysAddress textual convention has been introduced to + represent media addresses. + + (3) The ACCESS clause of sysLocation is now read-write. + + (4) The definition of sysServices has been clarified. + + (5) New ifType values (29-32) have been defined. In + addition, the textual-descriptor for the DS1 and E1 + interface types has been corrected. + + (6) The definition of ipForwarding has been clarified. + + (7) The definition of ipRouteType has been clarified. + + (8) The ipRouteMetric5 and ipRouteInfo objects have been + defined. + + (9) The ACCESS clause of tcpConnState is now read-write, to + support deletion of the TCB associated with a TCP + connection. The definition of this object has been + clarified to explain this usage. + + (10) The definition of egpNeighEventTrigger has been + clarified. + + (11) The definition of several of the variables in the new + snmp group have been clarified. In addition, the + snmpInBadTypes and snmpOutReadOnlys objects are no longer + present. (However, the object identifiers associated + with those objects are reserved to prevent future use.) + + (12) The definition of snmpInReadOnlys has been clarified. + + (13) The textual descriptor of the snmpEnableAuthTraps has + been changed to snmpEnableAuthenTraps, and the definition + has been clarified. + + + +SNMP Working Group [Page 9] + +RFC 1213 MIB-II March 1991 + + + (14) The ipRoutingDiscards object was added. + + (15) The optional use of an implementation-dependent, small + positive integer was disallowed when identifying + instances of the IP address and routing tables. + +4. Objects + + Managed objects are accessed via a virtual information store, termed + the Management Information Base or MIB. Objects in the MIB are + defined using the subset of Abstract Syntax Notation One (ASN.1) [8] + defined in the SMI. In particular, each object has a name, a syntax, + and an encoding. The name is an object identifier, an + administratively assigned name, which specifies an object type. The + object type together with an object instance serves to uniquely + identify a specific instantiation of the object. For human + convenience, we often use a textual string, termed the OBJECT + DESCRIPTOR, to also refer to the object type. + + The syntax of an object type defines the abstract data structure + corresponding to that object type. The ASN.1 language is used for + this purpose. However, the SMI [12] purposely restricts the ASN.1 + constructs which may be used. These restrictions are explicitly made + for simplicity. + + The encoding of an object type is simply how that object type is + represented using the object type's syntax. Implicitly tied to the + notion of an object type's syntax and encoding is how the object type + is represented when being transmitted on the network. + + The SMI specifies the use of the basic encoding rules of ASN.1 [9], + subject to the additional requirements imposed by the SNMP. + +4.1. Format of Definitions + + Section 6 contains contains the specification of all object types + contained in this MIB module. The object types are defined using the + conventions defined in the SMI, as amended by the extensions + specified in [14]. + +5. Overview + + Consistent with the IAB directive to produce simple, workable systems + in the short-term, the list of managed objects defined here, has been + derived by taking only those elements which are considered essential. + + This approach of taking only the essential objects is NOT + restrictive, since the SMI defined in the companion memo provides + + + +SNMP Working Group [Page 10] + +RFC 1213 MIB-II March 1991 + + + three extensibility mechanisms: one, the addition of new standard + objects through the definitions of new versions of the MIB; two, the + addition of widely-available but non-standard objects through the + experimental subtree; and three, the addition of private objects + through the enterprises subtree. Such additional objects can not + only be used for vendor-specific elements, but also for + experimentation as required to further the knowledge of which other + objects are essential. + + The design of MIB-II is heavily influenced by the first extensibility + mechanism. Several new variables have been added based on + operational experience and need. Based on this, the criteria for + including an object in MIB-II are remarkably similar to the MIB-I + criteria: + + (1) An object needed to be essential for either fault or + configuration management. + + (2) Only weak control objects were permitted (by weak, it is + meant that tampering with them can do only limited + damage). This criterion reflects the fact that the + current management protocols are not sufficiently secure + to do more powerful control operations. + + (3) Evidence of current use and utility was required. + + (4) In MIB-I, an attempt was made to limit the number of + objects to about 100 to make it easier for vendors to + fully instrument their software. In MIB-II, this limit + was raised given the wide technological base now + implementing MIB-I. + + (5) To avoid redundant variables, it was required that no + object be included that can be derived from others in the + MIB. + + (6) Implementation specific objects (e.g., for BSD UNIX) were + excluded. + + (7) It was agreed to avoid heavily instrumenting critical + sections of code. The general guideline was one counter + per critical section per layer. + + MIB-II, like its predecessor, the Internet-standard MIB, contains + only essential elements. There is no need to allow individual + objects to be optional. Rather, the objects are arranged into the + following groups: + + + + +SNMP Working Group [Page 11] + +RFC 1213 MIB-II March 1991 + + + - System + - Interfaces + - Address Translation (deprecated) + - IP + - ICMP + - TCP + - UDP + - EGP + - Transmission + - SNMP + + These groups are the basic unit of conformance: This method is as + follows: if the semantics of a group is applicable to an + implementation, then it must implement all objects in that group. + For example, an implementation must implement the EGP group if and + only if it implements the EGP. + + There are two reasons for defining these groups: to provide a means + of assigning object identifiers; and, to provide a method for + implementations of managed agents to know which objects they must + implement. + +6. Definitions + + RFC1213-MIB DEFINITIONS ::= BEGIN + + IMPORTS + mgmt, NetworkAddress, IpAddress, Counter, Gauge, + TimeTicks + FROM RFC1155-SMI + OBJECT-TYPE + FROM RFC-1212; + + -- This MIB module uses the extended OBJECT-TYPE macro as + -- defined in [14]; + + + -- MIB-II (same prefix as MIB-I) + + mib-2 OBJECT IDENTIFIER ::= { mgmt 1 } + + -- textual conventions + + DisplayString ::= + OCTET STRING + -- This data type is used to model textual information taken + -- from the NVT ASCII character set. By convention, objects + -- with this syntax are declared as having + + + +SNMP Working Group [Page 12] + +RFC 1213 MIB-II March 1991 + + + -- + -- SIZE (0..255) + + PhysAddress ::= + OCTET STRING + -- This data type is used to model media addresses. For many + -- types of media, this will be in a binary representation. + -- For example, an ethernet address would be represented as + -- a string of 6 octets. + + + -- groups in MIB-II + + system OBJECT IDENTIFIER ::= { mib-2 1 } + + interfaces OBJECT IDENTIFIER ::= { mib-2 2 } + + at OBJECT IDENTIFIER ::= { mib-2 3 } + + ip OBJECT IDENTIFIER ::= { mib-2 4 } + + icmp OBJECT IDENTIFIER ::= { mib-2 5 } + + tcp OBJECT IDENTIFIER ::= { mib-2 6 } + + udp OBJECT IDENTIFIER ::= { mib-2 7 } + + egp OBJECT IDENTIFIER ::= { mib-2 8 } + + -- historical (some say hysterical) + -- cmot OBJECT IDENTIFIER ::= { mib-2 9 } + + transmission OBJECT IDENTIFIER ::= { mib-2 10 } + + snmp OBJECT IDENTIFIER ::= { mib-2 11 } + + + -- the System group + + -- Implementation of the System group is mandatory for all + -- systems. If an agent is not configured to have a value + -- for any of these variables, a string of length 0 is + -- returned. + + sysDescr OBJECT-TYPE + SYNTAX DisplayString (SIZE (0..255)) + ACCESS read-only + STATUS mandatory + + + +SNMP Working Group [Page 13] + +RFC 1213 MIB-II March 1991 + + + DESCRIPTION + "A textual description of the entity. This value + should include the full name and version + identification of the system's hardware type, + software operating-system, and networking + software. It is mandatory that this only contain + printable ASCII characters." + ::= { system 1 } + + sysObjectID OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The vendor's authoritative identification of the + network management subsystem contained in the + entity. This value is allocated within the SMI + enterprises subtree (1.3.6.1.4.1) and provides an + easy and unambiguous means for determining `what + kind of box' is being managed. For example, if + vendor `Flintstones, Inc.' was assigned the + subtree 1.3.6.1.4.1.4242, it could assign the + identifier 1.3.6.1.4.1.4242.1.1 to its `Fred + Router'." + ::= { system 2 } + + sysUpTime OBJECT-TYPE + SYNTAX TimeTicks + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The time (in hundredths of a second) since the + network management portion of the system was last + re-initialized." + ::= { system 3 } + + sysContact OBJECT-TYPE + SYNTAX DisplayString (SIZE (0..255)) + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The textual identification of the contact person + for this managed node, together with information + on how to contact this person." + ::= { system 4 } + + sysName OBJECT-TYPE + SYNTAX DisplayString (SIZE (0..255)) + + + +SNMP Working Group [Page 14] + +RFC 1213 MIB-II March 1991 + + + ACCESS read-write + STATUS mandatory + DESCRIPTION + "An administratively-assigned name for this + managed node. By convention, this is the node's + fully-qualified domain name." + ::= { system 5 } + + sysLocation OBJECT-TYPE + SYNTAX DisplayString (SIZE (0..255)) + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The physical location of this node (e.g., + `telephone closet, 3rd floor')." + ::= { system 6 } + + sysServices OBJECT-TYPE + SYNTAX INTEGER (0..127) + ACCESS read-only + STATUS mandatory + DESCRIPTION + "A value which indicates the set of services that + this entity primarily offers. + + The value is a sum. This sum initially takes the + value zero, Then, for each layer, L, in the range + 1 through 7, that this node performs transactions + for, 2 raised to (L - 1) is added to the sum. For + example, a node which performs primarily routing + functions would have a value of 4 (2^(3-1)). In + contrast, a node which is a host offering + application services would have a value of 72 + (2^(4-1) + 2^(7-1)). Note that in the context of + the Internet suite of protocols, values should be + calculated accordingly: + + layer functionality + 1 physical (e.g., repeaters) + 2 datalink/subnetwork (e.g., bridges) + 3 internet (e.g., IP gateways) + 4 end-to-end (e.g., IP hosts) + 7 applications (e.g., mail relays) + + For systems including OSI protocols, layers 5 and + 6 may also be counted." + ::= { system 7 } + + + + +SNMP Working Group [Page 15] + +RFC 1213 MIB-II March 1991 + + + -- the Interfaces group + + -- Implementation of the Interfaces group is mandatory for + -- all systems. + + ifNumber OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of network interfaces (regardless of + their current state) present on this system." + ::= { interfaces 1 } + + + -- the Interfaces table + + -- The Interfaces table contains information on the entity's + -- interfaces. Each interface is thought of as being + -- attached to a `subnetwork'. Note that this term should + -- not be confused with `subnet' which refers to an + -- addressing partitioning scheme used in the Internet suite + -- of protocols. + + ifTable OBJECT-TYPE + SYNTAX SEQUENCE OF IfEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "A list of interface entries. The number of + entries is given by the value of ifNumber." + ::= { interfaces 2 } + + ifEntry OBJECT-TYPE + SYNTAX IfEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "An interface entry containing objects at the + subnetwork layer and below for a particular + interface." + INDEX { ifIndex } + ::= { ifTable 1 } + + IfEntry ::= + SEQUENCE { + ifIndex + INTEGER, + + + +SNMP Working Group [Page 16] + +RFC 1213 MIB-II March 1991 + + + ifDescr + DisplayString, + ifType + INTEGER, + ifMtu + INTEGER, + ifSpeed + Gauge, + ifPhysAddress + PhysAddress, + ifAdminStatus + INTEGER, + ifOperStatus + INTEGER, + ifLastChange + TimeTicks, + ifInOctets + Counter, + ifInUcastPkts + Counter, + ifInNUcastPkts + Counter, + ifInDiscards + Counter, + ifInErrors + Counter, + ifInUnknownProtos + Counter, + ifOutOctets + Counter, + ifOutUcastPkts + Counter, + ifOutNUcastPkts + Counter, + ifOutDiscards + Counter, + ifOutErrors + Counter, + ifOutQLen + Gauge, + ifSpecific + OBJECT IDENTIFIER + } + + ifIndex OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + + + +SNMP Working Group [Page 17] + +RFC 1213 MIB-II March 1991 + + + DESCRIPTION + "A unique value for each interface. Its value + ranges between 1 and the value of ifNumber. The + value for each interface must remain constant at + least from one re-initialization of the entity's + network management system to the next re- + initialization." + ::= { ifEntry 1 } + + ifDescr OBJECT-TYPE + SYNTAX DisplayString (SIZE (0..255)) + ACCESS read-only + STATUS mandatory + DESCRIPTION + "A textual string containing information about the + interface. This string should include the name of + the manufacturer, the product name and the version + of the hardware interface." + ::= { ifEntry 2 } + + ifType OBJECT-TYPE + SYNTAX INTEGER { + other(1), -- none of the following + regular1822(2), + hdh1822(3), + ddn-x25(4), + rfc877-x25(5), + ethernet-csmacd(6), + iso88023-csmacd(7), + iso88024-tokenBus(8), + iso88025-tokenRing(9), + iso88026-man(10), + starLan(11), + proteon-10Mbit(12), + proteon-80Mbit(13), + hyperchannel(14), + fddi(15), + lapb(16), + sdlc(17), + ds1(18), -- T-1 + e1(19), -- european equiv. of T-1 + basicISDN(20), + primaryISDN(21), -- proprietary serial + propPointToPointSerial(22), + ppp(23), + softwareLoopback(24), + eon(25), -- CLNP over IP [11] + ethernet-3Mbit(26), + + + +SNMP Working Group [Page 18] + +RFC 1213 MIB-II March 1991 + + + nsip(27), -- XNS over IP + slip(28), -- generic SLIP + ultra(29), -- ULTRA technologies + ds3(30), -- T-3 + sip(31), -- SMDS + frame-relay(32) + } + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The type of interface, distinguished according to + the physical/link protocol(s) immediately `below' + the network layer in the protocol stack." + ::= { ifEntry 3 } + + ifMtu OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The size of the largest datagram which can be + sent/received on the interface, specified in + octets. For interfaces that are used for + transmitting network datagrams, this is the size + of the largest network datagram that can be sent + on the interface." + ::= { ifEntry 4 } + + ifSpeed OBJECT-TYPE + SYNTAX Gauge + ACCESS read-only + STATUS mandatory + DESCRIPTION + "An estimate of the interface's current bandwidth + in bits per second. For interfaces which do not + vary in bandwidth or for those where no accurate + estimation can be made, this object should contain + the nominal bandwidth." + ::= { ifEntry 5 } + + ifPhysAddress OBJECT-TYPE + SYNTAX PhysAddress + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The interface's address at the protocol layer + immediately `below' the network layer in the + protocol stack. For interfaces which do not have + + + +SNMP Working Group [Page 19] + +RFC 1213 MIB-II March 1991 + + + such an address (e.g., a serial line), this object + should contain an octet string of zero length." + ::= { ifEntry 6 } + + ifAdminStatus OBJECT-TYPE + SYNTAX INTEGER { + up(1), -- ready to pass packets + down(2), + testing(3) -- in some test mode + } + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The desired state of the interface. The + testing(3) state indicates that no operational + packets can be passed." + ::= { ifEntry 7 } + + ifOperStatus OBJECT-TYPE + SYNTAX INTEGER { + up(1), -- ready to pass packets + down(2), + testing(3) -- in some test mode + } + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The current operational state of the interface. + The testing(3) state indicates that no operational + packets can be passed." + ::= { ifEntry 8 } + + ifLastChange OBJECT-TYPE + SYNTAX TimeTicks + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The value of sysUpTime at the time the interface + entered its current operational state. If the + current state was entered prior to the last re- + initialization of the local network management + subsystem, then this object contains a zero + value." + ::= { ifEntry 9 } + + ifInOctets OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + + + +SNMP Working Group [Page 20] + +RFC 1213 MIB-II March 1991 + + + STATUS mandatory + DESCRIPTION + "The total number of octets received on the + interface, including framing characters." + ::= { ifEntry 10 } + + ifInUcastPkts OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of subnetwork-unicast packets + delivered to a higher-layer protocol." + ::= { ifEntry 11 } + + ifInNUcastPkts OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of non-unicast (i.e., subnetwork- + broadcast or subnetwork-multicast) packets + delivered to a higher-layer protocol." + ::= { ifEntry 12 } + + ifInDiscards OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of inbound packets which were chosen + to be discarded even though no errors had been + detected to prevent their being deliverable to a + higher-layer protocol. One possible reason for + discarding such a packet could be to free up + buffer space." + ::= { ifEntry 13 } + + ifInErrors OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of inbound packets that contained + errors preventing them from being deliverable to a + higher-layer protocol." + ::= { ifEntry 14 } + + + + +SNMP Working Group [Page 21] + +RFC 1213 MIB-II March 1991 + + + ifInUnknownProtos OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of packets received via the interface + which were discarded because of an unknown or + unsupported protocol." + ::= { ifEntry 15 } + + ifOutOctets OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of octets transmitted out of the + interface, including framing characters." + ::= { ifEntry 16 } + + ifOutUcastPkts OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of packets that higher-level + protocols requested be transmitted to a + subnetwork-unicast address, including those that + were discarded or not sent." + ::= { ifEntry 17 } + + ifOutNUcastPkts OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of packets that higher-level + protocols requested be transmitted to a non- + unicast (i.e., a subnetwork-broadcast or + subnetwork-multicast) address, including those + that were discarded or not sent." + ::= { ifEntry 18 } + + ifOutDiscards OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of outbound packets which were chosen + + + +SNMP Working Group [Page 22] + +RFC 1213 MIB-II March 1991 + + + to be discarded even though no errors had been + detected to prevent their being transmitted. One + possible reason for discarding such a packet could + be to free up buffer space." + ::= { ifEntry 19 } + + ifOutErrors OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of outbound packets that could not be + transmitted because of errors." + ::= { ifEntry 20 } + + ifOutQLen OBJECT-TYPE + SYNTAX Gauge + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The length of the output packet queue (in + packets)." + ::= { ifEntry 21 } + + ifSpecific OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "A reference to MIB definitions specific to the + particular media being used to realize the + interface. For example, if the interface is + realized by an ethernet, then the value of this + object refers to a document defining objects + specific to ethernet. If this information is not + present, its value should be set to the OBJECT + IDENTIFIER { 0 0 }, which is a syntatically valid + object identifier, and any conformant + implementation of ASN.1 and BER must be able to + generate and recognize this value." + ::= { ifEntry 22 } + + + -- the Address Translation group + + -- Implementation of the Address Translation group is + -- mandatory for all systems. Note however that this group + -- is deprecated by MIB-II. That is, it is being included + + + +SNMP Working Group [Page 23] + +RFC 1213 MIB-II March 1991 + + + -- solely for compatibility with MIB-I nodes, and will most + -- likely be excluded from MIB-III nodes. From MIB-II and + -- onwards, each network protocol group contains its own + -- address translation tables. + + -- The Address Translation group contains one table which is + -- the union across all interfaces of the translation tables + -- for converting a NetworkAddress (e.g., an IP address) into + -- a subnetwork-specific address. For lack of a better term, + -- this document refers to such a subnetwork-specific address + -- as a `physical' address. + + -- Examples of such translation tables are: for broadcast + -- media where ARP is in use, the translation table is + -- equivalent to the ARP cache; or, on an X.25 network where + -- non-algorithmic translation to X.121 addresses is + -- required, the translation table contains the + -- NetworkAddress to X.121 address equivalences. + + atTable OBJECT-TYPE + SYNTAX SEQUENCE OF AtEntry + ACCESS not-accessible + STATUS deprecated + DESCRIPTION + "The Address Translation tables contain the + NetworkAddress to `physical' address equivalences. + Some interfaces do not use translation tables for + determining address equivalences (e.g., DDN-X.25 + has an algorithmic method); if all interfaces are + of this type, then the Address Translation table + is empty, i.e., has zero entries." + ::= { at 1 } + + atEntry OBJECT-TYPE + SYNTAX AtEntry + ACCESS not-accessible + STATUS deprecated + DESCRIPTION + "Each entry contains one NetworkAddress to + `physical' address equivalence." + INDEX { atIfIndex, + atNetAddress } + ::= { atTable 1 } + + AtEntry ::= + SEQUENCE { + atIfIndex + INTEGER, + + + +SNMP Working Group [Page 24] + +RFC 1213 MIB-II March 1991 + + + atPhysAddress + PhysAddress, + atNetAddress + NetworkAddress + } + + atIfIndex OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-write + STATUS deprecated + DESCRIPTION + "The interface on which this entry's equivalence + is effective. The interface identified by a + particular value of this index is the same + interface as identified by the same value of + ifIndex." + ::= { atEntry 1 } + + atPhysAddress OBJECT-TYPE + SYNTAX PhysAddress + ACCESS read-write + STATUS deprecated + DESCRIPTION + "The media-dependent `physical' address. + + Setting this object to a null string (one of zero + length) has the effect of invaliding the + corresponding entry in the atTable object. That + is, it effectively dissasociates the interface + identified with said entry from the mapping + identified with said entry. It is an + implementation-specific matter as to whether the + agent removes an invalidated entry from the table. + Accordingly, management stations must be prepared + to receive tabular information from agents that + corresponds to entries not currently in use. + Proper interpretation of such entries requires + examination of the relevant atPhysAddress object." + ::= { atEntry 2 } + + atNetAddress OBJECT-TYPE + SYNTAX NetworkAddress + ACCESS read-write + STATUS deprecated + DESCRIPTION + "The NetworkAddress (e.g., the IP address) + corresponding to the media-dependent `physical' + address." + + + +SNMP Working Group [Page 25] + +RFC 1213 MIB-II March 1991 + + + ::= { atEntry 3 } + + + -- the IP group + + -- Implementation of the IP group is mandatory for all + -- systems. + + ipForwarding OBJECT-TYPE + SYNTAX INTEGER { + forwarding(1), -- acting as a gateway + not-forwarding(2) -- NOT acting as a gateway + } + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The indication of whether this entity is acting + as an IP gateway in respect to the forwarding of + datagrams received by, but not addressed to, this + entity. IP gateways forward datagrams. IP hosts + do not (except those source-routed via the host). + + Note that for some managed nodes, this object may + take on only a subset of the values possible. + Accordingly, it is appropriate for an agent to + return a `badValue' response if a management + station attempts to change this object to an + inappropriate value." + ::= { ip 1 } + + ipDefaultTTL OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The default value inserted into the Time-To-Live + field of the IP header of datagrams originated at + this entity, whenever a TTL value is not supplied + by the transport layer protocol." + ::= { ip 2 } + + ipInReceives OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of input datagrams received from + interfaces, including those received in error." + + + +SNMP Working Group [Page 26] + +RFC 1213 MIB-II March 1991 + + + ::= { ip 3 } + + ipInHdrErrors OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of input datagrams discarded due to + errors in their IP headers, including bad + checksums, version number mismatch, other format + errors, time-to-live exceeded, errors discovered + in processing their IP options, etc." + ::= { ip 4 } + + ipInAddrErrors OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of input datagrams discarded because + the IP address in their IP header's destination + field was not a valid address to be received at + this entity. This count includes invalid + addresses (e.g., 0.0.0.0) and addresses of + unsupported Classes (e.g., Class E). For entities + which are not IP Gateways and therefore do not + forward datagrams, this counter includes datagrams + discarded because the destination address was not + a local address." + ::= { ip 5 } + + ipForwDatagrams OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of input datagrams for which this + entity was not their final IP destination, as a + result of which an attempt was made to find a + route to forward them to that final destination. + In entities which do not act as IP Gateways, this + counter will include only those packets which were + Source-Routed via this entity, and the Source- + Route option processing was successful." + ::= { ip 6 } + + ipInUnknownProtos OBJECT-TYPE + SYNTAX Counter + + + +SNMP Working Group [Page 27] + +RFC 1213 MIB-II March 1991 + + + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of locally-addressed datagrams + received successfully but discarded because of an + unknown or unsupported protocol." + ::= { ip 7 } + + ipInDiscards OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of input IP datagrams for which no + problems were encountered to prevent their + continued processing, but which were discarded + (e.g., for lack of buffer space). Note that this + counter does not include any datagrams discarded + while awaiting re-assembly." + ::= { ip 8 } + + ipInDelivers OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of input datagrams successfully + delivered to IP user-protocols (including ICMP)." + ::= { ip 9 } + + ipOutRequests OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of IP datagrams which local IP + user-protocols (including ICMP) supplied to IP in + requests for transmission. Note that this counter + does not include any datagrams counted in + ipForwDatagrams." + ::= { ip 10 } + + ipOutDiscards OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of output IP datagrams for which no + + + +SNMP Working Group [Page 28] + +RFC 1213 MIB-II March 1991 + + + problem was encountered to prevent their + transmission to their destination, but which were + discarded (e.g., for lack of buffer space). Note + that this counter would include datagrams counted + in ipForwDatagrams if any such packets met this + (discretionary) discard criterion." + ::= { ip 11 } + + ipOutNoRoutes OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of IP datagrams discarded because no + route could be found to transmit them to their + destination. Note that this counter includes any + packets counted in ipForwDatagrams which meet this + `no-route' criterion. Note that this includes any + datagarms which a host cannot route because all of + its default gateways are down." + ::= { ip 12 } + + ipReasmTimeout OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The maximum number of seconds which received + fragments are held while they are awaiting + reassembly at this entity." + ::= { ip 13 } + + ipReasmReqds OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of IP fragments received which needed + to be reassembled at this entity." + ::= { ip 14 } + + ipReasmOKs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of IP datagrams successfully re- + assembled." + + + +SNMP Working Group [Page 29] + +RFC 1213 MIB-II March 1991 + + + ::= { ip 15 } + + ipReasmFails OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of failures detected by the IP re- + assembly algorithm (for whatever reason: timed + out, errors, etc). Note that this is not + necessarily a count of discarded IP fragments + since some algorithms (notably the algorithm in + RFC 815) can lose track of the number of fragments + by combining them as they are received." + ::= { ip 16 } + + ipFragOKs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of IP datagrams that have been + successfully fragmented at this entity." + ::= { ip 17 } + + ipFragFails OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of IP datagrams that have been + discarded because they needed to be fragmented at + this entity but could not be, e.g., because their + Don't Fragment flag was set." + ::= { ip 18 } + + ipFragCreates OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of IP datagram fragments that have + been generated as a result of fragmentation at + this entity." + ::= { ip 19 } + + + + + + +SNMP Working Group [Page 30] + +RFC 1213 MIB-II March 1991 + + + -- the IP address table + + -- The IP address table contains this entity's IP addressing + -- information. + + ipAddrTable OBJECT-TYPE + SYNTAX SEQUENCE OF IpAddrEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "The table of addressing information relevant to + this entity's IP addresses." + ::= { ip 20 } + + ipAddrEntry OBJECT-TYPE + SYNTAX IpAddrEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "The addressing information for one of this + entity's IP addresses." + INDEX { ipAdEntAddr } + ::= { ipAddrTable 1 } + + IpAddrEntry ::= + SEQUENCE { + ipAdEntAddr + IpAddress, + ipAdEntIfIndex + INTEGER, + ipAdEntNetMask + IpAddress, + ipAdEntBcastAddr + INTEGER, + ipAdEntReasmMaxSize + INTEGER (0..65535) + } + + ipAdEntAddr OBJECT-TYPE + SYNTAX IpAddress + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The IP address to which this entry's addressing + information pertains." + ::= { ipAddrEntry 1 } + + + + + +SNMP Working Group [Page 31] + +RFC 1213 MIB-II March 1991 + + + ipAdEntIfIndex OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The index value which uniquely identifies the + interface to which this entry is applicable. The + interface identified by a particular value of this + index is the same interface as identified by the + same value of ifIndex." + ::= { ipAddrEntry 2 } + + ipAdEntNetMask OBJECT-TYPE + SYNTAX IpAddress + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The subnet mask associated with the IP address of + this entry. The value of the mask is an IP + address with all the network bits set to 1 and all + the hosts bits set to 0." + ::= { ipAddrEntry 3 } + + ipAdEntBcastAddr OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The value of the least-significant bit in the IP + broadcast address used for sending datagrams on + the (logical) interface associated with the IP + address of this entry. For example, when the + Internet standard all-ones broadcast address is + used, the value will be 1. This value applies to + both the subnet and network broadcasts addresses + used by the entity on this (logical) interface." + ::= { ipAddrEntry 4 } + + ipAdEntReasmMaxSize OBJECT-TYPE + SYNTAX INTEGER (0..65535) + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The size of the largest IP datagram which this + entity can re-assemble from incoming IP fragmented + datagrams received on this interface." + ::= { ipAddrEntry 5 } + + + + +SNMP Working Group [Page 32] + +RFC 1213 MIB-II March 1991 + + + -- the IP routing table + + -- The IP routing table contains an entry for each route + -- presently known to this entity. + + ipRouteTable OBJECT-TYPE + SYNTAX SEQUENCE OF IpRouteEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "This entity's IP Routing table." + ::= { ip 21 } + + ipRouteEntry OBJECT-TYPE + SYNTAX IpRouteEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "A route to a particular destination." + INDEX { ipRouteDest } + ::= { ipRouteTable 1 } + + IpRouteEntry ::= + SEQUENCE { + ipRouteDest + IpAddress, + ipRouteIfIndex + INTEGER, + ipRouteMetric1 + INTEGER, + ipRouteMetric2 + INTEGER, + ipRouteMetric3 + INTEGER, + ipRouteMetric4 + INTEGER, + ipRouteNextHop + IpAddress, + ipRouteType + INTEGER, + ipRouteProto + INTEGER, + ipRouteAge + INTEGER, + ipRouteMask + IpAddress, + ipRouteMetric5 + INTEGER, + + + +SNMP Working Group [Page 33] + +RFC 1213 MIB-II March 1991 + + + ipRouteInfo + OBJECT IDENTIFIER + } + + ipRouteDest OBJECT-TYPE + SYNTAX IpAddress + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The destination IP address of this route. An + entry with a value of 0.0.0.0 is considered a + default route. Multiple routes to a single + destination can appear in the table, but access to + such multiple entries is dependent on the table- + access mechanisms defined by the network + management protocol in use." + ::= { ipRouteEntry 1 } + + ipRouteIfIndex OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The index value which uniquely identifies the + local interface through which the next hop of this + route should be reached. The interface identified + by a particular value of this index is the same + interface as identified by the same value of + ifIndex." + ::= { ipRouteEntry 2 } + + ipRouteMetric1 OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The primary routing metric for this route. The + semantics of this metric are determined by the + routing-protocol specified in the route's + ipRouteProto value. If this metric is not used, + its value should be set to -1." + ::= { ipRouteEntry 3 } + + ipRouteMetric2 OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-write + STATUS mandatory + DESCRIPTION + + + +SNMP Working Group [Page 34] + +RFC 1213 MIB-II March 1991 + + + "An alternate routing metric for this route. The + semantics of this metric are determined by the + routing-protocol specified in the route's + ipRouteProto value. If this metric is not used, + its value should be set to -1." + ::= { ipRouteEntry 4 } + + ipRouteMetric3 OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-write + STATUS mandatory + DESCRIPTION + "An alternate routing metric for this route. The + semantics of this metric are determined by the + routing-protocol specified in the route's + ipRouteProto value. If this metric is not used, + its value should be set to -1." + ::= { ipRouteEntry 5 } + + ipRouteMetric4 OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-write + STATUS mandatory + DESCRIPTION + "An alternate routing metric for this route. The + semantics of this metric are determined by the + routing-protocol specified in the route's + ipRouteProto value. If this metric is not used, + its value should be set to -1." + ::= { ipRouteEntry 6 } + + ipRouteNextHop OBJECT-TYPE + SYNTAX IpAddress + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The IP address of the next hop of this route. + (In the case of a route bound to an interface + which is realized via a broadcast media, the value + of this field is the agent's IP address on that + interface.)" + ::= { ipRouteEntry 7 } + + ipRouteType OBJECT-TYPE + SYNTAX INTEGER { + other(1), -- none of the following + + invalid(2), -- an invalidated route + + + +SNMP Working Group [Page 35] + +RFC 1213 MIB-II March 1991 + + + -- route to directly + direct(3), -- connected (sub-)network + + -- route to a non-local + indirect(4) -- host/network/sub-network + } + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The type of route. Note that the values + direct(3) and indirect(4) refer to the notion of + direct and indirect routing in the IP + architecture. + + Setting this object to the value invalid(2) has + the effect of invalidating the corresponding entry + in the ipRouteTable object. That is, it + effectively dissasociates the destination + identified with said entry from the route + identified with said entry. It is an + implementation-specific matter as to whether the + agent removes an invalidated entry from the table. + Accordingly, management stations must be prepared + to receive tabular information from agents that + corresponds to entries not currently in use. + Proper interpretation of such entries requires + examination of the relevant ipRouteType object." + ::= { ipRouteEntry 8 } + + ipRouteProto OBJECT-TYPE + SYNTAX INTEGER { + other(1), -- none of the following + + -- non-protocol information, + -- e.g., manually configured + local(2), -- entries + + -- set via a network + netmgmt(3), -- management protocol + + -- obtained via ICMP, + icmp(4), -- e.g., Redirect + + -- the remaining values are + -- all gateway routing + -- protocols + egp(5), + ggp(6), + + + +SNMP Working Group [Page 36] + +RFC 1213 MIB-II March 1991 + + + hello(7), + rip(8), + is-is(9), + es-is(10), + ciscoIgrp(11), + bbnSpfIgp(12), + ospf(13), + bgp(14) + } + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The routing mechanism via which this route was + learned. Inclusion of values for gateway routing + protocols is not intended to imply that hosts + should support those protocols." + ::= { ipRouteEntry 9 } + + ipRouteAge OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The number of seconds since this route was last + updated or otherwise determined to be correct. + Note that no semantics of `too old' can be implied + except through knowledge of the routing protocol + by which the route was learned." + ::= { ipRouteEntry 10 } + + ipRouteMask OBJECT-TYPE + SYNTAX IpAddress + ACCESS read-write + STATUS mandatory + DESCRIPTION + "Indicate the mask to be logical-ANDed with the + destination address before being compared to the + value in the ipRouteDest field. For those systems + that do not support arbitrary subnet masks, an + agent constructs the value of the ipRouteMask by + determining whether the value of the correspondent + ipRouteDest field belong to a class-A, B, or C + network, and then using one of: + + mask network + 255.0.0.0 class-A + 255.255.0.0 class-B + 255.255.255.0 class-C + + + +SNMP Working Group [Page 37] + +RFC 1213 MIB-II March 1991 + + + If the value of the ipRouteDest is 0.0.0.0 (a + default route), then the mask value is also + 0.0.0.0. It should be noted that all IP routing + subsystems implicitly use this mechanism." + ::= { ipRouteEntry 11 } + + ipRouteMetric5 OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-write + STATUS mandatory + DESCRIPTION + "An alternate routing metric for this route. The + semantics of this metric are determined by the + routing-protocol specified in the route's + ipRouteProto value. If this metric is not used, + its value should be set to -1." + ::= { ipRouteEntry 12 } + + ipRouteInfo OBJECT-TYPE + SYNTAX OBJECT IDENTIFIER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "A reference to MIB definitions specific to the + particular routing protocol which is responsible + for this route, as determined by the value + specified in the route's ipRouteProto value. If + this information is not present, its value should + be set to the OBJECT IDENTIFIER { 0 0 }, which is + a syntatically valid object identifier, and any + conformant implementation of ASN.1 and BER must be + able to generate and recognize this value." + ::= { ipRouteEntry 13 } + + + -- the IP Address Translation table + + -- The IP address translation table contain the IpAddress to + -- `physical' address equivalences. Some interfaces do not + -- use translation tables for determining address + -- equivalences (e.g., DDN-X.25 has an algorithmic method); + -- if all interfaces are of this type, then the Address + -- Translation table is empty, i.e., has zero entries. + + ipNetToMediaTable OBJECT-TYPE + SYNTAX SEQUENCE OF IpNetToMediaEntry + ACCESS not-accessible + STATUS mandatory + + + +SNMP Working Group [Page 38] + +RFC 1213 MIB-II March 1991 + + + DESCRIPTION + "The IP Address Translation table used for mapping + from IP addresses to physical addresses." + ::= { ip 22 } + + ipNetToMediaEntry OBJECT-TYPE + SYNTAX IpNetToMediaEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "Each entry contains one IpAddress to `physical' + address equivalence." + INDEX { ipNetToMediaIfIndex, + ipNetToMediaNetAddress } + ::= { ipNetToMediaTable 1 } + + IpNetToMediaEntry ::= + SEQUENCE { + ipNetToMediaIfIndex + INTEGER, + ipNetToMediaPhysAddress + PhysAddress, + ipNetToMediaNetAddress + IpAddress, + ipNetToMediaType + INTEGER + } + + ipNetToMediaIfIndex OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The interface on which this entry's equivalence + is effective. The interface identified by a + particular value of this index is the same + interface as identified by the same value of + ifIndex." + ::= { ipNetToMediaEntry 1 } + + ipNetToMediaPhysAddress OBJECT-TYPE + SYNTAX PhysAddress + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The media-dependent `physical' address." + ::= { ipNetToMediaEntry 2 } + + + + +SNMP Working Group [Page 39] + +RFC 1213 MIB-II March 1991 + + + ipNetToMediaNetAddress OBJECT-TYPE + SYNTAX IpAddress + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The IpAddress corresponding to the media- + dependent `physical' address." + ::= { ipNetToMediaEntry 3 } + + ipNetToMediaType OBJECT-TYPE + SYNTAX INTEGER { + other(1), -- none of the following + invalid(2), -- an invalidated mapping + dynamic(3), + static(4) + } + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The type of mapping. + + Setting this object to the value invalid(2) has + the effect of invalidating the corresponding entry + in the ipNetToMediaTable. That is, it effectively + dissasociates the interface identified with said + entry from the mapping identified with said entry. + It is an implementation-specific matter as to + whether the agent removes an invalidated entry + from the table. Accordingly, management stations + must be prepared to receive tabular information + from agents that corresponds to entries not + currently in use. Proper interpretation of such + entries requires examination of the relevant + ipNetToMediaType object." + ::= { ipNetToMediaEntry 4 } + + + -- additional IP objects + + ipRoutingDiscards OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of routing entries which were chosen + to be discarded even though they are valid. One + possible reason for discarding such an entry could + be to free-up buffer space for other routing + + + +SNMP Working Group [Page 40] + +RFC 1213 MIB-II March 1991 + + + entries." + ::= { ip 23 } + + + -- the ICMP group + + -- Implementation of the ICMP group is mandatory for all + -- systems. + + icmpInMsgs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of ICMP messages which the + entity received. Note that this counter includes + all those counted by icmpInErrors." + ::= { icmp 1 } + + icmpInErrors OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP messages which the entity + received but determined as having ICMP-specific + errors (bad ICMP checksums, bad length, etc.)." + ::= { icmp 2 } + + icmpInDestUnreachs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Destination Unreachable + messages received." + ::= { icmp 3 } + + icmpInTimeExcds OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Time Exceeded messages + received." + ::= { icmp 4 } + + + + + +SNMP Working Group [Page 41] + +RFC 1213 MIB-II March 1991 + + + icmpInParmProbs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Parameter Problem messages + received." + ::= { icmp 5 } + + icmpInSrcQuenchs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Source Quench messages + received." + ::= { icmp 6 } + + icmpInRedirects OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Redirect messages received." + ::= { icmp 7 } + + icmpInEchos OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Echo (request) messages + received." + ::= { icmp 8 } + + icmpInEchoReps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Echo Reply messages received." + ::= { icmp 9 } + + icmpInTimestamps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + + + +SNMP Working Group [Page 42] + +RFC 1213 MIB-II March 1991 + + + "The number of ICMP Timestamp (request) messages + received." + ::= { icmp 10 } + + icmpInTimestampReps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Timestamp Reply messages + received." + ::= { icmp 11 } + + icmpInAddrMasks OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Address Mask Request messages + received." + ::= { icmp 12 } + + icmpInAddrMaskReps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Address Mask Reply messages + received." + ::= { icmp 13 } + + icmpOutMsgs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of ICMP messages which this + entity attempted to send. Note that this counter + includes all those counted by icmpOutErrors." + ::= { icmp 14 } + + icmpOutErrors OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP messages which this entity did + not send due to problems discovered within ICMP + + + +SNMP Working Group [Page 43] + +RFC 1213 MIB-II March 1991 + + + such as a lack of buffers. This value should not + include errors discovered outside the ICMP layer + such as the inability of IP to route the resultant + datagram. In some implementations there may be no + types of error which contribute to this counter's + value." + ::= { icmp 15 } + + icmpOutDestUnreachs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Destination Unreachable + messages sent." + ::= { icmp 16 } + + icmpOutTimeExcds OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Time Exceeded messages sent." + ::= { icmp 17 } + + icmpOutParmProbs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Parameter Problem messages + sent." + ::= { icmp 18 } + + icmpOutSrcQuenchs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Source Quench messages sent." + ::= { icmp 19 } + + icmpOutRedirects OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Redirect messages sent. For a + + + +SNMP Working Group [Page 44] + +RFC 1213 MIB-II March 1991 + + + host, this object will always be zero, since hosts + do not send redirects." + ::= { icmp 20 } + + icmpOutEchos OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Echo (request) messages sent." + ::= { icmp 21 } + + icmpOutEchoReps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Echo Reply messages sent." + ::= { icmp 22 } + + icmpOutTimestamps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Timestamp (request) messages + sent." + ::= { icmp 23 } + + icmpOutTimestampReps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Timestamp Reply messages + sent." + ::= { icmp 24 } + + icmpOutAddrMasks OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Address Mask Request messages + sent." + ::= { icmp 25 } + + + + + +SNMP Working Group [Page 45] + +RFC 1213 MIB-II March 1991 + + + icmpOutAddrMaskReps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of ICMP Address Mask Reply messages + sent." + ::= { icmp 26 } + + + -- the TCP group + + -- Implementation of the TCP group is mandatory for all + -- systems that implement the TCP. + + -- Note that instances of object types that represent + -- information about a particular TCP connection are + -- transient; they persist only as long as the connection + -- in question. + + tcpRtoAlgorithm OBJECT-TYPE + SYNTAX INTEGER { + other(1), -- none of the following + + constant(2), -- a constant rto + rsre(3), -- MIL-STD-1778, Appendix B + vanj(4) -- Van Jacobson's algorithm [10] + } + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The algorithm used to determine the timeout value + used for retransmitting unacknowledged octets." + ::= { tcp 1 } + + tcpRtoMin OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The minimum value permitted by a TCP + implementation for the retransmission timeout, + measured in milliseconds. More refined semantics + for objects of this type depend upon the algorithm + used to determine the retransmission timeout. In + particular, when the timeout algorithm is rsre(3), + an object of this type has the semantics of the + LBOUND quantity described in RFC 793." + + + +SNMP Working Group [Page 46] + +RFC 1213 MIB-II March 1991 + + + ::= { tcp 2 } + + + tcpRtoMax OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The maximum value permitted by a TCP + implementation for the retransmission timeout, + measured in milliseconds. More refined semantics + for objects of this type depend upon the algorithm + used to determine the retransmission timeout. In + particular, when the timeout algorithm is rsre(3), + an object of this type has the semantics of the + UBOUND quantity described in RFC 793." + ::= { tcp 3 } + + tcpMaxConn OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The limit on the total number of TCP connections + the entity can support. In entities where the + maximum number of connections is dynamic, this + object should contain the value -1." + ::= { tcp 4 } + + tcpActiveOpens OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of times TCP connections have made a + direct transition to the SYN-SENT state from the + CLOSED state." + ::= { tcp 5 } + + tcpPassiveOpens OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of times TCP connections have made a + direct transition to the SYN-RCVD state from the + LISTEN state." + ::= { tcp 6 } + + + +SNMP Working Group [Page 47] + +RFC 1213 MIB-II March 1991 + + + tcpAttemptFails OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of times TCP connections have made a + direct transition to the CLOSED state from either + the SYN-SENT state or the SYN-RCVD state, plus the + number of times TCP connections have made a direct + transition to the LISTEN state from the SYN-RCVD + state." + ::= { tcp 7 } + + tcpEstabResets OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of times TCP connections have made a + direct transition to the CLOSED state from either + the ESTABLISHED state or the CLOSE-WAIT state." + ::= { tcp 8 } + + tcpCurrEstab OBJECT-TYPE + SYNTAX Gauge + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of TCP connections for which the + current state is either ESTABLISHED or CLOSE- + WAIT." + ::= { tcp 9 } + + tcpInSegs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of segments received, including + those received in error. This count includes + segments received on currently established + connections." + ::= { tcp 10 } + + tcpOutSegs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + + + +SNMP Working Group [Page 48] + +RFC 1213 MIB-II March 1991 + + + DESCRIPTION + "The total number of segments sent, including + those on current connections but excluding those + containing only retransmitted octets." + ::= { tcp 11 } + + tcpRetransSegs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of segments retransmitted - that + is, the number of TCP segments transmitted + containing one or more previously transmitted + octets." + ::= { tcp 12 } + + + -- the TCP Connection table + + -- The TCP connection table contains information about this + -- entity's existing TCP connections. + + tcpConnTable OBJECT-TYPE + SYNTAX SEQUENCE OF TcpConnEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "A table containing TCP connection-specific + information." + ::= { tcp 13 } + + tcpConnEntry OBJECT-TYPE + SYNTAX TcpConnEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "Information about a particular current TCP + connection. An object of this type is transient, + in that it ceases to exist when (or soon after) + the connection makes the transition to the CLOSED + state." + INDEX { tcpConnLocalAddress, + tcpConnLocalPort, + tcpConnRemAddress, + tcpConnRemPort } + ::= { tcpConnTable 1 } + + + + +SNMP Working Group [Page 49] + +RFC 1213 MIB-II March 1991 + + + TcpConnEntry ::= + SEQUENCE { + tcpConnState + INTEGER, + tcpConnLocalAddress + IpAddress, + tcpConnLocalPort + INTEGER (0..65535), + tcpConnRemAddress + IpAddress, + tcpConnRemPort + INTEGER (0..65535) + } + + tcpConnState OBJECT-TYPE + SYNTAX INTEGER { + closed(1), + listen(2), + synSent(3), + synReceived(4), + established(5), + finWait1(6), + finWait2(7), + closeWait(8), + lastAck(9), + closing(10), + timeWait(11), + deleteTCB(12) + } + ACCESS read-write + STATUS mandatory + DESCRIPTION + "The state of this TCP connection. + + The only value which may be set by a management + station is deleteTCB(12). Accordingly, it is + appropriate for an agent to return a `badValue' + response if a management station attempts to set + this object to any other value. + + If a management station sets this object to the + value deleteTCB(12), then this has the effect of + deleting the TCB (as defined in RFC 793) of the + corresponding connection on the managed node, + resulting in immediate termination of the + connection. + + As an implementation-specific option, a RST + + + +SNMP Working Group [Page 50] + +RFC 1213 MIB-II March 1991 + + + segment may be sent from the managed node to the + other TCP endpoint (note however that RST segments + are not sent reliably)." + ::= { tcpConnEntry 1 } + + tcpConnLocalAddress OBJECT-TYPE + SYNTAX IpAddress + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The local IP address for this TCP connection. In + the case of a connection in the listen state which + is willing to accept connections for any IP + interface associated with the node, the value + 0.0.0.0 is used." + ::= { tcpConnEntry 2 } + + tcpConnLocalPort OBJECT-TYPE + SYNTAX INTEGER (0..65535) + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The local port number for this TCP connection." + ::= { tcpConnEntry 3 } + + tcpConnRemAddress OBJECT-TYPE + SYNTAX IpAddress + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The remote IP address for this TCP connection." + ::= { tcpConnEntry 4 } + + tcpConnRemPort OBJECT-TYPE + SYNTAX INTEGER (0..65535) + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The remote port number for this TCP connection." + ::= { tcpConnEntry 5 } + + + -- additional TCP objects + + tcpInErrs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + + + +SNMP Working Group [Page 51] + +RFC 1213 MIB-II March 1991 + + + DESCRIPTION + "The total number of segments received in error + (e.g., bad TCP checksums)." + ::= { tcp 14 } + + tcpOutRsts OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of TCP segments sent containing the + RST flag." + ::= { tcp 15 } + + + -- the UDP group + + -- Implementation of the UDP group is mandatory for all + -- systems which implement the UDP. + + udpInDatagrams OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of UDP datagrams delivered to + UDP users." + ::= { udp 1 } + + udpNoPorts OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of received UDP datagrams for + which there was no application at the destination + port." + ::= { udp 2 } + + udpInErrors OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of received UDP datagrams that could + not be delivered for reasons other than the lack + of an application at the destination port." + ::= { udp 3 } + + + +SNMP Working Group [Page 52] + +RFC 1213 MIB-II March 1991 + + + udpOutDatagrams OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of UDP datagrams sent from this + entity." + ::= { udp 4 } + + + -- the UDP Listener table + + -- The UDP listener table contains information about this + -- entity's UDP end-points on which a local application is + -- currently accepting datagrams. + + udpTable OBJECT-TYPE + SYNTAX SEQUENCE OF UdpEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "A table containing UDP listener information." + ::= { udp 5 } + + udpEntry OBJECT-TYPE + SYNTAX UdpEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "Information about a particular current UDP + listener." + INDEX { udpLocalAddress, udpLocalPort } + ::= { udpTable 1 } + + UdpEntry ::= + SEQUENCE { + udpLocalAddress + IpAddress, + udpLocalPort + INTEGER (0..65535) + } + + udpLocalAddress OBJECT-TYPE + SYNTAX IpAddress + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The local IP address for this UDP listener. In + + + +SNMP Working Group [Page 53] + +RFC 1213 MIB-II March 1991 + + + the case of a UDP listener which is willing to + accept datagrams for any IP interface associated + with the node, the value 0.0.0.0 is used." + ::= { udpEntry 1 } + + udpLocalPort OBJECT-TYPE + SYNTAX INTEGER (0..65535) + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The local port number for this UDP listener." + ::= { udpEntry 2 } + + + -- the EGP group + + -- Implementation of the EGP group is mandatory for all + -- systems which implement the EGP. + + egpInMsgs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of EGP messages received without + error." + ::= { egp 1 } + + egpInErrors OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of EGP messages received that proved + to be in error." + ::= { egp 2 } + + egpOutMsgs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of locally generated EGP + messages." + ::= { egp 3 } + + egpOutErrors OBJECT-TYPE + SYNTAX Counter + + + +SNMP Working Group [Page 54] + +RFC 1213 MIB-II March 1991 + + + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of locally generated EGP messages not + sent due to resource limitations within an EGP + entity." + ::= { egp 4 } + + + -- the EGP Neighbor table + + -- The EGP neighbor table contains information about this + -- entity's EGP neighbors. + + egpNeighTable OBJECT-TYPE + SYNTAX SEQUENCE OF EgpNeighEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "The EGP neighbor table." + ::= { egp 5 } + + egpNeighEntry OBJECT-TYPE + SYNTAX EgpNeighEntry + ACCESS not-accessible + STATUS mandatory + DESCRIPTION + "Information about this entity's relationship with + a particular EGP neighbor." + INDEX { egpNeighAddr } + ::= { egpNeighTable 1 } + + EgpNeighEntry ::= + SEQUENCE { + egpNeighState + INTEGER, + egpNeighAddr + IpAddress, + egpNeighAs + INTEGER, + egpNeighInMsgs + Counter, + egpNeighInErrs + Counter, + egpNeighOutMsgs + Counter, + egpNeighOutErrs + Counter, + + + +SNMP Working Group [Page 55] + +RFC 1213 MIB-II March 1991 + + + egpNeighInErrMsgs + Counter, + egpNeighOutErrMsgs + Counter, + egpNeighStateUps + Counter, + egpNeighStateDowns + Counter, + egpNeighIntervalHello + INTEGER, + egpNeighIntervalPoll + INTEGER, + egpNeighMode + INTEGER, + egpNeighEventTrigger + INTEGER + } + + egpNeighState OBJECT-TYPE + SYNTAX INTEGER { + idle(1), + acquisition(2), + down(3), + up(4), + cease(5) + } + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The EGP state of the local system with respect to + this entry's EGP neighbor. Each EGP state is + represented by a value that is one greater than + the numerical value associated with said state in + RFC 904." + ::= { egpNeighEntry 1 } + + egpNeighAddr OBJECT-TYPE + SYNTAX IpAddress + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The IP address of this entry's EGP neighbor." + ::= { egpNeighEntry 2 } + + egpNeighAs OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + + + +SNMP Working Group [Page 56] + +RFC 1213 MIB-II March 1991 + + + DESCRIPTION + "The autonomous system of this EGP peer. Zero + should be specified if the autonomous system + number of the neighbor is not yet known." + ::= { egpNeighEntry 3 } + + egpNeighInMsgs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of EGP messages received without error + from this EGP peer." + ::= { egpNeighEntry 4 } + + egpNeighInErrs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of EGP messages received from this EGP + peer that proved to be in error (e.g., bad EGP + checksum)." + ::= { egpNeighEntry 5 } + + egpNeighOutMsgs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of locally generated EGP messages to + this EGP peer." + ::= { egpNeighEntry 6 } + + egpNeighOutErrs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of locally generated EGP messages not + sent to this EGP peer due to resource limitations + within an EGP entity." + ::= { egpNeighEntry 7 } + + egpNeighInErrMsgs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + + + +SNMP Working Group [Page 57] + +RFC 1213 MIB-II March 1991 + + + DESCRIPTION + "The number of EGP-defined error messages received + from this EGP peer." + ::= { egpNeighEntry 8 } + + egpNeighOutErrMsgs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of EGP-defined error messages sent to + this EGP peer." + ::= { egpNeighEntry 9 } + + egpNeighStateUps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of EGP state transitions to the UP + state with this EGP peer." + ::= { egpNeighEntry 10 } + + egpNeighStateDowns OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The number of EGP state transitions from the UP + state to any other state with this EGP peer." + ::= { egpNeighEntry 11 } + + egpNeighIntervalHello OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The interval between EGP Hello command + retransmissions (in hundredths of a second). This + represents the t1 timer as defined in RFC 904." + ::= { egpNeighEntry 12 } + + egpNeighIntervalPoll OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The interval between EGP poll command + + + +SNMP Working Group [Page 58] + +RFC 1213 MIB-II March 1991 + + + retransmissions (in hundredths of a second). This + represents the t3 timer as defined in RFC 904." + ::= { egpNeighEntry 13 } + + egpNeighMode OBJECT-TYPE + SYNTAX INTEGER { active(1), passive(2) } + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The polling mode of this EGP entity, either + passive or active." + ::= { egpNeighEntry 14 } + + egpNeighEventTrigger OBJECT-TYPE + SYNTAX INTEGER { start(1), stop(2) } + ACCESS read-write + STATUS mandatory + DESCRIPTION + "A control variable used to trigger operator- + initiated Start and Stop events. When read, this + variable always returns the most recent value that + egpNeighEventTrigger was set to. If it has not + been set since the last initialization of the + network management subsystem on the node, it + returns a value of `stop'. + + When set, this variable causes a Start or Stop + event on the specified neighbor, as specified on + pages 8-10 of RFC 904. Briefly, a Start event + causes an Idle peer to begin neighbor acquisition + and a non-Idle peer to reinitiate neighbor + acquisition. A stop event causes a non-Idle peer + to return to the Idle state until a Start event + occurs, either via egpNeighEventTrigger or + otherwise." + ::= { egpNeighEntry 15 } + + + -- additional EGP objects + + egpAs OBJECT-TYPE + SYNTAX INTEGER + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The autonomous system number of this EGP entity." + ::= { egp 6 } + + + + +SNMP Working Group [Page 59] + +RFC 1213 MIB-II March 1991 + + + -- the Transmission group + + -- Based on the transmission media underlying each interface + -- on a system, the corresponding portion of the Transmission + -- group is mandatory for that system. + + -- When Internet-standard definitions for managing + -- transmission media are defined, the transmission group is + -- used to provide a prefix for the names of those objects. + + -- Typically, such definitions reside in the experimental + -- portion of the MIB until they are "proven", then as a + -- part of the Internet standardization process, the + -- definitions are accordingly elevated and a new object + -- identifier, under the transmission group is defined. By + -- convention, the name assigned is: + -- + -- type OBJECT IDENTIFIER ::= { transmission number } + -- + -- where "type" is the symbolic value used for the media in + -- the ifType column of the ifTable object, and "number" is + -- the actual integer value corresponding to the symbol. + + + -- the SNMP group + + -- Implementation of the SNMP group is mandatory for all + -- systems which support an SNMP protocol entity. Some of + -- the objects defined below will be zero-valued in those + -- SNMP implementations that are optimized to support only + -- those functions specific to either a management agent or + -- a management station. In particular, it should be + -- observed that the objects below refer to an SNMP entity, + -- and there may be several SNMP entities residing on a + -- managed node (e.g., if the node is hosting acting as + -- a management station). + + snmpInPkts OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of Messages delivered to the + SNMP entity from the transport service." + ::= { snmp 1 } + + snmpOutPkts OBJECT-TYPE + SYNTAX Counter + + + +SNMP Working Group [Page 60] + +RFC 1213 MIB-II March 1991 + + + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Messages which were + passed from the SNMP protocol entity to the + transport service." + ::= { snmp 2 } + + snmpInBadVersions OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Messages which were + delivered to the SNMP protocol entity and were for + an unsupported SNMP version." + ::= { snmp 3 } + + snmpInBadCommunityNames OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Messages delivered to + the SNMP protocol entity which used a SNMP + community name not known to said entity." + ::= { snmp 4 } + + snmpInBadCommunityUses OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Messages delivered to + the SNMP protocol entity which represented an SNMP + operation which was not allowed by the SNMP + community named in the Message." + ::= { snmp 5 } + + snmpInASNParseErrs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of ASN.1 or BER errors + encountered by the SNMP protocol entity when + decoding received SNMP Messages." + ::= { snmp 6 } + + + +SNMP Working Group [Page 61] + +RFC 1213 MIB-II March 1991 + + + -- { snmp 7 } is not used + + snmpInTooBigs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP PDUs which were + delivered to the SNMP protocol entity and for + which the value of the error-status field is + `tooBig'." + ::= { snmp 8 } + + snmpInNoSuchNames OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP PDUs which were + delivered to the SNMP protocol entity and for + which the value of the error-status field is + `noSuchName'." + ::= { snmp 9 } + + snmpInBadValues OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP PDUs which were + delivered to the SNMP protocol entity and for + which the value of the error-status field is + `badValue'." + ::= { snmp 10 } + + snmpInReadOnlys OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number valid SNMP PDUs which were + delivered to the SNMP protocol entity and for + which the value of the error-status field is + `readOnly'. It should be noted that it is a + protocol error to generate an SNMP PDU which + contains the value `readOnly' in the error-status + field, as such this object is provided as a means + of detecting incorrect implementations of the + + + +SNMP Working Group [Page 62] + +RFC 1213 MIB-II March 1991 + + + SNMP." + ::= { snmp 11 } + + snmpInGenErrs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP PDUs which were + delivered to the SNMP protocol entity and for + which the value of the error-status field is + `genErr'." + ::= { snmp 12 } + + snmpInTotalReqVars OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of MIB objects which have been + retrieved successfully by the SNMP protocol entity + as the result of receiving valid SNMP Get-Request + and Get-Next PDUs." + ::= { snmp 13 } + + snmpInTotalSetVars OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of MIB objects which have been + altered successfully by the SNMP protocol entity + as the result of receiving valid SNMP Set-Request + PDUs." + ::= { snmp 14 } + + snmpInGetRequests OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Get-Request PDUs which + have been accepted and processed by the SNMP + protocol entity." + ::= { snmp 15 } + + snmpInGetNexts OBJECT-TYPE + SYNTAX Counter + + + +SNMP Working Group [Page 63] + +RFC 1213 MIB-II March 1991 + + + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Get-Next PDUs which have + been accepted and processed by the SNMP protocol + entity." + ::= { snmp 16 } + + snmpInSetRequests OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Set-Request PDUs which + have been accepted and processed by the SNMP + protocol entity." + ::= { snmp 17 } + + snmpInGetResponses OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Get-Response PDUs which + have been accepted and processed by the SNMP + protocol entity." + ::= { snmp 18 } + + snmpInTraps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Trap PDUs which have + been accepted and processed by the SNMP protocol + entity." + ::= { snmp 19 } + + snmpOutTooBigs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP PDUs which were + generated by the SNMP protocol entity and for + which the value of the error-status field is + `tooBig.'" + ::= { snmp 20 } + + + +SNMP Working Group [Page 64] + +RFC 1213 MIB-II March 1991 + + + snmpOutNoSuchNames OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP PDUs which were + generated by the SNMP protocol entity and for + which the value of the error-status is + `noSuchName'." + ::= { snmp 21 } + + snmpOutBadValues OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP PDUs which were + generated by the SNMP protocol entity and for + which the value of the error-status field is + `badValue'." + ::= { snmp 22 } + + -- { snmp 23 } is not used + + snmpOutGenErrs OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP PDUs which were + generated by the SNMP protocol entity and for + which the value of the error-status field is + `genErr'." + ::= { snmp 24 } + + snmpOutGetRequests OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Get-Request PDUs which + have been generated by the SNMP protocol entity." + ::= { snmp 25 } + + snmpOutGetNexts OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + + + +SNMP Working Group [Page 65] + +RFC 1213 MIB-II March 1991 + + + DESCRIPTION + "The total number of SNMP Get-Next PDUs which have + been generated by the SNMP protocol entity." + ::= { snmp 26 } + + snmpOutSetRequests OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Set-Request PDUs which + have been generated by the SNMP protocol entity." + ::= { snmp 27 } + + snmpOutGetResponses OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Get-Response PDUs which + have been generated by the SNMP protocol entity." + ::= { snmp 28 } + + snmpOutTraps OBJECT-TYPE + SYNTAX Counter + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The total number of SNMP Trap PDUs which have + been generated by the SNMP protocol entity." + ::= { snmp 29 } + + snmpEnableAuthenTraps OBJECT-TYPE + SYNTAX INTEGER { enabled(1), disabled(2) } + ACCESS read-write + STATUS mandatory + DESCRIPTION + "Indicates whether the SNMP agent process is + permitted to generate authentication-failure + traps. The value of this object overrides any + configuration information; as such, it provides a + means whereby all authentication-failure traps may + be disabled. + + Note that it is strongly recommended that this + object be stored in non-volatile memory so that it + remains constant between re-initializations of the + network management system." + + + +SNMP Working Group [Page 66] + +RFC 1213 MIB-II March 1991 + + + ::= { snmp 30 } + + END + +7. Acknowledgements + + This document was produced by the SNMP Working Group: + + Anne Ambler, Spider + Karl Auerbach, Sun + Fred Baker, ACC + David Bridgham, Epilogue Technology + Ken Brinkerhoff + Ron Broersma, NOSC + Brian Brown, Synoptics + Jack Brown, US Army + Theodore Brunner, Bellcore + Jeff Buffum, HP + Jeffrey Buffum, HP + John Burress, Wellfleet + Jeffrey D. Case, University of Tennessee at Knoxville + Chris Chiptasso, Spartacus + Paul Ciarfella, DEC + Bob Collet + John Cook, Chipcom + Tracy Cox, Bellcore + James R. Davin, MIT-LCS + Eric Decker, cisco + Kurt Dobbins, Cabletron + Nadya El-Afandi, Network Systems + Gary Ellis, HP + Fred Engle + Mike Erlinger + Mark S. Fedor, PSI + Richard Fox, Synoptics + Karen Frisa, CMU + Stan Froyd, ACC + Chris Gunner, DEC + Fred Harris, University of Tennessee at Knoxville + Ken Hibbard, Xylogics + Ole Jacobsen, Interop + Ken Jones + Satish Joshi, Synoptics + Frank Kastenholz, Racal-Interlan + Shimshon Kaufman, Spartacus + Ken Key, University of Tennessee at Knoxville + Jim Kinder, Fibercom + Alex Koifman, BBN + + + +SNMP Working Group [Page 67] + +RFC 1213 MIB-II March 1991 + + + Christopher Kolb, PSI + Cheryl Krupczak, NCR + Paul Langille, DEC + Martin Lee Schoffstall, PSI + Peter Lin, Vitalink + John Lunny, TWG + Carl Malamud + Gary Malkin, FTP Software, Inc. + Randy Mayhew, University of Tennessee at Knoxville + Keith McCloghrie, Hughes LAN Systems + Donna McMaster, David Systems + Lynn Monsanto, Sun + Dave Perkins, 3COM + Jim Reinstedler, Ungerman Bass + Anil Rijsinghani, DEC + Kathy Rinehart, Arnold AFB + Kary Robertson + Marshall T. Rose, PSI (chair) + L. Michael Sabo, NCSC + Jon Saperia, DEC + Greg Satz, cisco + Martin Schoffstall, PSI + John Seligson + Steve Sherry, Xyplex + Fei Shu, NEC + Sam Sjogren, TGV + Mark Sleeper, Sparta + Lance Sprung + Mike St.Johns + Bob Stewart, Xyplex + Emil Sturniold + Kaj Tesink, Bellcore + Geoff Thompson, Synoptics + Dean Throop, Data General + Bill Townsend, Xylogics + Maurice Turcotte, Racal-Milgo + Kannan Varadhou + Sudhanshu Verma, HP + Bill Versteeg, Network Research Corporation + Warren Vik, Interactive Systems + David Waitzman, BBN + Steve Waldbusser, CMU + Dan Wintringhan + David Wood + Wengyik Yeong, PSI + Jeff Young, Cray Research + + + + + +SNMP Working Group [Page 68] + +RFC 1213 MIB-II March 1991 + + + In addition, the comments of the following individuals are also + acknolwedged: + + Craig A. Finseth, Minnesota Supercomputer Center, Inc. + Jeffrey C. Honig, Cornell University Theory Center + Philip R. Karn, Bellcore + +8. References + + [1] Cerf, V., "IAB Recommendations for the Development of Internet + Network Management Standards", RFC 1052, NRI, April 1988. + + [2] Rose M., and K. McCloghrie, "Structure and Identification of + Management Information for TCP/IP-based internets," RFC 1065, + TWG, August 1988. + + [3] McCloghrie, K., and M. Rose, "Management Information Base for + Network Management of TCP/IP-based internets, RFC 1066, TWG, + August 1988. + + [4] Cerf, V., "Report of the Second Ad Hoc Network Management Review + Group", RFC 1109, NRI, August 1989. + + [5] Case, J., Fedor, M., Schoffstall, M., and J. Davin, "Simple + Network Management Protocol (SNMP)", RFC 1098, University of + Tennessee at Knoxville, NYSERNet, Inc., Rensselaer Polytechnic + Institute, MIT Laboratory for Computer Science, April 1989. + + [6] Postel, J., and J. Reynolds, "TELNET Protocol Specification", RFC + 854, USC/Information Sciences Institute, May 1983. + + [7] Satz, G., "Connectionless Network Protocol (ISO 8473) and End + System to Intermediate System (ISO 9542) Management Information + Base", RFC 1162, cisco Systems, Inc., June 1990. + + [8] Information processing systems - Open Systems Interconnection - + Specification of Abstract Syntax Notation One (ASN.1), + International Organization for Standardization, International + Standard 8824, December 1987. + + [9] Information processing systems - Open Systems Interconnection - + Specification of Basic Encoding Rules for Abstract Notation One + (ASN.1), International Organization for Standardization, + International Standard 8825, December 1987. + + [10] Jacobson, V., "Congestion Avoidance and Control", SIGCOMM 1988, + Stanford, California. + + + + +SNMP Working Group [Page 69] + +RFC 1213 MIB-II March 1991 + + + [11] Hagens, R., Hall, N., and M. Rose, "Use of the Internet as a + Subnetwork for Experimentation with the OSI Network Layer", RFC + 1070, U of Wiscsonsin - Madison, U of Wiscsonsin - Madison, The + Wollongong Group, February 1989. + + [12] Rose M., and K. McCloghrie, "Structure and Identification of + Management Information for TCP/IP-based internets", RFC 1155, + Performance Systems International, Hughes LAN Systems, May 1990. + + [13] Case, J., Fedor, M., Schoffstall, M., and J. Davin, "Simple + Network Management Protocol", RFC 1157, SNMP Research, + Performance Systems International, Performance Systems + International, MIT Laboratory for Computer Science, May 1990. + + [14] Rose, M., and K. McCloghrie, Editors, "Concise MIB Definitions", + RFC 1212, Performance Systems International, Hughes LAN Systems, + March 1991. + +9. Security Considerations + + Security issues are not discussed in this memo. + +10. Authors' Addresses + + Keith McCloghrie + Hughes LAN Systems + 1225 Charleston Road + Mountain View, CA 94043 + 1225 Charleston Road + Mountain View, CA 94043 + + Phone: (415) 966-7934 + + EMail: kzm@hls.com + + + Marshall T. Rose + Performance Systems International + 5201 Great America Parkway + Suite 3106 + Santa Clara, CA 95054 + + Phone: +1 408 562 6222 + + EMail: mrose@psi.com + X.500: rose, psi, us + + + + + +SNMP Working Group [Page 70] + \ No newline at end of file diff --git a/standards/rfc2578.txt b/standards/rfc2578.txt new file mode 100644 index 000000000..0c1423c24 --- /dev/null +++ b/standards/rfc2578.txt @@ -0,0 +1,2541 @@ + + + + + + + +Network Working Group Editors of this version: +Request for Comments: 2578 K. McCloghrie +STD: 58 Cisco Systems +Obsoletes: 1902 D. Perkins +Category: Standards Track SNMPinfo + J. Schoenwaelder + TU Braunschweig + Authors of previous version: + J. Case + SNMP Research + K. McCloghrie + Cisco Systems + M. Rose + First Virtual Holdings + S. Waldbusser + International Network Services + April 1999 + + + Structure of Management Information Version 2 (SMIv2) + + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (1999). All Rights Reserved. + + +Table of Contents + + 1 Introduction .................................................3 + 1.1 A Note on Terminology ......................................4 + 2 Definitions ..................................................4 + 2.1 The MODULE-IDENTITY macro ..................................5 + 2.2 Object Names and Syntaxes ..................................5 + 2.3 The OBJECT-TYPE macro ......................................8 + 2.5 The NOTIFICATION-TYPE macro ...............................10 + 2.6 Administrative Identifiers ................................11 + 3 Information Modules .........................................11 + 3.1 Macro Invocation ..........................................12 + 3.1.1 Textual Values and Strings ..............................13 + + +McCloghrie, et al. Standards Track [Page 1] + + + + + +RFC 2578 SMIv2 April 1999 + + + 3.2 IMPORTing Symbols .........................................14 + 3.3 Exporting Symbols .........................................14 + 3.4 ASN.1 Comments ............................................14 + 3.5 OBJECT IDENTIFIER values ..................................15 + 3.6 OBJECT IDENTIFIER usage ...................................15 + 3.7 Reserved Keywords .........................................16 + 4 Naming Hierarchy ............................................16 + 5 Mapping of the MODULE-IDENTITY macro ........................17 + 5.1 Mapping of the LAST-UPDATED clause ........................17 + 5.2 Mapping of the ORGANIZATION clause ........................17 + 5.3 Mapping of the CONTACT-INFO clause ........................18 + 5.4 Mapping of the DESCRIPTION clause .........................18 + 5.5 Mapping of the REVISION clause ............................18 + 5.5.1 Mapping of the DESCRIPTION sub-clause ...................18 + 5.6 Mapping of the MODULE-IDENTITY value ......................18 + 5.7 Usage Example .............................................18 + 6 Mapping of the OBJECT-IDENTITY macro ........................19 + 6.1 Mapping of the STATUS clause ..............................19 + 6.2 Mapping of the DESCRIPTION clause .........................20 + 6.3 Mapping of the REFERENCE clause ...........................20 + 6.4 Mapping of the OBJECT-IDENTITY value ......................20 + 6.5 Usage Example .............................................20 + 7 Mapping of the OBJECT-TYPE macro ............................20 + 7.1 Mapping of the SYNTAX clause ..............................21 + 7.1.1 Integer32 and INTEGER ...................................21 + 7.1.2 OCTET STRING ............................................21 + 7.1.3 OBJECT IDENTIFIER .......................................22 + 7.1.4 The BITS construct ......................................22 + 7.1.5 IpAddress ...............................................22 + 7.1.6 Counter32 ...............................................23 + 7.1.7 Gauge32 .................................................23 + 7.1.8 TimeTicks ...............................................24 + 7.1.9 Opaque ..................................................24 + 7.1.10 Counter64 ..............................................24 + 7.1.11 Unsigned32 .............................................25 + 7.1.12 Conceptual Tables ......................................25 + 7.1.12.1 Creation and Deletion of Conceptual Rows .............26 + 7.2 Mapping of the UNITS clause ...............................26 + 7.3 Mapping of the MAX-ACCESS clause ..........................26 + 7.4 Mapping of the STATUS clause ..............................27 + 7.5 Mapping of the DESCRIPTION clause .........................27 + 7.6 Mapping of the REFERENCE clause ...........................27 + 7.7 Mapping of the INDEX clause ...............................27 + 7.8 Mapping of the AUGMENTS clause ............................29 + 7.8.1 Relation between INDEX and AUGMENTS clauses .............30 + 7.9 Mapping of the DEFVAL clause ..............................30 + 7.10 Mapping of the OBJECT-TYPE value .........................31 + 7.11 Usage Example ............................................32 + + +McCloghrie, et al. Standards Track [Page 2] + + + + + +RFC 2578 SMIv2 April 1999 + + + 8 Mapping of the NOTIFICATION-TYPE macro ......................34 + 8.1 Mapping of the OBJECTS clause .............................34 + 8.2 Mapping of the STATUS clause ..............................34 + 8.3 Mapping of the DESCRIPTION clause .........................35 + 8.4 Mapping of the REFERENCE clause ...........................35 + 8.5 Mapping of the NOTIFICATION-TYPE value ....................35 + 8.6 Usage Example .............................................35 + 9 Refined Syntax ..............................................36 + 10 Extending an Information Module ............................37 + 10.1 Object Assignments .......................................37 + 10.2 Object Definitions .......................................38 + 10.3 Notification Definitions .................................39 + 11 Appendix A: Detailed Sub-typing Rules ......................40 + 11.1 Syntax Rules .............................................40 + 11.2 Examples .................................................41 + 12 Security Considerations ....................................41 + 13 Editors' Addresses .........................................41 + 14 References .................................................42 + 15 Full Copyright Statement ...................................43 + +1. Introduction + + Management information is viewed as a collection of managed objects, + residing in a virtual information store, termed the Management + Information Base (MIB). Collections of related objects are defined + in MIB modules. These modules are written using an adapted subset of + OSI's Abstract Syntax Notation One, ASN.1 (1988) [1]. It is the + purpose of this document, the Structure of Management Information + (SMI), to define that adapted subset, and to assign a set of + associated administrative values. + + The SMI is divided into three parts: module definitions, object + definitions, and, notification definitions. + +(1) Module definitions are used when describing information modules. + An ASN.1 macro, MODULE-IDENTITY, is used to concisely convey the + semantics of an information module. + +(2) Object definitions are used when describing managed objects. An + ASN.1 macro, OBJECT-TYPE, is used to concisely convey the syntax + and semantics of a managed object. + +(3) Notification definitions are used when describing unsolicited + transmissions of management information. An ASN.1 macro, + NOTIFICATION-TYPE, is used to concisely convey the syntax and + semantics of a notification. + + + + +McCloghrie, et al. Standards Track [Page 3] + + + + + +RFC 2578 SMIv2 April 1999 + + +1.1. A Note on Terminology + + For the purpose of exposition, the original Structure of Management + Information, as described in RFCs 1155 (STD 16), 1212 (STD 16), and + RFC 1215, is termed the SMI version 1 (SMIv1). The current version + of the Structure of Management Information is termed SMI version 2 + (SMIv2). + +2. Definitions + +SNMPv2-SMI DEFINITIONS ::= BEGIN + + +-- the path to the root + +org OBJECT IDENTIFIER ::= { iso 3 } -- "iso" = 1 +dod OBJECT IDENTIFIER ::= { org 6 } +internet OBJECT IDENTIFIER ::= { dod 1 } + +directory OBJECT IDENTIFIER ::= { internet 1 } + +mgmt OBJECT IDENTIFIER ::= { internet 2 } +mib-2 OBJECT IDENTIFIER ::= { mgmt 1 } +transmission OBJECT IDENTIFIER ::= { mib-2 10 } + +experimental OBJECT IDENTIFIER ::= { internet 3 } + +private OBJECT IDENTIFIER ::= { internet 4 } +enterprises OBJECT IDENTIFIER ::= { private 1 } + +security OBJECT IDENTIFIER ::= { internet 5 } + +snmpV2 OBJECT IDENTIFIER ::= { internet 6 } + +-- transport domains +snmpDomains OBJECT IDENTIFIER ::= { snmpV2 1 } + +-- transport proxies +snmpProxys OBJECT IDENTIFIER ::= { snmpV2 2 } + +-- module identities +snmpModules OBJECT IDENTIFIER ::= { snmpV2 3 } + +-- Extended UTCTime, to allow dates with four-digit years +-- (Note that this definition of ExtUTCTime is not to be IMPORTed +-- by MIB modules.) +ExtUTCTime ::= OCTET STRING(SIZE(11 | 13)) + -- format is YYMMDDHHMMZ or YYYYMMDDHHMMZ + + +McCloghrie, et al. Standards Track [Page 4] + + + + + +RFC 2578 SMIv2 April 1999 + + + -- where: YY - last two digits of year (only years + -- between 1900-1999) + -- YYYY - last four digits of the year (any year) + -- MM - month (01 through 12) + -- DD - day of month (01 through 31) + -- HH - hours (00 through 23) + -- MM - minutes (00 through 59) + -- Z - denotes GMT (the ASCII character Z) + -- + -- For example, "9502192015Z" and "199502192015Z" represent + -- 8:15pm GMT on 19 February 1995. Years after 1999 must use + -- the four digit year format. Years 1900-1999 may use the + -- two or four digit format. + +-- definitions for information modules + +MODULE-IDENTITY MACRO ::= +BEGIN + TYPE NOTATION ::= + "LAST-UPDATED" value(Update ExtUTCTime) + "ORGANIZATION" Text + "CONTACT-INFO" Text + "DESCRIPTION" Text + RevisionPart + + VALUE NOTATION ::= + value(VALUE OBJECT IDENTIFIER) + + RevisionPart ::= + Revisions + | empty + Revisions ::= + Revision + | Revisions Revision + Revision ::= + "REVISION" value(Update ExtUTCTime) + "DESCRIPTION" Text + + -- a character string as defined in section 3.1.1 + Text ::= value(IA5String) +END + + +OBJECT-IDENTITY MACRO ::= +BEGIN + TYPE NOTATION ::= + "STATUS" Status + "DESCRIPTION" Text + + +McCloghrie, et al. Standards Track [Page 5] + + + + + +RFC 2578 SMIv2 April 1999 + + + ReferPart + + VALUE NOTATION ::= + value(VALUE OBJECT IDENTIFIER) + + Status ::= + "current" + | "deprecated" + | "obsolete" + + ReferPart ::= + "REFERENCE" Text + | empty + + -- a character string as defined in section 3.1.1 + Text ::= value(IA5String) +END + + +-- names of objects +-- (Note that these definitions of ObjectName and NotificationName +-- are not to be IMPORTed by MIB modules.) + +ObjectName ::= + OBJECT IDENTIFIER + +NotificationName ::= + OBJECT IDENTIFIER + +-- syntax of objects + +-- the "base types" defined here are: +-- 3 built-in ASN.1 types: INTEGER, OCTET STRING, OBJECT IDENTIFIER +-- 8 application-defined types: Integer32, IpAddress, Counter32, +-- Gauge32, Unsigned32, TimeTicks, Opaque, and Counter64 + +ObjectSyntax ::= + CHOICE { + simple + SimpleSyntax, + + -- note that SEQUENCEs for conceptual tables and + -- rows are not mentioned here... + + application-wide + ApplicationSyntax + } + + + +McCloghrie, et al. Standards Track [Page 6] + + + + + +RFC 2578 SMIv2 April 1999 + + +-- built-in ASN.1 types + +SimpleSyntax ::= + CHOICE { + -- INTEGERs with a more restrictive range + -- may also be used + integer-value -- includes Integer32 + INTEGER (-2147483648..2147483647), + + -- OCTET STRINGs with a more restrictive size + -- may also be used + string-value + OCTET STRING (SIZE (0..65535)), + + objectID-value + OBJECT IDENTIFIER + } + +-- indistinguishable from INTEGER, but never needs more than +-- 32-bits for a two's complement representation +Integer32 ::= + INTEGER (-2147483648..2147483647) + + +-- application-wide types + +ApplicationSyntax ::= + CHOICE { + ipAddress-value + IpAddress, + + counter-value + Counter32, + + timeticks-value + TimeTicks, + + arbitrary-value + Opaque, + + big-counter-value + Counter64, + + unsigned-integer-value -- includes Gauge32 + Unsigned32 + } + +-- in network-byte order + + +McCloghrie, et al. Standards Track [Page 7] + + + + + +RFC 2578 SMIv2 April 1999 + + +-- (this is a tagged type for historical reasons) +IpAddress ::= + [APPLICATION 0] + IMPLICIT OCTET STRING (SIZE (4)) + +-- this wraps +Counter32 ::= + [APPLICATION 1] + IMPLICIT INTEGER (0..4294967295) + +-- this doesn't wrap +Gauge32 ::= + [APPLICATION 2] + IMPLICIT INTEGER (0..4294967295) + +-- an unsigned 32-bit quantity +-- indistinguishable from Gauge32 +Unsigned32 ::= + [APPLICATION 2] + IMPLICIT INTEGER (0..4294967295) + +-- hundredths of seconds since an epoch +TimeTicks ::= + [APPLICATION 3] + IMPLICIT INTEGER (0..4294967295) + +-- for backward-compatibility only +Opaque ::= + [APPLICATION 4] + IMPLICIT OCTET STRING + +-- for counters that wrap in less than one hour with only 32 bits +Counter64 ::= + [APPLICATION 6] + IMPLICIT INTEGER (0..18446744073709551615) + + +-- definition for objects + +OBJECT-TYPE MACRO ::= +BEGIN + TYPE NOTATION ::= + "SYNTAX" Syntax + UnitsPart + "MAX-ACCESS" Access + "STATUS" Status + "DESCRIPTION" Text + ReferPart + + +McCloghrie, et al. Standards Track [Page 8] + + + + + +RFC 2578 SMIv2 April 1999 + + + IndexPart + DefValPart + + VALUE NOTATION ::= + value(VALUE ObjectName) + + Syntax ::= -- Must be one of the following: + -- a base type (or its refinement), + -- a textual convention (or its refinement), or + -- a BITS pseudo-type + type + | "BITS" "{" NamedBits "}" + + NamedBits ::= NamedBit + | NamedBits "," NamedBit + + NamedBit ::= identifier "(" number ")" -- number is nonnegative + + UnitsPart ::= + "UNITS" Text + | empty + + Access ::= + "not-accessible" + | "accessible-for-notify" + | "read-only" + | "read-write" + | "read-create" + + Status ::= + "current" + | "deprecated" + | "obsolete" + + ReferPart ::= + "REFERENCE" Text + | empty + + IndexPart ::= + "INDEX" "{" IndexTypes "}" + | "AUGMENTS" "{" Entry "}" + | empty + IndexTypes ::= + IndexType + | IndexTypes "," IndexType + IndexType ::= + "IMPLIED" Index + | Index + + +McCloghrie, et al. Standards Track [Page 9] + + + + + +RFC 2578 SMIv2 April 1999 + + + Index ::= + -- use the SYNTAX value of the + -- correspondent OBJECT-TYPE invocation + value(ObjectName) + Entry ::= + -- use the INDEX value of the + -- correspondent OBJECT-TYPE invocation + value(ObjectName) + + DefValPart ::= "DEFVAL" "{" Defvalue "}" + | empty + + Defvalue ::= -- must be valid for the type specified in + -- SYNTAX clause of same OBJECT-TYPE macro + value(ObjectSyntax) + | "{" BitsValue "}" + + BitsValue ::= BitNames + | empty + + BitNames ::= BitName + | BitNames "," BitName + + BitName ::= identifier + + -- a character string as defined in section 3.1.1 + Text ::= value(IA5String) +END + + +-- definitions for notifications + +NOTIFICATION-TYPE MACRO ::= +BEGIN + TYPE NOTATION ::= + ObjectsPart + "STATUS" Status + "DESCRIPTION" Text + ReferPart + + VALUE NOTATION ::= + value(VALUE NotificationName) + + ObjectsPart ::= + "OBJECTS" "{" Objects "}" + | empty + Objects ::= + Object + + +McCloghrie, et al. Standards Track [Page 10] + + + + + +RFC 2578 SMIv2 April 1999 + + + | Objects "," Object + Object ::= + value(ObjectName) + + Status ::= + "current" + | "deprecated" + | "obsolete" + + ReferPart ::= + "REFERENCE" Text + | empty + + -- a character string as defined in section 3.1.1 + Text ::= value(IA5String) +END + +-- definitions of administrative identifiers + +zeroDotZero OBJECT-IDENTITY + STATUS current + DESCRIPTION + "A value used for null identifiers." + ::= { 0 0 } + +END + +3. Information Modules + + An "information module" is an ASN.1 module defining information + relating to network management. + + The SMI describes how to use an adapted subset of ASN.1 (1988) to + define an information module. Further, additional restrictions are + placed on "standard" information modules. It is strongly recommended + that "enterprise-specific" information modules also adhere to these + restrictions. + + Typically, there are three kinds of information modules: + +(1) MIB modules, which contain definitions of inter-related managed + objects, make use of the OBJECT-TYPE and NOTIFICATION-TYPE macros; + +(2) compliance statements for MIB modules, which make use of the + MODULE-COMPLIANCE and OBJECT-GROUP macros [2]; and, + +(3) capability statements for agent implementations which make use of + the AGENT-CAPABILITIES macros [2]. + + +McCloghrie, et al. Standards Track [Page 11] + + + + + +RFC 2578 SMIv2 April 1999 + + + This classification scheme does not imply a rigid taxonomy. For + example, a "standard" information module will normally include + definitions of managed objects and a compliance statement. + Similarly, an "enterprise-specific" information module might include + definitions of managed objects and a capability statement. Of + course, a "standard" information module may not contain capability + statements. + + The constructs of ASN.1 allowed in SMIv2 information modules include: + the IMPORTS clause, value definitions for OBJECT IDENTIFIERs, type + definitions for SEQUENCEs (with restrictions), ASN.1 type assignments + of the restricted ASN.1 types allowed in SMIv2, and instances of + ASN.1 macros defined in this document and its companion documents [2, + 3]. Additional ASN.1 macros must not be defined in SMIv2 information + modules. SMIv1 macros must not be used in SMIv2 information modules. + + The names of all standard information modules must be unique (but + different versions of the same information module should have the + same name). Developers of enterprise information modules are + encouraged to choose names for their information modules that will + have a low probability of colliding with standard or other enterprise + information modules. An information module may not use the ASN.1 + construct of placing an object identifier value between the module + name and the "DEFINITIONS" keyword. For the purposes of this + specification, an ASN.1 module name begins with an upper-case letter + and continues with zero or more letters, digits, or hyphens, except + that a hyphen can not be the last character, nor can there be two + consecutive hyphens. + + All information modules start with exactly one invocation of the + MODULE-IDENTITY macro, which provides contact information as well as + revision history to distinguish between versions of the same + information module. This invocation must appear immediately after + any IMPORTs statements. + +3.1. Macro Invocation + + Within an information module, each macro invocation appears as: + + ::= + + where corresponds to an ASN.1 identifier, names + the macro being invoked, and and depend on the + definition of the macro. (Note that this definition of a descriptor + applies to all macros defined in this memo and in [2].) + + + + + +McCloghrie, et al. Standards Track [Page 12] + + + + + +RFC 2578 SMIv2 April 1999 + + + For the purposes of this specification, an ASN.1 identifier consists + of one or more letters or digits, and its initial character must be a + lower-case letter. Note that hyphens are not allowed by this + specification (except for use by information modules converted from + SMIv1 which did allow hyphens). + + For all descriptors appearing in an information module, the + descriptor shall be unique and mnemonic, and shall not exceed 64 + characters in length. (However, descriptors longer than 32 + characters are not recommended.) This promotes a common language for + humans to use when discussing the information module and also + facilitates simple table mappings for user-interfaces. + + The set of descriptors defined in all "standard" information modules + shall be unique. + + Finally, by convention, if the descriptor refers to an object with a + SYNTAX clause value of either Counter32 or Counter64, then the + descriptor used for the object should denote plurality. + +3.1.1. Textual Values and Strings + + Some clauses in a macro invocation may take a character string as a + textual value (e.g., the DESCRIPTION clause). Other clauses take + binary or hexadecimal strings (in any position where a non-negative + number is allowed). + + A character string is preceded and followed by the quote character + ("), and consists of an arbitrary number (possibly zero) of: + + - any 7-bit displayable ASCII characters except quote ("), + - tab characters, + - spaces, and + - line terminator characters (\n or \r\n). + + The value of a character string is interpreted as ASCII. + + A binary string consists of a number (possibly zero) of zeros and + ones preceded by a single (') and followed by either the pair ('B) or + ('b), where the number is a multiple of eight. + + A hexadecimal string consists of an even number (possibly zero) of + hexadecimal digits, preceded by a single (') and followed by either + the pair ('H) or ('h). Digits specified via letters can be in upper + or lower case. + + Note that ASN.1 comments can not be enclosed inside any of these + types of strings. + + +McCloghrie, et al. Standards Track [Page 13] + + + + + +RFC 2578 SMIv2 April 1999 + + +3.2. IMPORTing Symbols + + To reference an external object, the IMPORTS statement must be used + to identify both the descriptor and the module in which the + descriptor is defined, where the module is identified by its ASN.1 + module name. + + Note that when symbols from "enterprise-specific" information modules + are referenced (e.g., a descriptor), there is the possibility of + collision. As such, if different objects with the same descriptor + are IMPORTed, then this ambiguity is resolved by prefixing the + descriptor with the name of the information module and a dot ("."), + i.e., + + "module.descriptor" + + (All descriptors must be unique within any information module.) + + Of course, this notation can be used to refer to objects even when + there is no collision when IMPORTing symbols. + + Finally, if any of the ASN.1 named types and macros defined in this + document, specifically: + + Counter32, Counter64, Gauge32, Integer32, IpAddress, MODULE- + IDENTITY, NOTIFICATION-TYPE, Opaque, OBJECT-TYPE, OBJECT- + IDENTITY, TimeTicks, Unsigned32, + + or any of those defined in [2] or [3], are used in an information + module, then they must be imported using the IMPORTS statement. + However, the following must not be included in an IMPORTS statement: + + - named types defined by ASN.1 itself, specifically: INTEGER, + OCTET STRING, OBJECT IDENTIFIER, SEQUENCE, SEQUENCE OF type, + - the BITS construct. + +3.3. Exporting Symbols + + The ASN.1 EXPORTS statement is not allowed in SMIv2 information + modules. All items defined in an information module are + automatically exported. + +3.4. ASN.1 Comments + + ASN.1 comments can be included in an information module. However, it + is recommended that all substantive descriptions be placed within an + appropriate DESCRIPTION clause. + + + +McCloghrie, et al. Standards Track [Page 14] + + + + + +RFC 2578 SMIv2 April 1999 + + + ASN.1 comments commence with a pair of adjacent hyphens and end with + the next pair of adjacent hyphens or at the end of the line, + whichever occurs first. Comments ended by a pair of hyphens have the + effect of a single space character. + +3.5. OBJECT IDENTIFIER values + + An OBJECT IDENTIFIER value is an ordered list of non-negative + numbers. For the SMIv2, each number in the list is referred to as a + sub-identifier, there are at most 128 sub-identifiers in a value, and + each sub-identifier has a maximum value of 2^32-1 (4294967295 + decimal). + + All OBJECT IDENTIFIER values have at least two sub-identifiers, where + the value of the first sub-identifier is one of the following well- + known names: + + Value Name + 0 ccitt + 1 iso + 2 joint-iso-ccitt + + (Note that this SMI does not recognize "new" well-known names, e.g., + as defined when the CCITT became the ITU.) + +3.6. OBJECT IDENTIFIER usage + + OBJECT IDENTIFIERs are used in information modules in two ways: + +(1) registration: the definition of a particular item is registered as + a particular OBJECT IDENTIFIER value, and associated with a + particular descriptor. After such a registration, the semantics + thereby associated with the value are not allowed to change, the + OBJECT IDENTIFIER can not be used for any other registration, and + the descriptor can not be changed nor associated with any other + registration. The following macros result in a registration: + + OBJECT-TYPE, MODULE-IDENTITY, NOTIFICATION-TYPE, OBJECT-GROUP, + OBJECT-IDENTITY, NOTIFICATION-GROUP, MODULE-COMPLIANCE, + AGENT-CAPABILITIES. + +(2) assignment: a descriptor can be assigned to a particular OBJECT + IDENTIFIER value. For this usage, the semantics associated with + the OBJECT IDENTIFIER value is not allowed to change, and a + descriptor assigned to a particular OBJECT IDENTIFIER value cannot + subsequently be assigned to another. However, multiple descriptors + can be assigned to the same OBJECT IDENTIFIER value. Such + assignments are specified in the following manner: + + +McCloghrie, et al. Standards Track [Page 15] + + + + + +RFC 2578 SMIv2 April 1999 + + + mib OBJECT IDENTIFIER ::= { mgmt 1 } -- from RFC1156 + mib-2 OBJECT IDENTIFIER ::= { mgmt 1 } -- from RFC1213 + fredRouter OBJECT IDENTIFIER ::= { flintStones 1 1 } + barneySwitch OBJECT IDENTIFIER ::= { flintStones bedrock(2) 1 } + + Note while the above examples are legal, the following is not: + + dinoHost OBJECT IDENTIFIER ::= { flintStones bedrock 2 } + + A descriptor is allowed to be associated with both a registration and + an assignment, providing both are associated with the same OBJECT + IDENTIFIER value and semantics. + +3.7. Reserved Keywords + + The following are reserved keywords which must not be used as + descriptors or module names: + + ABSENT ACCESS AGENT-CAPABILITIES ANY APPLICATION AUGMENTS BEGIN + BIT BITS BOOLEAN BY CHOICE COMPONENT COMPONENTS CONTACT-INFO + CREATION-REQUIRES Counter32 Counter64 DEFAULT DEFINED + DEFINITIONS DEFVAL DESCRIPTION DISPLAY-HINT END ENUMERATED + ENTERPRISE EXPLICIT EXPORTS EXTERNAL FALSE FROM GROUP Gauge32 + IDENTIFIER IMPLICIT IMPLIED IMPORTS INCLUDES INDEX INTEGER + Integer32 IpAddress LAST-UPDATED MANDATORY-GROUPS MAX MAX-ACCESS + MIN MIN-ACCESS MINUS-INFINITY MODULE MODULE-COMPLIANCE MODULE- + IDENTITY NOTIFICATION-GROUP NOTIFICATION-TYPE NOTIFICATIONS NULL + OBJECT OBJECT-GROUP OBJECT-IDENTITY OBJECT-TYPE OBJECTS OCTET OF + OPTIONAL ORGANIZATION Opaque PLUS-INFINITY PRESENT PRIVATE + PRODUCT-RELEASE REAL REFERENCE REVISION SEQUENCE SET SIZE STATUS + STRING SUPPORTS SYNTAX TAGS TEXTUAL-CONVENTION TRAP-TYPE TRUE + TimeTicks UNITS UNIVERSAL Unsigned32 VARIABLES VARIATION WITH + WRITE-SYNTAX + +4. Naming Hierarchy + + The root of the subtree administered by the Internet Assigned Numbers + Authority (IANA) for the Internet is: + + internet OBJECT IDENTIFIER ::= { iso 3 6 1 } + + That is, the Internet subtree of OBJECT IDENTIFIERs starts with the + prefix: + + 1.3.6.1. + + Several branches underneath this subtree are used for network + management: + + +McCloghrie, et al. Standards Track [Page 16] + + + + + +RFC 2578 SMIv2 April 1999 + + + mgmt OBJECT IDENTIFIER ::= { internet 2 } + experimental OBJECT IDENTIFIER ::= { internet 3 } + private OBJECT IDENTIFIER ::= { internet 4 } + enterprises OBJECT IDENTIFIER ::= { private 1 } + + However, the SMI does not prohibit the definition of objects in other + portions of the object tree. + + The mgmt(2) subtree is used to identify "standard" objects. + + The experimental(3) subtree is used to identify objects being + designed by working groups of the IETF. If an information module + produced by a working group becomes a "standard" information module, + then at the very beginning of its entry onto the Internet standards + track, the objects are moved under the mgmt(2) subtree. + + The private(4) subtree is used to identify objects defined + unilaterally. The enterprises(1) subtree beneath private is used, + among other things, to permit providers of networking subsystems to + register models of their products. + +5. Mapping of the MODULE-IDENTITY macro + + The MODULE-IDENTITY macro is used to provide contact and revision + history for each information module. It must appear exactly once in + every information module. It should be noted that the expansion of + the MODULE-IDENTITY macro is something which conceptually happens + during implementation and not during run-time. + + Note that reference in an IMPORTS clause or in clauses of SMIv2 + macros to an information module is NOT through the use of the + 'descriptor' of a MODULE-IDENTITY macro; rather, an information + module is referenced through specifying its module name. + +5.1. Mapping of the LAST-UPDATED clause + + The LAST-UPDATED clause, which must be present, contains the date and + time that this information module was last edited. + +5.2. Mapping of the ORGANIZATION clause + + The ORGANIZATION clause, which must be present, contains a textual + description of the organization under whose auspices this information + module was developed. + + + + + + +McCloghrie, et al. Standards Track [Page 17] + + + + + +RFC 2578 SMIv2 April 1999 + + +5.3. Mapping of the CONTACT-INFO clause + + The CONTACT-INFO clause, which must be present, contains the name, + postal address, telephone number, and electronic mail address of the + person to whom technical queries concerning this information module + should be sent. + +5.4. Mapping of the DESCRIPTION clause + + The DESCRIPTION clause, which must be present, contains a high-level + textual description of the contents of this information module. + +5.5. Mapping of the REVISION clause + + The REVISION clause, which need not be present, is repeatedly used to + describe the revisions (including the initial version) made to this + information module, in reverse chronological order (i.e., most recent + first). Each instance of this clause contains the date and time of + the revision. + +5.5.1. Mapping of the DESCRIPTION sub-clause + + The DESCRIPTION sub-clause, which must be present for each REVISION + clause, contains a high-level textual description of the revision + identified in that REVISION clause. + +5.6. Mapping of the MODULE-IDENTITY value + + The value of an invocation of the MODULE-IDENTITY macro is an OBJECT + IDENTIFIER. As such, this value may be authoritatively used when + specifying an OBJECT IDENTIFIER value to refer to the information + module containing the invocation. + + Note that it is a common practice to use the value of the MODULE- + IDENTITY macro as a subtree under which other OBJECT IDENTIFIER + values assigned within the module are defined. However, it is legal + (and occasionally necessary) for the other OBJECT IDENTIFIER values + assigned within the module to be unrelated to the OBJECT IDENTIFIER + value of the MODULE-IDENTITY macro. + +5.7. Usage Example + + Consider how a skeletal MIB module might be constructed: e.g., + + FIZBIN-MIB DEFINITIONS ::= BEGIN + + IMPORTS + MODULE-IDENTITY, OBJECT-TYPE, experimental + + +McCloghrie, et al. Standards Track [Page 18] + + + + + +RFC 2578 SMIv2 April 1999 + + + FROM SNMPv2-SMI; + + + fizbin MODULE-IDENTITY + LAST-UPDATED "199505241811Z" + ORGANIZATION "IETF SNMPv2 Working Group" + CONTACT-INFO + " Marshall T. Rose + + Postal: Dover Beach Consulting, Inc. + 420 Whisman Court + Mountain View, CA 94043-2186 + US + + Tel: +1 415 968 1052 + Fax: +1 415 968 2510 + + E-mail: mrose@dbc.mtview.ca.us" + + DESCRIPTION + "The MIB module for entities implementing the xxxx + protocol." + REVISION "9505241811Z" + DESCRIPTION + "The latest version of this MIB module." + REVISION "9210070433Z" + DESCRIPTION + "The initial version of this MIB module, published in + RFC yyyy." + -- contact IANA for actual number + ::= { experimental xx } + + END + +6. Mapping of the OBJECT-IDENTITY macro + + The OBJECT-IDENTITY macro is used to define information about an + OBJECT IDENTIFIER assignment. All administrative OBJECT IDENTIFIER + assignments which define a type identification value (see + AutonomousType, a textual convention defined in [3]) should be + defined via the OBJECT-IDENTITY macro. It should be noted that the + expansion of the OBJECT-IDENTITY macro is something which + conceptually happens during implementation and not during run-time. + +6.1. Mapping of the STATUS clause + + The STATUS clause, which must be present, indicates whether this + definition is current or historic. + + +McCloghrie, et al. Standards Track [Page 19] + + + + + +RFC 2578 SMIv2 April 1999 + + + The value "current" means that the definition is current and valid. + The value "obsolete" means the definition is obsolete and should not + be implemented and/or can be removed if previously implemented. + While the value "deprecated" also indicates an obsolete definition, + it permits new/continued implementation in order to foster + interoperability with older/existing implementations. + +6.2. Mapping of the DESCRIPTION clause + + The DESCRIPTION clause, which must be present, contains a textual + description of the object assignment. + +6.3. Mapping of the REFERENCE clause + + The REFERENCE clause, which need not be present, contains a textual + cross-reference to some other document, either another information + module which defines a related assignment, or some other document + which provides additional information relevant to this definition. + +6.4. Mapping of the OBJECT-IDENTITY value + + The value of an invocation of the OBJECT-IDENTITY macro is an OBJECT + IDENTIFIER. + +6.5. Usage Example + + Consider how an OBJECT IDENTIFIER assignment might be made: e.g., + + fizbin69 OBJECT-IDENTITY + STATUS current + DESCRIPTION + "The authoritative identity of the Fizbin 69 chipset." + ::= { fizbinChipSets 1 } + +7. Mapping of the OBJECT-TYPE macro + + The OBJECT-TYPE macro is used to define a type of managed object. It + should be noted that the expansion of the OBJECT-TYPE macro is + something which conceptually happens during implementation and not + during run-time. + + For leaf objects which are not columnar objects (i.e., not contained + within a conceptual table), instances of the object are identified by + appending a sub-identifier of zero to the name of that object. + Otherwise, the INDEX clause of the conceptual row object superior to + a columnar object defines instance identification information. + + + + +McCloghrie, et al. Standards Track [Page 20] + + + + + +RFC 2578 SMIv2 April 1999 + + +7.1. Mapping of the SYNTAX clause + + The SYNTAX clause, which must be present, defines the abstract data + structure corresponding to that object. The data structure must be + one of the following: a base type, the BITS construct, or a textual + convention. (SEQUENCE OF and SEQUENCE are also possible for + conceptual tables, see section 7.1.12). The base types are those + defined in the ObjectSyntax CHOICE. A textual convention is a + newly-defined type defined as a sub-type of a base type [3]. + + An extended subset of the full capabilities of ASN.1 (1988) sub- + typing is allowed, as appropriate to the underlying ASN.1 type. Any + such restriction on size, range or enumerations specified in this + clause represents the maximal level of support which makes "protocol + sense". Restrictions on sub-typing are specified in detail in + Section 9 and Appendix A of this memo. + + The semantics of ObjectSyntax are now described. + +7.1.1. Integer32 and INTEGER + + The Integer32 type represents integer-valued information between + -2^31 and 2^31-1 inclusive (-2147483648 to 2147483647 decimal). This + type is indistinguishable from the INTEGER type. Both the INTEGER + and Integer32 types may be sub-typed to be more constrained than the + Integer32 type. + + The INTEGER type (but not the Integer32 type) may also be used to + represent integer-valued information as named-number enumerations. + In this case, only those named-numbers so enumerated may be present + as a value. Note that although it is recommended that enumerated + values start at 1 and be numbered contiguously, any valid value for + Integer32 is allowed for an enumerated value and, further, enumerated + values needn't be contiguously assigned. + + Finally, a label for a named-number enumeration must consist of one + or more letters or digits, up to a maximum of 64 characters, and the + initial character must be a lower-case letter. (However, labels + longer than 32 characters are not recommended.) Note that hyphens + are not allowed by this specification (except for use by information + modules converted from SMIv1 which did allow hyphens). + +7.1.2. OCTET STRING + + The OCTET STRING type represents arbitrary binary or textual data. + Although the SMI-specified size limitation for this type is 65535 + octets, MIB designers should realize that there may be implementation + and interoperability limitations for sizes in excess of 255 octets. + + +McCloghrie, et al. Standards Track [Page 21] + + + + + +RFC 2578 SMIv2 April 1999 + + +7.1.3. OBJECT IDENTIFIER + + The OBJECT IDENTIFIER type represents administratively assigned + names. Any instance of this type may have at most 128 sub- + identifiers. Further, each sub-identifier must not exceed the value + 2^32-1 (4294967295 decimal). + +7.1.4. The BITS construct + + The BITS construct represents an enumeration of named bits. This + collection is assigned non-negative, contiguous (but see below) + values, starting at zero. Only those named-bits so enumerated may be + present in a value. (Thus, enumerations must be assigned to + consecutive bits; however, see Section 9 for refinements of an object + with this syntax.) + + As part of updating an information module, for an object defined + using the BITS construct, new enumerations can be added or existing + enumerations can have new labels assigned to them. After an + enumeration is added, it might not be possible to distinguish between + an implementation of the updated object for which the new enumeration + is not asserted, and an implementation of the object prior to the + addition. Depending on the circumstances, such an ambiguity could + either be desirable or could be undesirable. The means to avoid such + an ambiguity is dependent on the encoding of values on the wire; + however, one possibility is to define new enumerations starting at + the next multiple of eight bits. (Of course, this can also result in + the enumerations no longer being contiguous.) + + Although there is no SMI-specified limitation on the number of + enumerations (and therefore on the length of a value), except as may + be imposed by the limit on the length of an OCTET STRING, MIB + designers should realize that there may be implementation and + interoperability limitations for sizes in excess of 128 bits. + + Finally, a label for a named-number enumeration must consist of one + or more letters or digits, up to a maximum of 64 characters, and the + initial character must be a lower-case letter. (However, labels + longer than 32 characters are not recommended.) Note that hyphens + are not allowed by this specification. + +7.1.5. IpAddress + + The IpAddress type represents a 32-bit internet address. It is + represented as an OCTET STRING of length 4, in network byte-order. + + + + + +McCloghrie, et al. Standards Track [Page 22] + + + + + +RFC 2578 SMIv2 April 1999 + + + Note that the IpAddress type is a tagged type for historical reasons. + Network addresses should be represented using an invocation of the + TEXTUAL-CONVENTION macro [3]. + +7.1.6. Counter32 + + The Counter32 type represents a non-negative integer which + monotonically increases until it reaches a maximum value of 2^32-1 + (4294967295 decimal), when it wraps around and starts increasing + again from zero. + + Counters have no defined "initial" value, and thus, a single value of + a Counter has (in general) no information content. Discontinuities + in the monotonically increasing value normally occur at re- + initialization of the management system, and at other times as + specified in the description of an object-type using this ASN.1 type. + If such other times can occur, for example, the creation of an object + instance at times other than re-initialization, then a corresponding + object should be defined, with an appropriate SYNTAX clause, to + indicate the last discontinuity. Examples of appropriate SYNTAX + clause include: TimeStamp (a textual convention defined in [3]), + DateAndTime (another textual convention from [3]) or TimeTicks. + + The value of the MAX-ACCESS clause for objects with a SYNTAX clause + value of Counter32 is either "read-only" or "accessible-for-notify". + + A DEFVAL clause is not allowed for objects with a SYNTAX clause value + of Counter32. + +7.1.7. Gauge32 + + The Gauge32 type represents a non-negative integer, which may + increase or decrease, but shall never exceed a maximum value, nor + fall below a minimum value. The maximum value can not be greater + than 2^32-1 (4294967295 decimal), and the minimum value can not be + smaller than 0. The value of a Gauge32 has its maximum value + whenever the information being modeled is greater than or equal to + its maximum value, and has its minimum value whenever the information + being modeled is smaller than or equal to its minimum value. If the + information being modeled subsequently decreases below (increases + above) the maximum (minimum) value, the Gauge32 also decreases + (increases). (Note that despite of the use of the term "latched" in + the original definition of this type, it does not become "stuck" at + its maximum or minimum value.) + + + + + + +McCloghrie, et al. Standards Track [Page 23] + + + + + +RFC 2578 SMIv2 April 1999 + + +7.1.8. TimeTicks + + The TimeTicks type represents a non-negative integer which represents + the time, modulo 2^32 (4294967296 decimal), in hundredths of a second + between two epochs. When objects are defined which use this ASN.1 + type, the description of the object identifies both of the reference + epochs. + + For example, [3] defines the TimeStamp textual convention which is + based on the TimeTicks type. With a TimeStamp, the first reference + epoch is defined as the time when sysUpTime [5] was zero, and the + second reference epoch is defined as the current value of sysUpTime. + + The TimeTicks type may not be sub-typed. + +7.1.9. Opaque + + The Opaque type is provided solely for backward-compatibility, and + shall not be used for newly-defined object types. + + The Opaque type supports the capability to pass arbitrary ASN.1 + syntax. A value is encoded using the ASN.1 Basic Encoding Rules [4] + into a string of octets. This, in turn, is encoded as an OCTET + STRING, in effect "double-wrapping" the original ASN.1 value. + + Note that a conforming implementation need only be able to accept and + recognize opaquely-encoded data. It need not be able to unwrap the + data and then interpret its contents. + + A requirement on "standard" MIB modules is that no object may have a + SYNTAX clause value of Opaque. + +7.1.10. Counter64 + + The Counter64 type represents a non-negative integer which + monotonically increases until it reaches a maximum value of 2^64-1 + (18446744073709551615 decimal), when it wraps around and starts + increasing again from zero. + + Counters have no defined "initial" value, and thus, a single value of + a Counter has (in general) no information content. Discontinuities + in the monotonically increasing value normally occur at re- + initialization of the management system, and at other times as + specified in the description of an object-type using this ASN.1 type. + If such other times can occur, for example, the creation of an object + instance at times other than re-initialization, then a corresponding + object should be defined, with an appropriate SYNTAX clause, to + indicate the last discontinuity. Examples of appropriate SYNTAX + + +McCloghrie, et al. Standards Track [Page 24] + + + + + +RFC 2578 SMIv2 April 1999 + + + clause are: TimeStamp (a textual convention defined in [3]), + DateAndTime (another textual convention from [3]) or TimeTicks. + + The value of the MAX-ACCESS clause for objects with a SYNTAX clause + value of Counter64 is either "read-only" or "accessible-for-notify". + + A requirement on "standard" MIB modules is that the Counter64 type + may be used only if the information being modeled would wrap in less + than one hour if the Counter32 type was used instead. + + A DEFVAL clause is not allowed for objects with a SYNTAX clause value + of Counter64. + +7.1.11. Unsigned32 + + The Unsigned32 type represents integer-valued information between 0 + and 2^32-1 inclusive (0 to 4294967295 decimal). + +7.1.12. Conceptual Tables + + Management operations apply exclusively to scalar objects. However, + it is sometimes convenient for developers of management applications + to impose an imaginary, tabular structure on an ordered collection of + objects within the MIB. Each such conceptual table contains zero or + more rows, and each row may contain one or more scalar objects, + termed columnar objects. This conceptualization is formalized by + using the OBJECT-TYPE macro to define both an object which + corresponds to a table and an object which corresponds to a row in + that table. A conceptual table has SYNTAX of the form: + + SEQUENCE OF + + where refers to the SEQUENCE type of its subordinate + conceptual row. A conceptual row has SYNTAX of the form: + + + + where is a SEQUENCE type defined as follows: + + ::= SEQUENCE { , ... , } + + where there is one for each subordinate object, and each + is of the form: + + + + where is the descriptor naming a subordinate object, and + has the value of that subordinate object's SYNTAX clause, + + +McCloghrie, et al. Standards Track [Page 25] + + + + + +RFC 2578 SMIv2 April 1999 + + + except that both sub-typing information and the named values for + enumerated integers or the named bits for the BITS construct, are + omitted from . + + Further, a is always present for every subordinate object. + (The ASN.1 DEFAULT and OPTIONAL clauses are disallowed in the + SEQUENCE definition.) The MAX-ACCESS clause for conceptual tables + and rows is "not-accessible". + +7.1.12.1. Creation and Deletion of Conceptual Rows + + For newly-defined conceptual rows which allow the creation of new + object instances and/or the deletion of existing object instances, + there should be one columnar object with a SYNTAX clause value of + RowStatus (a textual convention defined in [3]) and a MAX-ACCESS + clause value of read-create. By convention, this is termed the + status column for the conceptual row. + +7.2. Mapping of the UNITS clause + + This UNITS clause, which need not be present, contains a textual + definition of the units associated with that object. + +7.3. Mapping of the MAX-ACCESS clause + + The MAX-ACCESS clause, which must be present, defines whether it + makes "protocol sense" to read, write and/or create an instance of + the object, or to include its value in a notification. This is the + maximal level of access for the object. (This maximal level of + access is independent of any administrative authorization policy.) + + The value "read-write" indicates that read and write access make + "protocol sense", but create does not. The value "read-create" + indicates that read, write and create access make "protocol sense". + The value "not-accessible" indicates an auxiliary object (see Section + 7.7). The value "accessible-for-notify" indicates an object which is + accessible only via a notification (e.g., snmpTrapOID [5]). + + These values are ordered, from least to greatest: "not-accessible", + "accessible-for-notify", "read-only", "read-write", "read-create". + + If any columnar object in a conceptual row has "read-create" as its + maximal level of access, then no other columnar object of the same + conceptual row may have a maximal access of "read-write". (Note that + "read-create" is a superset of "read-write".) + + + + + +McCloghrie, et al. Standards Track [Page 26] + + + + + +RFC 2578 SMIv2 April 1999 + + +7.4. Mapping of the STATUS clause + + The STATUS clause, which must be present, indicates whether this + definition is current or historic. + + The value "current" means that the definition is current and valid. + The value "obsolete" means the definition is obsolete and should not + be implemented and/or can be removed if previously implemented. + While the value "deprecated" also indicates an obsolete definition, + it permits new/continued implementation in order to foster + interoperability with older/existing implementations. + +7.5. Mapping of the DESCRIPTION clause + + The DESCRIPTION clause, which must be present, contains a textual + definition of that object which provides all semantic definitions + necessary for implementation, and should embody any information which + would otherwise be communicated in any ASN.1 commentary annotations + associated with the object. + +7.6. Mapping of the REFERENCE clause + + The REFERENCE clause, which need not be present, contains a textual + cross-reference to some other document, either another information + module which defines a related assignment, or some other document + which provides additional information relevant to this definition. + +7.7. Mapping of the INDEX clause + + The INDEX clause, which must be present if that object corresponds to + a conceptual row (unless an AUGMENTS clause is present instead), and + must be absent otherwise, defines instance identification information + for the columnar objects subordinate to that object. + + The instance identification information in an INDEX clause must + specify object(s) such that value(s) of those object(s) will + unambiguously distinguish a conceptual row. The objects can be + columnar objects from the same and/or another conceptual table, but + must not be scalar objects. Multiple occurrences of the same object + in a single INDEX clause is strongly discouraged. + + The syntax of the objects in the INDEX clause indicate how to form + the instance-identifier: + +(1) integer-valued (i.e., having INTEGER as its underlying primitive + type): a single sub-identifier taking the integer value (this + works only for non-negative integers); + + + +McCloghrie, et al. Standards Track [Page 27] + + + + + +RFC 2578 SMIv2 April 1999 + + +(2) string-valued, fixed-length strings (or variable-length preceded by + the IMPLIED keyword): `n' sub-identifiers, where `n' is the length + of the string (each octet of the string is encoded in a separate + sub-identifier); + +(3) string-valued, variable-length strings (not preceded by the IMPLIED + keyword): `n+1' sub-identifiers, where `n' is the length of the + string (the first sub-identifier is `n' itself, following this, + each octet of the string is encoded in a separate sub-identifier); + +(4) object identifier-valued (when preceded by the IMPLIED keyword): + `n' sub-identifiers, where `n' is the number of sub-identifiers in + the value (each sub-identifier of the value is copied into a + separate sub-identifier); + +(5) object identifier-valued (when not preceded by the IMPLIED + keyword): `n+1' sub-identifiers, where `n' is the number of sub- + identifiers in the value (the first sub-identifier is `n' itself, + following this, each sub-identifier in the value is copied); + +(6) IpAddress-valued: 4 sub-identifiers, in the familiar a.b.c.d + notation. + + Note that the IMPLIED keyword can only be present for an object + having a variable-length syntax (e.g., variable-length strings or + object identifier-valued objects), Further, the IMPLIED keyword can + only be associated with the last object in the INDEX clause. + Finally, the IMPLIED keyword may not be used on a variable-length + string object if that string might have a value of zero-length. + + Since a single value of a Counter has (in general) no information + content (see section 7.1.6 and 7.1.10), objects defined using the + syntax, Counter32 or Counter64, must not be specified in an INDEX + + clause. If an object defined using the BITS construct is used in an + INDEX clause, it is considered a variable-length string. + + Instances identified by use of integer-valued objects should be + numbered starting from one (i.e., not from zero). The use of zero as + a value for an integer-valued index object should be avoided, except + in special cases. + + Objects which are both specified in the INDEX clause of a conceptual + row and also columnar objects of the same conceptual row are termed + auxiliary objects. The MAX-ACCESS clause for auxiliary objects is + "not-accessible", except in the following circumstances: + + + + +McCloghrie, et al. Standards Track [Page 28] + + + + + +RFC 2578 SMIv2 April 1999 + + +(1) within a MIB module originally written to conform to SMIv1, and + later converted to conform to SMIv2; or + +(2) a conceptual row must contain at least one columnar object which is + not an auxiliary object. In the event that all of a conceptual + row's columnar objects are also specified in its INDEX clause, then + one of them must be accessible, i.e., have a MAX-ACCESS clause of + "read-only". (Note that this situation does not arise for a + conceptual row allowing create access, since such a row will have a + status column which will not be an auxiliary object.) + + Note that objects specified in a conceptual row's INDEX clause need + not be columnar objects of that conceptual row. In this situation, + the DESCRIPTION clause of the conceptual row must include a textual + explanation of how the objects which are included in the INDEX clause + but not columnar objects of that conceptual row, are used in uniquely + identifying instances of the conceptual row's columnar objects. + +7.8. Mapping of the AUGMENTS clause + + The AUGMENTS clause, which must not be present unless the object + corresponds to a conceptual row, is an alternative to the INDEX + clause. Every object corresponding to a conceptual row has either an + INDEX clause or an AUGMENTS clause. + + If an object corresponding to a conceptual row has an INDEX clause, + that row is termed a base conceptual row; alternatively, if the + object has an AUGMENTS clause, the row is said to be a conceptual row + augmentation, where the AUGMENTS clause names the object + corresponding to the base conceptual row which is augmented by this + conceptual row augmentation. (Thus, a conceptual row augmentation + cannot itself be augmented.) Instances of subordinate columnar + objects of a conceptual row augmentation are identified according to + the INDEX clause of the base conceptual row corresponding to the + object named in the AUGMENTS clause. Further, instances of + subordinate columnar objects of a conceptual row augmentation exist + according to the same semantics as instances of subordinate columnar + objects of the base conceptual row being augmented. As such, note + that creation of a base conceptual row implies the correspondent + creation of any conceptual row augmentations. + + For example, a MIB designer might wish to define additional columns + in an "enterprise-specific" MIB which logically extend a conceptual + row in a "standard" MIB. The "standard" MIB definition of the + conceptual row would include the INDEX clause and the "enterprise- + specific" MIB would contain the definition of a conceptual row using + the AUGMENTS clause. On the other hand, it would be incorrect to use + the AUGMENTS clause for the relationship between RFC 2233's ifTable + + +McCloghrie, et al. Standards Track [Page 29] + + + + + +RFC 2578 SMIv2 April 1999 + + + and the many media-specific MIBs which extend it for specific media + (e.g., the dot3Table in RFC 2358), since not all interfaces are of + the same media. + + Note that a base conceptual row may be augmented by multiple + conceptual row augmentations. + +7.8.1. Relation between INDEX and AUGMENTS clauses + + When defining instance identification information for a conceptual + table: + +(1) If there is a one-to-one correspondence between the conceptual rows + of this table and an existing table, then the AUGMENTS clause + should be used. + +(2) Otherwise, if there is a sparse relationship between the conceptual + rows of this table and an existing table, then an INDEX clause + should be used which is identical to that in the existing table. + For example, the relationship between RFC 2233's ifTable and a + media-specific MIB which extends the ifTable for a specific media + (e.g., the dot3Table in RFC 2358), is a sparse relationship. + +(3) Otherwise, if no existing objects have the required syntax and + semantics, then auxiliary objects should be defined within the + conceptual row for the new table, and those objects should be used + within the INDEX clause for the conceptual row. + +7.9. Mapping of the DEFVAL clause + + The DEFVAL clause, which need not be present, defines an acceptable + default value which may be used at the discretion of an agent when an + object instance is created. That is, the value is a "hint" to + implementors. + + During conceptual row creation, if an instance of a columnar object + is not present as one of the operands in the correspondent management + protocol set operation, then the value of the DEFVAL clause, if + present, indicates an acceptable default value that an agent might + use (especially for a read-only object). + + Note that with this definition of the DEFVAL clause, it is + appropriate to use it for any columnar object of a read-create table. + It is also permitted to use it for scalar objects dynamically created + by an agent, or for columnar objects of a read-write table + dynamically created by an agent. + + + + +McCloghrie, et al. Standards Track [Page 30] + + + + + +RFC 2578 SMIv2 April 1999 + + + The value of the DEFVAL clause must, of course, correspond to the + SYNTAX clause for the object. If the value is an OBJECT IDENTIFIER, + then it must be expressed as a single ASN.1 identifier, and not as a + collection of sub-identifiers. + + Note that if an operand to the management protocol set operation is + an instance of a read-only object, then the error `notWritable' [6] + will be returned. As such, the DEFVAL clause can be used to provide + an acceptable default value that an agent might use. + + By way of example, consider the following possible DEFVAL clauses: + + ObjectSyntax DEFVAL clause + ---------------- ------------ + Integer32 DEFVAL { 1 } + -- same for Gauge32, TimeTicks, Unsigned32 + INTEGER DEFVAL { valid } -- enumerated value + OCTET STRING DEFVAL { 'ffffffffffff'H } + DisplayString DEFVAL { "SNMP agent" } + IpAddress DEFVAL { 'c0210415'H } -- 192.33.4.21 + OBJECT IDENTIFIER DEFVAL { sysDescr } + BITS DEFVAL { { primary, secondary } } + -- enumerated values that are set + BITS DEFVAL { { } } + -- no enumerated values are set + + A binary string used in a DEFVAL clause for an OCTET STRING must be + either an integral multiple of eight or zero bits in length; + similarly, a hexadecimal string must be an even number of hexadecimal + digits. The value of a character string used in a DEFVAL clause must + not contain tab characters or line terminator characters. + + Object types with SYNTAX of Counter32 and Counter64 may not have + DEFVAL clauses, since they do not have defined initial values. + However, it is recommended that they be initialized to zero. + +7.10. Mapping of the OBJECT-TYPE value + + The value of an invocation of the OBJECT-TYPE macro is the name of + the object, which is an OBJECT IDENTIFIER, an administratively + assigned name. + + When an OBJECT IDENTIFIER is assigned to an object: + +(1) If the object corresponds to a conceptual table, then only a single + assignment, that for a conceptual row, is present immediately + beneath that object. The administratively assigned name for the + conceptual row object is derived by appending a sub-identifier of + + +McCloghrie, et al. Standards Track [Page 31] + + + + + +RFC 2578 SMIv2 April 1999 + + + "1" to the administratively assigned name for the conceptual table. + +(2) If the object corresponds to a conceptual row, then at least one + assignment, one for each column in the conceptual row, is present + beneath that object. The administratively assigned name for each + column is derived by appending a unique, positive sub-identifier to + the administratively assigned name for the conceptual row. + +(3) Otherwise, no other OBJECT IDENTIFIERs which are subordinate to the + object may be assigned. + + Note that the final sub-identifier of any administratively assigned + name for an object shall be positive. A zero-valued final sub- + identifier is reserved for future use. + +7.11. Usage Example + + Consider how one might define a conceptual table and its + subordinates. (This example uses the RowStatus textual convention + defined in [3].) + + evalSlot OBJECT-TYPE + SYNTAX Integer32 (0..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The index number of the first unassigned entry in the + evaluation table, or the value of zero indicating that + all entries are assigned. + + A management station should create new entries in the + evaluation table using this algorithm: first, issue a + management protocol retrieval operation to determine the + value of evalSlot; and, second, issue a management + protocol set operation to create an instance of the + evalStatus object setting its value to createAndGo(4) or + createAndWait(5). If this latter operation succeeds, + then the management station may continue modifying the + instances corresponding to the newly created conceptual + row, without fear of collision with other management + stations." + ::= { eval 1 } + + evalTable OBJECT-TYPE + SYNTAX SEQUENCE OF EvalEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + + +McCloghrie, et al. Standards Track [Page 32] + + + + + +RFC 2578 SMIv2 April 1999 + + + "The (conceptual) evaluation table." + ::= { eval 2 } + + evalEntry OBJECT-TYPE + SYNTAX EvalEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry (conceptual row) in the evaluation table." + INDEX { evalIndex } + ::= { evalTable 1 } + + EvalEntry ::= + SEQUENCE { + evalIndex Integer32, + evalString DisplayString, + evalValue Integer32, + evalStatus RowStatus + } + + evalIndex OBJECT-TYPE + SYNTAX Integer32 (1..2147483647) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The auxiliary variable used for identifying instances of + the columnar objects in the evaluation table." + ::= { evalEntry 1 } + + evalString OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The string to evaluate." + ::= { evalEntry 2 } + + evalValue OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value when evalString was last evaluated, or zero if + no such value is available." + DEFVAL { 0 } + ::= { evalEntry 3 } + + evalStatus OBJECT-TYPE + + +McCloghrie, et al. Standards Track [Page 33] + + + + + +RFC 2578 SMIv2 April 1999 + + + SYNTAX RowStatus + MAX-ACCESS read-create + STATUS current + DESCRIPTION + "The status column used for creating, modifying, and + deleting instances of the columnar objects in the + evaluation table." + DEFVAL { active } + ::= { evalEntry 4 } + +8. Mapping of the NOTIFICATION-TYPE macro + + The NOTIFICATION-TYPE macro is used to define the information + contained within an unsolicited transmission of management + information (i.e., within either a SNMPv2-Trap-PDU or InformRequest- + PDU). It should be noted that the expansion of the NOTIFICATION-TYPE + macro is something which conceptually happens during implementation + and not during run-time. + +8.1. Mapping of the OBJECTS clause + + The OBJECTS clause, which need not be present, defines an ordered + sequence of MIB object types. One and only one object instance for + each occurrence of each object type must be present, and in the + specified order, in every instance of the notification. If the same + object type occurs multiple times in a notification's ordered + sequence, then an object instance is present for each of them. An + object type specified in this clause must not have an MAX-ACCESS + clause of "not-accessible". The notification's DESCRIPTION clause + must specify the information/meaning conveyed by each occurrence of + each object type in the sequence. The DESCRIPTION clause must also + specify which object instance is present for each object type in the + notification. + + Note that an agent is allowed, at its own discretion, to append as + many additional objects as it considers useful to the end of the + notification (i.e., after the objects defined by the OBJECTS clause). + +8.2. Mapping of the STATUS clause + + The STATUS clause, which must be present, indicates whether this + definition is current or historic. + + The value "current" means that the definition is current and valid. + The value "obsolete" means the definition is obsolete and should not + be implemented and/or can be removed if previously implemented. + While the value "deprecated" also indicates an obsolete definition, + it permits new/continued implementation in order to foster + + +McCloghrie, et al. Standards Track [Page 34] + + + + + +RFC 2578 SMIv2 April 1999 + + + interoperability with older/existing implementations. + +8.3. Mapping of the DESCRIPTION clause + + The DESCRIPTION clause, which must be present, contains a textual + definition of the notification which provides all semantic + definitions necessary for implementation, and should embody any + information which would otherwise be communicated in any ASN.1 + commentary annotations associated with the notification. In + particular, the DESCRIPTION clause should document which instances of + the objects mentioned in the OBJECTS clause should be contained + within notifications of this type. + +8.4. Mapping of the REFERENCE clause + + The REFERENCE clause, which need not be present, contains a textual + cross-reference to some other document, either another information + module which defines a related assignment, or some other document + which provides additional information relevant to this definition. + +8.5. Mapping of the NOTIFICATION-TYPE value + + The value of an invocation of the NOTIFICATION-TYPE macro is the name + of the notification, which is an OBJECT IDENTIFIER, an + administratively assigned name. In order to achieve compatibility + with SNMPv1 traps, both when converting SMIv1 information modules + to/from this SMI, and in the procedures employed by multi-lingual + systems and proxy forwarding applications, the next to last sub- + identifier in the name of any newly-defined notification must have + the value zero. + + Sections 4.2.6 and 4.2.7 of [6] describe how the NOTIFICATION-TYPE + macro is used to generate a SNMPv2-Trap-PDU or InformRequest-PDU, + respectively. + +8.6. Usage Example + + Consider how a configuration change notification might be described: + + entityMIBTraps OBJECT IDENTIFIER ::= { entityMIB 2 } + entityMIBTrapPrefix OBJECT IDENTIFIER ::= { entityMIBTraps 0 } + + entConfigChange NOTIFICATION-TYPE + STATUS current + DESCRIPTION + "An entConfigChange trap is sent when the value of + entLastChangeTime changes. It can be utilized by an NMS to + trigger logical/physical entity table maintenance polls. + + +McCloghrie, et al. Standards Track [Page 35] + + + + + +RFC 2578 SMIv2 April 1999 + + + + An agent must not generate more than one entConfigChange + 'trap-event' in a five second period, where a 'trap-event' + is the transmission of a single trap PDU to a list of + trap destinations. If additional configuration changes + occur within the five second 'throttling' period, then + these trap-events should be suppressed by the agent. An + NMS should periodically check the value of + entLastChangeTime to detect any missed entConfigChange + trap-events, e.g. due to throttling or transmission loss." + ::= { entityMIBTrapPrefix 1 } + + According to this invocation, the notification authoritatively + identified as + + { entityMIBTrapPrefix 1 } + + is used to report a particular type of configuration change. + +9. Refined Syntax + + Some macros have clauses which allows syntax to be refined, + specifically: the SYNTAX clause of the OBJECT-TYPE macro, and the + SYNTAX/WRITE-SYNTAX clauses of the MODULE-COMPLIANCE and AGENT- + CAPABILITIES macros [2]. However, not all refinements of syntax are + appropriate. In particular, the object's primitive or application + type must not be changed. + + Further, the following restrictions apply: + + Restrictions to Refinement of + object syntax range enumeration size + ----------------- ----- ----------- ---- + INTEGER (1) (2) - + Integer32 (1) - - + Unsigned32 (1) - - + OCTET STRING - - (3) + OBJECT IDENTIFIER - - - + BITS - (2) - + IpAddress - - - + Counter32 - - - + Counter64 - - - + Gauge32 (1) - - + TimeTicks - - - + + where: + + + + +McCloghrie, et al. Standards Track [Page 36] + + + + + +RFC 2578 SMIv2 April 1999 + + +(1) the range of permitted values may be refined by raising the lower- + bounds, by reducing the upper-bounds, and/or by reducing the + alternative value/range choices; + +(2) the enumeration of named-values may be refined by removing one or + more named-values (note that for BITS, a refinement may cause the + enumerations to no longer be contiguous); or, + +(3) the size in octets of the value may be refined by raising the + lower-bounds, by reducing the upper-bounds, and/or by reducing the + alternative size choices. + + No other types of refinements can be specified in the SYNTAX clause. + However, the DESCRIPTION clause is available to specify additional + restrictions which can not be expressed in the SYNTAX clause. + Further details on (and examples of) sub-typing are provided in + Appendix A. + +10. Extending an Information Module + + As experience is gained with an information module, it may be + desirable to revise that information module. However, changes are + not allowed if they have any potential to cause interoperability + problems "over the wire" between an implementation using an original + specification and an implementation using an updated + specification(s). + + For any change, the invocation of the MODULE-IDENTITY macro must be + updated to include information about the revision: specifically, + updating the LAST-UPDATED clause, adding a pair of REVISION and + DESCRIPTION clauses (see section 5.5), and making any necessary + changes to existing clauses, including the ORGANIZATION and CONTACT- + INFO clauses. + + Note that any definition contained in an information module is + available to be IMPORT-ed by any other information module, and is + referenced in an IMPORTS clause via the module name. Thus, a module + name should not be changed. Specifically, the module name (e.g., + "FIZBIN-MIB" in the example of Section 5.7) should not be changed + when revising an information module (except to correct typographical + errors), and definitions should not be moved from one information + module to another. + + Also note that obsolete definitions must not be removed from MIB + modules since their descriptors may still be referenced by other + information modules, and the OBJECT IDENTIFIERs used to name them + must never be re-assigned. + + + +McCloghrie, et al. Standards Track [Page 37] + + + + + +RFC 2578 SMIv2 April 1999 + + +10.1. Object Assignments + + If any non-editorial change is made to any clause of a object + assignment, then the OBJECT IDENTIFIER value associated with that + object assignment must also be changed, along with its associated + descriptor. + +10.2. Object Definitions + + An object definition may be revised in any of the following ways: + +(1) A SYNTAX clause containing an enumerated INTEGER may have new + enumerations added or existing labels changed. Similarly, named + bits may be added or existing labels changed for the BITS + construct. + +(2) The value of a SYNTAX clause may be replaced by a textual + convention, providing the textual convention is defined to use the + same primitive ASN.1 type, has the same set of values, and has + identical semantics. + +(3) A STATUS clause value of "current" may be revised as "deprecated" + or "obsolete". Similarly, a STATUS clause value of "deprecated" + may be revised as "obsolete". When making such a change, the + DESCRIPTION clause should be updated to explain the rationale. + +(4) A DEFVAL clause may be added or updated. + +(5) A REFERENCE clause may be added or updated. + +(6) A UNITS clause may be added. + +(7) A conceptual row may be augmented by adding new columnar objects at + the end of the row, and making the corresponding update to the + SEQUENCE definition. + +(8) Clarifications and additional information may be included in the + DESCRIPTION clause. + +(9) Entirely new objects may be defined, named with previously + unassigned OBJECT IDENTIFIER values. + + Otherwise, if the semantics of any previously defined object are + changed (i.e., if a non-editorial change is made to any clause other + than those specifically allowed above), then the OBJECT IDENTIFIER + value associated with that object must also be changed. + + + + +McCloghrie, et al. Standards Track [Page 38] + + + + + +RFC 2578 SMIv2 April 1999 + + + Note that changing the descriptor associated with an existing object + is considered a semantic change, as these strings may be used in an + IMPORTS statement. + +10.3. Notification Definitions + + A notification definition may be revised in any of the following + ways: + +(1) A REFERENCE clause may be added or updated. + +(2) A STATUS clause value of "current" may be revised as "deprecated" + or "obsolete". Similarly, a STATUS clause value of "deprecated" + may be revised as "obsolete". When making such a change, the + DESCRIPTION clause should be updated to explain the rationale. + +(3) A DESCRIPTION clause may be clarified. + + Otherwise, if the semantics of any previously defined notification + are changed (i.e., if a non-editorial change is made to any clause + other those specifically allowed above), then the OBJECT IDENTIFIER + value associated with that notification must also be changed. + + Note that changing the descriptor associated with an existing + notification is considered a semantic change, as these strings may be + used in an IMPORTS statement. + + + + + + + + + + + + + + + + + + + + + + + + +McCloghrie, et al. Standards Track [Page 39] + + + + + +RFC 2578 SMIv2 April 1999 + + +11. Appendix A: Detailed Sub-typing Rules + + +11.1. Syntax Rules + + The syntax rules for sub-typing are given below. Note that while + this syntax is based on ASN.1, it includes some extensions beyond + what is allowed in ASN.1, and a number of ASN.1 constructs are not + allowed by this syntax. + + + ::= + | "(" ["|" ]... ")" + + + ::= + | "(" "SIZE" "(" ["|" ]... ")" ")" + + + ::= + | ".." + + + ::= "-" + | + | + | + + where: + is the empty string + is a non-negative integer + is a hexadecimal string (e.g., '0F0F'H) + is a binary string (e.g, '1010'B) + + is further restricted as follows: + - any used in a SIZE clause must be non-negative. + - when a pair of values is specified, the first value + must be less than the second value. + - when multiple ranges are specified, the ranges may + not overlap but may touch. For example, (1..4 | 4..9) + is invalid, and (1..4 | 5..9) is valid. + - the ranges must be a subset of the maximum range of the + base type. + + + + + + + +McCloghrie, et al. Standards Track [Page 40] + + + + + +RFC 2578 SMIv2 April 1999 + + +11.2. Examples + + Some examples of legal sub-typing: + + Integer32 (-20..100) + Integer32 (0..100 | 300..500) + Integer32 (300..500 | 0..100) + Integer32 (0 | 2 | 4 | 6 | 8 | 10) + OCTET STRING (SIZE(0..100)) + OCTET STRING (SIZE(0..100 | 300..500)) + OCTET STRING (SIZE(0 | 2 | 4 | 6 | 8 | 10)) + SYNTAX TimeInterval (0..100) + SYNTAX DisplayString (SIZE(0..32)) + + (Note the last two examples above are not valid in a TEXTUAL + CONVENTION, see [3].) + + Some examples of illegal sub-typing: + + Integer32 (150..100) -- first greater than second + Integer32 (0..100 | 50..500) -- ranges overlap + Integer32 (0 | 2 | 0 ) -- value duplicated + Integer32 (MIN..-1 | 1..MAX) -- MIN and MAX not allowed + Integer32 (SIZE (0..34)) -- must not use SIZE + OCTET STRING (0..100) -- must use SIZE + OCTET STRING (SIZE(-10..100)) -- negative SIZE + +12. Security Considerations + + This document defines a language with which to write and read + descriptions of management information. The language itself has no + security impact on the Internet. + + + +13. Editors' Addresses + + Keith McCloghrie + Cisco Systems, Inc. + 170 West Tasman Drive + San Jose, CA 95134-1706 + USA + Phone: +1 408 526 5260 + EMail: kzm@cisco.com + + + + + + +McCloghrie, et al. Standards Track [Page 41] + + + + + +RFC 2578 SMIv2 April 1999 + + + David Perkins + SNMPinfo + 3763 Benton Street + Santa Clara, CA 95051 + USA + Phone: +1 408 221-8702 + EMail: dperkins@snmpinfo.com + + Juergen Schoenwaelder + TU Braunschweig + Bueltenweg 74/75 + 38106 Braunschweig + Germany + Phone: +49 531 391-3283 + EMail: schoenw@ibr.cs.tu-bs.de + + +14. References + +[1] Information processing systems - Open Systems Interconnection - + Specification of Abstract Syntax Notation One (ASN.1), + International Organization for Standardization. International + Standard 8824, (December, 1987). + +[2] McCloghrie, K., Perkins, D., Schoenwaelder, J., Case, J., Rose, M. + and S. Waldbusser, "Conformance Statements for SMIv2", STD 58, + RFC 2580, April 1999. + +[3] McCloghrie, K., Perkins, D., Schoenwaelder, J., Case, J., Rose, M. + and S. Waldbusser, "Textual Conventions for SMIv2", STD 58, + RFC 2579, April 1999. + +[4] Information processing systems - Open Systems Interconnection - + Specification of Basic Encoding Rules for Abstract Syntax Notation + One (ASN.1), International Organization for Standardization. + International Standard 8825, (December, 1987). + +[5] The SNMPv2 Working Group, Case, J., McCloghrie, K., Rose, M. and + S. Waldbusser, "Management Information Base for Version 2 of the + Simple Network Management Protocol (SNMPv2)", RFC 1907, January + 1996. + +[6] The SNMPv2 Working Group, Case, J., McCloghrie, K., Rose, M. and + S. Waldbusser, "Protocol Operations for Version 2 of the Simple + Network Management Protocol (SNMPv2)", RFC 1905, January 1996. + + + + + +McCloghrie, et al. Standards Track [Page 42] + + + + + +RFC 2578 SMIv2 April 1999 + + +15. Full Copyright Statement + + Copyright (C) The Internet Society (1999). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE." + + + + + + + + + + + + + + + + + + + + + + + +McCloghrie, et al. Standards Track [Page 43] + + + + + diff --git a/standards/rfc3805.txt b/standards/rfc3805.txt new file mode 100644 index 000000000..aa008142d --- /dev/null +++ b/standards/rfc3805.txt @@ -0,0 +1,9579 @@ + + + + + + +Network Working Group R. Bergman +Request for Comments: 3805 Hitachi Printing Solutions +Obsoletes: 1759 H. Lewis +Category: Standards Track IBM Corporation + I. McDonald + High North Inc. + June 2004 + + + Printer MIB v2 + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (2004). + +Abstract + + This document provides definitions of models and manageable objects + for printing environments. The objects included in this MIB apply to + physical, as well as logical entities within a printing device. This + document obsoletes RFC 1759. + + + + + + + + + + + + + + + + + + + + + + +Bergman, et al. Standards Track [Page 1] + +RFC 3805 Printer MIB v2 June 2004 + + +Table of Contents + + 1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . 4 + 1.1. Network Printing Environment. . . . . . . . . . . . . . 4 + 1.2. Printer Device Overview . . . . . . . . . . . . . . . . 6 + 1.3. Categories of Printer Information . . . . . . . . . . . 6 + 1.3.1. Descriptions. . . . . . . . . . . . . . . . . . 6 + 1.3.2. Status. . . . . . . . . . . . . . . . . . . . . 6 + 1.3.3. Alerts. . . . . . . . . . . . . . . . . . . . . 6 + 1.4. The Internet-Standard Management Framework. . . . . . . 7 + 1.5. Requirement Levels. . . . . . . . . . . . . . . . . . . 7 + 2. Printer Model . . . . . . . . . . . . . . . . . . . . . . . . 8 + 2.1. Overview of the Printer Model . . . . . . . . . . . . . 10 + 2.2. Printer Sub-Units . . . . . . . . . . . . . . . . . . . 10 + 2.2.1. General Printer . . . . . . . . . . . . . . . . 10 + 2.2.1.1. International Considerations. . . . . 10 + 2.2.2. Inputs. . . . . . . . . . . . . . . . . . . . . 11 + 2.2.3. Media . . . . . . . . . . . . . . . . . . . . . 12 + 2.2.4. Outputs . . . . . . . . . . . . . . . . . . . . 12 + 2.2.5. Finishers . . . . . . . . . . . . . . . . . . . 12 + 2.2.6. Markers . . . . . . . . . . . . . . . . . . . . 13 + 2.2.7. Media Paths . . . . . . . . . . . . . . . . . . 13 + 2.2.8. System Controller . . . . . . . . . . . . . . . 14 + 2.2.9. Interfaces. . . . . . . . . . . . . . . . . . . 14 + 2.2.10. Print Job Delivery Channels . . . . . . . . . . 14 + 2.2.11. Interpreters. . . . . . . . . . . . . . . . . . 15 + 2.2.12. Console . . . . . . . . . . . . . . . . . . . . 15 + 2.2.13. Alerts. . . . . . . . . . . . . . . . . . . . . 15 + 2.2.13.1. Status and Alerts . . . . . . . . . . 16 + 2.2.13.2. Overall Printer Status. . . . . . . . 16 + 2.2.13.2.1. Host Resources MIB + Printer Status. . . . . . 18 + 2.2.13.2.2. Sub-unit Status . . . . . 20 + 2.2.13.3. Alert Tables. . . . . . . . . . . . . 21 + 2.2.13.4. Alert Table Management. . . . . . . . 21 + 2.3. Read-Write Objects. . . . . . . . . . . . . . . . . . . 23 + 2.4. Enumerations. . . . . . . . . . . . . . . . . . . . . . 24 + 2.4.1. Registering Additional Enumerated Values. . . . 25 + 3. Groups from other MIB Specifications. . . . . . . . . . . . . 25 + 3.1. System Group. . . . . . . . . . . . . . . . . . . . . . 25 + 3.2. System Controller . . . . . . . . . . . . . . . . . . . 25 + 3.3. Interface Group objects . . . . . . . . . . . . . . . . 26 + 3.3.1. Interface Types . . . . . . . . . . . . . . . . 26 + 4. Differences from RFC 1759 . . . . . . . . . . . . . . . . . . 26 + 5. The IANA Printer MIB. . . . . . . . . . . . . . . . . . . . . 29 + 6. The Printer MIB . . . . . . . . . . . . . . . . . . . . . . . 56 + -- Textual conventions for this MIB module. . . . . . . . . . 59 + -- The General Printer Group. . . . . . . . . . . . . . . . . 67 + + + +Bergman, et al. Standards Track [Page 2] + +RFC 3805 Printer MIB v2 June 2004 + + + -- The Responsible Party group. . . . . . . . . . . . . . . . 70 + -- The Auxiliary Sheet Group. . . . . . . . . . . . . . . . . 73 + -- Administrative section (The General V2 Group) . . . . . . 74 + -- General alert table section (Alert Table V2 Group). . . . 74 + -- The Cover Table. . . . . . . . . . . . . . . . . . . . . . 75 + -- The Localization Table . . . . . . . . . . . . . . . . . . 76 + -- The System Resources Tables. . . . . . . . . . . . . . . . 78 + -- The Input Group. . . . . . . . . . . . . . . . . . . . . . 81 + -- The Extended Input Group . . . . . . . . . . . . . . . . . 86 + -- The Input Media Group. . . . . . . . . . . . . . . . . . . 87 + -- The Input Switching Group. . . . . . . . . . . . . . . . . 89 + -- The Output Group . . . . . . . . . . . . . . . . . . . . . 90 + -- The Extended Output Group. . . . . . . . . . . . . . . . . 93 + -- The Output Dimensions Group. . . . . . . . . . . . . . . . 95 + -- The Output Features Group. . . . . . . . . . . . . . . . . 97 + -- The Marker Group . . . . . . . . . . . . . . . . . . . . . 98 + -- The Marker Supplies Group. . . . . . . . . . . . . . . . . 104 + -- The Marker Colorant Group. . . . . . . . . . . . . . . . . 107 + -- The Media Path Group . . . . . . . . . . . . . . . . . . . 109 + -- The Print Job Delivery Channel Group . . . . . . . . . . . 113 + -- The Interpreter Group. . . . . . . . . . . . . . . . . . . 115 + -- The Console Group. . . . . . . . . . . . . . . . . . . . . 120 + -- The Alerts Group . . . . . . . . . . . . . . . . . . . . . 125 + -- Conformance Information. . . . . . . . . . . . . . . . . . 129 + 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 147 + 8. Internationalization Considerations . . . . . . . . . . . . . 147 + 9. Security Considerations . . . . . . . . . . . . . . . . . . . 148 + 10. References. . . . . . . . . . . . . . . . . . . . . . . . . . 150 + 10.1. Normative References. . . . . . . . . . . . . . . . . . 150 + 10.2. Informative References. . . . . . . . . . . . . . . . . 151 + Appendix A - Glossary of Terms. . . . . . . . . . . . . . . . . . 153 + Appendix B - Media Size Names . . . . . . . . . . . . . . . . . . 156 + Appendix C - Media Names. . . . . . . . . . . . . . . . . . . . . 158 + Appendix D - Roles of Users . . . . . . . . . . . . . . . . . . . 162 + Appendix E - Overall Printer Status Table . . . . . . . . . . . . 165 + Appendix F - Participants . . . . . . . . . . . . . . . . . . . . 166 + Significant Contributors. . . . . . . . . . . . . . . . . . . . . 168 + Authors' Addresses. . . . . . . . . . . . . . . . . . . . . . . . 170 + Full Copyright Statement. . . . . . . . . . . . . . . . . . . . . 171 + + + + + + + + + + + + +Bergman, et al. Standards Track [Page 3] + +RFC 3805 Printer MIB v2 June 2004 + + +1. Introduction + +1.1. Network Printing Environment + + The management of producing a printed document, in any computer + environment, is a complex subject. Basically, the task can be + divided into two overlapping pieces, the management of printing and + the management of the printer. Printing encompasses the entire + process of producing a printed document from generation of the file + to be printed, selection of a printer, choosing printing properties, + routing, queuing, resource management, scheduling, and final printing + including notifying the user. Most of the printing process is + outside the scope of the model presented here; only the management of + the printer is covered. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Bergman, et al. Standards Track [Page 4] + +RFC 3805 Printer MIB v2 June 2004 + + + Figure 1 - One Printer's View of the Network + + system printer asset user user user + manager operator manager + O O O O O O + /|\ /|\ /|\ /|\ /|\ /|\ + / \ / \ / \ / \ / \ / \ + | | | | | | ++---------+ +-------+ +-------+ +-------+ +-----------+ +-----------+ +|configur-| |printer| | asset | |printer| | user | | user | +|ator | |manager| |manager| |browser| |application| |application| ++---------+ +-------+ +-------+ +-------+ +-----------+ +-----------+ + ^ ^ ^ ^ | | + |R/W |R/W |R |R +-----------+ +-----------+ + | | | | | spooler | | spooler | + | | | | +-----------+ +-----------+ + | | | | | | + | | | | +-----------+ +-----------+ + | | | | |supervisor | |supervisor | + | | | | +-----------+ +-----------+ + | | | | ^ ^ ^ ^ + | | | | |R |R/W |R |R/W + v v | | | | | | +================================================== | ===== | + | print| print| + |SNMP data| data| + +-----+ +-------+ PCL| PCL| + | MIB |<------>| agent | PostScript| PostScript| + +-----+ +-------+ NPAP| NPAP| + |unspecified etc.| etc.| + +=============+ +-----------------+ | | + | |--|channel/interface|<--+ | + | | +-----------------+ | + | PRINTER | | + | | +-----------------+ | + | |--|channel/interface|<----------------+ + +=============+ +-----------------+ + + + + + + + + + + + + + + +Bergman, et al. Standards Track [Page 5] + +RFC 3805 Printer MIB v2 June 2004 + + +1.2. Printer Device Overview + + A printer is the physical device that takes media from an input + source, produces marks on that media according to some page + description or page control language and puts the result in some + output destination, possibly with finishing applied. Printers are + complex devices that consume supplies, produce waste and may have + mechanical problems. In the management of the physical device the + description, status and alert information concerning the printer and + its various subparts has to be made available to the management + application so that it can be reported to the end user, key operators + for the replenishment of supplies or the repair or maintenance of the + device. The information needed in the management of the physical + printer and the management of a printing job overlap highly and many + of the tasks in each management area require the same or similar + information. + +1.3. Categories of Printer Information + + Information about printers is classified into three basic categories: + descriptions, status and alerts. + +1.3.1. Descriptions + + Descriptions convey information about the configuration and + capabilities of the printer and its various sub-units. This + information is largely static information and does not generally + change during the operation of the system but may change as the + printer is repaired, reconfigured or upgraded. The descriptions are + one part of the visible state of the printer where state means the + condition of being of the printer at any point in time. + +1.3.2. Status + + Status is the information regarding the current operating state of + the printer and its various sub-units. As an example of the use of + status, a management application must be able to determine if the + various sub-units are ready to print or are in some state that + prevents printing or may prevent printing in the future. + +1.3.3. Alerts + + An Alert is the representation of a reportable event in the printer. + An event is a change in the state of the printer. Some of those + state changes are of interest to a management application and are + therefore reportable. Typically, these are the events that affect + the printer's ability to print. Alerts usually occur asynchronously + to the operation of the computer system(s) to which the printer is + + + +Bergman, et al. Standards Track [Page 6] + +RFC 3805 Printer MIB v2 June 2004 + + + attached. For convenience below, "alert" will be used for both the + event caused by a change in the printer's state and for the + representation of that event. + + Alerts can be classified into two basic categories, critical and non- + critical. A critical alert is one that is triggered by entry into a + state in which the printer is stopped and printing can not continue + until the condition that caused the critical alert is eliminated. + "Out of paper", "toner empty" and "output bin full" are examples of + critical alerts. Non-critical alerts are triggered by those events + that enter a state in which printing is not stopped. Such a non- + critical state may, at some future time, lead to a state in which + printing may be stopped. Examples of these kinds of non-critical + alerts are "input media low", "toner low" and "output bin nearly + full". Or, a non-critical alert may simply provide information, such + as signaling a configuration changed in the printer. + + Description, status and alert information about the printer can be + thought of as a database describing the printer. The management + application for a printer will want to view the printer data base + differently depending on how and for what purposes the information in + the database is needed. + +1.4. The Internet-Standard Management Framework + + For a detailed overview of the documents that describe the current + Internet-Standard Management Framework, please refer to section 7 of + RFC 3410 [RFC3410]. + + Managed objects are accessed via a virtual information store, termed + the Management Information Base or MIB. MIB objects are generally + accessed through the Simple Network Management Protocol (SNMP). + Objects in the MIB are defined using the mechanisms defined in the + Structure of Management Information (SMI). This memo specifies a MIB + module that is compliant to the SMIv2, which is described in STD 58, + RFC 2578 [RFC2578], STD 58, RFC 2579 [RFC2579] and STD 58, RFC 2580 + [RFC2580]. + +1.5. Requirement Levels + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in [RFC2119]. + + Compliant implementations must follow this specification. + + + + + + +Bergman, et al. Standards Track [Page 7] + +RFC 3805 Printer MIB v2 June 2004 + + +2. Printer Model + + In order to accomplish the management of the printer, an abstract + model of the printer is needed to represent the sub-units from which + the printer is composed. A printer can be described as consisting of + 13 types of sub-units. It is important to note that the sub-units of + a printer do not necessarily relate directly to any physically + identifiable mechanism. Sub-units can also be a set of definable + logical processes, such as interpreters for page description + languages or command processors that set various operating modes of + the printer. + + Figure 2 shows a block diagram of the printer and its basic 13 sub- + units. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Bergman, et al. Standards Track [Page 8] + +RFC 3805 Printer MIB v2 June 2004 + + + Figure 2 - Printer Block Diagram + + Physical Connections + | + +-----------+ + | | + +-------------+ | + | Interface |-+ + | MIB-II | + +-------------+ + | + +-----------+ + | | + +-------------+ | +-----------+ + | Channel |-+ | Operator | + | | | Console | + +-------------+ +-----------+ + | + +-----------+ +---------+ + | | | | + +-----------+ +-------------+ | +-----------+ | + | General | | Interpreter |-+ | Alerts |-+ + | Printer | | | | | + +-----------+ +-------------+ +-----------+ + | + +-------------------------------+ + | System Controller | + | HOST-RESOURCES-MIB | + +-------------------------------+ + + +------+ +--------+ +--------+ + | | | | | | ++-------+ | +-------+ +---------+ | +-------+ +--------+ | +| Input |-+ +--------+| | Marker |-+ +--------+| | Output |-+ +| |===>| |+<==>| |<==>| |+==>| | ++-------+ +--+ +--+ +---------+ +--+ +--+ +--------+ + \ | || | || \ + \ | || | || \ + \ | || | || \ + +--------+ | |+-------------------------| || +---------+ + | | | +--------------------------+ || | | ++----------+ | | Media Path |+ +----------+ | +| Media |-+ +--------------------------------+ | Finisher |-+ +|(optional)| |(optional)| ++----------+ +----------+ + + + + + + +Bergman, et al. Standards Track [Page 9] + +RFC 3805 Printer MIB v2 June 2004 + + +2.1. Overview of the Printer Model + + The model has three basic parts: (1) the flow of a print file into an + interpreter and onto the marker, (2) the flow of media through the + marker and (3) the auxiliary sub-units that control and facilitate + the two prior flows. The flow of the print data comes through a + physical connection on which some form of transport protocol stack is + running. The data provided by the transport protocol (interface) + appears on a channel, which is the input to an interpreter. The + interpreter converts the print data into a form suitable for marking + on the media. + + The media resides in Input sub-units from which the media is selected + and then transported via a Media Path first to a Marking sub-unit and + then onto an Output sub-unit with (optionally) some finishing + operations being performed. The auxiliary sub-units facilitate + control of the printer, inquiry/control of the operator panel, + reporting of alerts and the adaptation of the printer to various + natural languages and characters sets. All the software sub-units + run on the System Controller that represents the processor, memory + and storage systems of the Printer. Each of the sub-units is + discussed in more detail below. + + All of the sub-units other than the Alerts report only state + information, either a description or a status. The Alerts sub-unit + reports event information. + +2.2. Printer Sub-Units + + A printer is composed of 13 types of sub-units, called groups. The + following sections describe the different types of sub-units. + +2.2.1. General Printer + + The general printer sub-unit is responsible for the overall control + and status of the printer. There is exactly one general printer sub- + unit in a printer. The General Printer Group in the model represents + the general printer sub-unit. In addition to the providing the + status of the whole printer and allowing the printer to be reset, + this Group provides information on the status of the packaging of the + printer, in particular, the covers. The general printer sub-unit is + usually implemented on the system controller. + +2.2.1.1. International Considerations + + The localization portion of the general printer sub-unit is + responsible for identifying the natural language, country, and + character set in which certain character strings are expressed in + + + +Bergman, et al. Standards Track [Page 10] + +RFC 3805 Printer MIB v2 June 2004 + + + this MIB. Character sets are identified in this MIB using the + IANACharset textual convention imported from the IANA Character Set + MIB [CHARMIB]. + + There may be one or more localizations supported per printer. The + available localizations are specified in the Localization table. + Localization SHOULD only be performed on string objects which are + named 'xxxDescription' (sub-unit descriptions) or + 'prtConsoleDisplayBufferText' (local console text). + + The agent SHALL return all other character strings in coded character + sets in which code positions 0-127 (decimal) are US-ASCII [ASCII]. + The agent SHOULD return all other character strings in the UTF-8 + [RFC3629] transform of ISO 10646 [ISO10646], to conform with the IETF + Policy on Character Sets and Languages [RFC2277]. Control codes + (code positions 0-31 and 127 decimal) SHALL NOT be used unless + specifically required in the DESCRIPTION of an object. + + The character set portion of the general printer Localization table + is responsible for identifying the possible character sets for the + operator console, and network management requests for display + objects. There may be one or more character sets per printer. + Default coded character sets for interpreter unit and output octets + are described in the interpreter sub-unit by + prtInterpreterDefaultCharSetIn and prtInterpreterDefaultCharSetOut. + These input/output character sets may be overridden by commands in + the interpreter language itself. + +2.2.2. Inputs + + Input sub-units are mechanisms that feed media to be marked on into + the printer. A printer contains one or more input sub-units. The + Input Group in the model represents these. The model does not + distinguish fixed input bins from removable trays, except to report + when a removable tray has been removed. + + There are as many input sub-units as there are distinctly selectable + input "addresses". For example, if one tray has both a manual and + auto feeding option, then this is two input sub-units if these two + sources can be (must be) separately selected. However, the above + would be considered one input sub-unit if putting a sheet in the + manual feed slot overrides feeding from the contents of the tray. In + the second case there is no way to separately select or address the + manual feed slot. + + + + + + + +Bergman, et al. Standards Track [Page 11] + +RFC 3805 Printer MIB v2 June 2004 + + +2.2.3. Media + + An input sub-unit can hold one or more instances of the media on + which marking is to be done. Typically, there is a large set of + possible media that can be associated with an input. The Media Group + is an extension of the Input Group, which represents media in an + input sub-unit. The Media Group only describes the current contents + of each input and not the possible content of the input sub-unit. + +2.2.4. Outputs + + Output sub-units are mechanisms that receive media that has been + marked on. The Output Group in the model represents the one or more + output mechanisms contained by a printer. The model does not + distinguish fixed output bins from removable output bins, except to + report when a removable bin has been removed. + + There are as many output sub-units as there are distinctly selectable + output "addresses". Output sub-units can be addressed in two + different ways: (1) as a set of "mailboxes" which are addressed by a + specific mailbox selector such as a bin number or a bin name, or (2) + as a set of "slots" into which multiple copies are collated. + Sometimes both modes of using the output sub-units can be used on the + same printer. All that is important from the viewpoint of the model + is that the output units can be separately selected. + +2.2.5. Finishers + + A finisher is a sub-unit that performs some operations on the media + other than marking. The Finisher Group in the model represents the + finisher sub-units. Some examples of finishing processes are + stapling, punching, binding, inserting, or folding. Finishing + processes may have supplies associated with the process. Stapling, + binding, and punching are examples of processes that have supplies. + A printer may have more than one finishing sub-unit and each + finishing sub-unit may be associated with one or more output sub- + units. Finishers are described in the companion Finisher MIB + [RFC3806]. + + The model does not specify the exact interaction and sequencing + between an output device and its associated finisher. It depends on + the type of finishing process and the exact implementation of the + printer system. This standard allows for the logical association of + a finishing process with an output device but does not put any + restrictions on the exact sequence or interaction with the associated + output device. The output and finisher sub-units may or may not be + separate identifiable physical mechanisms depending on the exact + + + + +Bergman, et al. Standards Track [Page 12] + +RFC 3805 Printer MIB v2 June 2004 + + + implementation of a printer. In addition, a single output device may + be associated with multiple finishing sub-units and a single + finishing sub-unit may be associated with multiple output devices. + +2.2.6. Markers + + A marker is the mechanism that produces marks on the print media. + The Marker Group in the model represents the marker sub-units and + their associated supplies. A printer can contain one or more marking + mechanisms. Some examples of multiple marker sub-units are a printer + with separate markers for normal and magnetic ink or an image setter + that can output to both a proofing device and final film. Each + marking device can have its own set of characteristics associated + with it, such as marking technology and resolution. + + In this model the marker sub-unit is viewed as very generalized and + encompasses all aspects of a marking process. For example, in a + xerographic process, the marking process as well as the fusing + process would be included in the generalized concept of the marker. + With the generalized concept of a marking process, the concept of + multiple marking supplies associated with a single marking sub-unit + results. For example, in the xerographic process, there is not only + a supply of toner, but there can also be other supplies such as a + fuser supply (e.g., fuser oil) that can be consumed and replaced + separately. In addition there can be multiple supplies of toner for + a single marker device, as in a color process. + +2.2.7. Media Paths + + The media paths encompass the mechanisms in the printer that move the + media through the printer and connect all other media related sub- + units: inputs, outputs, markers and finishers. A printer contains + one or more media paths. The Media Path Group in the model + represents these. The Media Path group has some objects that apply + to all paths plus a table of the separate media paths. + + In general, the design of the media paths determines the maximum + speed of the printer as well as the maximum media size that the + printer can handle. Media paths are complex mechanisms and can + contain many different identifiable sub-mechanisms such as media + movement devices, media buffers, duplex units and interlocks. Not + all of the various sub-mechanisms reside on every media path. For + example, one media path may provide printing only on one surface of + the media (a simplex path) and another media path may have a sub- + mechanism that turns the media over and feeds it a second time + through the marker sub-unit (a duplex path). The duplex path may + + + + + +Bergman, et al. Standards Track [Page 13] + +RFC 3805 Printer MIB v2 June 2004 + + + even have a buffer sub-mechanism that allows multiple copies of the + obverse side to be held before the reverse side of all the copies is + marked. + +2.2.8. System Controller + + The System Controller is the sub-unit upon which the software + components of the Printer run. The Host Resources MIB [RFC2790] + represents the System Controller in the model. The Host Resources + MIB allows for the specification of the processor(s), memory, disk + storage, file system and other underlying sub-mechanisms of the + printer. The controller can range from simple single processor + systems to multiprocessor systems. In addition, controllers can have + a full range of resources such as hard disks. The printer is modeled + to have one system controller even though it may have more than one + processor and multiple other resources associated with it. + +2.2.9. Interfaces + + An interface is the communications port and associated protocols that + are responsible for the transport of data to the printer. A printer + has one or more interface sub-units. The interfaces are represented + by the Interfaces Group of MIB-II [RFC1213], [RFC2863]. Some + examples of interfaces are serial ports (with little or no protocol) + and Ethernet ports on which one might run Internet IP, Novell IPX, + etc. + +2.2.10. Print Job Delivery Channels + + The print job delivery channel sub-units identify the independent + sources of print data (here print data is the information that is + used to construct printed pages and may have both data and control + aspects). A printer may have one or more channels. The channel sub- + units are represented by the Print Job Delivery Channel Group in the + Model. The electronic path typically identifies each channel and + service protocol used to deliver print data to the printer. A + channel sub-unit may be independently enabled (allowing print data to + flow) or disabled (stopping the flow of print data). It has a + current Control Language that can be used to specify which + interpreter is to be used for the print data and to query and change + environment variables used by the interpreters (and SNMP). There is + also a default interpreter that is to be used if an interpreter is + not explicitly specified using the Control Language. Print Job + Delivery Channel sub-units can, and usually are, based on an + underlying interface. + + + + + + +Bergman, et al. Standards Track [Page 14] + +RFC 3805 Printer MIB v2 June 2004 + + +2.2.11. Interpreters + + The interpreter sub-units are responsible for the conversion of a + description of intended print instances into images that are to be + marked on the media. A printer may have one or more interpreters. + The Interpreter Group in the Model represents the interpreter sub- + units. Each interpreter is generally implemented with software + running on the System Controller sub-unit. The Interpreter Table has + one entry per interpreter where the interpreters include both Page + Description Language (PDL) Interpreters and Control Language + Interpreters. + +2.2.12. Console + + Many printers have a console on the printer, the operator console + that is used to display and modify the state of the printer. The + console can be as simple as a few indicators and switches or as + complicated as full screen displays and keyboards. There can be at + most one such console. The Console Group in the model represents + this console sub-unit. Although most of the information displayed + there is also available in the state of the printer as represented by + the various Groups, it is useful to be able to query and modify the + operator console remotely. For example, a management application + might like to display to its user the current message on the operator + console of the remote printer or the management application user + might like to modify the current message on the operators console of + the remote printer. As another example, one might have a remote + application that puts up a pseudo console on a workstation screen. + Since the rules by which the printer state is mapped onto the console + and vice versa are not standardized, it is not possible to reproduce + the console state or the action of console buttons and menus. + Therefore, the Console Group provides access to the console. The + operator console is usually implemented on the system controller with + additional hardware for input and display. + +2.2.13. Alerts + + The alert sub-unit is responsible for detecting reportable events, + making an entry in the alert table and, if and only if the event is a + critical event, initiating a trap. The exception to this rule is + when the "alertRemovalofBinaryChangeEntry" trap is generated. The + alert sub-unit is represented by the Alerts Group and, in particular, + the Alert Table. This table contains information on the severity, + sub- unit, and detailed location within the sub-unit, alert code and + description of each alert that is currently active within the + printer. Each reportable event causes an entry to be made in the + Alert Table. + + + + +Bergman, et al. Standards Track [Page 15] + +RFC 3805 Printer MIB v2 June 2004 + + +2.2.13.1. Status and Alerts + + Summary information about the state of the printer is reported at + three separate levels: (1) The status of the printer as a whole is + reported in the Host Resources MIB, (2) The status of various sub- + units is reported in the principle table of the Group that represents + the sub-unit, and (3) Alert codes are reported in the Alert Table. + +2.2.13.2. Overall Printer Status + + Of the many states a printer can be in, certain states are more + "interesting" because of the distinct actions they are likely to + provoke in the administrator. These states may be applied to the + printer as a whole, or to a particular sub-unit of the printer. + These named states are: + + Non Critical Alert Active - For the printer this means that one or + more sub-units have a non-critical alert active. For a sub-unit, + this means that the sub-unit has a non-critical alert active. + + Critical Alert Active - For the printer this means that one or more + sub-units have a critical alert active. For a sub-unit, this means + that the sub-unit has a critical alert active. + + Unavailable - The printer or sub-unit is unavailable for use (this is + the same as "broken" or "down" in other terminology). A trained + service person is typically necessary to make it available. + + Moving on-line or off-line - The printer is either off-line, in the + process of moving off-line or moving back on-line. For example, on + printers with motorized hoppers, reloading paper involves a + transition to off-line to open the paper bin, filling the hopper and, + finally, a transition back to on-line as the paper bin is + repositioned for printing. + + Standby - The printer or sub-unit is not immediately available but + can accept new instructions. + + Available - The printer or subunit is functioning normally. + + Idle - The printer or subunit is immediately available. + + Active - The printer or subunit is performing its primary function. + + Busy - The printer or subunit is performing a function (not + necessarily its primary function) and is not immediately available + for its primary function. + + + + +Bergman, et al. Standards Track [Page 16] + +RFC 3805 Printer MIB v2 June 2004 + + + The Host Resources MIB [RFC2790] provides three status objects that + can be used to describe the status of a printer: (1) hrDeviceStatus + in the entry in the hrDeviceTable; (2) hrPrinterStatus in the + hrPrinterTable; and (3) hrPrinterDetectedErrorState in the + hrPrinterTable. These objects describe many of the states that a + printer can be in. The following table shows how the values of the + three printer-related objects in the Host Resources MIB relate to the + states named above: + + Printer hrDeviceStatus hrPrinterStatus hrPrinterDetected- + Status ErrorState + + Idle running(2) idle(3) none set + + Busy/ running(2) printing(4) + Active + + Non Critical warning(3) idle(3) or could be: lowPaper, + Alert Active printing(4) lowToner, or + serviceRequested + + Critical down(5) other(1) could be: jammed, + Alert Active noPaper, noToner, + coverOpen, or + serviceRequested + + Unavailable down(5) other(1) + + Moving off- warning(3) idle(3) or offline + line printing(4) + Off-line down(5) other(1) offline + + Moving down(5) warmup(5) + on-line + + Standby running(2) other(1) + + These named states are only a subset of the possible states - they + are not an exhaustive list of the possible states. Nevertheless, + several things should be noted. When using these states, it is not + possible to detect when both critical and non-critical alerts are + pending - if both are pending, the Critical Alert Active state will + prevail. In addition, a printer in the Standby state will be + represented in the Host Resources MIB with a device status of + running(2) and a printer status of other(1), a set of states that + don't uniquely distinguish this important printer state. + + + + + +Bergman, et al. Standards Track [Page 17] + +RFC 3805 Printer MIB v2 June 2004 + + + Detailed status per sub-unit is reported in the sub-unit status + fields. + +2.2.13.2.1. Host Resources MIB Printer Status + + For completeness, the definitions of the Printer Status objects of + the Host Resources MIB [RFC2790] are given below: + + hrDeviceStatus OBJECT-TYPE + SYNTAX INTEGER { + unknown(1), + running(2), + warning(3), + testing(4), + down(5) + } + ACCESS read-only + STATUS mandatory + DESCRIPTION + "The current operational state of the device + described by this row of the table. A value + unknown(1) indicates that the current state of the + device is unknown. running(2) indicates that the + device is up and running and that no unusual error + conditions are known. The warning(3) state + indicates that agent has been informed of an + unusual error condition by the operational software + (e.g., a disk device driver) but that the device + is still 'operational'. An example would be high + number of soft errors on a disk. A value of + testing(4), indicates that the device is not + available for use because it is in the testing + state. The state of down(5) is used only when + the agent has been informed that the device is + not available for any use." + ::= { hrDeviceEntry 5 } + + hrPrinterStatus OBJECT-TYPE + SYNTAX INTEGER { + other(1), + unknown(2), + idle(3), + printing(4), + warmup(5) + } + ACCESS read-only + STATUS mandatory + DESCRIPTION + + + +Bergman, et al. Standards Track [Page 18] + +RFC 3805 Printer MIB v2 June 2004 + + + "The current status of this printer device. When in the + idle(3), printing(4), or warmup(5) state, the corresponding + hrDeviceStatus should be running(2) or warning(3). When in + the unknown(2) state, the corresponding hrDeviceStatus + should be unknown(1)." + ::= { hrPrinterEntry 1 } + + hrPrinterDetectedErrorState OBJECT-TYPE + SYNTAX OCTET STRING (0..128) + ACCESS read-only + STATUS mandatory + DESCRIPTION + "This object represents any error conditions detected by the + printer. The error conditions are encoded as an OCTET STRING + with the following definitions: + + Condition Bit # + + lowPaper 0 + noPaper 1 + lowToner 2 + noToner 3 + doorOpen 4 + jammed 5 + offline 6 + serviceRequested 7 + + inputTrayMissing 8 + outputTrayMissing 9 + markerSupplyMissing 10 + outputNearFull 11 + outputFull 12 + inputTrayEmpty 13 + overduePreventMaint 14 + + Bit # 15 is not assigned. + + If multiple conditions are currently detected and the + hrDeviceStatus would not otherwise be unknown(1) or + testing(4), the hrDeviceStatus shall correspond to the worst + state of those indicated, where down(5) is worse than + warning(3), which is worse than running(2). + + Bits are numbered starting with the most significant bit of + the first byte being bit 0, the least significant bit of the + first byte being bit 7, the most significant bit of the + second byte being bit 8, and so on. A one bit encodes that + the condition was detected, while a zero bit encodes that + + + +Bergman, et al. Standards Track [Page 19] + +RFC 3805 Printer MIB v2 June 2004 + + + the condition was not detected. + + This object is useful for alerting an operator to specific + warning or error conditions that may occur, especially those + requiring human intervention." + ::= { hrPrinterEntry 2 } + +2.2.13.2.2. Sub-unit Status + + Sub-unit status is reported in the entries of the principle table in + the Group that represents the sub-unit. For sub-units that report a + status, there is a status column in the table and the value of this + column is always an integer formed in the following way. + + The PrtSubUnitStatusTC is an integer that is the sum of 5 distinct + values, Availability, Non-Critical, Critical, On-line, and + Transitioning. These values are: + + Availability value + + Available and Idle 0 000'b + Available and Standby 2 010'b + Available and Active 4 100'b + Available and Busy 6 110'b + Unavailable and OnRequest 1 001'b + Unavailable because Broken 3 011'b + Unknown 5 101'b + + Non-Critical + + No Non-Critical Alerts 0 + Non-Critical Alerts 8 + + Critical + + No Critical Alerts 0 + Critical Alerts 16 + + On-Line + + State is On-Line 0 + State is Off-Line 32 + + Transitioning + + At intended state 0 + Transitioning to intended state 64 + + + + +Bergman, et al. Standards Track [Page 20] + +RFC 3805 Printer MIB v2 June 2004 + + + For example, an input (tray) that jammed on the next to the last page + may show a status of 27 (unavailable because broken (3) + a critical + state (16), jammed, and a noncritical state (8), low paper). + +2.2.13.3. Alert Tables + + The Alert Group consists of a single table in which all active alerts + are represented. This section provides an overview of the table and + a description of how it is managed. The basic content of the alert + table is the severity (critical or non-critical) of the alert, the + Group and entry where a state change caused the alert, additional + information about the alert (a more detailed location, an alert code, + and a description), and an indication of the level of training needed + to service the alert. + + The Alert Table contains some information that is redundant, for + example that an event has occurred, and some information that is only + represented in the Alert Table, for example the additional + information. A single table was used because a single entry in a + group could cause more than one alert, for example paper jams in more + than one place in a media path. Associating the additional + information with the entry in the affected group would only allow one + report where associating the additional information with the alert + makes multiple reports possible. Every time an alert occurs in the + printer, the printer makes one or more entries into the Alert Table. + The printer determines if an event is to be classified as critical or + non-critical. If the severity of the Alert is "critical", the + printer sends a trap or event notification to the host indicating + that the table has changed. Whether or not a trap is sent, the + management application is expected to poll the printer on a regular + basis and to read and parse the table to determine what conditions + have changed, in order to provide reliable information to the + management application user. + +2.2.13.4. Alert Table Management + + The alert tables are sparsely populated tables. This means the + tables will only contain entries of the alerts that are currently + active and the number of rows, or entries in the table will be + dynamic. More than one event can be added or removed from the event + tables at a time depending on the implementation of the printer. + + There are basically two kinds of events that produce alerts: binary + change events and unary change events. Binary change events come in + pairs: the leading edge event and the trailing edge event. The + leading edge event enters a state from which there is only one exit; + for example, going from running to stopped with a paper jam. The + only exit from this state is fixing the paper jam and it is clear + + + +Bergman, et al. Standards Track [Page 21] + +RFC 3805 Printer MIB v2 June 2004 + + + when that is accomplished. The trailing edge event exits the state + that was entered by the leading edge event. In the example above, + fixing the paper jam is the trailing edge event. + + It is relatively straightforward to manage binary change events in + the Alert Table. Only the leading edge event makes an entry in the + alert table. This entry persists in the Alert Table until the + trailing edge event occurs at which point this event is signaled by + the removal of the leading edge event entry in the Alert Table. That + is, a trailing edge event does not create an entry; it removes the + corresponding leading edge event. Removing the leading edge entry + may cause the unary change event "alertRemovalofBinaryChangeEntry" to + be added to the table. With binary change events it is possible to + compute the maximum number that can occur at the same time and + construct an Alert Table that would hold that many events. There + would be no possibility of table overflow and no information about + outstanding events would be lost. + + Unfortunately, there are some events that are not binary changes. + This other category of event, the unary change event, is illustrated + by the configuration change event. With this kind of event the state + of the machine has changed, but to a state which is (often) just as + valid as the state that was left and from which no return is + necessary. For example, an operator may change the paper that is in + the primary input source from letter to legal. At some time in the + future the paper may be changed back to letter, but it might be + changed to executive instead. This is where the problem occurs. It + is not obvious how long to keep unary change event entries in the + Alert Table. If they were never removed, the Alert Table would + continue to grow indefinitely. + + The agent needs to have an algorithm implemented for the management + of the alert table, especially in the face of combinations of binary + and unary alerts that would overflow the storage capacity of the + table. When the table is full and new alerts need to be added, an + old alert to be deleted should be chosen using the following rules: + + 1. Find a non-critical unary alert and delete it. If there are + multiple non-critical unary alerts, it is suggested that the + oldest one is chosen. If there are no non-critical unary alerts, + then, + + 2. Find a non-critical binary alert and delete it. If there are + multiple non-critical binary alerts, it is suggested that the + oldest one is chosen. If there are no non-critical binary alerts, + then, + + + + + +Bergman, et al. Standards Track [Page 22] + +RFC 3805 Printer MIB v2 June 2004 + + + 3. Find a critical (binary) alert and delete it. If there are + multiple critical alerts, it is suggested that the oldest one be + chosen. Agent implementers are encouraged to provide at least + enough storage space for the maximum number of critical alerts + that could occur simultaneously. Note that all critical alerts + are binary. + + In the event that a critical binary alert has been deleted out of the + alert table; when space allows and the alert condition still exists, + the alert should be re-added to the alert table even if there was no + subsequent transition into the associated state. It is recommended + that this be done for non-critical binary alerts as well. Note that + the new alert entry will not have the same index as the original + entry that was moved out of the table. + + Note that because the Alert Index is a monotonically increasing + integer there will be gaps in the values in the table when an alert + is deleted. The management application may want to re-acquire the + Printer state and check for state changes that it did not observe in + the Alert Table if such gaps are detected. + +2.3. Read-Write Objects + + Some objects in the printer MIB reflect the existence or amount of a + given resource within the printer. Some examples of such resources + are the size and number of sheets in a paper tray or the existence of + certain output options. Some printers have automatic sensors for + these resources. Most printers lack sensors for every property of + every resource. The management application is allowed to write into + objects that hold descriptive or existence values for printers that + cannot sense these values. The ability to change the value of a + read- write object may depend on the implementation of the agent. + Many objects in the MIB are given read-write access, but a printer + implementation might only permit a management application to change + the value if the printer can not sense the value itself. Note that + even though some objects explicitly state the behavior of conditional + ability to change values, any read-write object may act this way. + + Generally, an object is given read-write access in the Printer MIB + specification if: + + 1. The object involves installation of a resource that some printers + cannot themselves detect. Therefore, external means are needed to + inform the printer of the installation. (Here external means + include using the operator console, or remote management + application) and + + + + + +Bergman, et al. Standards Track [Page 23] + +RFC 3805 Printer MIB v2 June 2004 + + + 2. The printer will behave differently if the installation of the + resource is reported than the printer would if the installation + were not reported; that is, the object is not to be used as a + place to put information not used by the printer, i.e., not a + "sticky-note". Another way of saying this is that the printer + believes that information given it and acts as if the information + were true. For example, on a printer that cannot sense the size, + if one paper size is loaded, but another size is set into the + paper size object, then the printer will use the size that was set + as its current paper size in its imaging and paper handling. + + 3. The printer may get hints that it may not know about the existence + or properties of certain resources. For example, a paper tray may + be removed and re-inserted. When this removal and insertion + happens, the printer may either assume that a property, such as + the size of paper in the tray, has not changed or the printer may + change the value of the associated object to "unknown", as might + be done for the amount of paper in the tray. As long as the + printer acts according to the value in the object either strategy + is acceptable. + + 4. It is an implementation-specific matter as to whether or not MIB + object values are persistent across power cycles or cold starts. + It is particularly important that the values of the + prtMarkerLifeCount object persist throughout the lifetime of the + printer. Therefore, if the value of any MIB object persists + across power cycles, then the prtMarkerLifeCount object must also + persist. + +2.4. Enumerations + + Enumerations (enums) are sets of symbolic values defined for use with + one or more objects. Commonly used enumeration sets are assigned a + symbolic data type name (textual convention), rather than being + specified in the SYNTAX clause of each individual object definition. + + Textual conventions defined in the Printer MIB or the companion IANA + Printer MIB are extensible by RFC publication or by Designated Expert + Review (see the 'IANA Considerations' section of this Printer MIB and + the DESCRIPTION clause in MODULE-IDENTITY of IANA Printer MIB). All + of these textual conventions are: + + a) used more than once in the Printer MIB itself; or + + b) imported and used in the companion Finisher MIB; or + + c) imported and used in any other, including vendor private, MIB + modules. + + + +Bergman, et al. Standards Track [Page 24] + +RFC 3805 Printer MIB v2 June 2004 + + + The Printer MIB has also defined the following special values for use + with objects of the syntax "Integer32" to define conditions that are + outside of the normal numeric range: other(-1), unknown(-2), and + partial(-3). The 'partial' value means that there is some supply + remaining (but the amount is indeterminate) or there is some capacity + remaining (but the amount is indeterminate). The Integer32 range + field indicates in which objects these special values are valid. + +2.4.1. Registering Additional Enumerated Values + + The Printer MIB and the companion IANA Printer MIB each defines one + category of textual convention, according to the process employed to + control the addition of new enumerations: + + Type 1 - All of the legal values are defined in the Printer MIB. + Additional enumerated values require the publication of a new Printer + MIB. + + Type 2 - All of the legal values are registered in the IANA Printer + MIB. Additional enumerated values require a Designated Expert Review + defined in "Guidelines for Writing an IANA Considerations Section in + RFCs" [RFC2434]. The Designated Expert will be selected by the IETF + Area Director(s) of the Applications Area. + +3. Groups from other MIB Specifications + + This section identifies the groups from other MIBs that shall be + supported to supplement and complete a printer MIB implementation. + The section also describes some of the less obvious characteristics + of the Printer MIB structure that are related to the inclusion of + these other MIB groups. + +3.1. System Group + + All objects in the system group of MIB-II [RFC1213] shall be + implemented; however, as described in paragraph 2.4, implementers + should carefully consider what constitutes the "system". + +3.2. System Controller + + The storage and device groups of the Host Resources MIB [RFC2790] + shall be implemented to support the printer(s) system controller, and + any supporting devices. If deemed appropriate by the implementer, + other groups of the Host Resources MIB (System, Running Software, + Running Software Performance, and Installed Software) may be + implemented. Because of the structure of the Host Resources MIB, the + devices constituting the system controller are at the same level as + the printer. + + + +Bergman, et al. Standards Track [Page 25] + +RFC 3805 Printer MIB v2 June 2004 + + +3.3. Interface Group objects + + All objects in the Interfaces Group of MIB-II [RFC1213] shall be + implemented for all print information interfaces to the printer, + including non-network interfaces. + +3.3.1. Interface Types + + The interfaces group of RFC 1213 [RFC1213] contains only a partial + list of interface types that can be specified in the "ifType" object. + For a complete list of interface types, refer to the IANA registry at + "ftp://ftp.isi.edu/mib/iana.mib/ianaiftype.mib" + +4. Differences from RFC 1759 + + This document supersedes and replaces RFC 1759. However, a compliant + implementation of RFC 1759 is also compliant with this document. The + following changes to RFC 1759 are included: (See the printmib + REVISION/DESCRIPTION clause for additional details of changes.) + + - Minor editorial corrections and changes. Updated the cover page + and added the "SNMP Management Framework" boilerplate to section + 1. + + - Updated figure 2 to use MIB names instead of RFC numbers. + + - Updated Coded Character Set description and IANA registration + process. + + - Change hrPrinterDetectedErrorState "coverOpen" (bit 4) to + "doorOpen" per RFC 2790. + + - Added second octet of hrPrinterDetectedErrorState as partially + described and assigned in the updated Host Resources MIB (RFC + 2790). + + - Remove fixed association of hrDeviceStatus (warning/down) from + hrPrinterDetetctedErrorState per RFC 2790. + + - Instead of showing bit 15 as "not assigned" in the quote from RFC + 2790 in the hrPrinterDetectedErrorState object, removed that from + the tabular form and added it as a sentence, because the RFC + doesn't show bit 15 in the tabular form. + + - Clarified the international considerations. + + + + + + +Bergman, et al. Standards Track [Page 26] + +RFC 3805 Printer MIB v2 June 2004 + + + - Added prtChannelInformation to the Channel Group textual- + conventions on a per channel basis to clarify the channel + description and enhance interoperability. + + - Deprecated some obsolete channel types. + + - Extended the Alert Table and PrtMarkerSuppliesSupplyUnit textual + conventions to include values from the Finisher MIB. + + - Clarified alerts based on unary vs. binary change events. + + - Added (optional) unary change event + alertRemovalOfBinaryChangeEntry(1801). + + - Establish a convention for contact information for + prtGeneralCurrentOperator and prtGeneralServicePerson. + + - Added prtAuxiliarySheetStartupPage PresentOnOff + + - Added prtAuxiliarySheetBannerPage PresentOnOff + + - Added prtGeneralPrinterName OCTET STRING + + - Added prtGeneralSerialNumber OCTET STRING + + - Added prtInputNextIndex Integer32 + + - Added the Input Switching Group + + - Added prtAlertCriticalEvents Counter32 + + - Added prtAlertAllEvents Counter32 + + - Updated PrtAlertCode enums including generic alert codes. + + - Created five OBJECT-GROUPs (prtAuxilliarySheetGroup, + prtInputSwitchingGroup, prtGeneralV2Group, prtAlertTableV2Group, + prtChannelV2Group). Added the nine new objects to them + (prtAuxiliarySheetStartupPage, prtAuxiliarySheetBannerPage, + prtGeneralPrinterName, prtGeneralSerialNumber, + prtAlertCriticalEvents, prtAlertAllEvents, + prtInputMediaLoadTimeout, prtInputNextIndex, + prtChannelInformation). Created one new NOTIFICATION-GROUP + (prtAlertTrapGroup) to contain printerV2Alert. Included the new + OBJECT-GROUPs and the NOTIFICATION_GROUP in prtMIBCompliance, all + in GROUP (not MANDATORY-GROUP) clauses. The nine new objects are + optional, i.e., this document is backward compatible with RFC + 1759. + + + +Bergman, et al. Standards Track [Page 27] + +RFC 3805 Printer MIB v2 June 2004 + + + - prtAlertTime is strongly recommended. + + - Deprecated the use of alert codes doorOpen(501) and + doorClosed(502), in favor of coverOpened(3) and coverClosed(4). + + - Added the PrtConsoleDisableTC and PrtMarkerAddressabilityUnitTC + textual conventions, and changed the PrtConsoleDisable and + PrtMarkerAddressabilityUnit objects' syntax to use those TCs, and + changed the PrtGeneralEntry and PrtMarkerColorantEntry SEQUENCEs + to reflect the new syntax. + + - Added textual conventions "PrtLocalizedDescriptionStringTC" and + "PrtConsoleDescriptionStringTC" and updated several objects to use + them. + + - Changed most enumerations to textual conventions and therefore + changed the SYNTAX of many objects from RFC 1759 to specify the + appropriate textual conventions. (28 TCs were added.) + + - Changed the TC names "MediaUnit" to "PrtMediaUnitTC", + "CapacityUnit" to "PrtCapacityUnitTC", and "SubUnitStatus" to + "PrtSubUnitStatusTC" + + - All objects with a MAX-ACCESS of read-write now have a MIN-ACCESS + of read-only. + + - Added 'IANA Considerations' and 'Internationalization + Considerations' as top level sections, per IETF guidelines. + + - Updated Security and Copyright sections. + + - Updated references and split into Normative and Informative + groups. + + - Added Appendix E - Overall Printer Status Table. + + - Updated participant and contact information. + + - Removed CodedCharSet Textual Convention, replaced with an import + of the IANACharset. + + - Removed all comment statements that indicated objects or groups + are mandatory or optional. Avoids any potential conflicts with + the conformance section. + + + + + + + +Bergman, et al. Standards Track [Page 28] + +RFC 3805 Printer MIB v2 June 2004 + + + - Added text to empty description clauses. (prtStorageRefTable, + prtDeviceRefTable, prtMarkerTable, prtMediaPathTable, + prtChannelTable, prtInterpreterTable, prtConsoleLightTable, and + prtAlertTable) + + - Added "DEFVAL { unknown }" to prtInterpreterDefaultCharSetIn and + prtInterpreterDefaultCharSetOut. + + - Changed "...values are expected to remain stable..." to "...values + SHOULD remain stable..." in the description clauses for the index + object in all tables. + + - Added ranges to all objects with a syntax of Integer32. + + - Revised the description clause for prtAlertGroupIndex. + + - Added additional text to the description clause for + prtMediaPathEntry, prtChannelEntry, prtInterpreterEntry, and + printerV2Alert. + + - Added text to section 2.4 to explain the usage of textual + conventions in this MIB and others. Also added a note defining + the common usage of the enumerations 'other(-1)' and 'unknown(-2)' + + - Changed range of prtStorageRefSeqNumber, prtDeviceRefSeqNumber, + and prtConsoleLightIndex from (0..65535) to (1..65535) since index + values cannot be zero. (Typo in RFC 1759) + + - The PWG Standard for Standardized Media Names is now recommended + for the objects prtInputMediaName, prtInputMediaColor, and + prtInputMediaType. + + - Added chSMTP(45) to prtChannelTypeTC. + +5. The IANA Printer MIB + +IANA-PRINTER-MIB DEFINITIONS ::= BEGIN + -- http://www.iana.org/assignments/ianaprinter-mib + +IMPORTS + MODULE-IDENTITY, + mib-2 + FROM SNMPv2-SMI -- [RFC2578] + TEXTUAL-CONVENTION + FROM SNMPv2-TC; -- [RFC2579] + +ianaPrinterMIB MODULE-IDENTITY + LAST-UPDATED "200406020000Z" -- June 2, 2004 + + + +Bergman, et al. Standards Track [Page 29] + +RFC 3805 Printer MIB v2 June 2004 + + + ORGANIZATION "IANA" + CONTACT-INFO "Internet Assigned Numbers Authority + Postal: ICANN + 4676 Admiralty Way, Suite 330 + Marina del Rey, CA 90292 + + Tel: +1 310 823 9358 + E-Mail: iana@iana.org" + + DESCRIPTION "This MIB module defines a set of printing-related + TEXTUAL-CONVENTIONs for use in Printer MIB (RFC 3805), + Finisher MIB (RFC 3806), and other MIBs which need to + specify printing mechanism details. + + Any additions or changes to the contents of this MIB + module require either publication of an RFC, or + Designated Expert Review as defined in RFC 2434, + Guidelines for Writing an IANA Considerations Section + in RFCs. The Designated Expert will be selected by + the IESG Area Director(s) of the Applications Area. + + Copyright (C) The Internet Society (2004). The + initial version of this MIB module was published + in RFC 3805. For full legal notices see the RFC + itself or see: + http://www.ietf.org/copyrights/ianamib.html" + + REVISION "200406020000Z" -- June 2, 2004 + DESCRIPTION "Original version, published in coordination + with Printer MIB (RFC 3805)." + ::= { mib-2 109 } + +-- +-- Generic TEXTUAL-CONVENTIONs +-- + +PrtCoverStatusTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtCoverStatus in RFC 1759. + STATUS current + DESCRIPTION + "Values for encoding the state of a particular cover or + access panel on the printer case or enclosure." + SYNTAX INTEGER { + other(1), + coverOpen(3), + coverClosed(4), + interlockOpen(5), + interlockClosed(6) + + + +Bergman, et al. Standards Track [Page 30] + +RFC 3805 Printer MIB v2 June 2004 + + + } + +-- +-- General Group TEXTUAL-CONVENTIONs +-- + +PrtGeneralResetTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtGeneralReset in RFC 1759. + STATUS current + DESCRIPTION + "Values for reading and writing the prtGeneralReset object. + + If a device does not have NVRAM, the device shall none the + less respond to a SET with the value resetToNVRAM(5) with a + sort of warm reset that resets the device to implementation- + defined state that is preferably under control of the system + administrator by some means outside the scope of the Printer + MIB specification." + + SYNTAX INTEGER { + notResetting(3), + powerCycleReset(4), -- Cold Start + resetToNVRAM(5), -- Warm Start + resetToFactoryDefaults(6) -- Reset contents of + -- NVRAM to factory + -- defaults + } +-- +-- Channel Group TEXTUAL-CONVENTIONs +-- + +PrtChannelTypeTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtChannelType in RFC 1759. + STATUS current + DESCRIPTION + "This enumeration indicates the type of channel that is + receiving jobs." + SYNTAX INTEGER { + other(1), + chSerialPort(3), + chParallelPort(4), + chIEEE1284Port(5), + chSCSIPort(6), + chAppleTalkPAP(7), + -- AppleTalk Printer + -- Access Protocol (PAP) + -- + -- prtChannelInformation entry: + + + +Bergman, et al. Standards Track [Page 31] + +RFC 3805 Printer MIB v2 June 2004 + + + -- + -- Printer Name + -- Keyword: Name + -- Syntax: Name + -- Status: Optional + -- Multiplicity: Single + -- Description: The name of the printer + -- within the AppleTalk naming scope + chLPDServer(8), + -- prtChannelInformation entry: + -- + -- Printer queue name + -- Keyword: Queue + -- Syntax: Name + -- Status: Mandatory + -- Multiplicity: Single + -- Description: queue name as + -- defined in [RFC1179]. + chNetwareRPrinter(9), + -- Novell, Inc. + -- For each entry of this type, the + -- prtChannelInformation must have a pair of + -- keywords. For Netware 3.x channels this must + -- be a (PServer, Printer) pair. For Netware + -- 4.x channels and for IntranetWare channels + -- this must be a (NDSTree, NDSPrinter) pair. + -- + -- prtChannelInformation entries: + + -- Print Server Name + -- Keyword: PServer + -- Syntax: Name + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The Pserver's SAP name + -- + -- Printer Number + -- Keyword: Printer + -- Syntax: Integer + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The printer number + -- + -- NDSTree + -- Keyword: NDSTree + -- Syntax: Name + -- Multiplicity: Single + -- Description: The tree's SAP name + + + +Bergman, et al. Standards Track [Page 32] + +RFC 3805 Printer MIB v2 June 2004 + + + -- + -- NDS Printer object + -- Keyword: NDSPrinter + -- Syntax: Text (Unicode) + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The fully qualified + -- name of the Printer + -- + -- In the Netware 3.x environment, the + -- client checks the Bindery object + -- representing the named PServer. The + -- client then checks for queues which + -- are associated with the numbered + -- printer. In the 4.x and IntraNetware + -- environment, the client looks up the + -- queues which are associated with the + -- NDS Printer Object in the named Tree. + -- Depending on client access rights to + -- those queues, the client submits jobs + -- to the appropriate queue. + chNetwarePServer(10), + -- Novell,Inc. + -- For each entry of this type, the + -- prtChannelInformation must have a pair + -- of keywords. For Netware 3.x channels + -- this must be a (Server, PServer) pair. + -- For Netware 4.x and IntranetWare + -- channels, this must be a + -- (NDSTree, NDSPServer) pair. + -- + -- prtChannelInformation entries: + -- + -- Server Name + -- Keyword: Server + -- Syntax: Name + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The SAP name of the + -- server for which the PServer is defined. + -- + -- PServer + -- Keyword: PServer + -- Syntax: Name + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The bindery name of + -- the PServer + + + +Bergman, et al. Standards Track [Page 33] + +RFC 3805 Printer MIB v2 June 2004 + + + -- + -- NDS Tree + -- Keyword: NDSTree + -- Syntax: Name + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The NDS Tree name + -- + -- PServer + -- Keyword: NDSPServer + -- Syntax: Text (Unicode) + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The fully qualified + -- name of the PServer object in the tree. + -- + -- In the 3.x environment, the client + -- checks the bindery object + -- representing the named PServer on the + -- named Server. In the 4.x and + -- IntranetWare environment, + -- the client checks the NDS object + -- representing the named PServer in the + -- named Tree. In either case, the + -- client then checks for all queues + -- associated with the Pserver object. + -- Depending on client access rights + -- to those queues, the client submits + -- jobs to the appropriate queue. + chPort9100(11), + -- DEPRECATED + -- (see chPortTCP - 37; chBidirPortTCP - 38) + chAppSocket(12), + -- A bi-directional, LPD-like, protocol using + -- 9101 for control and 9100 for data. + -- Adobe Systems, Inc. + chFTP(13), -- [RFC959] + chTFTP(14), -- [RFC1350] + chDLCLLCPort(15), + chIBM3270(16), -- IBM Coax + chIBM5250(17), -- IBM Twinax + chFax(18), + chIEEE1394(19), + chTransport1(20), + -- TCP port 35, for reserved TCP port list see + -- [RFC3232]. This RFC should also be + -- referenced for other channel + -- enumerations utilizing TCP port + + + +Bergman, et al. Standards Track [Page 34] + +RFC 3805 Printer MIB v2 June 2004 + + + -- numbers 0 through 1024. + chCPAP(21), -- TCP port 170 + -- Digital Equipment Corp. + chDCERemoteProcCall(22), -- OSF + -- DEPRECATED + chONCRemoteProcCall(23), -- SUN Microsystems + -- DEPRECATED + chOLE(24), -- Microsoft + -- DEPRECATED + chNamedPipe(25), + chPCPrint(26), -- Banyan + chServerMessageBlock(27), + -- File/Print sharing protocol used by + -- various network operating systems + -- from IBM 3Com, Microsoft and others + -- + -- prtChannelInformation entry: + -- + -- Service Name + -- Keyword: Name + -- Syntax: Name + -- Status: Optional + -- Multiplicity: Single + -- Description: The service name of + -- the printer + chDPMF(28), -- IBM Infoprint + chDLLAPI(29), -- Microsoft + -- DEPRECATED + chVxDAPI(30), -- Microsoft + -- DEPRECATED + chSystemObjectManager(31), -- IBM + chDECLAT(32), + -- Digital Equipment Corp. + -- + -- prtChannelInformation entries: + -- + -- Port Name + -- Keyword: Port + -- Syntax: Name + -- Status: Conditionally + -- Mandatory + -- (see note below) + -- Multiplicity: Single + -- Description: LAT port name + -- + -- Service Name + -- Keyword: Service + -- Syntax: Name + + + +Bergman, et al. Standards Track [Page 35] + +RFC 3805 Printer MIB v2 June 2004 + + + -- Status: Conditionally + -- Mandatory + -- Multiplicity: Single + -- Description: LAT service name + -- + -- The LAT channel may be + -- identified by either a port or + -- service, so either a + -- Port or Service entry must be + -- specified, but not both. + chNPAP(33), + chUSB(34), -- Not in RFC 1759 + -- Universal Serial Bus + chIRDA(35), -- Not in RFC 1759 + -- Infrared Data Assoc. Prot. + chPrintXChange(36), -- Not in RFC 1759 + -- PrintXChange Protocol + chPortTCP(37), -- Not in RFC 1759 + -- A unidirectional "raw" TCP + -- channel that uses an administratively + -- assigned TCP port address. + -- + -- prtChannelInformation entry: + -- + -- Port Number + -- Keyword: Port + -- Syntax: decimal number + -- Status: Mandatory + -- Multiplicity: Single + -- Description: TCP port number + chBidirPortTCP(38), -- Not in RFC 1759 + -- A bi-directional version of chPortTCP + -- + -- prtChannelInformation entries: + -- (See chPortTCP) + chUNPP(39), -- Not in RFC 1759 + -- Universal Network Printing + -- Protocol(UNPP). A bi-directional, + -- multiport network printing + -- application protocol available on + -- multiple transport protocols. + -- Underscore, Inc. + -- Contact: info@underscore.com + chAppleTalkADSP(40), -- Not in RFC 1759 + -- AppleTalk Data Stream Protocol. + -- ADSP is part of the AppleTalk + -- suite of protocols. + -- It is a symmetric, connection- + + + +Bergman, et al. Standards Track [Page 36] + +RFC 3805 Printer MIB v2 June 2004 + + + -- oriented protocol that makes + -- possible the establishment + -- and maintenance of full-duplex + -- streams of data bytes between + -- two sockets in an AppleTalk + -- internet. + -- See [APPLEMAC]. + chPortSPX(41), -- Not in RFC 1759 + -- Sequenced Packet Exchange (SPX) + -- socket. + -- Novell, Inc. Similar to TCP, a + -- bi-directional data pipe using + -- Novell SPX as a transport. + -- + -- prtChannelInformation entries: + -- + -- Network Number + -- Keyword: Net + -- Syntax: HexString + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The network number + -- + -- Node Number + -- Keyword: Node + -- Syntax: HexString + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The node number + -- + -- Socket Number + -- Keyword: Socket + -- Syntax: HexString + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The SPX socket number + -- + -- There must be exactly one "Net" and + -- one "Node" and one "Socket" entry. A + -- HexString is a binary value + -- represented as a string of + -- ASCII characters using hexadecimal + -- notation. + chPortHTTP(42), -- Not in RFC 1759 + -- Hypertext Transfer Protocol. See [RFC1945] + -- and [RFC2616]. + chNDPS(43), -- Not in RFC 1759 + -- Novell, Inc. + + + +Bergman, et al. Standards Track [Page 37] + +RFC 3805 Printer MIB v2 June 2004 + + + -- + -- prtChannelInformation entry: + -- + -- Printer Agent Name + -- Keyword: PA + -- Syntax: Name + -- Status: Mandatory + -- Multiplicity: Single + -- Description: The NDPS Printer + -- Agent Name + chIPP(44), -- Not in RFC 1759 + -- Internet Printing Protocol (IPP), + -- (IPP/1.1 - see [RFC2910] and [RFC2911]) + -- also applies to all future versions of IPP. + -- + -- IPP Printer URI + -- Keyword: URI + -- Syntax: URI (Unicode UTF-8 per + -- [RFC2396]) + -- Status: Mandatory + -- Multiplicity: Single + -- Default: not applicable + -- Description: URI of this IPP Printer + -- within Internet naming scope. Unicode + -- UTF-8 [RFC3629] string with + -- hexadecimal escapes for any non-ASCII + -- characters (per [RFC2396]). + -- Conformance: An IPP Printer shall list all + -- IPP URI it supports (one per IPP Channel + -- entry). If a URI contains the 'http:' + -- scheme it must have an explicit port. + -- See: [RFC3629], [RFC2396], [RFC2910], + -- [RFC2911]. + -- + -- IPP Printer Client Authentication + -- Keyword: Auth + -- Syntax: Keyword + -- Status: Optional + -- Multiplicity: Single + -- Default: 'none' + -- Description: A client authentication + -- mechanism supported for this IPP Printer + -- URI: + -- 'none' + -- no client authentication mechanism + -- 'requesting-user-name' + -- authenticated user in 'requesting- + -- user-name' + + + +Bergman, et al. Standards Track [Page 38] + +RFC 3805 Printer MIB v2 June 2004 + + + -- 'basic' + -- authenticated user via HTTP Basic + -- mechanism + -- 'digest' + -- authenticated user via HTTP Digest + -- mechanism + -- 'certificate' + -- authenticated user via certificate + -- mechanism + -- Conformance: An IPP Printer should list + -- all IPP client authentication mechanisms + -- it supports (one per IPP Channel entry). + -- See: [RFC2911] and [RFC2910]. + -- + -- IPP Printer Security + -- Keyword: Security + -- Syntax: Keyword + -- Status: Optional + -- Multiplicity: Single + -- Default: 'none' + -- Description: A security mechanism + -- supported for this IPP Printer URI: + -- 'none' + -- no security mechanism + -- 'ssl3' + -- SSL3 secure communications channel + -- protocol + -- 'tls' + -- TLS secure communications channel + -- protocol + -- Conformance: An IPP Printer should list + -- all IPP security mechanisms it supports + -- (one per IPP Channel entry). + -- See: [RFC2246], [RFC2911]. + -- + -- IPP Printer Protocol Version + -- Keyword: Version + -- Syntax: Keyword + -- Status: Optional + -- Multiplicity: Multiple + -- Default: '1.1' + -- Description: All of the IPP protocol + -- versions (major.minor) supported for + -- this IPP Printer URI: + -- '1.0' + -- IPP/1.0 conforming Printer + -- '1.1' + -- IPP/1.1 conforming Printer + + + +Bergman, et al. Standards Track [Page 39] + +RFC 3805 Printer MIB v2 June 2004 + + + -- Conformance: An IPP Printer should list + -- all IPP versions it supports (all listed + -- in each IPP Channel entry). An IPP + -- Client should select the highest + -- numbered version the IPP Client supports + -- for use in all IPP Requests (for optimum + -- interworking). + -- See: [RFC2911]. + chSMTP(45) + -- Print Job submission via Simple Mail + -- Transfer Protocol (SMTP) - see [RFC2821] + -- + -- prtChannelInformation entry: + -- + -- Keyword: Mailto + -- Syntax: Name + -- Status: Mandatory + -- Multiplicity: Single + -- Default: not applicable + -- Description: The SMTP URL of the printer. +} + +-- +-- Interpreter Group TEXTUAL-CONVENTIONs +-- + +PrtInterpreterLangFamilyTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtInterpreterLangFamily in RFC 1759. + STATUS current + DESCRIPTION + "This enumeration indicates the type of interpreter that is + receiving jobs." + SYNTAX INTEGER { + other(1), + unknown(2), -- Not in RFC 1759 + langPCL(3), -- PCL. Starting with PCL version 5, + -- HP-GL/2 is included as part of the + -- PCL language. + -- PCL and HP-GL/2 are registered + -- trademarks of Hewlett-Packard + -- Company. + langHPGL(4), -- Hewlett-Packard Graphics Language. + -- HP-GL is a registered trademark of + -- Hewlett-Packard Company. + langPJL(5), -- Peripheral Job Language. Appears in + -- the data stream between data intended + -- for a page description language. + -- Hewlett-Packard Co. + + + +Bergman, et al. Standards Track [Page 40] + +RFC 3805 Printer MIB v2 June 2004 + + + langPS(6), -- PostScript (tm) Language + -- Postscript - a trademark of Adobe + -- Systems Incorporated which may be + -- registered in certain jurisdictions + langIPDS(7), -- Intelligent Printer Data Stream + -- Bi-directional print data stream for + -- documents consisting of data objects + -- (text, image, graphics, bar codes), + -- resources (fonts, overlays) and page, + -- form and finishing instructions. + -- Facilitates system level device + -- control, document tracking and error + -- recovery throughout the print + -- process. + -- IBM Corporation. + langPPDS(8), -- IBM Personal Printer Data Stream. + -- Originally called IBM ASCII, the name + -- was changed to PPDS when the Laser + -- Printer was introduced in 1989. + -- Lexmark International, Inc. + langEscapeP(9), -- Epson Corp. + langEpson(10), + langDDIF(11), -- Digital Document Interchange Format + -- Digital Equipment Corp., Maynard MA + langInterpress(12), + -- Xerox Corp. + langISO6429(13), -- ISO 6429. Control functions for + -- Coded Character Sets (has ASCII + -- control characters, plus additional + -- controls for + -- character imaging devices.) + langLineData(14), -- line-data: Lines of data as + -- separate ASCII or EBCDIC records + -- and containing no control functions + -- (no CR, LF, HT, FF, etc.) + -- For use with traditional line + -- printers. May use CR and/or LF to + -- delimit lines, instead of records. + -- See ISO 10175 Document Printing + -- Application (DPA) [ISO10175]. + langMODCA(15), -- Mixed Object Document Content + -- Architecture + -- Definitions that allow the + -- composition, interchange, and + -- presentation of final form + -- documents as a collection of data + -- objects (text, image, graphics, bar + -- codes), resources (fonts, overlays) + + + +Bergman, et al. Standards Track [Page 41] + +RFC 3805 Printer MIB v2 June 2004 + + + -- and page, form and finishing + -- instructions. + -- IBM Corporation. + langREGIS(16), -- Remote Graphics Instruction Set, + -- Digital Equipment Corp., Maynard MA + langSCS(17), -- SNA Character String + -- Bi-directional print data stream for + -- SNA LU-1 mode of communication. + -- IBM + langSPDL(18), -- ISO 10180 Standard Page Description + -- Language + -- ISO Standard + langTEK4014(19), -- Tektronix Corp. + langPDS(20), + langIGP(21), -- Printronix Corp. + langCodeV(22), -- Magnum Code-V, Image and printer + -- control language used to control + -- impact/dot-matrix printers. + -- QMS, Inc., Mobile AL + langDSCDSE(23), -- DSC-DSE: Data Stream Compatible and + -- Emulation Bi-directional print data + -- stream for non-SNA (DSC) and SNA LU-3 + -- 3270 controller (DSE) communications + -- IBM + langWPS(24), -- Windows Printing System, Resource + -- based command/data stream used by + -- Microsoft At Work Peripherals. + -- Developed by the Microsoft + -- Corporation. + langLN03(25), -- Early DEC-PPL3, Digital Equipment + -- Corp. + langCCITT(26), + langQUIC(27), -- QUIC (Quality Information Code), Page + -- Description Language for laser + -- printers. Included graphics, printer + -- control capability and emulation of + -- other well-known printer. + -- QMS, Inc. + langCPAP(28), -- Common Printer Access Protocol + -- Digital Equipment Corp. + langDecPPL(29), -- Digital ANSI-Compliant Printing + -- Protocol + -- (DEC-PPL) + -- Digital Equipment Corp. + langSimpleText(30), + -- simple-text: character coded data, + -- including NUL, CR , LF, HT, and FF + -- control characters. See ISO 10175 + + + +Bergman, et al. Standards Track [Page 42] + +RFC 3805 Printer MIB v2 June 2004 + + + -- Document Printing Application (DPA) + -- [ISO10175]. + langNPAP(31), -- Network Printer Alliance Protocol + -- (NPAP). This protocol has been + -- superseded by the IEEE 1284.1 TIPSI + -- Std (ref. LangTIPSI(49)). + langDOC(32), -- Document Option Commands, Appears in + -- the data stream between data + -- intended for a page description. + -- QMS, Inc. + langimPress(33), -- imPRESS, Page description language + -- originally developed for the + -- ImageServer product line. A binary + -- language providing representations + -- of text, simple graphics, and some + -- large forms (simple + -- bit-map and CCITT group 3/4 + -- encoded).The + -- language was intended to be sent over + -- an 8-bit channel and supported early + -- document preparation languages (e.g., + -- TeX and TROFF). + -- QMS, Inc. + langPinwriter(34), + -- 24 wire dot matrix printer for + -- USA, Europe, and Asia except + -- Japan. + -- More widely used in Germany, and + -- some Asian countries than in US. + -- NEC + langNPDL(35), -- Page printer for Japanese market. + -- NEC + langNEC201PL(36), -- Serial printer language used in + -- the Japanese market. + -- NEC + langAutomatic(37), + -- Automatic PDL sensing. Automatic + -- sensing of the interpreter + -- language family by the printer + -- examining the document content. + -- Which actual interpreter language + -- families are sensed depends on + -- the printer implementation. + langPages(38), -- Page printer Advanced Graphic + -- Escape Set + -- IBM Japan + langLIPS(39), -- LBP Image Processing System + langTIFF(40), -- Tagged Image File Format (Aldus) + + + +Bergman, et al. Standards Track [Page 43] + +RFC 3805 Printer MIB v2 June 2004 + + + langDiagnostic(41), + -- A hex dump of the input to the + -- interpreter + langPSPrinter(42), + -- The PostScript Language used for + -- control (with any PDLs) + -- Adobe Systems Incorporated + langCaPSL(43), -- Canon Print Systems Language + langEXCL(44), -- Extended Command Language + -- Talaris Systems Inc. + langLCDS(45), -- Line Conditioned Data Stream + -- Xerox Corporation + langXES(46), -- Xerox Escape Sequences + -- Xerox Corporation + langPCLXL(47), -- Not in RFC 1759 + -- Printer Control Language. Extended + -- language features for printing, and + -- printer control. + -- Hewlett-Packard Co. + langART(48), -- Not in RFC 1759 + -- Advanced Rendering Tools (ART). + -- Page Description language + -- originally developed for the Laser + -- Press printers. + -- Technical reference manual: "ART IV + -- Reference Manual", No F33M. + -- Fuji Xerox Co., Ltd. + langTIPSI(49), -- Not in RFC 1759 + -- Transport Independent Printer + -- System Interface (ref. IEEE Std. + -- 1284.1) + langPrescribe(50), -- Not in RFC 1759 + -- Page description and printer + -- control language. It can be + -- described with ordinary ASCII + -- Technical reference manual: + -- "PRESCRIBE II Programming Manual" + langLinePrinter(51), -- Not in RFC 1759 + -- A simple-text character stream which + -- supports the control codes LF, VT, + -- FF, and plus Centronics or + -- Dataproducts Vertical Format Unit + -- (VFU) language is commonly used on + -- many older model line and matrix + -- printers. + langIDP(52), -- Not in RFC 1759 + -- Imaging Device Protocol + -- Apple Computer. + + + +Bergman, et al. Standards Track [Page 44] + +RFC 3805 Printer MIB v2 June 2004 + + + langXJCL(53), -- Not in RFC 1759 + -- Xerox Job Control Language (JCL). + -- A Job Control language originally + -- developed for the LaserPress printers + -- and is capable of switching PDLs. + -- Technical reference manual: + -- "ART IV Reference Manual", No F33M. + -- Fuji Xerox Co., Ltd. + langPDF(54), -- Not in RFC 1759 + -- Adobe Portable Document Format + -- Adobe Systems, Inc. + langRPDL(55), -- Not in RFC 1759 + -- Ricoh Page Description Language for + -- printers. + -- Technical manual "RPDL command + -- reference" No.307029 + -- RICOH, Co. LTD + langIntermecIPL(56), -- Not in RFC 1759 + -- Intermec Printer Language for label + -- printers. + -- Technical Manual: "IPL Programmers + -- Reference Manual" + -- Intermec Corporation + langUBIFingerprint(57), -- Not in RFC 1759 + -- An intelligent basic-like programming + -- language for label printers. + -- Reference Manual: "UBI Fingerprint + -- 7.1", No. 1-960434-00 + -- United Barcode Industries + langUBIDirectProtocol(58), -- Not in RFC 1759 + -- An intelligent control language for + -- label printers. + -- Programmers guide: " UBI Direct + -- Protocol", No. 1-960419-00 + -- United Barcode Industries + langFujitsu(59), -- Not in RFC 1759 + -- Fujitsu Printer Language + -- Reference Manual: + -- "FM Printer Sequence" No. 80HP-0770 + -- FUJITSU LIMITED + langCGM(60), -- Not in RFC 1759 + -- Computer Graphics Metafile + -- MIME type 'image/cgm' + langJPEG(61), -- Not in RFC 1759 + -- Joint Photographic Experts Group + -- MIME type 'image/jpeg' + langCALS1(62), -- Not in RFC 1759 + -- US DOD CALS1 (see MIL-STD-1840) + + + +Bergman, et al. Standards Track [Page 45] + +RFC 3805 Printer MIB v2 June 2004 + + + -- MIME type 'application/cals-1840' + langCALS2(63), -- Not in RFC 1759 + -- US DOD CALS2 (see MIL-STD-1840) + -- MIME type 'application/cals-1840' + langNIRS(64), -- Not in RFC 1759 + -- US DOD NIRS (see MIL-STD-1840) + -- MIME type 'application/cals-1840' + langC4(65) -- Not in RFC 1759 + -- US DOD C4 (see MIL-STD-1840) + -- MIME type 'application/cals-1840' +} + +-- +-- Input/Output Group TEXTUAL-CONVENTIONs +-- + +PrtInputTypeTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtInputType in RFC 1759. + STATUS current + DESCRIPTION + "The type of technology (discriminated primarily according to + feeder mechanism type) employed by a specific component or + components." + SYNTAX INTEGER { + other(1), + unknown(2), + sheetFeedAutoRemovableTray(3), + sheetFeedAutoNonRemovableTray(4), + sheetFeedManual(5), + continuousRoll(6), + continuousFanFold(7) + } + +PrtOutputTypeTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtOutputType in RFC 1759. + STATUS current + DESCRIPTION + "The Type of technology supported by this output subunit." + SYNTAX INTEGER { + other(1), + unknown(2), + removableBin(3), + unRemovableBin(4), + continuousRollDevice(5), + mailBox(6), + continuousFanFold(7) + } + + + + +Bergman, et al. Standards Track [Page 46] + +RFC 3805 Printer MIB v2 June 2004 + + +-- +-- Marker Group TEXTUAL-CONVENTIONs +-- + +PrtMarkerMarkTechTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtMarkerMarkTech in RFC 1759. + STATUS current + DESCRIPTION + "The type of marking technology used for this marking + subunit." + SYNTAX INTEGER { + other(1), + unknown(2), + electrophotographicLED(3), + electrophotographicLaser(4), + electrophotographicOther(5), + impactMovingHeadDotMatrix9pin(6), + impactMovingHeadDotMatrix24pin(7), + impactMovingHeadDotMatrixOther(8), + impactMovingHeadFullyFormed(9), + impactBand(10), + impactOther(11), + inkjetAqueous(12), + inkjetSolid(13), + inkjetOther(14), + pen(15), + thermalTransfer(16), + thermalSensitive(17), + thermalDiffusion(18), + thermalOther(19), + electroerosion(20), + electrostatic(21), + photographicMicrofiche(22), + photographicImagesetter(23), + photographicOther(24), + ionDeposition(25), + eBeam(26), + typesetter(27) + } + +PrtMarkerSuppliesTypeTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtMarkerSuppliesType in RFC 1759. + STATUS current + DESCRIPTION + "The type of this supply." + SYNTAX INTEGER { + other(1), + unknown(2), + + + +Bergman, et al. Standards Track [Page 47] + +RFC 3805 Printer MIB v2 June 2004 + + + -- Values for Printer MIB + toner(3), + wasteToner(4), + ink(5), + inkCartridge(6), + inkRibbon(7), + wasteInk(8), + opc(9), -- photo conductor + developer(10), + fuserOil(11), + solidWax(12), + ribbonWax(13), + wasteWax(14), + fuser(15), -- Not in RFC 1759 + coronaWire(16), -- Not in RFC 1759 + fuserOilWick(17), -- Not in RFC 1759 + cleanerUnit(18), -- Not in RFC 1759 + fuserCleaningPad(19), -- Not in RFC 1759 + transferUnit(20), -- Not in RFC 1759 + tonerCartridge(21), -- Not in RFC 1759 + fuserOiler(22), -- Not in RFC 1759 + -- End of values for Printer MIB + -- Values for Finisher MIB + water(23), -- Not in RFC 1759 + wasteWater(24), -- Not in RFC 1759 + glueWaterAdditive(25),-- Not in RFC 1759 + wastePaper(26), -- Not in RFC 1759 + bindingSupply(27), -- Not in RFC 1759 + bandingSupply(28), -- Not in RFC 1759 + stitchingWire(29), -- Not in RFC 1759 + shrinkWrap(30), -- Not in RFC 1759 + paperWrap(31), -- Not in RFC 1759 + staples(32), -- Not in RFC 1759 + inserts(33), -- Not in RFC 1759 + covers(34) -- Not in RFC 1759 + -- End of values for Finisher MIB + } + +-- +-- Media Path TEXTUAL-CONVENTIONs +-- + +PrtMediaPathTypeTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtMediaPathType in RFC 1759. + STATUS current + DESCRIPTION + "The type of the media path for this media path." + SYNTAX INTEGER { + + + +Bergman, et al. Standards Track [Page 48] + +RFC 3805 Printer MIB v2 June 2004 + + + other(1), + unknown(2), + longEdgeBindingDuplex(3), + shortEdgeBindingDuplex(4), + simplex(5) + } + +-- +-- Console Group TEXTUAL-CONVENTIONs +-- + +PrtConsoleColorTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtConsoleColor in RFC 1759. + STATUS current + DESCRIPTION + "The color of this light." + SYNTAX INTEGER { + other(1), + unknown(2), + white(3), + red(4), + green(5), + blue(6), + cyan(7), + magenta(8), + yellow(9), + orange(10) -- Not in RFC 1759 + } + +PrtConsoleDisableTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtConsoleDisable in RFC 1759. + STATUS current + DESCRIPTION + "This value indicates whether or not input is accepted from + the operator console. A value of 'enabled' indicates that + input is accepted from the console, and a value of 'disabled' + indicates that input is not accepted from the console. " + SYNTAX INTEGER { + enabled(3), + disabled(4) + } + +-- +-- Alert Group TEXTUAL-CONVENTIONs +-- + +PrtAlertTrainingLevelTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtAlertTrainingLevel in RFC 1759. + + + +Bergman, et al. Standards Track [Page 49] + +RFC 3805 Printer MIB v2 June 2004 + + + STATUS current + DESCRIPTION + "The level of training required to handle this alert, if + human intervention is required. The noInterventionRequired + value should be used if the event does not require any human + intervention. The training level is an enumeration that is + determined and assigned by the printer manufacturer based on + the information or training required to handle this alert. + The printer will break alerts into these different training + levels. It is the responsibility of a management application + in the system to determine how a particular alert is handled + and how and to whom that alert is routed. The following are + the four training levels of alerts: + + Field Service - Alerts that typically require advanced + training and technical knowledge of the printer and its + subunits. An example of a technical person would be a + manufacturer's Field Service representative, or other + person formally trained by the manufacturer or similar + representative. + Trained - Alerts that require an intermediate or moderate + knowledge of the printer and its subunits. A typical + example of such an alert is replacing a toner cartridge. + Untrained - Alerts that can be fixed without prior + training either because the action to correct the alert + is obvious or the printer can help the untrained person + fix the problem. A typical example of such an alert is + reloading paper trays or emptying output bins on a low + end printer. + Management - Alerts that have to do with overall operation + of and configuration of the printer. Examples of such + management events are configuration change of subunits." + SYNTAX INTEGER { + other(1), + unknown(2), + untrained(3), + trained(4), + fieldService(5), + management(6), + noInterventionRequired(7) -- Not in RFC 1759 + } + +PrtAlertGroupTC ::= TEXTUAL-CONVENTION + -- Values in the range 1 to 29 must not be IANA-assigned without + -- re-publishing Printer MIB. + -- Values of 30 and greater are for use in MIBs that augment + -- the Printer MIB, such as the Finisher MIB. + -- This TC extracted from prtAlertGroup in RFC 1759. + + + +Bergman, et al. Standards Track [Page 50] + +RFC 3805 Printer MIB v2 June 2004 + + + STATUS current + DESCRIPTION + "The type of subunit within the printer model that this alert + is related. Input, output, and markers are examples of + printer model groups, i.e., examples of types of subunits. + Wherever possible, the enumerations match the sub-identifier + that identifies the relevant table in the Printer MIB. + + NOTE: Alert type codes have been added for the Host Resources + MIB storage table and device table. These additional types + are for situations in which the printer's storage and device + objects must generate alerts (and possibly traps for critical + alerts)." + SYNTAX INTEGER { + other(1), + -- (2) is reserved for conformance information + -- Values for Host Resources MIB + hostResourcesMIBStorageTable(3), + hostResourcesMIBDeviceTable(4), + -- Values for Printer MIB + generalPrinter(5), + cover(6), + localization(7), + input(8), + output(9), + marker(10), + markerSupplies(11), + markerColorant(12), + mediaPath(13), + channel(14), + interpreter(15), + consoleDisplayBuffer(16), + consoleLights(17), + alert(18), -- Not in RFC 1759 + -- Values (5) to (29) reserved for Printer MIB + -- Values for Finisher MIB + finDevice(30), -- Not in RFC 1759 + finSupply(31), -- Not in RFC 1759 + finSupplyMediaInput(32), -- Not in RFC 1759 + finAttribute(33) -- Not in RFC 1759 + -- Values (30) to (39) reserved for Finisher MIB + } + +PrtAlertCodeTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtAlertCode in RFC 1759. + STATUS current + DESCRIPTION + "The code that describes the type of alert for this entry in + + + +Bergman, et al. Standards Track [Page 51] + +RFC 3805 Printer MIB v2 June 2004 + + + the table. Binary change event alerts describe states of the + subunit while unary change event alerts describe a single + event. The same alert code can be used for a binary change + event or a unary change event, depending on implementation. + Also, the same alert code can be used to indicate a critical + or non-critical (warning) alert, depending on implementation. + The value of prtAlertSeverityLevel specifies binary vs. unary + and critical vs. non-critical for each event for the + implementation. + + While there are some specific codes for many subunits, the + generic codes should be used for most subunit alerts. The + network management station can then query the subunit + specified by prtAlertGroup to determine further subunit + status and other subunit information. + + An agent shall not add two entries to the alert table for the + same event, one containing a generic event code and the other + containing a specific event code; the agent shall add only + one entry in the alert table for each event; either generic + (preferred) or specific, not both. + + Implementation of the unary change event + alertRemovalOfBinaryChangeEntry(1801) is optional. When + implemented, this alert code shall indicate to network + management stations that the trailing edge of a binary change + event has occurred and the corresponding alert entry has been + removed from the alert table. As with all events, the + alertRemovalOfBinaryChangeEntry(1801) alert shall be placed + at the end of the alert table. Such an alert table entry + shall specify the following information: + + prtAlertSeverityLevel warningUnaryChangeEvent(4) + prtAlertTrainingLevel noInterventionRequired(7) + prtAlertGroup alert(18) + prtAlertGroupIndex the index of the row in the + alert table of the binary + change event that this event + has removed. + prtAlertLocation unknown (-2) + prtAlertCode alertRemovalOfBinaryChangeEntry(1801) + prtAlertDescription + prtAlertTime the value of sysUpTime at + the time of the removal of the + binary change event from the + alert table. + + Optionally, the agent may generate a trap coincident with + + + +Bergman, et al. Standards Track [Page 52] + +RFC 3805 Printer MIB v2 June 2004 + + + removing the binary change event and placing the unary change + event alertRemovalOfBinaryChangeEntry(1801) in the alert + table. For such a trap, the prtAlertIndex sent with the above + trap parameters shall be the index of the + alertRemovalOfBinaryChangeEvent row that was added to the + prtAlertTable; not the index of the row that was removed from + the prtAlertTable." + SYNTAX INTEGER { + other(1), + -- an event that is not represented + -- by one of the alert codes + -- specified below. + unknown(2), + -- The following generic codes are common to + -- multiple groups. The NMS may examine the + -- prtAlertGroup object to determine what group + -- to query for further information. + coverOpen(3), + coverClosed(4), + interlockOpen(5), + interlockClosed(6), + configurationChange(7), + jam(8), + subunitMissing(9), -- Not in RFC 1759 + -- The subunit tray, bin, etc. + -- has been removed. + subunitLifeAlmostOver(10), -- Not in RFC 1759 + subunitLifeOver(11), -- Not in RFC 1759 + subunitAlmostEmpty(12), -- Not in RFC 1759 + subunitEmpty(13), -- Not in RFC 1759 + subunitAlmostFull(14), -- Not in RFC 1759 + subunitFull(15), -- Not in RFC 1759 + subunitNearLimit(16), -- Not in RFC 1759 + subunitAtLimit(17), -- Not in RFC 1759 + subunitOpened(18), -- Not in RFC 1759 + subunitClosed(19), -- Not in RFC 1759 + subunitTurnedOn(20), -- Not in RFC 1759 + subunitTurnedOff(21), -- Not in RFC 1759 + subunitOffline(22), -- Not in RFC 1759 + subunitPowerSaver(23), -- Not in RFC 1759 + subunitWarmingUp(24), -- Not in RFC 1759 + subunitAdded(25), -- Not in RFC 1759 + subunitRemoved(26), -- Not in RFC 1759 + subunitResourceAdded(27), -- Not in RFC 1759 + subunitResourceRemoved(28), -- Not in RFC 1759 + subunitRecoverableFailure(29), + -- Not in RFC 1759 + subunitUnrecoverableFailure(30), + + + +Bergman, et al. Standards Track [Page 53] + +RFC 3805 Printer MIB v2 June 2004 + + + -- Not in RFC 1759 + subunitRecoverableStorageError(31), + -- Not in RFC 1759 + subunitUnrecoverableStorageError(32), + -- Not in RFC 1759 + subunitMotorFailure(33), -- Not in RFC 1759 + subunitMemoryExhausted(34), -- Not in RFC 1759 + subunitUnderTemperature(35), -- Not in RFC 1759 + subunitOverTemperature(36), -- Not in RFC 1759 + subunitTimingFailure(37), -- Not in RFC 1759 + subunitThermistorFailure(38), -- Not in RFC 1759 + + -- General Printer group + doorOpen(501), -- DEPRECATED + -- Use coverOpened(3) + doorClosed(502), -- DEPRECATED + -- Use coverClosed(4) + powerUp(503), + powerDown(504), + printerNMSReset(505), -- Not in RFC 1759 + -- The printer has been reset by some + -- network management station(NMS) + -- writing into 'prtGeneralReset'. + printerManualReset(506), -- Not in RFC 1759 + -- The printer has been reset manually. + printerReadyToPrint(507), -- Not in RFC 1759 + -- The printer is ready to print. (i.e., + -- not warming up, not in power save + -- state, not adjusting print quality, + -- etc.). + + -- Input Group + inputMediaTrayMissing(801), + inputMediaSizeChange(802), + inputMediaWeightChange(803), + inputMediaTypeChange(804), + inputMediaColorChange(805), + inputMediaFormPartsChange(806), + inputMediaSupplyLow(807), + inputMediaSupplyEmpty(808), + inputMediaChangeRequest(809), -- Not in RFC 1759 + -- An interpreter has detected that a + -- different medium is need in this input + -- tray subunit. The prtAlertDescription may + -- be used to convey a human readable + -- description of the medium required to + -- satisfy the request. + inputManualInputRequest(810), -- Not in RFC 1759 + + + +Bergman, et al. Standards Track [Page 54] + +RFC 3805 Printer MIB v2 June 2004 + + + -- An interpreter has detected that manual + -- input is required in this subunit. The + -- prtAlertDescription may be used to convey + -- a human readable description of the medium + -- required to satisfy the request. + inputTrayPositionFailure(811), -- Not in RFC 1759 + -- The input tray failed to position correctly. + inputTrayElevationFailure(812), + -- Not in RFC 1759 + inputCannotFeedSizeSelected(813), + -- Not in RFC 1759 + -- Output Group + outputMediaTrayMissing(901), + outputMediaTrayAlmostFull(902), + outputMediaTrayFull(903), + outputMailboxSelectFailure(904), + -- Not in RFC 1759 + -- Marker group + markerFuserUnderTemperature(1001), + markerFuserOverTemperature(1002), + markerFuserTimingFailure(1003), + -- Not in RFC 1759 + markerFuserThermistorFailure(1004), + -- Not in RFC 1759 + markerAdjustingPrintQuality(1005), + -- Not in RFC 1759 + -- Marker Supplies group + markerTonerEmpty(1101), + markerInkEmpty(1102), + markerPrintRibbonEmpty(1103), + markerTonerAlmostEmpty(1104), + markerInkAlmostEmpty(1105), + markerPrintRibbonAlmostEmpty(1106), + markerWasteTonerReceptacleAlmostFull(1107), + markerWasteInkReceptacleAlmostFull(1108), + markerWasteTonerReceptacleFull(1109), + markerWasteInkReceptacleFull(1110), + markerOpcLifeAlmostOver(1111), + markerOpcLifeOver(1112), + markerDeveloperAlmostEmpty(1113), + markerDeveloperEmpty(1114), + markerTonerCartridgeMissing(1115), + -- Not in RFC 1759 + -- Media Path Device Group + mediaPathMediaTrayMissing(1301), + mediaPathMediaTrayAlmostFull(1302), + mediaPathMediaTrayFull(1303), + mediaPathCannotDuplexMediaSelected(1304), + + + +Bergman, et al. Standards Track [Page 55] + +RFC 3805 Printer MIB v2 June 2004 + + + -- Not in RFC 1759 + -- Interpreter Group + interpreterMemoryIncrease(1501), + interpreterMemoryDecrease(1502), + interpreterCartridgeAdded(1503), + interpreterCartridgeDeleted(1504), + interpreterResourceAdded(1505), + interpreterResourceDeleted(1506), + interpreterResourceUnavailable(1507), + interpreterComplexPageEncountered(1509), + -- Not in RFC 1759 + -- The interpreter has encountered a page + -- that is too complex for the resources that + -- are available. + -- Alert Group + alertRemovalOfBinaryChangeEntry(1801) + -- Not in RFC 1759 + -- A binary change event entry has been + -- removed from the alert table. This unary + -- change alert table entry is added to the + -- end of the alert table. + } +END + +6. The Printer MIB + +Printer-MIB DEFINITIONS ::= BEGIN + +IMPORTS + MODULE-IDENTITY, OBJECT-TYPE, Counter32, Integer32, TimeTicks, + NOTIFICATION-TYPE, OBJECT-IDENTITY, + mib-2 FROM SNMPv2-SMI -- [RFC2578] + TEXTUAL-CONVENTION FROM SNMPv2-TC -- [RFC2579] + MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP + FROM SNMPv2-CONF -- [RFC2580] + hrDeviceIndex, hrStorageIndex FROM HOST-RESOURCES-MIB -- [RFC2790] + InterfaceIndexOrZero FROM IF-MIB -- [RFC2863] + PrtCoverStatusTC, PrtGeneralResetTC, PrtChannelTypeTC, + PrtInterpreterLangFamilyTC, PrtInputTypeTC, PrtOutputTypeTC, + PrtMarkerMarkTechTC, PrtMarkerSuppliesTypeTC, PrtConsoleColorTC, + PrtConsoleDisableTC, PrtMediaPathTypeTC, PrtAlertGroupTC, + PrtAlertTrainingLevelTC, PrtAlertCodeTC + FROM IANA-PRINTER-MIB + IANACharset FROM IANA-CHARSET-MIB; + +printmib MODULE-IDENTITY + LAST-UPDATED "200406020000Z" + ORGANIZATION "PWG IEEE/ISTO Printer Working Group" + + + +Bergman, et al. Standards Track [Page 56] + +RFC 3805 Printer MIB v2 June 2004 + + + CONTACT-INFO + "Harry Lewis + IBM + Phone (303) 924-5337 + Email: harryl@us.ibm.com + http://www.pwg.org/index.html + + Send comments to the printmib WG using the Printer MIB + Project (PMP) Mailing List: pmp@pwg.org + + For further information, access the PWG web page under 'Printer + MIB': http://www.pwg.org/ + + Implementers of this specification are encouraged to join the + pmp mailing list in order to participate in discussions on any + clarifications needed and registration proposals being reviewed + in order to achieve consensus." + DESCRIPTION + "The MIB module for management of printers. + Copyright (C) The Internet Society (2004). This + version of this MIB module was published + in RFC 3805. For full legal notices see the RFC itself." + REVISION "200406020000Z" + DESCRIPTION + "Printer MIB v2. + Moved all enum groups to be maintained by IANA into new TCs + within the ianaPrinterMIB, which is contained in this + document. + New TCs created from enums defined within RFC 1759 Objects: + PrtPrintOrientationTC, PrtLocalizedDescriptionStringTC, + PrtConsoleDescriptionStringTC, PrtChannelStateTC, + PrtOutputStackingOrderTC, PrtOutputPageDeliveryOrientationTC, + PrtMarkerCounterUnitTC, PrtMarkerSuppliesSupplyUnitTC, + PrtMarkerSuppliesClassTC, PrtMarkerAddressabilityUnitTC, + PrtMarkerColorantRoleTC, PrtMediaPathMaxSpeedPrintUnitTC, + PrtInterpreterTwoWayTC, and PrtAlertSeverityLevelTC. + The following four TCs have been deprecated: + MediaUnit (replaced by PrtMediaUnitTC), + CapacityUnit (replaced by PrtCapacityUnitTC), + SubUnitStatus (replaced by PrtSubUnitStatusTC), + CodedCharSet (replaced by IANACharset in IANA Charset MIB) + Five new OBJECT-GROUPs: prtAuxilliarySheetGroup, + prtInputSwitchingGroup, prtGeneralV2Group, + prtAlertTableV2Group, prtChannelV2Group. + Nine new objects added to those groups: + prtAuxiliarySheetStartupPage, prtAuxiliarySheetBannerPage, + prtGeneralPrinterName, prtGeneralSerialNumber, + prtAlertCriticalEvents, prtAlertAllEvents, + + + +Bergman, et al. Standards Track [Page 57] + +RFC 3805 Printer MIB v2 June 2004 + + + prtInputMediaLoadTimeout, prtInputNextIndex, + prtChannelInformation. + SYNTAX range changed from (0..65535) to (1..65535) for the + index objects prtStorageRefSeqNumber, prtDeviceRefSeqNumber, + and prtConsoleLightIndex. + SYNTAX range changed from (0..65535) to (0..2147483647) for the + objects prtStorageRefIndex and prtDeviceRefIndex to agree + with the Host Resources MIB. + Defined a range for the objects with a SYNTAX of Integer32: + prtOutputDefaultIndex, prtInputMediaDimFeedDirDeclared, + prtInputMediaDimXFeedDirDeclared, prtInputMaxCapacity, + prtInputCurrentLevel, prtInputMediaDimFeedDirChosen, + prtInputMediaDimXFeedDirChosen, prtInputMediaWeight, + prtInputMediaFormParts, prtOutputIndex, + prtOutputMaxCapacity, prtOutputRemainingCapacity, + prtOutputMaxDimFeedDir, prtOutputMaxDimXFeedDir, + prtOutputMinDimFeedDir, prtOutputMinDimXFeedDir, + prtMarkerAddressibilityFeedDir, + prtMarkerAddressibilityXFeedDir, prtMarkerNorthMargin, + prtMarkerSouthMargin, prtMarkerWestMargin, + prtMarkerEastMargin, prtMarkerSuppliesMaxCapacity, + prtMarkerSuppliesLevel, prtMarkerColorantTonality, + prtMediaPathMaxSpeed, prtMediaPathMaxMediaFeedDir, + prtMediaPathMaxMediaXFeedDir, prtMediaPathMinMediaFeedDir, + prtMediaPathMinMediaXFeedDir, prtChannelIndex, + prtChannelCurrentJobCntlLangIndex, prtInterpreterIndex, + prtChannelDefaultPageDescLangIndex, prtConsoleOnTime, + prtInterpreterFeedAddressibility, prtConsoleOffTime, + prtInterpreterXFeedAddressibility, prtAlertIndex, + prtAlertGroupIndex, prtAlertLocation. + Changed SYNTAX from Integer32 to InterfaceIndexOrZero for + prtChannelIfIndex. + Changed MAX-ACCESS of prtAlertIndex from not-accessible to + Read-only and added a compliance statement to allow a + MIN-ACCESS of accessible-for-notify. + One new NOTIFICATION-GROUP: prtAlertTrapGroup which contains + printerV2Alert. + In MODULE-COMPLIANCE prtMIBCompliance, new OBJECT-GROUPs and + the NOTIFICATION_GROUP, all in GROUP (not MANDATORY-GROUP) + clauses. The nine new objects are optional, i.e., this + document is backward compatible with RFC 1759." + REVISION "199411250000Z" + DESCRIPTION + "The original version of this MIB, published as RFC1759." + ::= { mib-2 43 } + + + + + + +Bergman, et al. Standards Track [Page 58] + +RFC 3805 Printer MIB v2 June 2004 + + +-- TEXTUAL-CONVENTIONs for this MIB module +-- +-- Generic unspecific TEXTUAL-CONVENTIONs +-- + +PrtMediaUnitTC ::= TEXTUAL-CONVENTION + -- Replaces MediaUnit in RFC 1759. + STATUS current + DESCRIPTION + "Units of measure for media dimensions." + SYNTAX INTEGER { + tenThousandthsOfInches(3), -- .0001 + micrometers(4) + } + +MediaUnit ::= TEXTUAL-CONVENTION + -- Replaced by PrtMediaUnitTC. + STATUS deprecated + DESCRIPTION + "Units of measure for media dimensions." + SYNTAX INTEGER { + tenThousandthsOfInches(3), -- .0001 + micrometers(4) + } + +PrtCapacityUnitTC ::= TEXTUAL-CONVENTION + -- Replaces CapacityUnit in RFC 1759. + STATUS current + DESCRIPTION + "Units of measure for media capacity." + SYNTAX INTEGER { + other(1), -- New, not in RFC 1759 + unknown(2), -- New, not in RFC 1759 + tenThousandthsOfInches(3), -- .0001 + micrometers(4), + sheets(8), + feet(16), + meters(17), + -- Values for Finisher MIB + items(18), -- New, not in RFC 1759 + percent(19) -- New, not in RFC 1759 + } + +CapacityUnit ::= TEXTUAL-CONVENTION + -- Replaced by PrtCapacityUnitTC. + STATUS deprecated + DESCRIPTION + "Units of measure for media capacity." + + + +Bergman, et al. Standards Track [Page 59] + +RFC 3805 Printer MIB v2 June 2004 + + + SYNTAX INTEGER { + tenThousandthsOfInches(3), -- .0001 + micrometers(4), + sheets(8), + feet(16), + meters(17) + } + +PrtPrintOrientationTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtInterpreterDefaultOrientation in + -- RFC 1759. + STATUS current + DESCRIPTION + "A generic representation for printing orientation on a + 'page'." + SYNTAX INTEGER { + other(1), + portrait(3), + landscape(4) + } + +PrtSubUnitStatusTC ::= TEXTUAL-CONVENTION + -- Replaces SubUnitStatus in RFC 1759. + STATUS current + DESCRIPTION + "Status of a printer sub-unit. + + The SubUnitStatus is an integer that is the sum of 5 distinct + values, Availability, Non-Critical, Critical, On-line, and + Transitioning. These values are: + + Availability Value + + Available and Idle 0 0000'b + Available and Standby 2 0010'b + Available and Active 4 0100'b + Available and Busy 6 0110'b + Unavailable and OnRequest 1 0001'b + Unavailable because Broken 3 0011'b + Unknown 5 0101'b + + Non-Critical + No Non-Critical Alerts 0 0000'b + Non-Critical Alerts 8 1000'b + + Critical + + No Critical Alerts 0 0000'b + + + +Bergman, et al. Standards Track [Page 60] + +RFC 3805 Printer MIB v2 June 2004 + + + Critical Alerts 16 1 0000'b + + On-Line + + State is On-Line 0 0000'b + State is Off-Line 32 10 0000'b + + Transitioning + + At intended state 0 0000'b + Transitioning to intended state 64 100 0000'b" + + SYNTAX INTEGER (0..126) + +SubUnitStatus ::= TEXTUAL-CONVENTION + -- Replaced by PrtSubUnitStatusTC. + STATUS deprecated + DESCRIPTION + "Status of a printer sub-unit. + + The SubUnitStatus is an integer that is the sum of 5 distinct + values, Availability, Non-Critical, Critical, On-line, and + Transitioning. These values are: + + Availability Value + Available and Idle 0 0000'b + Available and Standby 2 0010'b + Available and Active 4 0100'b + Available and Busy 6 0110'b + Unavailable and OnRequest 1 0001'b + Unavailable because Broken 3 0011'b + Unknown 5 0101'b + + Non-Critical + No Non-Critical Alerts 0 0000'b + Non-Critical Alerts 8 1000'b + + Critical + + No Critical Alerts 0 0000'b + Critical Alerts 16 1 0000'b + + On-Line + + State is On-Line 0 0000'b + State is Off-Line 32 10 0000'b + + Transitioning + + + +Bergman, et al. Standards Track [Page 61] + +RFC 3805 Printer MIB v2 June 2004 + + + At intended state 0 0000'b + Transitioning to intended state 64 100 0000'b" + + SYNTAX INTEGER (0..126) + +PresentOnOff ::= TEXTUAL-CONVENTION + STATUS current + DESCRIPTION + "Presence and configuration of a device or feature." + SYNTAX INTEGER { + other(1), + on(3), + off(4), + notPresent(5) + } + +PrtLocalizedDescriptionStringTC ::= TEXTUAL-CONVENTION + -- This TC did not appear in RFC 1759. + STATUS current + DESCRIPTION + "An object MUST use this TEXTUAL-CONVENTION when its + 'charset' is controlled by the value of + prtGeneralCurrentLocalization." + SYNTAX OCTET STRING (SIZE(0..255)) + +PrtConsoleDescriptionStringTC ::= TEXTUAL-CONVENTION + -- This TC did not appear in RFC 1759. + STATUS current + DESCRIPTION + "An object MUST use this TEXTUAL-CONVENTION when its + 'charset' is controlled by the value of + prtConsoleLocalization." + SYNTAX OCTET STRING (SIZE(0..255)) + +CodedCharSet ::= TEXTUAL-CONVENTION + + -- Replaced by IANACharset TEXTUAL-CONVENTION in IANA Charset MIB. + STATUS deprecated + DESCRIPTION + "The original description clause from RFC 1759 [RFC1759] was + technically inaccurate and therefore has been deleted." + SYNTAX INTEGER { + other(1) -- used if the designated coded + -- character set is not currently in + -- the enumeration +} + +-- + + + +Bergman, et al. Standards Track [Page 62] + +RFC 3805 Printer MIB v2 June 2004 + + +-- Channel Group TEXTUAL-CONVENTIONs +-- + +PrtChannelStateTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtChannelState in RFC 1759. + STATUS current + DESCRIPTION + "The state of this print job delivery channel. The value + determines whether print data is allowed through this channel." + SYNTAX INTEGER { + other(1), + printDataAccepted(3), + noDataAccepted(4) + } + +-- +-- Input/Output Group TEXTUAL-CONVENTIONs +-- + +PrtOutputStackingOrderTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtOutputStackingOrder in RFC 1759. + STATUS current + DESCRIPTION + "The current state of the stacking order for the associated + output sub-unit. 'firstToLast' means that as pages are output, + the front of the next page is placed against the back of the + previous page. 'lastToFirst' means that as pages are output, + the back of the next page is placed against the front of the + previous page." + SYNTAX INTEGER { + unknown(2), + firstToLast(3), + lastToFirst(4) + } + +PrtOutputPageDeliveryOrientationTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtOutputPageDeliveryOrientation + -- in RFC 1759. + STATUS current + DESCRIPTION + "The reading surface that will be 'up' when pages are delivered + to the associated output sub-unit. Values are Face-Up and Face + Down (Note: interpretation of these values is, in general, + context-dependent based on locale; presentation of these values + to an end-user should be normalized to the expectations of the + user." + SYNTAX INTEGER { + faceUp(3), + + + +Bergman, et al. Standards Track [Page 63] + +RFC 3805 Printer MIB v2 June 2004 + + + faceDown(4) + } + +-- +-- Marker Group TEXTUAL-CONVENTIONs +-- + +PrtMarkerCounterUnitTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtMarkerCounterUnit in RFC 1759. + STATUS current + DESCRIPTION + "The unit that will be used by the printer when reporting + counter values for this marking sub-unit. The + time units of measure are provided for a device like a + strip recorder that does not or cannot track the physical + dimensions of the media and does not use characters, + lines or sheets." + + SYNTAX INTEGER { + tenThousandthsOfInches(3), -- .0001 + micrometers(4), + characters(5), + lines(6), + impressions(7), + sheets(8), + dotRow(9), + hours(11), + feet(16), + meters(17) + } + +PrtMarkerSuppliesSupplyUnitTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtMarkerSuppliesSupplyUnit + -- in RFC 1759. + STATUS current + DESCRIPTION + "Unit of this marker supply container/receptacle." + SYNTAX INTEGER { + other(1), -- New, not in RFC 1759 + unknown(2), -- New, not in RFC 1759 + tenThousandthsOfInches(3), -- .0001 + micrometers(4), + impressions(7), -- New, not in RFC 1759 + sheets(8), -- New, not in RFC 1759 + hours(11), -- New, not in RFC 1759 + thousandthsOfOunces(12), + tenthsOfGrams(13), + hundrethsOfFluidOunces(14), + + + +Bergman, et al. Standards Track [Page 64] + +RFC 3805 Printer MIB v2 June 2004 + + + tenthsOfMilliliters(15), + feet(16), -- New, not in RFC 1759 + meters(17), -- New, not in RFC 1759 + -- Values for Finisher MIB + items(18), -- e.g., #staples. New, not in RFC 1759 + percent(19) -- New, not in RFC 1759 + } + +PrtMarkerSuppliesClassTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtMarkerSuppliesClass in RFC 1759. + STATUS current + DESCRIPTION + "Indicates whether this supply entity represents a supply + that is consumed or a receptacle that is filled." + SYNTAX INTEGER { + other(1), + supplyThatIsConsumed(3), + receptacleThatIsFilled(4) + } + +PrtMarkerColorantRoleTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtMarkerColorantRole in RFC 1759. + STATUS current + DESCRIPTION + "The role played by this colorant." + SYNTAX INTEGER { -- Colorant Role + other(1), + process(3), + spot(4) + } + +PrtMarkerAddressabilityUnitTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtMarkerAddressabilityUnit + -- in RFC 1759. + STATUS current + DESCRIPTION + "The unit of measure of distances, as applied to the marker's + resolution." + SYNTAX INTEGER { + tenThousandthsOfInches(3), -- .0001 + micrometers(4) + } + +-- +-- Media Path TEXTUAL-CONVENTIONs +-- + +PrtMediaPathMaxSpeedPrintUnitTC ::= TEXTUAL-CONVENTION + + + +Bergman, et al. Standards Track [Page 65] + +RFC 3805 Printer MIB v2 June 2004 + + + -- This TC was extracted from prtMediaPathMaxSpeedPrintUnit + -- in RFC 1759. + STATUS current + DESCRIPTION + "The unit of measure used in specifying the speed of all + media paths in the printer." + SYNTAX INTEGER { + tenThousandthsOfInchesPerHour(3),-- .0001/hour + micrometersPerHour(4), + charactersPerHour(5), + linesPerHour(6), + impressionsPerHour(7), + sheetsPerHour(8), + dotRowPerHour(9), + feetPerHour(16), + metersPerHour(17) + } + +-- +-- Interpreter Group TEXTUAL-CONVENTIONs +-- + +PrtInterpreterTwoWayTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtInterpreterTwoWay in RFC 1759. + STATUS current + DESCRIPTION + "Indicates whether or not this interpreter returns information + back to the host." + SYNTAX INTEGER { + yes(3), + no(4) + } + +-- +-- Alert Group TEXTUAL-CONVENTIONs +-- + +PrtAlertSeverityLevelTC ::= TEXTUAL-CONVENTION + -- This TC was extracted from prtAlertSeverityLevel in RFC 1759. + STATUS current + DESCRIPTION + "The level of severity of this alert table entry. The printer + determines the severity level assigned to each entry in the + table. A critical alert is binary by nature and definition. A + warning is defined to be a non-critical alert. The original and + most common warning is unary. The binary warning was added later + and given a more distinguished name." + SYNTAX INTEGER { + + + +Bergman, et al. Standards Track [Page 66] + +RFC 3805 Printer MIB v2 June 2004 + + + other(1), + critical(3), + warning(4), + warningBinaryChangeEvent(5) -- New, not in RFC 1759 + } + +-- The General Printer Group +-- +-- The general printer sub-unit is responsible for the overall +-- control and status of the printer. There is exactly one +-- general printer sub-unit in a printer. + +prtGeneral OBJECT IDENTIFIER ::= { printmib 5 } + +prtGeneralTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtGeneralEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A table of general information per printer. + Objects in this table are defined in various + places in the MIB, nearby the groups to + which they apply. They are all defined + here to minimize the number of tables that would + otherwise need to exist." + ::= { prtGeneral 1 } + +prtGeneralEntry OBJECT-TYPE + SYNTAX PrtGeneralEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "An entry exists in this table for each device entry in the + host resources MIB device table with a device type of + 'printer'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex } + ::= { prtGeneralTable 1 } + +PrtGeneralEntry ::= SEQUENCE { + -- Note that not all of the objects in this sequence are in + -- the general printer group. The group to which an + -- object belongs is tagged with a label "General", "Input" + -- "Output", etc. after each entry in the following sequence. + -- + prtGeneralConfigChanges Counter32, -- General + + + +Bergman, et al. Standards Track [Page 67] + +RFC 3805 Printer MIB v2 June 2004 + + + prtGeneralCurrentLocalization Integer32, -- General + prtGeneralReset PrtGeneralResetTC, + -- General + prtGeneralCurrentOperator OCTET STRING, + -- Responsible Party + prtGeneralServicePerson OCTET STRING, + -- Responsible Party + prtInputDefaultIndex Integer32, -- Input + prtOutputDefaultIndex Integer32, -- Output + prtMarkerDefaultIndex Integer32, -- Marker + prtMediaPathDefaultIndex Integer32, -- Media Path + prtConsoleLocalization Integer32, -- Console + prtConsoleNumberOfDisplayLines Integer32, -- Console + prtConsoleNumberOfDisplayChars Integer32, -- Console + prtConsoleDisable PrtConsoleDisableTC, + -- Console, + prtAuxiliarySheetStartupPage PresentOnOff, + -- AuxiliarySheet + prtAuxiliarySheetBannerPage PresentOnOff, + -- AuxiliarySheet + prtGeneralPrinterName OCTET STRING, + -- General V2 + prtGeneralSerialNumber OCTET STRING, + -- General V2 + prtAlertCriticalEvents Counter32, -- Alert V2 + prtAlertAllEvents Counter32 -- Alert V2 + } + +prtGeneralConfigChanges OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Counts configuration changes within the printer. A + configuration change is defined to be an action that results in + a change to any MIB object other than those that reflect status + or level, or those that act as counters or gauges. In addition, + any action that results in a row being added or deleted from + any table in the Printer MIB is considered a configuration + change. Such changes will often affect the capability of the + printer to service certain types of print jobs. Management + applications may cache infrequently changed configuration + information about sub units within the printer. This object + should be incremented whenever the agent wishes to notify + management applications that any cached configuration + information for this device is to be considered 'stale'. At + this point, the management application should flush any + configuration information cached about this device and fetch + + + +Bergman, et al. Standards Track [Page 68] + +RFC 3805 Printer MIB v2 June 2004 + + + new configuration information. + + The following are examples of actions that would cause the + prtGeneralConfigChanges object to be incremented: + + - Adding an output bin + - Changing the media in a sensing input tray + - Changing the value of prtInputMediaType + + Note that the prtGeneralConfigChanges counter would not be + incremented when an input tray is temporarily removed to load + additional paper or when the level of an input device changes. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + + ::= { prtGeneralEntry 1 } + +prtGeneralCurrentLocalization OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The value of the prtLocalizationIndex corresponding to the + current language, country, and character set to be used for + localized string values that are identified as being dependent + on the value of this object. Note that this object does not + apply to localized strings in the prtConsole group or to any + object that is not explicitly identified as being localized + according to prtGeneralCurrentLocalization. When an object's + 'charset' is controlled by the value of + prtGeneralCurrentLocalization, it MUST specify + PrtLocalizedDescriptionStringTC as its syntax. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtGeneralEntry 2 } + +prtGeneralReset OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly defined + -- by this object. + SYNTAX PrtGeneralResetTC + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Setting this value to 'powerCycleReset', 'resetToNVRAM', or + 'resetToFactoryDefaults' will result in the resetting of the + printer. When read, this object will always have the value + + + +Bergman, et al. Standards Track [Page 69] + +RFC 3805 Printer MIB v2 June 2004 + + + 'notResetting(3)', and a SET of the value 'notResetting' shall + have no effect on the printer. Some of the defined values are + optional. However, every implementation must support at least + the values 'notResetting' and 'resetToNVRAM'." + ::= { prtGeneralEntry 3 } + +-- The Responsible Party group + +prtGeneralCurrentOperator OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..127)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The name of the person who is responsible for operating + this printer. It is suggested that this string include + information that would enable other humans to reach the + operator, such as a phone number. As a convention to + facilitate automatic notification of the operator by the + agent or network management station, the phone number, + fax number or email address should be indicated by the + URL schemes 'tel:', 'fax:' and 'mailto:', respectively. + If either the phone, fax, or email information is not + available, then a line should not be included for this + information. + + NOTE: For interoperability purposes, it is advisable to + use email addresses formatted according to [RFC2822] + requirements. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtGeneralEntry 4 } + +prtGeneralServicePerson OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..127)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The name of the person responsible for servicing this + printer. It is suggested that this string include + information that would enable other humans to reach the + service person, such as a phone number. As a convention + to facilitate automatic notification of the operator by + the agent or network management station, the phone + number, fax number or email address should be indicated + by the URL schemes 'tel:', 'fax:' and 'mailto:', + respectively. If either the phone, fax, or email + information is not available, then a line should not + + + +Bergman, et al. Standards Track [Page 70] + +RFC 3805 Printer MIB v2 June 2004 + + + be included for this information. + + NOTE: For interoperability purposes, it is advisable to use + email addresses formatted per [RFC2822] requirements. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + + ::= { prtGeneralEntry 5 } + +-- Default indexes section +-- +-- The following four objects are used to specify the indexes of +-- certain subunits used as defaults during the printing process. + +prtInputDefaultIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The value of prtInputIndex corresponding to the default input + sub-unit: that is, this object selects the default source of + input media." +::= { prtGeneralEntry 6 } + +prtOutputDefaultIndex OBJECT-TYPE + -- A range has been added to the SYNTAX clause that was not in + -- RFC 1759. Although this violates SNMP compatibility rules, + -- it provides a more reasonable guide for SNMP managers. + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The value of prtOutputIndex corresponding to the default + output sub-unit; that is, this object selects the default + output destination." +::= { prtGeneralEntry 7 } + +prtMarkerDefaultIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The value of prtMarkerIndex corresponding to the + default marker sub-unit; that is, this object selects the + default marker." + ::= { prtGeneralEntry 8 } + + + + +Bergman, et al. Standards Track [Page 71] + +RFC 3805 Printer MIB v2 June 2004 + + +prtMediaPathDefaultIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The value of prtMediaPathIndex corresponding to + the default media path; that is, the selection of the + default media path." + ::= { prtGeneralEntry 9 } + +-- Console general section +-- +-- The following four objects describe overall parameters of the +-- printer console subsystem. + +prtConsoleLocalization OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The value of the prtLocalizationIndex corresponding to + the language, country, and character set to be used for the + console. This localization applies both to the actual display + on the console as well as the encoding of these console objects + in management operations. When an object's 'charset' is + controlled by the value of prtConsoleLocalization, it MUST + specify PrtConsoleDescriptionStringTC as its syntax. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtGeneralEntry 10 } + +prtConsoleNumberOfDisplayLines OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of lines on the printer's physical + display. This value is 0 if there are no lines on the + physical display or if there is no physical display" + ::= { prtGeneralEntry 11 } + +prtConsoleNumberOfDisplayChars OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of characters per line displayed on the physical + + + +Bergman, et al. Standards Track [Page 72] + +RFC 3805 Printer MIB v2 June 2004 + + + display. This value is 0 if there are no lines on the physical + display or if there is no physical display" + ::= { prtGeneralEntry 12 } + +prtConsoleDisable OBJECT-TYPE + -- In RFC 1759, the enumeration values were implicitly defined + -- by this object. + SYNTAX PrtConsoleDisableTC + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This value indicates how input is (or is not) accepted from + the operator console. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtGeneralEntry 13 } + +-- The Auxiliary Sheet Group +-- +-- The auxiliary sheet group allows the administrator to control +-- the production of auxiliary sheets by the printer. This group +-- contains only the "prtAuxiliarySheetStartupPage" and +-- "prtAuxiliarySheetBannerPage" objects. + +prtAuxiliarySheetStartupPage OBJECT-TYPE + SYNTAX PresentOnOff + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Used to enable or disable printing a startup page. If enabled, + a startup page will be printed shortly after power-up, when the + device is ready. Typical startup pages include test patterns + and/or printer configuration information." + ::= { prtGeneralEntry 14 } + +prtAuxiliarySheetBannerPage OBJECT-TYPE + SYNTAX PresentOnOff + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Used to enable or disable printing banner pages at the + beginning of jobs. This is a master switch which applies to all + jobs, regardless of interpreter." + ::= { prtGeneralEntry 15 } + + + + + + +Bergman, et al. Standards Track [Page 73] + +RFC 3805 Printer MIB v2 June 2004 + + +-- Administrative section (The General V2 Group) +-- +-- The following two objects are used to specify administrative +-- information assigned to the printer. + +prtGeneralPrinterName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (0..127)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "An administrator-specified name for this printer. Depending + upon implementation of this printer, the value of this object + may or may not be same as the value for the MIB-II 'SysName' + object." + ::= { prtGeneralEntry 16 } + +prtGeneralSerialNumber OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (0..255)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "A recorded serial number for this device that indexes some + type device catalog or inventory. This value is usually set by + the device manufacturer but the MIB supports the option of + writing for this object for site-specific administration of + device inventory or tracking." + ::= { prtGeneralEntry 17 } + +-- General alert table section (Alert Table V2 Group) +-- +-- The following two objects are used to specify counters +-- associated with the Alert Table. + +prtAlertCriticalEvents OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A running counter of the number of critical alert events that + have been recorded in the alert table. The value of this object + is RESET in the event of a power cycle operation (i.e., the + value is not persistent." + ::= { prtGeneralEntry 18 } + +prtAlertAllEvents OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + + + +Bergman, et al. Standards Track [Page 74] + +RFC 3805 Printer MIB v2 June 2004 + + + DESCRIPTION + "A running counter of the total number of alert event entries + (critical and non-critical) that have been recorded in the + alert table" + ::= { prtGeneralEntry 19 } + +-- The Cover Table +-- +-- The cover portion of the General print sub-unit describes the +-- covers and interlocks of the printer. The Cover Table has an +-- entry for each cover and interlock. + +prtCover OBJECT IDENTIFIER ::= { printmib 6 } + +prtCoverTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtCoverEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A table of the covers and interlocks of the printer." + ::= { prtCover 1 } + +prtCoverEntry OBJECT-TYPE + SYNTAX PrtCoverEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Information about a cover or interlock. + Entries may exist in the table for each device + index with a device type of 'printer'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtCoverIndex } + ::= { prtCoverTable 1 } + +PrtCoverEntry ::= SEQUENCE { + prtCoverIndex Integer32, + prtCoverDescription PrtLocalizedDescriptionStringTC, + prtCoverStatus PrtCoverStatusTC + } + +prtCoverIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value used by the printer to identify this Cover sub + + + +Bergman, et al. Standards Track [Page 75] + +RFC 3805 Printer MIB v2 June 2004 + + + unit. Although these values may change due to a major + reconfiguration of the device (e.g., the addition of new cover + sub-units to the printer), values SHOULD remain stable across + successive printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtCoverEntry 1 } + +prtCoverDescription OBJECT-TYPE + -- In RFC 1759, the SYNTAX was OCTET STRING. This has been changed + -- to a TC to better support localization of the object. + SYNTAX PrtLocalizedDescriptionStringTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The manufacturer provided cover sub-mechanism name in the + localization specified by prtGeneralCurrentLocalization." + ::= { prtCoverEntry 2 } + +prtCoverStatus OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly defined + -- by this object and are now defined in the IANA-PRINTER-MIB. The + -- new TC has defined "coverOpen" and "coverClosed" to replace + -- "doorOpen" and "doorClosed" in RFC 1759. A name change is not + -- formally allowed per SMI rules, but was agreed to by the WG group + -- since a door has a more restrictive meaning than a cover and + -- Cover group is intended to support doors as a subset of covers. + + SYNTAX PrtCoverStatusTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The status of this cover sub-unit." + ::= { prtCoverEntry 3 } + +-- The Localization Table +-- +-- The localization portion of the General printer sub-unit is +-- responsible for identifying the natural language, country, and +-- character set in which character strings are expressed. There +-- may be one or more localizations supported per printer. The +-- available localizations are represented by the Localization +-- table. + +prtLocalization OBJECT IDENTIFIER ::= { printmib 7 } + +prtLocalizationTable OBJECT-TYPE + + + +Bergman, et al. Standards Track [Page 76] + +RFC 3805 Printer MIB v2 June 2004 + + + SYNTAX SEQUENCE OF PrtLocalizationEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The available localizations in this printer." + ::= { prtLocalization 1 } + +prtLocalizationEntry OBJECT-TYPE + SYNTAX PrtLocalizationEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A description of a localization. + Entries may exist in the table for each device + index with a device type of 'printer'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtLocalizationIndex } + ::= { prtLocalizationTable 1 } + +PrtLocalizationEntry ::= SEQUENCE { + prtLocalizationIndex Integer32, + prtLocalizationLanguage OCTET STRING, + prtLocalizationCountry OCTET STRING, + prtLocalizationCharacterSet IANACharset + } + +prtLocalizationIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value used by the printer to identify this + localization entry. Although these values may change due to a + major reconfiguration of the device (e.g., the addition of new + localization data to the printer), values SHOULD remain + stable across successive printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtLocalizationEntry 1 } + +prtLocalizationLanguage OBJECT-TYPE + -- Note: The size is fixed, was incorrectly 0..2 in RFC 1759. + SYNTAX OCTET STRING (SIZE(2)) + MAX-ACCESS read-only + STATUS current + + + +Bergman, et al. Standards Track [Page 77] + +RFC 3805 Printer MIB v2 June 2004 + + + DESCRIPTION + "A two character language code from ISO 639. Examples en, + es, fr, de. NOTE: These examples were shown as upper case in + RFC 1759 and are now shown as lower case to agree with ISO 639." + ::= { prtLocalizationEntry 2 } + +prtLocalizationCountry OBJECT-TYPE + -- Note: The size is fixed, was incorrectly 0..2 in RFC 1759. + SYNTAX OCTET STRING (SIZE(2)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A two character country code from ISO 3166, a blank string + (two space characters) shall indicate that the country is not + defined. Examples: US, GB, FR, DE, ..." + ::= { prtLocalizationEntry 3 } + +prtLocalizationCharacterSet OBJECT-TYPE + SYNTAX IANACharset + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The coded character set used for this localization." + ::= { prtLocalizationEntry 4 } + +-- The System Resources Tables +-- +-- The Printer MIB makes use of the Host Resources MIB to +-- define system resources by referencing the storage +-- and device groups of the print group. + +prtStorageRefTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtStorageRefEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table defines which printer, amongst multiple printers + serviced by one agent, owns which storage units. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtGeneral 2 } + +prtStorageRefEntry OBJECT-TYPE + SYNTAX PrtStorageRefEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + + + +Bergman, et al. Standards Track [Page 78] + +RFC 3805 Printer MIB v2 June 2004 + + + "This table will have an entry for each entry in the Host + Resources MIB storage table that represents storage associated + with a printer managed by this agent. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrStorageIndex, prtStorageRefSeqNumber } + ::= { prtStorageRefTable 1 } + +PrtStorageRefEntry ::= SEQUENCE { + prtStorageRefSeqNumber Integer32, + prtStorageRefIndex Integer32 + } + +prtStorageRefSeqNumber OBJECT-TYPE + -- NOTE: The range has been changed from RFC 1759, which allowed a + -- minumum value of zero. This was incorrect, since zero is not a + -- valid index. + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This value will be unique amongst all entries with a common + value of hrStorageIndex. This object allows a storage entry to + point to the multiple printer devices with which it is + associated." + ::= { prtStorageRefEntry 1 } + +prtStorageRefIndex OBJECT-TYPE + -- NOTE: The range has been changed from RFC 1759 to be compatible + -- with the defined range of hrDeviceIndex. + SYNTAX Integer32 (0..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of the hrDeviceIndex of the printer device that this + storageEntry is associated with." + ::= { prtStorageRefEntry 2 } + +prtDeviceRefTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtDeviceRefEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table defines which printer, amongst multiple printers + serviced by one agent, is associated with which devices. + + NOTE: The above description has been modified from RFC 1759 + + + +Bergman, et al. Standards Track [Page 79] + +RFC 3805 Printer MIB v2 June 2004 + + + for clarification." + ::= { prtGeneral 3 } + +prtDeviceRefEntry OBJECT-TYPE + SYNTAX PrtDeviceRefEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table will have an entry for each entry in the Host + Resources MIB device table that represents a device associated + with a printer managed by this agent. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtDeviceRefSeqNumber } + ::= { prtDeviceRefTable 1 } + +PrtDeviceRefEntry ::= SEQUENCE { + prtDeviceRefSeqNumber Integer32, + prtDeviceRefIndex Integer32 + } + +prtDeviceRefSeqNumber OBJECT-TYPE + -- NOTE: The range has been changed from RFC 1759, which allowed a + -- minumum value of zero. This was incorrect, since zero is not a + -- valid index. + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This value will be unique amongst all entries with a common + value of hrDeviceIndex. This object allows a device entry to + point to the multiple printer devices with which it is + associated." + ::= { prtDeviceRefEntry 1 } + +prtDeviceRefIndex OBJECT-TYPE + -- NOTE: The range has been changed from RFC 1759 to be compatible + -- with the defined range of hrDeviceIndex. + SYNTAX Integer32 (0..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of the hrDeviceIndex of the printer device that this + deviceEntry is associated with." + ::= { prtDeviceRefEntry 2 } + + + + + +Bergman, et al. Standards Track [Page 80] + +RFC 3805 Printer MIB v2 June 2004 + + +-- The Input Group +-- +-- Input sub-units are managed as a tabular, indexed collection +-- of possible devices capable of providing media for input to +-- the printing process. Input sub-units typically have a +-- location, a type, an identifier, a set of constraints on +-- possible media sizes and potentially other media +-- characteristics, and may be capable of indicating current +-- status or capacity. + +prtInput OBJECT IDENTIFIER ::= { printmib 8 } + +prtInputTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtInputEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A table of the devices capable of providing media for input to + the printing process." + ::= { prtInput 2 } + +prtInputEntry OBJECT-TYPE + SYNTAX PrtInputEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Attributes of a device capable of providing media for input to + the printing process. Entries may exist in the table for each + device index with a device type of 'printer'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtInputIndex } + ::= { prtInputTable 1 } + +PrtInputEntry ::= SEQUENCE { + prtInputIndex Integer32, + prtInputType PrtInputTypeTC, + prtInputDimUnit PrtMediaUnitTC, + prtInputMediaDimFeedDirDeclared Integer32, + prtInputMediaDimXFeedDirDeclared Integer32, + prtInputMediaDimFeedDirChosen Integer32, + prtInputMediaDimXFeedDirChosen Integer32, + prtInputCapacityUnit PrtCapacityUnitTC, + prtInputMaxCapacity Integer32, + prtInputCurrentLevel Integer32, + prtInputStatus PrtSubUnitStatusTC, + prtInputMediaName OCTET STRING, + + + +Bergman, et al. Standards Track [Page 81] + +RFC 3805 Printer MIB v2 June 2004 + + + prtInputName OCTET STRING, + prtInputVendorName OCTET STRING, + prtInputModel OCTET STRING, + prtInputVersion OCTET STRING, + prtInputSerialNumber OCTET STRING, + prtInputDescription PrtLocalizedDescriptionStringTC, + prtInputSecurity PresentOnOff, + prtInputMediaWeight Integer32, + prtInputMediaType OCTET STRING, + prtInputMediaColor OCTET STRING, + prtInputMediaFormParts Integer32, + prtInputMediaLoadTimeout Integer32, + prtInputNextIndex Integer32 + } + +prtInputIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value used by the printer to identify this input + sub-unit. Although these values may change due to a major + reconfiguration of the device (e.g., the addition of new input + sub-units to the printer), values SHOULD remain stable across + successive printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtInputEntry 1 } + +prtInputType OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtInputTypeTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The type of technology (discriminated primarily according to + feeder mechanism type) employed by the input sub-unit. Note, + the Input Class provides for a descriptor field to further + qualify the other choice." + ::= { prtInputEntry 2 } + +prtInputDimUnit OBJECT-TYPE + SYNTAX PrtMediaUnitTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + + + +Bergman, et al. Standards Track [Page 82] + +RFC 3805 Printer MIB v2 June 2004 + + + "The unit of measurement for use calculating and relaying + dimensional values for this input sub-unit." + ::= { prtInputEntry 3 } + +prtInputMediaDimFeedDirDeclared OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This object provides the value of the declared dimension, in + the feed direction, of the media that is (or, if empty, was or + will be) in this input sub-unit. The feed direction is the + direction in which the media is fed on this sub-unit. This + dimension is measured in input sub-unit dimensional units + (controlled by prtInputDimUnit, which uses PrtMediaUnitTC). If + this input sub-unit can reliably sense this value, the value is + sensed by the printer and may not be changed by management + requests. Otherwise, the value may be changed. The value (-1) + means other and specifically means that this sub-unit places no + restriction on this parameter. The value (-2) indicates + unknown." + ::= { prtInputEntry 4 } + +prtInputMediaDimXFeedDirDeclared OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This object provides the value of the declared dimension, in + the cross feed direction, of the media that is (or, if empty, + was or will be) in this input sub-unit. The cross feed + direction is ninety degrees relative to the feed direction + associated with this sub-unit. This dimension is measured in + input sub-unit dimensional units (controlled by + prtInputDimUnit,which uses PrtMediaUnitTC). If this input sub- + unit can reliably sense this value, the value is sensed by the + printer and may not be changed by management requests. + Otherwise, the value may be changed. The value (-1) means other + and specifically means that this sub-unit places no restriction + on this parameter. The value (-2) indicates unknown." + ::= { prtInputEntry 5 } + +prtInputMediaDimFeedDirChosen OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + + + +Bergman, et al. Standards Track [Page 83] + +RFC 3805 Printer MIB v2 June 2004 + + + STATUS current + DESCRIPTION + "The printer will act as if media of the chosen dimension (in + the feed direction) is present in this input source. Note that + this value will be used even if the input tray is empty. Feed + dimension measurements are taken relative to the feed direction + associated with that sub-unit and are in input sub-unit + dimensional units (controlled by prtInputDimUnit, which uses + PrtMediaUnitTC). If the printer supports the declared + dimension,the granted dimension is the same as the declared + dimension. If not, the granted dimension is set to the closest + dimension that the printer supports when the declared dimension + is set. The value (-1) means other and specifically indicates + that this sub-unit places no restriction on this parameter. The + value (-2)indicates unknown." + ::= { prtInputEntry 6 } + +prtInputMediaDimXFeedDirChosen OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The printer will act as if media of the chosen dimension (in + the cross feed direction) is present in this input source. Note + that this value will be used even if the input tray is empty. + The cross feed direction is ninety degrees relative to the feed + direction associated with this sub-unit. This dimension is + measured in input sub-unit dimensional units (controlled by + prtInputDimUnit, which uses PrtMediaUnitTC). If the printer + supports the declare dimension, the granted dimension is the + same as the declared dimension. If not, the granted dimension + is set to the closest dimension that the printer supports when + the declared dimension is set. The value (-1) means other and + specifically indicates that this sub-unit places no restriction + on this parameter. The value (-2) indicates unknown." + ::= { prtInputEntry 7 } + +prtInputCapacityUnit OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtCapacityUnitTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The unit of measurement for use in calculating and relaying + capacity values for this input sub-unit." + ::= { prtInputEntry 8 } + + + +Bergman, et al. Standards Track [Page 84] + +RFC 3805 Printer MIB v2 June 2004 + + +prtInputMaxCapacity OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The maximum capacity of the input sub-unit in input sub-unit + capacity units (PrtCapacityUnitTC). There is no convention + associated with the media itself so this value reflects claimed + capacity. If this input sub-unit can reliably sense this value, + the value is sensed by the printer and may not be changed by + management requests; otherwise, the value may be written (by a + Remote Control Panel or a Management Application). The value + (-1) means other and specifically indicates that the sub-unit + places no restrictions on this parameter. The value (-2) means + unknown." + ::= { prtInputEntry 9 } + +prtInputCurrentLevel OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-3..2147483647) -- in capacity units + -- (PrtCapacityUnitTC). + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The current capacity of the input sub-unit in input sub-unit + capacity units (PrtCapacityUnitTC). If this input sub-unit can + reliably sense this value, the value is sensed by the printer + and may not be changed by management requests; otherwise, the + value may be written (by a Remote Control Panel or a Management + Application). The value (-1) means other and specifically + indicates that the sub-unit places no restrictions on this + parameter. The value (-2) means unknown. The value (-3) means + that the printer knows that at least one unit remains." + ::= { prtInputEntry 10 } + +prtInputStatus OBJECT-TYPE + SYNTAX PrtSubUnitStatusTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The current status of this input sub-unit." + ::= { prtInputEntry 11 } + +prtInputMediaName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-write + STATUS current + + + +Bergman, et al. Standards Track [Page 85] + +RFC 3805 Printer MIB v2 June 2004 + + + DESCRIPTION + "A description of the media contained in this input sub-unit; + This description is to be used by a client to format and + Localize a string for display to a human operator. This + description is not processed by the printer. It is used to + provide information not expressible in terms of the other + media attributes (e.g., prtInputMediaDimFeedDirChosen, + prtInputMediaDimXFeedDirChosen, prtInputMediaWeight, + prtInputMediaType)." + -- The following reference was not included in RFC 1759. + REFERENCE + "The PWG Standardized Media Names specification [PWGMEDIA] + contains the recommended values for this object. See also + RFC 3805 Appendix C,'Media Names', which lists the values + Of standardized media names defined in ISO/IEC 10175." + ::= { prtInputEntry 12 } + +-- INPUT MEASUREMENT +-- +-- _______ | | +-- ^ | | +-- | | | | +-- | |_ _ _ _ _ _ _ _| _______________ |direction +-- | | | ^ v +-- MaxCapacity | Sheets | | +-- | | left | CurrentLevel +-- | | in | | +-- v | tray | v +-- _______ +_______________+ _______ + +-- The Extended Input Group + +prtInputName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The name assigned to this input sub-unit." + ::= { prtInputEntry 13 } + +prtInputVendorName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The vendor name of this input sub-unit." + ::= { prtInputEntry 14 } + + + + +Bergman, et al. Standards Track [Page 86] + +RFC 3805 Printer MIB v2 June 2004 + + +prtInputModel OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The model name of this input sub-unit." + ::= { prtInputEntry 15 } + +prtInputVersion OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The version of this input sub-unit." + ::= { prtInputEntry 16 } + +prtInputSerialNumber OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..32)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The serial number assigned to this input sub-unit." + ::= { prtInputEntry 17 } + +prtInputDescription OBJECT-TYPE + -- In RFC 1759, the SYNTAX was OCTET STRING. This has been changed + -- to a TC to better support localization of the object. + SYNTAX PrtLocalizedDescriptionStringTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A free-form text description of this input sub-unit in the + localization specified by prtGeneralCurrentLocalization." + ::= { prtInputEntry 18 } + +prtInputSecurity OBJECT-TYPE + SYNTAX PresentOnOff + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Indicates if this input sub-unit has some security associated + with it." + ::= { prtInputEntry 19 } + +-- The Input Media Group +-- +-- The Input Media Group supports identification of media +-- installed or available for use on a printing device. + + + +Bergman, et al. Standards Track [Page 87] + +RFC 3805 Printer MIB v2 June 2004 + + +-- Medium resources are identified by name, and include a +-- collection of characteristic attributes that may further be +-- used for selection and management of them. +-- The Input Media group consists of a set of optional +-- "columns" in the Input Table. In this manner, a minimally +-- conforming implementation may choose to not support reporting +-- of media resources if it cannot do so. + +prtInputMediaWeight OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The weight of the medium associated with this input sub-unit + in grams / per meter squared. The value (-2) means unknown." + ::= { prtInputEntry 20 } + +prtInputMediaType OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The name of the type of medium associated with this input sub + unit. This name need not be processed by the printer; it might + simply be displayed to an operator. + + NOTE: The above description has been modified from RFC 1759." + -- The following reference was not included in RFC 1759. + REFERENCE + "The PWG Standardized Media Names specification [PWGMEDIA], + section 3 Media Type Names, contains the recommended values for + this object. Implementers may add additional string values. + The naming conventions in ISO 9070 are recommended in order to + avoid potential name clashes." + ::= { prtInputEntry 21 } + +prtInputMediaColor OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The name of the color of the medium associated with + this input sub-unit using standardized string values. + + NOTE: The above description has been modified from RFC 1759." + -- The following reference was not included in RFC 1759. + REFERENCE + + + +Bergman, et al. Standards Track [Page 88] + +RFC 3805 Printer MIB v2 June 2004 + + + "The PWG Standardized Media Names specification [PWGMEDIA], + section 4 Media Color Names, contains the recommended values + for this object. Implementers may add additional string values. + The naming conventions in ISO 9070 are recommended in order to + avoid potential name clashes." + ::= { prtInputEntry 22 } + +prtInputMediaFormParts OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The number of parts associated with the medium + associated with this input sub-unit if the medium is a + multi-part form. The value (-1) means other and + specifically indicates that the device places no + restrictions on this parameter. The value (-2) means + unknown." + ::= { prtInputEntry 23 } + +-- The Input Switching Group +-- +-- The input switching group allows the administrator to set the +-- input subunit time-out for the printer and to control the +-- automatic input subunit switching by the printer when an input +-- subunit becomes empty. + +prtInputMediaLoadTimeout OBJECT-TYPE + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "When the printer is not able to print due to a subunit being + empty or the requested media must be manually loaded, the + printer will wait for the duration (in seconds) specified by + this object. Upon expiration of the time-out, the printer will + take the action specified by prtInputNextIndex. + + The event which causes the printer to enter the waiting state + is product specific. If the printer is not waiting for manually + fed media, it may switch from an empty subunit to a different + subunit without waiting for the time-out to expire. + + A value of (-1) implies 'other' or 'infinite' which translates + to 'wait forever'. The action which causes printing to continue + is product specific. A value of (-2) implies 'unknown'." + ::= { prtInputEntry 24 } + + + +Bergman, et al. Standards Track [Page 89] + +RFC 3805 Printer MIB v2 June 2004 + + +prtInputNextIndex OBJECT-TYPE + SYNTAX Integer32 (-3..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The value of prtInputIndex corresponding to the input subunit + which will be used when this input subunit is emptied and the + time-out specified by prtInputMediaLoadTimeout expires. A value + of zero(0) indicates that auto input switching will not occur + when this input subunit is emptied. If the time-out specified + by prtInputLoadMediaTimeout expires and this value is zero(0), + the job will be aborted. A value of (-1) means other. The + value (-2)means 'unknown' and specifically indicates that an + implementation specific method will determine the next input + subunit to use at the time this subunit is emptied and the time + out expires. The value(-3) means input switching is not + supported for this subunit." + ::= { prtInputEntry 25 } + +-- The Output Group +-- +-- Output sub-units are managed as a tabular, indexed collection +-- of possible devices capable of receiving media delivered from +-- the printing process. Output sub-units typically have a +-- location, a type, an identifier, a set of constraints on +-- possible media sizes and potentially other characteristics, +-- and may be capable of indicating current status or capacity. + +prtOutput OBJECT IDENTIFIER ::= { printmib 9 } + +prtOutputTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtOutputEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A table of the devices capable of receiving media delivered + from the printing process." + ::= { prtOutput 2 } + +prtOutputEntry OBJECT-TYPE + SYNTAX PrtOutputEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Attributes of a device capable of receiving media delivered + from the printing process. Entries may exist in the table for + each device index with a device type of 'printer'. + + + + +Bergman, et al. Standards Track [Page 90] + +RFC 3805 Printer MIB v2 June 2004 + + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtOutputIndex } + ::= { prtOutputTable 1 } + +PrtOutputEntry ::= SEQUENCE { + prtOutputIndex Integer32, + prtOutputType PrtOutputTypeTC, + prtOutputCapacityUnit PrtCapacityUnitTC, + prtOutputMaxCapacity Integer32, + prtOutputRemainingCapacity Integer32, + prtOutputStatus PrtSubUnitStatusTC, + prtOutputName OCTET STRING, + prtOutputVendorName OCTET STRING, + prtOutputModel OCTET STRING, + prtOutputVersion OCTET STRING, + prtOutputSerialNumber OCTET STRING, + prtOutputDescription PrtLocalizedDescriptionStringTC, + prtOutputSecurity PresentOnOff, + prtOutputDimUnit PrtMediaUnitTC, + prtOutputMaxDimFeedDir Integer32, + prtOutputMaxDimXFeedDir Integer32, + prtOutputMinDimFeedDir Integer32, + prtOutputMinDimXFeedDir Integer32, + prtOutputStackingOrder PrtOutputStackingOrderTC, + prtOutputPageDeliveryOrientation + PrtOutputPageDeliveryOrientationTC, + prtOutputBursting PresentOnOff, + prtOutputDecollating PresentOnOff, + prtOutputPageCollated PresentOnOff, + prtOutputOffsetStacking PresentOnOff + } + +prtOutputIndex OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value used by this printer to identify this output + sub-unit. Although these values may change due to a major + reconfiguration of the sub-unit (e.g., the addition of new + output devices to the printer), values SHOULD remain stable + across successive printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtOutputEntry 1 } + + + +Bergman, et al. Standards Track [Page 91] + +RFC 3805 Printer MIB v2 June 2004 + + +prtOutputType OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly defined + -- by this object. + SYNTAX PrtOutputTypeTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The type of technology supported by this output sub-unit." + ::= { prtOutputEntry 2 } + +prtOutputCapacityUnit OBJECT-TYPE + SYNTAX PrtCapacityUnitTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The unit of measurement for use in calculating and relaying + capacity values for this output sub-unit." + ::= { prtOutputEntry 3 } + +prtOutputMaxCapacity OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The maximum capacity of this output sub-unit in output sub- + unit capacity units (PrtCapacityUnitTC). There is no convention + associated with the media itself so this value essentially + reflects claimed capacity. If this output sub-unit can reliably + sense this value, the value is sensed by the printer and may + not be changed by management requests; otherwise, the value may + be written (by a Remote Control Panel or a Management + Application). The value (-1) means other and specifically + indicates that the sub-unit places no restrictions on this + parameter. The value (-2) means unknown." + ::= { prtOutputEntry 4 } + +prtOutputRemainingCapacity OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-3..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The remaining capacity of the possible output sub-unit + capacity in output sub-unit capacity units + (PrtCapacityUnitTC)of this output sub-unit. If this output sub- + unit can reliably sense this value, the value is sensed by the + printer and may not be modified by management requests; + + + +Bergman, et al. Standards Track [Page 92] + +RFC 3805 Printer MIB v2 June 2004 + + + otherwise, the value may be written (by a Remote Control Panel + or a Management Application). The value (-1) means other and + specifically indicates that the sub-unit places no restrictions + on this parameter. The value (-2) means unknown. The value + (-3) means that the printer knows that there remains capacity + for at least one unit." + ::= { prtOutputEntry 5 } + +prtOutputStatus OBJECT-TYPE + SYNTAX PrtSubUnitStatusTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The current status of this output sub-unit." + ::= { prtOutputEntry 6 } + +-- OUTPUT MEASUREMENT +-- +-- _______ | | ________ +-- ^ | | ^ +-- | | | | +-- | | |RemainingCapacity +-- MaxCapacity| | | +-- | | | v ^ +-- | |_ _ _ _ _ _ _ _ | _______________ |direction +-- | | Sheets | | +-- | | in | +-- v | Output | +-- _______ +________________+ + +-- The Extended Output Group + +prtOutputName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The name assigned to this output sub-unit." + ::= { prtOutputEntry 7 } + +prtOutputVendorName OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The vendor name of this output sub-unit." + ::= { prtOutputEntry 8 } + + + + +Bergman, et al. Standards Track [Page 93] + +RFC 3805 Printer MIB v2 June 2004 + + +prtOutputModel OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The model name assigned to this output sub-unit. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtOutputEntry 9 } + +prtOutputVersion OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The version of this output sub-unit." + ::= { prtOutputEntry 10 } + +prtOutputSerialNumber OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The serial number assigned to this output sub-unit." + ::= { prtOutputEntry 11 } + +prtOutputDescription OBJECT-TYPE + -- In RFC 1759, the SYNTAX was OCTET STRING. This has been changed + -- to a TC to better support localization of the object. + SYNTAX PrtLocalizedDescriptionStringTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A free-form text description of this output sub-unit in the + localization specified by prtGeneralCurrentLocalization." + ::= { prtOutputEntry 12 } + +prtOutputSecurity OBJECT-TYPE + SYNTAX PresentOnOff + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "Indicates if this output sub-unit has some security associated + with it and if that security is enabled or not." + ::= { prtOutputEntry 13 } + + + + + +Bergman, et al. Standards Track [Page 94] + +RFC 3805 Printer MIB v2 June 2004 + + +-- The Output Dimensions Group + +prtOutputDimUnit OBJECT-TYPE + SYNTAX PrtMediaUnitTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The unit of measurement for use in calculating and relaying + dimensional values for this output sub-unit." + ::= { prtOutputEntry 14 } + +prtOutputMaxDimFeedDir OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The maximum dimensions supported by this output sub-unit + for measurements taken parallel relative to the feed + direction associated with that sub-unit in output + sub-unit dimensional units (controlled by prtOutputDimUnit, + which uses PrtMediaUnitTC). If this output sub-unit can + reliably sense this value, the value is sensed by the printer + and may not be changed with management protocol operations. + The value (-1) means other and specifically indicates that the + sub-unit places no restrictions on this parameter. The value + (-2) means unknown. + + NOTE: The above description has been modified from RFC 1759 + for clarification and to explain the purpose of (-1) and (-2)." + ::= { prtOutputEntry 15 } + +prtOutputMaxDimXFeedDir OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The maximum dimensions supported by this output sub-unit + for measurements taken ninety degrees relative to the + feed direction associated with that sub-unit in output + sub-unit dimensional units (controlled by prtOutputDimUnit, + which uses PrtMediaUnitTC). If this output sub-unit can + reliably sense this value, the value is sensed by the printer + and may not be changed with management protocol operations. + The value (-1) means other and specifically indicates that the + sub-unit places no restrictions on this parameter. The value + (-2) means unknown. + + + +Bergman, et al. Standards Track [Page 95] + +RFC 3805 Printer MIB v2 June 2004 + + + NOTE: The above description has been modified from RFC 1759 + for clarification and to explain the purpose of (-1) and (-2)." + ::= { prtOutputEntry 16 } + +prtOutputMinDimFeedDir OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The minimum dimensions supported by this output sub-unit + for measurements taken parallel relative to the feed + direction associated with that sub-unit in output + sub-unit dimensional units (controlled by prtOutputDimUnit, + which uses PrtMediaUnitTC). If this output sub-unit can + reliably sense this value, the value is sensed by the printer + and may not be changed with management protocol operations. + The value (-1) means other and specifically indicates that the + sub-unit places no restrictions on this parameter. The value + (-2) means unknown. + + NOTE: The above description has been modified from RFC 1759 + for clarification and to explain the purpose of (-1) and (-2)." + ::= { prtOutputEntry 17 } + +prtOutputMinDimXFeedDir OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The minimum dimensions supported by this output sub-unit + for measurements taken ninety degrees relative to the + feed direction associated with that sub-unit in output + sub-unit dimensional units (controlled by prtOutputDimUnit, + which uses PrtMediaUnitTC). If this output sub-unit can + reliably sense this value, the value is sensed by the printer + and may not be changed with management protocol operations. + The value (-1) means other and specifically indicates that the + sub-unit places no restrictions on this parameter. The value + (-2) means unknown. + + NOTE: The above description has been modified from RFC 1759 + for clarification and to explain the purpose of (-1) and (-2)." + ::= { prtOutputEntry 18 } + + + + + + +Bergman, et al. Standards Track [Page 96] + +RFC 3805 Printer MIB v2 June 2004 + + +-- The Output Features Group + +prtOutputStackingOrder OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtOutputStackingOrderTC + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The current state of the stacking order for the + associated output sub-unit. 'FirstToLast' means + that as pages are output the front of the next page is + placed against the back of the previous page. + 'LasttoFirst' means that as pages are output the back + of the next page is placed against the front of the + previous page." + ::= { prtOutputEntry 19 } + +prtOutputPageDeliveryOrientation OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtOutputPageDeliveryOrientationTC + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The reading surface that will be 'up' when pages are + delivered to the associated output sub-unit. Values are + faceUp and faceDown. (Note: interpretation of these + values is in general context-dependent based on locale; + presentation of these values to an end-user should be + normalized to the expectations of the user)." + ::= { prtOutputEntry 20 } + +prtOutputBursting OBJECT-TYPE + SYNTAX PresentOnOff + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This object indicates that the outputting sub-unit supports + bursting, and if so, whether the feature is enabled. Bursting + is the process by which continuous media is separated into + individual sheets, typically by bursting along pre-formed + perforations." + ::= { prtOutputEntry 21 } + +prtOutputDecollating OBJECT-TYPE + SYNTAX PresentOnOff + MAX-ACCESS read-write + + + +Bergman, et al. Standards Track [Page 97] + +RFC 3805 Printer MIB v2 June 2004 + + + STATUS current + DESCRIPTION + "This object indicates that the output supports decollating, + and if so, whether the feature is enabled. Decollating is the + process by which the individual parts within a multi-part form + are separated and sorted into separate stacks for each part." + ::= { prtOutputEntry 22 } + +prtOutputPageCollated OBJECT-TYPE + SYNTAX PresentOnOff + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This object indicates that the output sub-unit supports page + collation, and if so, whether the feature is enabled. See RFC + 3805 Appendix A, Glossary Of Terms, for definition of how this + document defines collation. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtOutputEntry 23 } + +prtOutputOffsetStacking OBJECT-TYPE + SYNTAX PresentOnOff + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This object indicates that the output supports offset + stacking,and if so, whether the feature is enabled. See RFC + 3805 Appendix A, Glossary Of Terms, for how Offset Stacking is + defined by this document. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtOutputEntry 24 } + +-- The Marker Group +-- +-- A marker is the mechanism that produces marks on the print +-- media. The marker sub-units and their associated supplies are +-- represented by the Marker Group in the model. A printer can +-- contain one or more marking mechanisms. Some examples of +-- multiple marker sub-units are: a printer +-- with separate markers for normal and magnetic ink or an +-- imagesetter that can output to both a proofing device and +-- final film. Each marking device can have its own set of +-- characteristics associated with it, such as marking technology +-- and resolution. + + + +Bergman, et al. Standards Track [Page 98] + +RFC 3805 Printer MIB v2 June 2004 + + +prtMarker OBJECT IDENTIFIER ::= { printmib 10 } + +-- The printable area margins as listed below define an area of +-- the print media which is guaranteed to be printable for all +-- combinations of input, media paths, and interpreters for this +-- marker. + +prtMarkerTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtMarkerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The marker table provides a description of each marker + sub-unit contained within the printer. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarker 2 } + +prtMarkerEntry OBJECT-TYPE + SYNTAX PrtMarkerEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Entries in this table define the characteristics and status + of each marker sub-unit in the printer. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtMarkerIndex } + ::= { prtMarkerTable 1 } + +PrtMarkerEntry ::= SEQUENCE { + prtMarkerIndex Integer32, + prtMarkerMarkTech PrtMarkerMarkTechTC, + prtMarkerCounterUnit PrtMarkerCounterUnitTC, + prtMarkerLifeCount Counter32, + prtMarkerPowerOnCount Counter32, + prtMarkerProcessColorants Integer32, + prtMarkerSpotColorants Integer32, + prtMarkerAddressabilityUnit PrtMarkerAddressabilityUnitTC, + prtMarkerAddressabilityFeedDir Integer32, + prtMarkerAddressabilityXFeedDir Integer32, + prtMarkerNorthMargin Integer32, + prtMarkerSouthMargin Integer32, + prtMarkerWestMargin Integer32, + prtMarkerEastMargin Integer32, + prtMarkerStatus PrtSubUnitStatusTC + + + +Bergman, et al. Standards Track [Page 99] + +RFC 3805 Printer MIB v2 June 2004 + + + } + +prtMarkerIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value used by the printer to identify this marking + SubUnit. Although these values may change due to a major + reconfiguration of the device (e.g., the addition of new marking + sub-units to the printer), values SHOULD remain stable across + successive printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerEntry 1 } + +prtMarkerMarkTech OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtMarkerMarkTechTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The type of marking technology used for this marking + sub-unit." + ::= { prtMarkerEntry 2 } + +prtMarkerCounterUnit OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtMarkerCounterUnitTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The unit that will be used by the printer when reporting + counter values for this marking sub-unit. The time units of + measure are provided for a device like a strip recorder that + does not or cannot track the physical dimensions of the media + and does not use characters, lines or sheets." + ::= { prtMarkerEntry 3 } + +prtMarkerLifeCount OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The count of the number of units of measure counted during the + + + +Bergman, et al. Standards Track [Page 100] + +RFC 3805 Printer MIB v2 June 2004 + + + life of printer using units of measure as specified by + prtMarkerCounterUnit. + + Note: This object should be implemented as a persistent object + with a reliable value throughout the lifetime of the printer." + ::= { prtMarkerEntry 4 } + +prtMarkerPowerOnCount OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The count of the number of units of measure counted since the + equipment was most recently powered on using units of measure + as specified by prtMarkerCounterUnit." + ::= { prtMarkerEntry 5 } + +prtMarkerProcessColorants OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of process colors supported by this marker. A + process color of 1 implies monochrome. The value of this + object and prtMarkerSpotColorants cannot both be 0. The value + of prtMarkerProcessColorants must be 0 or greater. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerEntry 6 } + +prtMarkerSpotColorants OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The number of spot colors supported by this marker. The value + of this object and prtMarkerProcessColorants cannot both be 0. + Must be 0 or greater. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerEntry 7 } + +prtMarkerAddressabilityUnit OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtMarkerAddressabilityUnitTC + + + +Bergman, et al. Standards Track [Page 101] + +RFC 3805 Printer MIB v2 June 2004 + + + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The unit of measure of distances, as applied to the marker's + resolution. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerEntry 8 } + +prtMarkerAddressabilityFeedDir OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The maximum number of addressable marking positions in the + feed direction per 10000 units of measure specified by + prtMarkerAddressabilityUnit. A value of (-1) implies 'other' + or 'infinite' while a value of (-2) implies 'unknown'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerEntry 9 } + +prtMarkerAddressabilityXFeedDir OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The maximum number of addressable marking positions in the + cross feed direction in 10000 units of measure specified by + prtMarkerAddressabilityUnit. A value of (-1) implies 'other' + or 'infinite' while a value of (-2) implies 'unknown'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerEntry 10 } + +prtMarkerNorthMargin OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The margin, in units identified by prtMarkerAddressabilityUnit, + from the leading edge of the medium as the medium flows through + + + +Bergman, et al. Standards Track [Page 102] + +RFC 3805 Printer MIB v2 June 2004 + + + the marking engine with the side to be imaged facing the + observer. The leading edge is the North edge and the other + edges are defined by the normal compass layout of directions + with the compass facing the observer. Printing within the area + bounded by all four margins is guaranteed for all interpreters. + The value (-2) means unknown." + ::= { prtMarkerEntry 11 } + +prtMarkerSouthMargin OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The margin from the South edge (see prtMarkerNorthMargin) of + the medium in units identified by prtMarkerAddressabilityUnit. + Printing within the area bounded by all four margins is + guaranteed for all interpreters. The value (-2) means unknown." + ::= { prtMarkerEntry 12 } + +prtMarkerWestMargin OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The margin from the West edge (see prtMarkerNorthMargin) of + the medium in units identified by prtMarkerAddressabilityUnit. + Printing within the area bounded by all four margins is + guaranteed for all interpreters. The value (-2) means unknown." + ::= { prtMarkerEntry 13 } + +prtMarkerEastMargin OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The margin from the East edge (see prtMarkerNorthMargin) of + the medium in units identified by prtMarkerAddressabilityUnit. + Printing within the area bounded by all four margins is + guaranteed for all interpreters. The value (-2) means unknown." + ::= { prtMarkerEntry 14 } + +prtMarkerStatus OBJECT-TYPE + SYNTAX PrtSubUnitStatusTC + MAX-ACCESS read-only + STATUS current + + + +Bergman, et al. Standards Track [Page 103] + +RFC 3805 Printer MIB v2 June 2004 + + + DESCRIPTION + "The current status of this marker sub-unit." + ::= { prtMarkerEntry 15 } + +-- The Marker Supplies Group + +prtMarkerSupplies OBJECT IDENTIFIER ::= { printmib 11 } + +prtMarkerSuppliesTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtMarkerSuppliesEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A table of the marker supplies available on this printer." + ::= { prtMarkerSupplies 1 } + +prtMarkerSuppliesEntry OBJECT-TYPE + SYNTAX PrtMarkerSuppliesEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Attributes of a marker supply. Entries may exist in the table + for each device index with a device type of 'printer'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtMarkerSuppliesIndex } + ::= { prtMarkerSuppliesTable 1 } +PrtMarkerSuppliesEntry ::= SEQUENCE { + prtMarkerSuppliesIndex Integer32, + prtMarkerSuppliesMarkerIndex Integer32, + prtMarkerSuppliesColorantIndex Integer32, + prtMarkerSuppliesClass PrtMarkerSuppliesClassTC, + prtMarkerSuppliesType PrtMarkerSuppliesTypeTC, + prtMarkerSuppliesDescription PrtLocalizedDescriptionStringTC, + prtMarkerSuppliesSupplyUnit PrtMarkerSuppliesSupplyUnitTC, + prtMarkerSuppliesMaxCapacity Integer32, + prtMarkerSuppliesLevel Integer32 + } + +prtMarkerSuppliesIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value used by the printer to identify this marker + supply. Although these values may change due to a major + reconfiguration of the device (e.g., the addition of new marker + + + +Bergman, et al. Standards Track [Page 104] + +RFC 3805 Printer MIB v2 June 2004 + + + supplies to the printer), values SHOULD remain stable across + successive printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerSuppliesEntry 1 } + +prtMarkerSuppliesMarkerIndex OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of prtMarkerIndex corresponding to the marking sub + unit with which this marker supply sub-unit is associated." + ::= { prtMarkerSuppliesEntry 2 } + +prtMarkerSuppliesColorantIndex OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of prtMarkerColorantIndex corresponding to the + colorant with which this marker supply sub-unit is associated. + This value shall be 0 if there is no colorant table or if this + supply does not depend on a single specified colorant. + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerSuppliesEntry 3 } + +prtMarkerSuppliesClass OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtMarkerSuppliesClassTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Indicates whether this supply entity represents a supply that + is consumed or a receptacle that is filled. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerSuppliesEntry 4 } + +prtMarkerSuppliesType OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtMarkerSuppliesTypeTC + MAX-ACCESS read-only + + + +Bergman, et al. Standards Track [Page 105] + +RFC 3805 Printer MIB v2 June 2004 + + + STATUS current + DESCRIPTION + "The type of this supply." + ::= { prtMarkerSuppliesEntry 5 } + +prtMarkerSuppliesDescription OBJECT-TYPE + -- In RFC 1759, the SYNTAX was OCTET STRING. This has been changed + -- to a TC to better support localization of the object. + SYNTAX PrtLocalizedDescriptionStringTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The description of this supply container/receptacle in the + localization specified by prtGeneralCurrentLocalization." + ::= { prtMarkerSuppliesEntry 6 } + +prtMarkerSuppliesSupplyUnit OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtMarkerSuppliesSupplyUnitTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Unit of measure of this marker supply container/receptacle. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerSuppliesEntry 7 } + +prtMarkerSuppliesMaxCapacity OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The maximum capacity of this supply container/receptacle + expressed in prtMarkerSuppliesSupplyUnit. If this supply + container/receptacle can reliably sense this value, the value + is reported by the printer and is read-only; otherwise, the + value may be written (by a Remote Control Panel or a Management + Application). The value (-1) means other and specifically + indicates that the sub-unit places no restrictions on this + parameter. The value (-2) means unknown." + ::= { prtMarkerSuppliesEntry 8 } + +prtMarkerSuppliesLevel OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-3..2147483647) + + + +Bergman, et al. Standards Track [Page 106] + +RFC 3805 Printer MIB v2 June 2004 + + + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The current level if this supply is a container; the remaining + space if this supply is a receptacle. If this supply + container/receptacle can reliably sense this value, the value + is reported by the printer and is read-only; otherwise, the + value may be written (by a Remote Control Panel or a Management + Application). The value (-1) means other and specifically + indicates that the sub-unit places no restrictions on this + parameter. The value (-2) means unknown. A value of (-3) means + that the printer knows that there is some supply/remaining + space, respectively." + ::= { prtMarkerSuppliesEntry 9 } + +-- The Marker Colorant Group + +prtMarkerColorant OBJECT IDENTIFIER ::= { printmib 12 } + +prtMarkerColorantTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtMarkerColorantEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A table of all of the colorants available on the printer." + ::= { prtMarkerColorant 1 } + +prtMarkerColorantEntry OBJECT-TYPE + SYNTAX PrtMarkerColorantEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Attributes of a colorant available on the printer. Entries may + exist in the table for each device index with a device type of + 'printer'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtMarkerColorantIndex } + ::= { prtMarkerColorantTable 1 } + +PrtMarkerColorantEntry ::= SEQUENCE { + prtMarkerColorantIndex Integer32, + prtMarkerColorantMarkerIndex Integer32, + prtMarkerColorantRole PrtMarkerColorantRoleTC, + prtMarkerColorantValue OCTET STRING, + prtMarkerColorantTonality Integer32 + } + + + +Bergman, et al. Standards Track [Page 107] + +RFC 3805 Printer MIB v2 June 2004 + + +prtMarkerColorantIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value used by the printer to identify this colorant. + Although these values may change due to a major reconfiguration + of the device (e.g., the addition of new colorants to the + printer) , values SHOULD remain stable across successive + printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMarkerColorantEntry 1 } + +prtMarkerColorantMarkerIndex OBJECT-TYPE + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of prtMarkerIndex corresponding to the marker sub + unit with which this colorant entry is associated." + ::= { prtMarkerColorantEntry 2 } + +prtMarkerColorantRole OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtMarkerColorantRoleTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The role played by this colorant." + ::= { prtMarkerColorantEntry 3 } + +prtMarkerColorantValue OBJECT-TYPE + -- NOTE: The string length range has been increased from RFC 1759. + SYNTAX OCTET STRING (SIZE(0..255)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The name of the color of this colorant using standardized + string names from ISO 10175 (DPA) and ISO 10180 (SPDL) such as: + other + unknown + white + red + green + blue + + + +Bergman, et al. Standards Track [Page 108] + +RFC 3805 Printer MIB v2 June 2004 + + + cyan + magenta + yellow + black + Implementers may add additional string values. The naming + conventions in ISO 9070 are recommended in order to avoid + potential name clashes" + ::= { prtMarkerColorantEntry 4 } + +prtMarkerColorantTonality OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The distinct levels of tonality realizable by a marking sub + unit when using this colorant. This value does not include the + number of levels of tonal difference that an interpreter can + obtain by techniques such as half toning. This value must be at + least 2." + ::= { prtMarkerColorantEntry 5 } + +-- The Media Path Group +-- +-- The media paths encompass the mechanisms in the printer that +-- move the media through the printer and connect all other media +-- related sub-units: inputs, outputs, markers and finishers. A +-- printer contains one or more media paths. These are +-- represented by the Media Path Group in the model. + +prtMediaPath OBJECT IDENTIFIER ::= { printmib 13 } + +prtMediaPathTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtMediaPathEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The media path table includes both physical and logical paths + within the printer. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMediaPath 4 } + +prtMediaPathEntry OBJECT-TYPE + SYNTAX PrtMediaPathEntry + MAX-ACCESS not-accessible + STATUS current + + + +Bergman, et al. Standards Track [Page 109] + +RFC 3805 Printer MIB v2 June 2004 + + + DESCRIPTION + "Entries may exist in the table for each device index with a + device type of 'printer' Each entry defines the physical + characteristics of and the status of the media path. The data + provided indicates the maximum throughput and the media + size limitations of these subunits. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtMediaPathIndex } + ::= { prtMediaPathTable 1 } + +PrtMediaPathEntry ::= SEQUENCE { + prtMediaPathIndex Integer32, + prtMediaPathMaxSpeedPrintUnit PrtMediaPathMaxSpeedPrintUnitTC, + prtMediaPathMediaSizeUnit PrtMediaUnitTC, + prtMediaPathMaxSpeed Integer32, + prtMediaPathMaxMediaFeedDir Integer32, + prtMediaPathMaxMediaXFeedDir Integer32, + prtMediaPathMinMediaFeedDir Integer32, + prtMediaPathMinMediaXFeedDir Integer32, + prtMediaPathType PrtMediaPathTypeTC, + prtMediaPathDescription PrtLocalizedDescriptionStringTC, + prtMediaPathStatus PrtSubUnitStatusTC + } + +prtMediaPathIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value used by the printer to identify this media + path. Although these values may change due to a major + reconfiguration of the device (e.g., the addition of new media + paths to the printer), values SHOULD remain stable across + successive printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMediaPathEntry 1 } + +prtMediaPathMaxSpeedPrintUnit OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtMediaPathMaxSpeedPrintUnitTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + + + +Bergman, et al. Standards Track [Page 110] + +RFC 3805 Printer MIB v2 June 2004 + + + "The unit of measure used in specifying the speed of all media + paths in the printer." + ::= { prtMediaPathEntry 2 } + +prtMediaPathMediaSizeUnit OBJECT-TYPE + SYNTAX PrtMediaUnitTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The units of measure of media size for use in calculating and + relaying dimensional values for all media paths in the + printer." + ::= { prtMediaPathEntry 3 } + +prtMediaPathMaxSpeed OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The maximum printing speed of this media path expressed in + prtMediaPathMaxSpeedUnit's. A value of (-1) implies 'other'." + ::= { prtMediaPathEntry 4 } + +prtMediaPathMaxMediaFeedDir OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The maximum physical media size in the feed direction of this + media path expressed in units of measure specified by + PrtMediaPathMediaSizeUnit. A value of (-1) implies 'unlimited' + a value of (-2) implies 'unknown'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMediaPathEntry 5 } + +prtMediaPathMaxMediaXFeedDir OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The maximum physical media size across the feed direction of + this media path expressed in units of measure specified by + prtMediaPathMediaSizeUnit. A value of (-2) implies 'unknown'. + + + +Bergman, et al. Standards Track [Page 111] + +RFC 3805 Printer MIB v2 June 2004 + + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMediaPathEntry 6 } + +prtMediaPathMinMediaFeedDir OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The minimum physical media size in the feed direction of this + media path expressed in units of measure specified by + prtMediaPathMediaSizeUnit. A value of (-2) implies 'unknown'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMediaPathEntry 7 } + +prtMediaPathMinMediaXFeedDir OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The minimum physical media size across the feed direction of + this media path expressed in units of measure specified by + prtMediaPathMediaSizeUnit. A value of (-2) implies 'unknown'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtMediaPathEntry 8 } + +prtMediaPathType OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtMediaPathTypeTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The type of the media path for this media path." + ::= { prtMediaPathEntry 9 } + +prtMediaPathDescription OBJECT-TYPE + -- In RFC 1759, the SYNTAX was OCTET STRING. This has been changed + -- to a TC to better support localization of the object. + SYNTAX PrtLocalizedDescriptionStringTC + MAX-ACCESS read-only + STATUS current + + + +Bergman, et al. Standards Track [Page 112] + +RFC 3805 Printer MIB v2 June 2004 + + + DESCRIPTION + "The manufacturer-provided description of this media path in + the localization specified by prtGeneralCurrentLocalization." + ::= { prtMediaPathEntry 10 } + +prtMediaPathStatus OBJECT-TYPE + SYNTAX PrtSubUnitStatusTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The current status of this media path." + ::= { prtMediaPathEntry 11 } + +-- The Print Job Delivery Channel Group +-- +-- Print Job Delivery Channels are independent sources of print +-- data. Here, print data is the term used for the information +-- that is used to construct printed pages and may have both data +-- and control aspects. The output of a channel is in a form +-- suitable for input to one of the interpreters as a +-- stream. A channel may be independently enabled (allowing +-- print data to flow) or disabled (stopping the flow of +-- print data). A printer may have one or more channels. +-- +-- The Print Job Delivery Channel table describes the +-- capabilities of the printer and not what is currently being +-- performed by the printer +-- +-- Basically, the print job delivery channel abstraction +-- describes the final processing step of getting the print data +-- to an interpreter. It might include some level of +-- decompression or decoding of print stream data. +-- channel. All of these aspects are hidden in the channel +-- abstraction. +-- +-- There are many kinds of print job delivery channels; some of +-- which are based on networks and others which are not. For +-- example, a channel can be a serial (or parallel) connection; +-- it can be a service, such as the UNIX Line Printer Daemon +-- (LPD), offering services over a network connection; or +-- it could be a disk drive into which a floppy disk with +-- the print data is inserted. Each print job delivery channel is +-- identified by the electronic path and/or service protocol +-- used to deliver print data to a print data interpreter. +-- +-- Channel example Implementation +-- +-- serial port channel bi-directional data channel + + + +Bergman, et al. Standards Track [Page 113] + +RFC 3805 Printer MIB v2 June 2004 + + +-- parallel port channel often uni-directional channel +-- IEEE 1284 port channel bi-directional channel +-- SCSI port channel bi-directional +-- Apple PAP channel may be based on LocalTalk, +-- Ethernet or Tokentalk +-- LPD Server channel TCP/IP based, port 515 +-- Netware Remote Printer SPX/IPX based channel +-- Netware Print Server SPX/IPX based channel +-- +-- It is easy to note that this is a mixed bag. There are +-- some physical connections over which no (or very meager) +-- protocols are run (e.g., the serial or old parallel ports) +-- and there are services which often have elaborate +-- protocols that run over a number of protocol stacks. In +-- the end, what is important is the delivery of print data +-- through the channel. +-- +-- The print job delivery channel sub-units are represented by +-- the Print Job Delivery Channel Group in the Model. It has a +-- current print job control language, which can be used to +-- specify which interpreter is to be used for the print data and +-- to query and change environment variables used by the +-- interpreters (and Management Applications). There is also a +-- default interpreter that is to be used if an interpreter is +-- not explicitly specified using the Control Language. + +-- The first seven items in the Print Job Delivery Channel Table +-- define the "channel" itself. A channel typically depends on +-- other protocols and interfaces to provide the data that flows +-- through the channel. +-- +-- Control of a print job delivery channel is largely limited to +-- enabling or disabling the entire channel itself. It is likely +-- that more control of the process of accessing print data +-- will be needed over time. Thus, the ChannelType will +-- allow type-specific data to be associated with each +-- channel (using ChannelType specific groups in a fashion +-- analogous to the media specific MIBs that are associated +-- with the IANAIfType in the Interfaces Table). As a first +-- step in this direction, each channel will identify the +-- underlying Interface on which it is based. This is the +-- eighth object in each row of the table. + + + + + + + + + +Bergman, et al. Standards Track [Page 114] + +RFC 3805 Printer MIB v2 June 2004 + + +-- The Print Job Delivery Channel Table + +prtChannel OBJECT IDENTIFIER ::= { printmib 14 } + +prtChannelTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtChannelEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The channel table represents the set of input data sources + which can provide print data to one or more of the + interpreters available on a printer. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtChannel 1 } + +prtChannelEntry OBJECT-TYPE + SYNTAX PrtChannelEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Entries may exist in the table for each device index with a + device type of 'printer'. Each channel table entry is + characterized by a unique protocol stack and/or addressing. + The channel may also have printer dependent features that are + associated with a printing language. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtChannelIndex } + ::= { prtChannelTable 1 } + +PrtChannelEntry ::= SEQUENCE { + prtChannelIndex Integer32, + prtChannelType PrtChannelTypeTC, + prtChannelProtocolVersion OCTET STRING, + prtChannelCurrentJobCntlLangIndex Integer32, + prtChannelDefaultPageDescLangIndex Integer32, + prtChannelState PrtChannelStateTC, + prtChannelIfIndex InterfaceIndexOrZero, + prtChannelStatus PrtSubUnitStatusTC, + prtChannelInformation OCTET STRING + } + +prtChannelIndex OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (1..65535) + + + +Bergman, et al. Standards Track [Page 115] + +RFC 3805 Printer MIB v2 June 2004 + + + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value used by the printer to identify this data + channel. Although these values may change due to a major + reconfiguration of the device (e.g., the addition of new data + channels to the printer), values SHOULD remain stable across + successive printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtChannelEntry 1 } + +prtChannelType OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtChannelTypeTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The type of this print data channel. This object provides the + linkage to ChannelType-specific groups that may (conceptually) + extend the prtChannelTable with additional details about that + channel." + ::= { prtChannelEntry 2 } + +prtChannelProtocolVersion OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..63)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The version of the protocol used on this channel. The format + used for version numbering depends on prtChannelType." + ::= { prtChannelEntry 3 } + +prtChannelCurrentJobCntlLangIndex OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The value of prtInterpreterIndex corresponding to the Control + Language Interpreter for this channel. This interpreter defines + the syntax used for control functions, such as querying or + changing environment variables and identifying job boundaries + (e.g., PJL, PostScript, NPAP). A value of zero indicates that + there is no current Job Control Language Interpreter for this + channel. + + + +Bergman, et al. Standards Track [Page 116] + +RFC 3805 Printer MIB v2 June 2004 + + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtChannelEntry 4 } + +prtChannelDefaultPageDescLangIndex OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (0..65535) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The value of prtInterpreterIndex corresponding to the Page + Description Language Interpreter for this channel. This + interpreter defines the default Page Description Language + interpreter to be used for the print data unless the Control + Language is used to select a specific interpreter (e.g., PCL, + PostScript Language, auto-sense). A value of zero indicates + that there is no default page description language interpreter + for this channel. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtChannelEntry 5 } + +prtChannelState OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtChannelStateTC + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The state of this print data channel. The value determines + whether control information and print data is allowed through + this channel or not." + ::= { prtChannelEntry 6 } + +prtChannelIfIndex OBJECT-TYPE + SYNTAX InterfaceIndexOrZero -- Was Integer32 in RFC 1759. + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The value of ifIndex in the ifTable; see the Interfaces Group + MIB [RFC2863] which corresponds to this channel. + When more than one row of the ifTable is relevant, this is the + index of the row representing the topmost layer in the + interface hierarchy. A value of zero indicates that no + interface is associated with this channel. + + NOTE: The above description has been modified from RFC 1759 + + + +Bergman, et al. Standards Track [Page 117] + +RFC 3805 Printer MIB v2 June 2004 + + + for clarification." + ::= { prtChannelEntry 7 } + +prtChannelStatus OBJECT-TYPE + SYNTAX PrtSubUnitStatusTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The current status of the channel." + ::= { prtChannelEntry 8 } + +prtChannelInformation OBJECT-TYPE + SYNTAX OCTET STRING (SIZE (0..255)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Auxiliary information to allow a printing application to use + the channel for data submission to the printer. An application + capable of using a specific PrtChannelType should be able to + use the combined information from the prtChannelInformation and + other channel and interface group objects to 'bootstrap' its + use of the channel. prtChannelInformation is not intended to + provide a general channel description, nor to provide + information that is available once the channel is in use. + + The encoding and interpretation of the prtChannelInformation + object is specific to channel type. The description of each + PrtChannelType enum value for which prtChannelInformation is + defined specifies the appropriate encoding and interpretation, + including interaction with other objects. For channel types + that do not specify a prtChannelInformation value, its value + shall be null (0 length). + + When a new PrtChannelType enumeration value is registered, its + accompanying description must specify the encoding and + interpretation of the prtChannelInformation value for the + channel type. prtChannelInformation semantics for an existing + PrtChannelType may be added or amended in the same manner as + described in section 2.4.1 for type 2 enumeration values. + + The prtChannelInformation specifies values for a collection of + channel attributes, represented as text according to the + following rules: + + 1. The prtChannelInformation is not affected by localization. + + 2. The prtChannelInformation is a list of entries representing + the attribute values. Each entry consists of the following + + + +Bergman, et al. Standards Track [Page 118] + +RFC 3805 Printer MIB v2 June 2004 + + + items, in order: + + a. A keyword, composed of alphabetic characters (A-Z, a-z) + represented by their NVT ASCII [RFC854] codes, that + identifies a channel attribute, + + b. The NVT ASCII code for an Equals Sign (=) (code 61) to + delimit the keyword, + + c. A data value encoded using rules specific to the + PrtChannelType to with the prtChannelInformation applies which + must in no case allow an octet with value 10 (the NVT ASCII + Line Feed code), + + d. the NVT ASCII code for a Line Feed character (code 10) to + delimit the data value. + + No other octets shall be present. + + Keywords are case-sensitive. Conventionally, keywords are + capitalized (including each word of a multi-word keyword) and + since they occupy space in the prtChannelInformation, they are + kept short. + + 3. If a channel attribute has multiple values, it is + represented by multiple entries with the same keyword, each + specifying one value. Otherwise, there shall be at most one + entry for each attribute. + + 4. By default, entries may appear in any order. If there are + ordering constraints for particular entries, these must be + specified in their definitions. + + 5. The prtChannelInformation value by default consists of text + represented by NVT ASCII graphics character codes. However, + other representations may be specified: + + a. In cases where the prtChannelInformation value contains + information not normally coded in textual form, whatever + symbolic representation is conventionally used for the + information should be used for encoding the + prtChannelInformation value. (For instance, a binary port value + might be represented as a decimal number using NVT ASCII + codes.) Such encoding must be specified in the definition of + the value. + + b. The value may contain textual information in a character set + other than NVT ASCII graphics characters. (For instance, an + + + +Bergman, et al. Standards Track [Page 119] + +RFC 3805 Printer MIB v2 June 2004 + + + identifier might consist of ISO 10646 text encoded using the + UTF-8 encoding scheme.) Such a character set and its encoding + must be specified in the definition of the value. + + 6. For each PrtChannelType for which prtChannelInformation + entries are defined, the descriptive text associated with the + PrtChannelType enumeration value shall specify the following + information for each entry: + + Title: Brief description phrase, e.g.: 'Port name', + 'Service Name', etc. + + Keyword: The keyword value, e.g.: 'Port' or 'Service' + + Syntax: The encoding of the entry value if it cannot be + directly represented by NVT ASCII. + + Status: 'Mandatory', 'Optional', or 'Conditionally + Mandatory' + + Multiplicity: 'Single' or 'Multiple' to indicate whether the + entry may be present multiple times. + + Description: Description of the use of the entry, other + information required to complete the definition + (e.g.: ordering constraints, interactions between + entries). + + Applications that interpret prtChannelInformation should ignore + unrecognized entries, so they are not affected if new entry + types are added." + + ::= { prtChannelEntry 9 } + +-- The Interpreter Group +-- +-- The interpreter sub-units are responsible for the conversion +-- of a description of intended print instances into images that +-- are to be marked on the media. A printer may have one or more +-- interpreters. The interpreter sub-units are represented by the +-- Interpreter Group in the Model. Each interpreter is generally +-- implemented with software running on the System Controller +-- sub-unit. The Interpreter Table has one entry per interpreter +-- where the interpreters include both Page Description Language +-- (PDL) Interpreters and Control Language Interpreters. + +prtInterpreter OBJECT IDENTIFIER ::= { printmib 15 } + + + + +Bergman, et al. Standards Track [Page 120] + +RFC 3805 Printer MIB v2 June 2004 + + +-- Interpreter Table + +prtInterpreterTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtInterpreterEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The interpreter table is a table representing the + interpreters in the printer. An entry shall be placed in the + interpreter table for each interpreter on the printer. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtInterpreter 1 } + +prtInterpreterEntry OBJECT-TYPE + SYNTAX PrtInterpreterEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Entries may exist in the table for each device index with a + device type of 'printer'. Each table entry provides a complete + description of the interpreter, including version information, + rendering resolutions, default character sets, output + orientation, and communication capabilities. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtInterpreterIndex } + ::= { prtInterpreterTable 1 } + +PrtInterpreterEntry ::= SEQUENCE { + prtInterpreterIndex Integer32, + prtInterpreterLangFamily PrtInterpreterLangFamilyTC, + prtInterpreterLangLevel OCTET STRING, + prtInterpreterLangVersion OCTET STRING, + prtInterpreterDescription PrtLocalizedDescriptionStringTC, + prtInterpreterVersion OCTET STRING, + prtInterpreterDefaultOrientation PrtPrintOrientationTC, + prtInterpreterFeedAddressability Integer32, + prtInterpreterXFeedAddressability Integer32, + prtInterpreterDefaultCharSetIn IANACharset, + prtInterpreterDefaultCharSetOut IANACharset, + prtInterpreterTwoWay PrtInterpreterTwoWayTC + } + +prtInterpreterIndex OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + + + +Bergman, et al. Standards Track [Page 121] + +RFC 3805 Printer MIB v2 June 2004 + + + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value for each PDL or control language for which + there exists an interpreter or emulator in the printer. The + value is used to identify this interpreter. Although these + values may change due to a major reconfiguration of the device + (e.g., the addition of new interpreters to the printer), values + SHOULD remain stable across successive printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtInterpreterEntry 1 } + +prtInterpreterLangFamily OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtInterpreterLangFamilyTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The family name of a Page Description Language (PDL) or + control language which this interpreter in the printer can + interpret or emulate. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtInterpreterEntry 2 } + +prtInterpreterLangLevel OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..31)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The level of the language which this interpreter is + interpreting or emulating. This might contain a value like + '5e'for an interpreter which is emulating level 5e of the PCL + language. It might contain '2' for an interpreter which is + emulating level 2 of the PostScript language. Similarly it + might contain '2' for an interpreter which is emulating level 2 + of the HPGL language." + ::= { prtInterpreterEntry 3 } + +prtInterpreterLangVersion OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..31)) + MAX-ACCESS read-only + STATUS current + + + +Bergman, et al. Standards Track [Page 122] + +RFC 3805 Printer MIB v2 June 2004 + + + DESCRIPTION + "The date code or version of the language which this + interpreter is interpreting or emulating." + ::= { prtInterpreterEntry 4 } + +prtInterpreterDescription OBJECT-TYPE + -- In RFC 1759, the SYNTAX was OCTET STRING. This has been changed + -- to a TC to better support localization of the object. + SYNTAX PrtLocalizedDescriptionStringTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A string to identify this interpreter in the localization + specified by prtGeneralCurrentLocalization as opposed to the + language which is being interpreted. It is anticipated that + this string will allow manufacturers to unambiguously identify + their interpreters." + ::= { prtInterpreterEntry 5 } + +prtInterpreterVersion OBJECT-TYPE + SYNTAX OCTET STRING (SIZE(0..31)) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The date code, version number, or other product specific + information tied to this interpreter. This value is associated + with the interpreter, rather than with the version of the + language which is being interpreted or emulated." + ::= { prtInterpreterEntry 6 } + +prtInterpreterDefaultOrientation OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtPrintOrientationTC + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The current orientation default for this interpreter. This + value may be overridden for a particular job (e.g., by a + command in the input data stream)." + ::= { prtInterpreterEntry 7 } + +prtInterpreterFeedAddressability OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + + + +Bergman, et al. Standards Track [Page 123] + +RFC 3805 Printer MIB v2 June 2004 + + + "The maximum interpreter addressability in the feed + direction in 10000 prtMarkerAddressabilityUnits (as specified + by prtMarkerDefaultIndex) for this interpreter. The + value (-1) means other and specifically indicates that the + sub-unit places no restrictions on this parameter. The value + (-2) means unknown. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtInterpreterEntry 8 } + +prtInterpreterXFeedAddressability OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The maximum interpreter addressability in the cross feed + direction in 10000 prtMarkerAddressabilityUnits (as specified + by prtMarkerDefaultIndex) for this interpreter. The + value (-1) means other and specifically indicates that the + sub-unit places no restrictions on this parameter. The value + (-2) means unknown. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtInterpreterEntry 9 } + +prtInterpreterDefaultCharSetIn OBJECT-TYPE + SYNTAX IANACharset + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The default coded character set for input octets encountered + outside a context in which the Page Description Language + established the interpretation of the octets. (Input octets are + presented to the interpreter through a path defined in the + channel group.)" + ::= { prtInterpreterEntry 10 } + +prtInterpreterDefaultCharSetOut OBJECT-TYPE + SYNTAX IANACharset + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The default character set for data coming from this + interpreter through the printer's output channel (i.e. the + 'backchannel')." + + + +Bergman, et al. Standards Track [Page 124] + +RFC 3805 Printer MIB v2 June 2004 + + + ::= { prtInterpreterEntry 11 } + +prtInterpreterTwoWay OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtInterpreterTwoWayTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Indicates whether or not this interpreter returns information + back to the host." + ::= { prtInterpreterEntry 12 } + +-- The Console Group +-- +-- Many printers have a console on the printer, the operator +-- console, that is used to display and modify the state of the +-- printer. The console can be as simple as a few indicators and +-- switches or as complicated as full screen displays and +-- keyboards. There can be at most one such console. + +-- The Display Buffer Table + +prtConsoleDisplayBuffer OBJECT IDENTIFIER ::= { printmib 16 } + +prtConsoleDisplayBufferTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtConsoleDisplayBufferEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Physical display buffer for printer console display or + operator panel + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtConsoleDisplayBuffer 5 } + +prtConsoleDisplayBufferEntry OBJECT-TYPE + SYNTAX PrtConsoleDisplayBufferEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "This table contains one entry for each physical line on + the display. Lines cannot be added or deleted. Entries may + exist in the table for each device index with a device type of + 'printer'. + + NOTE: The above description has been modified from RFC 1759 + + + +Bergman, et al. Standards Track [Page 125] + +RFC 3805 Printer MIB v2 June 2004 + + + for clarification." + INDEX { hrDeviceIndex, prtConsoleDisplayBufferIndex } + ::= { prtConsoleDisplayBufferTable 1 } + +PrtConsoleDisplayBufferEntry ::= SEQUENCE { + prtConsoleDisplayBufferIndex Integer32, + prtConsoleDisplayBufferText PrtConsoleDescriptionStringTC + } + +prtConsoleDisplayBufferIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value for each console line in the printer. The value + is used to identify this console line. Although these values + may change due to a major reconfiguration of the device (e.g., + the addition of new console lines to the printer). Values + SHOULD remain stable across successive printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtConsoleDisplayBufferEntry 1 } + +prtConsoleDisplayBufferText OBJECT-TYPE + -- In RFC 1759, the SYNTAX was OCTET STRING. This has been changed + -- to a TC to better support localization of the object. + SYNTAX PrtConsoleDescriptionStringTC + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "The content of a line in the logical display buffer of + the operator's console of the printer. When a write + operation occurs, normally a critical message, to one of + the LineText strings, the agent should make that line + displayable if a physical display is present. Writing a zero + length string clears the line. It is an implementation- + specific matter as to whether the agent allows a line to be + overwritten before it has been cleared. Printer generated + strings shall be in the localization specified by + prtConsoleLocalization.Management Application generated strings + should be localized by the Management Application." + ::= { prtConsoleDisplayBufferEntry 2 } + +-- The Console Light Table + +prtConsoleLights OBJECT IDENTIFIER ::= { printmib 17 } + + + + +Bergman, et al. Standards Track [Page 126] + +RFC 3805 Printer MIB v2 June 2004 + + +prtConsoleLightTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtConsoleLightEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The console light table provides a description and state + information for each light present on the printer console. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtConsoleLights 6 } + +prtConsoleLightEntry OBJECT-TYPE + SYNTAX PrtConsoleLightEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "Entries may exist in the table for each device index with a + device type of 'printer'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtConsoleLightIndex } + ::= { prtConsoleLightTable 1 } + +PrtConsoleLightEntry ::= SEQUENCE { + prtConsoleLightIndex Integer32, + prtConsoleOnTime Integer32, + prtConsoleOffTime Integer32, + prtConsoleColor PrtConsoleColorTC, + prtConsoleDescription PrtConsoleDescriptionStringTC + } + +prtConsoleLightIndex OBJECT-TYPE + SYNTAX Integer32 (1..65535) -- Lower limit invalid in RFC 1759 + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "A unique value used by the printer to identify this light. + Although these values may change due to a major + reconfiguration of the device (e.g., the addition of new lights + to the printer). Values SHOULD remain stable across successive + printer power cycles. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtConsoleLightEntry 1 } + + + + +Bergman, et al. Standards Track [Page 127] + +RFC 3805 Printer MIB v2 June 2004 + + +prtConsoleOnTime OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (0..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This object, in conjunction with prtConsoleOffTime, defines + the current status of the light. If both prtConsoleOnTime and + prtConsoleOffTime are non-zero, the lamp is blinking and the + values presented define the on time and off time, respectively, + in milliseconds. If prtConsoleOnTime is zero and + prtConsoleOffTime is non-zero, the lamp is off. If + prtConsoleOffTime is zero and prtConsoleOnTime is non-zero, the + lamp is on. If both values are zero the lamp is off. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtConsoleLightEntry 2 } + +prtConsoleOffTime OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (0..2147483647) + MAX-ACCESS read-write + STATUS current + DESCRIPTION + "This object, in conjunction with prtConsoleOnTime, defines the + current status of the light. If both prtConsoleOnTime and + prtConsoleOffTime are non-zero, the lamp is blinking and the + values presented define the on time and off time, respectively, + in milliseconds. If prtConsoleOnTime is zero and + prtConsoleOffTime is non-zero, the lamp is off. If + prtConsoleOffTime is zero and prtConsoleOnTime is non-zero, the + lamp is on. If both values are zero the lamp is off. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtConsoleLightEntry 3 } + +prtConsoleColor OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtConsoleColorTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The color of this light." + ::= { prtConsoleLightEntry 4 } + + + + +Bergman, et al. Standards Track [Page 128] + +RFC 3805 Printer MIB v2 June 2004 + + +prtConsoleDescription OBJECT-TYPE + -- In RFC 1759, the SYNTAX was OCTET STRING. This has been changed + -- to a TC to better support localization of the object. + SYNTAX PrtConsoleDescriptionStringTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The vendor description or label of this light in the + localization specified by prtConsoleLocalization." + ::= { prtConsoleLightEntry 5 } + +-- The Alerts Group +-- +-- The table contains information on the severity, component, +-- detail location within the component, alert code and +-- description of each critical alert that is currently active +-- within the printer. See 2.2.13 for a more complete +-- description of the alerts table and its management. +-- +-- Each parameter in the Trap PDU is a full OID which itself is +-- indexed by the host resources MIB "hrDeviceIndex" object. In +-- order for a management station to obtain the correct +-- "hrDeviceIndex" associated with a particular Trap PDU, the +-- "hrDeviceIndex" value can be extracted from the returned OID +-- value in the Trap PDU when the PDU is received by the +-- Management station. + +prtAlert OBJECT IDENTIFIER ::= { printmib 18 } + +prtAlertTable OBJECT-TYPE + SYNTAX SEQUENCE OF PrtAlertEntry + MAX-ACCESS not-accessible + STATUS current + DESCRIPTION + "The prtAlertTable lists all the critical and non-critical + alerts currently active in the printer. A critical alert is + one that stops the printer from printing immediately and + printing can not continue until the critical alert condition + is eliminated. Non-critical alerts are those items that do + not stop printing but may at some future time. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtAlert 1 } + +prtAlertEntry OBJECT-TYPE + SYNTAX PrtAlertEntry + MAX-ACCESS not-accessible + + + +Bergman, et al. Standards Track [Page 129] + +RFC 3805 Printer MIB v2 June 2004 + + + STATUS current + DESCRIPTION + "Entries may exist in the table for each device + index with a device type of 'printer'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + INDEX { hrDeviceIndex, prtAlertIndex } + ::= { prtAlertTable 1 } + +PrtAlertEntry ::= SEQUENCE { + prtAlertIndex Integer32, + prtAlertSeverityLevel PrtAlertSeverityLevelTC, + prtAlertTrainingLevel PrtAlertTrainingLevelTC, + prtAlertGroup PrtAlertGroupTC, + prtAlertGroupIndex Integer32, + prtAlertLocation Integer32, + prtAlertCode PrtAlertCodeTC, + prtAlertDescription PrtLocalizedDescriptionStringTC, + prtAlertTime TimeTicks + } + +prtAlertIndex OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. The MAX-ACCESS has + -- been changed from not accessible to allow the object to be + -- included (as originally in RFC 1759) in the trap bindings. + + SYNTAX Integer32 (1..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The index value used to determine which alerts have been added + or removed from the alert table. This is an incrementing + integer initialized to 1 when the printer is reset. (i.e., The + first event placed in the alert table after a reset of the + printer shall have an index value of 1.) When the printer adds + an alert to the table, that alert is assigned the next higher + integer value from the last item entered into the table. If + the index value reaches its maximum value, the next index value + used must be 1. + + NOTE: The management application will read the alert table when + a trap or event notification occurs or at a periodic rate and + then parse the table to determine if any new entries were added + by comparing the last known index value with the current + highest index value. The management application will then + update its copy of the alert table. When the printer discovers + that an alert is no longer active, the printer shall remove the + + + +Bergman, et al. Standards Track [Page 130] + +RFC 3805 Printer MIB v2 June 2004 + + + row for that alert from the table and shall reduce the number + of rows in the table. The printer may add or delete any number + of rows from the table at any time. The management station can + detect when binary change alerts have been deleted by + requesting an attribute of each alert, and noting alerts as + deleted when that retrieval is not possible. The objects + 'prtAlertCriticalEvents'and 'prtAlertAllEvents' in the + 'prtGeneralTable' reduce the need for management applications + to scan the 'prtAlertTable'. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtAlertEntry 1 } + +prtAlertSeverityLevel OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtAlertSeverityLevelTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The level of severity of this alert table entry. The printer + determines the severity level assigned to each entry into the + table." + ::= { prtAlertEntry 2 } + +prtAlertTrainingLevel OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtAlertTrainingLevelTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "See TEXTUAL-CONVENTION PrtAlertTrainingLevelTC. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtAlertEntry 3 } + +prtAlertGroup OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtAlertGroupTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The type of sub-unit within the printer model that this alert + is related. Input, output, and markers are examples of printer + + + +Bergman, et al. Standards Track [Page 131] + +RFC 3805 Printer MIB v2 June 2004 + + + model groups, i.e., examples of types of sub-units. Wherever + possible, these enumerations match the sub-identifier that + identifies the relevant table in the printmib." + ::= { prtAlertEntry 4 } + +prtAlertGroupIndex OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-1..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The low-order index of the row within the table identified + by prtAlertGroup that represents the sub-unit of the printer + that caused this alert, or -1 if not applicable. The + combination of the prtAlertGroup and the prtAlertGroupIndex + defines exactly which printer sub-unit caused the alert; for + example, Input #3, Output#2, and Marker #1. Every object in + this MIB is indexed with hrDeviceIndex and optionally, another + index variable. If this other index variable is present in the + table that generated the alert, it will be used as the value + for this object. Otherwise, this value shall be -1. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtAlertEntry 5 } + +prtAlertLocation OBJECT-TYPE + -- NOTE: In RFC 1759, the range was not defined. + SYNTAX Integer32 (-2..2147483647) + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The sub-unit location that is defined by the printer + manufacturer to further refine the location of this alert + within the designated sub-unit. The location is used in + conjunction with the Group and GroupIndex values; for example, + there is an alert in Input #2 at location number 7. The value + (-2) indicates unknown. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtAlertEntry 6 } + +prtAlertCode OBJECT-TYPE + -- NOTE: In RFC 1759, the enumeration values were implicitly + -- defined by this object. + SYNTAX PrtAlertCodeTC + MAX-ACCESS read-only + + + +Bergman, et al. Standards Track [Page 132] + +RFC 3805 Printer MIB v2 June 2004 + + + STATUS current + DESCRIPTION + "See associated TEXTUAL-CONVENTION PrtAlertCodeTC. + + NOTE: The above description has been modified from RFC 1759 + for clarification." + ::= { prtAlertEntry 7 } + +prtAlertDescription OBJECT-TYPE + -- In RFC 1759, the SYNTAX was OCTET STRING. This has been changed + -- to a TC to better support localization of the object. + SYNTAX PrtLocalizedDescriptionStringTC + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "A description of this alert entry in the localization + specified by prtGeneralCurrentLocalization. The description is + provided by the printer to further elaborate on the enumerated + alert or provide information in the case where the code is + classified as 'other' or 'unknown'. The printer is required to + return a description string but the string may be a null + string." + ::= { prtAlertEntry 8 } + +prtAlertTime OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "The value of sysUpTime at the time that this alert was + generated." + ::= { prtAlertEntry 9 } + +printerV1Alert OBJECT-IDENTITY + STATUS current + DESCRIPTION + "The value of the enterprise-specific OID in an SNMPv1 trap + sent signaling a critical event in the prtAlertTable." + ::= { prtAlert 2 } + +printerV2AlertPrefix OBJECT IDENTIFIER ::= { printerV1Alert 0 } + +printerV2Alert NOTIFICATION-TYPE + OBJECTS { prtAlertIndex, prtAlertSeverityLevel, prtAlertGroup, + prtAlertGroupIndex, prtAlertLocation, prtAlertCode } + STATUS current + DESCRIPTION + "This trap is sent whenever a critical event is added to the + + + +Bergman, et al. Standards Track [Page 133] + +RFC 3805 Printer MIB v2 June 2004 + + + prtAlertTable. + + NOTE: The prtAlertIndex object was redundantly included in the + bindings of the 'printerV2Alert' notification in RFC 1759, even + though the value exists in the instance qualifier of all the + other bindings. This object has been retained to provide + compatiblity with existing RFC 1759 implementaions." + ::= { printerV2AlertPrefix 1 } + +-- Note that the SNMPv2 to SNMPv1 translation rules dictate that +-- the preceding structure will result in SNMPv1 traps of the +-- following form: +-- +-- printerAlert TRAP-TYPE +-- ENTERPRISE printerV1Alert +-- VARIABLES { prtAlertIndex, prtAlertSeverityLevel, +-- prtAlertGroup, prtAlertGroupIndex, +-- prtAlertLocation, prtAlertCode } +-- DESCRIPTION +-- "This trap is sent whenever a critical event is added +-- to the prtAlertTable." +-- ::= 1 + +-- Conformance Information + +prtMIBConformance OBJECT IDENTIFIER ::= { printmib 2 } + +-- compliance statements + +prtMIBCompliance MODULE-COMPLIANCE + + STATUS current + DESCRIPTION + "The compliance statement for agents that implement the + printer MIB as defined by RFC 1759." + MODULE -- this module + MANDATORY-GROUPS { prtGeneralGroup, prtInputGroup, + prtOutputGroup, + prtMarkerGroup, prtMediaPathGroup, + prtChannelGroup, prtInterpreterGroup, + prtConsoleGroup, prtAlertTableGroup } + OBJECT prtGeneralReset + SYNTAX INTEGER { + notResetting(3), + resetToNVRAM(5) + } + DESCRIPTION + "It is conformant to implement just these two states in this + + + +Bergman, et al. Standards Track [Page 134] + +RFC 3805 Printer MIB v2 June 2004 + + + object. Any additional states are optional." + + OBJECT prtConsoleOnTime + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtConsoleOffTime + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + ::= { prtMIBConformance 1 } + +prtMIB2Compliance MODULE-COMPLIANCE + STATUS current + DESCRIPTION + "The compliance statement for agents that implement the + printer MIB V2." + -- The changes from RFC 1759 fall into 2 categories: + -- 1. New objects plus existing objects with a MIN-ACCESS of + -- read-only are included. Existing objects have been added + -- to this category due to feedback from implementers and + -- interoperability testing. This allows products to be + -- be designed with a higher degree of SNMP security. + -- 2. New object groups have been added to include all new + -- objects in this MIB. All new object groups are optional. + -- Any MIB that is compliant with RFC 1759 will also be + -- compliant with this version of the MIB. + MODULE -- this module + MANDATORY-GROUPS { prtGeneralGroup, prtInputGroup, + prtOutputGroup, + prtMarkerGroup, prtMediaPathGroup, + prtChannelGroup, prtInterpreterGroup, + prtConsoleGroup, prtAlertTableGroup } + OBJECT prtGeneralReset + SYNTAX INTEGER { + notResetting(3), + resetToNVRAM(5) + } + DESCRIPTION + "It is conformant to implement just these two states in this + object. Any additional states are optional." + + OBJECT prtGeneralCurrentLocalization + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + + + +Bergman, et al. Standards Track [Page 135] + +RFC 3805 Printer MIB v2 June 2004 + + + OBJECT prtGeneralCurrentOperator + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtGeneralServicePerson + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtGeneralPrinterName + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtGeneralSerialNumber + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputDefaultIndex + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputMediaDimFeedDirDeclared + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputMaxCapacity + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputCurrentLevel + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputMediaName + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputName + MIN-ACCESS read-only + DESCRIPTION + + + +Bergman, et al. Standards Track [Page 136] + +RFC 3805 Printer MIB v2 June 2004 + + + "It is conformant to implement this object as read-only" + + OBJECT prtInputSecurity + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputMediaWeight + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputMediaType + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputMediaColor + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputMediaFormParts + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputDefaultIndex + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputMaxCapacity + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputRemainingCapacity + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputName + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputSecurity + + + +Bergman, et al. Standards Track [Page 137] + +RFC 3805 Printer MIB v2 June 2004 + + + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputMaxDimFeedDir + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputMaxDimXFeedDir + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputMinDimFeedDir + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputMinDimXFeedDir + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputStackingOrder + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputPageDeliveryOrientation + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputBursting + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputDecollating + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtOutputPageCollated + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + + +Bergman, et al. Standards Track [Page 138] + +RFC 3805 Printer MIB v2 June 2004 + + + OBJECT prtOutputOffsetStacking + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtMarkerDefaultIndex + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtMarkerSuppliesMaxCapacity + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtMarkerSuppliesLevel + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtMediaPathDefaultIndex + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtChannelCurrentJobCntlLangIndex + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtChannelDefaultPageDescLangIndex + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtChannelState + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtChannelIfIndex + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInterpreterDefaultOrientation + MIN-ACCESS read-only + DESCRIPTION + + + +Bergman, et al. Standards Track [Page 139] + +RFC 3805 Printer MIB v2 June 2004 + + + "It is conformant to implement this object as read-only" + + OBJECT prtInterpreterDefaultCharSetIn + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInterpreterDefaultCharSetOut + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtConsoleLocalization + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtConsoleDisable + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtConsoleDisplayBufferText + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtConsoleOnTime + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtConsoleOffTime + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtAlertIndex + MIN-ACCESS accessible-for-notify + DESCRIPTION + "It is conformant to implement this object as + accessible-for-notify " + + GROUP prtResponsiblePartyGroup + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtExtendedInputGroup + + + +Bergman, et al. Standards Track [Page 140] + +RFC 3805 Printer MIB v2 June 2004 + + + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtInputMediaGroup + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtExtendedOutputGroup + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtOutputDimensionsGroup + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtOutputFeaturesGroup + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtMarkerSuppliesGroup + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtMarkerColorantGroup + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtAlertTimeGroup + DESCRIPTION + "This group is unconditionally optional." + + -- the prtResponsiblePartyGroup, prtExtendedInputGroup, + -- prtInputMediaGroup, prtExtendedOutputGroup, + -- prtOutputDimensionsGroup, prtOutputFeaturesGroup, + -- prtMarkerSuppliesGroup, prtMarkerColorantGroup, and the + -- prtAlertTimeGroup are completely optional. However, it is + -- strongly RECOMMENDED that the prtAlertTimeGroup be implemented. + + -- New to version 2 of this printer MIB: + OBJECT prtAuxiliarySheetStartupPage + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtAuxiliarySheetBannerPage + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + + +Bergman, et al. Standards Track [Page 141] + +RFC 3805 Printer MIB v2 June 2004 + + + OBJECT prtInputMediaLoadTimeout + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + OBJECT prtInputNextIndex + MIN-ACCESS read-only + DESCRIPTION + "It is conformant to implement this object as read-only" + + GROUP prtAuxiliarySheetGroup + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtInputSwitchingGroup + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtGeneralV2Group + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtAlertTableV2Group + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtChannelV2Group + DESCRIPTION + "This group is unconditionally optional." + + GROUP prtAlertTrapGroup + DESCRIPTION + "This group is unconditionally optional." + ::= { prtMIBConformance 3 } + +prtMIBGroups OBJECT IDENTIFIER ::= { prtMIBConformance 2 } +-- These groups are from RFC 1759 and are applicable to Printer MIB V2 + +prtGeneralGroup OBJECT-GROUP + OBJECTS { prtGeneralConfigChanges, + prtGeneralCurrentLocalization, + prtGeneralReset, prtCoverDescription, + prtCoverStatus, + prtLocalizationLanguage, prtLocalizationCountry, + prtLocalizationCharacterSet, prtStorageRefIndex, + prtDeviceRefIndex } + STATUS current + DESCRIPTION + + + +Bergman, et al. Standards Track [Page 142] + +RFC 3805 Printer MIB v2 June 2004 + + + "The general printer group." + ::= { prtMIBGroups 1 } + +prtResponsiblePartyGroup OBJECT-GROUP + OBJECTS { prtGeneralCurrentOperator, prtGeneralServicePerson } + STATUS current + DESCRIPTION + "The responsible party group contains contact information for + humans responsible for the printer." + ::= { prtMIBGroups 2 } + +prtInputGroup OBJECT-GROUP + OBJECTS { prtInputDefaultIndex, prtInputType, prtInputDimUnit, + prtInputMediaDimFeedDirDeclared, + prtInputMediaDimXFeedDirDeclared, + prtInputMediaDimFeedDirChosen, + prtInputMediaDimXFeedDirChosen, prtInputCapacityUnit, + prtInputMaxCapacity, prtInputCurrentLevel, prtInputStatus, + prtInputMediaName } + STATUS current + DESCRIPTION + "The input group." + ::= { prtMIBGroups 3 } + +prtExtendedInputGroup OBJECT-GROUP + OBJECTS { prtInputName, prtInputVendorName, prtInputModel, + prtInputVersion, prtInputSerialNumber, + prtInputDescription, prtInputSecurity } + STATUS current + DESCRIPTION + "The extended input group." + ::= { prtMIBGroups 4 } + +prtInputMediaGroup OBJECT-GROUP + OBJECTS { prtInputMediaWeight, prtInputMediaType, + prtInputMediaColor, prtInputMediaFormParts } + STATUS current + DESCRIPTION + "The input media group." + ::= { prtMIBGroups 5 } + +prtOutputGroup OBJECT-GROUP + OBJECTS { prtOutputDefaultIndex, prtOutputType, + prtOutputCapacityUnit, prtOutputMaxCapacity, + prtOutputRemainingCapacity, prtOutputStatus } + STATUS current + DESCRIPTION + "The output group." + + + +Bergman, et al. Standards Track [Page 143] + +RFC 3805 Printer MIB v2 June 2004 + + + ::= { prtMIBGroups 6 } + +prtExtendedOutputGroup OBJECT-GROUP + OBJECTS { prtOutputName, prtOutputVendorName, prtOutputModel, + prtOutputVersion, prtOutputSerialNumber, + prtOutputDescription, prtOutputSecurity } + STATUS current + DESCRIPTION + "The extended output group." + ::= { prtMIBGroups 7 } + +prtOutputDimensionsGroup OBJECT-GROUP + OBJECTS { prtOutputDimUnit, prtOutputMaxDimFeedDir, + prtOutputMaxDimXFeedDir, prtOutputMinDimFeedDir, + prtOutputMinDimXFeedDir } + STATUS current + DESCRIPTION + "The output dimensions group" + ::= { prtMIBGroups 8 } + +prtOutputFeaturesGroup OBJECT-GROUP + OBJECTS { prtOutputStackingOrder, + prtOutputPageDeliveryOrientation, prtOutputBursting, + prtOutputDecollating, prtOutputPageCollated, + prtOutputOffsetStacking } + STATUS current + DESCRIPTION + "The output features group." + ::= { prtMIBGroups 9 } + +prtMarkerGroup OBJECT-GROUP + OBJECTS { prtMarkerDefaultIndex, prtMarkerMarkTech, + prtMarkerCounterUnit, prtMarkerLifeCount, + prtMarkerPowerOnCount, prtMarkerProcessColorants, + prtMarkerSpotColorants, prtMarkerAddressabilityUnit, + prtMarkerAddressabilityFeedDir, + prtMarkerAddressabilityXFeedDir, prtMarkerNorthMargin, + prtMarkerSouthMargin, prtMarkerWestMargin, + prtMarkerEastMargin, prtMarkerStatus } + STATUS current + DESCRIPTION + "The marker group." + ::= { prtMIBGroups 10 } + +prtMarkerSuppliesGroup OBJECT-GROUP + OBJECTS { prtMarkerSuppliesMarkerIndex, + prtMarkerSuppliesColorantIndex, prtMarkerSuppliesClass, + prtMarkerSuppliesType, prtMarkerSuppliesDescription, + + + +Bergman, et al. Standards Track [Page 144] + +RFC 3805 Printer MIB v2 June 2004 + + + prtMarkerSuppliesSupplyUnit, + prtMarkerSuppliesMaxCapacity, prtMarkerSuppliesLevel } + STATUS current + DESCRIPTION + "The marker supplies group." + ::= { prtMIBGroups 11 } + +prtMarkerColorantGroup OBJECT-GROUP + OBJECTS { prtMarkerColorantMarkerIndex, prtMarkerColorantRole, + prtMarkerColorantValue, prtMarkerColorantTonality } + STATUS current + DESCRIPTION + "The marker colorant group." + ::= { prtMIBGroups 12 } + +prtMediaPathGroup OBJECT-GROUP + OBJECTS { prtMediaPathDefaultIndex, prtMediaPathMaxSpeedPrintUnit, + prtMediaPathMediaSizeUnit, prtMediaPathMaxSpeed, + prtMediaPathMaxMediaFeedDir, + prtMediaPathMaxMediaXFeedDir, + prtMediaPathMinMediaFeedDir, + prtMediaPathMinMediaXFeedDir, prtMediaPathType, + prtMediaPathDescription, prtMediaPathStatus} + STATUS current + DESCRIPTION + "The media path group." + ::= { prtMIBGroups 13 } + +prtChannelGroup OBJECT-GROUP + OBJECTS { prtChannelType, prtChannelProtocolVersion, + prtChannelCurrentJobCntlLangIndex, + prtChannelDefaultPageDescLangIndex, prtChannelState, + prtChannelIfIndex, prtChannelStatus + } + STATUS current + DESCRIPTION + "The channel group." + ::= { prtMIBGroups 14 } + +prtInterpreterGroup OBJECT-GROUP + OBJECTS { prtInterpreterLangFamily, prtInterpreterLangLevel, + prtInterpreterLangVersion, prtInterpreterDescription, + prtInterpreterVersion, prtInterpreterDefaultOrientation, + prtInterpreterFeedAddressability, + prtInterpreterXFeedAddressability, + prtInterpreterDefaultCharSetIn, + prtInterpreterDefaultCharSetOut, prtInterpreterTwoWay } + STATUS current + + + +Bergman, et al. Standards Track [Page 145] + +RFC 3805 Printer MIB v2 June 2004 + + + DESCRIPTION + "The interpreter group." + ::= { prtMIBGroups 15 } + +prtConsoleGroup OBJECT-GROUP + OBJECTS { prtConsoleLocalization, prtConsoleNumberOfDisplayLines, + prtConsoleNumberOfDisplayChars, prtConsoleDisable, + prtConsoleDisplayBufferText, prtConsoleOnTime, + prtConsoleOffTime, prtConsoleColor, + prtConsoleDescription } + STATUS current + DESCRIPTION + "The console group." + ::= { prtMIBGroups 16 } + +prtAlertTableGroup OBJECT-GROUP + OBJECTS { prtAlertSeverityLevel, prtAlertTrainingLevel, + prtAlertGroup, prtAlertGroupIndex, prtAlertLocation, + prtAlertCode, prtAlertDescription } + STATUS current + DESCRIPTION + "The alert table group." + ::= { prtMIBGroups 17 } + +prtAlertTimeGroup OBJECT-GROUP + OBJECTS { prtAlertTime } + STATUS current + DESCRIPTION + "The alert time group. Implementation of prtAlertTime is + strongly RECOMMENDED." + ::= { prtMIBGroups 18 } + +prtMIB2Groups OBJECT IDENTIFIER ::= { prtMIBConformance 4 } +-- These groups are unique to Printer MIB V2 + +prtAuxiliarySheetGroup OBJECT-GROUP + OBJECTS { prtAuxiliarySheetStartupPage, + prtAuxiliarySheetBannerPage } + STATUS current + DESCRIPTION + "The auxiliary sheet group." + ::= { prtMIBGroups 19 } + +prtInputSwitchingGroup OBJECT-GROUP + OBJECTS { prtInputMediaLoadTimeout, prtInputNextIndex } + STATUS current + DESCRIPTION + "The input switching group." + + + +Bergman, et al. Standards Track [Page 146] + +RFC 3805 Printer MIB v2 June 2004 + + + ::= { prtMIBGroups 20 } + +prtGeneralV2Group OBJECT-GROUP + OBJECTS { prtGeneralPrinterName, prtGeneralSerialNumber } + STATUS current + DESCRIPTION + "The general printer group with new v2 objects." + ::= { prtMIBGroups 21 } + +prtAlertTableV2Group OBJECT-GROUP + OBJECTS { prtAlertIndex, prtAlertCriticalEvents, prtAlertAllEvents } + STATUS current + DESCRIPTION + "The alert table group with new v2 objects and prtAlertIndex + changed to MAX-ACCESS of 'read-only' for inclusion in the trap + bindings (as originally defined in RFC 1759)." + + ::= { prtMIBGroups 22 } + +prtChannelV2Group OBJECT-GROUP + OBJECTS { prtChannelInformation } + STATUS current + DESCRIPTION + "The channel group with a new v2 object." + ::= { prtMIBGroups 23 } + +prtAlertTrapGroup NOTIFICATION-GROUP + NOTIFICATIONS { printerV2Alert } + STATUS current + DESCRIPTION + "The alert trap group." + ::= { prtMIBGroups 24 } + +END + +7. IANA Considerations + + The initial version the IANA Printer MIB defined in section 5 of this + document is to be archived by IANA and subsequently maintained + according to the Process specified in section 2.4.1 of this document. + The most current and authoritative version of the IANA Printer MIB is + available at: + + http://www.iana.org/assignments/ianaprinter-mib + +8. Internationalization Considerations + + See section 2.2.1.1, 'International Considerations'. + + + +Bergman, et al. Standards Track [Page 147] + +RFC 3805 Printer MIB v2 June 2004 + + +9. Security Considerations + + There are a number of management objects defined in this MIB module + with a MAX-ACCESS clause of read-write and/or read-create. Such + objects may be considered sensitive or vulnerable in some network + environments. The support for SET operations in a non-secure + environment without proper protection can have a negative effect on + network operations. These are the tables and objects and their + sensitivity/vulnerability: + + prtGeneralTable: + prtGeneralCurrentLocalization - Possible data loss + prtGeneralReset - Possible data loss + prtGeneralCurrentOperator - Possible severe inconvenience + prtGeneralServicePerson - Possible severe inconvenience + prtInputDefaultIndex - Possible data loss + prtOutputDefaultIndex - Possible minor inconvenience + prtMarkerDefaultIndex - Possible minor inconvenience + prtMediaPathDefaultIndex - Possible minor inconvenience + prtConsoleLocalization - Possible severe inconvenience + prtConsoleDisable - Possible severe inconvenience + prtAuxiliarySheetStartupPage - Possible minor inconvenience + prtAuxiliarySheetBannerPage - Possible minor inconvenience + prtGeneralPrinterName - Possible severe inconvenience + prtGeneralSerialNumber - Possible severe inconvenience + prtInputTable: + prtInputMediaDimFeedDirDeclared - Possible data loss + prtInputMediaDimXFeedDirDeclared - Possible data loss + prtInputMaxCapacity - Possible minor inconvenience + prtInputCurrentLevel - Possible minor inconvenience + prtInputMediaName - Possible minor inconvenience + prtInputName - Possible minor inconvenience + prtInputSecurity - Possible minor inconvenience + prtInputMediaWeight - Possible minor inconvenience + prtInputMediaType - Possible minor inconvenience + prtInputMediaColor - Possible minor inconvenience + prtInputMediaFormParts - Possible minor inconvenience + prtInputMediaLoadTimeout - Possible minor inconvenience + prtInputNextIndex - Possible minor inconvenience + prtOutputTable + prtOutputMaxCapacity - Possible minor inconvenience + prtOutputRemainingCapacity - Possible minor inconvenience + prtOutputName - Possible minor inconvenience + prtOutputSecurity - Possible minor inconvenience + prtOutputMaxDimFeedDir - Possible minor inconvenience + prtOutputMaxDimXFeedDir - Possible minor inconvenience + prtOutputMinDimFeedDir - Possible minor inconvenience + prtOutputMinDimXFeedDir - Possible minor inconvenience + + + +Bergman, et al. Standards Track [Page 148] + +RFC 3805 Printer MIB v2 June 2004 + + + prtOutputStackingOrder - Possible minor inconvenience + prtOutputPageDeliveryOrientation - Possible minor inconvenience + prtOutputBursting - Possible minor inconvenience + prtOutputDecollating - Possible minor inconvenience + prtOutputPageCollated - Possible minor inconvenience + prtOutputOffsetStacking - Possible minor inconvenience + prtMarkerSuppliesTable + prtMarkerSuppliesMaxCapacity - Possible minor inconvenience + prtMarkerSuppliesLevel - Possible minor inconvenience + prtChannelTable + prtChannelCurrentJobCntlLangIndex - Possible data loss + prtChannelDefaultPageDescLangIndex - Possible data loss + prtChannelState - Possible minor inconvenience + prtChannelIfIndex - Possible minor inconvenience + prtInterpreterTable + prtInterpreterDefaultOrientation - Possible data loss + prtInterpreterDefaultCharSetIn - Possible data loss + prtInterpreterDefaultCharSetOut - Possible minor inconvenience + prtConsoleDisplayBufferTable + prtConsoleDisplayBufferText - Possible minor inconvenience + prtConsoleLightTable + prtConsoleOnTime - Possible minor inconvenience + prtConsoleOffTime - Possible minor inconvenience + + SNMP versions prior to SNMPv3 did not include adequate security. + Even if the network itself is secure (for example by using IPSec), + even then, there is no control as to who on the secure network is + allowed to access and GET/SET (read/change/create/delete) the objects + in this MIB module. + + It is RECOMMENDED that implementers consider the security features as + provided by the SNMPv3 framework (see [RFC3410], section 8), + including full support for the SNMPv3 cryptographic mechanisms (for + authentication and privacy). + + Further, deployment of SNMP versions prior to SNMPv3 is NOT + RECOMMENDED. Instead, it is RECOMMENDED to deploy SNMPv3 and to + enable cryptographic security. It is then a customer/operator + responsibility to ensure that the SNMP entity giving access to an + instance of this MIB module is properly configured to give access to + the objects only to those principals (users) that have legitimate + rights to indeed GET or SET (change/create/delete) them. + + Where the operational capability of the printing device are + especially vulnerable or difficult to administer, certain objects + within this MIB have been tagged as READ-ONLY, preventing + modification. Further, for all READ-WRITE objects within the MIB, + the working group has included specific conformance guidelines + + + +Bergman, et al. Standards Track [Page 149] + +RFC 3805 Printer MIB v2 June 2004 + + + stating that vendors are free to implement these objects as READ- + ONLY. This conformance allowance should cover cases where specific + vendor vulnerabilities may differ from product to product. (See + conformance section with regards to MIN-ACCESS clauses). + +10. References + +10.1. Normative References + + [ASCII] ANSI, "Coded Character Set - 7-bit American Standard Code + for Information Interchange", ANSI X3.4-1986. + + [CHARSET] IANA Character Set Registry: + http://www.iana.org/assignments/character-sets + + [CHARMIB] IANA Character Set MIB: + http://www.iana.org/assignments/ianacharset-mib + + [ISO10175] ISO, "Document Printing Application (DPA)", ISO 10175, + 1996. + + [ISO10646] ISO, "Universal Multiple-Octet Coded Character Set (UCS) - + Part 1: Architecture and Basic Multilingual Plane", ISO + 10646-1, September 2000. ISO, "Universal Multiple-Octet + Coded Character Set (UCS) - Part 2: Supplemental Planes", + ISO 10646-2, January 2001. + + [PWGMEDIA] IEEE-ISTO PWG "The Printer Working Group Standard for + Media Standardized Names", IEEE-ISTO PWG 5101.1-2002. + + [RFC1213] McCloghrie, K. and M. Rose, "Management Information Base + for Network Management of TCP/IP-based internets: MIB-II", + STD 17, RFC 1213, March 1991. + + [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", BCP 14, RFC 2119, March 1997. + + [RFC2277] Alvestrand, H., "IETF Policy on Character Sets and + Languages", BCP 18, RFC 2277, January 1998. + + [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO + 10646", RFC 3629, November 2003. + + + + + + + + + +Bergman, et al. Standards Track [Page 150] + +RFC 3805 Printer MIB v2 June 2004 + + + [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an + IANA Considerations Section in RFCs", BCP 26, RFC 2434, + October 1998. + + [RFC2578] McCloghrie, K., Perkins, D., and J. Schoenwaelder, + "Structure of Management Information Version 2 (SMIv2)", + STD 58, RFC 2578, April 1999. + + [RFC2579] McCloghrie, K., Perkins, D., and J. Schoenwaelder, + "Textual Conventions for SMIv2", STD 58, RFC 2579, April + 1999. + + [RFC2580] McCloghrie, K., Perkins, D., and J. Schoenwaelder, + "Conformance Statements for SMIv2", STD 58, RFC 2580, + April 1999. + + [RFC2790] Waldbusser, S. and P. Grillo, "Host Resources MIB", RFC + 2790, March 2000. + + [RFC2863] McCloghrie, K. and F. Kastenholz, "The Interfaces Group + MIB", RFC 2863, June 2000. + + [RFC3806] Bergman, R., Lewis, H., and I. McDonald, "Printer + Finishing MIB", RFC 3806, June 2004. + +10.2. Informative References + + [APPLEMAC] Apple staff, "Inside MacIntosh: Networking", 1994. + + [RFC854] Postel, J. and J. Reynolds, "Telnet Protocol + Specification", STD 8, RFC 854, May 1983. + + [RFC959] Postel, J. and J. Reynolds, "File Transfer Protocol", STD + 9, RFC 959, October 1985. + + [RFC1179] McLaughlin, L., "Line printer daemon protocol", RFC 1179, + August 1990. + + [RFC1350] Sollins, K., "The TFTP Protocol (Revision 2)", STD 33, RFC + 1350, July 1992. + + [RFC1945] Berners-Lee, T., Fielding, R., and H. Frystyk, "Hypertext + Transfer Protocol - HTTP/1.0", RFC 1945, May 1996. + + [RFC2246] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0", + RFC 2246, 1999. + + + + + +Bergman, et al. Standards Track [Page 151] + +RFC 3805 Printer MIB v2 June 2004 + + + [RFC2396] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform + Resource Identifiers (URI): Generic Syntax", RFC 2396, + August 1998. + + [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., + Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext + Transfer Protocol - HTTP/1.1", RFC 2616, June 1999. + + [RFC2821] Klensin, J., Ed., "Simple Mail Transfer Protocol", RFC + 2821, April 2001. + + [RFC2822] Resnick, P., Ed., "Internet Message Format", RFC 2822, + April 2001. + + [RFC2910] Herriot, R., Ed., Butler, S., Moore, P., Turner, R., and + J. Wenn, "Internet Printing Protocol/1.1: Encoding and + Transport", RFC 2910, September 2000. + + [RFC2911] Hastings, T., Ed., Herriot, R., deBry, R., Isaacson, S., + and P. Powell, "Internet Printing Protocol/1.1: Model and + Semantics", RFC 2911, September 2000. + + [RFC2978] Freed, N. and J. Postel, "IANA Charset Registration + Procedures", BCP 19, RFC 2978, October 2000. + + [RFC3232] Reynolds, J., Ed., "Assigned Numbers: RFC 1700 is + Replaced by an On-line Database", RFC 3232, January 2002. + + [RFC3285] Gahrns, M. and T. Hain, "Using Microsoft Word to create + Internet Drafts and RFCs", RFC 3285, May 2002. + + [RFC3410] Case, J., Mundy, R., Partain, D., and B. Stewart, + "Introduction and Applicability Statements for Internet- + Standard Management Framework", RFC 3410, December 2002. + + + + + + + + + + + + + + + + + +Bergman, et al. Standards Track [Page 152] + +RFC 3805 Printer MIB v2 June 2004 + + +Appendix A - Glossary of Terms + + Addressability - On the marker, the number of distinct marking units + (pels) per unit of addressability unit that can be set; for example, + 300 dots per inch is expressed as 300 per 1000 Thousandths Of Inches + and 4 dots per millimeter is 4 per 1000 Micrometers. Addressability + is not resolution because marks that are one addressability position + apart may not be independently resolvable by the eye due to factors + such as gain in the area of marks so they overlap or nearly touch. + + Alert - A reportable event for which there is an entry in the alert + table. + + Bin - An output sub-unit which may or may not be removable. + + Binary Change Event - An event which comes in pairs; the leading edge + event and the trailing edge event. The leading edge event enters a + state from which there is only one exit. A binary change event may + be critical or non-critical. See unary change event. + + Bursting - The process by which continuous media is separated into + individual sheets, typically by bursting along pre-formed + perforations. + + Channel - A term used to describe a single source of data which is + presented to a printer. The model that we use in describing a + printer allows for an arbitrary number of channels. Multiple + channels can exist on the same physical port. This is commonly done + over Ethernet ports where EtherTalk, TCP/IP, and SPX/IPX protocols + can be supplying different data streams simultaneously to a single + printer on the same physical port. + + Collation - In multiple copy output, placing the pages from separate + copies into separate ordered sets, ready for binding. + + Control Language - A data syntax or language for controlling the + printer through the print data channel. + + Critical Alert - An alert triggered by an event which leads to a + state in which printing is no longer possible; the printer is + stopped. + + Decollating - The process by which the individual parts within a + multi-part form are separated and sorted into separate stacks for + each part. + + Description - Information about the configuration and capabilities of + the printer and its various sub-units. + + + +Bergman, et al. Standards Track [Page 153] + +RFC 3805 Printer MIB v2 June 2004 + + + DPA - ISO 10175 Document Printing Application standard. A standard + for a client server protocol for a print system, including (1) + submitting print jobs to and (2) managing print jobs in a spooler. + + Event - A state change in the printer. + + Group - A collection of objects that represent a type of sub-unit of + the printer. + + Host Resources MIB - See [RFC2790]. + + IANA - Internet Assigned Numbers Authority. See [RFC3232]. + + Idempotent - Idempotence is the property of an operation that results + in the same state no matter how many times it is executed (at least + once). This is a property that is shared by true databases in which + operations on data items only change the state of the data item and + do not have other side effects. Because the SNMP data model is that + of operations on a database, SNMP MIB objects should be assumed to be + idempotent. If a MIB object is defined in a non-idempotent way, the + this data model can break in subtle ways when faced with packet loss, + multiple managers, and other common conditions. + + In order to fulfill the common need for actions to result from + SNMP Set operations, SNMP MIB objects can be modeled such that the + change in state from one state to another has the side effect of + causing an action. It is important to note that with this model, + an SNMP operation that sets a value equal to its current value + will cause no action. This retains the idempotence of a single + command, while allowing actions to be initiated by SNMP SET + requests. + + Input - A tray or bin from which instances of the media are obtained + and fed into the Media Path. + + Interpreter - The embodiment of an algorithm that processes a data + stream consisting of a Page Description Language (PDL) and/or a + Control Language. + + Localization - The specification of human language, country, and + character set needed to present information to people in their native + languages. + + Management Application (a.k.a. Manager) - A program which queries and + controls one or more managed nodes. + + Management Station - A physical computer on which one or more + management applications can run. + + + +Bergman, et al. Standards Track [Page 154] + +RFC 3805 Printer MIB v2 June 2004 + + + Media Path - The mechanisms that transport instances of the media + from an input, through the marker, possibly through media buffers and + duplex pathways, out to the output with optional finishing applied. + The inputs and outputs are not part of the Media Path. + + Non-critical Alert - An alert triggered by a reportable event which + does not lead to a state in which printing is no longer possible; + such an alert may lead to a state from which printing may no longer + be possible in the future, such as the low toner state or the alert + may be pure informational, such as a configuration change at the + printer. + + Output - A bin or stacker which accepts instances of media that have + been processed by a printer. + + Page Description Language (PDL) - A data syntax or language for the + electronic representation of a document as a sequence of page images. + + Printer - A physical device that takes media from an input source, + produces marks on that media according to some page description or + page control language and puts the result in some output destination, + possibly with finishing applied. + + Printing - The entire process of producing a printed document from + generation of the file to be printed, choosing printing properties, + selection of a printer, routing, queuing, resource management, + scheduling, and finally printing including notifying the user. + + Reportable event - An event that is deemed of interest to a + management station watching the printer. + + Status - Information regarding the current operating state of the + printer and its various sub-units. This is an abstraction of the + exact physical condition of the printer. + + Sub-mechanism - A distinguishable part of a sub-unit. + + Sub-unit - A part of the printer which may be a physical part, such + as one of the input sources or a logical part such as an interpreter. + + Tray - An input sub-unit which is typically removable. + + Unary Change Event - An event that indicates a change of state of the + printer, but to a state which is (often) just as valid as the state + that was left, and from which no return is necessary. See binary + change event. + + + + + +Bergman, et al. Standards Track [Page 155] + +RFC 3805 Printer MIB v2 June 2004 + + + Visible state - The portion of the state of the printer that can be + examined by a management application. + + Warning - A non-critical alert. See non-critical alert. + +Appendix B - Media Size Names + + The PWG Standardized Media Names specification [PWGMEDIA], section 5 + Self Describing Names, contains the currently recommended media size + names. This appendix lists the standardized media size names from + ISO/IEC 10175 Document Printing Application (DPA), [ISO10175] as + presented in RFC 1759. Management applications are encouraged to use + the names from the PWG standard. However, many legacy systems exist + that use the DPA names and they are presented here for the + convenience of developers. + + A printer implementing the Printer MIB has no knowledge of these + names, however; all media sizes in the MIB are given in terms of + media dimensions as the values of prtInputMediaDimFeedDirChosen and + prtInputMediaDimXFeedDirChosen. + + String name Description + + other + + unknown + na-letter or letter North American letter size: 8.5 by 11 inches + na-legal or legal North American legal size: 8.5 by 14 inches + na-10x13-envelope North American 10x13 envelope + size: 10 by 13 inches + na-9x12-envelope North American 9x12 envelope + size: 9 by 12 inches + na-number-10-envelope North American number 10 business envelope + size: 4.125 by 9.5 inches + na-7x9-envelope North American 7x9 size: 7 by 9 inches + na-9x11-envelope North American 9x11 size: 9 by 11 inches + na-10x14-envelope North American 10x14 envelope + size: 10 by 14 inches + na-number-9-envelope North American number 9 business envelope + size: 3.875 by 8.875 inches + na-6x9-envelope North American 6x9 envelope + size: 6 by 9 inches + na-10x15-envelope North American 10x15 envelope + size: 10 by 15 inches + a engineering A size 8.5 inches by 11 inches + b engineering B size 11 inches by 17 inches + c engineering C size 17 inches by 22 inches + d engineering D size 22 inches by 34 inches + + + +Bergman, et al. Standards Track [Page 156] + +RFC 3805 Printer MIB v2 June 2004 + + + e engineering E size 34 inches by 44 inches + iso-a0 ISO A0 size: 841 mm by 1189 mm + iso-a1 ISO A1 size: 594 mm by 841 mm + iso-a2 ISO A2 size: 420 mm by 594 mm + iso-a3 ISO A3 size: 297 mm by 420 mm + iso-a4 ISO A4 size: 210 mm by 297 mm + iso-a5 ISO A5 size: 148 mm by 210 mm + iso-a6 ISO A6 size: 105 mm by 148 mm + iso-a7 ISO A7 size: 74 mm by 105 mm + iso-a8 ISO A8 size: 52 mm by 74 mm + iso-a9 ISO A9 size: 37 mm by 52 mm + iso-a10 ISO A10 size: 26 mm by 37 mm + iso-b0 ISO B0 size: 1000 mm by 1414 mm + iso-b1 ISO B1 size: 707 mm by 1000 mm + iso-b2 ISO B2 size: 500 mm by 707 mm + iso-b3 ISO B3 size: 353 mm by 500 mm + iso-b4 ISO B4 size: 250 mm by 353 mm + iso-b5 ISO B5 size: 176 mm by 250 mm + iso-b6 ISO B6 size: 125 mm by 176 mm + iso-b7 ISO B7 size: 88 mm by 125 mm + iso-b8 ISO B8 size: 62 mm by 88 mm + iso-b9 ISO B9 size: 44 mm by 62 mm + iso-b10 ISO B10 size: 31 mm by 44 mm + iso-c0 ISO C0 size: 917 mm by 1297 mm + iso-c1 ISO C1 size: 648 mm by 917 mm + iso-c2 ISO C2 size: 458 mm by 648 mm + iso-c3 ISO C3 size: 324 mm by 458 mm + iso-c4 ISO C4 size: 229 mm by 324 mm + iso-c5 ISO C5 size: 162 mm by 229 mm + iso-c6 ISO C6 size: 114 mm by 162 mm + iso-c7 ISO C7 size: 81 mm by 114 mm + iso-c8 ISO C8 size: 57 mm by 81 mm + iso-designated ISO Designated Long + size: 110 mm by 220 mm + jis-b0 JIS B0 size 1030 mm by 1456 mm + jis-b1 JIS B1 size 728 mm by 1030 mm + jis-b2 JIS B2 size 515 mm by 728 mm + jis-b3 JIS B3 size 364 mm by 515 mm + jis-b4 JIS B4 size 257 mm by 364 mm + jis-b5 JIS B5 size 182 mm by 257 mm + jis-b6 JIS B6 size 128 mm by 182 mm + jis-b7 JIS B7 size 91 mm by 128 mm + jis-b8 JIS B8 size 64 mm by 91 mm + jis-b9 JIS B9 size 45 mm by 64 mm + jis-b10 JIS B10 size 32 mm by 45 mm + + + + + + +Bergman, et al. Standards Track [Page 157] + +RFC 3805 Printer MIB v2 June 2004 + + +Appendix C - Media Names + + For the convenience of management application developers, this + appendix lists the standardized media names from ISO/IEC 10175 + Document Printing Application (DPA), [ISO10175]. Management + applications that present a dialogue for choosing media may wish to + use these names as an alternative to separately specifying, size, + color, and/or type. New names may also be created using this format + and the names defined in the PWG Standardized Media Names + specification [PWGMEDIA]. + + Using standard media names will mean that a single management + application dealing with printers from different vendors and under + different system mangers will tend to use the same names for the same + media. If selection of media by name is used, the attributes (size, + type or color) implied by the name must be explicitly mapped to the + appropriate object (prtInputMediaDimFeedDirDeclared, + prtInputMediaDimXFeedDirDeclared, prtInputMediaType and + prtInputMediaColor) in the MIB. The object prtInputMediaName is + intended for display to an operator and is purely descriptive. The + value in prtInputMediaName is not interpreted by the printer so using + a standard name for this value will not change any of the other media + attributes nor will it cause an alert if the media in the input sub- + unit does not match the name. + + Simple Name Descriptor Text + + other + unknown + iso-a4-white Specifies the ISO A4 white medium with + size: 210 mm by 297 mm as defined in ISO 216 + iso-a4-coloured Specifies the ISO A4 colored medium with + size: 210 mm by 297 mm as defined in ISO 216 + iso-a4-transparent Specifies the ISO A4 transparent medium with + size: 210 mm by 297 mm as defined in ISO 216 + iso-a3-white Specifies the ISO A3 white medium with + size: 297 mm by 420 mm as defined in ISO 216 + iso-a3-coloured Specifies the ISO A3 colored medium with + size: 297 mm by 420 mm as defined in ISO 216 + iso-a5-white Specifies the ISO A5 white medium with + size: 148 mm by 210 mm as defined in ISO 216 + iso-a5-coloured Specifies the ISO A5 colored medium with + size: 148 mm by 210 mm as defined in ISO 216 + iso-b4-white Specifies the ISO B4 white medium with + size: 250 mm by 353 mm as defined in ISO 216 + iso-b4-coloured Specifies the ISO B4 colored medium with + size: 250 mm by 353 mm as defined in ISO 216 + + + + +Bergman, et al. Standards Track [Page 158] + +RFC 3805 Printer MIB v2 June 2004 + + + iso-b5-white Specifies the ISO B5 white medium with + size: 176 mm by 250 mm as defined in ISO 216 + iso-b5-coloured Specifies the ISO B5 colored medium with + size: 176 mm by 250 mm as defined in ISO 216 + jis-b4-white Specifies the JIS B4 white medium with + size: 257 mm by 364 mm as defined in JIS P0138 + jis-b4-coloured Specifies the JIS B4 colored medium with + size: 257 mm by 364 mm as defined in JIS P0138 + jis-b5-white Specifies the JIS B5 white medium with + size: 182 mm by 257 mm as defined in JIS P0138 + jis-b5-coloured Specifies the JIS B5 colored medium with + size: 182 mm by 257 mm as defined in JIS P0138 + + The following standard values are defined for North American media: + + na-letter-white Specifies the North American letter white + medium with size: 8.5 inches by 11 inches + na-letter-coloured Specifies the North American letter colored + medium with size: 8.5 inches by 11 inches + na-letter-transparent + Specifies the North American letter + transparent medium with size: 8.5 inches + by 11 inches + na-legal-white Specifies the North American legal white + medium with size: 8.5 inches by 14 inches + na-legal-coloured Specifies the North American legal colored + medium with size: 8.5 inches by 14 inches + + The following standard values are defined for envelopes: + + iso-b5-envelope Specifies the ISO B5 envelope medium + with size: 176 mm by 250 mm + as defined in ISO 216 and ISO 269 + iso-b4-envelope Specifies the ISO B4 envelope medium + with size: 250 mm by 353 mm + as defined in ISO 216 + iso-c4-envelope Specifies the ISO C4 envelope medium + with size: 229 mm by 324 mm + as defined in ISO 216 and ISO 269 + iso-c5-envelope Specifies the ISO C5 envelope medium + with size: 162 mm by 229 mm + as defined in ISO 269 + iso-designated-long-envelope + Specifies the ISO Designated Long envelope + medium with size: 110 mm by 220 mm + as defined in ISO 269 + + + + + +Bergman, et al. Standards Track [Page 159] + +RFC 3805 Printer MIB v2 June 2004 + + + na-10x13-envelope Specifies the North American 10x13 envelope + medium with size: 10 inches by 13 inches + na-9x12-envelope Specifies the North American 9x12 envelope + medium with size: 9 inches by 12 inches + na-number-10-envelope + Specifies the North American number 10 + business envelope medium with size: 4.125 + inches by 9.5 inches + na-7x9-envelope Specifies the North American 7x9 inch envelope + + na-9x11-envelope Specifies the North American 9x11 inch envelope + + na-10x14-envelope Specifies the North American 10x14 inch envelope + + na-number-9-envelope + Specifies the North American number 9 + business envelope 3.875 by 8.875 inches + na-6x9-envelope Specifies the North American 6x9 inch envelope + + na-10x15-envelope Specifies the North American 10x15 inch envelope + + The following standard values are defined for the less commonly + used media (white-only): + + iso-a0-white Specifies the ISO A0 white medium + with size: 841 mm by 1189 mm + as defined in ISO 216 + iso-a1-white Specifies the ISO A1 white medium + with size: 594 mm by 841 mm + as defined in ISO 216 + iso-a2-white Specifies the ISO A2 white medium + with size: 420 mm by 594 mm + as defined in ISO 216 + iso-a6-white Specifies the ISO A6 white medium + with size: 105 mm by 148 mm + as defined in ISO 216 + iso-a7-white Specifies the ISO A7 white medium + with size: 74 mm by 105 mm + as defined in ISO 216 + iso-a8-white Specifies the ISO A8 white medium + with size: 52 mm by 74 mm + as defined in ISO 216 + iso-a9-white Specifies the ISO A9 white medium + with size: 39 mm by 52 mm + as defined in ISO 216 + iso-a10-white Specifies the ISO A10 white medium + with size: 26 mm by 37 mm + as defined in ISO 216 + + + +Bergman, et al. Standards Track [Page 160] + +RFC 3805 Printer MIB v2 June 2004 + + + iso-b0-white Specifies the ISO B0 white medium + with size: 1000 mm by 1414 mm + as defined in ISO 216 + iso-b1-white Specifies the ISO B1 white medium + with size: 707 mm by 1000 mm + as defined in ISO 216 + iso-b2-white Specifies the ISO B2 white medium + with size: 500 mm by 707 mm + as defined in ISO 216 + iso-b3-white Specifies the ISO B3 white medium + with size: 353 mm by 500 mm + as defined in ISO 216 + iso-b6-white Specifies the ISO B6 white medium + with size: 125 mm by 176 mm i + as defined in ISO 216 + iso-b7-white Specifies the ISO B7 white medium + with size: 88 mm by 125 mm + as defined in ISO 216 + iso-b8-white Specifies the ISO B8 white medium + with size: 62 mm by 88 mm + as defined in ISO 216 + iso-b9-white Specifies the ISO B9 white medium + with size: 44 mm by 62 mm + as defined in ISO 216 + iso-b10-white Specifies the ISO B10 white medium + with size: 31 mm by 44 mm + as defined in ISO 216 + jis-b0-white Specifies the JIS B0 white medium with size: + 1030 mm by 1456 mm + jis-b1-white Specifies the JIS B1 white medium with size: + 728 mm by 1030 mm + jis-b2-white Specifies the JIS B2 white medium with size: + 515 mm by 728 mm + jis-b3-white Specifies the JIS B3 white medium with size: + 364 mm by 515 mm + jis-b6-white Specifies the JIS B6 white medium with size: + 257 mm by 364 mm + jis-b7-white Specifies the JIS B7 white medium with size: + 182 mm by 257 mm + jis-b8-white Specifies the JIS B8 white medium with size: + 128 mm by 182 mm + jis-b9-white Specifies the JIS B9 white medium with size: + 91 mm by 128 mm + jis-b10-white Specifies the JIS B10 white medium with size: + 64 mm by 91 mm + + + + + + +Bergman, et al. Standards Track [Page 161] + +RFC 3805 Printer MIB v2 June 2004 + + + The following standard values are defined for engineering media: + a Specifies the engineering A size medium with + size: 8.5 inches by 11 inches + b Specifies the engineering B size medium with + size: 11 inches by 17 inches + c Specifies the engineering C size medium with + size: 17 inches by 22 inches + d Specifies the engineering D size medium with + size: 22 inches by 34 inches + e Specifies the engineering E size medium with + size: 34 inches by 44 inches + +Appendix D - Roles of Users + + Background + + The need for "Role Models" stemmed in large part from the need to + understand the importance of any given proposed object for the MIB. + Many times the real world need for a proposed object would be debated + within the group; the debate would typically result in the need to + describe the potential usage of the object in terms of a "live" + person performing some type of printing-related task. + + Determining the value of a proposed object through identification of + the associated human users was found to be so common that a more + formalized model was required for consistent analysis. The model + describing categories of human-oriented tasks is called "Role Models" + in this document. + + In developing the Role Models it was necessary to identify the + common, primary tasks that humans typically face when interacting + with a printer and its related printing system(s). It was expected + that certain kinds of tasks would serve to identify the various Role + Models. + + In presenting the set of Role Models, the set of "Common Print System + Tasks" are first presented, followed by the set of Role Model + definitions. Finally, a simple matrix is presented in which Role + Models and Tasks are cross-compared. + + Common Print System Tasks + + Upon researching the many tasks encountered by humans in dealing with + printers and printing systems, the following were found to be + pervasive within any operating environment: + + Printer job state - Determine the status of a job without a printer. + + + + +Bergman, et al. Standards Track [Page 162] + +RFC 3805 Printer MIB v2 June 2004 + + + Printer capabilities - Determine the current capabilities of a + printer, for example, the available media sizes, two-sided printing, + a particular type of interpreter, etc. + + Printer job submission - Submit a print job to a printer. + + Printer job removal - Remove a job from a printer. + + Notification of events - Receive notification of the existence of a + defined printer event. An event can be of many types, including + warnings, errors, job stage completion (e.g., "job done"), etc. + + Printer configuration - Query the current configuration of a printer. + + Printer consumables - Determine the current state of any and all + consumables within a printer. + + Print job identification - Determine the identification of a job + within a printer. + + Internal printer status - Determine the current status of the + printer. + + Printer identification - Determine the identity of a printer. + Printer location - Determine the physical location of a printer. + + Local system configuration - Determine various aspects of the current + configuration of the local system involved with the operation of a + printer. + + These "tasks" cover a large spectrum of requirements surrounding the + operation of a printer in a network environment. This list serves as + the basis for defining the various Role Models described below. + + Proposed Role Models + + Following is the list of "Role Models" used to evaluate the + requirements for any given Printer MIB object. Note that the keyword + enclosed in parentheses represents an abbreviation for the particular + Role Model in the matrix described later in this document. + + User (USER) - A person or application that submits print jobs to the + printer; typically viewed as the "end user" within the overall + printing environment. + + + + + + + +Bergman, et al. Standards Track [Page 163] + +RFC 3805 Printer MIB v2 June 2004 + + + Operator (OP) - A person responsible for maintaining a printer on a + day-to-day basis, including such tasks as filling empty media trays, + emptying full output trays, replacing toner cartridges, clearing + simple paper jams, etc. + + Technician (TECH) - A person responsible for repairing a + malfunctioning printer, performing routine preventive maintenance, + and other tasks that typically require advanced training on the + printer internals. An example of a "technician" would be a + manufacturer's Field Service representative, or other person formally + trained by the manufacturer or similar representative. + + System Manager (MGR) - A person responsible for configuration and + troubleshooting of components involved in the overall printing + environment, including printers, print queues and network + connectivity issues. This person is typically responsible for + ensuring the overall operational integrity of the print system + components, and is typically viewed as the central point of + coordination among all other Role Models. + + Help Desk (HELP) - A person responsible for supporting Users in + their printing needs, including training Users and troubleshooting + Users' printing problems. + + Asset Manager (AM) - A person responsible for managing an + organization's printing system assets (primarily printers). Such a + person needs to be able to identify and track the location of + printing assets on an ongoing basis. + + Capacity Planner (CP) - A person responsible for tracking the usage + of printing resources on an ongoing basis for the purpose of planning + printer acquisitions and/or placement of printers based on usage + trends. + + Installer (INST) - A person or application responsible for + installing or configuring printing system components on a local + system. + + Accountant (ACCT) - A person responsible for tracking the usage of + printing resources on an ongoing basis for the purpose of charging + Users for resources used. + + Matrix of Common Print System Tasks and Role Models + + To better understand the relationship between the set of defined + "Common Print System Tasks" and the various "Role Models," the + following matrix is provided. + + + + +Bergman, et al. Standards Track [Page 164] + +RFC 3805 Printer MIB v2 June 2004 + + + It is important to recognize that many of the tasks will appear to be + applicable to many of the Role Models. However, when considering the + actual context of a task, it is very important to realize that often + the actual context of a task is such that the Role Model can change. + + For example, it is obvious that a "System Manager" must be able to + submit print jobs to a printer; however, when submitting a print job, + a person identified as a "System Manager" is actually operating in + the context of a "User" in this case; hence, the requirement to + submit a print job is not listed as a requirement for a System + Manager. + + Conversely, while a "User" must be able to remove a job previously + submitted to a printer, an "Operator" is often expected to be able to + remove any print job from any printer; hence, print job removal is a + (subtly different) requirement for both the "User" and "Operator" + Role Models. + + Role Models + ----------- + + Requirement Area USER OP TECH MGR HELP AM CP INST ACCT + Print job status xx xx xx xx xx + Printer capabilities xx xx xx + Print job submission xx + Print job removal xx xx + Notification of events xx xx + Printer configuration xx xx + Printer consumables xx xx xx + Print job identification xx xx xx xx xx + Internal printer status xx xx xx + Printer identification xx xx xx xx xx xx xx + Printer location xx + Local system configuration xx xx + +Appendix E - Overall Printer Status Table + + The Status Table establishes a convention for the top 25 printer + errors. The table defines a suggested relationship between various + printer states and the variables Printer hrDeviceStatus, + hrPrinterStatus, hrPrinterDetectedErrorState, prtAlertGroup, + prtAlertCode and various sub-unit status variables (prtInputStatus, + prtOutputStatus, prtMarkerStatus, prtMediaPathStatus and + prtChannelStatus). This table is the recommended implementation of + these variables. It is provided to guide implementors of this MIB + and users of the MIB by providing a sample set of states and the + variable values that are expected to be produced as result of that + state. This information supplements that provided in Section + + + +Bergman, et al. Standards Track [Page 165] + +RFC 3805 Printer MIB v2 June 2004 + + + 2.2.13.2 "Overall Printer Status". This is not an exhaustive list + rather it is a guideline. + + The definition of PrtSubUnitStatusTC specifies that SubUnitStatus is + an integer that is the sum of 5 distinct values/states: Availability, + Critical, Non-Critical, On-line and Transitioning. Thus when a non- + critical alert or alerts are present the values for Availability, + On-Line and Transitioning will be summed with the Non- Critical + Alerts (8) value. + + The table was generated in landscape format and is located at + ftp://ftp.pwg.org/pub/pwg/pmp/contributions/Top25Errors.pdf. + +Appendix F - Participants + + The Printer MIB Working Group would like to extend a special thank + you to the following individuals that put forth a significant effort + to review this document and provide numerous suggestions for + improvement. + + David Harrington - Enterasys Networks + Juergen Schoenwaelder - TU Braunschweig + Bert Wijnen - Lucent Technologies and IETF Op & Mngmt, Area Director + + This version of the Printer MIB would not be possible without the + previous work that resulted in RFC 1759. The authors of the Printer + MIB version 2 would like to acknowledge the following individuals for + their efforts in developing the base for this document. A special + recognition is also extended to Steve Waldbusser, who provided + significant technical guidance in the development of the architecture + of the Printer MIB. + + Joel Gyllenskog - Microworks + Tom Hastings - Xerox + Jay Martin - Underscore, Inc. + Ron Smith - Texas Instruments + Steve Waldbusser - Lucent Technologies + Don Wright - Lexmark + Steve Zilles - Adobe + + The following people attended at least one meeting of the Printer MIB + Working Group for version 2; many attended most meetings. + + Ron Bergman - Hitachi Printing Solutions + Luis Cubero - Hewlett-Packard + Jay Cummings - Novell + Andy Davidson - Tektronix + Lee Farrell - Canon + + + +Bergman, et al. Standards Track [Page 166] + +RFC 3805 Printer MIB v2 June 2004 + + + Tom Hastings - Xerox + Scott Isaacson - Novell + Binnur Al-Kazily - Hewlett-Packard + Rick Landau - Digital Equipment Corporation + David Kellerman - Northlake Software + Harry Lewis - IBM + Pete Loya - Hewlett-Packard + Jay Martin - Underscore, Inc. + Bob Pentecost - Hewlett-Packard + Dave Roach - Unisys + Stuart Rowley - Kyocera + Bob Setterbo - Adobe + Mike Timperman - Lexmark + Randy Turner - 2Wire, Inc. + Bill Wagner - NETsilicon, Inc. + Chris Wellens - Interworking Labs + Craig Whittle - Sharp Labs + Don Wright - Lexmark + Lloyd Young - Lexmark + Atsushi Yuki - Kyocera + Steve Zilles - Adobe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Bergman, et al. Standards Track [Page 167] + +RFC 3805 Printer MIB v2 June 2004 + + +Significant Contributors + + Ray Casterline + Lighthouse Solutions, LLC + + Phone: (716) 218-9910 + EMail: RayCasterline@lhsolutions.com + + Gary Gocek + + Phone: (585) 223-3826 + EMail: gary@gocek.org + + Thomas N. Hastings + Xerox Corporation + + Phone: (310) 333-6413 + EMail: hastings@cp10.es.xerox.com + + Scott Isaacson + Novell + + Phone: (801) 861-7366 + EMail: sisaacson@novell.com + + Binnur Al-Kazily + Hewlett-Packard, Inc. + + Phone: (208) 396-6372 + EMail: binnur_al-kazily@hp.com + + David Kellerman + Northlake Software + + Phone: (503) 228-3383 + EMail: kellerman@nls.com + + Matt King + Lexmark International + + Phone: (859) 232-6907 + EMail: emking@lexmark.com + + Jay Martin + Underscore, Inc. + + Phone: (603) 889-7000 + EMail: jkm@underscore.com + + + +Bergman, et al. Standards Track [Page 168] + +RFC 3805 Printer MIB v2 June 2004 + + + + Mike McKay + Novell, Inc. + + Bob Pentecost + Hewlett-Packard + + Phone: (208) 396-3312 + EMail: bpenteco@boi.hp.com + + Stuart Rowley + Kyocera + + Phone: (510) 299-7206 + EMail: stuart.rowley@kyocera.com + + Gail Songer + Peerless Systems Networking + + Phone: (650) 569-4414 + EMail: gsonger@peerless.com + + Randy Turner + 2Wire, Inc. + + Phone (408) 895-1216 + EMail: rturner@2wire.com + + William Wagner + NETsilicon, Inc. + + Phone: (781) 398-4588 + EMail: WWagner@NetSilicon.com + + Chris Wellens + Interworking Labs + + Phone: (408) 685-3190 + EMail: chrisw@iwl.com + + F.D. Wright + Lexmark International + + Phone: (859) 232-4808 + EMail: don@lexmark.com + + + + + + +Bergman, et al. Standards Track [Page 169] + +RFC 3805 Printer MIB v2 June 2004 + + + Lloyd Young + Lexmark International + + Phone: (859) 232-5150 + EMail: lpyoung@lexmark.com + + Stephen N. Zilles + Adobe Systems, Inc. + + Phone: (415) 962-4766 + EMail: szilles@adobe.com + +Authors' Addresses + + Ron Bergman (Chairman) + Hitachi Printing Solutions America + 2635 Park Center Drive + Simi Valley, CA 93065-6209 + + Phone: (805) 578-4421 + EMail: Ron.Bergman@hitachi-ps.us + + + Harry Lewis + IBM + 6300 Diagonal Hwy. + Boulder, CO 80301 + + Phone (303) 924-5337 + EMail: harryl@us.ibm.com + + + Ira McDonald + High North Inc + P.O. Box 221 + Grand Marais, MI 49839 + + Phone: (906) 494-2434 or (906) 494-2697 + EMail: imcdonald@sharplabs.com + + + + + + + + + + + + +Bergman, et al. Standards Track [Page 170] + +RFC 3805 Printer MIB v2 June 2004 + + +Full Copyright Statement + + Copyright (C) The Internet Society (2004). This document is subject + to the rights, licenses and restrictions contained in BCP 78, and + except as set forth therein, the authors retain all their rights. + + This document and the information contained herein are provided on an + "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS + OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET + ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE + INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED + WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +Intellectual Property + + The IETF takes no position regarding the validity or scope of any + Intellectual Property Rights or other rights that might be claimed to + pertain to the implementation or use of the technology described in + this document or the extent to which any license under such rights + might or might not be available; nor does it represent that it has + made any independent effort to identify any such rights. Information + on the procedures with respect to rights in RFC documents can be + found in BCP 78 and BCP 79. + + Copies of IPR disclosures made to the IETF Secretariat and any + assurances of licenses to be made available, or the result of an + attempt made to obtain a general license or permission for the use of + such proprietary rights by implementers or users of this + specification can be obtained from the IETF on-line IPR repository at + http://www.ietf.org/ipr. + + The IETF invites any interested party to bring to its attention any + copyrights, patents or patent applications, or other proprietary + rights that may cover technology that may be required to implement + this standard. Please address the information to the IETF at ietf- + ipr@ietf.org. + +Acknowledgement + + Funding for the RFC Editor function is currently provided by the + Internet Society. + + + + + + + + + +Bergman, et al. Standards Track [Page 171] + diff --git a/templates/classes.tmpl b/templates/classes.tmpl index 17ee9e4a0..ef13feca2 100644 --- a/templates/classes.tmpl +++ b/templates/classes.tmpl @@ -17,35 +17,35 @@ Print Test Page {printer_state=5? - + Start Class : - + Stop Class } {printer_is_accepting_jobs=0? - + Accept Jobs : - + Reject Jobs } - + Cancel All Jobs {printer_is_shared=0? - + Publish Printer : - + Unpublish Printer } - + Modify Class - + Delete Class - + Set As Default - + Set Allowed Users

                                          diff --git a/templates/edit-config.tmpl.in b/templates/edit-config.tmpl.in index 68c9e0dd0..b457fadaf 100644 --- a/templates/edit-config.tmpl.in +++ b/templates/edit-config.tmpl.in @@ -33,7 +33,7 @@ function reset_config() "\\n" + "# Restrict access to the admin pages...\\n" + "\\n" + -"@ENCRYPTION_REQUIRED\\n" + +"@ENCRYPTION_REQUIRED@\\n" + " Order allow,deny\\n" + " Allow localhost\\n" + "\\n" + diff --git a/templates/es/classes.tmpl b/templates/es/classes.tmpl index 1173b53f6..43de08d2a 100644 --- a/templates/es/classes.tmpl +++ b/templates/es/classes.tmpl @@ -17,35 +17,35 @@ Imprimir página de prueba {printer_state=5? - + Iniciar clase : - + Detener clase } {printer_is_accepting_jobs=0? - + Aceptar trabajos : - + Rechazar trabajos } - + Cancelar todos los trabajos {printer_is_shared=0? - + Publicar impresora : - + No publicar impresora } - + Modificar clase - + Borrar clase - + Poner como predeterminada - + Establecer usuarios permitidos

                                          diff --git a/templates/es/edit-config.tmpl.in b/templates/es/edit-config.tmpl.in index 891d2e562..5ebd84cd7 100644 --- a/templates/es/edit-config.tmpl.in +++ b/templates/es/edit-config.tmpl.in @@ -33,7 +33,7 @@ function reset_config() "\\n" + "# Restrict access to the admin pages...\\n" + "\\n" + -"@ENCRYPTION_REQUIRED\\n" + +"@ENCRYPTION_REQUIRED@\\n" + " Order allow,deny\\n" + " Allow localhost\\n" + "\\n" + diff --git a/templates/es/printers.tmpl b/templates/es/printers.tmpl index 67984f543..2366f4441 100644 --- a/templates/es/printers.tmpl +++ b/templates/es/printers.tmpl @@ -23,39 +23,39 @@ Imprimir página de auto-prueba:} {printer_state=5? - + Iniciar impresora : - + Detener impresora } {printer_is_accepting_jobs=0? - + Aceptar trabajos : - + Rechazar trabajos } - + Mover todos los trabajos - + Cancelar todos los trabajos {printer_is_shared=0? - + Publicar impresora : - + No publicar impresora } - + Modificar impresora - + Cambiar opciones impresora - + Borrar impresora - + Poner como predeterminada - + Establecer usuarios permitidos

                                          diff --git a/templates/ja/classes.tmpl b/templates/ja/classes.tmpl index 67dcf8048..2e117e82b 100644 --- a/templates/ja/classes.tmpl +++ b/templates/ja/classes.tmpl @@ -19,35 +19,35 @@ テストページの印刷 {printer_state=5? - + クラスを開始 : - + クラスを停止 } {printer_is_accepting_jobs=0? - + ジョブを受け付け : - + ジョブを拒否 } - + すべてのジョブをキャンセル {printer_is_shared=0? - + プリンタを公開 : - + プリンタを非公開 } - + クラスの変更 - + クラスの削除 - + デフォルトに設定 - + 許可するユーザの設定

                                          diff --git a/templates/ja/edit-config.tmpl.in b/templates/ja/edit-config.tmpl.in index 0f6b1fadf..b3d4a96d1 100644 --- a/templates/ja/edit-config.tmpl.in +++ b/templates/ja/edit-config.tmpl.in @@ -33,7 +33,7 @@ function reset_config() "\\n" + "# Restrict access to the admin pages...\\n" + "\\n" + -"@ENCRYPTION_REQUIRED\\n" + +"@ENCRYPTION_REQUIRED@\\n" + " Order allow,deny\\n" + " Allow localhost\\n" + "\\n" + diff --git a/templates/ja/printers.tmpl b/templates/ja/printers.tmpl index f0a39dd64..457f12152 100644 --- a/templates/ja/printers.tmpl +++ b/templates/ja/printers.tmpl @@ -19,39 +19,39 @@ テストページの印刷 {printer_state=5? - + プリタを開始 : - + プリンタを停止 } {printer_is_accepting_jobs=0? - + ジョブを受け付け : - + ジョブを拒否 } - + すべてのジョブの移動 - + すべてのジョブをキャンセル {printer_is_shared=0? - + プリンタを公開 : - + プリンタを非公開 } - + プリンタの変更 - + プリンタオプションの設定 - + プリンタの削除 - + デフォルトに設定 - + 許可するユーザの設定

                                          diff --git a/templates/pl/admin.tmpl b/templates/pl/admin.tmpl index 4e7c28ee8..9d88d5557 100644 --- a/templates/pl/admin.tmpl +++ b/templates/pl/admin.tmpl @@ -62,7 +62,7 @@ CLASS="button">

                                          Pokazuj drukarki udostępnione przez inne systemy
                                          - Udostępniaj upublicznione drukarki podłączone do tego systemu
                                          + Udostępniaj opublikowane drukarki podłączone do tego systemu
                                          Zezwalaj na zdalną administrację
                                          Zezwalaj użytkownikom na anulowanie wszystkich wydruków (nie tylko własnych)
                                          Zachowuj informacje odpluskwiania dla rozwiązania problemów

                                          diff --git a/templates/pl/classes.tmpl b/templates/pl/classes.tmpl index a39a17d89..d42e145de 100644 --- a/templates/pl/classes.tmpl +++ b/templates/pl/classes.tmpl @@ -10,42 +10,42 @@ Opis: {printer_info}
                                          Położenie: {printer_location}
                                          Stan Grupy: {printer_state=3?bezczynna:{printer_state=4?drukuje:zatrzymana}}, -{printer_is_accepting_jobs=0?odrzuca wydruki:akceptuje wydruki}, {printer_is_shared=0?nie upubliczniona:upubliczniona}. +{printer_is_accepting_jobs=0?odrzuca wydruki:akceptuje wydruki}, {printer_is_shared=0?nie: opublikowana}. {?member_uris=?:
                                          Składniki: {member_uris}}

                                          Drukuj Stronę Testową {printer_state=5? - + Start Grupy : - + Zatrzymaj Grupę } {printer_is_accepting_jobs=0? - + Akceptuj Wydruki : - + Odrzucaj Wydruki } - + Skasuj Wszystkie Wydruki {printer_is_shared=0? - -Upublicznij Drukarkę + +Publikuj Drukarkę : - -Nie Upubliczniaj Drukarki + +Nie Publikuj Drukarki } - + Modyfikuj Grupę - + Usuń Grupę - + Ustaw Jako Domyślną - + Ustaw Uprawnienia Użytkowników

                                          diff --git a/templates/pl/edit-config.tmpl.in b/templates/pl/edit-config.tmpl.in index 6047e016e..939f01153 100644 --- a/templates/pl/edit-config.tmpl.in +++ b/templates/pl/edit-config.tmpl.in @@ -33,7 +33,7 @@ function reset_config() "\\n" + "# Restrict access to the admin pages...\\n" + "\\n" + -"@ENCRYPTION_REQUIRED\\n" + +"@ENCRYPTION_REQUIRED@\\n" + " Order allow,deny\\n" + " Allow localhost\\n" + "\\n" + diff --git a/templates/pl/printers.tmpl b/templates/pl/printers.tmpl index f35dfdec4..9cc02fe2d 100644 --- a/templates/pl/printers.tmpl +++ b/templates/pl/printers.tmpl @@ -12,7 +12,7 @@ Położenie: {printer_location}
                                          Producent i Typ: {printer_make_and_model}
                                          Stan Drukarki: {printer_state=3?bezczynna:{printer_state=4?drukuje:zatrzymana}}, -{printer_is_accepting_jobs=0?odrzuca wydruki:akceptuje wydruki}, {printer_is_shared=0?nie:} upubliczniona. +{printer_is_accepting_jobs=0?odrzuca wydruki:akceptuje wydruki}, {printer_is_shared=0?nie:} opublikowana. {?device_uri=?:
                                          URI Urządzenia: {device_uri}}

                                          @@ -23,39 +23,39 @@ Drukuj Auto-Test Drukarki:} {printer_state=5? - + Start Drukarki : - + Zatrzymaj Drukarkę } {printer_is_accepting_jobs=0? - + Akceptuj Wydruki : - + Odrzucaj Wydruki } - + Przenieś Wszystkie Wydruki - + Skasuj Wszystkie Wydruki {printer_is_shared=0? - -Upublicznij Drukarkę + +Publikuj Drukarkę : - -Nie Upubliczniaj Drukarki + +Nie Publikuj Drukarki } - + Modyfikuj Drukarkę - + Ustaw Opcje Drukarki - + Usuń Drukarkę - + Ustaw jako Domyślną - + Ustaw Uprawnienia Użytkowników

                                          diff --git a/templates/printers.tmpl b/templates/printers.tmpl index 79e4ddd81..d4f5e569a 100644 --- a/templates/printers.tmpl +++ b/templates/printers.tmpl @@ -23,39 +23,39 @@ Print Self Test Page:} {printer_state=5? - + Start Printer : - + Stop Printer } {printer_is_accepting_jobs=0? - + Accept Jobs : - + Reject Jobs } - + Move All Jobs - + Cancel All Jobs {printer_is_shared=0? - + Publish Printer : - + Unpublish Printer } - + Modify Printer - + Set Printer Options - + Delete Printer - + Set As Default - + Set Allowed Users

                                          diff --git a/templates/sv/classes.tmpl b/templates/sv/classes.tmpl index 1dd52ebaa..d555c0c06 100644 --- a/templates/sv/classes.tmpl +++ b/templates/sv/classes.tmpl @@ -17,35 +17,35 @@ Skriv ut testsida {printer_state=5? - + Starta klass : - + Stoppa klass } {printer_is_accepting_jobs=0? - + Acceptera jobb : - + Vägra jobb } - + Avbryt alla jobb {printer_is_shared=0? - + Publicera skrivare : - + Avpublicera skrivare } - + Modifiera klass - + Ta bort klass - + Ställ in som standard - + Ställ in tillåtna användare

                                          diff --git a/templates/sv/edit-config.tmpl.in b/templates/sv/edit-config.tmpl.in index ff7a01e05..b4d1d8bec 100644 --- a/templates/sv/edit-config.tmpl.in +++ b/templates/sv/edit-config.tmpl.in @@ -33,7 +33,7 @@ function reset_config() "\\n" + "# Restrict access to the admin pages...\\n" + "\\n" + -"@ENCRYPTION_REQUIRED\\n" + +"@ENCRYPTION_REQUIRED@\\n" + " Order allow,deny\\n" + " Allow localhost\\n" + "\\n" + diff --git a/templates/sv/printers.tmpl b/templates/sv/printers.tmpl index ad21e5ca7..3251d4213 100644 --- a/templates/sv/printers.tmpl +++ b/templates/sv/printers.tmpl @@ -23,39 +23,39 @@ Skriv ut självtestsida:} {printer_state=5? - + Starta skrivare : - + Stoppa skrivare } {printer_is_accepting_jobs=0? - + Acceptera jobb : - + Vägra jobb } - + Flytta alla jobb - + Avbryt alla jobb {printer_is_shared=0? - + Publicera skrivare : - + Avpublicera skrivare } - + Modifiera skrivare - + Ställ in skrivaralternativ - + Ta bort skrivare - + Ställ in som standard - + Ställ in tillåtna användare

                                          diff --git a/test/4.2-cups-printer-ops.test b/test/4.2-cups-printer-ops.test index 107123888..54189002f 100644 --- a/test/4.2-cups-printer-ops.test +++ b/test/4.2-cups-printer-ops.test @@ -1,5 +1,5 @@ # -# "$Id: 4.2-cups-printer-ops.test 5091 2006-02-08 18:39:56Z mike $" +# "$Id: 4.2-cups-printer-ops.test 5493 2006-05-05 16:33:57Z mike $" # # Verify that the CUPS printer operations work. # @@ -130,7 +130,7 @@ ATTR language attributes-natural-language en ATTR uri printer-uri $method://$hostname:$port/printers/Test2 - FILE testps.ppd + FILE testhp.ppd # What statuses are OK? STATUS successful-ok @@ -205,7 +205,7 @@ ATTR enum printer-state 3 ATTR boolean printer-is-accepting-jobs true - FILE testhp.ppd + FILE testps.ppd # What statuses are OK? STATUS successful-ok @@ -258,5 +258,5 @@ } # -# End of "$Id: 4.2-cups-printer-ops.test 5091 2006-02-08 18:39:56Z mike $" +# End of "$Id: 4.2-cups-printer-ops.test 5493 2006-05-05 16:33:57Z mike $" # diff --git a/test/4.3-job-ops.test b/test/4.3-job-ops.test index 7d33b383e..fa1849b29 100644 --- a/test/4.3-job-ops.test +++ b/test/4.3-job-ops.test @@ -1,5 +1,5 @@ # -# "$Id: 4.3-job-ops.test 4837 2005-11-14 04:13:13Z mike $" +# "$Id: 4.3-job-ops.test 5493 2006-05-05 16:33:57Z mike $" # # Verify that the IPP job operations work. # @@ -55,7 +55,7 @@ } { # The name of the test... - NAME "Print PostScript Job to Test2" + NAME "Print JPEG Job to Test2" # The operation to use OPERATION print-job @@ -71,7 +71,7 @@ GROUP subscription ATTR uri notify-recipient testnotify - FILE testfile.ps + FILE testfile.jpg # What statuses are OK? STATUS successful-ok @@ -297,5 +297,5 @@ } # -# End of "$Id: 4.3-job-ops.test 4837 2005-11-14 04:13:13Z mike $" +# End of "$Id: 4.3-job-ops.test 5493 2006-05-05 16:33:57Z mike $" # diff --git a/test/run-stp-tests.sh b/test/run-stp-tests.sh index 06b7564a0..fe169ecda 100755 --- a/test/run-stp-tests.sh +++ b/test/run-stp-tests.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# "$Id: run-stp-tests.sh 5262 2006-03-09 21:26:27Z mike $" +# "$Id: run-stp-tests.sh 5493 2006-05-05 16:33:57Z mike $" # # Perform the complete set of IPP compliance tests specified in the # CUPS Software Test Plan. @@ -24,6 +24,8 @@ # WWW: http://www.cups.org # +argcount=$# + # # Make the IPP test program... # @@ -67,7 +69,12 @@ echo "4 - Basic conformance test, torture load testing (minimum 2GB VM, 1GB disk echo "" echo $ac_n "Enter the number of the test you wish to perform: [1] $ac_c" -read testtype +if test $# -gt 0; then + testtype=$1 + shift +else + read testtype +fi echo "" case "$testtype" in @@ -118,7 +125,12 @@ echo "2 - Create a SSL/TLS certificate and key and require encryption" echo "" echo $ac_n "Enter the number of the SSL/TLS tests to perform: [0] $ac_c" -read ssltype +if test $# -gt 0; then + ssltype=$1 + shift +else + read ssltype +fi echo "" case "$ssltype" in @@ -186,7 +198,12 @@ echo " http://developer.kde.org/~sewardj/" echo "" echo $ac_n "Enter Y to use Valgrind or N to not use Valgrind: [N] $ac_c" -read usevalgrind +if test $# -gt 0; then + usevalgrind=$1 + shift +else + read usevalgrind +fi echo "" case "$usevalgrind" in @@ -204,6 +221,8 @@ esac # Start by creating temporary directories for the tests... # +echo "Creating directories for test..." + rm -rf /tmp/cups-$user mkdir /tmp/cups-$user mkdir /tmp/cups-$user/bin @@ -225,6 +244,7 @@ ln -s $root/backend/ipp /tmp/cups-$user/bin/backend ln -s $root/backend/lpd /tmp/cups-$user/bin/backend ln -s $root/backend/parallel /tmp/cups-$user/bin/backend ln -s $root/backend/serial /tmp/cups-$user/bin/backend +ln -s $root/backend/snmp /tmp/cups-$user/bin/backend ln -s $root/backend/socket /tmp/cups-$user/bin/backend ln -s $root/backend/usb /tmp/cups-$user/bin/backend ln -s $root/cgi-bin /tmp/cups-$user/bin @@ -246,6 +266,7 @@ ln -s $root/data/secret /tmp/cups-$user/share/banners ln -s $root/data/standard /tmp/cups-$user/share/banners ln -s $root/data/topsecret /tmp/cups-$user/share/banners ln -s $root/data/unclassified /tmp/cups-$user/share/banners +ln -s $root/data /tmp/cups-$user/share/charmaps ln -s $root/data /tmp/cups-$user/share/charsets ln -s $root/data /tmp/cups-$user/share ln -s $root/fonts /tmp/cups-$user/share @@ -261,6 +282,8 @@ fi # Then create the necessary config files... # +echo "Creating cupsd.conf for test..." + if test $ssltype = 2; then encryption="Encryption Required" else @@ -286,7 +309,7 @@ MaxLogSize 0 AccessLog /tmp/cups-$user/log/access_log ErrorLog /tmp/cups-$user/log/error_log PageLog /tmp/cups-$user/log/page_log -LogLevel debug +LogLevel debug2 PreserveJobHistory Yes @@ -305,6 +328,8 @@ touch /tmp/cups-$user/printers.conf # Setup lots of test queues - 500 with PPD files, 500 without... # +echo "Creating printers.conf for test..." + i=1 while test $i -le $nprinters1; do cat >>/tmp/cups-$user/printers.conf </tmp/cups-$user/log/debug_log &" +echo " $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &" echo "" -$valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log & +$valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 & cupsd=$! #if test -x /usr/bin/strace; then @@ -412,10 +439,15 @@ if test "x$testtype" = x0; then exit 0 fi -echo "Scheduler is PID $cupsd; run debugger now if you need to." -echo "" -echo $ac_n "Press ENTER to continue... $ac_c" -read junk +if test $argcount -eq 0; then + echo "Scheduler is PID $cupsd; run debugger now if you need to." + echo "" + echo $ac_n "Press ENTER to continue... $ac_c" + read junk +else + echo "Scheduler is PID $cupsd." + sleep 2 +fi IPP_PORT=$port; export IPP_PORT @@ -442,6 +474,7 @@ cat str-header.html >$strfile # Run the IPP tests... # +echo "" echo "Running IPP compliance tests..." echo "

                                          1 - IPP Compliance Tests

                                          " >>$strfile @@ -470,6 +503,7 @@ echo "" >>$strfile # Run the command tests... # +echo "" echo "Running command tests..." echo "

                                          2 - Command Tests

                                          " >>$strfile @@ -546,8 +580,6 @@ fi # Format the reports and tell the user where to find them... # -echo "Formatting reports..." - cat str-trailer.html >>$strfile echo "" @@ -558,16 +590,10 @@ else echo "All tests were successful." fi -if test "x$valgrind" != x; then - echo "Valgrind log files can be found in /tmp/cups-$user/log." -fi - -echo "" -echo "See the following file for details:" -echo "" -echo " $strfile" +echo "Log files can be found in /tmp/cups-$user/log." +echo "A HTML report was created in test/$strfile." echo "" # -# End of "$Id: run-stp-tests.sh 5262 2006-03-09 21:26:27Z mike $" +# End of "$Id: run-stp-tests.sh 5493 2006-05-05 16:33:57Z mike $" # -- 2.39.2