hlswmaster/src/main.c

98 lines
3.0 KiB
C
Raw Normal View History

2006-02-02 16:25:55 +01:00
/***************************************************************************
* Copyright (C) 03/2005 by Olaf Rempel *
* razzor@kopf-tisch.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
2006-02-02 16:24:06 +01:00
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <getopt.h>
#include "hlswmaster.h"
static struct option opts[] = {
{"config", 1, 0, 'c'},
{"user", 1, 0, 'u'},
{"debug", 1, 0, 'd'},
{"no-daemon", 0, 0, 'f'},
{"help", 0, 0, 'h'},
{0, 0, 0, 0}
};
int main(int argc, char *argv[]) {
int arg = 0, code = 0;
pthread_t thread1, thread2, thread3, thread4;
while (code != -1) {
code = getopt_long(argc, argv, "c:u:d:fh", opts, &arg);
switch (code) {
case 'c': /* config */
break;
case 'u': /* user */
break;
case 'd': /* debug */
break;
case 'f': /* no-daemon */
break;
case 'h': /* help */
printf("Usage: hlsw-master [options]\n"
"Options: \n"
" --config -c configfile use this configfile\n"
" --user -u username change uid to username\n"
" --debug -d debuglevel level: 0 - 7\n"
" --no-daemon -f do not fork\n"
" --help -h this help\n"
"\n");
exit(0);
break;
case '?': /* error */
exit(-1);
break;
default: /* unknown / all options parsed */
break;
}
}
plugin_load("plugins/quake3.so");
2006-02-02 16:27:19 +01:00
plugin_load("plugins/hlswproxy.so");
2006-02-02 16:24:06 +01:00
scan_init();
2006-02-02 16:27:19 +01:00
// scan_transmit();
pthread_create(&thread1, NULL, (void *)&scan_transmit, NULL);
pthread_create(&thread2, NULL, (void *)&scan_receive, NULL);
pthread_create(&thread3, NULL, (void *)&server_collector, NULL);
pthread_create(&thread4, NULL, (void *)&client_handler, NULL);
2006-02-02 16:24:06 +01:00
sleep(9999);
scan_exit();
return 0;
}