-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
75 lines (65 loc) · 1.62 KB
/
index.d.ts
File metadata and controls
75 lines (65 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
declare module '@verdigris/libssh2.js' {
/**
* SSH session handle
*/
export type SSHSession = number;
/**
* SSH channel handle
*/
export type SSHChannel = number;
/**
* SSH socket handle
*/
export type SSHSocket = number;
/**
* Custom transport callback functions
*/
export interface CustomTransport {
customSend: (socket: SSHSocket, buffer: number, length: number) => number;
customRecv: (socket: SSHSocket, buffer: number, length: number) => number;
}
/**
* SSH2 WASM module interface
*/
export interface SSH2Module extends CustomTransport {
/**
* Initialize libssh2 library
* @param funcName Function name to call
* @param returnType Return type
* @param argTypes Array of argument types
* @param args Array of arguments
*/
ccall(
funcName: string,
returnType: string,
argTypes: string[],
args: any[]
): number;
/**
* Allocate memory in WASM heap
* @param size Size in bytes to allocate
*/
_malloc(size: number): number;
/**
* Free memory from WASM heap
* @param ptr Pointer to free
*/
_free(ptr: number): void;
/**
* Access to WASM heap memory
*/
HEAPU8: Uint8Array;
/**
* Custom send callback for transport
*/
customSend: (socket: SSHSocket, buffer: number, length: number) => number;
/**
* Custom receive callback for transport
*/
customRecv: (socket: SSHSocket, buffer: number, length: number) => number;
}
/**
* SSH2 module factory function
*/
export default function SSH2Module(): Promise<SSH2Module>;
}