SSLerr(SSL_F_SSL3_GET_MESSAGE,SSL_R_UNEXPECTED_MESSAGE);
SSLerr(SSL_F_DTLS1_GET_MESSAGE,SSL_R_UNEXPECTED_MESSAGE);
long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, 	int	*ok)	{	int i, al;	/* s3->tmp is used to store messages that are unexpected, caused	 * by the absence of an optional handshake message */	if (s->s3->tmp.reuse_message)		{		s->s3->tmp.reuse_message=0;		if ((mt >= 0) && (s->s3->tmp.message_type != mt))			{			al=SSL_AD_UNEXPECTED_MESSAGE;			SSLerr(SSL_F_SSL3_GET_MESSAGE,SSL_R_UNEXPECTED_MESSAGE);			goto f_err;			}		*ok=1;		s->init_msg = s->init_buf->data + DTLS1_HM_HEADER_LENGTH;		s->init_num = (int)s->s3->tmp.message_size;		return s->init_num;		}		do		{		if ( s->d1->r_msg_hdr.frag_off == 0)			{			/* s->d1->r_message_header.msg_len = 0; */			memset(&(s->d1->r_msg_hdr), 0x00, sizeof(struct hm_header_st));			}		i = dtls1_get_message_fragment(s, st1, stn, max, ok);		if ( i == DTLS1_HM_BAD_FRAGMENT ||            i == DTLS1_HM_FRAGMENT_RETRY)  /* bad fragment received */			continue;		else if ( i <= 0 && !*ok)			return i;		if (s->d1->r_msg_hdr.msg_len == s->init_num - DTLS1_HM_HEADER_LENGTH)			{			memset(&(s->d1->r_msg_hdr), 0x00, sizeof(struct hm_header_st));			s->d1->handshake_read_seq++;			/* we just read a handshake message from the other side:			 * this means that we don't need to retransmit of the			 * buffered messages.  			 * XDTLS: may be able clear out this			 * buffer a little sooner (i.e if an out-of-order			 * handshake message/record is received at the record			 * layer.  			 * XDTLS: exception is that the server needs to			 * know that change cipher spec and finished messages			 * have been received by the client before clearing this			 * buffer.  this can simply be done by waiting for the			 * first data  segment, but is there a better way?  */			dtls1_clear_record_buffer(s);            s->init_msg = s->init_buf->data + DTLS1_HM_HEADER_LENGTH;			return s->init_num - DTLS1_HM_HEADER_LENGTH;			}		else			s->d1->r_msg_hdr.frag_off = i;		} while(1) ;f_err:	ssl3_send_alert(s,SSL3_AL_FATAL,al);	*ok = 0;	return -1;	}