Skip to main content

Crate pavao_sys

Crate pavao_sys 

Source
Expand description

Raw Rust bindings to Samba’s libsmbclient library.

This crate mirrors the native C types and functions. Most callers should use the safe pavao crate instead.

§Safety

The bindings do not validate pointers, lifetimes, buffer lengths, context state, or native return values. Callers must uphold the corresponding libsmbclient C API contracts. libsmbclient also shares process-wide parameter state, so separate contexts are not sufficient for thread safety. Callers must serialize all raw native activity with one process-wide lock. These bindings do not coordinate with Pavão’s safe-wrapper lock; raw calls must never race a Pavão operation or any other raw libsmbclient call.

§Callback contracts

Unless an alias says otherwise, callbacks require a live, initialized context; every file or directory handle must be live and belong to that context; C strings must be NUL-terminated and readable for the call; and buffers must be valid for the supplied size. File and directory operation callbacks generally return -1 or null with errno set on failure. Server-cache callbacks instead return one on failure and do not promise an errno value. Callback implementations must not unwind across the C ABI boundary.

Directory-entry pointers are borrowed from libsmbclient. They may be invalidated by the next read on the same directory or when the directory is closed, so callers must copy needed data.

§Feature flags

namedescriptiondefault
abi-0-6Require libsmbclient ABI 0.6 or newer.
abi-0-8Require libsmbclient ABI 0.8 or newer.
vendoredBuild the bundled Samba source instead of using the system library.

Structs§

libsmb_file_info
Extended directory-entry metadata returned by libsmbclient.
print_job_info
Information about a queued SMB print job.
smbc_dirent
A directory entry returned by libsmbclient.
smbc_notify_callback_action
A single directory notification action reported by libsmbclient.

Enums§

_SMBCCTX
Opaque native SMB client context.
_SMBCFILE
Opaque native SMB file or directory handle.
_SMBCSRV
Opaque native SMB server handle.

Constants§

SMBC_BASE_FD
Smallest file descriptor returned by libsmbclient.
SMBC_COMMS_SHARE
Directory-entry type for an SMB communications share.
SMBC_DIR
Directory-entry type for an SMB directory.
SMBC_DOS_MODE_ARCHIVE
DOS attribute bit for archived files.
SMBC_DOS_MODE_DIRECTORY
DOS attribute bit for directories.
SMBC_DOS_MODE_HIDDEN
DOS attribute bit for hidden files.
SMBC_DOS_MODE_READONLY
DOS attribute bit for read-only files.
SMBC_DOS_MODE_SYSTEM
DOS attribute bit for system files.
SMBC_DOS_MODE_VOLUME_ID
DOS attribute bit for volume identifiers.
SMBC_ENCRYPTLEVEL_DEFAULT
Default SMB encryption policy.
SMBC_ENCRYPTLEVEL_NONE
SMB encryption is disabled.
SMBC_ENCRYPTLEVEL_REQUEST
SMB encryption is requested when available.
SMBC_ENCRYPTLEVEL_REQUIRE
SMB encryption is required.
SMBC_FILE
Directory-entry type for an SMB file.
SMBC_FILE_SHARE
Directory-entry type for an SMB file share.
SMBC_IPC_SHARE
Directory-entry type for an SMB IPC share.
SMBC_LINK
Directory-entry type for an SMB symbolic link.
SMBC_NOTIFY_ACTION_ADDED
Notification action for an added entry.
SMBC_NOTIFY_ACTION_ADDED_STREAM
Notification action for an added stream.
SMBC_NOTIFY_ACTION_MODIFIED
Notification action for a modified entry.
SMBC_NOTIFY_ACTION_MODIFIED_STREAM
Notification action for a modified stream.
SMBC_NOTIFY_ACTION_NEW_NAME
Notification action for a new entry name.
SMBC_NOTIFY_ACTION_OLD_NAME
Notification action for an old entry name.
SMBC_NOTIFY_ACTION_REMOVED
Notification action for a removed entry.
SMBC_NOTIFY_ACTION_REMOVED_STREAM
Notification action for a removed stream.
SMBC_NOTIFY_CHANGE_ATTRIBUTES
Notification filter for attribute changes.
SMBC_NOTIFY_CHANGE_CREATION
Notification filter for creation-time changes.
SMBC_NOTIFY_CHANGE_DIR_NAME
Notification filter for directory-name changes.
SMBC_NOTIFY_CHANGE_EA
Notification filter for extended-attribute changes.
SMBC_NOTIFY_CHANGE_FILE_NAME
Notification filter for file-name changes.
SMBC_NOTIFY_CHANGE_LAST_ACCESS
Notification filter for last-access changes.
SMBC_NOTIFY_CHANGE_LAST_WRITE
Notification filter for last-write changes.
SMBC_NOTIFY_CHANGE_SECURITY
Notification filter for security changes.
SMBC_NOTIFY_CHANGE_SIZE
Notification filter for size changes.
SMBC_NOTIFY_CHANGE_STREAM_NAME
Notification filter for stream-name changes.
SMBC_NOTIFY_CHANGE_STREAM_SIZE
Notification filter for stream-size changes.
SMBC_NOTIFY_CHANGE_STREAM_WRITE
Notification filter for stream-write changes.
SMBC_PRINTER_SHARE
Directory-entry type for an SMB printer share.
SMBC_SERVER
Directory-entry type for an SMB server.
SMBC_SHAREMODE_DENY_ALL
Share mode that denies all access sharing.
SMBC_SHAREMODE_DENY_DOS
Share mode that denies DOS compatibility access.
SMBC_SHAREMODE_DENY_FCB
Share mode that denies file-control-block sharing.
SMBC_SHAREMODE_DENY_NONE
Share mode that allows all sharing.
SMBC_SHAREMODE_DENY_READ
Share mode that denies read sharing.
SMBC_SHAREMODE_DENY_WRITE
Share mode that denies write sharing.
SMBC_VFS_FEATURE_CASE_INSENSITIVE
VFS feature indicating case-insensitive path handling.
SMBC_VFS_FEATURE_DFS
VFS feature indicating DFS support.
SMBC_VFS_FEATURE_NO_UNIXCIFS
VFS feature indicating the absence of Unix CIFS extensions.
SMBC_VFS_FEATURE_RDONLY
VFS feature indicating a read-only filesystem.
SMBC_WORKGROUP
Directory-entry type for an SMB workgroup.
SMBC_XATTR_FLAG_CREATE
Extended-attribute flag that requires a new attribute.
SMBC_XATTR_FLAG_REPLACE
Extended-attribute flag that requires an existing attribute.

