Lines Matching refs:ws

49 	if (wsi->ws->rx_draining_ext) {
63 wsi->ws->defeat_check_utf8 = 0;
65 switch (wsi->ws->ietf_spec_revision) {
67 wsi->ws->opcode = c & 0xf;
69 switch (wsi->ws->opcode) {
71 wsi->ws->rsv_first_msg = (c & 0x70);
78 wsi->ws->pmd_trailer_application = !!(c & 0x40);
80 wsi->ws->continuation_possible = 1;
81 wsi->ws->check_utf8 = lws_check_opt(
84 wsi->ws->utf8 = 0;
85 wsi->ws->first_fragment = 1;
88 wsi->ws->rsv_first_msg = (c & 0x70);
95 wsi->ws->pmd_trailer_application = !!(c & 0x40);
97 wsi->ws->check_utf8 = 0;
98 wsi->ws->continuation_possible = 1;
99 wsi->ws->first_fragment = 1;
102 if (!wsi->ws->continuation_possible) {
106 wsi->ws->first_fragment = 0;
109 wsi->ws->check_utf8 = 0;
110 wsi->ws->utf8 = 0;
125 wsi->ws->defeat_check_utf8 = 1;
128 wsi->ws->rsv = (c & 0x70);
132 !wsi->ws->count_act_ext &&
134 wsi->ws->rsv) {
138 wsi->ws->final = !!((c >> 7) & 1);
140 wsi->ws->final);
142 if (wsi->ws->owed_a_fin &&
143 (wsi->ws->opcode == LWSWSOPC_TEXT_FRAME ||
144 wsi->ws->opcode == LWSWSOPC_BINARY_FRAME)) {
148 if ((!(wsi->ws->opcode & 8)) && wsi->ws->final) {
149 wsi->ws->continuation_possible = 0;
150 wsi->ws->owed_a_fin = 0;
153 if ((wsi->ws->opcode & 8) && !wsi->ws->final) {
157 if (!wsi->ws->final)
158 wsi->ws->owed_a_fin = 1;
160 switch (wsi->ws->opcode) {
163 wsi->ws->frame_is_binary = wsi->ws->opcode ==
172 wsi->ws->ietf_spec_revision);
179 wsi->ws->this_frame_masked = !!(c & 0x80);
180 if (wsi->ws->this_frame_masked)
186 if (wsi->ws->opcode & 8)
192 if (wsi->ws->opcode & 8)
197 wsi->ws->rx_packet_length = c & 0x7f;
198 if (wsi->ws->this_frame_masked)
202 if (wsi->ws->rx_packet_length) {
215 wsi->ws->rx_packet_length = (size_t)((unsigned int)c << 8);
220 wsi->ws->rx_packet_length |= c;
221 if (wsi->ws->this_frame_masked)
224 if (wsi->ws->rx_packet_length)
241 wsi->ws->rx_packet_length = ((size_t)c) << 56;
243 wsi->ws->rx_packet_length = 0;
250 wsi->ws->rx_packet_length |= ((size_t)c) << 48;
257 wsi->ws->rx_packet_length |= ((size_t)c) << 40;
264 wsi->ws->rx_packet_length |= ((size_t)c) << 32;
270 wsi->ws->rx_packet_length |= ((size_t)c) << 24;
275 wsi->ws->rx_packet_length |= ((size_t)c) << 16;
280 wsi->ws->rx_packet_length |= ((size_t)c) << 8;
285 wsi->ws->rx_packet_length |= (size_t)c;
286 if (wsi->ws->this_frame_masked)
290 if (wsi->ws->rx_packet_length)
301 wsi->ws->mask[0] = c;
303 wsi->ws->all_zero_nonce = 0;
308 wsi->ws->mask[1] = c;
310 wsi->ws->all_zero_nonce = 0;
315 wsi->ws->mask[2] = c;
317 wsi->ws->all_zero_nonce = 0;
322 wsi->ws->mask[3] = c;
324 wsi->ws->all_zero_nonce = 0;
326 if (wsi->ws->rx_packet_length)
337 assert(wsi->ws->rx_ubuf);
339 if (wsi->ws->rx_draining_ext)
342 if (wsi->ws->this_frame_masked && !wsi->ws->all_zero_nonce)
343 c ^= wsi->ws->mask[(wsi->ws->mask_idx++) & 3];
350 wsi->ws->rx_ubuf[LWS_PRE + (wsi->ws->rx_ubuf_head++)] = c;
352 if (--wsi->ws->rx_packet_length == 0) {
364 wsi->ws->rx_ubuf_head != wsi->a.context->pt_serv_buf_size)
368 wsi->ws->rx_ubuf_head != wsi->a.protocol->rx_buffer_size)
383 switch (wsi->ws->opcode) {
385 pp = &wsi->ws->rx_ubuf[LWS_PRE];
388 wsi->ws->rx_ubuf_head > 2 &&
389 lws_check_utf8(&wsi->ws->utf8, pp + 2,
390 wsi->ws->rx_ubuf_head - 2))
404 (int)wsi->ws->rx_ubuf_head);
405 if (wsi->ws->rx_ubuf_head >= 2) {
421 wsi->ws->rx_ubuf_head))
424 memcpy(wsi->ws->ping_payload_buf + LWS_PRE, pp,
425 wsi->ws->rx_ubuf_head);
426 wsi->ws->close_in_ping_buffer_len =
427 (uint8_t)wsi->ws->rx_ubuf_head;
441 (int)wsi->ws->rx_ubuf_head);
444 if (wsi->ws->close_in_ping_buffer_len)
447 if (wsi->ws->pong_pending_flag) {
457 if (wsi->ws->rx_ubuf_head > 128 - 3) {
463 memcpy(wsi->ws->pong_payload_buf + LWS_PRE,
464 &wsi->ws->rx_ubuf[LWS_PRE],
465 wsi->ws->rx_ubuf_head);
467 wsi->ws->pong_payload_len = (uint8_t)wsi->ws->rx_ubuf_head;
468 wsi->ws->pong_pending_flag = 1;
473 wsi->ws->rx_ubuf_head = 0;
479 lwsl_hexdump_wsi_debug(wsi, &wsi->ws->rx_ubuf[LWS_PRE],
480 wsi->ws->rx_ubuf_head);
494 lwsl_wsi_ext(wsi, "Unhandled ext opc 0x%x", wsi->ws->opcode);
495 wsi->ws->rx_ubuf_head = 0;
517 pmdrx.eb_in.token = &wsi->ws->rx_ubuf[LWS_PRE];
518 pmdrx.eb_in.len = (int)wsi->ws->rx_ubuf_head;
525 (int)wsi->ws->rx_ubuf_head);
569 rx_draining_ext = wsi->ws->rx_draining_ext;
572 if (wsi->ws->check_utf8 && !wsi->ws->defeat_check_utf8) {
574 if (lws_check_utf8(&wsi->ws->utf8,
584 if (!wsi->ws->rx_packet_length &&
585 wsi->ws->final && wsi->ws->utf8
651 wsi->ws->first_fragment = 0;
653 lwsl_wsi_debug(wsi, "bulk ws rx: inp used %d, output %d",
654 (int)wsi->ws->rx_ubuf_head,
668 wsi->ws->rx_ubuf_head = 0;