Google
Web alhem.net
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

NukeHandler.cpp

Go to the documentation of this file.
00001 // NukeHandler.cpp 00002 /* 00003 Copyright (C) 2004 Anders Hedstrom 00004 00005 This program is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU General Public License 00007 as published by the Free Software Foundation; either version 2 00008 of the License, or (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifdef _WIN32 00021 #pragma warning(disable:4786) 00022 #endif 00023 //#include <stdio.h> 00024 00025 #include "SMTPSocket.h" 00026 #include "FwdSocket.h" 00027 #include "NukeHandler.h" 00028 #ifdef _WIN32 00029 //#define random rand 00030 #endif 00031 00032 #define DEB(x) 00033 00034 00035 NukeHandler::NukeHandler() 00036 :SocketHandler() 00037 ,m_db(NULL) 00038 { 00039 InitDB(); 00040 } 00041 00042 00043 NukeHandler::~NukeHandler() 00044 { 00045 } 00046 00047 00048 void NukeHandler::ViewSockets() 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 } 00065 00066 00067 void NukeHandler::InitDB() 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 } 00107 00108

Generated for C++ Sockets library example: SMTP Proxy by doxygen 1.3.6

www.TV-friendship.com
The matchmaking service with an all new twist.

Quantum 'Teleportation'
Some thoughts
Page, code, and content Copyright (C) 2004 by Anders Hedström