Logo
~Sockets~
~Examples~
~Contact~


CTcpSocket Class Reference
[Distributed network framework]

TcpSocket implementation with manual encrypt/decrypt. More...

#include <CTcpSocket.h>

Inheritance diagram for CTcpSocket:

Inheritance graph
[legend]
Collaboration diagram for CTcpSocket:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CTcpSocket (ISocketHandler &)
 ~CTcpSocket ()
void Init ()
 CTcpSocket uses this to create its ICrypt member variable.
virtual ICryptAllocateCrypt ()=0
std::string encrypt (unsigned char *, const std::string &)
bool decrypt (unsigned char *, const std::string &, std::string &)

Protected Member Functions

 CTcpSocket (const CTcpSocket &s)

Private Member Functions

CTcpSocketoperator= (const CTcpSocket &)

Private Attributes

ICryptm_crypt

Detailed Description

TcpSocket implementation with manual encrypt/decrypt.

Definition at line 44 of file CTcpSocket.h.


Constructor & Destructor Documentation

CTcpSocket::CTcpSocket ( ISocketHandler  ) 

Definition at line 39 of file CTcpSocket.cpp.

00040 :TcpSocket(h)
00041 ,m_crypt(NULL)
00042 {
00043 }

CTcpSocket::~CTcpSocket (  ) 

Definition at line 46 of file CTcpSocket.cpp.

References m_crypt.

00047 {
00048         if (m_crypt)
00049                 delete m_crypt;
00050 }

CTcpSocket::CTcpSocket ( const CTcpSocket s  )  [inline, protected]

Definition at line 58 of file CTcpSocket.h.

00058 : TcpSocket(s) {}


Member Function Documentation

void CTcpSocket::Init (  )  [virtual]

CTcpSocket uses this to create its ICrypt member variable.

The ICrypt member variable is created by a virtual method, therefore it can't be called directly from the CTcpSocket constructor. Also used to determine if incoming HTTP connection is normal (port 80) or ssl (port 443).

Reimplemented from Socket.

Definition at line 53 of file CTcpSocket.cpp.

References AllocateCrypt(), and m_crypt.

00054 {
00055         m_crypt = AllocateCrypt();
00056 }

virtual ICrypt* CTcpSocket::AllocateCrypt (  )  [pure virtual]

Referenced by Init().

std::string CTcpSocket::encrypt ( unsigned char *  ,
const std::string &   
)

Definition at line 59 of file CTcpSocket.cpp.

References m_crypt.

Referenced by MinionSocket::OnLine(), MinionSocket::OnVerifiedLine(), and MinionSocket::SendHello().

00060 {
00061         return m_crypt ? m_crypt -> encrypt(ik, msg) : "";
00062 }

bool CTcpSocket::decrypt ( unsigned char *  ,
const std::string &  ,
std::string &   
)

Definition at line 65 of file CTcpSocket.cpp.

References m_crypt.

Referenced by MinionSocket::OnLine().

00066 {
00067         return m_crypt ? m_crypt -> decrypt(ik, msg, output) : false;
00068 }

CTcpSocket& CTcpSocket::operator= ( const CTcpSocket  )  [inline, private]

Definition at line 60 of file CTcpSocket.h.

00060 { return *this; }


Member Data Documentation

Definition at line 61 of file CTcpSocket.h.

Referenced by decrypt(), encrypt(), Init(), and ~CTcpSocket().


The documentation for this class was generated from the following files:
Page, code, and content Copyright (C) 2007 by Anders Hedström
Generated for C++ Sockets by  doxygen 1.4.4