Introduce a DTLS_RECORD_LAYER type for DTLS record layer state

Reviewed-by: Richard Levitte <levitte@openssl.org>
diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c
index ad6561c..7179258 100644
--- a/ssl/d1_lib.c
+++ b/ssl/d1_lib.c
@@ -131,6 +131,12 @@
         return (0);
     }
     memset(d1, 0, sizeof *d1);
+    
+    if(!DTLS_RECORD_LAYER_new(&s->rlayer)) {
+        OPENSSL_free(d1);
+        ssl3_free(s);
+        return 0;
+    }
 
     /* d1->handshake_epoch=0; */
 
@@ -218,6 +224,8 @@
 
 void dtls1_free(SSL *s)
 {
+    DTLS_RECORD_LAYER_free(&s->rlayer);
+
     ssl3_free(s);
 
     dtls1_clear_queues(s);
@@ -242,6 +250,8 @@
     unsigned int mtu;
     unsigned int link_mtu;
 
+    DTLS_RECORD_LAYER_clear(&s->rlayer);
+
     if (s->d1) {
         unprocessed_rcds = s->d1->unprocessed_rcds.q;
         processed_rcds = s->d1->processed_rcds.q;