示例#1
0
文件: config.c 项目: Laukien/DoIT
void config_show() {
	char *tmp;

	/* root */
	printf("root: %s\n", config_getRoot());

	/* data */
	printf("data: %s\n", config_getData());

	/* exec */
	printf("exec: %s\n", config_getExec());

	/* temp */
	printf("temp: %s\n", config_getTemp());

	/* pipe */
	printf("pipe: %s\n", config_getPipe());

	/* address */
	printf("address: %s\n", config_getAddress());

	/* port */
	printf("port: %d\n", config_getPort());

	/* timeout */
	printf("timeout: %d\n", config_getTimeout());

	/* challenge */
	printf("challenge: %s\n", config_getChallenge());

	/* debug */
	tmp = boolean_toString(config_getDebug());
	printf("debug: %s\n", tmp);
	free(tmp);
}
示例#2
0
文件: main.c 项目: m3l3m01t/antinat
void
reloadconfig (int x)
{
	unsigned long ip;
	unsigned short port;
	if (conf) {
		ip = config_getInterface (conf);
		port = config_getPort (conf);
		config_dereference (conf);
	} else {
		/* Must be invalid */
		ip = 0;
		port = 0;
	}
	conf = (config_t *) malloc (sizeof (config_t));
	if (!loadconfig (conf, config_filename)) {
#ifdef _WIN32_
		MessageBox (NULL, "Could not open configuration file.", "Antinat",
					48);
#else
		printf ("Could not open configuration file.");
#endif
		free (conf);
		exit (EXIT_FAILURE);
	}
	log_log (NULL, LOG_EVT_SERVERRESTART, 0, conf);
	if ((config_getPort (conf) != port) || (config_getInterface (conf) != ip)) {
		if (srv != INVALID_SOCKET)
			closesocket (srv);
		srv = INVALID_SOCKET;
		if (!startServer
			((unsigned short) config_getPort (conf),
			 (unsigned int) config_getInterface (conf))) {
#ifndef _WIN32_
			printf ("Could not listen on interface/port\n");
#else
			MessageBox (NULL, "Could not listen on interface/port", "Antinat",
						16);
#endif
			exit (EXIT_FAILURE);
		}
	}
#ifndef _WIN32_
	signal (x, reloadconfig);
#endif
}