#include <pssl.h>
Inheritance diagram for PSSLChannel:
Public Types | |
enum | VerifyMode { VerifyNone, VerifyPeer, VerifyPeerMandatory } |
Public Member Functions | |
PSSLChannel (PSSLContext *context=NULL, BOOL autoDeleteContext=FALSE) | |
PSSLChannel (PSSLContext &context) | |
~PSSLChannel () | |
virtual BOOL | Read (void *buf, PINDEX len) |
virtual BOOL | Write (const void *buf, PINDEX len) |
virtual BOOL | Close () |
virtual BOOL | Shutdown (ShutdownValue) |
virtual PString | GetErrorText (ErrorGroup group=NumErrorGroups) const |
virtual BOOL | ConvertOSError (int error, ErrorGroup group=LastGeneralError) |
BOOL | Accept () |
BOOL | Accept (PChannel &channel) |
BOOL | Accept (PChannel *channel, BOOL autoDelete=TRUE) |
BOOL | Connect () |
BOOL | Connect (PChannel &channel) |
BOOL | Connect (PChannel *channel, BOOL autoDelete=TRUE) |
BOOL | UseCertificate (const PSSLCertificate &certificate) |
BOOL | UsePrivateKey (const PSSLPrivateKey &key) |
void | SetVerifyMode (VerifyMode mode) |
PSSLContext * | GetContext () const |
virtual BOOL | RawSSLRead (void *buf, PINDEX &len) |
Protected Member Functions | |
virtual BOOL | OnOpen () |
Protected Attributes | |
PSSLContext * | context |
BOOL | autoDeleteContext |
ssl_st * | ssl |
PSSLChannel::PSSLChannel | ( | PSSLContext * | context = NULL , |
|
BOOL | autoDeleteContext = FALSE | |||
) |
Create a new channel given the context. If no context is given a default one is created.
context | Context for SSL channel |
autoDeleteContext | Flag for context to be automatically deleted. |
PSSLChannel::PSSLChannel | ( | PSSLContext & | context | ) |
context | Context for SSL channel |
PSSLChannel::~PSSLChannel | ( | ) |
Close and clear the SSL channel.
virtual BOOL PSSLChannel::Read | ( | void * | buf, | |
PINDEX | len | |||
) | [virtual] |
Low level read from the channel. This function may block until the requested number of characters were read or the read timeout was reached. The GetLastReadCount() function returns the actual number of bytes read.
This will use the readChannel# pointer to actually do the read. If readChannel# is null the this asserts.
The GetErrorCode() function should be consulted after Read() returns FALSE to determine what caused the failure.
Reimplemented from PIndirectChannel.
virtual BOOL PSSLChannel::Write | ( | const void * | buf, | |
PINDEX | len | |||
) | [virtual] |
Low level write to the channel. This function will block until the requested number of characters are written or the write timeout is reached. The GetLastWriteCount() function returns the actual number of bytes written.
This will use the writeChannel# pointer to actually do the write. If writeChannel# is null the this asserts.
The GetErrorCode() function should be consulted after Write() returns FALSE to determine what caused the failure.
Reimplemented from PIndirectChannel.
virtual BOOL PSSLChannel::Close | ( | ) | [virtual] |
Close the channel. This will detach itself from the read and write channels and delete both of them if they are auto delete.
Reimplemented from PIndirectChannel.
virtual BOOL PSSLChannel::Shutdown | ( | ShutdownValue | ) | [inline, virtual] |
Close one or both of the data streams associated with a channel.
The behavour here is to pass the shutdown on to its read and write channels.
Reimplemented from PIndirectChannel.
virtual PString PSSLChannel::GetErrorText | ( | ErrorGroup | group = NumErrorGroups |
) | const [virtual] |
Get error message description. Return a string indicating the error message that may be displayed to the user. The error for the last I/O operation in this object is used.
Reimplemented from PIndirectChannel.
virtual BOOL PSSLChannel::ConvertOSError | ( | int | error, | |
ErrorGroup | group = LastGeneralError | |||
) | [virtual] |
Convert an operating system error into platform independent error. The internal error codes are set by this function. They may be obtained via the GetErrorCode()# and GetErrorNumber()# functions.
Reimplemented from PChannel.
BOOL PSSLChannel::Accept | ( | ) |
Accept a new inbound connection (server). This version expects that the indirect channel has already been opened using Open() beforehand.
BOOL PSSLChannel::Accept | ( | PChannel & | channel | ) |
Accept a new inbound connection (server).
channel | Channel to attach to. |
BOOL PSSLChannel::Accept | ( | PChannel * | channel, | |
BOOL | autoDelete = TRUE | |||
) |
Accept a new inbound connection (server).
channel | Channel to attach to. |
autoDelete | Flag for if channel should be automatically deleted. |
BOOL PSSLChannel::Connect | ( | ) |
Connect to remote server. This version expects that the indirect channel has already been opened using Open() beforehand.
BOOL PSSLChannel::Connect | ( | PChannel & | channel | ) |
Connect to remote server.
channel | Channel to attach to. |
BOOL PSSLChannel::Connect | ( | PChannel * | channel, | |
BOOL | autoDelete = TRUE | |||
) |
Connect to remote server.
channel | Channel to attach to. |
autoDelete | Flag for if channel should be automatically deleted. |
BOOL PSSLChannel::UseCertificate | ( | const PSSLCertificate & | certificate | ) |
Use the certificate specified.
BOOL PSSLChannel::UsePrivateKey | ( | const PSSLPrivateKey & | key | ) |
Use the private key file specified.
void PSSLChannel::SetVerifyMode | ( | VerifyMode | mode | ) |
PSSLContext* PSSLChannel::GetContext | ( | ) | const [inline] |
virtual BOOL PSSLChannel::RawSSLRead | ( | void * | buf, | |
PINDEX & | len | |||
) | [virtual] |
virtual BOOL PSSLChannel::OnOpen | ( | ) | [protected, virtual] |
This callback is executed when the Open() function is called with open channels. It may be used by descendent channels to do any handshaking required by the protocol that channel embodies.
The default behaviour "connects" the channel to the OpenSSL library.
Reimplemented from PIndirectChannel.
PSSLContext* PSSLChannel::context [protected] |
BOOL PSSLChannel::autoDeleteContext [protected] |
ssl_st* PSSLChannel::ssl [protected] |