Queue.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef QUEUE_H
  2. #define QUEUE_H
  3. #include <deque>
  4. #include <mutex>
  5. #include <string>
  6. #include "CovertChannel/ChannelControls.h"
  7. /**
  8. * Namespace wich manages the queue for the covert channel
  9. */
  10. namespace Queue {
  11. /**
  12. * Adds file to queue
  13. * @param file add file to queue
  14. */
  15. bool push(const std::string &file);
  16. /**
  17. * Remove file from queue. Checks if remove is allowed
  18. * @param file file to remove from queue
  19. */
  20. bool remove(const std::string &file);
  21. /**
  22. * Schedules one file to be transfered over the covert channel.
  23. * schedule() must be called again to send the next file.
  24. */
  25. void schedule();
  26. /**
  27. * Returns the name of the file of the current transfer. Empty otherwise.
  28. * @return file name
  29. */
  30. std::string curTransfer();
  31. /**
  32. * The queue. Stores filenames. Acts as FIFO.
  33. */
  34. extern std::deque<std::string> queue;
  35. /**
  36. * Mutex to lock queue while editing it.
  37. */
  38. extern std::mutex mtx;
  39. /**
  40. * Covert channel which will be used to send files.
  41. */
  42. extern ChannelControls *channel;
  43. }; // namespace Queue
  44. #endif // QUEUE_H