socket/ws/frame.c
/* extract header fields and calculate offset */
extract header fields and calculate offset
extract header fields and calculate offset
void
WebsocketsFrame_parse_header(WebsocketsFrame* frame, char* raw)
{
	XDBG("Parse frame header");
	frame->payload_length = HeaderField_byte_value(WS_HDR_PAYLOAD_LENGTH, raw);
	frame->opcode = HeaderField_byte_value(WS_HDR_OPCODE, raw);
	frame->masked = HeaderField_byte_value(WS_HDR_MASKED, raw);
	frame->fin = HeaderField_byte_value(WS_HDR_FIN, raw);
	frame->rsv1 = HeaderField_byte_value(WS_HDR_RSV1, raw);
	frame->rsv2 = HeaderField_byte_value(WS_HDR_RSV2, raw);
	frame->rsv3 = HeaderField_byte_value(WS_HDR_RSV3, raw);
	frame->payload_offset = WebsocketsFrame_parse_offset(frame->payload_length, frame->masked);
	if (frame->payload_length <= PAYLOAD_MAX)
		frame->length = frame->payload_offset + frame->payload_length;
	WebsocketsFrame_log(frame);
}
void WebsocketsFrame_parse_header ( WebsocketsFrame * frame , char * raw ) { XDBG ( " " ) ; frame -> payload_length = HeaderField_byte_value ( WS_HDR_PAYLOAD_LENGTH , raw ) ; frame -> opcode = HeaderField_byte_value ( WS_HDR_OPCODE , raw ) ; frame -> masked = HeaderField_byte_value ( WS_HDR_MASKED , raw ) ; frame -> fin = HeaderField_byte_value ( WS_HDR_FIN , raw ) ; frame -> rsv1 = HeaderField_byte_value ( WS_HDR_RSV1 , raw ) ; frame -> rsv2 = HeaderField_byte_value ( WS_HDR_RSV2 , raw ) ; frame -> rsv3 = HeaderField_byte_value ( WS_HDR_RSV3 , raw ) ; frame -> payload_offset = WebsocketsFrame_parse_offset ( frame -> payload_length , frame -> masked ) ; if ( frame -> payload_length <= PAYLOAD_MAX ) frame -> length = frame -> payload_offset + frame -> payload_length ; WebsocketsFrame_log ( frame ) ; }
extract header fields and calculate offset
extract header fields and calculate offset