• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/samba-3.0.25b/examples/libsmbclient/smbwrapper/
1/*
2   Unix SMB/Netbios implementation.
3   Version 2.0
4   SMB wrapper functions - definitions
5   Copyright (C) Andrew Tridgell 1998
6   Copyright (C) Derrell Lipman 2003-2005
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2 of the License, or
11   (at your option) any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with this program; if not, write to the Free Software
20   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/
22
23#ifndef _SMBW_H
24#define _SMBW_H
25
26#include <sys/types.h>
27#include <errno.h>
28#include <malloc.h>
29#include <limits.h>
30#include <stdlib.h>
31#include <string.h>
32#include <time.h>
33#include "config.h"             /* must come before libsmbclient.h */
34#include "libsmbclient.h"
35#include "wrapper.h"
36
37#ifndef __restrict
38#  define __restrict
39#endif
40
41#undef DEBUG
42#define DEBUG(level, s) do { if (level <= debug_level) printf s; } while (0)
43
44
45#define SMBW_PREFIX "/smb"
46#define SMBW_DUMMY "/dev/null"
47
48extern int smbw_initialized;
49#define SMBW_INIT()     do { if (! smbw_initialized) smbw_init(); } while (0)
50
51#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
52#  define SMBW_OFF_T off64_t
53#else
54#  define SMBW_OFF_T off_t
55#endif
56
57
58/* The following definitions come from  smbwrapper/smbw.c  */
59
60typedef enum {
61        SMBW_RCT_Increment,
62        SMBW_RCT_Decrement,
63        SMBW_RCT_Get,
64        SMBW_RCT_Set
65} Ref_Count_Type;
66
67int smbw_ref(int client_fd, Ref_Count_Type type, ...);
68void smbw_init(void);
69int smbw_fd(int fd);
70int smbw_path(const char *path);
71void smbw_clean_fname(char *name);
72void smbw_fix_path(const char *src, char *dest);
73void smbw_set_auth_data_fn(smbc_get_auth_data_fn fn);
74int smbw_open(const char *fname, int flags, mode_t mode);
75ssize_t smbw_pread(int fd, void *buf, size_t count, SMBW_OFF_T ofs);
76ssize_t smbw_read(int fd, void *buf, size_t count);
77ssize_t smbw_write(int fd, void *buf, size_t count);
78ssize_t smbw_pwrite(int fd, void *buf, size_t count, SMBW_OFF_T ofs);
79int smbw_close(int fd);
80int smbw_fcntl(int fd, int cmd, long arg);
81int smbw_access(const char *name, int mode);
82int smbw_readlink(const char *path, char *buf, size_t bufsize);
83int smbw_unlink(const char *fname);
84int smbw_rename(const char *oldname, const char *newname);
85int smbw_utime(const char *fname, void *buf);
86int smbw_utimes(const char *fname, void *buf);
87int smbw_chown(const char *fname, uid_t owner, gid_t group);
88int smbw_chmod(const char *fname, mode_t newmode);
89SMBW_OFF_T smbw_lseek(int smbw_fd, SMBW_OFF_T offset, int whence);
90int smbw_dup(int fd);
91int smbw_dup2(int fd, int fd2);
92int smbw_fork(void);
93
94/* The following definitions come from  smbwrapper/smbw_dir.c  */
95
96int smbw_dirp(DIR * dirp);
97int smbw_dir_open(const char *fname);
98int smbw_dir_fstat(int fd, SMBW_stat *st);
99int smbw_dir_close(int fd);
100int smbw_getdents(unsigned int fd, SMBW_dirent *dirp, int count);
101int smbw_chdir(const char *name);
102int smbw_mkdir(const char *fname, mode_t mode);
103int smbw_rmdir(const char *fname);
104char *smbw_getcwd(char *buf, size_t size);
105int smbw_fchdir(int fd);
106DIR *smbw_opendir(const char *fname);
107SMBW_dirent *smbw_readdir(DIR *dirp);
108int smbw_readdir_r(DIR *dirp,
109                   struct SMBW_dirent *__restrict entry,
110                   struct SMBW_dirent **__restrict result);
111int smbw_closedir(DIR *dirp);
112void smbw_seekdir(DIR *dirp, long long offset);
113long long smbw_telldir(DIR *dirp);
114int smbw_setxattr(const char *fname,
115                  const char *name,
116                  const void *value,
117                  size_t size,
118                  int flags);
119int smbw_lsetxattr(const char *fname,
120                   const char *name,
121                   const void *value,
122                   size_t size,
123                   int flags);
124int smbw_fsetxattr(int smbw_fd,
125                   const char *name,
126                   const void *value,
127                   size_t size,
128                   int flags);
129int smbw_getxattr(const char *fname,
130                  const char *name,
131                  const void *value,
132                  size_t size);
133int smbw_lgetxattr(const char *fname,
134                   const char *name,
135                   const void *value,
136                   size_t size);
137int smbw_fgetxattr(int smbw_fd,
138                   const char *name,
139                   const void *value,
140                   size_t size);
141int smbw_removexattr(const char *fname,
142                     const char *name);
143int smbw_lremovexattr(const char *fname,
144                      const char *name);
145int smbw_fremovexattr(int smbw_fd,
146                      const char *name);
147int smbw_listxattr(const char *fname,
148                   char *list,
149                   size_t size);
150int smbw_llistxattr(const char *fname,
151                    char *list,
152                    size_t size);
153int smbw_flistxattr(int smbw_fd,
154                    char *list,
155                    size_t size);
156
157/* The following definitions come from  smbwrapper/smbw_stat.c  */
158
159int smbw_fstat(int fd, SMBW_stat *st);
160int smbw_stat(const char *fname, SMBW_stat *st);
161
162/* The following definitions come from smbwrapper/cache.c */
163int
164smbw_cache_functions(SMBCCTX * context);
165
166
167#endif /* _SMBW_H */
168