Symulacja NAT na przedmiot Symulacje Komputerowe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
763 B

  1. /*
  2. * Simulation.h
  3. *
  4. * Created on: 16.01.2017
  5. * Author: piotrek
  6. */
  7. #ifndef SIMULATION_H_
  8. #define SIMULATION_H_
  9. #include "common.h"
  10. #include "Log.h"
  11. enum THREAD_TYPE
  12. {
  13. NODE_RECV,
  14. SIM_TIMER,
  15. SIM_RESIZE,
  16. NAT_FP,
  17. };
  18. struct threadParams
  19. {
  20. THREAD_TYPE type;
  21. void *context;
  22. pthread_t thread_id;
  23. };
  24. class Simulation : public Log
  25. {
  26. map<string, struct threadParams> threads;
  27. int cols, rows;
  28. string name;
  29. unsigned long startTime;
  30. public:
  31. Simulation();
  32. ~Simulation();
  33. void createThread(string name, THREAD_TYPE type, void * context);
  34. void destroyThread(string name);
  35. static void * threadWrapper(void * context);
  36. void resizeWnd();
  37. void timer();
  38. void p2pSimulation();
  39. void natOverflowSimulation(int nNodes);
  40. };
  41. #endif /* SIMULATION_H_ */