Exemplo n.º 1
0
int main(int argc, char** argv)
{
#ifdef PARALLEL_CORES
  omp_set_num_threads(PARALLEL_CORES);
#endif

  OpenANN::Logger configLogger(OpenANN::Logger::CONSOLE);
  int runs = 1000;

  configLogger << "SPB, MDP, uncompressed\n";
  Results results = benchmarkConfiguration(false, true, true, false, -1, runs, 10.0);
  printResults(results);
  configLogger << "SPB, MDP, compressed (1)\n";
  results = benchmarkConfiguration(false, true, false, false, 1, runs, 100.0);
  printResults(results);
  configLogger << "DPB, MDP, uncompressed\n";
  results = benchmarkConfiguration(true, true, false, false, -1, runs, 10.0);
  printResults(results);
  configLogger << "DPB, MDP, compressed (5)\n";
  results = benchmarkConfiguration(true, true, false, false, 5, runs, 10.0);
  printResults(results);
  configLogger << "SPB, POMDP (ABF), uncompressed\n";
  results = benchmarkConfiguration(false, false, true, false, -1, runs, 10.0);
  printResults(results);
  configLogger << "SPB, POMDP (ABF), compressed (3)\n";
  results = benchmarkConfiguration(false, false, true, false, 3, runs, 10.0);
  printResults(results);
  configLogger << "DPB, POMDP (ABF), uncompressed\n";
  results = benchmarkConfiguration(true, false, true, false, -1, runs, 10.0);
  printResults(results);
  configLogger << "DPB, POMDP (ABF), compressed (5)\n";
  results = benchmarkConfiguration(true, false, true, false, 5, runs, 10.0);
  printResults(results);
  configLogger << "SPB, POMDP (DES), uncompressed\n";
  results = benchmarkConfiguration(false, false, false, true, -1, runs, 10.0);
  printResults(results);
  configLogger << "SPB, POMDP (DES), compressed (3)\n";
  results = benchmarkConfiguration(false, false, false, true, 3, runs, 10.0);
  printResults(results);
  configLogger << "DPB, POMDP (DES), uncompressed\n";
  results = benchmarkConfiguration(true, false, false, true, -1, runs, 10.0);
  printResults(results);
  configLogger << "DPB, POMDP (DES), compressed (5)\n";
  results = benchmarkConfiguration(true, false, false, true, 5, runs, 10.0);
  printResults(results);
}
Exemplo n.º 2
0
int cliShowConfigurationCmd(CliMode mode, int argc, char **argv) {
	int no_passwords = 0;
	ASSERT(shm != NULL);

	// generate a temporary file
	char file_name[50] = "/opt/rcp/var/transport/cXXXXXX";
	int fd = mkstemp(file_name);
	if (fd == -1) {
		ASSERT(0)
		printf("Error: cannot create temporary file\n");
		return RCPERR;
	}
	close(fd);

	// open the file
	FILE *fp = fopen(file_name, "w");
	if (fp == NULL) {
		printf("Error: cannot open temporary file\n");
		return RCPERR;
	}

	if (argc == 3 && strcmp(argv[2], "no-passwords") == 0)
		no_passwords = 1;
		
	if (argc == 2 || (argc == 3 && no_passwords)) {
		// general configuration from services/config directory
		configLogger(fp, no_passwords);
		configDns(fp, no_passwords);
		configServices(fp, no_passwords);
		configAdministrators(fp, no_passwords);
		
		// ntp configuration
		configNtp(fp, no_passwords);
		
		// network monitoring and SNMP configuration
		configNetmon(fp, no_passwords);
		configSnmp(fp, no_passwords);

		// router configuration
		configArp(fp, no_passwords);
		configRoute(fp, no_passwords);
		configAcl(fp, no_passwords);
		configNat(fp, no_passwords);
		configIpsecTun(fp, no_passwords);

		// dhcp configuration
		configDhcp(fp, no_passwords);
		
		
		// rip configuration
		configRip(fp, no_passwords);
		
		// ospf configuration
		configOspf(fp, no_passwords);
	
		// print interfaces
		configInterfaces(fp, no_passwords);
	}
	else if (argc == 3) {
		if (strcmp(argv[2], "dns") == 0)
			configDns(fp, no_passwords);
		else if (strcmp(argv[2], "ntp") == 0)
			configNtp(fp, no_passwords);
		else if (strcmp(argv[2], "arp") == 0)
			configArp(fp, no_passwords);
		else if (strcmp(argv[2], "logger") == 0)
			configLogger(fp, no_passwords);
		else if (strcmp(argv[2], "administrators") == 0)
			configAdministrators(fp, no_passwords);
		else if (strcmp(argv[2], "services") == 0)
			configServices(fp, no_passwords);
		else if (strcmp(argv[2], "interfaces") == 0)
			configInterfaces(fp, no_passwords);
		else if (strcmp(argv[2], "acl") == 0)
			configAcl(fp, no_passwords);
		else if (strcmp(argv[2], "nat") == 0)
			configNat(fp, no_passwords);

		else if (strcmp(argv[2], "tunnel") == 0)
			configIpsecTun(fp, no_passwords);

		else if (strcmp(argv[2], "monitor") == 0)
			configNetmon(fp, no_passwords);
		else if (strcmp(argv[2], "snmp") == 0)
			configSnmp(fp, no_passwords);
		else if (strcmp(argv[2], "route") == 0)
			configRoute(fp, no_passwords);
		else if (strcmp(argv[2], "dhcp") == 0) {
			configDhcp(fp, no_passwords);
			configDhcpIf(fp, no_passwords);
		}
		else if (strcmp(argv[2], "rip") == 0)
			configRip(fp, no_passwords);
		else if (strcmp(argv[2], "ospf") == 0) {
			configOspf(fp, no_passwords);
			configOspfIf(fp, no_passwords);
		}
		else if (strcmp(argv[2], "no-passwords") == 0)
			;
		else
			ASSERT(0);
	}


	// close the file, print and delete it
	fclose(fp);
	cliPrintFile(file_name);
	unlink(file_name);
	
	return 0;
}