forked from w3c/p2p-webtransport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1386 lines (1386 loc) · 70.5 KB
/
index.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="webrtc.css" rel="stylesheet">
<title>QUIC API for WebRTC</title>
<script class="remove" src="respec-w3c-common.js" type="text/javascript"></script>
<script src="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 a protocol
specification developed by the IETF QUIC Working Group.</p>
</section>
<section id="sotd">
<p>The API is based on preliminary work done in the W3C ORTC Community Group.</p>
</section>
<section class="informative" id="intro">
<h2>Introduction</h2>
<p>This specification extends the WebRTC specification [[!WEBRTC]] 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]], 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. While the QUIC transport defined in [[!QUIC-TRANSPORT]] is reliable,
support for unreliable communications is achievable via use of timers or
through extensions to the QUIC protocol.</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 MUST 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]].</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 is associated to
one or more <code><a>RTCQuicStream</a></code> instances.</p>
<p class="note">The QUIC API presented in this and the subsequent
section represents a preliminary proposal based on work-in-progress
within the IETF QUIC WG. Since the QUIC protocol specification is still
in its early stages, both the protocol and API are likely to
change significantly going forward (such as changes to support
uni-directional streams).</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 a 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.
Approaches to multiplexing of QUIC with STUN, TURN, DTLS, RTP and RTCP
are described in [[QUIC-MULT]].</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, 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 ();
RTCQuicStream createStream ();
attribute EventHandler onstatechange;
attribute EventHandler onerror;
attribute EventHandler onquicstream;
};</pre>
<section>
<h2>Constructors</h2>
When the <code><a>RTCQuicTransport</a></code> constructor is invoked,
the user agent MUST run the following steps:
<ol>
<li>If the <code><a>RTCIceTransport</a></code> <var>transport</var>
provided in the first argument 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>If the <code>certificates</code> argument 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>.</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>[[\QuicTransportState]]</dfn> internal slot, initialized to
<code>"new"</code>.</li>
<li>Let <var>quictransport</var> have a <dfn>[[\Certificates]]</dfn> internal slot, initialized to
the <var>certificates</var> argument passed in the constructor.</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="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="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 MUST 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>onquicstream</code></dfn> of type <span class=
"idlAttrType"><a>EventHandler</a></span></dt>
<dd>
<p>This event handler, of event handler event type <code><a>quicstream</a></code>,
<em class="rfc2119" title="MUST">MUST</em> be fired on when a remote
<code><a>RTCQuicStream</a></code> is created.</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.
Calling <code>stop()</code> when <code>state</code> is <code>closed</code>
has no effect.</p>
<div>
<em>No parameters.</em>
</div>
<div>
<em>Return type:</em> <code>void</code>
</div>
</dd>
<dt><dfn><code>createStream</code></dfn></dt>
<dd>
<p>Creates an <code><a>RTCQuicStream</a></code> object.
Since [[QUIC-TRANSPORT]] only defines reliable QUIC streams,
<code>createStream</code> only supports creation of reliable
streams.</p>
<p>When <code>createStream</code> is called, the user agent MUST run the
following steps:</p>
<ol>
<li>Let <var>transport</var> be the <code><a>RTCQuicTransport</a></code>
on which <code>createStream</code> is invoked.</li>
<li>If <code><var>transport</var>.state</code> is <code>closed</code>
<a>throw</a> an <code>InvalidStateError</code>.</li>
<li>
<p>Let <var>stream</var> be a newly created
<code><a>RTCQuicStream</a></code> object.</p>
</li>
<li>
<p>Let <var>stream</var> have a <dfn>[[\QuicStreamState]]</dfn> internal
slot initialized to <code>new</code>.</p>
</li>
<li>
<p>Let <var>stream</var> have a <dfn>[[\Readable]]</dfn> internal
slot initialized to <code>false</code>.</p>
</li>
<li>
<p>Let <var>stream</var> have a <dfn>[[\Writable]]</dfn> internal
slot initialized to <code>false</code>.</p>
</li>
<li>
<p>Let <var>stream</var> have a <dfn>[[\MaxWriteBufferedAmount]]</dfn> internal
slot initialized to the maximum write buffer size.</p>
</li>
<li>
<p>Let <var>stream</var> have a <dfn>[[\MaxReadBufferedAmount]]</dfn> internal
slot initialized to the maximum read buffer size.</p>
</li>
<li>
<p>Let <var>stream</var> have a <dfn>[[\TargetReadBufferedAmount]]</dfn> internal
slot initialized to the maximum read buffer size.</p>
</li>
<li>
<p>Let <var>stream</var> have a <dfn>[[\WriteBufferedAmount]]</dfn> internal
slot initialized to zero.</p>
</li>
<li>
<p>Let <var>stream</var> have a <dfn>[[\ReadBufferedAmount]]</dfn> internal
slot initialized to zero.</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>RTCQuicStream</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>
<h3><dfn>RTCQuicStreamEvent</dfn></h3>
<p>The <code><a>quicstream</a></code> event uses the
<code><a>RTCQuicStreamEvent</a></code> interface.</p>
<p>Firing a <code><a>quicstream</a></code> event named <var>e</var> with a
<code><a>RTCQuicStream</a></code> <var>stream</var> means that an event with the
name <var>e</var>, which does not bubble (except where otherwise stated) and is not
cancelable (except where otherwise stated), and which uses the
<code><a>RTCQuicStreamEvent</a></code> interface with the <code>stream</code>
attribute set to <var>stream</var>, MUST be created and dispatched at the given target.</p>
<div>
<pre class="idl">
[ Constructor (DOMString type, RTCQuicStreamEventInit eventInitDict), Exposed=Window]
interface RTCQuicStreamEvent : Event {
readonly attribute RTCQuicStream stream;
};</pre>
<section>
<h2>Constructors</h2>
<dl data-link-for="RTCQuicStreamEvent" data-dfn-for="RTCQuicStreamEvent"
class="constructors">
<dt><code>RTCQuicStreamEvent</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>RTCQuicStreamEventInit</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="RTCQuicStreamEvent" data-dfn-for="RTCQuicStreamEvent"
class="attributes">
<dt><code>stream</code> of type <span class=
"idlAttrType"><a>RTCQuicStream</a></span>, readonly</dt>
<dd>
<p>The <dfn id="dom-quicstreamevent-stream"><code>stream</code></dfn>
attribute represents the <code><a>RTCQuicStream</a></code> object
associated with the event.</p>
</dd>
</dl>
</section>
</div>
<div>
<p>The <dfn><code>RTCQuicStreamEventInit</code></dfn> dictionary includes
information on the configuration of the QUIC stream.</p>
<pre class="idl">dictionary RTCQuicStreamEventInit : EventInit {
RTCQuicStream stream;
};</pre>
<section>
<h2>Dictionary RTCQuicStreamEventInit Members</h2>
<dl data-link-for="RTCQuicStreamEventInit" data-dfn-for=
"RTCQuicStreamEventInit" class="dictionary-members">
<dt><dfn><code>stream</code></dfn> of type <span class=
"idlMemberType"><a>RTCQuicStream</a></span></dt>
<dd>
<p>The <code><a>RTCQuicStream</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 close_notify alert. Calling
<code>transport.stop()</code> will also result in a transition to the
<code>closed</code> state.</p>
</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).</p>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</section>
<section id="quicstream*">
<h2><dfn>RTCQuicStream</dfn> Interface</h2>
<p>The <code>RTCQuicStream</code> includes information relating
to a QUIC stream. The RTCQuicStream provides a target read buffered
amount in the case that the application can't process incoming data
as fast as it is received. This allows the data to be buffered while
the application is busy, while not requiring the application to buffer
data indefinitely.</p>
<section id="rtcquicstream-overview*">
<h3>Overview</h3>
<p>An <code><a>RTCQuicStream</a></code> instance is associated to
an <code><a>RTCQuicTransport</a></code> instance.</p>
</section>
<section id="rtcquicstream-operation*">
<h3>Operation</h3>
<p>An <code><a>RTCQuicStream</a></code> instance is constructed
using the <code><a>RTCQuicTransport</a>.createStream</code> method.</p>
</section>
<section id="rtcquicstream-interface-definition*">
<h3>Interface Definition</h3>
<div>
<pre class="idl">
[ Exposed=Window ]
interface RTCQuicStream {
readonly attribute RTCQuicTransport transport;
readonly attribute RTCQuicStreamState state;
readonly attribute unsigned long readBufferedAmount;
readonly attribute unsigned long maxReadBufferedAmount;
readonly attribute unsigned long targetReadBufferedAmount;
readonly attribute unsigned long writeBufferedAmount;
readonly attribute unsigned long maxWriteBufferedAmount;
long readInto (Uint8Array data);
void write (Uint8Array data);
void finish ();
void reset ();
Promise<void> waitForReadable(unsigned long amount);
Promise<void> waitForWritable(unsigned long amount, optional unsigned long targetWriteBufferedAmount);
void setTargetReadBufferedAmount(unsigned long amount);
attribute EventHandler onstatechange;
};</pre>
<section>
<h2>Attributes</h2>
<dl data-link-for="RTCQuicStream" data-dfn-for="RTCQuicStream" class=
"attributes">
<dt><dfn><code>transport</code></dfn> of type <span class=
"idlAttrType"><a>RTCQuicTransport</a></span>, readonly</dt>
<dd>
<p>The readonly attribute referring to the related <code><a>RTCQuicTransport</a></code> object.</p>
</dd>
<dt><code>state</code> of type <span class=
"idlAttrType"><a>RTCQuicStreamState</a></span>, readonly</dt>
<dd>
<p>The <dfn id="dom-quicstream-state"><code>state</code></dfn>
attribute represents the state of the <a>RTCQuicStream</a> object.
On getting it <em class="rfc2119" title="MUST">MUST</em> return
the value of the <code><a>RTCQuicStream</a></code>'s
<a>[[\QuicStreamState]]</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 <code><a>RTCQuicStreamState</a></code>
changes.</p>
</dd>
<dt><code>readBufferedAmount</code> of type <span class="idlAttrType"><a>unsigned
long</a></span>, readonly</dt>
<dd>
<p>The <dfn id="dom-quicstream-readbufferedamount"><code>readBufferedAmount</code></dfn>
attribute represents the number of bytes buffered for access by
<code>readInto</code> but that, as of the last time the event loop
started executing a task, had not yet been read. This does not include
framing overhead incurred by the protocol, or buffers associated with
the network hardware. On getting, it <em class="rfc2119" title="MUST">MUST</em>
return the value of the <code><a>RTCQuicStream</a></code>'s
<a>[[\ReadBufferedAmount]]</a> internal slot.
If the <code><a>RTCQuicStream</a></code> is in the <code>closed</code> state,
this attribute's value will only decrease with each call to the
<code>readInto</code> method (the attribute does not reset to zero once the
<code><a>RTCQuicStream</a></code> closes).</p>
</dd>
<dt><code>maxReadBufferedAmount</code> of type <span class="idlAttrType"><a>unsigned
long</a></span>, readonly</dt>
<dd>
<p>The <dfn id="dom-quicstream-maxreadbufferedamount"><code>maxReadBufferedAmount</code></dfn>
attribute represents the maximum number of bytes that the implementation allows
to be buffered for access by <code>readInto</code>. On getting, it
<em class="rfc2119" title="MUST">MUST</em> return the value of the
<code><a>RTCQuicStream</a></code>'s <a>[[\MaxReadBufferedAmount]]</a> internal slot.</p>
</dd>
<dt><code>targetReadBufferedAmount</code> of type <span class="idlAttrType"><a>unsigned
long</a></span>, readonly</dt>
<dd>
<p>The
<dfn id="dom-quicstream-targetreadbufferedamount"><code>targetReadBufferedAmount</code></dfn>
attribute represents the target number of bytes in the read buffer, which enables control
of back-pressure on the sender when the target number of bytes is read. On getting,
it <em class="rfc2119" title="MUST">MUST</em> return the value of the
<code><a>RTCQuicStream</a></code>'s <a>[[\TargetReadBufferedAmount]]</a> internal slot.</p>
</dd>
<dt><code>writeBufferedAmount</code> of type <span class="idlAttrType"><a>unsigned
long</a></span>, readonly</dt>
<dd>
<p>The <dfn id="dom-quicstream-writebufferedamount"><code>writeBufferedAmount</code></dfn>
attribute represents the number of bytes of application data
that have been queued using <code>write</code> but that, as of the last
time the event loop started executing a task, had not yet been transmitted
to the network. This includes any data sent during the execution of the
current task, regardless of whether the <a>user agent</a> is able to
transmit text asynchronously with script execution. This does not
include framing overhead incurred by the protocol, or buffering done
by the operating system or network hardware. On getting, it
<em class="rfc2119" title="MUST">MUST</em> return the value of the
<code><a>RTCQuicStream</a></code>'s <a>[[\WriteBufferedAmount]]</a> internal slot.
If the <code><a>RTCQuicStream</a></code> is in the <code>closed</code>
state, this attribute's value will only increase with each call to the
<code>write</code> method (the attribute does not reset to zero once the
<code><a>RTCQuicStream</a></code> closes).</p>
</dd>
<dt><code>maxWriteBufferedAmount</code> of type <span class="idlAttrType"><a>unsigned
long</a></span>, readonly</dt>
<dd>
<p>The <dfn id="dom-quicstream-maxwritebufferedamount"><code>maxWriteBufferedAmount</code></dfn>
attribute represents the maximum number of bytes that the implementation allows
to be buffered by <code>write</code>. On getting, it <em class="rfc2119" title="MUST">MUST</em>
return the value of the <code><a>RTCQuicStream</a></code>'s
<a>[[\MaxWriteBufferedAmount]]</a> internal slot.</p>
</dd>
</dl>
</section>
<section>
<h2>Methods</h2>
<dl data-link-for="RTCQuicStream" data-dfn-for="RTCQuicStream" class=
"methods">
<dt><dfn><code>readInto</code></dfn></dt>
<dd>
<p>Reads from <code><a>RTCQuicStream</a></code> into the buffer specified
by the first argument and returns the number of bytes read; a negative
number indicates end-of-file. If there is no data to be read then
<code>readInto</code> returns zero. When the <code>readInto</code>
method is called, the user agent
<em class="rfc2119" title="MUST">MUST</em> run the following steps:</p>
<ol>
<li>Let <var>stream</var> be the <code><a>RTCQuicStream</a></code> object
on which <code>readInto</code> is invoked.</li>
<li>If <var>stream</var>'s <a>[[\Readable]]</a> slot is <code>false</code>,
<a>throw</a> an <code>InvalidStateError</code>, then abort these steps.</li>
<li>Let <var>data</var> be the first argument.</li>
<li>If <var>stream</var> has <a>finished reading</a> return
a negative number, set <var>stream</var>'s <a>[[\Readable]]</a> slot to
<code>false</code> and abort these steps.</li>
<li>Transfer data from the read buffer into <var>data</var>.</li>
<li>Decrease the value of <var>stream</var>'s <a>[[\ReadBufferedAmount]]</a>
slot by the length of <var>data</var> in bytes.</li>
<li>Return the length of <var>data</var> in bytes.</li>
</ol>
<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">data</td>
<td class="prmType"><code>Uint8Array</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>long</code>
</div>
</dd>
<dt><dfn><code>write</code></dfn></dt>
<dd>
<p>When the <code>write</code> method is called, the <a>user agent</a>
MUST run the following steps:</p>
<ol>
<li>Let <var>data</var> be the first argument.</li>
<li>Let <var>stream</var> be the <code><a>RTCQuicStream</a></code>
object on which <var>data</var> is to be sent.</li>
<li>If <var>stream</var>'s <a>[[\Writable]]</a> slot is <code>false</code>,
<a>throw</a> an <code>InvalidStateError</code> and abort these steps.</li>
<li>If the length of <var>data</var> added to <a>[[\WriteBufferedAmount]]</a>
exceeds <a>[[\MaxWriteBufferedAmount]]</a>, <a>throw</a> an
<code>OperationError</code> and abort these steps.</li>
<li>Increase the value of <var>stream</var>'s
<a>[[\WriteBufferedAmount]]</a> slot by the length of
<var>data</var> in bytes.</li>
<li>Queue <var>data</var> for transmission on <var>stream</var>'s
underlying data transport.
<div class="note">The actual transmission of data occurs in
parallel. If sending data leads to a QUIC-level error, the
application will be notified asynchronously through the
<code><a>RTCQuicTransport</a></code>'s <code><a>onerror</a></code>
EventHandler.</div></li>
</ol>
<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">data</td>
<td class="prmType"><code>Uint8Array</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>finish</code></dfn></dt>
<dd>
<p>Initiates the closing procedure for the
<code><a>RTCQuicStream</a></code>. It may be called
regardless of whether the <code><a>RTCQuicStream</a></code> object
was created by the local or remote peer. When the <code>finish()</code>
method is called, the user agent <em class="rfc2119" title="MUST">MUST</em>
run the following steps:</p>
<ol>
<li>Let <var>stream</var> be the <code><a>RTCQuicStream</a></code> object
which is about to be closed.</li>
<li>If <var>stream</var>'s <a>[[\QuicStreamState]]</a> is <code>new</code>,
set <var>stream</var>'s <a>[[\QuicStreamState]]</a> to <code>closed</code>,
and abort these steps.</li>
<li>If <var>stream</var>'s <a>[[\QuicStreamState]]</a> is <code>closed</code>,
then abort these steps.</li>
<li>Set <var>stream</var>'s <a>[[\Writable]]</a> slot to <code>false</code>.</li>
<li>Set <var>stream</var>'s <a>[[\QuicStreamState]]</a> slot to
<code>closing</code>.</li>
<li>If <var>stream</var> has <a>finished reading</a>, set
<var>stream</var>'s <a>[[\QuicStreamState]]</a> slot to
<code>closed</code>.</li>
<li>If the closing procedure has not started yet, start it by sending a STREAM
frame with the FIN bit set.</li>
</ol>
<div>
<em>No parameters.</em>
</div>
<div>
<em>Return type:</em> <code>void</code>
</div>
</dd>
<dt><dfn><code>reset</code></dfn></dt>
<dd>
<p>Resets the <code><a>RTCQuicStream</a></code>. It may be called
regardless of whether the <code><a>RTCQuicStream</a></code> object
was created by the local or remote peer. When the <code>reset()</code>
method is called, the user agent <em class="rfc2119" title="MUST">MUST</em>
run the following steps:</p>
<ol>
<li>Let <var>stream</var> be the <code><a>RTCQuicStream</a></code> object
which is about to be reset.</li>
<li>If <var>stream</var>'s <a>[[\QuicStreamState]]</a> is <code>new</code>,
set <var>stream</var>'s <a>[[\QuicStreamState]]</a> to <code>closed</code>,
and abort these steps.</li>
<li>If <var>stream</var>'s <a>[[\QuicStreamState]]</a> slot is <code>closed</code>,
then abort these steps.</li>
<li>Set <var>stream</var>'s <a>[[\Writable]]</a> and <a>[[\Readable]]</a>
slots to <code>false</code>.</li>
<li>Set <var>stream</var>'s <a>[[\QuicStreamState]]</a> slot to
<code>closing</code>.</li>
<li>If the <var>stream</var> has received a STREAM frame with the FIN bit set,
set <var>stream</var>'s <a>[[\QuicStreamState]]</a> slot to <code>closed</code>.</li>
<li>If the closing procedure has not started yet, start it by sending a RST_STREAM
frame.</li>
</ol>
<div>
<em>No parameters.</em>
</div>
<div>
<em>Return type:</em> <code>void</code>
</div>
</dd>
<dt><dfn><code>waitForReadable</code></dfn></dt>
<dd>
<p><code>waitForReadable</code> waits for data to become available, or
for the <code><a>RTCQuicStream</a></code> to be finished reading. It
<a>resolves</a> the promise when the data queued in the read buffer
increases above the amount provided as an argument or when a STREAM frame
with the FIN bit set has been received. If <code>waitForReadable</code>
is called multiple times, multiple promises could be resolved.
The Promise will be <a>rejected</a> with a newly created
<code>InvalidStateError</code> if the <var>stream</var>'s
<a>[[\Readable]]</a> slot transitions from true to false and the promise
isn't <a>settled</a>. When the <code>waitForReadable</code> method is
called, the <a>user agent</a> MUST run the following steps:</p>
<ol>
<li>Let <var>stream</var> be the <code><a>RTCQuicStream</a></code>
on which <code>waitForReadable</code> is invoked.</li>
<li>Let <var>p</var> be a new promise.</li>
<li>If <var>stream</var>'s <a>[[\Readable]]</a> slot is
<code>false</code>, <a>reject</a> <var>p</var> with a
newly created <code>InvalidStateError</code> and abort
these steps.</li>
<li>Let <var>amount</var> be the first argument.</li>
<li>If <var>amount</var> is larger than the value of
<var>stream</var>'s <a>[[\TargetReadBufferedAmount]]</a> slot,
<a>reject</a> <var>p</var> with a newly created