Lines Matching refs:enc

492 static void ws_enc_info(struct ws_encoder *enc, struct Curl_easy *data,  in ws_enc_info()  argument
496 msg, ws_frame_name_of_op(enc->firstbyte), in ws_enc_info()
497 (enc->firstbyte & WSBIT_OPCODE_MASK) == WSBIT_OPCODE_CONT ? in ws_enc_info()
499 (enc->firstbyte & WSBIT_FIN) ? "" : " NON-FIN", in ws_enc_info()
500 enc->payload_len - enc->payload_remain, enc->payload_len); in ws_enc_info()
503 static void ws_enc_reset(struct ws_encoder *enc) in ws_enc_reset() argument
505 enc->payload_remain = 0; in ws_enc_reset()
506 enc->xori = 0; in ws_enc_reset()
507 enc->contfragment = FALSE; in ws_enc_reset()
510 static void ws_enc_init(struct ws_encoder *enc) in ws_enc_init() argument
512 ws_enc_reset(enc); in ws_enc_init()
539 struct ws_encoder *enc, in ws_enc_write_head() argument
558 if(enc->payload_remain > 0) { in ws_enc_write_head()
561 "remaining to be sent", (ssize_t)enc->payload_remain); in ws_enc_write_head()
574 if(!enc->contfragment) in ws_enc_write_head()
582 enc->contfragment = FALSE; in ws_enc_write_head()
584 else if(enc->contfragment) { in ws_enc_write_head()
591 enc->contfragment = TRUE; in ws_enc_write_head()
594 head[0] = enc->firstbyte = firstbyte; in ws_enc_write_head()
618 enc->payload_remain = enc->payload_len = payload_len; in ws_enc_write_head()
619 ws_enc_info(enc, data, "sending"); in ws_enc_write_head()
622 memcpy(&head[hlen], &enc->mask, 4); in ws_enc_write_head()
625 enc->xori = 0; in ws_enc_write_head()
639 static ssize_t ws_enc_write_payload(struct ws_encoder *enc, in ws_enc_write_payload() argument
654 if((curl_off_t)len > enc->payload_remain) in ws_enc_write_payload()
655 len = (size_t)enc->payload_remain; in ws_enc_write_payload()
658 unsigned char c = buf[i] ^ enc->mask[enc->xori]; in ws_enc_write_payload()
665 enc->xori++; in ws_enc_write_payload()
666 enc->xori &= 3; in ws_enc_write_payload()
668 enc->payload_remain -= (curl_off_t)i; in ws_enc_write_payload()
669 ws_enc_info(enc, data, "buffered"); in ws_enc_write_payload()
785 ws_enc_init(&ws->enc); in Curl_ws_accept()
790 ws_enc_reset(&ws->enc); in Curl_ws_accept()
813 result = Curl_rand(data, (unsigned char *)&ws->enc.mask, in Curl_ws_accept()
814 sizeof(ws->enc.mask)); in Curl_ws_accept()
818 ws->enc.mask[0], ws->enc.mask[1], ws->enc.mask[2], ws->enc.mask[3]); in Curl_ws_accept()
1189 n = ws_enc_write_head(data, &ws->enc, flags, fragsize, in curl_ws_send()
1195 if((curl_off_t)buflen > ws->enc.payload_remain) { in curl_ws_send()
1198 buflen, ws->enc.payload_remain); in curl_ws_send()
1202 else if(!ws->enc.payload_remain) { in curl_ws_send()
1203 n = ws_enc_write_head(data, &ws->enc, flags, (curl_off_t)buflen, in curl_ws_send()
1209 n = ws_enc_write_payload(&ws->enc, data, in curl_ws_send()
1226 n = ws_enc_write_payload(&ws->enc, data, in curl_ws_send()