Logo
~Sockets~
~Examples~
~Contact~


smtpnuke.cpp File Reference

#include <stdio.h>
#include <ListenSocket.h>
#include "SMTPSocket.h"
#include "NukeHandler.h"
#include "../Minion/config.h"
#include <signal.h>
#include <Utility.h>

Include dependency graph for smtpnuke.cpp:

Go to the source code of this file.


Defines

#define DEB(x)

Functions

void sigint (int s)
void sighup (int s)
void sigusr1 (int s)
void sigusr2 (int s)
void sigpipe (int s)
void siginit (void)
void run ()
int main (int argc, char *argv[])

Variables

static int m_quit = 0

Define Documentation

#define DEB (  ) 

Definition at line 29 of file smtpnuke.cpp.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 94 of file smtpnuke.cpp.

References parse_config(), run(), and siginit().

00095 {
00096         siginit();
00097         parse_config(argc,argv,"nuke.cfg");
00098         run();
00099 }

void run (  ) 

Definition at line 71 of file smtpnuke.cpp.

References m_quit, and NukeHandler::ViewSockets().

Referenced by main().

00072 {
00073         size_t sz = 0;
00074         NukeHandler h;
00075         ListenSocket<SMTPSocket> l(h);
00076 
00077         if (l.Bind(25, 20))
00078         {
00079                 exit(-1);
00080         }
00081         h.Add(&l);
00082         while (!m_quit)
00083         {
00084                 h.Select(1, 0);
00085                 if (h.GetCount() != sz)
00086                 {
00087                         sz = h.GetCount();
00088                         h.ViewSockets();
00089                 }
00090         }
00091 }

void sighup ( int  s  ) 

Definition at line 42 of file smtpnuke.cpp.

References DEB, and m_quit.

Referenced by siginit().

00043 {
00044 DEB(    printf("sighup\n");)
00045         m_quit++;
00046 }

void siginit ( void   ) 

Definition at line 60 of file smtpnuke.cpp.

References sighup(), sigint(), sigpipe(), sigusr1(), and sigusr2().

Referenced by main().

00061 {
00062         signal(SIGINT, (__sighandler_t)sigint);
00063         signal(SIGHUP, (__sighandler_t)sighup);
00064         signal(SIGUSR1, (__sighandler_t)sigusr1);
00065         signal(SIGUSR2, (__sighandler_t)sigusr2);
00066         signal(SIGPIPE, (__sighandler_t)sigpipe);
00067 }

void sigint ( int  s  ) 

Definition at line 36 of file smtpnuke.cpp.

References DEB, and m_quit.

Referenced by siginit().

00037 {
00038 DEB(    printf("sigint\n");)
00039         m_quit++;
00040 }

void sigpipe ( int  s  ) 

Definition at line 56 of file smtpnuke.cpp.

Referenced by siginit().

00057 {
00058 }

void sigusr1 ( int  s  ) 

Definition at line 48 of file smtpnuke.cpp.

Referenced by siginit().

00049 {
00050 }

void sigusr2 ( int  s  ) 

Definition at line 52 of file smtpnuke.cpp.

Referenced by siginit().

00053 {
00054 }


Variable Documentation

int m_quit = 0 [static]

Definition at line 32 of file smtpnuke.cpp.

Referenced by run(), sighup(), and sigint().

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