r6304: missed some files in the previous commit
[Samba.git] / examples / libsmbclient / smbwrapper / wrapper.h
blob6d0d9f527a3f4bffae5cc385ea2aeecaa8d24acc
1 /*
2 Unix SMB/Netbios implementation.
3 Version 2.0
4 SMB wrapper functions
5 Copyright (C) Derrell Lipman 2003-2005
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef __WRAPPER_H__
23 #define __WRAPPER_H__
25 #include <sys/stat.h>
26 #include <sys/select.h>
27 #include <sys/time.h>
28 #include <sys/types.h>
29 #include <unistd.h>
30 #include <dirent.h>
31 #include <utime.h>
32 #include <signal.h>
33 #include <stdio.h>
35 extern int smbw_fd_map[__FD_SETSIZE];
36 extern int smbw_ref_count[__FD_SETSIZE];
37 extern char smbw_cwd[PATH_MAX];
38 extern char smbw_prefix[];
40 typedef struct SMBW_stat {
41 unsigned long s_dev; /* device */
42 unsigned long s_ino; /* inode */
43 unsigned long s_mode; /* protection */
44 unsigned long s_nlink; /* number of hard links */
45 unsigned long s_uid; /* user ID of owner */
46 unsigned long s_gid; /* group ID of owner */
47 unsigned long s_rdev; /* device type (if inode device) */
48 unsigned long long s_size; /* total size, in bytes */
49 unsigned long s_blksize; /* blocksize for filesystem I/O */
50 unsigned long s_blocks; /* number of blocks allocated */
51 unsigned long s_atime; /* time of last access */
52 unsigned long s_mtime; /* time of last modification */
53 unsigned long s_ctime; /* time of last change */
54 } SMBW_stat;
56 typedef struct SMBW_dirent {
57 unsigned long d_ino; /* inode number */
58 unsigned long long d_off; /* offset to the next dirent */
59 unsigned long d_reclen; /* length of this record */
60 unsigned long d_type; /* type of file */
61 char d_name[256]; /* filename */
62 char d_comment[256]; /* comment */
63 } SMBW_dirent;
65 struct kernel_sigaction {
66 __sighandler_t k_sa_handler;
67 unsigned long sa_flags;
68 sigset_t sa_mask;
71 typedef struct SMBW_libc
73 /* write() is first, to allow debugging */
74 ssize_t (* write)(int fd, void *buf, size_t count);
75 int (* open)(char *name, int flags, mode_t mode);
76 int (* _open)(char *name, int flags, mode_t mode) ;
77 int (* __open)(char *name, int flags, mode_t mode) ;
78 int (* open64)(char *name, int flags, mode_t mode);
79 int (* _open64)(char *name, int flags, mode_t mode) ;
80 int (* __open64)(char *name, int flags, mode_t mode) ;
81 ssize_t (* pread)(int fd, void *buf, size_t size, off_t ofs);
82 ssize_t (* pread64)(int fd, void *buf, size_t size, off64_t ofs);
83 ssize_t (* pwrite)(int fd, void *buf, size_t size, off_t ofs);
84 ssize_t (* pwrite64)(int fd, void *buf, size_t size, off64_t ofs);
85 int (* close)(int fd);
86 int (* __close)(int fd);
87 int (* _close)(int fd);
88 int (* fcntl)(int fd, int cmd, long arg);
89 int (* __fcntl)(int fd, int cmd, long arg);
90 int (* _fcntl)(int fd, int cmd, long arg);
91 int (* getdents)(int fd, struct dirent *dirp, unsigned int count);
92 int (* __getdents)(int fd, struct dirent *dirp, unsigned int count);
93 int (* _getdents)(int fd, struct dirent *dirp, unsigned int count);
94 int (* getdents64)(int fd, struct dirent64 *dirp, unsigned int count);
95 off_t (* lseek)(int fd, off_t offset, int whence);
96 off_t (* __lseek)(int fd, off_t offset, int whence);
97 off_t (* _lseek)(int fd, off_t offset, int whence);
98 off64_t (* lseek64)(int fd, off64_t offset, int whence);
99 off64_t (* __lseek64)(int fd, off64_t offset, int whence);
100 off64_t (* _lseek64)(int fd, off64_t offset, int whence);
101 ssize_t (* read)(int fd, void *buf, size_t count);
102 ssize_t (* __read)(int fd, void *buf, size_t count);
103 ssize_t (* _read)(int fd, void *buf, size_t count);
104 ssize_t (* __write)(int fd, void *buf, size_t count);
105 ssize_t (* _write)(int fd, void *buf, size_t count);
106 int (* access)(char *name, int mode);
107 int (* chmod)(char *name, mode_t mode);
108 int (* fchmod)(int fd, mode_t mode);
109 int (* chown)(char *name, uid_t owner, gid_t group);
110 int (* fchown)(int fd, uid_t owner, gid_t group);
111 int (* __xstat)(int vers, char *name, struct stat *st);
112 char * ( *getcwd)(char *buf, size_t size);
113 int (* mkdir)(char *name, mode_t mode);
114 int (* __fxstat)(int vers, int fd, struct stat *st);
115 int (* __lxstat)(int vers, char *name, struct stat *st);
116 int (* stat)(char *name, struct stat *st);
117 int (* lstat)(char *name, struct stat *st);
118 int (* fstat)(int fd, struct stat *st);
119 int (* unlink)(char *name);
120 int (* utime)(char *name, struct utimbuf *tvp);
121 int (* utimes)(char *name, struct timeval *tvp);
122 int (* readlink)(char *path, char *buf, size_t bufsize);
123 int (* rename)(char *oldname, char *newname);
124 int (* rmdir)(char *name);
125 int (* symlink)(char *topath, char *frompath);
126 int (* dup)(int fd);
127 int (* dup2)(int oldfd, int newfd);
128 DIR * (* opendir)(char *name);
129 struct dirent * (* readdir)(DIR *dir);
130 int (* closedir)(DIR *dir);
131 off_t (* telldir)(DIR *dir);
132 void (* seekdir)(DIR *dir, off_t offset);
133 int (* creat)(char *path, mode_t mode);
134 int (* creat64)(char *path, mode_t mode);
135 int (* __xstat64)(int ver, char *name, struct stat64 *st64);
136 int (* stat64)(char *name, struct stat64 *st64);
137 int (* __fxstat64)(int ver, int fd, struct stat64 *st64);
138 int (* fstat64)(int fd, struct stat64 *st64);
139 int (* __lxstat64)(int ver, char *name, struct stat64 *st64);
140 int (* lstat64)(char *name, struct stat64 *st64);
141 int (* _llseek)(unsigned int fd, unsigned long offset_high, unsigned long offset_low, loff_t *result, unsigned int whence);
142 struct dirent64 * (* readdir64)(DIR *dir);
143 int (* readdir_r)(DIR *dir, struct dirent *entry, struct dirent **result);
144 int (* readdir64_r)(DIR *dir, struct dirent64 *entry, struct dirent64 **result);
145 int (* setxattr)(const char *fname,
146 const char *name,
147 const void *value,
148 size_t size,
149 int flags);
150 int (* lsetxattr)(const char *fname,
151 const char *name,
152 const void *value,
153 size_t size,
154 int flags);
155 int (* fsetxattr)(int smbw_fd,
156 const char *name,
157 const void *value,
158 size_t size,
159 int flags);
160 int (* getxattr)(const char *fname,
161 const char *name,
162 const void *value,
163 size_t size);
164 int (* lgetxattr)(const char *fname,
165 const char *name,
166 const void *value,
167 size_t size);
168 int (* fgetxattr)(int smbw_fd,
169 const char *name,
170 const void *value,
171 size_t size);
172 int (* removexattr)(const char *fname,
173 const char *name);
174 int (* lremovexattr)(const char *fname,
175 const char *name);
176 int (* fremovexattr)(int smbw_fd,
177 const char *name);
178 int (* listxattr)(const char *fname,
179 char *list,
180 size_t size);
181 int (* llistxattr)(const char *fname,
182 char *list,
183 size_t size);
184 int (* flistxattr)(int smbw_fd,
185 char *list,
186 size_t size);
187 int (* chdir)(const char *path);
188 int (* fchdir)(int fd);
189 pid_t (* fork)(void);
190 int (* select)(int n,
191 fd_set *readfds,
192 fd_set *writefds,
193 fd_set *exceptfds,
194 struct timeval *timeout);
195 int (* _select)(int n,
196 fd_set *readfds,
197 fd_set *writefds,
198 fd_set *exceptfds,
199 struct timeval *timeout);
200 int (* __select)(int n,
201 fd_set *readfds,
202 fd_set *writefds,
203 fd_set *exceptfds,
204 struct timeval *timeout);
205 } SMBW_libc_pointers;
207 extern SMBW_libc_pointers smbw_libc;
209 #endif /* __WRAPPER_H__ */