Browse Source

suppress inconsistent-missing-override warning message

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1687/head
R4SAS 3 years ago
parent
commit
f0c49b58fb
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 54
      libi2pd/TunnelConfig.h

54
libi2pd/TunnelConfig.h

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2020, The PurpleI2P Project * Copyright (c) 2013-2021, The PurpleI2P Project
* *
* This file is part of Purple i2pd project and licensed under BSD3 * This file is part of Purple i2pd project and licensed under BSD3
* *
@ -31,14 +31,14 @@ namespace tunnel
TunnelHopConfig * next, * prev; TunnelHopConfig * next, * prev;
int recordIndex; // record # in tunnel build message int recordIndex; // record # in tunnel build message
TunnelHopConfig (std::shared_ptr<const i2p::data::IdentityEx> r); TunnelHopConfig (std::shared_ptr<const i2p::data::IdentityEx> r);
virtual ~TunnelHopConfig () {}; virtual ~TunnelHopConfig () {};
void SetNextIdent (const i2p::data::IdentHash& ident); void SetNextIdent (const i2p::data::IdentHash& ident);
void SetReplyHop (uint32_t replyTunnelID, const i2p::data::IdentHash& replyIdent); void SetReplyHop (uint32_t replyTunnelID, const i2p::data::IdentHash& replyIdent);
void SetNext (TunnelHopConfig * n); void SetNext (TunnelHopConfig * n);
void SetPrev (TunnelHopConfig * p); void SetPrev (TunnelHopConfig * p);
virtual uint8_t GetRetCode (const uint8_t * records) const = 0; virtual uint8_t GetRetCode (const uint8_t * records) const = 0;
virtual void CreateBuildRequestRecord (uint8_t * records, uint32_t replyMsgID) = 0; virtual void CreateBuildRequestRecord (uint8_t * records, uint32_t replyMsgID) = 0;
@ -51,47 +51,47 @@ namespace tunnel
{ {
ElGamalTunnelHopConfig (std::shared_ptr<const i2p::data::IdentityEx> r): ElGamalTunnelHopConfig (std::shared_ptr<const i2p::data::IdentityEx> r):
TunnelHopConfig (r) {}; TunnelHopConfig (r) {};
uint8_t GetRetCode (const uint8_t * records) const uint8_t GetRetCode (const uint8_t * records) const
{ return (records + recordIndex*TUNNEL_BUILD_RECORD_SIZE)[BUILD_RESPONSE_RECORD_RET_OFFSET]; }; { return (records + recordIndex*TUNNEL_BUILD_RECORD_SIZE)[BUILD_RESPONSE_RECORD_RET_OFFSET]; };
void CreateBuildRequestRecord (uint8_t * records, uint32_t replyMsgID); void CreateBuildRequestRecord (uint8_t * records, uint32_t replyMsgID);
bool DecryptBuildResponseRecord (uint8_t * records) const; bool DecryptBuildResponseRecord (uint8_t * records) const;
}; };
struct ECIESTunnelHopConfig: public TunnelHopConfig, public i2p::crypto::NoiseSymmetricState struct ECIESTunnelHopConfig: public TunnelHopConfig, public i2p::crypto::NoiseSymmetricState
{ {
ECIESTunnelHopConfig (std::shared_ptr<const i2p::data::IdentityEx> r): ECIESTunnelHopConfig (std::shared_ptr<const i2p::data::IdentityEx> r):
TunnelHopConfig (r) {}; TunnelHopConfig (r) {};
void EncryptECIES (const uint8_t * clearText, size_t len, uint8_t * encrypted); void EncryptECIES (const uint8_t * clearText, size_t len, uint8_t * encrypted);
bool DecryptECIES (const uint8_t * key, const uint8_t * nonce, const uint8_t * encrypted, size_t len, uint8_t * clearText) const; bool DecryptECIES (const uint8_t * key, const uint8_t * nonce, const uint8_t * encrypted, size_t len, uint8_t * clearText) const;
}; };
struct LongECIESTunnelHopConfig: public ECIESTunnelHopConfig struct LongECIESTunnelHopConfig: public ECIESTunnelHopConfig
{ {
LongECIESTunnelHopConfig (std::shared_ptr<const i2p::data::IdentityEx> r): LongECIESTunnelHopConfig (std::shared_ptr<const i2p::data::IdentityEx> r):
ECIESTunnelHopConfig (r) {}; ECIESTunnelHopConfig (r) {};
uint8_t GetRetCode (const uint8_t * records) const uint8_t GetRetCode (const uint8_t * records) const override
{ return (records + recordIndex*TUNNEL_BUILD_RECORD_SIZE)[ECIES_BUILD_RESPONSE_RECORD_RET_OFFSET]; }; { return (records + recordIndex*TUNNEL_BUILD_RECORD_SIZE)[ECIES_BUILD_RESPONSE_RECORD_RET_OFFSET]; };
void CreateBuildRequestRecord (uint8_t * records, uint32_t replyMsgID); void CreateBuildRequestRecord (uint8_t * records, uint32_t replyMsgID) override;
bool DecryptBuildResponseRecord (uint8_t * records) const; bool DecryptBuildResponseRecord (uint8_t * records) const override;
}; };
struct ShortECIESTunnelHopConfig: public ECIESTunnelHopConfig struct ShortECIESTunnelHopConfig: public ECIESTunnelHopConfig
{ {
ShortECIESTunnelHopConfig (std::shared_ptr<const i2p::data::IdentityEx> r): ShortECIESTunnelHopConfig (std::shared_ptr<const i2p::data::IdentityEx> r):
ECIESTunnelHopConfig (r) {}; ECIESTunnelHopConfig (r) {};
uint8_t GetRetCode (const uint8_t * records) const uint8_t GetRetCode (const uint8_t * records) const override
{ return (records + recordIndex*SHORT_TUNNEL_BUILD_RECORD_SIZE)[SHORT_RESPONSE_RECORD_RET_OFFSET]; }; { return (records + recordIndex*SHORT_TUNNEL_BUILD_RECORD_SIZE)[SHORT_RESPONSE_RECORD_RET_OFFSET]; };
void CreateBuildRequestRecord (uint8_t * records, uint32_t replyMsgID); void CreateBuildRequestRecord (uint8_t * records, uint32_t replyMsgID) override;
bool DecryptBuildResponseRecord (uint8_t * records) const; bool DecryptBuildResponseRecord (uint8_t * records) const override;
void DecryptRecord (uint8_t * records, int index) const override; // Chacha20 void DecryptRecord (uint8_t * records, int index) const override; // Chacha20
uint64_t GetGarlicKey (uint8_t * key) const override; uint64_t GetGarlicKey (uint8_t * key) const override;
}; };
class TunnelConfig class TunnelConfig
{ {
public: public:
TunnelConfig (const std::vector<std::shared_ptr<const i2p::data::IdentityEx> >& peers, TunnelConfig (const std::vector<std::shared_ptr<const i2p::data::IdentityEx> >& peers,
bool isShort = false): // inbound bool isShort = false): // inbound
m_IsShort (isShort) m_IsShort (isShort)
{ {
@ -121,7 +121,7 @@ namespace tunnel
} }
bool IsShort () const { return m_IsShort; } bool IsShort () const { return m_IsShort; }
TunnelHopConfig * GetFirstHop () const TunnelHopConfig * GetFirstHop () const
{ {
return m_FirstHop; return m_FirstHop;
@ -203,12 +203,12 @@ namespace tunnel
if (m_IsShort) if (m_IsShort)
hop = new ShortECIESTunnelHopConfig (it); hop = new ShortECIESTunnelHopConfig (it);
else else
{ {
if (it->GetCryptoKeyType () == i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD) if (it->GetCryptoKeyType () == i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD)
hop = new LongECIESTunnelHopConfig (it); hop = new LongECIESTunnelHopConfig (it);
else else
hop = new ElGamalTunnelHopConfig (it); hop = new ElGamalTunnelHopConfig (it);
} }
if (prev) if (prev)
prev->SetNext (hop); prev->SetNext (hop);
else else

Loading…
Cancel
Save