diff options
Diffstat (limited to 'src/Net')
-rw-r--r-- | src/Net/Connection.cpp | 2 | ||||
-rw-r--r-- | src/Net/Connection.h | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/Net/Connection.cpp b/src/Net/Connection.cpp index 6a30d11..cfced4f 100644 --- a/src/Net/Connection.cpp +++ b/src/Net/Connection.cpp @@ -226,6 +226,8 @@ void Connection::doDisconnect() { delete peer; peer = 0; + authenticated = false; + state = DISCONNECTED; } diff --git a/src/Net/Connection.h b/src/Net/Connection.h index 21e8444..d733ee3 100644 --- a/src/Net/Connection.h +++ b/src/Net/Connection.h @@ -54,6 +54,8 @@ class Connection { sigc::signal<void,Connection*,const Packet&> signal; + bool authenticated; + void doHandshake(); void packetHeaderReceiveHandler(const void *data, unsigned long length); @@ -126,7 +128,7 @@ class Connection { } public: - Connection() : state(DISCONNECTED), peer(0) { + Connection() : state(DISCONNECTED), authenticated(false), peer(0) { transR.length = transR.transmitted = 0; transR.data = 0; @@ -157,6 +159,18 @@ class Connection { return (state == DISCONNECT || state == BYE); } + bool isAuthenticated() const {return authenticated;} + void setAuthenticated() {authenticated = true;} + + const gnutls_datum_t* getCertificate() { + return gnutls_certificate_get_ours(session); + } + + const gnutls_datum_t* getPeerCertificate() { + unsigned int n; + return gnutls_certificate_get_peers(session, &n); + } + const IPAddress* getPeer() {return peer;} int getSocket() const {return sock;} |