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

Definition at line 50 of file server.cpp.

00051 {
00052 
00053 signal(SIGINT, INThandler);
00054 
00055     const char* DEFAULT_CONFIG_FOLDER = ".keyvil";
00056     const char* DEFAULT_CONFIG_FILE = "server.conf";
00057     string filePath = getenv("HOME");
00058     filePath += "/";
00059     filePath += DEFAULT_CONFIG_FOLDER;
00060     mkdir(filePath.c_str(), 0750);
00061     filePath += "/";
00062     filePath += "backup";
00063     char backupFileName[1024];
00064     backupFileName[0] = '\0';
00065     strcat(backupFileName, "backupfile = ");
00066     strcat(backupFileName, filePath.c_str());
00067 
00068     const char* DEFAULT_CONFIG_CONTENT[] = {
00069             "#-------------------------------------",
00070             "# config file for the keyvil server",
00071             "#-------------------------------------",
00072             "",
00073             "ip = 127.0.0.1",
00074             "port = 1322",
00075             "cryptosys = MD5",
00076             "hash = 12345678901234567890123456789012",
00077                         "hashlength = 32",
00078                         backupFileName,
00079             "confirmationtimer = 15",
00080             0
00081     };
00082 
00083     string personalConfig = DefaultConf::createIfNonExistent(DEFAULT_CONFIG_FOLDER, DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_CONTENT);
00084 
00085     const char* CONFIG_FILES[] = {
00086             "/etc/server_keyvil.conf",
00087             personalConfig.c_str(),
00088             0
00089     };
00090     serverConf sc;
00091 
00092     if (sc.readConf(argc,argv,CONFIG_FILES)) {
00093         cout << "usage: " << argv[0]
00094         << " -i ipAddress -p portNumber -c cryptoSys -h hash -l hashLength -b backupfile -t confirmationTimer"
00095         << endl;
00096         return -1;
00097     }
00098         const int PORT = sc.getPort();
00099         const char* IP = sc.getIp();
00100         const char* CRYPTOSYS = sc.getCrypto();
00101         const char* HASH = sc.getHash();
00102         const char* HASHLENGTH = sc.getHashLength();
00103         const char* BACKUPFILE = sc.getBackupFile();
00104         const int CONFIRMATIONTIMER = sc.getConfirmationTimer();
00105         
00106 // to do server management :-)!!!
00107         servermgnt = new ServerMgnt(IP, PORT, CRYPTOSYS, BACKUPFILE, HASH, HASHLENGTH, CONFIRMATIONTIMER) ;
00108         servermgnt->start();
00109         cout << argv[0] << " finished \n";
00110 
00111 
00112 return 0;
00113 }


Generated on Wed Jun 25 14:47:03 2008 for keyvil by  doxygen 1.5.1