aboutsummaryrefslogtreecommitdiffstats
path: root/src/ssl/tls_record.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-01-11 22:57:21 +0000
committerlloyd <[email protected]>2010-01-11 22:57:21 +0000
commita4124ddf481bfc56859007b34dea646ecb7f8a25 (patch)
treefd842d8a091c5c529d6c32cd300bc195519ceb46 /src/ssl/tls_record.h
parentf5fd85b0ea6a5a6975d595130e029f94fddae9a4 (diff)
Import latest version of Ajisai into src/ssl; once this hits mainline
I'll officially kill off Ajisai (instead of it just lingering as a zombine as it is currently). Apparently I broke something (or multiple things) during the import process; servers crash and clients gets MAC errors on connect.
Diffstat (limited to 'src/ssl/tls_record.h')
-rw-r--r--src/ssl/tls_record.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/ssl/tls_record.h b/src/ssl/tls_record.h
new file mode 100644
index 000000000..b362d3fb7
--- /dev/null
+++ b/src/ssl/tls_record.h
@@ -0,0 +1,79 @@
+/**
+* TLS Record Handling Header File
+* (C) 2004-2006 Jack Lloyd
+*
+* Released under the terms of the Botan license
+*/
+
+#ifndef BOTAN_RECORDS_H__
+#define BOTAN_RECORDS_H__
+
+#include <botan/tls_session_key.h>
+#include <botan/tls_suites.h>
+#include <botan/socket.h>
+#include <botan/pipe.h>
+#include <vector>
+
+namespace Botan {
+
+/**
+* TLS Record Writer
+*/
+class BOTAN_DLL Record_Writer
+ {
+ public:
+ void send(byte, const byte[], u32bit);
+ void send(byte, byte);
+ void flush();
+
+ void alert(Alert_Level, Alert_Type);
+
+ void set_keys(const CipherSuite&, const SessionKeys&, Connection_Side);
+ void set_compressor(Filter*);
+
+ void set_version(Version_Code);
+
+ void reset();
+
+ Record_Writer(Socket&);
+ private:
+ void send_record(byte, const byte[], u32bit);
+ void send_record(byte, byte, byte, const byte[], u32bit);
+
+ Socket& socket;
+ Pipe compress, cipher, mac;
+ SecureVector<byte> buffer;
+ u32bit pad_amount, mac_size, buf_pos;
+ u64bit seq_no;
+ byte major, minor, buf_type;
+ bool do_compress;
+ };
+
+/**
+* TLS Record Reader
+*/
+class BOTAN_DLL Record_Reader
+ {
+ public:
+ SecureVector<byte> get_record(byte&);
+
+ void set_keys(const CipherSuite&, const SessionKeys&, Connection_Side);
+ void set_compressor(Filter*);
+
+ void set_version(Version_Code);
+
+ void reset();
+
+ Record_Reader(Socket&);
+ private:
+ Socket& socket;
+ Pipe compress, cipher, mac;
+ u32bit pad_amount, mac_size;
+ u64bit seq_no;
+ byte major, minor;
+ bool do_compress;
+ };
+
+}
+
+#endif