diff options
author | lloyd <[email protected]> | 2010-03-23 22:12:53 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-23 22:12:53 +0000 |
commit | 7479e66bb43e843c067e9a45145bafc84bdd41dc (patch) | |
tree | dcbd947508ab3bd8182816677d7d0d94edbf84c6 /src/ssl/tls_record.h | |
parent | 8fda37bf5b79bf6569e1e375c48e9d74171cb141 (diff) |
Make Record_Reader event driven. Callers (eg TLS_Client and
TLS_Server) are not; they instead loop blocking on the socket. Will
move the event-driven behavior upwards as I go.
Diffstat (limited to 'src/ssl/tls_record.h')
-rw-r--r-- | src/ssl/tls_record.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/ssl/tls_record.h b/src/ssl/tls_record.h index 3bec2e8ef..fa6ed2d17 100644 --- a/src/ssl/tls_record.h +++ b/src/ssl/tls_record.h @@ -1,6 +1,6 @@ /** -* TLS Record Handling -* (C) 2004-2006 Jack Lloyd +* TLS Record Handling +* (C) 2004-2010 Jack Lloyd * * Released under the terms of the Botan license */ @@ -12,6 +12,7 @@ #include <botan/socket.h> #include <botan/tls_suites.h> #include <botan/pipe.h> +#include <botan/secqueue.h> #include <vector> namespace Botan { @@ -55,18 +56,32 @@ class BOTAN_DLL Record_Writer class BOTAN_DLL Record_Reader { public: - SecureVector<byte> get_record(byte&); + void add_input(const byte input[], u32bit input_size); - void set_keys(const CipherSuite&, const SessionKeys&, Connection_Side); - void set_compressor(Filter*); + /** + * @param msg_type (output variable) + * @param buffer (output variable) + * @return Number of bytes still needed (minimum), or 0 if success + */ + u32bit get_record(byte& msg_type, + MemoryRegion<byte>& buffer); - void set_version(Version_Code); + SecureVector<byte> get_record(byte& msg_type); + + void set_keys(const CipherSuite& suite, + const SessionKeys& keys, + Connection_Side side); + + void set_compressor(Filter* compressor); + + void set_version(Version_Code version); void reset(); - Record_Reader(Socket&); + Record_Reader() { reset(); } private: - Socket& socket; + SecureQueue input_queue; + Pipe compress, cipher, mac; u32bit pad_amount, mac_size; u64bit seq_no; |