basic tls setup
This commit is contained in:
parent
cc26022e72
commit
06cd276614
|
@ -165,7 +165,7 @@ void EventLoop::leaveScope() {
|
|||
local_loop = nullptr;
|
||||
}
|
||||
|
||||
bool EventLoop::turnLoop(){
|
||||
bool EventLoop::turnLoop() {
|
||||
size_t turn_step = 0;
|
||||
while (head && turn_step < 65536) {
|
||||
if (!turn()) {
|
||||
|
|
|
@ -1,10 +1,26 @@
|
|||
#include "tls.h"
|
||||
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <gnutls/x509.h>
|
||||
|
||||
namespace gin {
|
||||
class TlsContext::Impl {
|
||||
private:
|
||||
gnutls_certificate_credentials_t xcred;
|
||||
|
||||
public:
|
||||
Impl() {
|
||||
gnutls_global_init();
|
||||
gnutls_certificate_allocate_credentials(&xcred);
|
||||
gnutls_certificate_set_x509_system_trust(xcred);
|
||||
}
|
||||
|
||||
~Impl() {
|
||||
gnutls_certificate_free_credentials(xcred);
|
||||
gnutls_global_deinit();
|
||||
}
|
||||
};
|
||||
|
||||
TlsContext::TlsContext():impl{heap<TlsContext::Impl>()}{}
|
||||
TlsContext::~TlsContext(){}
|
||||
}
|
||||
TlsContext::TlsContext() : impl{heap<TlsContext::Impl>()} {}
|
||||
TlsContext::~TlsContext() {}
|
||||
} // namespace gin
|
||||
|
|
14
source/tls.h
14
source/tls.h
|
@ -4,19 +4,19 @@
|
|||
|
||||
namespace gin {
|
||||
class TlsContext {
|
||||
public:
|
||||
struct Options {};
|
||||
|
||||
private:
|
||||
/*
|
||||
* Pimpl pattern to hide GnuTls include
|
||||
*/
|
||||
* Pimpl pattern to hide GnuTls include
|
||||
*/
|
||||
class Impl;
|
||||
Own<Impl> impl;
|
||||
|
||||
public:
|
||||
TlsContext();
|
||||
~TlsContext();
|
||||
};
|
||||
|
||||
class TlsIoProvider {
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace gin
|
||||
|
|
Loading…
Reference in New Issue