98701b2693e2174e513c4b0d005940574dd2dea1
[vlendec/samba-autobuild/.git] / source3 / include / libsmbclient.h
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
8    
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.
13    
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.
18    
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.
22   =====================================================================*/
23
24 #ifndef SMBCLIENT_H_INCLUDED
25 #define SMBCLIENT_H_INCLUDED
26
27 /*-------------------------------------------------------------------*/
28 /* The following are special comments to instruct DOXYGEN (automated 
29  * documentation tool:
30 */
31 /** \defgroup libsmbclient
32 */
33 /** \defgroup structure Data Structures Type and Constants
34 *   \ingroup libsmbclient
35 *   Data structures, types, and constants
36 */
37 /** \defgroup file File Functions
38 *   \ingroup libsmbclient
39 *   Functions used to access individual file contents
40 */
41 /** \defgroup directory Directory Functions
42 *   \ingroup libsmbclient
43 *   Functions used to access directory entries
44 */
45 /** \defgroup attribute Attributes Functions
46 *   \ingroup libsmbclient
47 *   Functions used to view or change file and directory attributes
48 */
49 /** \defgroup print Print Functions
50 *   \ingroup libsmbclient
51 *   Functions used to access printing functionality
52 */
53 /** \defgroup attribute Miscellaneous Functions
54 *   \ingroup libsmbclient
55 *   Functions that don't fit in to other categories
56 */
57 /*-------------------------------------------------------------------*/   
58
59 /* Make sure we have the following includes for now ... */
60 #include <sys/types.h>
61 #include <sys/stat.h>
62 #include <fcntl.h>
63
64 #define SMBC_MAX_NAME       1023
65 #define SMBC_WORKGROUP      1
66 #define SMBC_SERVER         2
67 #define SMBC_FILE_SHARE     3
68 #define SMBC_PRINTER_SHARE  4
69 #define SMBC_COMMS_SHARE    5
70 #define SMBC_IPC_SHARE      6
71 #define SMBC_DIR            7
72 #define SMBC_FILE           8
73 #define SMBC_LINK           9
74
75 #define SMBC_FILE_MODE (S_IFREG | 0444)
76 #define SMBC_DIR_MODE  (S_IFDIR | 0555)
77
78 #define SMBC_MAX_FD         10000
79
80
81 /**@ingroup structure
82  * Structure that represents a directory entry.
83  *
84  */
85 struct smbc_dirent 
86 {
87         /** Type of entity.
88             SMBC_WORKGROUP=1,
89             SMBC_SERVER=2, 
90             SMBC_FILE_SHARE=3,
91             SMBC_PRINTER_SHARE=4,
92             SMBC_COMMS_SHARE=5,
93             SMBC_IPC_SHARE=6,
94             SMBC_DIR=7,
95             SMBC_FILE=8,
96             SMBC_LINK=9,*/ 
97         uint smbc_type; 
98
99         /** Length of this smbc_dirent in bytes
100          */
101         uint dirlen;
102         /** The length of the comment string in bytes (includes null 
103          *  terminator)
104          */
105         uint commentlen;
106         /** Points to the null terminated comment string 
107          */
108         char *comment;
109         /** The length of the name string in bytes (includes null 
110          *  terminator)
111          */
112         uint namelen;
113         /** Points to the null terminated name string 
114          */
115         char name[1];
116 };
117
118
119 #ifndef _CLIENT_H
120 typedef unsigned short uint16;
121
122 /**@ingroup structure
123  * Structure that represents a print job.
124  *
125  */
126 struct print_job_info 
127 {
128         /** numeric ID of the print job
129          */
130         uint16 id;
131     
132         /** represents print job priority (lower numbers mean higher priority)
133          */
134         uint16 priority;
135     
136         /** Size of the print job
137          */
138         size_t size;
139     
140         /** Name of the user that owns the print job
141          */
142         char user[128];
143   
144         /** Name of the print job. This will have no name if an anonymous print
145          *  file was opened. Ie smb://server/printer
146          */
147         char name[128];
148
149         /** Time the print job was spooled
150          */
151         time_t t;
152 };
153 #endif
154
155
156 /**@ingroup structure
157  * Authentication callback function type.
158  * 
159  * Type for the the authentication function called by the library to
160  * obtain authentication credentals
161  *
162  * @param srv       Server being authenticated to
163  *
164  * @param shr       Share being authenticated to
165  *
166  * @param wg        Pointer to buffer containing a "hint" for the
167  *                  workgroup to be authenticated.  Should be filled in
168  *                  with the correct workgroup if the hint is wrong.
169  * 
170  * @param wglen     The size of the workgroup buffer in bytes
171  *
172  * @param un        Pointer to buffer containing a "hint" for the
173  *                  user name to be use for authentication. Should be
174  *                  filled in with the correct workgroup if the hint is
175  *                  wrong.
176  * 
177  * @param unlen     The size of the username buffer in bytes
178  *
179  * @param pw        Pointer to buffer containing to which password 
180  *                  copied
181  * 
182  * @param pwlen     The size of the password buffer in bytes
183  *           
184  */
185 typedef void (*smbc_get_auth_data_fn)(const char *srv, 
186                                       const char *shr,
187                                       char *wg, int wglen, 
188                                       char *un, int unlen,
189                                       char *pw, int pwlen);
190
191
192 /**@ingroup structure
193  * Print job info callback function type.
194  *
195  * @param i         pointer to print job information structure
196  *
197  */ 
198 typedef void (*smbc_get_print_job_info)(struct print_job_info *i);
199
200
201 /**@ingroup misc
202  * Initialize the samba client library.
203  *
204  * Must be called before using any of the smbclient API function
205  *  
206  * @param fn        The function that will be called to obtaion 
207  *                  authentication credentials.
208  *
209  * @param debug     Allows caller to set the debug level. Can be
210  *                  changed in smb.conf file. Allows caller to set
211  *                  debugging if no smb.conf.
212  *   
213  * @return          0 on success, < 0 on error with errno set:
214  *                  - ENOMEM Out of memory
215  *                  - ENOENT The smb.conf file would not load
216  *
217  */
218 int smbc_init(smbc_get_auth_data_fn fn, int debug);
219
220
221 /**@ingroup file
222  * Open a file on an SMB server.
223  *
224  * @param furl      The smb url of the file to be opened. 
225  *
226  * @param flags     Is one of O_RDONLY, O_WRONLY or O_RDWR which 
227  *                  request opening  the  file  read-only,write-only
228  *                  or read/write. flags may also be bitwise-or'd with
229  *                  one or  more of  the following: 
230  *                  O_CREAT - If the file does not exist it will be 
231  *                  created.
232  *                  O_EXCL - When  used with O_CREAT, if the file 
233  *                  already exists it is an error and the open will 
234  *                  fail. 
235  *                  O_TRUNC - If the file already exists it will be
236  *                  truncated.
237  *                  O_APPEND The  file  is  opened  in  append mode 
238  *
239  * @param mode      mode specifies the permissions to use if a new 
240  *                  file is created.  It  is  modified  by  the 
241  *                  process's umask in the usual way: the permissions
242  *                  of the created file are (mode & ~umask) 
243  *
244  *                  Not currently use, but there for future use.
245  *                  We will map this to SYSTEM, HIDDEN, etc bits
246  *                  that reverses the mapping that smbc_fstat does.
247  *
248  * @return          Valid file handle, < 0 on error with errno set:
249  *                  - ENOMEM  Out of memory
250  *                  - EINVAL if an invalid parameter passed, like no 
251  *                  file, or smbc_init not called.
252  *                  - EEXIST  pathname already exists and O_CREAT and 
253  *                  O_EXCL were used.
254  *                  - EISDIR  pathname  refers  to  a  directory  and  
255  *                  the access requested involved writing.
256  *                  - EACCES  The requested access to the file is not 
257  *                  allowed 
258  *                  - ENODEV The requested share does not exist
259  *                  - ENOTDIR A file on the path is not a directory
260  *                  - ENOENT  A directory component in pathname does 
261  *                  not exist.
262  *
263  * @see             smbc_creat()
264  *
265  * @note            This call uses an underlying routine that may create
266  *                  a new connection to the server specified in the URL.
267  *                  If the credentials supplied in the URL, or via the
268  *                  auth_fn in the smbc_init call, fail, this call will
269  *                  try again with an empty username and password. This 
270  *                  often gets mapped to the guest account on some machines.
271  */
272 int smbc_open(const char *furl, int flags, mode_t mode);
273
274
275 /**@ingroup file
276  * Create a file on an SMB server.
277  *
278  * Same as calling smbc_open() with flags = O_CREAT|O_WRONLY|O_TRUNC 
279  *   
280  * @param furl      The smb url of the file to be created
281  *  
282  * @param mode      mode specifies the permissions to use if  a  new  
283  *                  file is created.  It  is  modified  by  the 
284  *                  process's umask in the usual way: the permissions
285  *                  of the created file are (mode & ~umask)
286  *
287  *                  NOTE, the above is not true. We are dealing with 
288  *                  an SMB server, which has no concept of a umask!
289  *      
290  * @return          Valid file handle, < 0 on error with errno set:
291  *                  - ENOMEM  Out of memory
292  *                  - EINVAL if an invalid parameter passed, like no 
293  *                  file, or smbc_init not called.
294  *                  - EEXIST  pathname already exists and O_CREAT and
295  *                  O_EXCL were used.
296  *                  - EISDIR  pathname  refers  to  a  directory  and
297  *                  the access requested involved writing.
298  *                  - EACCES  The requested access to the file is not
299  *                  allowed 
300  *                  - ENOENT  A directory component in pathname does 
301  *                  not exist.
302  *                  - ENODEV The requested share does not exist.
303  * @see             smbc_open()
304  *
305  */
306 int smbc_creat(const char *furl, mode_t mode);
307
308
309 /**@ingroup file
310  * Read from a file using an opened file handle.
311  *
312  * @param fd        Open file handle from smbc_open() or smbc_creat()
313  *
314  * @param buf       Pointer to buffer to recieve read data
315  *
316  * @param bufsize   Size of buf in bytes
317  *
318  * @return          Number of bytes read, < 0 on error with errno set:
319  *                  - EISDIR fd refers to a directory
320  *                  - EBADF  fd  is  not  a valid file descriptor or 
321  *                  is not open for reading.
322  *                  - EINVAL fd is attached to an object which is 
323  *                  unsuitable for reading, or no buffer passed or
324  *                  smbc_init not called.
325  *
326  * @see             smbc_open(), smbc_write()
327  *
328  */
329 ssize_t smbc_read(int fd, void *buf, size_t bufsize);
330
331
332 /**@ingroup file
333  * Write to a file using an opened file handle.
334  *
335  * @param fd        Open file handle from smbc_open() or smbc_creat()
336  *
337  * @param buf       Pointer to buffer to recieve read data
338  *
339  * @param bufsize   Size of buf in bytes
340  *
341  * @return          Number of bytes written, < 0 on error with errno set:
342  *                  - EISDIR fd refers to a directory.
343  *                  - EBADF  fd  is  not  a valid file descriptor or 
344  *                  is not open for reading.
345  *                  - EINVAL fd is attached to an object which is 
346  *                  unsuitable for reading, or no buffer passed or
347  *                  smbc_init not called.
348  *
349  * @see             smbc_open(), smbc_read()
350  *
351  */
352 ssize_t smbc_write(int fd, void *buf, size_t bufsize);
353
354
355 /**@ingroup file
356  * Seek to a specific location in a file.
357  *
358  * @param fd        Open file handle from smbc_open() or smbc_creat()
359  * 
360  * @param offset    Offset in bytes from whence
361  * 
362  * @param whence    A location in the file:
363  *                  - SEEK_SET The offset is set to offset bytes from
364  *                  the beginning of the file
365  *                  - SEEK_CUR The offset is set to current location 
366  *                  plus offset bytes.
367  *                  - SEEK_END The offset is set to the size of the 
368  *                  file plus offset bytes.
369  *
370  * @return          Upon successful completion, lseek returns the 
371  *                  resulting offset location as measured in bytes 
372  *                  from the beginning  of the file. Otherwise, a value
373  *                  of (off_t)-1 is returned and errno is set to 
374  *                  indicate the error:
375  *                  - EBADF  Fildes is not an open file descriptor.
376  *                  - EINVAL Whence is not a proper value or smbc_init
377  *                    not called.
378  *
379  * @todo Are all the whence values really supported?
380  * 
381  * @todo Are errno values complete and correct?
382  */
383 off_t smbc_lseek(int fd, off_t offset, int whence);
384
385
386 /**@ingroup file
387  * Close an open file handle.
388  *
389  * @param fd        The file handle to close
390  *
391  * @return          0 on success, < 0 on error with errno set:
392  *                  - EBADF  fd isn't a valid open file descriptor
393  *                  - EINVAL smbc_init() failed or has not been called
394  *
395  * @see             smbc_open(), smbc_creat()
396  */
397 int smbc_close(int fd);
398
399
400 /**@ingroup directory
401  * Unlink (delete) a file or directory.
402  *
403  * @param furl      The smb url of the file to delete
404  *
405  * @return          0 on success, < 0 on error with errno set:
406  *                  - EACCES or EPERM Write  access  to the directory 
407  *                  containing pathname is not allowed or one  
408  *                  of  the  directories in pathname did not allow
409  *                  search (execute) permission
410  *                  - ENOENT A directory component in pathname does
411  *                  not exist
412  *                  - EINVAL NULL was passed in the file param or
413  *                    smbc_init not called.
414  *                  - EACCES You do not have access to the file
415  *                  - ENOMEM Insufficient kernel memory was available
416  *
417  * @see             smbc_rmdir()s
418  *
419  * @todo Are errno values complete and correct?
420  */
421 int smbc_unlink(const char *furl);
422
423
424 /**@ingroup directory
425  * Rename or move a file or directory.
426  * 
427  * @param ourl      The original smb url (source url) of file or 
428  *                  directory to be moved
429  * 
430  * @param nurl      The new smb url (destination url) of the file
431  *                  or directory after the move.  Currently nurl must
432  *                  be on the same share as ourl.
433  *
434  * @return          0 on success, < 0 on error with errno set:
435  *                  - EISDIR nurl is an existing directory, but ourl is
436  *                  not a directory.
437  *                  - EEXIST nurl is  a  non-empty directory, 
438  *                  i.e., contains entries other than "." and ".."
439  *                  - EINVAL The  new  url  contained  a path prefix 
440  *                  of the old, or, more generally, an  attempt was
441  *                  made  to make a directory a subdirectory of itself
442  *                  or smbc_init not called.
443  *                  - ENOTDIR A component used as a directory in ourl 
444  *                  or nurl path is not, in fact, a directory.  Or, 
445  *                  ourl  is a directory, and newpath exists but is not
446  *                  a directory.
447  *                  - EACCES or EPERM Write access to the directory 
448  *                  containing ourl or nurl is not allowed for the 
449  *                  process's effective uid,  or  one of the 
450  *                  directories in ourl or nurl did not allow search
451  *                  (execute) permission,  or ourl  was  a  directory
452  *                  and did not allow write permission.
453  *                  - ENOENT A  directory component in ourl or nurl 
454  *                  does not exist.
455  *                  - EXDEV Rename across shares not supported.
456  *                  - ENOMEM Insufficient kernel memory was available.
457  *                  - EEXIST The target file, nurl, already exists.
458  *
459  *
460  * @todo Are we going to support copying when urls are not on the same
461  *       share?  I say no... NOTE. I agree for the moment.
462  *
463  */
464 int smbc_rename(const char *ourl, const char *nurl);
465
466
467 /**@ingroup directory
468  * Open a directory used to obtain directory entries.
469  *
470  * @param durl      The smb url of the directory to open
471  *
472  * @return          Valid directory handle. < 0 on error with errno set:
473  *                  - EACCES Permission denied.
474  *                  - EINVAL A NULL file/URL was passed, or the URL would
475  *                  not parse, or was of incorrect form or smbc_init not
476  *                  called.
477  *                  - ENOENT durl does not exist, or name is an 
478  *                  - ENOMEM Insufficient memory to complete the 
479  *                  operation.                              
480  *                  - ENOTDIR name is not a directory.
481  *                  - EPERM the workgroup could not be found.
482  *                  - ENODEV the workgroup or server could not be found.
483  *
484  * @see             smbc_getdents(), smbc_readdir(), smbc_closedir()
485  *
486  */
487 int smbc_opendir(const char *durl);
488
489
490 /**@ingroup directory
491  * Close a directory handle opened by smbc_opendir().
492  *
493  * @param dh        Directory handle to close
494  *
495  * @return          0 on success, < 0 on error with errno set:
496  *                  - EBADF dh is an invalid directory handle
497  *
498  * @see             smbc_opendir()
499  */
500 int smbc_closedir(int dh);
501
502
503 /**@ingroup directory
504  * Get multiple directory entries.
505  *
506  * smbc_getdents() reads as many dirent structures from the an open 
507  * directory handle into a specified memory area as will fit.
508  *
509  * @param dh        Valid directory as returned by smbc_opendir()
510  *
511  * @param dirp      pointer to buffer that will receive the directory
512  *                  entries.
513  * 
514  * @param count     The size of the dirp buffer in bytes
515  *
516  * @returns         If any dirents returned, return will indicate the
517  *                  total size. If there were no more dirents available,
518  *                  0 is returned. < 0 indicates an error.
519  *                  - EBADF  Invalid directory handle
520  *                  - EINVAL Result buffer is too small or smbc_init
521  *                  not called.
522  *                  - ENOENT No such directory.
523  * @see             , smbc_dirent, smbc_readdir(), smbc_open()
524  *
525  * @todo Are errno values complete and correct?
526  *
527  * @todo Add example code so people know how to parse buffers.
528  */
529 int smbc_getdents(unsigned int dh, struct smbc_dirent *dirp, int count);
530
531
532 /**@ingroup directory
533  * Get a single directory entry.
534  *
535  * @param dh        Valid directory as returned by smbc_opendir()
536  *
537  * @return          A pointer to a smbc_dirent structure, or NULL if an
538  *                  error occurs or end-of-directory is reached:
539  *                  - EBADF Invalid directory handle
540  *                  - EINVAL smbc_init() failed or has not been called
541  *
542  * @see             smbc_dirent, smbc_getdents(), smbc_open()
543  */
544 struct smbc_dirent* smbc_readdir(unsigned int dh);
545
546
547 /**@ingroup directory
548  * Get the current directory offset.
549  *
550  * smbc_telldir() may be used in conjunction with smbc_readdir() and
551  * smbc_lseekdir().
552  *
553  * @param dh        Valid directory as returned by smbc_opendir()
554  *
555  * @return          The current location in the directory stream or -1
556  *                  if an error occur.  The current location is not
557  *                  an offset. Becuase of the implementation, it is a 
558  *                  handle that allows the library to find the entry
559  *                  later.
560  *                  - EBADF dh is not a valid directory handle
561  *                  - EINVAL smbc_init() failed or has not been called
562  *                  - ENOTDIR if dh is not a directory
563  *
564  * @see             smbc_readdir()
565  *
566  */
567 off_t smbc_telldir(int dh);
568
569
570 /**@ingroup directory
571  * lseek on directories.
572  *
573  * smbc_lseekdir() may be used in conjunction with smbc_readdir() and
574  * smbc_telldir(). (rewind by smbc_lseekdir(fd, NULL))
575  *
576  * @param fd        Valid directory as returned by smbc_opendir()
577  * 
578  * @param offset    The offset (as returned by smbc_telldir). Can be
579  *                  NULL, in which case we will rewind
580  *
581  * @return          0 on success, -1 on failure
582  *                  - EBADF dh is not a valid directory handle
583  *                  - ENOTDIR if dh is not a directory
584  *                  - EINVAL offset did not refer to a valid dirent or
585  *                    smbc_init not called.
586  *
587  * @see             smbc_telldir()
588  *
589  *
590  * @todo In what does the reture and errno values mean?
591  */
592 int smbc_lseekdir(int fd, off_t offset);
593
594 /**@ingroup directory
595  * Create a directory.
596  *
597  * @param durl      The url of the directory to create
598  *
599  * @param mode      Specifies  the  permissions to use. It is modified
600  *                  by the process's umask in the usual way: the 
601  *                  permissions of the created file are (mode & ~umask).
602  * 
603  * @return          0 on success, < 0 on error with errno set:
604  *                  - EEXIST directory url already exists
605  *                  - EACCES The parent directory does not allow write
606  *                  permission to the process, or one of the directories
607  *                  - ENOENT A directory component in pathname does not
608  *                  exist.
609  *                  - EINVAL NULL durl passed or smbc_init not called.
610  *                  - ENOMEM Insufficient memory was available.
611  *
612  * @see             smbc_rmdir()
613  *
614  */
615 int smbc_mkdir(const char *durl, mode_t mode);
616
617
618 /**@ingroup directory
619  * Remove a directory.
620  * 
621  * @param durl      The smb url of the directory to remove
622  *
623  * @return          0 on success, < 0 on error with errno set:
624  *                  - EACCES or EPERM Write access to the directory
625  *                  containing pathname was not allowed.
626  *                  - EINVAL durl is NULL or smbc_init not called.
627  *                  - ENOENT A directory component in pathname does not
628  *                  exist.
629  *                  - ENOTEMPTY directory contains entries.
630  *                  - ENOMEM Insufficient kernel memory was available.
631  *
632  * @see             smbc_mkdir(), smbc_unlink() 
633  *
634  * @todo Are errno values complete and correct?
635  */
636 int smbc_rmdir(const char *durl);
637
638
639 /**@ingroup attribute
640  * Get information about a file or directory.
641  *
642  * @param url       The smb url to get information for
643  *
644  * @param st        pointer to a buffer that will be filled with 
645  *                  standard Unix struct stat information.
646  *
647  * @return          0 on success, < 0 on error with errno set:
648  *                  - ENOENT A component of the path file_name does not
649  *                  exist.
650  *                  - EINVAL a NULL url was passed or smbc_init not called.
651  *                  - EACCES Permission denied.
652  *                  - ENOMEM Out of memory
653  *                  - ENOTDIR The target dir, url, is not a directory.
654  *
655  * @see             Unix stat()
656  *
657  */
658 int smbc_stat(const char *url, struct stat *st);
659
660
661 /**@ingroup attribute
662  * Get file information via an file descriptor.
663  * 
664  * @param fd        Open file handle from smbc_open() or smbc_creat()
665  *
666  * @param st        pointer to a buffer that will be filled with 
667  *                  standard Unix struct stat information.
668  * 
669  * @return          EBADF  filedes is bad.
670  *                  - EACCES Permission denied.
671  *                  - EBADF fd is not a valid file descriptor
672  *                  - EINVAL Problems occurred in the underlying routines
673  *                    or smbc_init not called.
674  *                  - ENOMEM Out of memory
675  *
676  * @see             smbc_stat(), Unix stat()
677  *
678  */
679 int smbc_fstat(int fd, struct stat *st);
680
681
682 /**@ingroup attribue
683  * Change the ownership of a file or directory.
684  *
685  * @param url       The smb url of the file or directory to change 
686  *                  ownership of.
687  *
688  * @param owner     I have no idea?
689  *
690  * @param group     I have not idea?
691  *
692  * @return          0 on success, < 0 on error with errno set:
693  *                  - EPERM  The effective UID does not match the owner
694  *                  of the file, and is not zero; or the owner or group
695  *                  were specified incorrectly.
696  *                  - ENOENT The file does not exist.
697  *                  - ENOMEM Insufficient was available.
698  *                  - ENOENT file or directory does not exist
699  *
700  * @todo Are we actually going to be able to implement this function
701  *
702  * @todo How do we abstract owner and group uid and gid?
703  *
704  */
705 int smbc_chown(const char *url, uid_t owner, gid_t group);
706
707
708 /**@ingroup attribute
709  * Change the permissions of a file.
710  *
711  * @param url       The smb url of the file or directory to change
712  *                  permissions of
713  * 
714  * @param mode      The permissions to set:
715  *                  - Put good explaination of permissions here!
716  *
717  * @return          0 on success, < 0 on error with errno set:
718  *                  - EPERM  The effective UID does not match the owner
719  *                  of the file, and is not zero
720  *                  - ENOENT The file does not exist.
721  *                  - ENOMEM Insufficient was available.
722  *                  - ENOENT file or directory does not exist
723  *
724  * @todo Actually implement this fuction?
725  *
726  * @todo Are errno values complete and correct?
727  */
728 int smbc_chmod(const char *url, mode_t mode);
729
730
731 /**@ingroup print
732  * Print a file given the name in fname. It would be a URL ...
733  * 
734  * @param fname     The URL of a file on a remote SMB server that the
735  *                  caller wants printed
736  *
737  * @param printq    The URL of the print share to print the file to.
738  *
739  * @return          0 on success, < 0 on error with errno set:         
740  *
741  *                  - EINVAL fname or printq was NULL or smbc_init not
742  *                    not called.
743  *                  and errors returned by smbc_open
744  *
745  */                                     
746 int smbc_print_file(const char *fname, const char *printq);
747
748 /**@ingroup print
749  * Open a print file that can be written to by other calls. This simply
750  * does an smbc_open call after checking if there is a file name on the
751  * URI. If not, a temporary name is added ...
752  *
753  * @param fname     The URL of the print share to print to?
754  *
755  * @returns         A file handle for the print file if successful.
756  *                  Returns -1 if an error ocurred and errno has the values
757  *                  - EINVAL fname was NULL or smbc_init not called.
758  *                  - all errors returned by smbc_open
759  *
760  */
761 int smbc_open_print_job(const char *fname);
762
763 /**@ingroup print
764  * List the print jobs on a print share, for the moment, pass a callback 
765  *
766  * @param purl      The url of the print share to list the jobs of
767  * 
768  * @param fn        Callback function the receives printjob info
769  * 
770  * @return          0 on success, < 0 on error with errno set: 
771  *                  - EINVAL fname was NULL or smbc_init not called
772  *                  - EACCES ???
773  */
774 int smbc_list_print_jobs(const char *purl, smbc_get_print_job_info fn);
775
776 /**@ingroup print
777  * Delete a print job 
778  *
779  * @param purl      Url of the print share
780  *
781  * @param id        The id of the job to delete
782  *
783  * @return          0 on success, < 0 on error with errno set: 
784  *                  - EINVAL fname was NULL or smbc_init not called
785  *
786  * @todo    what errno values are possible here?
787  */
788 int smbc_unlink_print_job(const char *purl, int id);
789
790
791 #endif /* SMBCLIENT_H_INCLUDED */