1
0
Fork 0
mirror of https://gitee.com/fantix/kloop.git synced 2024-05-19 08:48:07 +00:00
kloop/src/kloop/tls.pxd
Fantix King 74f0062154
Barely working TLS client!
Refs #I5ANZH
2022-06-26 11:48:49 -04:00

59 lines
1.4 KiB
Cython

# Copyright (c) 2022 Fantix King https://fantix.pro
# kLoop is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
from cpython cimport PyObject
from .includes cimport libc
from .includes.openssl cimport bio
from .loop cimport KLoopImpl, Loop, RingCallback
cdef struct Proxy:
PyObject* transport
libc.iovec send_vec
libc.msghdr send_msg
RingCallback send_callback
libc.iovec recv_vec
libc.msghdr recv_msg
RingCallback recv_callback
unsigned char flags
char* read_buffer
Loop* loop
int fd
cdef enum State:
UNWRAPPED
HANDSHAKING
WRAPPED
WRAPPED_KTLS
cdef class TLSTransport:
cdef:
KLoopImpl loop
int fd
bio.BIO* bio
object protocol
object sslctx
object sslobj
object waiter
Proxy proxy
State state
object write_buffer
bint sending
cdef do_handshake(self)
cdef do_read(self)
cdef do_read_ktls(self)
cdef write_cb(self, int res)
cdef read_cb(self, int res)