00001 #ifndef CONNECTIONFACTORY_H 00002 #define CONNECTIONFACTORY_H 00003 #include <stdio.h> 00004 #include <iostream> 00005 #include <errno.h> 00006 #include <stdlib.h> 00007 #include <unistd.h> 00008 #include <sys/time.h> 00009 #include <sys/types.h> 00010 #include <sys/socket.h> 00011 #include <netinet/in.h> 00012 #include <netdb.h> 00013 #include <string> 00014 00015 #include "Connection.h" 00016 #include "FilterConnection.h" 00017 #include "InputConnection.h" 00018 #include "OutputConnection.h" 00019 #include "ConfigConnection.h" 00020 #include "ConnectionWrap.h" 00021 #include "BufferedFile.h" 00022 #include "BufferedFileFactory.h" 00023 00028 class ConnectionFactory { 00029 public: 00034 ConnectionFactory(BufferedFileFactory * bff,int start); 00038 ConnectionFactory(BufferedFileFactory * bff,int inputPort,int outputPort,int filterPort,int configPort); 00042 bool isThereANewConnection(); 00046 ConnectionWrap * ConnectionFactory::processConnection(); //return NULL for ones that weren't recorded.. This is 00050 ~ConnectionFactory(); 00051 private: 00052 void init(BufferedFileFactory * bff, int inputPort,int outputPort,int filterPort,int configPort); 00053 int inputfd; 00054 int outputfd; 00055 int filterfd; 00056 int configfd; 00057 BufferedFile * inputBF; 00058 BufferedFile * outputBF; 00059 BufferedFile * filterBF; 00060 BufferedFile * configBF; 00061 BufferedFileFactory * bf; 00062 BufferedFile * acceptAndGetFile(int fdin); 00063 }; 00064 #endif