libdsm 0.4.3
Minimalist and read-only SMB client lib
Loading...
Searching...
No Matches
Functions
smb_share.h File Reference

List and connect to SMB shares. More...

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

Functions

BDSM_EXPORT int smb_share_get_list (smb_session *s, smb_share_list *list, size_t *p_count)
 List the existing share of this sessions's machine. More...
 
BDSM_EXPORT size_t smb_share_list_count (smb_share_list list)
 Get the number of share in the list. More...
 
BDSM_EXPORT 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...
 
BDSM_EXPORT void smb_share_list_destroy (smb_share_list list)
 Destroy an opaque share list object. More...
 
BDSM_EXPORT int smb_tree_connect (smb_session *s, const char *name, smb_tid *tid)
 Connects to a SMB share. More...
 
BDSM_EXPORT 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

◆ smb_share_get_list()

BDSM_EXPORT int smb_share_get_list ( smb_session s,
smb_share_list list,
size_t *  p_count 
)

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.
[out]pointerto the number of elements in the list
Returns
0 on success or a DSM error code in case of error

◆ smb_share_list_at()

BDSM_EXPORT 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

◆ smb_share_list_count()

BDSM_EXPORT 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

◆ smb_share_list_destroy()

BDSM_EXPORT 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_tree_connect()

BDSM_EXPORT int smb_tree_connect ( smb_session s,
const char *  name,
smb_tid tid 
)

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
Parameters
tidThe pointer to an opaque open share
Returns
0 on success or a DSM error code in case of error

◆ smb_tree_disconnect()

BDSM_EXPORT int smb_tree_disconnect ( smb_session s,
smb_tid  tid 
)

Disconnect from a share.

UNIMPLEMENTED

Returns
0 on success or a DSM error code in case of error