RAP queue status codes for LANMAN printing

Rainer Weikusat rainer.weikusat at sncag.com
Thu Dec 15 20:26:25 GMT 2005


Excuse me if this is something "everybody just knows about", but this
information is neither available in the Samba 3 source (as far as I
could determine) nor is it easily found on the web.

The following code is used in .../source/smbd/lanman.c
to map queue status values, as returned by some spooler,
into RAP queue status codes:

/*
turn a print queue status into a on the wire status 
*/
static int printq_status(int v)
{
        switch (v) {
        case LPQ_QUEUED:
                return 0;
        case LPQ_PAUSED:
                return RAP_QUEUE_STATUS_PAUSED;
        }
        return RAP_QUEUE_STATUS_ERROR;
}

First, this is "somewhat weird", because the spooler backends return
LPSTAT_*-codes and not LPQ_*-codes. Some experimentation with w2k has
resulted in the following:

	- the RAP QUEUE status is actually a quantity with two bits
          (there are four possible states with wrap-around after the fourth)

	- the following codes are defined:

        	0	- 	active
                1	-	stopped
                2	-	error
                3	-	being deleted

	[this has been determined by modifying the mapping
         routine to return increasing unsigned integers and
         translating the (German) net print messages].

I would therefore suggest to drop this routine and to add a
LPSTAT_BEING_DELETED to the LPSTAT_ enum in .../includes/smb.h,
perhaps adding a comment which explains that LPSTAT_* is actually the
'wire status'. Unless I can think of something better until tomorrow
(CET), this is what I will do to the copy I maintain over here and
send a patch to the list in case of interest in that.

I've been flamed enough on various mailing lists to no longer send
patches to code someone else wrote without giving him a chance to
start flaming before I try to make a 'clean' patch ... :->.


More information about the samba-technical mailing list