aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_version.cpp
blob: 82dce0be97a6339e2a9d6fe38e546c51749a2dcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* TLS Protocol Version Management
* (C) 2012 Jack Lloyd
*
* Released under the terms of the Botan license
*/

#include <botan/tls_version.h>
#include <botan/parsing.h>

namespace Botan {

namespace TLS {

std::string Protocol_Version::to_string() const
   {
   const byte maj = major_version();
   const byte min = minor_version();

   // Some very new or very old protocol?
   if(maj != 3)
      return "Protocol " + std::to_string(maj) + "." + std::to_string(min);

   if(maj == 3 && min == 0)
      return "SSL v3";

   // The TLS v1.[0123...] case
   return "TLS v1." + std::to_string(min-1);
   }

}

}