diff options
author | lloyd <[email protected]> | 2012-09-04 21:12:29 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-09-04 21:12:29 +0000 |
commit | 1141af65915a10910fec5f00afc9a83cf89685c6 (patch) | |
tree | 799d95d3b3a538e2193b29d570d619a497add079 /src/tls/tls_alert.cpp | |
parent | fdcf9fb3dd5fc850cbbbdb94163af0d395ffabaf (diff) |
Remove Record_Writer::send_alert. Move Alert serialization to Alert::serialize
Diffstat (limited to 'src/tls/tls_alert.cpp')
-rw-r--r-- | src/tls/tls_alert.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/tls/tls_alert.cpp b/src/tls/tls_alert.cpp index 5bc2e7484..540fdd838 100644 --- a/src/tls/tls_alert.cpp +++ b/src/tls/tls_alert.cpp @@ -18,8 +18,8 @@ Alert::Alert(const std::vector<byte>& buf) throw Decoding_Error("Alert: Bad size " + std::to_string(buf.size()) + " for alert message"); - if(buf[0] == 1) fatal = false; - else if(buf[0] == 2) fatal = true; + if(buf[0] == 1) m_fatal = false; + else if(buf[0] == 2) m_fatal = true; else throw Decoding_Error("Alert: Bad code for alert level"); @@ -32,7 +32,15 @@ Alert::Alert(const std::vector<byte>& buf) if(dc == 255) throw Internal_Error("Alert: description code 255, rejecting"); - type_code = static_cast<Type>(dc); + m_type_code = static_cast<Type>(dc); + } + +std::vector<byte> Alert::serialize() const + { + std::vector<byte> alert(2); + alert[0] = static_cast<byte>(is_fatal() ? 2 : 1); + alert[1] = static_cast<byte>(type()); + return alert; } std::string Alert::type_string() const |