aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_heartbeats.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-01 21:20:55 +0000
committerlloyd <[email protected]>2014-01-01 21:20:55 +0000
commit197dc467dec28a04c3b2f30da7cef122dfbb13e9 (patch)
treecdbd3ddaec051c72f0a757db461973d90c37b97a /src/tls/tls_heartbeats.cpp
parent62faac373c07cfe10bc8c309e89ebdd30d8e5eaa (diff)
Shuffle things around. Add NIST X.509 test to build.
Diffstat (limited to 'src/tls/tls_heartbeats.cpp')
-rw-r--r--src/tls/tls_heartbeats.cpp78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/tls/tls_heartbeats.cpp b/src/tls/tls_heartbeats.cpp
deleted file mode 100644
index 8c129858e..000000000
--- a/src/tls/tls_heartbeats.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-* TLS Heartbeats
-* (C) 2012 Jack Lloyd
-*
-* Released under the terms of the Botan license
-*/
-
-#include <botan/internal/tls_heartbeats.h>
-#include <botan/internal/tls_extensions.h>
-#include <botan/internal/tls_reader.h>
-#include <botan/tls_exceptn.h>
-
-namespace Botan {
-
-namespace TLS {
-
-Heartbeat_Message::Heartbeat_Message(const std::vector<byte>& buf)
- {
- TLS_Data_Reader reader(buf);
-
- const byte type = reader.get_byte();
-
- if(type != 1 && type != 2)
- throw TLS_Exception(Alert::ILLEGAL_PARAMETER,
- "Unknown heartbeat message type");
-
- m_type = static_cast<Type>(type);
-
- m_payload = reader.get_range<byte>(2, 0, 16*1024);
-
- // padding follows and is ignored
- }
-
-Heartbeat_Message::Heartbeat_Message(Type type,
- const byte payload[],
- size_t payload_len) :
- m_type(type),
- m_payload(payload, payload + payload_len)
- {
- }
-
-std::vector<byte> Heartbeat_Message::contents() const
- {
- std::vector<byte> send_buf(3 + m_payload.size() + 16);
- send_buf[0] = m_type;
- send_buf[1] = get_byte<u16bit>(0, m_payload.size());
- send_buf[2] = get_byte<u16bit>(1, m_payload.size());
- copy_mem(&send_buf[3], &m_payload[0], m_payload.size());
- // leave padding as all zeros
-
- return send_buf;
- }
-
-std::vector<byte> Heartbeat_Support_Indicator::serialize() const
- {
- std::vector<byte> heartbeat(1);
- heartbeat[0] = (m_peer_allowed_to_send ? 1 : 2);
- return heartbeat;
- }
-
-Heartbeat_Support_Indicator::Heartbeat_Support_Indicator(TLS_Data_Reader& reader,
- u16bit extension_size)
- {
- if(extension_size != 1)
- throw Decoding_Error("Strange size for heartbeat extension");
-
- const byte code = reader.get_byte();
-
- if(code != 1 && code != 2)
- throw TLS_Exception(Alert::ILLEGAL_PARAMETER,
- "Unknown heartbeat code " + std::to_string(code));
-
- m_peer_allowed_to_send = (code == 1);
- }
-
-}
-
-}