Index :

Method list
File management
Options
Utility functions
Name service
Related classes

## Method list

### File management (SMB class)

Opens a file. URLs are accepted. Works as its standard equivalent.
int open(const char* file="", int flags=O_RDWR, int mode=0644)

Create a file. URLs are accepted. Works as its standard equivalent.
int creat(const char* file="", int mode=0644)

Reads from an "opened" file descriptor. Does caching.
int read(int fd, void *buf, uint32 count)

Writes to "opened" file descriptor. Does caching.
int write(int fd, void *buf, uint32 count)

Close the file associated with this file descriptor
int close(int fd)

Flush forces a write of all buffered data for the given fd
int flush(int fd)

Position the file position pointer for this file descriptor
int32 lseek(int fd, int32 offset, int from)

Unlink will delete or unlink the file depending on target OS
int unlink(const char *file)

Renames a file, but doesn't move it between directories
int rename(const char *fileURL, const char *newname)

Stats a file/directory. URLs are accepted. Works as its standard equivalent.
int stat(const char *filename, struct stat *buf)

Stats the file/directory corresponding to this fd.
int fstat(int fd, struct stat *buf)

Opens a directory referenced by URL. Returns a directory descriptor.
int opendir(const char *name)

Reads from an "opened" directory descriptor. Does caching.
SMBdirent *readdir(int dirdesc)

Close the directory associated with this file descriptor
int closedir(int dirdesc)

Position the position pointer for this directory descriptor.
int rewinddir(int dirdesc)

Creates a directory with URL pathname
int mkdir(const char *pathname)

Deletes the directory pointed by the URL pathname
int rmdir(const char *pathname)

###

### Options (SMB class)

Specify a callback for the library to get user answers (passwords, login names)
void setPasswordCallback(SmbAnswerCallback *getObject)

Specify a default user, instead of anonymous access
void setDefaultUser(const char *userName)

Makes browsing possible without samba installed locally
void setDefaultBrowseServer(const char *serverName)

Set the charset to use (in native code only)
void setCharSet(const char *aCharSet)

###

### Utility functions (Util class)

Parser for smb URLs. It can interpret "." and ".." as subdirectories, and query for hosts/workgroups.
void parse(const char *name, bool interpretDirs = true)

Those functions return the corresponding components of the last parsed URL. See "parse" for details.
char* user()
char* password()
char* ip()
char* workgroup()
char* host()
char* share()
char* path()

It's also possible to override the current values (used mainly internally)
char* user(const char* newValue)
char* password(const char* newValue)
char* ip(const char* newValue)
char* workgroup(const char* newValue)
char* host(const char* newValue)
char* share(const char* newValue)
char* dir(const char* newValue)

Does the opposite of the parser
char *buildURL(const char* user=0, const char* password=0, const char* workgroup=0, const char *host=0, const char* share=0, const char* path=0, const char* ip=0)

Appends a string to a URL, making it another URL. Subdirs ".." and "." can be recognized and interpreted
char *append(const char* URL, const char *string, bool interpretDirs = true)

###

### Name service (NMB class)

Name query that can find NetBIOS names as well.
struct hostent *gethostbyname(const char *name)

## Related classes

This class replaces the structure dirent, and provides more useful fields
class SMBdirent

Derive this class to implement a way for the library to get user feedback.
class SmbAnswerCallback

Copyright © Nicolas Brodu, 1999 - 2000