Implement two printing related functions and start the remaining two.
[Samba.git] / source / include / libsmbclient.h
blob5469966cf8f1c15356f2cbc5e2d2c2da76025437
1 /*
2 Unix SMB/Netbios implementation.
3 Version 2.0
4 SMB client library API definitions
5 Copyright (C) Andrew Tridgell 1998
6 Copyright (C) Richard Sharpe 2000
7 Copyright (C) John Terpsra 2000
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef _SMBCLIENT_H
25 #define _SMBCLIENT_H
27 /* Make sure we have the following includes for now ... */
29 #include <sys/types.h>
30 #include <sys/stat.h>
31 #include <fcntl.h>
33 #define SMBC_MAX_NAME 1023
35 struct smbc_dirent {
37 uint smbc_type; /* Type of entity, see below */
38 uint dirlen; /* Convenience */
39 uint namelen;
40 uint commentlen;
41 char *comment; /* Points to the comment futher down */
42 char name[1];
47 * Entity types
49 #define SMBC_WORKGROUP 1
50 #define SMBC_SERVER 2
51 #define SMBC_FILE_SHARE 3
52 #define SMBC_PRINTER_SHARE 4
53 #define SMBC_COMMS_SHARE 5
54 #define SMBC_IPC_SHARE 6
55 #define SMBC_DIR 7
56 #define SMBC_FILE 8
57 #define SMBC_LINK 9
59 #define SMBC_FILE_MODE (S_IFREG | 0444)
60 #define SMBC_DIR_MODE (S_IFDIR | 0555)
62 typedef void (*smbc_get_auth_data_fn)(char *server, char *share,
63 char *workgroup, int wgmaxlen,
64 char *username, int unmaxlen,
65 char *password, int pwmaxlen);
68 * Init the smbc package
70 int smbc_init(smbc_get_auth_data_fn fn, const char *workgroup, int debug);
73 * Open a file on an SMB server, this has the same form as normal open
74 * but the fname is a URL of the form smb://server/share/path
77 int smbc_open(const char *fname, int flags, mode_t mode);
80 * Create a file on an SMB server, similar to smbc_open
83 int smbc_creat(const char *fname, mode_t mode);
86 * Read from a file, what about pread?
89 ssize_t smbc_read(int fd, void *buf, size_t count);
91 /*
92 * Write to a file, what about pwrite?
95 ssize_t smbc_write(int fd, void *buf, size_t count);
98 * Close a file by fd
101 int smbc_close(int fd);
104 * Unlink a file on server, share, dir, file ...
107 int smbc_unlink(const char *fname);
110 * rename oname to nname ... probably need to be on the same
111 * server initially. Later can copy between servers ...
114 int smbc_rename(const char *oname, const char *nname);
117 * Seek to a specific location in a file on an SMB server
120 off_t smbc_lseek(int fd, off_t offset, int whence);
123 * Stat a file to get info via file name
126 int smbc_stat(const char *fname, struct stat *st);
129 * Stat a file to get info via an fd
132 int smbc_fstat(int fd, struct stat *st);
135 * Chown a file
138 int smbc_chown(const char *fname, uid_t owner, gid_t group);
141 * Chmod a file
144 int smbc_chmod(const char *fname, mode_t newmode);
147 * Open a directory on a URL (server and share and dir)
150 int smbc_opendir(const char *fname);
153 * Close a directory
156 int smbc_closedir(int fd);
159 * Get a directory entry
162 int smbc_getdents(unsigned int fd, struct smbc_dirent *dirp, int count);
165 * Read a dirent in the old way
168 struct smbc_dirent *smbc_readdir(unsigned int fd);
171 * Create a directory on a server, share, dir in fname URL
174 int smbc_mkdir(const char *fname, mode_t mode);
177 * Remove a directory on a server
180 int smbc_rmdir(const char *fname);
183 * Get the current directory offset
186 off_t smbc_telldir(int fd);
189 * lseek on directories, rewind by smbc_lseekdir(fd, 0, SEEK_SET)
192 int smbc_lseekdir(int fd, off_t offset, int whence);
195 * Print a file given the name in fname. It would be a URL ...
198 int smbc_print_file(const char *fname, const char *printq);
201 * Open a print file that can be written to by other calls. This simply
202 * does an smbc_open call after checking if there is a file name on the
203 * URI. If not, a temporary name is added ...
206 int smbc_open_print_job(const char *fname);
209 * List the print jobs on a print share, for the moment, pass a callback
212 int smbc_list_print_jobs(const char *fname, void (*fn)(struct print_job_info *));
215 * Delete a print job
218 int smbc_unlink_print_job(const char *fname, int id);
220 #endif