Functions§

smbc_free_context
Attempts to free context and optionally shuts down its connections.
smbc_getDebug
Returns the native debug verbosity configured for c.
smbc_getFunctionChmod
Returns the mode-change callback installed in c.
smbc_getFunctionClose
Returns the file-close callback installed in c.
smbc_getFunctionClosedir
Returns the directory-close callback installed in c.
smbc_getFunctionCreat
Returns the file-creation callback installed in c.
smbc_getFunctionFstat
Returns the open-file metadata callback installed in c.
smbc_getFunctionFstatVFS
Returns the open-file filesystem-statistics callback installed in c.
smbc_getFunctionFstatdir
Returns the directory-metadata callback installed in c.
smbc_getFunctionFtruncate
Returns the file-truncation callback installed in c.
smbc_getFunctionGetdents
Returns the multiple-directory-entry callback installed in c.
smbc_getFunctionGetxattr
Returns the extended-attribute read callback installed in c.
smbc_getFunctionListPrintJobs
Returns the print-job listing callback installed in c.
smbc_getFunctionListxattr
Returns the extended-attribute listing callback installed in c.
smbc_getFunctionLseek
Returns the file-seek callback installed in c.
smbc_getFunctionLseekdir
Returns the directory-seek callback installed in c.
smbc_getFunctionMkdir
Returns the directory-creation callback installed in c.
smbc_getFunctionNotify
Returns the directory-notification callback installed in c.
smbc_getFunctionOpen
Returns the file-open callback installed in c.
smbc_getFunctionOpenPrintJob
Returns the print-job opening callback installed in c.
smbc_getFunctionOpendir
Returns the directory-open callback installed in c.
smbc_getFunctionPrintFile
Returns the file-printing callback installed in c.
smbc_getFunctionRead
Returns the file-read callback installed in c.
smbc_getFunctionReaddir
Returns the directory-read callback installed in c.
smbc_getFunctionReaddirPlus
Returns the extended directory-read callback installed in c.
smbc_getFunctionRemovexattr
Returns the extended-attribute removal callback installed in c.
smbc_getFunctionRename
Returns the entry-rename callback installed in c.
smbc_getFunctionRmdir
Returns the directory-removal callback installed in c.
smbc_getFunctionSetxattr
Returns the extended-attribute write callback installed in c.
smbc_getFunctionSplice
Returns the file-splicing callback installed in c.
smbc_getFunctionStat
Returns the path-metadata callback installed in c.
smbc_getFunctionStatVFS
Returns the filesystem-statistics callback installed in c.
smbc_getFunctionTelldir
Returns the directory-position callback installed in c.
smbc_getFunctionUnlink
Returns the file-removal callback installed in c.
smbc_getFunctionUnlinkPrintJob
Returns the print-job removal callback installed in c.
smbc_getFunctionUtimes
Returns the timestamp-update callback installed in c.
smbc_getFunctionWrite
Returns the file-write callback installed in c.
smbc_getNetbiosName
Returns the NetBIOS name configured for c.
smbc_getOptionBrowseMaxLmbCount
Returns the maximum local master browser query count configured for c.
smbc_getOptionCaseSensitive
Returns whether path matching is case-sensitive for c.
smbc_getOptionDebugToStderr
Returns whether native debug output is written to standard error for c.
smbc_getOptionFallbackAfterKerberos
Returns whether authentication falls back after Kerberos fails.
smbc_getOptionFullTimeNames
Returns whether full SMB time attribute names are enabled for c.
smbc_getOptionNoAutoAnonymousLogin
Returns whether automatic anonymous authentication is disabled.
smbc_getOptionOneSharePerServer
Returns whether each server connection is restricted to one share.
smbc_getOptionOpenShareMode
Returns the file-open sharing mode configured for c.
smbc_getOptionSmbEncryptionLevel
Returns the SMB encryption policy configured for c.
smbc_getOptionUrlEncodeReaddirEntries
Returns whether URL encoding is enabled for directory-entry names in c.
smbc_getOptionUseCCache
Returns whether Kerberos uses the credential cache.
smbc_getOptionUseKerberos
Returns whether Kerberos authentication is enabled for c.
smbc_getOptionUseNTHash
Returns whether the password configured for c is an NT hash.
smbc_getOptionUserData
Returns the user data pointer stored in c.
smbc_getPort
Returns the TCP port configured for c, or zero for the native default.
smbc_getTimeout
Returns the timeout configured for c in milliseconds.
smbc_getUser
Returns the username configured for c.
smbc_getWorkgroup
Returns the workgroup configured for c.
smbc_init_context
Initializes a newly allocated native SMB context.
smbc_new_context
Allocates a new, uninitialized native SMB context.
smbc_setConfiguration
Sets the global libsmbclient configuration file used by c.
smbc_setDebug
Sets the native debug verbosity for c.
smbc_setFunctionAuthDataWithContext
Installs the context-aware authentication callback for c.
smbc_setLogCallback
Installs the callback used for native diagnostic messages.
smbc_setNetbiosName
Sets the NetBIOS name configured for c.
smbc_setOptionBrowseMaxLmbCount
Sets the maximum local master browser query count for c.
smbc_setOptionCaseSensitive
Controls case-sensitive path matching for c.
smbc_setOptionDebugToStderr
Controls whether native debug output is written to standard error.
smbc_setOptionFallbackAfterKerberos
Controls fallback after Kerberos authentication fails.
smbc_setOptionFullTimeNames
Enables or disables full SMB time attribute names for c.
smbc_setOptionNoAutoAnonymousLogin
Prevents automatic anonymous authentication when enabled.
smbc_setOptionOneSharePerServer
Restricts each server connection to one share when enabled.
smbc_setOptionOpenShareMode
Sets the file-open sharing mode for c.
smbc_setOptionProtocols
Sets the minimum and maximum SMB dialects offered during protocol negotiation.
smbc_setOptionSmbEncryptionLevel
Sets the SMB encryption policy for c.
smbc_setOptionUrlEncodeReaddirEntries
Controls URL encoding of directory-entry names for c.
smbc_setOptionUseCCache
Controls whether Kerberos uses the credential cache.
smbc_setOptionUseKerberos
Controls whether Kerberos authentication is attempted for c.
smbc_setOptionUseNTHash
Marks the password configured for c as an NT hash when enabled.
smbc_setOptionUserData
Stores an opaque user data pointer in c.
smbc_setPort
Sets the TCP port used by c, where zero selects the native default.
smbc_setTimeout
Sets the timeout for c in milliseconds.
smbc_setUser
Sets the username configured for c.
smbc_setWorkgroup
Sets the workgroup configured for c.
smbc_set_credentials_with_fallback
Sets fallback credentials used by libsmbclient for DFS referrals.
smbc_version
Returns the linked libsmbclient version string.

