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 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-11-24 19:01:02 +01:00
|
|
|
preamble="unsigned char",
|
|
|
|
length_high="unsigned char",
|
|
|
|
maybe_msg_type="unsigned char"
|
2023-10-12 20:12:39 +02:00
|
|
|
)
|
2023-11-17 00:50:54 +01:00
|
|
|
cpdef data_received(self, object data)
|
2023-11-09 18:12:00 +01:00
|
|
|
|
2023-11-24 19:40:33 +01:00
|
|
|
cdef void _error_on_incorrect_preamble(self, object preamble)
|
2023-11-16 17:31:02 +01:00
|
|
|
|
|
|
|
@cython.locals(
|
|
|
|
type_="unsigned int",
|
|
|
|
data=bytes,
|
2023-11-18 22:10:40 +01:00
|
|
|
packet=tuple,
|
|
|
|
type_=object
|
2023-11-16 17:31:02 +01:00
|
|
|
)
|
2023-11-23 19:20:52 +01:00
|
|
|
cpdef write_packets(self, list packets, bint debug_enabled)
|