forked from legastero/stanza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xep0177.ts
64 lines (59 loc) · 1.99 KB
/
xep0177.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
// ====================================================================
// XEP-0177: Jingle Raw UDP Transport Method
// --------------------------------------------------------------------
// Source: https://xmpp.org/extensions/xep-0177.html
// Version: 1.1 (2009-12-23)
// ====================================================================
import { attribute, childBoolean, DefinitionOptions, integerAttribute } from '../jxt';
import { NS_JINGLE_RAW_UDP_1 } from '../Namespaces';
import { JingleTransport } from './';
export interface JingleRawUdp extends JingleTransport {
transportType: typeof NS_JINGLE_RAW_UDP_1;
candidates?: JingleRawUdpCandidate[];
}
export interface JingleRawUdpCandidate {
component: string;
foundation: string;
id: string;
ip: string;
port: number;
type: 'host' | 'prflx' | 'srflx' | 'relay';
}
const Protocol: DefinitionOptions[] = [
{
element: 'transport',
fields: {
gatheringComplete: childBoolean(null, 'gathering-complete'),
password: attribute('pwd'),
usernameFragment: attribute('ufrag')
},
namespace: NS_JINGLE_RAW_UDP_1,
path: 'iq.jingle.contents.transport',
type: NS_JINGLE_RAW_UDP_1,
typeField: 'transportType'
},
{
aliases: [
{
impliedType: true,
multiple: true,
path: 'iq.jingle.contents.transport.candidates',
selector: NS_JINGLE_RAW_UDP_1
}
],
element: 'candidate',
fields: {
component: integerAttribute('component'),
foundation: attribute('foundation'),
generation: integerAttribute('generation'),
id: attribute('id'),
ip: attribute('ip'),
port: integerAttribute('port'),
type: attribute('type')
},
namespace: NS_JINGLE_RAW_UDP_1,
type: NS_JINGLE_RAW_UDP_1,
typeField: 'transportType'
}
];
export default Protocol;