namespace IO; using Notifiers.Notifier; struct IONotifierInfo virtual { guid: "E38D4FC2-36C7-11DA-B2D1-000A95BB581A"; ulong len; enum Result { Success, NoMoreData, NoMoreSpace, IOError, BadHandle, NoEndpoint } result; }; interface IStream { guid: "6A2E42D6-EAB6-11D9-AD6A-000A95BB581A"; read(octet[] buf out, ulong len inout); read_async(octet[] buf shared, ulong len, Notifier notifier) async; }; interface OStream { guid: "76004CA4-EAB6-11D9-A808-000A95BB581A"; write(octet[] buf, ulong len inout); write_async(octet[] buf, ulong len, Notifier notifier) async; }; interface IOStream : IStream, OStream { guid: "76621658-EAB6-11D9-8884-000A95BB581A"; }; interface File { guid: "76C2638F-EAB6-11D9-BE5C-000A95BB581A"; size(ulong size out); }; interface ReadableFile : File { guid: "4B46E7A0-E66B-49F5-BB8A-D63833A4D79A"; read(ulong pos, octet[] buf out, ulong len inout); read_async(ulong pos, octet[] buf shared, ulong len, Notifier notifier) async; }; interface WriteableFile : File { guid: "310C44B2-D5F8-4439-A7DB-0BDBFD0C306C"; write(ulong pos, octet[] buf, ulong len inout); write_async(ulong pos, octet[] buf, ulong len, Notifier notifier) async; }; interface ReadWriteFile : ReadableFile, WriteableFile { guid: "61E259EF-A929-449C-A8B8-1870A744F160"; }; interface HasFile { guid: "540020D6-23AC-4061-9CD7-EEC4118BBAAC"; set_file(File f); get_file(File f out); }; interface Seekable { guid: "772A2170-EAB6-11D9-BAA4-000A95BB581A"; enum SeekType { FromBeginning, FromCurrent, FromEnd }; // If the backing file is changed, the position resets to the // beginning. // // The offset can be considered unsigned if access to the full 2^64 // bytes of the underlying file is required. Overflow and underflow // cause wraparound. seek(long offset, SeekType type); get_pos(ulong offset out); size(ulong size out); };