-
Notifications
You must be signed in to change notification settings - Fork 0
/
asnjs.d.mts
executable file
·227 lines (212 loc) · 8 KB
/
asnjs.d.mts
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
declare module "asnjs"{
export class DataCursor {
constructor(buffer: Uint8Array|ArrayBuffer, byteOffset?: number, byteLength?: number);
dv: DataView;
index?: number;
get buffer(): ArrayBuffer;
get byteOffset(): number;
get byteLength(): number;
getInt8(index?: number): number;
setInt8(r: number, index?: number): DataCursor;
getUint8(index?: number): number;
setUint8(r: number, index?: number): DataCursor;
getInt16(index?: number): number;
setInt16(r: number, index?: number): DataCursor;
getUint16(index?: number): number;
setUint16(r: number, index?: number): DataCursor;
getInt32(index?: number): number;
setInt32(r: number, index?: number): DataCursor;
getUint32(index?: number): number;
setUint32(r: number, index?: number): DataCursor;
getInt64(index?: number): bigint;
setInt64(r: number|bigint, index?: number): DataCursor;
getUint64(index?: number): bigint;
setUint64(r: number|bigint, index?: number): DataCursor;
hasNext(): boolean;
proceed(len: number): number;
}
export class iBitString extends Array<boolean>{
static from_oer(dc: DataCursor, bitLength?: number): iBitString;
static from_uper(dc: DataCursor, bitLength?: number): iBitString;
static to_oer(dc: DataCursor, r: any, bitLength?: number): DataCursor;
to_oer(dc: DataCursor, bitLength?:number):DataCursor;
readonly fixedLength: number;
}
export function BitString(fixedLength?: number): iBitString;
class NumberOerInterface {
from_oer(dc: DataCursor): number;
to_oer(dc: DataCursor, r: number|bigint): DataCursor;
from_uper(dc: DataCursor): number;
to_oer(dc: DataCursor): DataCursor;
}
export class Int8 extends NumberOerInterface {}
export class Int16 extends NumberOerInterface {}
export class Int32 extends NumberOerInterface {}
export class Int64 extends NumberOerInterface {}
export class Uint8 extends NumberOerInterface {}
export class Uint16 extends NumberOerInterface {}
export class Uint32 extends NumberOerInterface {}
export class Uint64 extends NumberOerInterface {}
class iInteger extends Number {
readonly min: number | bigint;
readonly max: number | bigint;
readonly extendable: boolean;
readonly MAX_VALUE: number|bigint;
readonly MIN_VALUE: number|bigint;
to_oer(dc: DataCursor): DataCursor;
static from_oer(dc: DataCursor): number|bigint;
static to_oer(dc: DataCursor, r: number|bigint): DataCursor;
static from_uper(dc: DataCursor): number|bigint;
}
export default function Integer(options?: {
min?: number | bigint;
max?: number | bigint;
length?: number;
} | number | bigint, max?: number|bigint): iInteger;
export class Length extends Number {
static from_oer(dc: DataCursor): Length;
static to_oer(dc: DataCursor, r: number): DataCursor;
to_oer(dc: DataCursor): DataCursor;
}
class iEnumerated extends Number{
fields: string [];
to_oer(dc: DataCursor): DataCursor;
isExtension(x: string): boolean;
}
export function Enumerated(fields: string []):{
new (x: any): iEnumerated;
from_oer(dc: DataCursor): iEnumerated;
from_uper(dc: DataCursor): iEnumerated;
to_oer(dc: DataCursor, r:number): DataCursor;
};
export namespace Enumerated {
function from_uper(dc: DataCursor): iEnumerated;
function to_oer(dc: DataCursor, r:number): DataCursor;
}
export function IA5String(fixedLength?: number): string;
export namespace IA5String {
function from_oer(dc: DataCursor, len?: number): string;
function from_uper(dc: DataCursor, len?: number): string;
}
export function UTF8String(fixedLength?: number): string;
export namespace UTF8String {
function from_oer(dc: DataCursor, len?: number): string;
function from_uper(dc: DataCursor, len?: number): string;
}
export class iOctetString extends Uint8Array{
readonly fixedLength: number|undefined;
readonly BYTES_PER_ELEMENT: number;
readonly buffer: ArrayBuffer;
readonly byteLength: number;
readonly byteOffset: number;
dataCursor(): DataCursor;
to_oer(ds:DataCursor):DataCursor;
}
export function OctetString(fixedLength?: number):{
new (buffer: string|ArrayBuffer|Uint8Array, offset?: number, len?: number): iOctetString;
from_oer(dc: DataCursor, options?: number|{length:number}): iOctetString;
from_uper(dc: DataCursor, options?: number|{length:number}): iOctetString;
equal(b:iOctetString):boolean;
};
export namespace OctetString {
function from_oer(dc: DataCursor, options?: number|{length:number}): iOctetString;
function from_uper(dc: DataCursor, options?: number|{length:number}): iOctetString;
function equal(a:iOctetString, b:iOctetString): boolean;
}
export class iChoice {
to_oer(dc: DataCursor, options?:{
keep_buffer?:boolean,
}):DataCursor;
fields:{
name:string,
type:any,
extension?:boolean
}[];
oer?:Uint8Array;
}
export function Choice(
fields: {
name:string,
type:any,
keep_buffer?:boolean,
extension?:boolean
}[],
options: {
extendable?:boolean,
}
): {
new (): iChoice;
from_oer(dc: DataCursor, options?: {keep_buffer?:boolean}): {
tagName:string,
tagIndex:number,
[key:string]: any
};
}
export class iSequence {
to_oer(dc:DataCursor, options?:{
keep_buffer?:boolean
}):DataCursor;
[key:string]:any;
oer?:Uint8Array
}
export function Sequence(
fields: {
type?:any,
key?:any
name?:string,
extension?:boolean,
default?:any,
optional?:boolean
}[], options: {
extendable?:boolean
}): {
new (): iSequence;
from_oer(dc: DataCursor, options: {}): iSequence;
fields: {
type?:any,
key?:any
name?:string,
extension?:boolean,
default?:any,
optional?:boolean
}[];
};
export class iSequenceOf<T> extends Array<T> {
oer?:Uint8Array
Type():T
}
export function SequenceOf<T>(type:T):{
new():iSequenceOf<T>;
from_oer(dc:DataCursor, options:{keep_buffer?:boolean}):iSequenceOf<T>
from_uper(dc:DataCursor, options:{keep_buffer?:boolean}):iSequenceOf<T>
}
export class Tag {
static from_oer(dc: DataCursor): Tag;
static to_oer(dc: DataCursor, c: any, t: any): void;
constructor(c: any, t: any);
class: number;
index: number;
get tag(): any;
to_oer(dc: DataCursor): DataCursor;
}
export namespace Tag {
const UNIVARSAL: number;
const APPLICATION: number;
const CONTEXT_SPEC: number;
const PRIVATE: number;
}
export function OpenType(variants: [], varName?: string): {
new (): {
to_oer(dc: DataCursor, inner: Function|Object): DataCursor;
};
from_oer(dc: DataCursor, options: any): any;
from_uper(dc: DataCursor, options: any): any;
variants: {};
};
export class Null {
static from_oer(dc: DataCursor): undefined;
static from_uper(dc: DataCursor): undefined;
static to_oer(dc: DataCursor): DataCursor;
to_oer(dc:DataCursor): DataCursor;
};
}