aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/session_ticket.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-03-22 13:59:09 +0000
committerlloyd <[email protected]>2012-03-22 13:59:09 +0000
commit3192ec3acfbf03a3b64a5aeb75e409db5adaaaf2 (patch)
tree16a96961fb891f87352e73789abb79da69aea4e4 /src/tls/session_ticket.cpp
parent2ed0f752f195a962f7c4d84ee40e2ecfe0928290 (diff)
Add missing source file for New_Session_Ticket msg
Diffstat (limited to 'src/tls/session_ticket.cpp')
-rw-r--r--src/tls/session_ticket.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/tls/session_ticket.cpp b/src/tls/session_ticket.cpp
new file mode 100644
index 000000000..8dceade28
--- /dev/null
+++ b/src/tls/session_ticket.cpp
@@ -0,0 +1,39 @@
+/*
+* Session Tickets
+* (C) 2012 Jack Lloyd
+*
+* Released under the terms of the Botan license
+*/
+
+#include <botan/internal/tls_messages.h>
+#include <botan/internal/tls_extensions.h>
+#include <botan/internal/tls_reader.h>
+#include <botan/tls_record.h>
+#include <botan/loadstor.h>
+
+namespace Botan {
+
+namespace TLS {
+
+New_Session_Ticket::New_Session_Ticket(const MemoryRegion<byte>& buf) :
+ m_ticket_lifetime_hint(0)
+ {
+ if(buf.size() >= 4)
+ {
+ m_ticket_lifetime_hint = load_be<u32bit>(&buf[0], 0);
+ m_ticket.resize(buf.size() - 4);
+ copy_mem(&m_ticket[0], &buf[4], buf.size() - 4);
+ }
+ }
+
+MemoryVector<byte> New_Session_Ticket::serialize() const
+ {
+ MemoryVector<byte> buf(4 + m_ticket.size());
+ store_be(m_ticket_lifetime_hint, &buf[0]);
+ copy_mem(&buf[4], &m_ticket[0], m_ticket.size());
+ return buf;
+ }
+
+}
+
+}