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

stprog.cpp File Reference

#include <stdio.h>
#include <ListenSocket.h>
#include "InSocket.h"
#include "ProxyHandler.h"
#include <signal.h>
#include <StdoutLog.h>

Include dependency graph for stprog.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 stprog.cpp.


Function Documentation

int main int  argc,
char *  argv[]
 

Definition at line 96 of file stprog.cpp.

References run(), and siginit().

00097 {
00098         siginit();
00099         run();
00100 }

void run  ) 
 

Definition at line 71 of file stprog.cpp.

References m_quit, and ProxyHandler::ViewSockets().

Referenced by main().

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

void sighup int  s  ) 
 

Definition at line 42 of file stprog.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 stprog.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 stprog.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 stprog.cpp.

Referenced by siginit().

00057 {
00058 }

void sigusr1 int  s  ) 
 

Definition at line 48 of file stprog.cpp.

Referenced by siginit().

00049 {
00050 }

void sigusr2 int  s  ) 
 

Definition at line 52 of file stprog.cpp.

Referenced by siginit().

00053 {
00054 }


Variable Documentation

int m_quit = 0 [static]
 

Definition at line 32 of file stprog.cpp.

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


Generated for C++ Sockets library example: simple tcp port 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