- /*
- * Main.cpp
- *
- * Created on: 07-01-2017
- * Author: Piotr Dergun
- */
-
- #include "common.h"
- #include "Node.h"
- #include "NATRouter.h"
- #include "Simulation.h"
-
- void usage(string programName)
- {
- cerr << endl;
- cerr << "Usage:" << endl;
- cerr << programName << " p2p\t\t\tP2P simulation" << endl;
- cerr << programName << " nat <nodes>\t\tNAT overflow simulation" << endl;
- cerr << endl;
- exit(1);
- }
-
- int main(int argc, char *argv[])
- {
- char *endptr=NULL;
- int nodesCount;
-
- if (argc < 2)
- usage(argv[0]);
-
- if (!strcmp(argv[1], "p2p"))
- {
- Simulation sim;
- sim.createThread("timer", SIM_TIMER, &sim);
- sim.p2pSimulation();
- }
- else if (!strcmp(argv[1], "nat"))
- {
- if (argc < 3)
- usage(argv[0]);
-
- nodesCount = strtol(argv[2], &endptr, 10);
- if (nodesCount < 1 || nodesCount > 255)
- {
- cerr << "Invalid number of nodes format [1,255]" << endl;
- usage(argv[0]);
- }
-
- Simulation sim;
- //sim.createThread("timer", SIM_TIMER, &sim);
- sim.natOverflowSimulation(nodesCount);
- }
- else if (!strcmp(argv[1], "-v"))
- {
-
- }
- else
- usage(argv[0]);
-
- return 0;
- }
|