summaryrefslogtreecommitdiffstats
path: root/netwerk/protocol/webtransport/nsIWebTransportStream.idl
blob: 8917807ba76230000c0d2d492bab15056d237309 (plain)
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
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIInputStreamCallback;
interface nsIEventTarget;

%{C++
namespace mozilla {
class TimeStamp;
}
%}

native TimeStamp(mozilla::TimeStamp);

[builtinclass, scriptable, uuid(ccc3e685-8411-48f0-8b3e-ff6d1fae4809)]
interface nsIWebTransportSendStreamStats : nsISupports {
  [noscript] readonly attribute TimeStamp timestamp;
  readonly attribute unsigned long long bytesSent;
  readonly attribute unsigned long long bytesAcknowledged;
};

[builtinclass, scriptable, uuid(43ce1145-30ef-41a7-b97d-fa797f7f7d18)]
interface nsIWebTransportReceiveStreamStats : nsISupports {
  [noscript] readonly attribute TimeStamp timestamp;
  readonly attribute unsigned long long bytesReceived;
};

[scriptable, uuid(9c1df3f5-bf04-46b6-9977-eb6389076db8)]
interface nsIWebTransportStreamStatsCallback : nsISupports {
  void onSendStatsAvailable(in nsIWebTransportSendStreamStats aStats);
  void onReceiveStatsAvailable(in nsIWebTransportReceiveStreamStats aStats);
};

[builtinclass, scriptable, uuid(d461b235-6291-4817-adcc-a2a3b3dfc10b)]
interface nsIWebTransportReceiveStream : nsISupports {
  // Sends the STOP_SENDING on the stream.
  void sendStopSending(in uint8_t aError);

  void getReceiveStreamStats(
    in nsIWebTransportStreamStatsCallback aCallback);

  void asyncWaitForRead(in nsIInputStreamCallback aCallback,
                        in unsigned long aFlags,
                        in unsigned long aRequestedCount,
                        in nsIEventTarget aEventTarget);
};

[builtinclass, scriptable, uuid(804f245c-52ea-403c-8a78-f751533bdd70)]
interface nsIWebTransportSendStream : nsISupports {
  // Sends the FIN on the stream.
  void sendFin();

  // Reset the stream with the specified error code.
  void reset(in uint8_t aErrorCode);

  void getSendStreamStats(in nsIWebTransportStreamStatsCallback aCallback);
};

[builtinclass, scriptable, uuid(f9ecb509-36db-4689-97d6-137639a08750)]
interface nsIWebTransportBidirectionalStream : nsISupports {
  // Sends the STOP_SENDING on the stream.
  void sendStopSending(in uint8_t aError);

  // Sends the FIN on the stream.
  void sendFin();

  // Reset the stream with the specified error code.
  void reset(in uint8_t aErrorCode);

  void asyncWaitForRead(in nsIInputStreamCallback aCallback,
                        in unsigned long aFlags,
                        in unsigned long aRequestedCount,
                        in nsIEventTarget aEventTarget);
};