Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / channels / rdpdr / disk / disk_file.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol client.
3  * File System Virtual Channel
4  *
5  * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  * Copyright 2010-2011 Vic Lee
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21 #ifndef __DISK_FILE_H
22 #define __DISK_FILE_H
23
24 #include <sys/types.h>
25 #include <sys/stat.h>
26 #include <dirent.h>
27
28 typedef struct _DISK_FILE DISK_FILE;
29 struct _DISK_FILE
30 {
31         uint32 id;
32         boolean is_dir;
33         int fd;
34         int err;
35         DIR* dir;
36         char* basepath;
37         char* fullpath;
38         char* filename;
39         char* pattern;
40         boolean delete_pending;
41 };
42
43 DISK_FILE* disk_file_new(const char* base_path, const char* path, uint32 id,
44         uint32 DesiredAccess, uint32 CreateDisposition, uint32 CreateOptions);
45 void disk_file_free(DISK_FILE* file);
46
47 boolean disk_file_seek(DISK_FILE* file, uint64 Offset);
48 boolean disk_file_read(DISK_FILE* file, uint8* buffer, uint32* Length);
49 boolean disk_file_write(DISK_FILE* file, uint8* buffer, uint32 Length);
50 boolean disk_file_query_information(DISK_FILE* file, uint32 FsInformationClass, STREAM* output);
51 boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, uint32 Length, STREAM* input);
52 boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, uint8 InitialQuery,
53         const char* path, STREAM* output);
54
55 #endif /* __DISK_FILE_H */