Implemented sub-second W32 filesystem interface by new: CaptiveFileInfoObject
[captive.git] / src / libcaptive / sandbox / sandbox.idl
1 /* $Id$
2  * CORBA ORBit IDL definition of sandbox intra-captive interface
3  * Copyright (C) 2002-2003 Jan Kratochvil <project-captive@jankratochvil.net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; exactly version 2 of June 1991 is required
8  * 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  * 
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19
20 module Captive
21 {
22         typedef sequence<octet> Bytes;
23
24
25         typedef unsigned long GnomeVFSResult;   /* enum */
26         exception GnomeVFSResultException {
27                 GnomeVFSResult gnome_vfs_result;
28                 };
29
30
31         typedef unsigned long GIOStatus;        /* enum */
32         exception GIOStatusException {
33                 GIOStatus g_io_status;
34                 };
35
36
37         typedef unsigned long GLogLevelFlags;   /* enum mask */
38         struct GLogMessage {    /* accepted by 'GLogFunc' */
39                 /* string log_domain; always "Captive" */
40                 GLogLevelFlags log_level;
41                 string message;
42                 };
43         exception GLogMessageFatal {
44                 GLogMessage g_log_message;
45                 };
46
47         interface GLogFunc {
48                 /* Do not use 'oneway' as we would loose logging order coherency. */
49                 void g_log_func(in GLogMessage g_log_message);
50                 };
51
52
53         typedef unsigned long      GnomeVFSFileType;        /* enum */
54         typedef unsigned short     GnomeVFSFilePermissions;
55         typedef unsigned long      guint;
56         typedef unsigned long long time_t;
57         typedef unsigned long long GnomeVFSFileSize;
58         typedef unsigned long long GnomeVFSFileFlags;
59         typedef          long long GnomeVFSFileOffset;
60         typedef unsigned long      GnomeVFSSeekPosition;    /* enum */
61         typedef unsigned long      GnomeVFSSetFileInfoMask; /* enum mask */
62         typedef unsigned long long GnomeVFSOpenMode;          /* enum mask */
63         struct CaptiveFileInfoObject {
64                 string name;    /* Base name of the file (no path). */
65                 /* File type (i.e. regular, directory, block device...). */
66                 GnomeVFSFileType type;
67                 boolean type_valid;
68                 GnomeVFSFilePermissions permissions;    /* File permissions. */
69                 boolean permissions_valid;
70                 GnomeVFSFileSize size;  /* Size in bytes. */
71                 boolean size_valid;
72                 GnomeVFSFileSize block_count;   /* Size measured in units of 512-byte blocks. */
73                 boolean block_count_valid;
74                 /* Access, modification and change times. */
75                 time_t atime;   /* not valid if ==(time_t)0 */
76                 guint atime_nsec;
77                 time_t mtime;   /* not valid if ==(time_t)0 */
78                 guint mtime_nsec;
79                 time_t ctime;   /* not valid if ==(time_t)0 */
80                 guint ctime_nsec;
81                 GnomeVFSFileFlags flags;
82                 boolean flags_valid;
83                 };
84
85
86         typedef               long long GInt64;
87         typedef unsigned long long GUInt64;
88         typedef unsigned long      GSeekType;   /* enum */
89         typedef unsigned long      GSize;
90         interface CaptiveIOChannel {
91                 void read(out Bytes buffer,in GSize count)
92                         raises (GIOStatusException,GLogMessageFatal);
93                 void write(in Bytes buffer,out GSize bytes_written_return)
94                         raises (GIOStatusException,GLogMessageFatal);
95                 void seek(in GInt64 offset,in GSeekType type)
96                         raises (GIOStatusException,GLogMessageFatal);
97                 GUInt64 size()
98                         raises (GLogMessageFatal);
99                 };
100
101
102         typedef unsigned long CaptiveOptionRwmode;      /* enum */
103         typedef unsigned long CaptiveOptionMedia;       /* enum */
104         struct CaptiveOptionsModule {
105                 string pathname_utf8;
106                 Bytes data;
107                 };
108         typedef sequence<CaptiveOptionsModule> CaptiveOptionsModuleList;
109         struct CaptiveOptions {
110                 GLogFunc g_log_func;
111                 CaptiveOptionsModule filesystem;
112                 CaptiveOptionRwmode rwmode;
113                 CaptiveOptionMedia media;
114                 boolean debug_messages;
115                 CaptiveIOChannel image_iochannel;
116                 CaptiveOptionsModuleList load_module;
117                 };
118
119
120         typedef unsigned long      GUInt32;
121         struct CaptiveVfsVolumeInfo {
122                 GUInt32 block_size;
123                 GUInt64 bytes;
124                 GUInt64 bytes_free;
125                 GUInt64 bytes_available;
126                 };
127
128
129         interface Directory {
130                 void read(out CaptiveFileInfoObject file_info)
131                         raises (GnomeVFSResultException,GLogMessageFatal);
132                 void remove()
133                         raises (GnomeVFSResultException,GLogMessageFatal);
134                 void shutdown();
135                 };
136
137
138         interface File {
139                 void read(out Bytes buffer,in GnomeVFSFileSize num_bytes)
140                         raises (GnomeVFSResultException,GLogMessageFatal);
141                 void write(in Bytes buffer,out GnomeVFSFileSize bytes_written_return)
142                         raises (GnomeVFSResultException,GLogMessageFatal);
143                 void seek(in GnomeVFSSeekPosition whence,in GnomeVFSFileOffset offset)
144                         raises (GnomeVFSResultException,GLogMessageFatal);
145                 void tell(out GnomeVFSFileOffset offset_return)
146                         raises (GnomeVFSResultException,GLogMessageFatal);
147                 void remove()
148                         raises (GnomeVFSResultException,GLogMessageFatal);
149                 void file_info_get(out CaptiveFileInfoObject file_info)
150                         raises (GnomeVFSResultException,GLogMessageFatal);
151                 void file_info_set(in CaptiveFileInfoObject file_info,in GnomeVFSSetFileInfoMask mask)
152                         raises (GnomeVFSResultException,GLogMessageFatal);
153                 void truncate(in GnomeVFSFileSize file_size)
154                         raises (GnomeVFSResultException,GLogMessageFatal);
155                 void move(in string pathname_new,in boolean force_replace)
156                         raises (GnomeVFSResultException,GLogMessageFatal);
157                 void shutdown();
158                 };
159
160
161         interface Vfs {
162                 void init(in CaptiveOptions options);
163                 void shutdown();
164                 Directory directory_new_open(in string pathname)
165                         raises (GnomeVFSResultException,GLogMessageFatal);
166                 Directory directory_new_make(in string pathname,in GnomeVFSFilePermissions perm)
167                         raises (GnomeVFSResultException,GLogMessageFatal);
168                 File file_new_open(in string pathname,in GnomeVFSOpenMode mode)
169                         raises (GnomeVFSResultException,GLogMessageFatal);
170                 File file_new_create(in string pathname,in GnomeVFSOpenMode mode,in boolean exclusive,in unsigned long perm)
171                         raises (GnomeVFSResultException,GLogMessageFatal);
172                 void volume_info_get(out CaptiveVfsVolumeInfo volume_info)
173                         raises (GnomeVFSResultException,GLogMessageFatal);
174                 };
175 };