Browse Source

Merge pull request #70 from cpubug/master

fix CMAKE build
pull/72/head
orignal 10 years ago
parent
commit
d0712423a3
  1. 6
      Identity.cpp
  2. 6
      Identity.h
  3. 10
      Streaming.cpp
  4. 12
      build/CMakeLists.txt

6
Identity.cpp

@ -40,6 +40,12 @@ namespace data
return *this; return *this;
} }
bool IdentHash::FromBase32(const std::string& s)
{
size_t count = Base32ToByteStream(s.c_str(), s.length(), m_Hash, sizeof(m_Hash));
return count == sizeof(m_Hash);
}
Keys CreateRandomKeys () Keys CreateRandomKeys ()
{ {
Keys keys; Keys keys;

6
Identity.h

@ -73,7 +73,9 @@ namespace data
bool operator== (const IdentHash& other) const { return !memcmp (m_Hash, other.m_Hash, 32); }; bool operator== (const IdentHash& other) const { return !memcmp (m_Hash, other.m_Hash, 32); };
bool operator< (const IdentHash& other) const { return memcmp (m_Hash, other.m_Hash, 32) < 0; }; bool operator< (const IdentHash& other) const { return memcmp (m_Hash, other.m_Hash, 32) < 0; };
bool FromBase32(const std::string&);
private: private:
uint8_t m_Hash[32]; uint8_t m_Hash[32];
@ -106,7 +108,7 @@ namespace data
public: public:
RoutingDestination (): m_ElGamalEncryption (nullptr) {}; RoutingDestination (): m_ElGamalEncryption (nullptr) {};
virtual ~RoutingDestination () { if (m_ElGamalEncryption) delete m_ElGamalEncryption; }; virtual ~RoutingDestination () { delete m_ElGamalEncryption; };
virtual const IdentHash& GetIdentHash () const = 0; virtual const IdentHash& GetIdentHash () const = 0;
virtual const uint8_t * GetEncryptionPublicKey () const = 0; virtual const uint8_t * GetEncryptionPublicKey () const = 0;

10
Streaming.cpp

@ -283,11 +283,11 @@ namespace stream
bool Stream::SendPacket (const uint8_t * buf, size_t len) bool Stream::SendPacket (const uint8_t * buf, size_t len)
{ {
const I2NPMessage * leaseSet = nullptr; const I2NPMessage * leaseSet = nullptr;
if (m_LeaseSetUpdated)
{ leaseSet = m_LocalDestination->GetLeaseSet ();
leaseSet = m_LocalDestination->GetLeaseSet (); if (!leaseSet)
m_LeaseSetUpdated = false; return false;
}
I2NPMessage * msg = i2p::garlic::routing.WrapMessage (m_RemoteLeaseSet, I2NPMessage * msg = i2p::garlic::routing.WrapMessage (m_RemoteLeaseSet,
CreateDataMessage (this, buf, len), leaseSet); CreateDataMessage (this, buf, len), leaseSet);
if (!m_OutboundTunnel || m_OutboundTunnel->IsFailed ()) if (!m_OutboundTunnel || m_OutboundTunnel->IsFailed ())

12
build/CMakeLists.txt

@ -21,6 +21,7 @@ set ( SOURCES
NTCPSession.cpp NTCPSession.cpp
RouterContext.cpp RouterContext.cpp
SSU.cpp SSU.cpp
SSUData.cpp
TransitTunnel.cpp TransitTunnel.cpp
Tunnel.cpp Tunnel.cpp
TunnelGateway.cpp TunnelGateway.cpp
@ -37,6 +38,7 @@ set ( SOURCES
TunnelEndpoint.cpp TunnelEndpoint.cpp
TunnelPool.cpp TunnelPool.cpp
util.cpp util.cpp
Daemon.cpp
) )
set ( HEADERS set ( HEADERS
@ -48,6 +50,7 @@ set ( HEADERS
NTCPSession.h NTCPSession.h
RouterContext.h RouterContext.h
SSU.h SSU.h
SSUData.h
TransitTunnel.h TransitTunnel.h
Tunnel.h Tunnel.h
TunnelGateway.h TunnelGateway.h
@ -64,8 +67,17 @@ set ( HEADERS
TunnelEndpoint.h TunnelEndpoint.h
TunnelPool.h TunnelPool.h
util.h util.h
Daemon.h
) )
if (WIN32)
list (APPEND SOURCES DeamonWin32.cpp)
else ()
list (APPEND SOURCES DaemonLinux.cpp)
endif ()
source_group ("Header Files" FILES ${HEADERS}) source_group ("Header Files" FILES ${HEADERS})
source_group ("Source Files" FILES ${SOURCES}) source_group ("Source Files" FILES ${SOURCES})

Loading…
Cancel
Save