-
Notifications
You must be signed in to change notification settings - Fork 6
/
index-old.html
1772 lines (1771 loc) · 88.3 KB
/
index-old.html
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link href="includes/style.css" rel="stylesheet">
<title>QUIC API for WebRTC</title>
<script class="remove" src="includes/respec-w3c-common.js" type="text/javascript"></script>
<script src="includes/respec-config.js" class="remove"></script>
</head>
<body>
<section id="abstract">
<p>This document defines a set of ECMAScript APIs in WebIDL to allow data to be sent
and received from another browser or device implementing the QUIC
protocol. This specification is being developed in conjunction with protocol
specifications developed by the IETF QUIC Working Group.</p>
</section>
<section id="sotd">
<p>The API is a product of the W3C ORTC Community Group.</p>
</section>
<section class="informative" id="intro">
<h2>Introduction</h2>
<p>This specification extends the WebRTC [[!WEBRTC]] and ORTC [[!ORTC]] specifications
to enable the use of QUIC [[!QUIC-TRANSPORT]] to exchange arbitrary data with
remote peers using NAT-traversal technologies such as ICE, STUN, and
TURN. Since QUIC can be multiplexed on the same port as RTP, RTCP,
DTLS, STUN and TURN, this specification is compatible with all the
functionality defined in [[!WEBRTC]] and [[!ORTC]] including communication
using audio/video media and SCTP data channels.</p>
<p>While this specification defines an interface to QUIC streams,
by utilizing a QUIC stream per message, it is possible to implement
support for message-based communications (such as <code>RTCDataChannel</code>)
on top.</p>
<p class="note">The QUIC API presented in this specification
represents a preliminary proposal based on work-in-progress
within the IETF QUIC WG. Since the QUIC transport specification is
a work-in-progress, both the protocol and API are likely to
change significantly going forward.</p>
</section>
<section id="conformance">
<p>This specification defines conformance criteria that apply to a single
product: the <dfn>user agent</dfn> that implements the interfaces that it
contains.</p>
<p>Conformance requirements phrased as algorithms or specific steps may be
implemented in any manner, so long as the end result is equivalent. (In
particular, the algorithms defined in this specification are intended to be
easy to follow, and not intended to be performant.)</p>
<p>Implementations that use ECMAScript to implement the APIs defined in
this specification <em class="rfc2119" title="MUST">MUST</em> implement them
in a manner consistent with the ECMAScript Bindings defined in the Web IDL
specification [[!WEBIDL-1]], as this specification uses that specification
and terminology.</p>
</section>
<section>
<h2>Terminology</h2>
<p>The <code><a href=
"http://dev.w3.org/html5/spec/webappapis.html#eventhandler">EventHandler</a></code>
interface, representing a callback used for event handlers, and the <a href=
"http://dev.w3.org/html5/spec/webappapis.html#errorevent"><code><dfn>ErrorEvent</dfn></code></a>
interface are defined in [[!HTML51]].</p>
<p>The concepts <dfn><a href=
"http://dev.w3.org/html5/spec/webappapis.html#queue-a-task">queue a task</a></dfn>,
<dfn><a href=
"http://dev.w3.org/html5/spec/webappapis.html#fire-a-simple-event">fires a simple
event</a></dfn> and <dfn><a href=
"http://dev.w3.org/html5/spec/webappapis.html#networking-task-source">networking
task source</a></dfn> are defined in [[!HTML51]].</p>
<p>The term <dfn>finished reading</dfn> means that the application has read all
available data up to the STREAM frame with the FIN bit set, which causes
the <a>[[\Readable]]</a> slot to be set to <code>false</code>.</p>
<p>The terms <dfn>event</dfn>, <dfn><a href=
"http://dev.w3.org/html5/spec/webappapis.html#event-handlers">event
handlers</a></dfn> and <dfn><a href=
"http://dev.w3.org/html5/spec/webappapis.html#event-handler-event-type">event
handler event types</a></dfn> are defined in [[!HTML51]].</p>
<p>When referring to exceptions, the terms <dfn><a
href="https://www.w3.org/TR/WebIDL-1/#dfn-throw">throw</a></dfn> and
<dfn data-dfn-for="exception"><a href=
"https://www.w3.org/TR/WebIDL-1/#dfn-create-exception">create</a></dfn> are
defined in [[!WEBIDL-1]].</p>
<p>The terms <dfn data-lt="fulfill|fulfillment">fulfilled</dfn>, <dfn
data-lt="reject|rejection|rejecting|rejected">rejected</dfn>,
<dfn data-lt="resolve|resolves">resolved</dfn>, <dfn>pending</dfn> and
<dfn data-lt="settled">settled</dfn> used in the context of Promises are defined in
[[!ECMASCRIPT-6.0]].</p>
<p>The <dfn><code>RTCIceTransport</code></dfn> and <dfn><code>RTCCertificate</code></dfn> interfaces
and the <dfn><code>RTCDtlsFingerprint</code></dfn> dictionary are defined in [[!WEBRTC]] and [[!ORTC]].</p>
</section>
<section id="quic-transport*">
<h2><dfn>RTCQuicTransport</dfn> Interface</h2>
<p>The <code>RTCQuicTransport</code> includes information relating
to QUIC transport.</p>
<section id="rtcquictransport-overview*">
<h3>Overview</h3>
<p>An <code><a>RTCQuicTransport</a></code> instance can be associated to
one or more <code><a>RTCQuicBidirectionalStream</a></code>,
<code><a>RTCQuicSendStream</a></code>, or <code><a>RTCQuicReceiveStream</a></code>
instances.</p>
</section>
<section id="rtcquictransport-operation*">
<h3>Operation</h3>
<p>The QUIC transport protocol is described in [[!QUIC-TRANSPORT]].
A <code><a>RTCQuicTransport</a></code> instance is constructed
using an <code><a>RTCIceTransport</a></code> and an optional sequence of
<code><a>RTCCertificate</a></code> objects.
An <code><a>RTCQuicTransport</a></code> object in the <code>"closed"</code> or
<code>"failed"</code> states can be garbage-collected when it is no longer
referenced.</p>
<p>The QUIC negotiation occurs between transport endpoints determined via ICE.
Multiplexing of QUIC with STUN, TURN, DTLS, RTP and RTCP
is supported within [[QUIC-TRANSPORT]].</p>
<p>A newly constructed <code><a>RTCQuicTransport</a></code> <em class="rfc2119"
title="MUST">MUST</em> listen and respond to incoming QUIC packets before
<code>start()</code> is called. However, to complete the negotiation it is
necessary to verify the remote fingerprint by computing fingerprints for
the selected remote certificate using the digest algorithms provided
in <code><var>remoteParameters</var>.fingerprints[].algorithm</code>. If a
calculated fingerprint and algorithm matches a fingerprint and algorithm
included in <code><var>remoteParameters</var>.fingerprints[]</code>,
the remote fingerprint is verified. After the QUIC handshake exchange
completes (but before the remote fingerprint is verified) incoming media packets
may be received. A modest buffer <em class="rfc2119" title="MUST">MUST</em> be
provided to avoid loss of media prior to remote fingerprint validation (which can
begin after <code>start()</code> is called).</p>
</section>
<section id="rtcquictransport-interface-definition*">
<h3>Interface Definition</h3>
<div>
<pre class="idl">
[ Constructor (RTCIceTransport transport, optional sequence<RTCCertificate> certificates), Exposed=Window]
interface RTCQuicTransport : RTCStatsProvider {
readonly attribute RTCIceTransport transport;
readonly attribute RTCQuicTransportState state;
RTCQuicParameters getLocalParameters ();
RTCQuicParameters? getRemoteParameters ();
sequence<RTCCertificate> getCertificates ();
sequence<ArrayBuffer> getRemoteCertificates ();
void start (RTCQuicParameters remoteParameters);
void stop (RTCQuicTransportStopInfo stopInfo);
RTCQuicBidirectionalStream createBidirectionalStream ();
RTCQuicSendStream createSendStream (optional RTCQuicStreamParameters parameters);
attribute EventHandler onstatechange;
attribute EventHandler onerror;
attribute EventHandler onreceivestream;
attribute EventHandler onbidirectionalstream;
};</pre>
<section>
<h2>Constructors</h2>
When the <code><a>RTCQuicTransport</a></code> constructor is invoked,
the user agent <em class="rfc2119" title="MUST">MUST</em> run the
following steps:
<ol>
<li>Let <var>transport</var> be the first argument.</li>
<li>If <var>transport</var> is in the <code>"closed"</code>
state, <a>throw</a> an <code>InvalidStateError</code> and abort
these steps.</li>
<li>If <var>transport</var> has been used to construct another
<code><a>RTCQuicTransport</a></code> whose <a>[[\QuicTransportState]]</a> slot
is not <code>"closed"</code>, <a>throw</a> an <code>InvalidStateError</code>
and abort these steps.</li>
<li>
Let <var>certificates</var> be the second argument if provided,
<code>null</code> otherwise.
</li>
<li>
If <var>certificates</var> is non-null and is non-empty, check that the
<code>expires</code> attribute of each <code><a>RTCCertificate</a></code>
object is in the future. If a certificate has expired, <a>throw</a> an
<code>InvalidAccessError</code> and abort these steps.
</li>
<li>
Let <var>quictransport</var> be a newly constructed
<code><a>RTCQuicTransport</a></code> object.
</li>
<li>Let <var>quictransport</var> have a <dfn>[[\QuicTransportWritableStreams]]</dfn>
internal slot representing a sequence of <code><a>RTCQuicWritableStream</a></code>
objects, initialized to empty.
</li>
<li>Let <var>quictransport</var> have a <dfn>[[\QuicTransportReadableStreams]]</dfn>
internal slot representing a sequence of <code><a>RTCQuicReadableStream</a></code>
objects, initialized to empty.
</li>
<li>
Let <var>quictransport</var> have a <dfn>[[\QuicTransportState]]</dfn>
internal slot, initialized to <code>"new"</code>.
</li>
<li>
Let <var>quictransport</var> have a <dfn>[[\Certificates]]</dfn>
internal slot.
</li>
<li>
If <var>certificates</var> is non-null and is non-empty,
initialize the <a>[[\Certificates]]</a> internal slot to
<var>certificates</var>.
</li>
<li>
If <var>certificates</var> is <code>null</code> or is empty,
generate a certificate using the default key generation algorithm
and store it in the <a>[[\Certificates]]</a> internal slot.
</li>
<li>
Return <var>quictransport</var>.
</li>
</ol>
<dl data-link-for="RTCQuicTransport" data-dfn-for="RTCQuicTransport" class=
"constructors">
<dt><code><a>RTCQuicTransport</a></code></dt>
<dd>
<table class="parameters">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Nullable</th>
<th>Optional</th>
<th>Description</th>
</tr>
<tr>
<td class="prmName">transport</td>
<td class="prmType"><code><a>RTCIceTransport</a></code></td>
<td class="prmNullFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmOptFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmDesc"></td>
</tr>
<tr>
<td class="prmName">certificates</td>
<td class="prmType">
<code>sequence</code><<code><a>RTCCertificate</a></code>></td>
<td class="prmNullFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmOptTrue"><span role="img" aria-label=
"True">✔</span></td>
<td class="prmDesc"></td>
</tr>
</tbody>
</table>
</dd>
</dl>
</section>
<section>
<h2>Attributes</h2>
<dl data-link-for="RTCQuicTransport" data-dfn-for="RTCQuicTransport" class=
"attributes">
<dt><dfn><code>transport</code></dfn> of type <span class=
"idlAttrType"><a>RTCIceTransport</a></span>, readonly</dt>
<dd>
<p>The associated <code><a>RTCIceTransport</a></code> instance.</p>
</dd>
<dt><dfn><code>state</code></dfn> of type <span class=
"idlAttrType"><a>RTCQuicTransportState</a></span>, readonly</dt>
<dd>
<p>The current state of the QUIC transport. On getting, it
<em class="rfc2119" title="MUST">MUST</em> return the value
of the <a>[[\QuicTransportState]]</a> internal slot.</p>
</dd>
<dt><dfn><code>onstatechange</code></dfn> of type <span class=
"idlAttrType"><a>EventHandler</a></span></dt>
<dd>
<p>This event handler, of event handler event type
<code><a>statechange</a></code>, <em class="rfc2119" title="MUST">MUST</em>
be fired any time the <a>[[\QuicTransportState]]</a> slot changes.</p>
</dd>
<dt><dfn><code>onerror</code></dfn> of type <span class=
"idlAttrType"><a>EventHandler</a></span></dt>
<dd>
<p>This event handler, of event handler event type <code>error</code>,
<em class="rfc2119" title="MUST">MUST</em> be fired on reception of a QUIC
error; an implementation <em class="rfc2119" title=
"SHOULD">SHOULD</em> include QUIC error information in
<var>error.message</var> (defined in [[!HTML51]] Section 7.1.3.8.2).</p>
</dd>
<dt><dfn><code>onreceivestream</code></dfn> of type <span class=
"idlAttrType"><a>EventHandler</a></span></dt>
<dd>
<p>This event handler, of event handler event type
<code><a>receivestream</a></code>,
<em class="rfc2119" title="MUST">MUST</em> be fired on when data is received
from a newly created remote <code><a>RTCQuicSendStream</a></code> for the
first time.
</p>
</dd>
<dt><dfn><code>onbidirectionalstream</code></dfn> of type <span class=
"idlAttrType"><a>EventHandler</a></span></dt>
<dd>
<p>This event handler, of event handler event type
<code><a>bidirectionalstream</a></code>,
<em class="rfc2119" title="MUST">MUST</em> be fired when data is received
from a newly created remote <code><a>RTCQuicBidirectionalStream</a></code> for the
first time.
</p>
</dd>
</dl>
</section>
<section>
<h2>Methods</h2>
<dl data-link-for="RTCQuicTransport" data-dfn-for="RTCQuicTransport" class=
"methods">
<dt><code>getLocalParameters</code></dt>
<dd>
<p><dfn>getLocalParameters()</dfn> obtains the QUIC parameters of
the local <code><a>RTCQuicTransport</a></code> upon construction.
If multiple certificates were provided in the constructor, then
multiple fingerprints will be returned, one for each certificate.
<code>getLocalParameters().role</code> always returns the default
role of a newly constructed <code><a>RTCQuicTransport</a></code>;
for a browser this will be <code>auto</code>.</p>
<div>
<em>No parameters.</em>
</div>
<div>
<em>Return type:</em> <code><a>RTCQuicParameters</a></code>
</div>
</dd>
<dt><code>getRemoteParameters</code></dt>
<dd>
<p><dfn>getRemoteParameters()</dfn> obtains
the remote QUIC parameters passed in the
<code>start()</code> method. Prior to calling
<code>start()</code>, null is returned.</p>
<div>
<em>No parameters.</em>
</div>
<div>
<em>Return type:</em> <code><a>RTCQuicParameters</a></code>, nullable
</div>
</dd>
<dt><code>getCertificates</code></dt>
<dd>
<p><dfn>getCertificates()</dfn> returns the value of the <code><a>RTCQuicTransport</a></code>'s
<a>[[\Certificates]]></a> internal slot.</p>
<div>
<em>No parameters.</em>
</div>
<div>
<em>Return type:</em> <code>sequence<RTCCertificate></code>
</div>
</dd>
<dt><code>getRemoteCertificates</code></dt>
<dd>
<p><dfn>getRemoteCertificates()</dfn> returns the certificate chain in use by the remote side, with each
certificate encoded in binary Distinguished Encoding Rules (DER) [[!X690]].
<code><a>getRemoteCertificates()</a></code> returns an empty list prior to
selection of the remote certificate, which is completed once
<code><a>RTCQuicTransportState</a></code> transitions to
<code>connected</code>.</p>
<div>
<em>No parameters.</em>
</div>
<div>
<em>Return type:</em> <code>sequence<ArrayBuffer></code>
</div>
</dd>
<dt><dfn><code>start</code></dfn></dt>
<dd>
<p>Start QUIC transport negotiation with the parameters of the remote QUIC
transport, including verification of the remote fingerprint.
Only a single QUIC transport can be multiplexed over an ICE transport.
Therefore if a <code><a>RTCQuicTransport</a></code> object
<var>quicTransportB</var> is constructed with an
<code><a>RTCIceTransport</a></code> object <var>iceTransport</var>
previously used to construct another <code><a>RTCQuicTransport</a></code>
object <var>quicTransportA</var>, then if
<code>quicTransportB.start()</code> is called prior to having called
<code>quicTransportA.stop()</code>, then <a>throw</a> an
<code>InvalidStateError</code>.</p>
<p>If <code>start</code> is called after a previous <code>start</code>
call, or if <code>state</code> is <code>closed</code>, <a>throw</a>
an <code>InvalidStateError</code>.</p>
<p>If all of the values of
<code><var>remoteParameters</var>.fingerprints[<var>j</var>].algorithm</code>
are unsupported, where <var>j</var> goes from 0 to the number of fingerprints,
<a>throw</a> a <code>NotSupportedError</code>.</p>
<table class="parameters">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Nullable</th>
<th>Optional</th>
<th>Description</th>
</tr>
<tr>
<td class="prmName">remoteParameters</td>
<td class="prmType"><code><a>RTCQuicParameters</a></code></td>
<td class="prmNullFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmOptFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmDesc"></td>
</tr>
</tbody>
</table>
<div>
<em>Return type:</em> <code>void</code>
</div>
</dd>
<dt><dfn><code>stop</code></dfn></dt>
<dd>
<p>Stops and closes the <code><a>RTCQuicTransport</a></code> object.
This triggers an <dfn>Immediate Close</dfn> as described in [[QUIC-TRANSPORT]] section 10.3.
<p>When <code>stop</code> is called, the user agent <em class="rfc2119" title="MUST">MUST</em>
run the following steps:</p>
<ol>
<li>Let <var>transport</var> be the <code><a>RTCQuicTransport</a></code>
on which <code>stop</code> is invoked.</li>
<li>If <var>transport</var>'s <a>[[\QuicTransportState]]</a> is <code>"closed"</code>
then abort these steps.</li>
<li>Set <var>transport</var>'s <a>[[\QuicTransportState]]</a> to
<code>"closed"</code>.</li>
<li>Let <code>stopInfo</code> be the first argument.</li>
<li>Start the <a>Immediate Close</a> procedure by sending an CONNECTION_CLOSE frame
with its error code value set to the value of <var>stopInfo</var>.errorCode
and its reason value set to the value of <var>stopInfo</var>.reason.</li>
</ol>
<div>
<em>No parameters.</em>
</div>
<div>
<em>Return type:</em> <code>void</code>
</div>
<table class="parameters">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Nullable</th>
<th>Optional</th>
<th>Description</th>
</tr>
<tr>
<td class="prmName">stopInfo</td>
<td class="prmType"><code>RTCQuicTransportStopInfo</code></td>
<td class="prmNullFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmOptFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmDesc"></td>
</tr>
</tbody>
</table>
</dd>
<dt><dfn><code>createBidirectionalStream</code></dfn></dt>
<dd>
<p>Creates an <code><a>RTCQuicBidirectionalStream</a></code> object.</p>
<p>When <code>createBidectionalStream</code> is called, the user agent
<em class="rfc2119" title="MUST">MUST</em> run the following
steps:</p>
<ol>
<li>
<p>Let <var>transport</var> be the <code><a>RTCQuicTransport</a></code>
on which <code>createBidectionalStream</code> is invoked.</p>
</li>
<li>
<p>If <code><var>transport</var>'s state</code> is not <code>connected</code>
<a>throw</a> an <code>InvalidStateError</code> and abort these steps.</p>
</li>
<li>
<p>Let <var>stream</var> be a newly created
<code><a>RTCQuicBidirectionalStream</a></code> object.</p>
</li>
<li>
<p>Add <var>stream</var> to <var>transport</var>'s
<a>[[\QuicTransportWritableStreams]]</a> internal slot. </p>
</li>
<li>
<p>Add <var>stream</var> to <var>transport</var>'s
<a>[[\QuicTransportReadableStreams]]</a> internal slot. </p>
</li>
<li>
<p>Return <var>stream</var> and continue the following steps
in the background.</p>
</li>
<li>
<p>Create <var>stream</var>'s associated underlying data
transport.</p>
</li>
</ol>
<div>
<em>No parameters.</em>
</div>
<div>
<em>Return type:</em> <code><a>RTCQuicBidirectionalStream</a></code>
</div>
</dd>
<dt><dfn><code>createSendStream</code></dfn></dt>
<dd>
<p>Creates an <code><a>RTCQuicSendStream</a></code> object.</p>
<p>When <code>createSendStream</code> is called, the user agent
<em class="rfc2119" title="MUST">MUST</em> run the following
steps:</p>
<ol>
<li>
<p>Let <var>transport</var> be the <code><a>RTCQuicTransport</a></code>
on which <code>createSendStream</code> is invoked.</p>
</li>
<li>
<p>If <code><var>transport</var>'s state</code> is not <code>connected</code>
<a>throw</a> an <code>InvalidStateError</code> and abort these steps.</p>
</li>
<li>
<p>Let <var>stream</var> be a newly created
<code><a>RTCQuicSendStream</a></code> object.</p>
</li>
<li>
<p>Add <var>stream</var> to <var>transport</var>'s <a>[[\QuicTransportWritableStreams]]</a>
internal slot. </p>
</li>
<li>
<p>Return <var>stream</var> and continue the following steps
in the background.</p>
</li>
<li>
<p>Create <var>stream</var>'s associated underlying data
transport.</p>
</li>
</ol>
<div>
<em>No parameters.</em>
</div>
<div>
<em>Return type:</em> <code><a>RTCQuicSendStream</a></code>
</div>
</dd>
</dl>
</section>
</div>
</section>
<section id="rtcquicparameters*">
<h3><dfn>RTCQuicParameters</dfn> Dictionary</h3>
<p>The <code>RTCQuicParameters</code> dictionary includes information
relating to QUIC configuration.</p>
<div>
<pre class="idl">dictionary RTCQuicParameters {
RTCQuicRole role = "auto";
sequence<RTCDtlsFingerprint> fingerprints;
};</pre>
<section>
<h2>Dictionary <a class="idlType">RTCQuicParameters</a> Members</h2>
<dl data-link-for="RTCQuicParameters" data-dfn-for="RTCQuicParameters" class=
"dictionary-members">
<dt><dfn><code>role</code></dfn> of type <span class=
"idlMemberType"><a>RTCQuicRole</a></span>, defaulting to
<code>"auto"</code></dt>
<dd>
<p>The QUIC role, with a default of <code>auto</code>.</p>
</dd>
<dt><dfn><code>fingerprints</code></dfn> of type <span class=
"idlMemberType">sequence<<a>RTCDtlsFingerprint</a>></span></dt>
<dd>
<p>Sequence of fingerprints, at least one fingerprint for each certificate
(with one computed with the digest algorithm used in the certificate
signature).</p>
</dd>
</dl>
</section>
</div>
</section>
<section id="rtcstreamparameters*">
<h3><dfn>RTCQuicStreamParameters</dfn> Dictionary</h3>
<p>The <code>RTCQuicParameters</code> dictionary includes information
relating to QUIC stream configuration.</p>
<div>
<pre class="idl">dictionary RTCQuicStreamParameters {
bool disableRetransmissions = false;
};</pre>
<section>
<h2>Dictionary <a class="idlType">RTCQuicStreamParameters</a> Members</h2>
<dl data-link-for="RTCQuicStreamParameters" data-dfn-for="RTCQuicStreamParameters" class=
"dictionary-members">
<dt><dfn><code>disableRetransmissions</code></dfn> of type <span class=
"idlMemberType"><a>bool</a></span>, defaulting to
<code>false</code></dt>
<dd>
<p>disableRetransmissions, with a default of <code>false</code>. If
true, the stream will be sent without retransmissions. If false, the
stream will be sent with retransmissions.</p>
</dd>
</dl>
</section>
</div>
</section>
<section>
<h3><dfn>ReceiveStreamEvent</dfn></h3>
<p>The <code><a>receivestream</a></code> event uses the
<code><a>ReceiveStreamEvent</a></code> interface.</p>
<div>
<pre class="idl">
[ Constructor (DOMString type, ReceiveStreamEventInit eventInitDict), Exposed=Window]
interface ReceiveStreamEvent : Event {
readonly attribute RTCQuicReceiveStream stream;
};</pre>
<section>
<h2>Constructors</h2>
<dl data-link-for="ReceiveStreamEvent" data-dfn-for="ReceiveStreamEvent"
class="constructors">
<dt><code>ReceiveStreamEvent</code></dt>
<dd>
<table class="parameters">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Nullable</th>
<th>Optional</th>
<th>Description</th>
</tr>
<tr>
<td class="prmName">type</td>
<td class="prmType"><code>DOMString</code></td>
<td class="prmNullFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmOptFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmDesc"></td>
</tr>
<tr>
<td class="prmName">eventInitDict</td>
<td class="prmType"><code><a>ReceiveStreamEventInit</a></code></td>
<td class="prmNullFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmOptFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmDesc"></td>
</tr>
</tbody>
</table>
</dd>
</dl>
</section>
<section>
<h2>Attributes</h2>
<dl data-link-for="ReceiveStreamEvent" data-dfn-for="ReceiveStreamEvent"
class="attributes">
<dt><code>stream</code> of type <span class=
"idlAttrType"><a>RTCQuicReceiveStream</a></span>, readonly</dt>
<dd>
<p>The <dfn id="dom-receivequicstreamevent-stream"><code>stream</code></dfn>
attribute represents the <code><a>RTCQuicReceiveStream</a></code> object
associated with the event.</p>
</dd>
</dl>
</section>
</div>
<div>
<p>The <dfn><code>ReceiveStreamEventInit</code></dfn> dictionary includes
information on the configuration of the QUIC stream.</p>
<pre class="idl">dictionary ReceiveStreamEventInit : EventInit {
RTCQuicReceiveStream stream;
};</pre>
<section>
<h2>Dictionary ReceiveStreamEventInit Members</h2>
<dl data-link-for="ReceiveStreamEventInit" data-dfn-for=
"ReceiveStreamEventInit" class="dictionary-members">
<dt><dfn><code>stream</code></dfn> of type <span class=
"idlMemberType"><a>RTCQuicReceiveStream</a></span></dt>
<dd>
<p>The <code><a>RTCQuicReceiveStream</a></code> object associated with the
event.</p>
</dd>
</dl>
</section>
</div>
</section>
<section>
<h3><dfn>BidirectionalStreamEvent</dfn></h3>
<p>The <code><a>bidirectionalstream</a></code> event uses the
<code><a>BidirectionalStreamEvent</a></code> interface.</p>
<div>
<pre class="idl">
[ Constructor (DOMString type, BidirectionalStreamEventInit eventInitDict), Exposed=Window]
interface BidirectionalStreamEvent : Event {
readonly attribute RTCQuicBidirectionalStream stream;
};</pre>
<section>
<h2>Constructors</h2>
<dl data-link-for="BidirectionalStreamEvent" data-dfn-for="BidirectionalStreamEvent"
class="constructors">
<dt><code>BidirectionalStreamEvent</code></dt>
<dd>
<table class="parameters">
<tbody>
<tr>
<th>Parameter</th>
<th>Type</th>
<th>Nullable</th>
<th>Optional</th>
<th>Description</th>
</tr>
<tr>
<td class="prmName">type</td>
<td class="prmType"><code>DOMString</code></td>
<td class="prmNullFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmOptFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmDesc"></td>
</tr>
<tr>
<td class="prmName">eventInitDict</td>
<td class="prmType"><code><a>BidirectionalStreamEventInit</a></code></td>
<td class="prmNullFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmOptFalse"><span role="img" aria-label=
"False">✘</span></td>
<td class="prmDesc"></td>
</tr>
</tbody>
</table>
</dd>
</dl>
</section>
<section>
<h2>Attributes</h2>
<dl data-link-for="BidirectionalStreamEvent" data-dfn-for="BidirectionalStreamEvent"
class="attributes">
<dt><code>stream</code> of type <span class=
"idlAttrType"><a>RTCQuicBidirectionalStream</a></span>, readonly</dt>
<dd>
<p>The <dfn id="dom-bidirectionalquicstreamevent-stream"><code>stream</code></dfn>
attribute represents the <code><a>RTCQuicBidirectionalStream</a></code> object
associated with the event.</p>
</dd>
</dl>
</section>
</div>
<div>
<p>The <dfn><code>BidirectionalStreamEventInit</code></dfn> dictionary includes
information on the configuration of the QUIC stream.</p>
<pre class="idl">dictionary BidirectionalStreamEventInit : EventInit {
RTCQuicBidirectionalStream stream;
};</pre>
<section>
<h2>Dictionary BidirectionalStreamEventInit Members</h2>
<dl data-link-for="BidirectionalStreamEventInit" data-dfn-for=
"BidirectionalStreamEventInit" class="dictionary-members">
<dt><dfn><code>stream</code></dfn> of type <span class=
"idlMemberType"><a>RTCQuicBidirectionalStream</a></span></dt>
<dd>
<p>The <code><a>RTCQuicBidirectionalStream</a></code> object associated with the
event.</p>
</dd>
</dl>
</section>
</div>
</section>
<section id="rtcquicrole*">
<h3><dfn>RTCQuicRole</dfn> Enum</h3>
<p><code>RTCQuicRole</code> indicates the role of the QUIC
transport.</p>
<div>
<pre class="idl">enum RTCQuicRole {
"auto",
"client",
"server"
};</pre>
<table data-link-for="RTCQuicRole" data-dfn-for="RTCQuicRole" class="simple">
<tbody>
<tr>
<th colspan="2">Enumeration description</th>
</tr>
<tr>
<td><dfn><code id="idl-def-RTCQuicRole.auto">auto</code></dfn></td>
<td>
<p>The QUIC role is determined based on the resolved ICE role:
the ICE <code>controlled</code> role acts as the QUIC client and
the ICE <code>controlling</code> role acts as the QUIC server.</p>
</td>
</tr>
<tr>
<td><dfn><code id="idl-def-RTCQuicRole.client">client</code></dfn></td>
<td>
<p>The QUIC client role.</p>
</td>
</tr>
<tr>
<td><dfn><code id="idl-def-RTCQuicRole.server">server</code></dfn></td>
<td>
<p>The QUIC server role.</p>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="rtcquicroleinfo">
<h3>QUIC role determination</h3>
<p>To diagnose QUIC role issues, an application may wish to determine
the desired and actual QUIC role of an <code><a>RTCQuicTransport</a></code>.
For a browser implementing ORTC, a <code><a>RTCQuicTransport</a></code>
object assumes a QUIC role of <code>auto</code> upon construction.
This implies that the QUIC role is determined by the ICE role. Since
<code>getLocalParameters().role</code> always returns the role assigned
to an <code><a>RTCQuicTransport</a></code> object upon construction
(<code>auto</code> for a browser), the <code>getLocalParameters</code>
method cannot be used to determine the desired or actual role of an
<code><a>RTCQuicTransport</a></code>.</p>
<p>An application can determine the
desired role of an <code><a>RTCQuicTransport</a></code> from the value of
<code><var>remoteParameters</var>.role</code> passed to
<code><a>RTCQuicTransport</a>.start(<var>remoteParameters</var>)</code>.
If <code><var>remoteParameters</var>.role</code> is <code>server</code>
then the desired role of the <code><a>RTCQuicTransport</a></code>
is <code>client</code>. If <code><var>remoteParameters</var>.role</code>
is <code>client</code> then the desired role of the
<code><a>RTCQuicTransport</a></code> is <code>server</code>.</p>
<p>The <code>RTCQuicTransport.transport.onstatechange</code> EventHandler
can be used to determine whether an <code><a>RTCQuicTransport</a></code>
transitions to the desired role. When
<code><a>RTCQuicTransport</a>.transport.state</code> transitions to
<code>connected</code>, if <code><a>RTCQuicTransport</a>.transport.role</code>
is <code>controlled</code> then the role of the
<code><a>RTCQuicTransport</a></code> is <code>client</code>.
If <code><a>RTCQuicTransport</a>.transport.role</code>
is <code>controlling</code> then the role of the
<code><a>RTCQuicTransport</a></code> is <code>server</code>.</p>
</section>
<section id="rtcquictransportstate*">
<h3><dfn>RTCQuicTransportState</dfn> Enum</h3>
<p><code>RTCQuicTransportState</code> indicates the state of the QUIC
transport.</p>
<div>
<pre class="idl">enum RTCQuicTransportState {
"new",
"connecting",
"connected",
"closed",
"failed"
};</pre>
<table data-link-for="RTCQuicTransportState" data-dfn-for="RTCQuicTransportState"
class="simple">
<tbody>
<tr>
<th colspan="2">Enumeration description</th>
</tr>
<tr>
<td><dfn><code id="idl-def-RTCQuicTransportState.new">new</code></dfn></td>
<td>
<p>The <code><a>RTCQuicTransport</a></code> object has been created and
has not started negotiating yet.</p>
</td>
</tr>
<tr>
<td><dfn><code id=
"idl-def-RTCQuicTransportState.connecting">connecting</code></dfn></td>
<td>
<p>QUIC is in the process of negotiating a secure connection and
verifying the remote fingerprint. Once a secure connection is negotiated
(but prior to verification of the remote fingerprint, enabled by calling
<code>start()</code>), incoming data can flow through.</p>
</td>
</tr>
<tr>
<td><dfn><code id=
"idl-def-RTCQuicTransportState.connected">connected</code></dfn></td>
<td>
<p>QUIC has completed negotiation of a secure connection and verified the
remote fingerprint. Outgoing data and media can now flow through.</p>
</td>
</tr>
<tr>
<td><dfn><code id=
"idl-def-RTCQuicTransportState.closed">closed</code></dfn></td>
<td>
<p>The QUIC connection has been closed intentionally via a call to
<code>stop()</code> or receipt of a closing frame as described in
[[QUIC-TRANSPORT]]. When the <code><a>RTCQuicTransport</a></code>'s
internal <a>[[\QuicTransportState]]</a> slot transitions to
<code>closed</code> the user agent <em class="rfc2119" title="MUST">MUST</em>
run the following steps:</p>
<ol>
<li>Let <var>transport</var> be the <code><a>RTCQuicTransport</a></code>.
<li>For each <code><a>RTCQuicReadableStream</a></code> in <var>transport</var>'s
<a>[[\QuicTransportReadableStreams]]</a> internal slot run the
following:</li>
<ol>
<li>Let <var>stream</var> be the <code><a>RTCQuicReadableStream</a></code>.</li>
<li>Set <var>stream</var>'s <a>[[\Readable]]</a> slot to
<code>false</code>.</li>
<li>Clear the <var>stream</var>'s read buffer.</li>
<li>Remove the <var>stream</var> from the <var>transport</var>'s
<a>[[\QuicTransportReadableStreams]]</a> internal slot.
</ol>
<li>For each <code><a>RTCQuicWritableStream</a></code> in <var>transport</var>'s
<a>[[\QuicTransportWritableStreams]]</a> internal slot run the
following:</li>
<ol>
<li>Let <var>stream</var> be the <code><a>RTCQuicWritableStream</a></code>.</li>
<li>Set <var>stream</var>'s <a>[[\Writable]]</a> slot to
<code>false</code>.</li>
<li>Clear the <var>stream</var>'s write buffer.</li>
<li>Remove the <var>stream</var> from the <var>transport</var>'s
<a>[[\QuicTransportWritableStreams]]</a> internal slot.
</ol>
</ol>
</td>
</tr>
<tr>
<td><dfn><code id=
"idl-def-RTCQuicTransportState.failed">failed</code></dfn></td>
<td>
<p>The QUIC connection has been closed as the result of an error (such as
receipt of an error alert or a failure to validate the remote
fingerprint). When the <code><a>RTCQuicTransport</a></code>'s
internal <a>[[\QuicTransportState]]</a> slot transitions to
<code>failed</code> the user agent <em class="rfc2119" title="MUST">MUST</em>
run the following steps:</p>
<ol>
<li>Let <var>transport</var> be the <code><a>RTCQuicTransport</a></code>.
<li>For each <code><a>RTCQuicReadableStream</a></code> in <var>transport</var>'s
<a>[[\QuicTransportReadableStreams]]</a> internal slot run the
following:</li>
<ol>
<li>Let <var>stream</var> be the <code><a>RTCQuicReadableStream</a></code>.</li>
<li>Set <var>stream</var>'s <a>[[\Readable]]</a> slot to
<code>false</code>.</li>
<li>Clear the <var>stream</var>'s read buffer.</li>
<li>Remove the <var>stream</var> from the <var>transport</var>'s
<a>[[\QuicTransportReadableStreams]]</a> internal slot.
</ol>
<li>For each <code><a>RTCQuicWritableStream</a></code> in <var>transport</var>'s
<a>[[\QuicTransportWritableStreams]]</a> internal slot run the
following:</li>
<ol>
<li>Let <var>stream</var> be the <code><a>RTCQuicWritableStream</a></code>.</li>
<li>Set <var>stream</var>'s <a>[[\Writable]]</a> slot to
<code>false</code>.</li>
<li>Clear the <var>stream</var>'s write buffer.</li>
<li>Remove the <var>stream</var> from the <var>transport</var>'s
<a>[[\QuicTransportWritableStreams]]</a> internal slot.
</ol>
</ol>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="rtcquictransportstopinfo*">
<h3><dfn>RTCQuicTransportStopInfo</dfn> Dictionary</h3>
<p>The <code>RTCQuicTransportStopInfo</code> dictionary includes information
relating to the error code for stopping a <code><a>RTCQuicTransport</a></code>.
This information is used to set the error code and reason for an CONNECTION_CLOSE
frame.</p>
<div>
<pre class="idl">dictionary RTCQuicTransportStopInfo {
unsigned short errorCode = 0;
DOMString reason = "";
};
</pre>
<section>
<h2>Dictionary <a class="idlType">RTCQuicTransportStopInfo</a> Members</h2>
<dl data-link-for="RTCQuicTransportStopInfo" data-dfn-for="RTCQuicTransportStopInfo" class=
"dictionary-members">
<dt><dfn><code>errorCode</code></dfn> of type <span class=
"idlMemberType"><a>unsigned short</a></span>, defaulting to
<code>0</code>.</dt>
<dd>
<p>The error code used in CONNECTION_CLOSE frame.</p>
</dd>
<dt><dfn><code>reason</code></dfn> of type <span class=
"idlMemberType"><a>DOMString</a></span>, defaulting to <code>""</code></dt>
<dd>
<p>The reason for stopping the <code><a>RTCQuicTransport</a></code></p>
</dd>
</dl>
</section>
</div>
</section>
</section>
<section id="quicstream*">
<h2><dfn>QUIC Stream API</dfn></h2>
<p>The <code>QUIC Stream API</code> includes information relating
to a QUIC stream. </p>
<section id="rtcquicstream-overview*">
<h3>Overview</h3>
<p><code><a>RTCQuicBidirectionalStream</a></code>, <code><a>RTCQuicSendStream</a></code>,
and <code><a>RTCQuicReceiveStream</a></code> instances are associated to
a <code><a>RTCQuicTransport</a></code> instance.</p>
</section>
<section id="rtcquicstream-operation*">
<h3>Operation</h3>
<p>An <code><a>RTCQuicBidirectionalStream</a></code> can be created in the following ways:</p>
<ol>
<li>Using the <code><a>RTCQuicTransport</a></code>'s <code>createBidirectionalStream</code> method.</li>
<li>Getting a <code><a>bidirectionalstream</a></code> event on the
<code><a>RTCQuicTransport</a></code>.</li>
</ol>
<p>An <code><a>RTCQuicSendStream</a></code> can be created in the following ways:</p>
<ol>
<li>Using the <code><a>RTCQuicTransport</a></code>'s </code>createSendStream</code> method.</li>
</ol>
<p>An <code><a>RTCQuicReceiveStream</a></code> can be created in the following
ways:</p>
<ol>
<li>Getting a <code><a>receivestream</a></code> event on the
<code><a>RTCQuicTransport</a></code>.</li>
</ol>
</section>