[jcifs] Re: smb printers with jcifs

Michael B. Allen miallen at eskimo.com
Sat Jun 15 07:40:19 EST 2002


The  SHARE_INFO_1  structures,  of  which  the type field you speak of is a
member,  are  returned  in the results array of the NetShareEnumResponse on
lines  992 (list) and 1184 (listFiles) of jcifs/smb/SmbFile.java. Of course
you  might  also  check SmbTree.service if an SMB_COM_TREE_CONNECT_ANDX has
occured.  I  don't  think  I want four more isXxx methods but I would happy
with  one  isPrinter.  Or  we  could  have some kind of getType method that
returns  SmbFile.TYPE_DISK,  SmbFile.TYPE_PRINTER,  SmbFile.TYPE_DEVICE, or
SmbFile.TYPE_IPC   (in  which  case  we  could  drop  isWorkgroup  and  add
TYPE_WORKGROUP and TYPE_SERVER too).

Whatever the case this is simply a matter of adding a serviceType member to
SmbFile.java  and  ensuring  that it is appropriately set in the few places
where  SmbFile  objects  may  be  created  (grep  for  'new SmbFile(') with
particular  attention  being  paid to the SmbFiles created in the listFiles
method.  It would be necessary to consider creation scenarios that have the
potential  to  violate  state  consistency  but  that  should  not  be  too
difficult; jCIFS ain't spaghetti.

Mike

On Fri, 14 Jun 2002 12:18:49 -0500
Christopher R.Hertel <crh at ubiqx.mn.org> wrote:

> ..the below, of course, being part of the NetShareEnum response.
> I found it in the cifsrap document:
> 
> Name           Value  Description
> STYPE_DISKTREE 0      Disk Directory Tree
> STYPE_PRINTQ   1      Printer Queue
> STYPE_DEVICE   2      Communications device
> STYPE_IPC      3      Inter process communication (IPC)
> 
> Michael (Schulze), you can find this doc at:
> http://www.samba.org/samba/ftp/specs/draft-leach-cifs-rap-spec-00.txt
> 
> Chris -)-----
> 
> On Fri, Jun 14, 2002 at 11:46:35AM -0500, Christopher R.Hertel wrote:
> > Hmmm...
> > 
> > I looked a packet trace.  I see:
> > 
> >     Available Entries: 6
> >     Available Shares
> >         Share HOME
> >             Share Name: HOME
> >             Share Type: Directory tree (0)
> >             Share Comment: User Files
> >         Share D
> >             Share Name: D
> >             Share Type: Directory tree (0)
> >             Share Comment: D drive
> >         Share C
> >             Share Name: C
> >             Share Type: Directory tree (0)
> >             Share Comment: C drive
> >         Share PRINTER$
> >             Share Name: PRINTER$
> >             Share Type: Directory tree (0)
> >             Share Comment: 
> >         Share HP560C
> >             Share Name: HP560C
> >             Share Type: Printer queue (1)
> >             Share Comment: HP Deskjet 560 C Color Printer
> >         Share IPC$
> >             Share Name: IPC$
> >             Share Type: IPC (3)
> >             Share Comment: Remote Inter Process Communication
> > 
> > So the share type is listed in then entry.
> > 0 : directory
> > 1 : printer queue
> > 2 : ??
> > 3 : IPC
> > 
> > Michael (Schulze): You know Java.  Can you take a look at the code and see
> > how jCIFS is deriving the value you are getting?  It may be that you need
> > to ask the object for the share type as a separate step.  I have to admit
> > I'm not familiar with that bit of code.  Well, I'm not up-to-date on a lot
> > of the code because I've been busy writing documentation.  :)

-- 
http://www.eskimo.com/~miallen/c/jus.c





More information about the jcifs mailing list