Rework for TLS.
This commit is contained in:
1 parent
519faa535b
commit
b7deabc5dc
2830 files changed
+4559
-80373
No files matched your search
@@ -1,11 +1,8 @@
|
||||
#ifndef TLSServerSocket_h__
|
||||
#define TLSServerSocket_h__
|
||||
#ifndef __TLS_h__
|
||||
#define __TLS_h__
|
||||
|
||||
#include "Socket.h"
|
||||
#include "TCPServer.h"
|
||||
#include "Command.h"
|
||||
#include "TCPSession.h"
|
||||
#include "IPAddress.h"
|
||||
#include "ZString.h"
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
namespace core {
|
||||
|
||||
@@ -20,41 +17,39 @@ namespace core {
|
||||
|
||||
public:
|
||||
|
||||
///
|
||||
/// Use this constructor when the SSL context needs to be created as when opening
|
||||
/// a server TCPSocket.
|
||||
///
|
||||
|
||||
TLS();
|
||||
|
||||
///
|
||||
/// Use this constructor on creation of a new TCPSocket that needs access to
|
||||
/// the generating server's SSL context.
|
||||
///
|
||||
|
||||
TLS(SSL_CTX *ctx);
|
||||
|
||||
///
|
||||
/// The destructor for this object.
|
||||
///
|
||||
|
||||
~TLS();
|
||||
~TLS();
|
||||
|
||||
void createContext();
|
||||
|
||||
SSL_CTX *ctx;
|
||||
|
||||
|
||||
protected:
|
||||
void receiveData(coreutils::ZString &buffer);
|
||||
void registerSocket(int fd);
|
||||
void acceptSocket();
|
||||
|
||||
private:
|
||||
|
||||
char *sip_cacert = (char *)"../testkeys/certs/pbxca.crt";
|
||||
char *sip_cert = (char *)"../testkeys/certs/pbxserver.crt";
|
||||
char *sip_key = (char *)"../testkeys/certs/pbxserver.key";
|
||||
|
||||
|
||||
public:
|
||||
|
||||
///
|
||||
/// The output method is called by a socket session (Session) and
|
||||
/// will output the detail information for the client socket. When extending
|
||||
/// TLSSocket or Session you can override the method to add attributes
|
||||
/// to the list.
|
||||
///
|
||||
|
||||
virtual void output(std::stringstream &out);
|
||||
virtual void protocol(coreutils::ZString &data) override;
|
||||
|
||||
protected:
|
||||
void receiveData(coreutils::ZString &buffer) override;
|
||||
void onRegister();
|
||||
void onRegistered();
|
||||
|
||||
private:
|
||||
bool initialized = false;
|
||||
SSL *ssl;
|
||||
|
||||
|
||||
Reference in new issue
Block a user