Moved s3_pkt.c, s23_pkt.c and d1_pkt.c into the record layer.
[openssl.git] / ssl / record / rec_layer.h
index 3a04b170ee257e4f03acf74a12d3d1c3fdc17c11..e8dd3ff1f186f1391854f4bfc8a41202f5f5b45d 100644 (file)
 
 #include "../ssl_locl.h"
 
 
 #include "../ssl_locl.h"
 
+typedef struct dtls1_bitmap_st {
+    unsigned long map;          /* track 32 packets on 32-bit systems and 64
+                                 * - on 64-bit systems */
+    unsigned char max_seq_num[8]; /* max record number seen so far, 64-bit
+                                   * value in big-endian encoding */
+} DTLS1_BITMAP;
+
+
+typedef struct record_pqueue_st {
+    unsigned short epoch;
+    pqueue q;
+} record_pqueue;
+
 typedef struct record_layer_st {
     /* The parent SSL structure */
     SSL *s;
 typedef struct record_layer_st {
     /* The parent SSL structure */
     SSL *s;
@@ -125,6 +138,8 @@ typedef struct record_layer_st {
     SSL3_BUFFER wbuf;
     /* each decoded record goes in here */
     SSL3_RECORD rrec;
     SSL3_BUFFER wbuf;
     /* each decoded record goes in here */
     SSL3_RECORD rrec;
+    /* goes out from here */
+    SSL3_RECORD wrec;
 } RECORD_LAYER;
 
 #define RECORD_LAYER_set_ssl(rl, s)             ((rl)->s = (s))
 } RECORD_LAYER;
 
 #define RECORD_LAYER_set_ssl(rl, s)             ((rl)->s = (s))
@@ -133,3 +148,28 @@ typedef struct record_layer_st {
 #define RECORD_LAYER_get_rbuf(rl)               (&(rl)->rbuf)
 #define RECORD_LAYER_get_wbuf(rl)               (&(rl)->wbuf)
 #define RECORD_LAYER_get_rrec(rl)               (&(rl)->rrec)
 #define RECORD_LAYER_get_rbuf(rl)               (&(rl)->rbuf)
 #define RECORD_LAYER_get_wbuf(rl)               (&(rl)->wbuf)
 #define RECORD_LAYER_get_rrec(rl)               (&(rl)->rrec)
+#define RECORD_LAYER_get_wrec(rl)               (&(rl)->wrec)
+
+__owur int ssl23_read_bytes(SSL *s, int n);
+__owur int ssl23_write_bytes(SSL *s);
+__owur int ssl3_read_n(SSL *s, int n, int max, int extend);
+__owur int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
+__owur int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
+                         unsigned int len, int create_empty_fragment);
+__owur int ssl3_write_pending(SSL *s, int type, const unsigned char *buf,
+                       unsigned int len);
+__owur int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
+__owur int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
+int dtls1_write_bytes(SSL *s, int type, const void *buf, int len);
+__owur int do_dtls1_write(SSL *s, int type, const unsigned char *buf,
+                   unsigned int len, int create_empty_fragement);
+int dtls1_record_replay_check(SSL *s, DTLS1_BITMAP *bitmap);
+void dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap);
+DTLS1_BITMAP *dtls1_get_bitmap(SSL *s, SSL3_RECORD *rr,
+                                      unsigned int *is_next_epoch);
+int dtls1_process_buffered_records(SSL *s);
+int dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue);
+int dtls1_buffer_record(SSL *s, record_pqueue *q,
+                               unsigned char *priority);
+void dtls1_reset_seq_numbers(SSL *s, int rw);
+