dtls_handshake.hpp
Go to the documentation of this file.
1 #ifndef DTLS_HANDSHAKE_HPP
2 #define DTLS_HANDSHAKE_HPP
3 
4 #include "dtls.hpp"
5 
6 namespace DTLS {
7 
8 namespace Handshake {
9 struct HandshakeType {
10  static constexpr uint8_t helloRequest = 0;
11  static constexpr uint8_t clientHello = 1;
12  static constexpr uint8_t serverHello = 2;
13  static constexpr uint8_t certificate = 11;
14  static constexpr uint8_t serverKeyExchange = 12;
15  static constexpr uint8_t certificateRequest = 13;
16  static constexpr uint8_t serverHelloDone = 14;
17  static constexpr uint8_t certificateVerify = 15;
18  static constexpr uint8_t clientKeyExchange = 16;
19  static constexpr uint8_t finished = 20;
20 
21  uint8_t val;
22 
32  void setFinished() { val = finished; };
33 
34  bool isHelloRequest() { return val == helloRequest; };
35  bool isClientHello() { return val == clientHello; };
36  bool isServerHello() { return val == serverHello; };
37  bool isCertificate() { return val == certificate; };
38  bool isServerKeyExchange() { return val == serverKeyExchange; };
40  bool isServerHelloDone() { return val == serverHelloDone; };
41  bool isCertificateVerify() { return val == certificateVerify; };
42  bool isClientKeyExchange() { return val == clientKeyExchange; };
43  bool isFinished() { return val == finished; };
44 };
45 
46 struct Header {
49  uint16_t messageSeq;
52 };
53 
54 namespace Hello {};
55 namespace Certificate {};
56 namespace KeyExchange {};
57 namespace Finished {};
58 
59 }; // namespace Handshake
60 
61 }; // namespace DTLS
62 
63 #endif /* DTLS_HANDSHAKE_HPP */
static constexpr uint8_t certificateRequest
Definition: dtls.hpp:7
static constexpr uint8_t clientKeyExchange
static constexpr uint8_t clientHello
static constexpr uint8_t certificateVerify
static constexpr uint8_t serverHello
This is a 24 bit variable.
Definition: common.hpp:83
static constexpr uint8_t certificate
static constexpr uint8_t helloRequest
static constexpr uint8_t finished
static constexpr uint8_t serverHelloDone
static constexpr uint8_t serverKeyExchange