-
Notifications
You must be signed in to change notification settings - Fork 8
/
SRUP_Observed_Base.h
42 lines (31 loc) · 1.25 KB
/
SRUP_Observed_Base.h
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
34
35
36
37
38
39
40
41
42
//
// Created by AJ Poulter on 24/05/2018.
//
#ifndef SRUP_LIB_OBSERVED_BASE_H
#define SRUP_LIB_OBSERVED_BASE_H
#include "SRUP.h"
#include "SRUP_Crypto.h"
// This is the base-class for all of the "observed" join messages - which consist of the base-message fields, plus the
// encrypted value used to confirm identity.
// So in addition to the base-class; we add the encrypted data; and the associated methods.
// We also need to implement all the virtual functions to do with Serialization.
class SRUP_MSG_OBS_BASE : public SRUP_MSG
{
using SRUP_MSG::SRUP_MSG;
public:
//SRUP_MSG_OBS_BASE(const SRUP_MSG_OBS_BASE&) = delete;
~SRUP_MSG_OBS_BASE() override;
const uint8_t* encrypted_data(bool, char*);
bool encrypt_data(uint8_t*, uint16_t, bool, char*);
unsigned char* Serialized() override;
bool DeSerialize(const uint8_t *) override;
uint32_t SerializedLength() override;
protected:
// We'd ideally like the constructor to be virtual - but as we can't do that in C++ we'll make the constructor
// a protected method – that way you the compiler will prevent instantiation ...
SRUP_MSG_OBS_BASE();
bool Serialize(bool) override;
bool DataCheck() override;
SRUP_Crypto* m_crypto;
};
#endif //SRUP_LIB_OBSERVED_BASE_H