Logo
~Sockets~
~Examples~
~Contact~


NukeHandler Class Reference

SMTP proxy socket handler controller class. More...

#include <NukeHandler.h>

Collaboration diagram for NukeHandler:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 NukeHandler ()
 ~NukeHandler ()
void ViewSockets ()
DatabaseGetDatabase ()
void InitDB ()

Private Attributes

Databasem_db

Detailed Description

SMTP proxy socket handler controller class.

Definition at line 33 of file NukeHandler.h.


Constructor & Destructor Documentation

NukeHandler::NukeHandler (  ) 

Definition at line 35 of file NukeHandler.cpp.

References InitDB().

00036 :SocketHandler()
00037 ,m_db(NULL)
00038 {
00039         InitDB();
00040 }

NukeHandler::~NukeHandler (  ) 

Definition at line 43 of file NukeHandler.cpp.

00044 {
00045 }


Member Function Documentation

void NukeHandler::ViewSockets (  ) 

Definition at line 48 of file NukeHandler.cpp.

Referenced by run().

00049 {
00050         for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++)
00051         {
00052                 SOCKET s = (*it).first;
00053                 Socket *p = (*it).second;
00054                 if (dynamic_cast<SMTPSocket *>(p))
00055                 {
00056                         printf("%4d: SMTPSocket\n",s);
00057                 }
00058                 else
00059                 if (dynamic_cast<FwdSocket *>(p))
00060                 {
00061                         printf("%4d: FwdSocket\n",s);
00062                 }
00063         }
00064 }

Database* NukeHandler::GetDatabase (  )  [inline]

Definition at line 41 of file NukeHandler.h.

References m_db.

00041 { return m_db; }

void NukeHandler::InitDB (  ) 

Definition at line 67 of file NukeHandler.cpp.

References Query::execute(), and m_db.

Referenced by NukeHandler().

00068 {
00069         FILE *fil = fopen("nuke.db","rb");
00070         bool exists = false;
00071         if (fil)
00072         {
00073                 exists = true;
00074                 fclose(fil);
00075         }
00076         m_db = new Database("nuke.db");
00077         if (!exists)
00078         {
00079                 Query q(m_db);
00080                 q.execute("create table sender ("
00081                            "num integer primary key,"
00082                            "email string,"
00083                            "status string,"
00084                            "forward string"
00085                           ")");
00086                 q.execute("create table recipient ("
00087                            "num integer primary key,"
00088                            "email string,"
00089                            "status string,"
00090                            "forward string"
00091                           ")");
00092                 q.execute("create table mailinst ("
00093                            "id integer primary key,"
00094                            "host string,"
00095                            "mail string,"
00096                            "rcpt string,"
00097                            "h_from string,"
00098                            "h_to string,"
00099                            "h_subject string,"
00100                            "host_spam string,"
00101                            "mail_spam string,"
00102                            "from_spam string,"
00103                            "subject_spam string"
00104                           ")");
00105         }
00106 }


Member Data Documentation

Definition at line 45 of file NukeHandler.h.

Referenced by GetDatabase(), and InitDB().


The documentation for this class was generated from the following files:
Page, code, and content Copyright (C) 2006 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4