1 // Copyright 2009 The Archiveopteryx Developers <info@aox.org> 2 3 #ifndef SERVER_H 4 #define SERVER_H 5 6 #include "global.h" 7 8 9 class EString; 10 11 12 class Server 13 : public Garbage 14 { 15 public: 16 Server( const char *, int, char *[] ); 17 18 enum ChrootMode { 19 JailDir, LogDir 20 }; 21 22 void setChrootMode( ChrootMode ); 23 24 enum Stage { 25 Configuration, 26 NameResolution, 27 Files, 28 LogSetup, 29 Loop, 30 Report, 31 Fork, 32 PidFile, 33 LogStartup, 34 Secure, 35 MaintainChildren, 36 Finish // MUST BE LAST 37 }; 38 39 void setup( Stage ); 40 void run(); 41 42 static EString name(); 43 static bool useCache(); 44 45 static void killChildren( int ); 46 47 private: 48 static class ServerData * d; 49 50 void configuration(); 51 void nameResolution(); 52 void files(); 53 void loop(); 54 void logSetup(); 55 void fork(); 56 void pidFile(); 57 void logStartup(); 58 void secure(); 59 void maintainChildren(); 60 }; 61 62 63 #endif 64