Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
reader_c.pxd111 linesDownload Raw Back to _websocket
1import cython
2
3from .mask cimport _websocket_mask_cython as websocket_mask
4
5
6cdef unsigned int READ_HEADER
7cdef unsigned int READ_PAYLOAD_LENGTH
8cdef unsigned int READ_PAYLOAD_MASK
9cdef unsigned int READ_PAYLOAD
10
11cdef int OP_CODE_NOT_SET
12cdef int OP_CODE_CONTINUATION
13cdef int OP_CODE_TEXT
14cdef int OP_CODE_BINARY
15cdef int OP_CODE_CLOSE
16cdef int OP_CODE_PING
17cdef int OP_CODE_PONG
18
19cdef int COMPRESSED_NOT_SET
20cdef int COMPRESSED_FALSE
21cdef int COMPRESSED_TRUE
22
23cdef object UNPACK_LEN3
24cdef object UNPACK_CLOSE_CODE
25cdef object TUPLE_NEW
26
27cdef object WSMsgType
28cdef object WSMessage
29
30cdef object WS_MSG_TYPE_TEXT
31cdef object WS_MSG_TYPE_BINARY
32
33cdef set ALLOWED_CLOSE_CODES
34cdef set MESSAGE_TYPES_WITH_CONTENT
35
36cdef tuple EMPTY_FRAME
37cdef tuple EMPTY_FRAME_ERROR
38
39cdef class WebSocketDataQueue:
40
41    cdef unsigned int _size
42    cdef public object _protocol
43    cdef unsigned int _limit
44    cdef object _loop
45    cdef bint _eof
46    cdef object _waiter
47    cdef object _exception
48    cdef public object _buffer
49    cdef object _get_buffer
50    cdef object _put_buffer
51
52    cdef void _release_waiter(self)
53
54    cpdef void feed_data(self, object data, unsigned int size)
55
56    @cython.locals(size="unsigned int")
57    cdef _read_from_buffer(self)
58
59cdef class WebSocketReader:
60
61    cdef WebSocketDataQueue queue
62    cdef unsigned int _max_msg_size
63
64    cdef Exception _exc
65    cdef bytearray _partial
66    cdef unsigned int _state
67
68    cdef int _opcode
69    cdef bint _frame_fin
70    cdef int _frame_opcode
71    cdef list _payload_fragments
72    cdef Py_ssize_t _frame_payload_len
73
74    cdef bytes _tail
75    cdef bint _has_mask
76    cdef bytes _frame_mask
77    cdef Py_ssize_t _payload_bytes_to_read
78    cdef unsigned int _payload_len_flag
79    cdef int _compressed
80    cdef object _decompressobj
81    cdef bint _compress
82
83    cpdef tuple feed_data(self, object data)
84
85    @cython.locals(
86        is_continuation=bint,
87        fin=bint,
88        has_partial=bint,
89        payload_merged=bytes,
90    )
91    cpdef void _handle_frame(self, bint fin, int opcode, object payload, int compressed) except *
92
93    @cython.locals(
94        start_pos=Py_ssize_t,
95        data_len=Py_ssize_t,
96        length=Py_ssize_t,
97        chunk_size=Py_ssize_t,
98        chunk_len=Py_ssize_t,
99        data_len=Py_ssize_t,
100        data_cstr="const unsigned char *",
101        first_byte="unsigned char",
102        second_byte="unsigned char",
103        f_start_pos=Py_ssize_t,
104        f_end_pos=Py_ssize_t,
105        has_mask=bint,
106        fin=bint,
107        had_fragments=Py_ssize_t,
108        payload_bytearray=bytearray,
109    )
110    cpdef void _feed_data(self, bytes data) except *
111 
codekingpro/portable-devtools · Team Ai