This is the BJNP protocol backend for CUPS
It works with cups 1.2 - 1.6 (verified)

CUPS-BJNP can be compiled standalone (when the cups-devel package or your OS 
equivalent is installed, e.g. for Fedora install cups-devel).  

Cups-bjnp is included in a number of distributions so in most cases it is not
necessary to compile it yourself.

Compiling Cups-bjnp
===================

Compiling CUPS-BJNP is as simple as:
./configure --prefix=/usr 
make

In most cases configure will find the backend directory where cups stores its
 backends without help. If it does not, add the --with-cupsbackenddir=xxx
option to the configure comand line to point configure in the right direction.

Cups-bjnp works over IPv4 and IPv6 (since version 1.1)

For a first test type: ./bjnp 

This should return the printers uri assuming that you are on the same subnet, 
the printer is on, and there is no firewall blocking tcp/udp port 8611
See notes on firewall setup below.

For my MP970 bjnp returns:

[louis@travel backend]$ ./bjnp 
network bjnp://printer-1.pheasant:0 "Canon MP970 series" "bjnp printer-1.pheasant" 
"MFG:Canon;CMD:BJL,BJRaster3,BSCCe,NCCe,PLI;SOJ:TXT01,BJNP2;MDL:MP970 series;CLS:
PRINTER;DES:Canon MP970 series;VER:1.110;STA:10;FSI:03;HRI:OTH;MSI:DAT,E3;"

if this works, install the binary, as root type:  make install.
if you want to do this manually: copy (as root) bjnp into your cups backend
directory.

configure cups through the web frontend (https://localhost:631), e.g. try 
tab <administration> <find new printers>

Debugging
=========
If you have problems, you may want to set the debugging level.

To debug printer detection you can set the environment variable BJNP_DEBUG
export BJNP_DEBUG=DEBUG2 (for sh or bash) or
setenv BJNP_DEBUG DEBUG2 (for csh or tcsh)

To debug printing, you can add the debug level as part of the printer URI:
DeviceURI bjnp://printer-1.pheasant:8611/?debuglevel=DEBUG2

In both cases the debuglevel is set to one of the cups debuglevels (see cups 
documentation: http://www.cups.org/documentation.php/man-filter.html)

Debug information will be sent to the bjnp_log in your cups logging directory 
(e.g. /var/log/cups).  Debug files will become big, so the file is truncated 
at the start of each printjob.

If for whatever reason, opening of the logfile causes problems, you can force 
all debug output to be sent to the cups error_log by adding _toCups to the 
DeviceURI:
DeviceURI bjnp://printer-1.pheasant:8611/?debuglevel=DEBUG2_toCups

Firewalling
===========
Cups-bjnp communicates with port 8611 on the printer. So you will have to allow 
traffic TO port 8611 for printing.

Printer detection is slightly more complicated. (cups-bjnp sends a broadcast on
all subnets it can find. The broadast is sent FROM port 8611 to port 8611. The
outgoing packets will be allowed by the rule above. Responses from the printer
are sent back to the computer TO port 8611. Connection tracking however does not
see a match. You will therefore have to allow packets received TO port 8611 as well.

Louis Lagendijk
louis.lagendijk@gmail.com

ChangeLog
2012-08-31 Added IPv6 support
           Refactored into a number of c-files
2011-07-05 Version 1.0
           Fixed some warnings from the latest GCC on unused code
           Made hostname resolution for the printer more robust by verifying
           that a forward lookup matches the reverse name lookup.
           This should fix printer detection for some buggy routers that 
           return a bogus hostname on a reverse lookup
           Bumped version number to 1.0 the code seems to be stable.
