source: branches/client-1.6/src/smbwrp.h@ 444

Last change on this file since 444 was 444, checked in by Silvan Scherrer, 15 years ago

samba client 1.6: more work

  • Property svn:eol-style set to native
File size: 5.2 KB
Line 
1/*
2 Netdrive Samba client plugin
3 samba library wrappers
4 Copyright (C) netlabs.org 2003-2008
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _SMBWRP_H
22#define _SMBWRP_H
23
24#if !defined (O_RDONLY)
25#define O_ACCMODE 0x03 /* mask */
26#define O_RDONLY 0x00
27#define O_WRONLY 0x01
28#define O_RDWR 0x02
29#define O_NONBLOCK 0x04
30#define O_APPEND 0x08
31#define O_TEXT 0x10
32
33#define O_BINARY 0x0100
34#define O_CREAT 0x0200
35#define O_TRUNC 0x0400
36#define O_EXCL 0x0800
37#define O_SYNC 0x2000
38#define O_NOCTTY 0x4000
39#define O_SIZE 0x8000
40#endif
41
42#if !defined (DENY_NONE)
43/* deny modes */
44#define DENY_DOS 0
45#define DENY_ALL 1
46#define DENY_WRITE 2
47#define DENY_READ 3
48#define DENY_NONE 4
49#define DENY_FCB 7
50#endif
51
52
53/* these define the attribute byte as seen by DOS */
54#ifndef aRONLY
55#define aRONLY (1L<<0) /* 0x01 */
56#define aHIDDEN (1L<<1) /* 0x02 */
57#define aSYSTEM (1L<<2) /* 0x04 */
58#define aVOLID (1L<<3) /* 0x08 */
59#define aDIR (1L<<4) /* 0x10 */
60#define aARCH (1L<<5) /* 0x20 */
61#endif
62
63#pragma pack(1)
64
65#ifdef CLI_BUFFER_SIZE
66typedef struct cli_state cli_state;
67#else
68typedef unsigned long cli_state;
69#endif
70
71#define CAP_NOPATHINFO2 0x01000000
72
73typedef struct smbwrp_server
74{
75 char server_name[256];
76 char share_name[256];
77 char workgroup[256];
78 char username[256];
79 char password[256];
80 char master[256];
81 int ifmastergroup;
82 int no_pathinfo2;
83} smbwrp_server;
84
85typedef struct smbwrp_file
86{
87 int fd;
88 unsigned long long offset;
89 int openmode;
90 int openattr;
91 int denymode;
92 unsigned long mtime;
93 char fullname[261];
94 char fname[261];
95} smbwrp_file;
96
97typedef struct smbwrp_fileinfo
98{
99 unsigned long long size;
100 unsigned long attr;
101 unsigned long ctime;
102 unsigned long mtime;
103 unsigned long atime;
104 int easize;
105// char fname[261];
106 char *fname;
107} smbwrp_fileinfo;
108
109typedef struct smbwrp_fileseek
110{
111 int whence;
112 long offset;
113 unsigned long result;
114} smbwrp_fileseek;
115
116
117#ifndef INCL_DOS
118typedef struct _FSALLOCATE /* fsalloc */
119{
120 unsigned long idFileSystem;
121 unsigned long cSectorUnit;
122 unsigned long cUnit;
123 unsigned long cUnitAvail;
124 unsigned short cbSector;
125} FSALLOCATE;
126#endif
127
128typedef struct _Resource
129{
130 int rootlevel;
131 smbwrp_server srv;
132 char logfile[_MAX_PATH + 1];
133 char loglevel;
134 int easupport;
135 int krb5support;
136} Resource;
137
138typedef struct _Connection
139{
140 Resource *pRes;
141 cli_state* cli;
142 smbwrp_file file;
143} Connection;
144
145
146typedef struct filelist_state
147{
148 unsigned long pipe;
149 char * data;
150 int datalen;
151 int bufferlen;
152 void ( * _System add_dir_entry)(void * st);
153 char mask[ _MAX_PATH];
154 char dir[ _MAX_PATH];
155 char dir_mask[ _MAX_PATH];
156 smbwrp_fileinfo finfo;
157 Connection* pConn;
158 void *plist;
159 unsigned long ulAttribute;
160} filelist_state;
161
162#pragma pack()
163
164int _System smbwrp_getclisize(void);
165int _System smbwrp_init(void);
166int _System smbwrp_connect(Resource * pRes, cli_state **);
167void _System smbwrp_disconnect(Resource * pRes, cli_state *);
168int _System smbwrp_open(cli_state * cli, smbwrp_file * file);
169int _System smbwrp_read(cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result);
170int _System smbwrp_write(cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result);
171int _System smbwrp_lseek(cli_state * cli, smbwrp_file * file, int whence, long long offset);
172int _System smbwrp_close(cli_state * cli, smbwrp_file * file);
173int _System smbwrp_setattr(cli_state * cli, smbwrp_fileinfo *finfo);
174int _System smbwrp_getattr(smbwrp_server *srv, cli_state * cli, smbwrp_fileinfo *finfo);
175int _System smbwrp_fgetattr(cli_state * cli, smbwrp_file *file, smbwrp_fileinfo *finfo);
176int _System smbwrp_filelist(smbwrp_server *srv, cli_state * cli, filelist_state * state);
177int _System smbwrp_rename(cli_state * cli, char *oldname, char *newname);
178int _System smbwrp_chdir(smbwrp_server *srv, cli_state * cli, char *fname);
179int _System smbwrp_mkdir(cli_state * cli, char *fname);
180int _System smbwrp_rmdir(cli_state * cli, char *fname);
181int _System smbwrp_unlink(cli_state * cli, const char *fname);
182int _System smbwrp_setfilesize(cli_state * cli, smbwrp_file * file, long long newsize);
183int _System smbwrp_setea(cli_state * cli, char *fname, char * name, unsigned char * value, int size);
184int _System smbwrp_fsetea(cli_state * cli, smbwrp_file *file, char * name, unsigned char * value, int size);
185int _System smbwrp_listea(cli_state * cli, char *fname, void * buffer, unsigned long size);
186int _System smbwrp_flistea(cli_state * cli, smbwrp_file *file, void * buffer, unsigned long size);
187int _System smbwrp_dskattr(cli_state * cli, FSALLOCATE *pfsa);
188
189#endif /* _SMBWRP_H */
Note: See TracBrowser for help on using the repository browser.