libsmbclient API for querying LMB?

David Wuertele dave-gnus at bfnet.com
Mon Nov 10 21:07:02 GMT 2003


Derrell> Calling smbc_opendir() with "smb://" as the pathname,
Derrell> followed by some number of calls to smbc_readdir() and then
Derrell> smbc_closedir() will give you the list of servers.  Use
Derrell> "smb://workgroup_name" as the path parameter to
Derrell> smbc_opendir() to get the servers in the workgroup, and
Derrell> "smb://server_name" to get the list of services provided by
Derrell> the server.

Excellent advice, the following code worked great:

  smbc_init(auth_fn, 0);
  dh = smbc_opendir("smb://");
  while (dirptr = smbc_readdir( dh )) {
    printf ("type = %u, len = %u, commentlen = %u, comment =%s, namelen = %u, name = %s\n",
	    dirptr->smbc_type,
	    dirptr->dirlen,
	    dirptr->commentlen,
	    dirptr->comment,
	    dirptr->namelen,
	    dirptr->name);
  }

I have two questions:

1.  Does running smbc_readdir() multiple times result in multiple
    packets on the LAN?  Or does it cache and return?

2.  Is there a way to specify the ethernet interface used for the
    query?

Thanks!
Dave




More information about the samba-technical mailing list