59 lines
906 B
C++
59 lines
906 B
C++
#ifndef __SSL_SERVER_H__
|
|
#define __SSL_SERVER_H__
|
|
|
|
#include "ssl_process.h"
|
|
|
|
#include <sys/socket.h>
|
|
#include <arpa/inet.h>
|
|
#include <resolv.h>
|
|
#include <unistd.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <iostream>
|
|
#include <map>
|
|
|
|
#include <boost/thread/thread.hpp>
|
|
#include <openssl/ssl.h>
|
|
|
|
struct Acceptor
|
|
{
|
|
int _master;
|
|
SSL_CTX* _ctx;
|
|
|
|
Acceptor(int iMasterHd, SSL_CTX* iCtx)
|
|
: _master(iMasterHd)
|
|
, _ctx(iCtx)
|
|
{ }
|
|
|
|
void operator()();
|
|
int openTCPSocket();
|
|
SSL* openSSLSession(int);
|
|
|
|
};
|
|
|
|
class Server : public SSLProcess
|
|
{
|
|
|
|
// Private data
|
|
private:
|
|
int _master;
|
|
|
|
void startListen();
|
|
void doServerSSLInit();
|
|
|
|
boost::thread* _sender;
|
|
boost::thread* _reciver;
|
|
boost::thread* _reactor;
|
|
|
|
public:
|
|
// Constructors
|
|
Server();
|
|
~Server();
|
|
|
|
void init();
|
|
void start();
|
|
void waitForStop();
|
|
};
|
|
|
|
#endif
|