-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.d.ts
67 lines (61 loc) · 1.35 KB
/
index.d.ts
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
export type OptionName =
| "If-Match"
| "Uri-Host"
| "ETag"
| "If-None-Match"
| "Observe"
| "Uri-Port"
| "Location-Path"
| "Uri-Path"
| "OSCORE"
| "Content-Format"
| "Max-Age"
| "Uri-Query"
| "Hop-Limit"
| "Accept"
| "Q-Block1"
| "Location-Query"
| "Block2"
| "Block1"
| "Size2"
| "Q-Block2"
| "Proxy-Uri"
| "Proxy-Scheme"
| "Size1"
| "No-Response"
| "OCF-Accept-Content-Format-Version"
| "OCF-Content-Format-Version";
export type CoapMethod = "GET" | "POST" | "PUT" | "DELETE" | "FETCH" | "PATCH" | "iPATCH";
export interface Packet {
token?: Buffer;
code?: CoapMethod | string;
messageId?: number;
payload?: Buffer;
options?: (Option | NamedOption)[];
confirmable?: boolean;
reset?: boolean;
ack?: boolean;
}
export interface ParsedPacket {
code: string;
confirmable: boolean;
reset: boolean;
ack: boolean;
messageId: number;
token: Buffer;
options: {
name: OptionName | number,
value: Buffer
}[];
payload: Buffer;
}
export interface NamedOption {
name: OptionName;
value: Buffer;
}
export interface Option {
name: number | string;
value: Buffer;
}
export function generate(packet: Packet, maxLength?: number): Buffer;
export function parse(buffer: Buffer): ParsedPacket;