Type Aliases§

SMBCCTX
Native libsmbclient context.
SMBCFILE
Native SMB file or directory handle.
SMBCSRV
Native SMB server handle.
smbc_add_cached_srv_fn
Optional callback that inserts a server into the connection cache.
smbc_bool
Native Boolean represented as a C integer.
smbc_check_server_fn
Optional callback that checks whether a cached server is still available.
smbc_chmod_fn
Optional callback that changes a remote entry’s POSIX mode.
smbc_close_fn
Optional callback that closes an open file handle.
smbc_closedir_fn
Optional callback that closes an open directory handle.
smbc_creat_fn
Optional callback that creates a remote file.
smbc_debug_callback_fn
Optional callback that receives native libsmbclient diagnostics.
smbc_fstat_fn
Optional callback that reads metadata from an open file handle.
smbc_fstatdir_fn
Optional callback that reads metadata from an open directory handle.
smbc_fstatvfs_fn
Optional callback that reads filesystem statistics from an open file handle.
smbc_ftruncate_fn
Optional callback that changes the length of an open remote file.
smbc_get_auth_data_fn
Optional callback that supplies authentication strings.
smbc_get_auth_data_with_context_fn
Optional context-aware callback that supplies authentication strings.
smbc_get_cached_srv_fn
Optional callback that looks up a server in the connection cache.
smbc_getdents_fn
Optional callback that reads multiple directory entries into a buffer.
smbc_getxattr_fn
Optional callback that reads a remote entry’s extended attribute.
smbc_list_print_job_fn
Optional callback invoked for each print job in a queue.
smbc_list_print_jobs_fn
Optional callback that enumerates jobs in a print queue.
smbc_listxattr_fn
Optional callback that lists a remote entry’s extended attributes.
smbc_lseek_fn
Optional callback that changes an open file’s offset.
smbc_lseekdir_fn
Optional callback that changes a directory-stream offset.
smbc_mkdir_fn
Optional callback that creates a remote directory.
smbc_notify_callback_fn
Callback invoked with directory notification actions.
smbc_notify_fn
Optional callback that watches a directory for changes.
smbc_open_fn
Optional callback that opens a remote file.
smbc_open_print_job_fn
Optional callback that opens a new print job.
smbc_opendir_fn
Optional callback that opens a remote directory.
smbc_print_file_fn
Optional callback that submits a remote file to a print queue.
smbc_purge_cached_fn
Optional callback that purges the connection cache.
smbc_read_fn
Optional callback that reads bytes from an open remote file.
smbc_readdir_fn
Optional callback that reads the next directory entry.
smbc_readdirplus_fn
Optional callback that reads the next directory entry with metadata.
smbc_remove_cached_srv_fn
Optional callback that removes a server from the connection cache.
smbc_remove_unused_server_fn
Optional callback that removes an unused cached server.
smbc_removexattr_fn
Optional callback that removes a remote entry’s extended attribute.
smbc_rename_fn
Optional callback that renames or moves a remote entry.
smbc_rmdir_fn
Optional callback that removes a remote directory.
smbc_setxattr_fn
Optional callback that writes a remote entry’s extended attribute.
smbc_share_mode
Native value for the open_share_mode option.
smbc_smb_encrypt_level
Native value for the SMB transport encryption policy.
smbc_splice_callback_fn
Callback invoked while libsmbclient splices data between two open files.
smbc_splice_fn
Optional callback that splices data between two open remote files.
smbc_stat_fn
Optional callback that reads metadata for a remote path.
smbc_statvfs_fn
Optional callback that reads filesystem statistics for a remote path.
smbc_telldir_fn
Optional callback that returns the current directory-stream offset.
smbc_unlink_fn
Optional callback that removes a remote file.
smbc_unlink_print_job_fn
Optional callback that removes a job from a print queue.
smbc_utimes_fn
Optional callback that changes a remote entry’s access and modification times.
smbc_vfs_feature
Bitmask describing filesystem capabilities reported by libsmbclient.
smbc_write_fn
Optional callback that writes bytes to an open remote file.