2018-08-15 23:36:48 -04:00
|
|
|
union Any {
|
2018-07-06 11:27:36 -04:00
|
|
|
Start,
|
|
|
|
StartRes,
|
|
|
|
CodeFetch,
|
|
|
|
CodeFetchRes,
|
|
|
|
CodeCache,
|
2018-09-24 22:46:36 -04:00
|
|
|
SetTimeout,
|
2018-07-06 11:27:36 -04:00
|
|
|
Exit,
|
2018-08-31 07:51:12 -04:00
|
|
|
Environ,
|
|
|
|
EnvironRes,
|
2018-07-06 11:27:36 -04:00
|
|
|
FetchReq,
|
|
|
|
FetchRes,
|
2018-08-23 18:36:45 -04:00
|
|
|
MakeTempDir,
|
|
|
|
MakeTempDirRes,
|
2018-09-10 05:48:36 -04:00
|
|
|
Mkdir,
|
2018-09-10 23:40:03 -04:00
|
|
|
Remove,
|
2018-09-09 20:25:43 -04:00
|
|
|
ReadFile,
|
|
|
|
ReadFileRes,
|
2018-10-03 17:56:56 -04:00
|
|
|
ReadDir,
|
|
|
|
ReadDirRes,
|
2018-09-11 12:00:57 -04:00
|
|
|
WriteFile,
|
2018-09-30 18:06:41 -04:00
|
|
|
CopyFile,
|
2018-09-12 11:44:58 -04:00
|
|
|
Rename,
|
2018-09-25 00:20:49 -04:00
|
|
|
Readlink,
|
|
|
|
ReadlinkRes,
|
2018-09-19 00:38:24 -04:00
|
|
|
Symlink,
|
2018-09-11 15:38:53 -04:00
|
|
|
Stat,
|
|
|
|
StatRes,
|
2018-08-31 07:51:12 -04:00
|
|
|
SetEnv,
|
2018-09-30 15:06:20 -04:00
|
|
|
Truncate,
|
2018-09-27 00:56:39 -04:00
|
|
|
Open,
|
|
|
|
OpenRes,
|
|
|
|
Read,
|
|
|
|
ReadRes,
|
|
|
|
Write,
|
|
|
|
WriteRes,
|
|
|
|
Close,
|
2018-10-05 12:16:24 -04:00
|
|
|
Shutdown,
|
2018-10-03 23:58:29 -04:00
|
|
|
Listen,
|
|
|
|
ListenRes,
|
|
|
|
Accept,
|
|
|
|
Dial,
|
|
|
|
NewConn,
|
2018-07-04 14:50:28 -04:00
|
|
|
}
|
|
|
|
|
2018-08-15 23:36:48 -04:00
|
|
|
enum ErrorKind: byte {
|
|
|
|
NoError = 0,
|
|
|
|
|
|
|
|
// io errors
|
|
|
|
|
|
|
|
NotFound,
|
|
|
|
PermissionDenied,
|
|
|
|
ConnectionRefused,
|
|
|
|
ConnectionReset,
|
|
|
|
ConnectionAborted,
|
|
|
|
NotConnected,
|
|
|
|
AddrInUse,
|
|
|
|
AddrNotAvailable,
|
|
|
|
BrokenPipe,
|
|
|
|
AlreadyExists,
|
|
|
|
WouldBlock,
|
|
|
|
InvalidInput,
|
|
|
|
InvalidData,
|
|
|
|
TimedOut,
|
|
|
|
Interrupted,
|
|
|
|
WriteZero,
|
|
|
|
Other,
|
|
|
|
UnexpectedEof,
|
|
|
|
|
2018-10-10 11:15:47 -04:00
|
|
|
BadResource,
|
2018-09-27 00:56:39 -04:00
|
|
|
|
2018-08-15 23:36:48 -04:00
|
|
|
// url errors
|
|
|
|
|
|
|
|
EmptyHost,
|
|
|
|
IdnaError,
|
|
|
|
InvalidPort,
|
|
|
|
InvalidIpv4Address,
|
|
|
|
InvalidIpv6Address,
|
|
|
|
InvalidDomainCharacter,
|
|
|
|
RelativeUrlWithoutBase,
|
|
|
|
RelativeUrlWithCannotBeABaseBase,
|
|
|
|
SetHostOnCannotBeABaseUrl,
|
|
|
|
Overflow,
|
2018-08-14 16:50:53 -04:00
|
|
|
|
|
|
|
// hyper errors
|
|
|
|
|
|
|
|
HttpUser,
|
|
|
|
HttpClosed,
|
|
|
|
HttpCanceled,
|
|
|
|
HttpParse,
|
|
|
|
HttpOther,
|
2018-08-15 23:36:48 -04:00
|
|
|
}
|
|
|
|
|
2018-07-06 11:27:36 -04:00
|
|
|
table Base {
|
2018-08-17 16:59:57 -04:00
|
|
|
cmd_id: uint32;
|
2018-09-05 22:13:36 -04:00
|
|
|
sync: bool = true; // TODO(ry) Change default to false.
|
2018-08-15 23:36:48 -04:00
|
|
|
error_kind: ErrorKind = NoError;
|
2018-07-06 11:27:36 -04:00
|
|
|
error: string;
|
2018-10-03 21:12:23 -04:00
|
|
|
inner: Any;
|
2018-07-04 14:50:28 -04:00
|
|
|
}
|
|
|
|
|
2018-07-23 14:13:12 -04:00
|
|
|
table Start {
|
2018-07-06 11:27:36 -04:00
|
|
|
unused: int8;
|
|
|
|
}
|
|
|
|
|
|
|
|
table StartRes {
|
|
|
|
cwd: string;
|
|
|
|
argv: [string];
|
|
|
|
debug_flag: bool;
|
2018-09-02 18:50:46 -04:00
|
|
|
deps_flag: bool;
|
2018-09-24 15:33:50 -04:00
|
|
|
recompile_flag: bool;
|
2018-07-06 11:27:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
table CodeFetch {
|
|
|
|
module_specifier: string;
|
|
|
|
containing_file: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
table CodeFetchRes {
|
|
|
|
// If it's a non-http module, moduleName and filename will be the same.
|
|
|
|
// For http modules, moduleName is its resolved http URL, and filename
|
|
|
|
// is the location of the locally downloaded source code.
|
|
|
|
module_name: string;
|
|
|
|
filename: string;
|
|
|
|
source_code: string;
|
|
|
|
output_code: string; // Non-empty only if cached.
|
|
|
|
}
|
|
|
|
|
|
|
|
table CodeCache {
|
|
|
|
filename: string;
|
|
|
|
source_code: string;
|
|
|
|
output_code: string;
|
|
|
|
}
|
|
|
|
|
2018-09-24 22:46:36 -04:00
|
|
|
table SetTimeout {
|
2018-10-02 20:47:40 -04:00
|
|
|
timeout: double;
|
2018-09-24 22:46:36 -04:00
|
|
|
}
|
|
|
|
|
2018-07-23 14:13:12 -04:00
|
|
|
table Exit {
|
2018-07-06 11:27:36 -04:00
|
|
|
code: int;
|
|
|
|
}
|
|
|
|
|
2018-08-31 07:51:12 -04:00
|
|
|
table Environ {}
|
|
|
|
|
|
|
|
table SetEnv {
|
2018-09-07 18:59:02 -04:00
|
|
|
key: string;
|
|
|
|
value: string;
|
2018-08-31 07:51:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
table EnvironRes {
|
2018-09-07 18:59:02 -04:00
|
|
|
map: [EnvPair];
|
2018-08-31 07:51:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
table EnvPair {
|
2018-09-07 18:59:02 -04:00
|
|
|
key: string;
|
|
|
|
value: string;
|
2018-08-31 07:51:12 -04:00
|
|
|
}
|
|
|
|
|
2018-07-06 11:27:36 -04:00
|
|
|
table FetchReq {
|
|
|
|
id: uint;
|
|
|
|
url: string;
|
|
|
|
// header_line: [string];
|
|
|
|
}
|
|
|
|
|
|
|
|
table FetchRes {
|
|
|
|
id: uint;
|
|
|
|
status: int;
|
2018-09-12 15:16:42 -04:00
|
|
|
header_key: [string];
|
|
|
|
header_value: [string];
|
2018-08-13 15:02:35 -04:00
|
|
|
body: [ubyte];
|
2018-07-06 11:27:36 -04:00
|
|
|
}
|
|
|
|
|
2018-08-23 18:36:45 -04:00
|
|
|
table MakeTempDir {
|
|
|
|
dir: string;
|
|
|
|
prefix: string;
|
|
|
|
suffix: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
table MakeTempDirRes {
|
|
|
|
path: string;
|
|
|
|
}
|
|
|
|
|
2018-09-10 05:48:36 -04:00
|
|
|
table Mkdir {
|
2018-08-26 02:26:30 -04:00
|
|
|
path: string;
|
|
|
|
mode: uint;
|
|
|
|
// mode specified by https://godoc.org/os#FileMode
|
|
|
|
}
|
|
|
|
|
2018-09-10 23:40:03 -04:00
|
|
|
table Remove {
|
|
|
|
path: string;
|
|
|
|
recursive: bool;
|
|
|
|
}
|
|
|
|
|
2018-09-09 20:25:43 -04:00
|
|
|
table ReadFile {
|
2018-07-06 11:27:36 -04:00
|
|
|
filename: string;
|
|
|
|
}
|
|
|
|
|
2018-09-09 20:25:43 -04:00
|
|
|
table ReadFileRes {
|
2018-08-13 15:02:35 -04:00
|
|
|
data: [ubyte];
|
2018-07-06 11:27:36 -04:00
|
|
|
}
|
|
|
|
|
2018-10-03 17:56:56 -04:00
|
|
|
table ReadDir {
|
|
|
|
path: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
table ReadDirRes {
|
|
|
|
entries: [StatRes];
|
|
|
|
}
|
|
|
|
|
2018-09-11 12:00:57 -04:00
|
|
|
table WriteFile {
|
|
|
|
filename: string;
|
2018-09-27 00:56:39 -04:00
|
|
|
data: [ubyte];
|
2018-09-11 12:00:57 -04:00
|
|
|
perm: uint;
|
|
|
|
// perm specified by https://godoc.org/os#FileMode
|
|
|
|
}
|
|
|
|
|
2018-09-30 18:06:41 -04:00
|
|
|
table CopyFile {
|
|
|
|
from: string;
|
|
|
|
to: string;
|
|
|
|
}
|
|
|
|
|
2018-09-12 11:44:58 -04:00
|
|
|
table Rename {
|
2018-09-03 20:22:30 -04:00
|
|
|
oldpath: string;
|
|
|
|
newpath: string;
|
|
|
|
}
|
|
|
|
|
2018-09-25 00:20:49 -04:00
|
|
|
table Readlink {
|
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
table ReadlinkRes {
|
|
|
|
path: string;
|
|
|
|
}
|
|
|
|
|
2018-09-19 00:38:24 -04:00
|
|
|
table Symlink {
|
|
|
|
oldname: string;
|
|
|
|
newname: string;
|
|
|
|
}
|
|
|
|
|
2018-09-11 15:38:53 -04:00
|
|
|
table Stat {
|
2018-08-29 09:22:25 -04:00
|
|
|
filename: string;
|
|
|
|
lstat: bool;
|
|
|
|
}
|
|
|
|
|
2018-09-11 15:38:53 -04:00
|
|
|
table StatRes {
|
2018-08-29 09:22:25 -04:00
|
|
|
is_file: bool;
|
|
|
|
is_symlink: bool;
|
|
|
|
len: ulong;
|
|
|
|
modified:ulong;
|
|
|
|
accessed:ulong;
|
|
|
|
created:ulong;
|
2018-09-17 19:53:55 -04:00
|
|
|
mode: uint;
|
|
|
|
has_mode: bool; // false on windows
|
2018-10-03 17:56:56 -04:00
|
|
|
name: string;
|
|
|
|
path: string;
|
2018-08-29 09:22:25 -04:00
|
|
|
}
|
|
|
|
|
2018-09-30 15:06:20 -04:00
|
|
|
table Truncate {
|
|
|
|
name: string;
|
|
|
|
len: uint;
|
|
|
|
}
|
|
|
|
|
2018-09-27 00:56:39 -04:00
|
|
|
table Open {
|
|
|
|
filename: string;
|
|
|
|
perm: uint;
|
|
|
|
}
|
|
|
|
|
|
|
|
table OpenRes {
|
2018-10-01 19:37:18 -04:00
|
|
|
rid: int;
|
2018-09-27 00:56:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
table Read {
|
2018-10-01 19:37:18 -04:00
|
|
|
rid: int;
|
2018-09-27 00:56:39 -04:00
|
|
|
// (ptr, len) is passed as second parameter to libdeno.send().
|
|
|
|
}
|
|
|
|
|
|
|
|
table ReadRes {
|
|
|
|
nread: uint;
|
|
|
|
eof: bool;
|
|
|
|
}
|
|
|
|
|
|
|
|
table Write {
|
2018-10-01 19:37:18 -04:00
|
|
|
rid: int;
|
2018-09-27 00:56:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
table WriteRes {
|
|
|
|
nbyte: uint;
|
|
|
|
}
|
|
|
|
|
|
|
|
table Close {
|
2018-10-01 19:37:18 -04:00
|
|
|
rid: int;
|
2018-09-27 00:56:39 -04:00
|
|
|
}
|
|
|
|
|
2018-10-05 12:16:24 -04:00
|
|
|
table Shutdown {
|
|
|
|
rid: int;
|
|
|
|
how: uint;
|
|
|
|
}
|
|
|
|
|
2018-10-03 23:58:29 -04:00
|
|
|
table Listen {
|
|
|
|
network: string;
|
|
|
|
address: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
table ListenRes {
|
|
|
|
rid: int;
|
|
|
|
}
|
|
|
|
|
|
|
|
table Accept {
|
|
|
|
rid: int;
|
|
|
|
}
|
|
|
|
|
|
|
|
table Dial {
|
|
|
|
network: string;
|
|
|
|
address: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Response to Accept and Dial.
|
|
|
|
table NewConn {
|
|
|
|
rid: int;
|
|
|
|
remote_addr: string;
|
|
|
|
local_addr: string;
|
|
|
|
}
|
|
|
|
|
2018-08-13 19:55:10 -04:00
|
|
|
root_type Base;
|