KjSslConnection Class Reference

#include <KjSslConnection.h>

Inheritance diagram for KjSslConnection:

KjSslObject List of all members.

Public Types

enum  EKjSslConType { KJ_SSL_SERVER, KJ_SSL_CLIENT }

Public Member Functions

 KjSslConnection (KjSslConnection::EKjSslConType _eType, char *_strConn, const string &_strCertFile="", const string &_strKeyFile="")
 KjSslConnection (BIO *_pBio, const string &_strCertFile="", const string &_strKeyFile="")
 ~KjSslConnection ()
int Write (const string &_str)
 Write string to the SSL connection.
int Read (string &_str)
 Read string from SSL connection.
bool GetIsValid ()
int & GetId ()
BIO * GetBio ()

Private Member Functions

bool ServerConnect (char *_strConn)
 New server connection.
bool ClientConnect (char *_strConn)
 New client connection.
bool Init (const string &_strCertFile, const string &_strKeyFile)
 Initialize SSL connection.
bool CheckSslState ()
 Check SSL connection state.

Private Attributes

SSL * m_pSsl
 SSL connection.
X509 * m_pCert
 X509 certificate.
EKjSslConType m_eType
 Connection types.
BIO * m_pBio
 BIO I/O.
bool m_bIsValid
 Is SSL connection valid ?
int m_iId
 Connection index (client connection index).

Detailed Description

KjSslConnection is class for client server connection. Including functions Read() , Write() for SSL communication between client and server

Definition at line 50 of file KjSslConnection.h.


Member Enumeration Documentation

enum KjSslConnection::EKjSslConType
 

Enumerator:
KJ_SSL_SERVER 
KJ_SSL_CLIENT 

Definition at line 53 of file KjSslConnection.h.


Constructor & Destructor Documentation

KjSslConnection::KjSslConnection KjSslConnection::EKjSslConType  _eType,
char *  _strConn,
const string &  _strCertFile = "",
const string &  _strKeyFile = ""
 

Definition at line 36 of file KjSslConnection.cpp.

References ClientConnect(), Init(), KJ_SSL_CLIENT, KJ_SSL_SERVER, m_bIsValid, m_eType, and ServerConnect().

KjSslConnection::KjSslConnection BIO *  _pBio,
const string &  _strCertFile = "",
const string &  _strKeyFile = ""
 

Definition at line 53 of file KjSslConnection.cpp.

References Init(), m_bIsValid, m_iId, and ServerConnect().

KjSslConnection::~KjSslConnection  ) 
 

Definition at line 65 of file KjSslConnection.cpp.

References m_bIsValid, and m_pSsl.


Member Function Documentation

bool KjSslConnection::CheckSslState  )  [private]
 

Check SSL connection state.

Return values:
bool Returns true if connection state is correct

Definition at line 245 of file KjSslConnection.cpp.

References m_pSsl.

Referenced by Read(), and Write().

bool KjSslConnection::ClientConnect char *  _strConn  )  [private]
 

New client connection.

Parameters:
_strConn Connection IP adress and port
Return values:
bool Returns true if client connected

Definition at line 148 of file KjSslConnection.cpp.

References KjSslObject::CheckErrors(), KjSslObject::CheckSslErrors(), m_bIsValid, m_pBio, and m_pSsl.

Referenced by KjSslConnection().

BIO* KjSslConnection::GetBio  )  [inline]
 

Definition at line 90 of file KjSslConnection.h.

References m_pBio.

int& KjSslConnection::GetId  )  [inline]
 

Definition at line 85 of file KjSslConnection.h.

References m_iId.

bool KjSslConnection::GetIsValid  )  [inline]
 

Definition at line 80 of file KjSslConnection.h.

References m_bIsValid.

bool KjSslConnection::Init const string &  _strCertFile,
const string &  _strKeyFile
[private]
 

Initialize SSL connection.

Parameters:
_strCertFile Certificate file
_strKeyFile RSA private key file
Return values:
bool Returns true if both files correctly checked

Definition at line 75 of file KjSslConnection.cpp.

References KjSslObject::CheckErrors(), KjSslObject::GetCtx(), m_bIsValid, and m_pSsl.

Referenced by KjSslConnection().

int KjSslConnection::Read string &  _str  ) 
 

Read string from SSL connection.

Parameters:
_str Output string
Return values:
int Number of bytes read

Definition at line 224 of file KjSslConnection.cpp.

References CheckSslState(), KJ_SSL_READ_CHUNK_SIZE, and m_pSsl.

bool KjSslConnection::ServerConnect char *  _strConn  )  [private]
 

New server connection.

Parameters:
_strConn Connection IP adress and port
Return values:
bool Returns true if server connected

Definition at line 122 of file KjSslConnection.cpp.

References KjSslObject::CheckErrors(), KjSslObject::CheckSslErrors(), m_pBio, and m_pSsl.

Referenced by KjSslConnection().

int KjSslConnection::Write const string &  _str  ) 
 

Write string to the SSL connection.

Parameters:
_str Input string
Return values:
int Number of written bytes or some error enumerator

Definition at line 173 of file KjSslConnection.cpp.

References CheckSslState(), KJ_SSL_READ_CHUNK_SIZE, and m_pSsl.


Member Data Documentation

bool KjSslConnection::m_bIsValid [private]
 

Is SSL connection valid ?

Definition at line 64 of file KjSslConnection.h.

Referenced by ClientConnect(), GetIsValid(), Init(), KjSslConnection(), and ~KjSslConnection().

EKjSslConType KjSslConnection::m_eType [private]
 

Connection types.

Definition at line 62 of file KjSslConnection.h.

Referenced by KjSslConnection().

int KjSslConnection::m_iId [private]
 

Connection index (client connection index).

Definition at line 65 of file KjSslConnection.h.

Referenced by GetId(), and KjSslConnection().

BIO* KjSslConnection::m_pBio [private]
 

BIO I/O.

Definition at line 63 of file KjSslConnection.h.

Referenced by ClientConnect(), GetBio(), and ServerConnect().

X509* KjSslConnection::m_pCert [private]
 

X509 certificate.

Definition at line 61 of file KjSslConnection.h.

SSL* KjSslConnection::m_pSsl [private]
 

SSL connection.

Definition at line 60 of file KjSslConnection.h.

Referenced by CheckSslState(), ClientConnect(), Init(), Read(), ServerConnect(), Write(), and ~KjSslConnection().


The documentation for this class was generated from the following files:
Generated on Tue Jul 24 10:03:19 2007 for KjSslSocket by  doxygen 1.4.6