libdsm  0.0.4-11-g223c1ba
Minimalist and read-only SMB client lib
 All Data Structures Files Functions Typedefs Enumerator Macros
Functions
smb_share.h File Reference

List and connect to SMB shares. More...

#include "bdsm/smb_session.h"
#include "bdsm/smb_file.h"

Functions

size_t smb_share_get_list (smb_session *s, smb_share_list *list)
 List the existing share of this sessions's machine. More...
 
size_t smb_share_list_count (smb_share_list list)
 Get the number of share in the list. More...
 
const char * smb_share_list_at (smb_share_list list, size_t index)
 Get the name of the share in the list at the given index. More...
 
void smb_share_list_destroy (smb_share_list list)
 Destroy an opaque share list object. More...
 
smb_tid smb_tree_connect (smb_session *s, const char *name)
 Connects to a SMB share. More...
 
int smb_tree_disconnect (smb_session *s, smb_tid tid)
 Disconnect from a share. More...
 

Detailed Description

List and connect to SMB shares.

Function Documentation

size_t smb_share_get_list ( smb_session s,
smb_share_list list 
)

List the existing share of this sessions's machine.

This function makes a RPC to the machine this session is currently authenticated to and list all the existing shares of this machines. The share starting with a $ are supposed to be system/hidden share.

Parameters
[in]sThe session object
[out]listA pointer to an opaque share_list object.
Returns
The number of share listed or 0 if there was an error (There theorically cannot be 0 share on a machine, there's at least $IPC)
const char* smb_share_list_at ( smb_share_list  list,
size_t  index 
)

Get the name of the share in the list at the given index.

Parameters
listAn opaque share list object
indexThe index of the returned item in the list
Returns
The string has been decoded from UTF16 to you local encoding
size_t smb_share_list_count ( smb_share_list  list)

Get the number of share in the list.

Parameters
listAn opaque share list returned by smb_share_list()
Returns
The number of share in the opaque share_list object
void smb_share_list_destroy ( smb_share_list  list)

Destroy an opaque share list object.

Parameters
listThe list to destroy. The object is not usable anymore afterward, you can set it to 'NULL'
smb_tid smb_tree_connect ( smb_session s,
const char *  name 
)

Connects to a SMB share.

Before being able to list/read files on a SMB file server, you have to be connected to the share containing the files you want to read or the directories you want to list

Parameters
sThe session object
nameThe share name
See also
smb_share_list
Returns
An opaque value representing an open share (like a file descriptor) or 0 if there was an error
int smb_tree_disconnect ( smb_session s,
smb_tid  tid 
)

Disconnect from a share.

UNIMPLEMENTED

Returns
?