Debian Codegraph @

testing/web-platform/tests/tools/webtransport/h3/handler.py

raw
1 from typing import List, Optional, Tuple
2
3 from .webtransport_h3_server import WebTransportSession
4
5 # This file exists for documentation purpose.
6
7
8 def connect_received(request_headers: List[Tuple[bytes, bytes]],
9 response_headers: List[Tuple[bytes, bytes]]) -> None:
10 """
11 Called whenever an extended CONNECT method is received.
12
13 :param request_headers: The request headers received from the peer.
14 :param response_headers: The response headers which will be sent to the peer. ``:status`` is set
15 to 200 when it isn't specified.
16 """
17 pass
18
19
20 def session_established(session: WebTransportSession) -> None:
21 """
22 Called whenever an WebTransport session is established.
23
24 :param session: A WebTransport session object.
25 """
26
27
28 def stream_data_received(session: WebTransportSession, stream_id: int,
29 data: bytes, stream_ended: bool) -> None:
30 """
31 Called whenever data is received on a WebTransport stream.
32
33 :param session: A WebTransport session object.
34 :param stream_id: The ID of the stream.
35 :param data: The received data.
36 :param stream_ended: Whether the stream is ended.
37 """
38 pass
39
40
41 def datagram_received(session: WebTransportSession, data: bytes) -> None:
42 """
43 Called whenever a datagram is received on a WebTransport session.
44
45 :param session: A WebTransport session object.
46 :param data: The received data.
47 """
48 pass
49
50
51 def session_closed(session: WebTransportSession,
52 close_info: Optional[Tuple[int, bytes]],
53 abruptly: bool) -> None:
54 """
55 Called when a WebTransport session is closed.
56
57 :param session: A WebTransport session.
58 :param close_info: The code and reason attached to the
59 CLOSE_WEBTRANSPORT_SESSION capsule.
60 :param abruptly: True when the session is closed forcibly
61 (by a CLOSE_CONNECTION QUIC frame for example).
62 """
63 pass
64
65
66 def stream_reset(session: WebTransportSession,
67 stream_id: int,
68 error_code: int) -> None:
69 """
70 Called when a stream is reset with RESET_STREAM.
71
72 :param session: A WebTransport session.
73 :param stream_id: The ID of the stream.
74 :param error_code: The reason of the reset.
75 """
76 pass