2023-10-12 20:12:39 +02:00
|
|
|
import cython
|
|
|
|
|
2023-11-16 19:24:50 +01:00
|
|
|
from ..connection cimport APIConnection
|
2023-10-12 20:12:39 +02:00
|
|
|
from .base cimport APIFrameHelper
|
|
|
|
|
|
|
|
|
2023-10-13 03:17:46 +02:00
|
|
|
cdef bint TYPE_CHECKING
|
2023-10-12 20:12:39 +02:00
|
|
|
cdef object WRITE_EXCEPTIONS
|
|
|
|
cdef object bytes_to_varuint, varuint_to_bytes
|
|
|
|
|
2023-10-17 05:24:03 +02:00
|
|
|
cpdef _varuint_to_bytes(cython.int value)
|
|
|
|
|
|
|
|
@cython.locals(result=cython.int, bitpos=cython.int, val=cython.int)
|
|
|
|
cpdef _bytes_to_varuint(cython.bytes value)
|
|
|
|
|
2023-10-12 20:12:39 +02:00
|
|
|
cdef class APIPlaintextFrameHelper(APIFrameHelper):
|
|
|
|
|
|
|
|
@cython.locals(
|
|
|
|
msg_type=bytes,
|
|
|
|
length=bytes,
|
2023-10-13 03:17:46 +02:00
|
|
|
init_bytes=bytes,
|
|
|
|
add_length=bytes,
|
2023-10-12 20:12:39 +02:00
|
|
|
end_of_frame_pos=cython.uint,
|
|
|
|
length_int=cython.uint,
|
2023-10-20 02:00:36 +02:00
|
|
|
preamble=cython.uint,
|
|
|
|
length_high=cython.uint,
|
2023-10-12 20:12:39 +02:00
|
|
|
maybe_msg_type=cython.uint
|
|
|
|
)
|
2023-11-17 00:50:54 +01:00
|
|
|
cpdef data_received(self, object data)
|
2023-11-09 18:12:00 +01:00
|
|
|
|
2023-11-17 00:50:54 +01:00
|
|
|
cdef _error_on_incorrect_preamble(self, object preamble)
|
2023-11-16 17:31:02 +01:00
|
|
|
|
|
|
|
@cython.locals(
|
|
|
|
type_="unsigned int",
|
|
|
|
data=bytes,
|
|
|
|
packet=tuple
|
|
|
|
)
|
|
|
|
cpdef write_packets(self, list packets)
|