3 from collections import deque
4 from typing import Any, Callable, ClassVar
5 from typing_extensions import Literal
7 from . import constants, events, futures, protocols, transports
9 def _create_transport_context(server_side: bool, server_hostname: str | None) -> ssl.SSLContext: ...
11 _UNWRAPPED: Literal["UNWRAPPED"]
12 _DO_HANDSHAKE: Literal["DO_HANDSHAKE"]
13 _WRAPPED: Literal["WRAPPED"]
14 _SHUTDOWN: Literal["SHUTDOWN"]
18 max_size: ClassVar[int]
20 _context: ssl.SSLContext
22 _server_hostname: str | None
24 _incoming: ssl.MemoryBIO
25 _outgoing: ssl.MemoryBIO
26 _sslobj: ssl.SSLObject | None
28 _handshake_cb: Callable[[BaseException | None], None] | None
29 _shutdown_cb: Callable[[], None] | None
30 def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: str | None = ...) -> None: ...
32 def context(self) -> ssl.SSLContext: ...
34 def ssl_object(self) -> ssl.SSLObject | None: ...
36 def need_ssldata(self) -> bool: ...
38 def wrapped(self) -> bool: ...
39 def do_handshake(self, callback: Callable[[BaseException | None], None] | None = ...) -> list[bytes]: ...
40 def shutdown(self, callback: Callable[[], None] | None = ...) -> list[bytes]: ...
41 def feed_eof(self) -> None: ...
42 def feed_ssldata(self, data: bytes, only_handshake: bool = ...) -> tuple[list[bytes], list[bytes]]: ...
43 def feed_appdata(self, data: bytes, offset: int = ...) -> tuple[list[bytes], int]: ...
45 class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
47 _sendfile_compatible: ClassVar[constants._SendfileMode]
49 _loop: events.AbstractEventLoop
50 _ssl_protocol: SSLProtocol
52 def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ...
53 def get_extra_info(self, name: str, default: Any | None = ...) -> dict[str, Any]: ...
54 def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ...
55 def get_protocol(self) -> protocols.BaseProtocol: ...
56 def is_closing(self) -> bool: ...
57 def close(self) -> None: ...
58 if sys.version_info >= (3, 7):
59 def is_reading(self) -> bool: ...
60 def pause_reading(self) -> None: ...
61 def resume_reading(self) -> None: ...
62 def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ...
63 def get_write_buffer_size(self) -> int: ...
64 if sys.version_info >= (3, 7):
66 def _protocol_paused(self) -> bool: ...
67 def write(self, data: bytes) -> None: ...
68 def can_write_eof(self) -> Literal[False]: ...
69 def abort(self) -> None: ...
71 class SSLProtocol(protocols.Protocol):
74 _server_hostname: str | None
75 _sslcontext: ssl.SSLContext
76 _extra: dict[str, Any]
77 _write_backlog: deque[tuple[bytes, int]]
78 _write_buffer_size: int
79 _waiter: futures.Future[Any]
80 _loop: events.AbstractEventLoop
81 _app_transport: _SSLProtocolTransport
82 _sslpipe: _SSLPipe | None
83 _session_established: bool
86 _transport: transports.BaseTransport | None
87 _call_connection_made: bool
88 _ssl_handshake_timeout: int | None
89 _app_protocol: protocols.BaseProtocol
90 _app_protocol_is_buffer: bool
92 if sys.version_info >= (3, 7):
95 loop: events.AbstractEventLoop,
96 app_protocol: protocols.BaseProtocol,
97 sslcontext: ssl.SSLContext,
98 waiter: futures.Future[Any],
99 server_side: bool = ...,
100 server_hostname: str | None = ...,
101 call_connection_made: bool = ...,
102 ssl_handshake_timeout: int | None = ...,
107 loop: events.AbstractEventLoop,
108 app_protocol: protocols.BaseProtocol,
109 sslcontext: ssl.SSLContext,
110 waiter: futures.Future[Any],
111 server_side: bool = ...,
112 server_hostname: str | None = ...,
113 call_connection_made: bool = ...,
115 if sys.version_info >= (3, 7):
116 def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ...
117 def _wakeup_waiter(self, exc: BaseException | None = ...) -> None: ...
118 def connection_made(self, transport: transports.BaseTransport) -> None: ...
119 def connection_lost(self, exc: BaseException | None) -> None: ...
120 def pause_writing(self) -> None: ...
121 def resume_writing(self) -> None: ...
122 def data_received(self, data: bytes) -> None: ...
123 def eof_received(self) -> None: ...
124 def _get_extra_info(self, name: str, default: Any | None = ...) -> Any: ...
125 def _start_shutdown(self) -> None: ...
126 def _write_appdata(self, data: bytes) -> None: ...
127 def _start_handshake(self) -> None: ...
128 if sys.version_info >= (3, 7):
129 def _check_handshake_timeout(self) -> None: ...
130 def _on_handshake_complete(self, handshake_exc: BaseException | None) -> None: ...
131 def _process_write_backlog(self) -> None: ...
132 def _fatal_error(self, exc: BaseException, message: str = ...) -> None: ...
133 def _finalize(self) -> None: ...
134 def _abort(self) -> None: ...