Move buffered_app_data from s->d1 to s->rlayer.d
[openssl.git] / ssl / ssl_locl.h
index 323a00df1ef7b919d58aba19f4833bb3209103fd..4ee0ddd79c575528a0ebf91c77f3b6c1bb3fe4cf 100644 (file)
 # include <openssl/ssl.h>
 # include <openssl/symhacks.h>
 
+#include "record/dtls1_bitmap.h"
 #include "record/ssl3_buffer.h"
 #include "record/ssl3_record.h"
 #include "record/rec_layer.h"
@@ -1022,16 +1023,12 @@ struct ssl_st {
     int shutdown;
     /* where we are */
     int state;
-    /* where we are when reading */
-    int rstate;
     BUF_MEM *init_buf;          /* buffer used during init */
     void *init_msg;             /* pointer to handshake message body, set by
                                  * ssl3_get_message() */
     int init_num;               /* amount read/written */
     int init_off;               /* amount read/written */
-    /* used internally to point at a raw packet */
-    unsigned char *packet;
-    unsigned int packet_length;
+
     struct ssl3_state_st *s3;   /* SSLv3 variables */
     struct dtls1_state_st *d1;  /* DTLSv1 variables */
 
@@ -1228,10 +1225,8 @@ struct ssl_st {
 typedef struct ssl3_state_st {
     long flags;
     int delay_buf_pop_ret;
-    unsigned char read_sequence[8];
     int read_mac_secret_size;
     unsigned char read_mac_secret[EVP_MAX_MD_SIZE];
-    unsigned char write_sequence[8];
     int write_mac_secret_size;
     unsigned char write_mac_secret[EVP_MAX_MD_SIZE];
     unsigned char server_random[SSL3_RANDOM_SIZE];
@@ -1241,20 +1236,6 @@ typedef struct ssl3_state_st {
     int empty_fragment_done;
     /* The value of 'extra' when the buffers were initialized */
     int init_extra;
-    /*
-     * storage for Alert/Handshake protocol data received but not yet
-     * processed by ssl3_read_bytes:
-     */
-    unsigned char alert_fragment[2];
-    unsigned int alert_fragment_len;
-    unsigned char handshake_fragment[4];
-    unsigned int handshake_fragment_len;
-    /* partial write - check the numbers match */
-    unsigned int wnum;          /* number of bytes sent so far */
-    int wpend_tot;              /* number bytes written */
-    int wpend_type;
-    int wpend_ret;              /* number of bytes submitted */
-    const unsigned char *wpend_buf;
     /* used during startup, digest all incoming/outgoing packets */
     BIO *handshake_buffer;
     /*
@@ -1423,36 +1404,18 @@ typedef struct dtls1_state_st {
     unsigned char cookie[DTLS1_COOKIE_LENGTH];
     unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];
     unsigned int cookie_len;
-    /*
-     * The current data and handshake epoch.  This is initially
-     * undefined, and starts at zero once the initial handshake is
-     * completed
-     */
-    unsigned short r_epoch;
-    unsigned short w_epoch;
-    /* records being received in the current epoch */
-    DTLS1_BITMAP bitmap;
-    /* renegotiation starts a new set of sequence numbers */
-    DTLS1_BITMAP next_bitmap;
+
     /* handshake message numbers */
     unsigned short handshake_write_seq;
     unsigned short next_handshake_write_seq;
     unsigned short handshake_read_seq;
     /* save last sequence number for retransmissions */
     unsigned char last_write_sequence[8];
-    /* Received handshake records (processed and unprocessed) */
-    record_pqueue unprocessed_rcds;
-    record_pqueue processed_rcds;
     /* Buffered handshake messages */
     pqueue buffered_messages;
     /* Buffered (sent) handshake records */
     pqueue sent_messages;
-    /*
-     * Buffered application records. Only for records between CCS and
-     * Finished to prevent either protocol violation or unnecessary message
-     * loss.
-     */
-    record_pqueue buffered_app_data;
+
     /* Is set when listening for new connections with dtls1_listen() */
     unsigned int listen;
     unsigned int link_mtu;      /* max on-the-wire DTLS packet size */
@@ -1466,14 +1429,7 @@ typedef struct dtls1_state_st {
     struct timeval next_timeout;
     /* Timeout duration */
     unsigned short timeout_duration;
-    /*
-     * storage for Alert/Handshake protocol data received but not yet
-     * processed by ssl3_read_bytes:
-     */
-    unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH];
-    unsigned int alert_fragment_len;
-    unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];
-    unsigned int handshake_fragment_len;
+
     unsigned int retransmitting;
     /*
      * Set when the handshake is ready to process peer's ChangeCipherSpec message.
@@ -1487,15 +1443,6 @@ typedef struct dtls1_state_st {
 #  endif
 } DTLS1_STATE;
 
-typedef struct dtls1_record_data_st {
-    unsigned char *packet;
-    unsigned int packet_length;
-    SSL3_BUFFER rbuf;
-    SSL3_RECORD rrec;
-#  ifndef OPENSSL_NO_SCTP
-    struct bio_dgram_sctp_rcvinfo recordinfo;
-#  endif
-} DTLS1_RECORD_DATA;
 
 
 # ifndef OPENSSL_NO_EC
@@ -1979,8 +1926,10 @@ const SSL_METHOD *func_name(void)  \
 struct openssl_ssl_test_functions {
     int (*p_ssl_init_wbio_buffer) (SSL *s, int push);
     int (*p_ssl3_setup_buffers) (SSL *s);
-    int (*p_tls1_process_heartbeat) (SSL *s);
-    int (*p_dtls1_process_heartbeat) (SSL *s);
+    int (*p_tls1_process_heartbeat) (SSL *s,
+        unsigned char *p, unsigned int length);
+    int (*p_dtls1_process_heartbeat) (SSL *s,
+        unsigned char *p, unsigned int length);
 };
 
 # ifndef OPENSSL_UNIT_TEST
@@ -2267,8 +2216,8 @@ __owur int ssl_prepare_serverhello_tlsext(SSL *s);
 #   ifndef OPENSSL_NO_HEARTBEATS
 __owur int tls1_heartbeat(SSL *s);
 __owur int dtls1_heartbeat(SSL *s);
-__owur int tls1_process_heartbeat(SSL *s);
-__owur int dtls1_process_heartbeat(SSL *s);
+__owur int tls1_process_heartbeat(SSL *s, unsigned char *p, unsigned int length);
+__owur int dtls1_process_heartbeat(SSL *s, unsigned char *p, unsigned int length);
 #   endif
 
 __owur int tls1_process_ticket(SSL *s, unsigned char *session_id, int len,