]> git.buserror.net Git - polintos/scott/priv.git/blob - idl/io.idl
Add first draft of marshalling spec
[polintos/scott/priv.git] / idl / io.idl
1 namespace IO;
2 using Notifiers.Notifier;
3
4 struct IONotifierInfo virtual {
5         guid: "E38D4FC2-36C7-11DA-B2D1-000A95BB581A";
6
7         ulong len;
8         enum Result {
9                 Success,
10                 NoMoreData,
11                 NoMoreSpace,
12                 IOError,
13                 BadHandle,
14                 NoEndpoint
15         } result;
16 };
17
18 interface IStream {
19         guid: "6A2E42D6-EAB6-11D9-AD6A-000A95BB581A";
20
21         read(octet[] buf out, ulong len inout);
22         read_async(octet[] buf shared, ulong len, Notifier notifier) async;
23 };
24
25 interface OStream {
26         guid: "76004CA4-EAB6-11D9-A808-000A95BB581A";
27
28         write(octet[] buf, ulong len inout);
29         write_async(octet[] buf, ulong len, Notifier notifier) async;
30 };
31
32 interface IOStream : IStream, OStream {
33         guid: "76621658-EAB6-11D9-8884-000A95BB581A";
34 };
35
36 interface File {        
37         guid: "76C2638F-EAB6-11D9-BE5C-000A95BB581A";
38
39         size(ulong size out);
40 };
41
42 interface ReadableFile : File {
43         guid: "4B46E7A0-E66B-49F5-BB8A-D63833A4D79A";
44
45         read(ulong pos, octet[] buf out, ulong len inout);
46         read_async(ulong pos, octet[] buf shared, 
47                    ulong len, Notifier notifier) async;
48 };
49
50 interface WriteableFile : File {
51         guid: "310C44B2-D5F8-4439-A7DB-0BDBFD0C306C";
52
53         write(ulong pos, octet[] buf, ulong len inout);
54         write_async(ulong pos, octet[] buf, 
55                     ulong len, Notifier notifier) async;
56 };
57
58 interface ReadWriteFile : ReadableFile, WriteableFile {
59         guid: "61E259EF-A929-449C-A8B8-1870A744F160";
60 };
61
62 interface HasFile {
63         guid: "540020D6-23AC-4061-9CD7-EEC4118BBAAC";
64
65         set_file(File f);
66         get_file(File f out);
67 };
68
69 interface Seekable {
70         guid: "772A2170-EAB6-11D9-BAA4-000A95BB581A";
71
72         enum SeekType {
73                 FromBeginning,
74                 FromCurrent,
75                 FromEnd
76         };
77
78         // If the backing file is changed, the position resets to the
79         // beginning.
80         //
81         // The offset can be considered unsigned if access to the full 2^64
82         // bytes of the underlying file is required.  Overflow and underflow
83         // cause wraparound.
84
85         seek(long offset, SeekType type);
86         get_pos(ulong offset out);
87         size(ulong size out);
88 };