@bytecodealliance/preview2-shim 0.17.2 → 0.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/lib/browser/cli.js +76 -103
- package/lib/browser/clocks.js +30 -29
- package/lib/browser/config.js +6 -0
- package/lib/browser/environment.js +29 -0
- package/lib/browser/filesystem.js +299 -255
- package/lib/browser/http.js +129 -128
- package/lib/browser/index.js +8 -16
- package/lib/browser/io.js +143 -135
- package/lib/browser/random.js +44 -42
- package/lib/browser/sockets.js +68 -166
- package/lib/common/instantiation.js +134 -0
- package/lib/io/calls.js +8 -5
- package/lib/io/worker-http.js +179 -157
- package/lib/io/worker-io.js +402 -386
- package/lib/io/worker-socket-tcp.js +271 -219
- package/lib/io/worker-socket-udp.js +494 -429
- package/lib/io/worker-sockets.js +255 -241
- package/lib/io/worker-thread.js +837 -754
- package/lib/nodejs/cli.js +64 -63
- package/lib/nodejs/clocks.js +51 -45
- package/lib/nodejs/filesystem.js +785 -651
- package/lib/nodejs/http.js +697 -617
- package/lib/nodejs/index.js +8 -16
- package/lib/nodejs/random.js +32 -28
- package/lib/nodejs/sockets.js +538 -474
- package/lib/synckit/index.js +94 -85
- package/package.json +11 -5
- package/types/index.d.ts +0 -1
- package/types/instantiation.d.ts +136 -0
package/lib/browser/random.js
CHANGED
|
@@ -3,54 +3,56 @@ const MAX_BYTES = 65536;
|
|
|
3
3
|
let insecureRandomValue1, insecureRandomValue2;
|
|
4
4
|
|
|
5
5
|
export const insecure = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
getInsecureRandomBytes(len) {
|
|
7
|
+
return random.getRandomBytes(len);
|
|
8
|
+
},
|
|
9
|
+
getInsecureRandomU64() {
|
|
10
|
+
return random.getRandomU64();
|
|
11
|
+
},
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
let insecureSeedValue1, insecureSeedValue2;
|
|
15
15
|
|
|
16
16
|
export const insecureSeed = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
insecureSeed() {
|
|
18
|
+
if (insecureSeedValue1 === undefined) {
|
|
19
|
+
insecureSeedValue1 = random.getRandomU64();
|
|
20
|
+
insecureSeedValue2 = random.getRandomU64();
|
|
21
|
+
}
|
|
22
|
+
return [insecureSeedValue1, insecureSeedValue2];
|
|
23
|
+
},
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export const random = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
27
|
+
getRandomBytes(len) {
|
|
28
|
+
const bytes = new Uint8Array(Number(len));
|
|
29
|
+
|
|
30
|
+
if (len > MAX_BYTES) {
|
|
31
|
+
// this is the max bytes crypto.getRandomValues
|
|
32
|
+
// can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
|
|
33
|
+
for (var generated = 0; generated < len; generated += MAX_BYTES) {
|
|
34
|
+
// buffer.slice automatically checks if the end is past the end of
|
|
35
|
+
// the buffer so we don't have to here
|
|
36
|
+
crypto.getRandomValues(
|
|
37
|
+
bytes.subarray(generated, generated + MAX_BYTES)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
crypto.getRandomValues(bytes);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return bytes;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
getRandomU64() {
|
|
48
|
+
return crypto.getRandomValues(new BigUint64Array(1))[0];
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
insecureRandom() {
|
|
52
|
+
if (insecureRandomValue1 === undefined) {
|
|
53
|
+
insecureRandomValue1 = random.getRandomU64();
|
|
54
|
+
insecureRandomValue2 = random.getRandomU64();
|
|
55
|
+
}
|
|
56
|
+
return [insecureRandomValue1, insecureRandomValue2];
|
|
57
|
+
},
|
|
56
58
|
};
|
package/lib/browser/sockets.js
CHANGED
|
@@ -1,186 +1,88 @@
|
|
|
1
1
|
export const instanceNetwork = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
instanceNetwork() {
|
|
3
|
+
console.log(`[sockets] instance network`);
|
|
4
|
+
},
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export const ipNameLookup = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
resolveAddresses () {
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
resolveNextAddress () {
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
nonBlocking () {
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
setNonBlocking () {
|
|
24
|
-
|
|
25
|
-
},
|
|
8
|
+
dropResolveAddressStream() {},
|
|
9
|
+
subscribe() {},
|
|
10
|
+
resolveAddresses() {},
|
|
11
|
+
resolveNextAddress() {},
|
|
12
|
+
nonBlocking() {},
|
|
13
|
+
setNonBlocking() {},
|
|
26
14
|
};
|
|
27
15
|
|
|
28
16
|
export const network = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
17
|
+
dropNetwork() {},
|
|
32
18
|
};
|
|
33
19
|
|
|
34
20
|
export const tcpCreateSocket = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
21
|
+
createTcpSocket() {},
|
|
38
22
|
};
|
|
39
23
|
|
|
40
24
|
export const tcp = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
addressFamily() {
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
setListenBacklogSize() {
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
keepAlive() {
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
setKeepAlive() {
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
noDelay() {
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
setNoDelay() {
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
unicastHopLimit() {
|
|
84
|
-
|
|
85
|
-
},
|
|
86
|
-
setUnicastHopLimit() {
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
receiveBufferSize() {
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
setReceiveBufferSize() {
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
sendBufferSize() {
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
setSendBufferSize() {
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
nonBlocking() {
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
setNonBlocking() {
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
shutdown() {
|
|
108
|
-
|
|
109
|
-
}
|
|
25
|
+
subscribe() {},
|
|
26
|
+
dropTcpSocket() {},
|
|
27
|
+
bind() {},
|
|
28
|
+
connect() {},
|
|
29
|
+
listen() {},
|
|
30
|
+
accept() {},
|
|
31
|
+
localAddress() {},
|
|
32
|
+
remoteAddress() {},
|
|
33
|
+
addressFamily() {},
|
|
34
|
+
setListenBacklogSize() {},
|
|
35
|
+
keepAlive() {},
|
|
36
|
+
setKeepAlive() {},
|
|
37
|
+
noDelay() {},
|
|
38
|
+
setNoDelay() {},
|
|
39
|
+
unicastHopLimit() {},
|
|
40
|
+
setUnicastHopLimit() {},
|
|
41
|
+
receiveBufferSize() {},
|
|
42
|
+
setReceiveBufferSize() {},
|
|
43
|
+
sendBufferSize() {},
|
|
44
|
+
setSendBufferSize() {},
|
|
45
|
+
nonBlocking() {},
|
|
46
|
+
setNonBlocking() {},
|
|
47
|
+
shutdown() {},
|
|
110
48
|
};
|
|
111
49
|
|
|
112
50
|
export const udp = {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
unicastHopLimit () {
|
|
150
|
-
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
setUnicastHopLimit () {
|
|
154
|
-
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
receiveBufferSize () {
|
|
158
|
-
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
setReceiveBufferSize () {
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
sendBufferSize () {
|
|
166
|
-
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
setSendBufferSize () {
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
nonBlocking () {
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
setNonBlocking () {
|
|
178
|
-
|
|
179
|
-
}
|
|
51
|
+
subscribe() {},
|
|
52
|
+
|
|
53
|
+
dropUdpSocket() {},
|
|
54
|
+
|
|
55
|
+
bind() {},
|
|
56
|
+
|
|
57
|
+
connect() {},
|
|
58
|
+
|
|
59
|
+
receive() {},
|
|
60
|
+
|
|
61
|
+
send() {},
|
|
62
|
+
|
|
63
|
+
localAddress() {},
|
|
64
|
+
|
|
65
|
+
remoteAddress() {},
|
|
66
|
+
|
|
67
|
+
addressFamily() {},
|
|
68
|
+
|
|
69
|
+
unicastHopLimit() {},
|
|
70
|
+
|
|
71
|
+
setUnicastHopLimit() {},
|
|
72
|
+
|
|
73
|
+
receiveBufferSize() {},
|
|
74
|
+
|
|
75
|
+
setReceiveBufferSize() {},
|
|
76
|
+
|
|
77
|
+
sendBufferSize() {},
|
|
78
|
+
|
|
79
|
+
setSendBufferSize() {},
|
|
80
|
+
|
|
81
|
+
nonBlocking() {},
|
|
82
|
+
|
|
83
|
+
setNonBlocking() {},
|
|
180
84
|
};
|
|
181
85
|
|
|
182
86
|
export const udpCreateSocket = {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
87
|
+
createUdpSocket() {},
|
|
186
88
|
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as wasi from '@bytecodealliance/preview2-shim';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* (EXPERIMENTAL) A class that holds WASI shims and can be used to configure
|
|
5
|
+
* an instantiation of a WebAssembly component transpiled with jco
|
|
6
|
+
* (i.e. via `jco transpile`).
|
|
7
|
+
*
|
|
8
|
+
* Normally, transpiled components contain mapping for WASI interfaces
|
|
9
|
+
* and/or imports that import the relevant packages (ex. `@bytecodealliance/preview2-shim/clocks`)
|
|
10
|
+
* from the right sources.
|
|
11
|
+
*
|
|
12
|
+
* This function makes use of the `WASIShim` object to provide an object that can be easily
|
|
13
|
+
* fed to the `instantiate` function produced by a transpiled component:
|
|
14
|
+
*
|
|
15
|
+
* ```js
|
|
16
|
+
* import { WASIShim } from "@bytecodealliance/preview2-shim/instantiation"
|
|
17
|
+
* // ...
|
|
18
|
+
* import { instantiate } from "path/to/transpiled/component.js"
|
|
19
|
+
* // ...
|
|
20
|
+
* const component = await instantiate(null, new WASIShim().getImportObject())
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* You can also replace imports that you'd like to override with custom implementations,
|
|
24
|
+
* by using the `WASIShim` object directly:
|
|
25
|
+
*
|
|
26
|
+
* ```js
|
|
27
|
+
* import { random } from "@bytecodealliance/preview2-shim"
|
|
28
|
+
* import { WASIShim } from "@bytecodealliance/preview2-shim/instantiation"
|
|
29
|
+
* // ...
|
|
30
|
+
* import { instantiate } from "path/to/transpiled/component.js"
|
|
31
|
+
* // ...
|
|
32
|
+
* const customWASIShim = new WASIShim({
|
|
33
|
+
* random: {
|
|
34
|
+
* // For these two interfaces we re-use the default provided shim
|
|
35
|
+
* random: random.random,
|
|
36
|
+
* insecure-seed: random.insecureSeed,
|
|
37
|
+
* // For insecure, we can supply our own custom implementation
|
|
38
|
+
* insecure: {
|
|
39
|
+
* ...
|
|
40
|
+
* }
|
|
41
|
+
* }
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* const component = await instantiate(null, customWASIShim.getImportObject())
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* Note that this object is similar but not identical to the Node `WASI` object --
|
|
48
|
+
* it is solely concerned with shimming of preview2 when dealing with a WebAssembly
|
|
49
|
+
* component transpiled by Jco. While this object *does* work with Node (and the browser)
|
|
50
|
+
* semantics are not the same as Node's `WASI` object.
|
|
51
|
+
*
|
|
52
|
+
* @class WASIShim
|
|
53
|
+
*/
|
|
54
|
+
export class WASIShim {
|
|
55
|
+
/** Object that confirms to the shim interface for `wasi:cli` */
|
|
56
|
+
#cli;
|
|
57
|
+
/** Object that confirms to the shim interface for `wasi:filesystem` */
|
|
58
|
+
#filesystem;
|
|
59
|
+
/** Object that confirms to the shim interface for `wasi:io` */
|
|
60
|
+
#io;
|
|
61
|
+
/** Object that confirms to the shim interface for `wasi:random` */
|
|
62
|
+
#random;
|
|
63
|
+
/** Object that confirms to the shim interface for `wasi:clocks` */
|
|
64
|
+
#clocks;
|
|
65
|
+
/** Object that confirms to the shim interface for `wasi:sockets` */
|
|
66
|
+
#sockets;
|
|
67
|
+
/** Object that confirms to the shim interface for `wasi:http` */
|
|
68
|
+
#http;
|
|
69
|
+
|
|
70
|
+
constructor(shims) {
|
|
71
|
+
this.#cli = shims?.cli ?? wasi.cli;
|
|
72
|
+
this.#filesystem = shims?.filesystem ?? wasi.filesystem;
|
|
73
|
+
this.#io = shims?.io ?? wasi.io;
|
|
74
|
+
this.#random = shims?.random ?? wasi.random;
|
|
75
|
+
this.#clocks = shims?.clocks ?? wasi.clocks;
|
|
76
|
+
this.#sockets = shims?.sockets ?? wasi.sockets;
|
|
77
|
+
this.#http = shims?.http ?? wasi.http;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Generate an import object for the shim that can be used with
|
|
82
|
+
* functions like `instantiate` that are exposed from a transpiled
|
|
83
|
+
* WebAssembly component.
|
|
84
|
+
*
|
|
85
|
+
* @param {GetImportObjectArgs} [opts] - options for import object generation
|
|
86
|
+
* @returns {WASIImportObject}
|
|
87
|
+
*
|
|
88
|
+
* @typedef {{
|
|
89
|
+
* asVersion?: number,
|
|
90
|
+
* }} GetImportObjectArgs
|
|
91
|
+
*/
|
|
92
|
+
getImportObject(opts) {
|
|
93
|
+
const versionSuffix = opts?.asVersion ? `@${opts.asVersion}` : '';
|
|
94
|
+
|
|
95
|
+
const obj = {};
|
|
96
|
+
obj[`wasi:cli/environment${versionSuffix}`] = this.#cli.environment;
|
|
97
|
+
obj[`wasi:cli/exit${versionSuffix}`] = this.#cli.exit;
|
|
98
|
+
obj[`wasi:cli/stderr${versionSuffix}`] = this.#cli.stderr;
|
|
99
|
+
obj[`wasi:cli/stdin${versionSuffix}`] = this.#cli.stdin;
|
|
100
|
+
obj[`wasi:cli/stdout${versionSuffix}`] = this.#cli.stdout;
|
|
101
|
+
obj[`wasi:cli/terminal-input${versionSuffix}`] = this.#cli.terminalInput;
|
|
102
|
+
obj[`wasi:cli/terminal-output${versionSuffix}`] = this.#cli.terminalOutput;
|
|
103
|
+
obj[`wasi:cli/terminal-stderr${versionSuffix}`] = this.#cli.terminalStderr;
|
|
104
|
+
obj[`wasi:cli/terminal-stdin${versionSuffix}`] = this.#cli.terminalStdin;
|
|
105
|
+
obj[`wasi:cli/terminal-stdout${versionSuffix}`] = this.#cli.terminalStdout;
|
|
106
|
+
|
|
107
|
+
obj[`wasi:sockets/instance-network${versionSuffix}`] = this.#sockets.instanceNetwork;
|
|
108
|
+
obj[`wasi:sockets/ip-name-lookup${versionSuffix}`] = this.#sockets.ipNameLookup;
|
|
109
|
+
obj[`wasi:sockets/network${versionSuffix}`] = this.#sockets.network;
|
|
110
|
+
obj[`wasi:sockets/tcp${versionSuffix}`] = this.#sockets.tcp;
|
|
111
|
+
obj[`wasi:sockets/tcp-create-socket${versionSuffix}`] = this.#sockets.tcpCreateSocket;
|
|
112
|
+
obj[`wasi:sockets/udp${versionSuffix}`] = this.#sockets.udp;
|
|
113
|
+
obj[`wasi:sockets/udp-create-socket${versionSuffix}`] = this.#sockets.udpCreateSocket;
|
|
114
|
+
|
|
115
|
+
obj[`wasi:filesystem/preopens${versionSuffix}`] = this.#filesystem.preopens;
|
|
116
|
+
obj[`wasi:filesystem/types${versionSuffix}`] = this.#filesystem.types;
|
|
117
|
+
|
|
118
|
+
obj[`wasi:io/error${versionSuffix}`] = this.#io.error;
|
|
119
|
+
obj[`wasi:io/poll${versionSuffix}`] = this.#io.poll;
|
|
120
|
+
obj[`wasi:io/streams${versionSuffix}`] = this.#io.streams;
|
|
121
|
+
|
|
122
|
+
obj[`wasi:random/random${versionSuffix}`] = this.#random.random;
|
|
123
|
+
obj[`wasi:random/insecure${versionSuffix}`] = this.#random.insecure;
|
|
124
|
+
obj[`wasi:random/insecure-seed${versionSuffix}`] = this.#random.insecureSeed;
|
|
125
|
+
|
|
126
|
+
obj[`wasi:clocks/monotonic-clock${versionSuffix}`] = this.#clocks.monotonicClock;
|
|
127
|
+
obj[`wasi:clocks/wall-clock${versionSuffix}`] = this.#clocks.wallClock;
|
|
128
|
+
|
|
129
|
+
obj[`wasi:http/types${versionSuffix}`] = this.#http.types;
|
|
130
|
+
obj[`wasi:http/outgoing-handler${versionSuffix}`] = this.#http.outgoingHandler;
|
|
131
|
+
|
|
132
|
+
return obj;
|
|
133
|
+
}
|
|
134
|
+
}
|
package/lib/io/calls.js
CHANGED
|
@@ -34,7 +34,7 @@ export const OUTPUT_STREAM_FLUSH = ++call_id << CALL_SHIFT;
|
|
|
34
34
|
export const OUTPUT_STREAM_BLOCKING_FLUSH = ++call_id << CALL_SHIFT;
|
|
35
35
|
export const OUTPUT_STREAM_WRITE_ZEROES = ++call_id << CALL_SHIFT;
|
|
36
36
|
export const OUTPUT_STREAM_BLOCKING_WRITE_ZEROES_AND_FLUSH =
|
|
37
|
-
|
|
37
|
+
++call_id << CALL_SHIFT;
|
|
38
38
|
export const OUTPUT_STREAM_SPLICE = ++call_id << CALL_SHIFT;
|
|
39
39
|
export const OUTPUT_STREAM_BLOCKING_SPLICE = ++call_id << CALL_SHIFT;
|
|
40
40
|
export const OUTPUT_STREAM_SUBSCRIBE = ++call_id << CALL_SHIFT;
|
|
@@ -62,6 +62,7 @@ export const HTTP_SERVER_STOP = ++call_id << CALL_SHIFT;
|
|
|
62
62
|
export const HTTP_SERVER_INCOMING_HANDLER = ++call_id << CALL_SHIFT;
|
|
63
63
|
export const HTTP_SERVER_SET_OUTGOING_RESPONSE = ++call_id << CALL_SHIFT;
|
|
64
64
|
export const HTTP_SERVER_CLEAR_OUTGOING_RESPONSE = ++call_id << CALL_SHIFT;
|
|
65
|
+
export const HTTP_SERVER_GET_ADDRESS = ++call_id << CALL_SHIFT;
|
|
65
66
|
export const HTTP_OUTGOING_BODY_DISPOSE = ++call_id << CALL_SHIFT;
|
|
66
67
|
|
|
67
68
|
// Clocks
|
|
@@ -103,7 +104,7 @@ export const SOCKET_UDP_SET_SEND_BUFFER_SIZE = ++call_id << CALL_SHIFT;
|
|
|
103
104
|
export const SOCKET_UDP_SET_UNICAST_HOP_LIMIT = ++call_id << CALL_SHIFT;
|
|
104
105
|
export const SOCKET_INCOMING_DATAGRAM_STREAM_RECEIVE = ++call_id << CALL_SHIFT;
|
|
105
106
|
export const SOCKET_OUTGOING_DATAGRAM_STREAM_CHECK_SEND =
|
|
106
|
-
|
|
107
|
+
++call_id << CALL_SHIFT;
|
|
107
108
|
export const SOCKET_OUTGOING_DATAGRAM_STREAM_SEND = ++call_id << CALL_SHIFT;
|
|
108
109
|
export const SOCKET_DATAGRAM_STREAM_SUBSCRIBE = ++call_id << CALL_SHIFT;
|
|
109
110
|
export const SOCKET_DATAGRAM_STREAM_DISPOSE = ++call_id << CALL_SHIFT;
|
|
@@ -119,9 +120,11 @@ export const SOCKET_RESOLVE_ADDRESS_DISPOSE_REQUEST = ++call_id << CALL_SHIFT;
|
|
|
119
120
|
|
|
120
121
|
export const reverseMap = {};
|
|
121
122
|
|
|
122
|
-
import * as calls from
|
|
123
|
+
import * as calls from './calls.js';
|
|
123
124
|
|
|
124
125
|
for (const name of Object.getOwnPropertyNames(calls)) {
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
if (name === 'reverseMap') {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
reverseMap[calls[name]] = name;
|
|
127
130
|
}
|