7e3cb442f011e2944ef8f8bdb3c66d2b635936bc
[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 long time_t;
56         typedef unsigned long long GnomeVFSFileSize;
57         typedef unsigned long long GnomeVFSFileFlags;
58         typedef          long long GnomeVFSFileOffset;
59         typedef unsigned long      GnomeVFSSeekPosition;    /* enum */
60         typedef unsigned long      GnomeVFSSetFileInfoMask; /* enum mask */
61         typedef unsigned long long GnomeVFSOpenMode;          /* enum mask */
62         struct GnomeVFSFileInfo {
63                 string name;    /* Base name of the file (no path). */
64                 /* File type (i.e. regular, directory, block device...). */
65                 GnomeVFSFileType type;
66                 boolean type_valid;
67                 GnomeVFSFilePermissions permissions;    /* File permissions. */
68                 boolean permissions_valid;
69                 GnomeVFSFileSize size;  /* Size in bytes. */
70                 boolean size_valid;
71                 GnomeVFSFileSize block_count;   /* Size measured in units of 512-byte blocks. */
72                 boolean block_count_valid;
73                 /* Access, modification and change times. */
74                 time_t atime;   /* not valid if ==(time_t)0 */
75                 time_t mtime;   /* not valid if ==(time_t)0 */
76                 time_t ctime;   /* not valid if ==(time_t)0 */
77                 GnomeVFSFileFlags flags;
78                 boolean flags_valid;
79                 };
80
81
82         typedef               long long GInt64;
83         typedef unsigned long long GUInt64;
84         typedef unsigned long      GSeekType;   /* enum */
85         typedef unsigned long      GSize;
86         interface CaptiveIOChannel {
87                 void read(out Bytes buffer,in GSize count)
88                         raises (GIOStatusException,GLogMessageFatal);
89                 void write(in Bytes buffer,out GSize bytes_written_return)
90                         raises (GIOStatusException,GLogMessageFatal);
91                 void seek(in GInt64 offset,in GSeekType type)
92                         raises (GIOStatusException,GLogMessageFatal);
93                 GUInt64 size()
94                         raises (GLogMessageFatal);
95                 };
96
97
98         typedef unsigned long CaptiveOptionRwmode;      /* enum */
99         typedef unsigned long CaptiveOptionMedia;       /* enum */
100         struct CaptiveOptionsModule {
101                 string pathname_utf8;
102                 Bytes data;
103                 };
104         typedef sequence<CaptiveOptionsModule> CaptiveOptionsModuleList;
105         struct CaptiveOptions {
106                 GLogFunc g_log_func;
107                 CaptiveOptionsModule filesystem;
108                 CaptiveOptionRwmode rwmode;
109                 CaptiveOptionMedia media;
110                 boolean debug_messages;
111                 CaptiveIOChannel image_iochannel;
112                 CaptiveOptionsModuleList load_module;
113                 };
114
115
116         typedef unsigned long      GUInt32;
117         struct CaptiveVfsVolumeInfo {
118                 GUInt32 block_size;
119                 GUInt64 bytes;
120                 GUInt64 bytes_free;
121                 GUInt64 bytes_available;
122                 };
123
124
125         interface Directory {
126                 void read(out GnomeVFSFileInfo file_info)
127                         raises (GnomeVFSResultException,GLogMessageFatal);
128                 void remove()
129                         raises (GnomeVFSResultException,GLogMessageFatal);
130                 void shutdown();
131                 };
132
133
134         interface File {
135                 void read(out Bytes buffer,in GnomeVFSFileSize num_bytes)
136                         raises (GnomeVFSResultException,GLogMessageFatal);
137                 void write(in Bytes buffer,out GnomeVFSFileSize bytes_written_return)
138                         raises (GnomeVFSResultException,GLogMessageFatal);
139                 void seek(in GnomeVFSSeekPosition whence,in GnomeVFSFileOffset offset)
140                         raises (GnomeVFSResultException,GLogMessageFatal);
141                 void tell(out GnomeVFSFileOffset offset_return)
142                         raises (GnomeVFSResultException,GLogMessageFatal);
143                 void remove()
144                         raises (GnomeVFSResultException,GLogMessageFatal);
145                 void file_info_get(out GnomeVFSFileInfo file_info)
146                         raises (GnomeVFSResultException,GLogMessageFatal);
147                 void file_info_set(in GnomeVFSFileInfo file_info,in GnomeVFSSetFileInfoMask mask)
148                         raises (GnomeVFSResultException,GLogMessageFatal);
149                 void truncate(in GnomeVFSFileSize file_size)
150                         raises (GnomeVFSResultException,GLogMessageFatal);
151                 void move(in string pathname_new,in boolean force_replace)
152                         raises (GnomeVFSResultException,GLogMessageFatal);
153                 void shutdown();
154                 };
155
156
157         interface Vfs {
158                 void init(in CaptiveOptions options);
159                 void shutdown();
160                 Directory directory_new_open(in string pathname)
161                         raises (GnomeVFSResultException,GLogMessageFatal);
162                 Directory directory_new_make(in string pathname,in GnomeVFSFilePermissions perm)
163                         raises (GnomeVFSResultException,GLogMessageFatal);
164                 File file_new_open(in string pathname,in GnomeVFSOpenMode mode)
165                         raises (GnomeVFSResultException,GLogMessageFatal);
166                 File file_new_create(in string pathname,in GnomeVFSOpenMode mode,in boolean exclusive,in unsigned long perm)
167                         raises (GnomeVFSResultException,GLogMessageFatal);
168                 void volume_info_get(out CaptiveVfsVolumeInfo volume_info)
169                         raises (GnomeVFSResultException,GLogMessageFatal);
170                 };
171 };