The Poor Man's (or Woman's) Intrusion Detection System
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.
 
 
 
 

61 lines
1.7 KiB

  1. //////////////////////////////////////////////////////////////////////
  2. // IP traffic analyzer - configuration file
  3. // Written by Jonathan A. Foster <jon@jfpossibilities.com>
  4. // Started May 14th, 2021
  5. // Copyright JF Possibilities, Inc. All rights reserved.
  6. //
  7. // This class reads and holds configuration data for "iptraffic". The
  8. // file is basically an INI format with '#' for remarks instead of ';'
  9. // and sections can be lists, not just name/value pairs. In fact this
  10. // first version is strictly only lists.
  11. //////////////////////////////////////////////////////////////////////
  12. #ifndef __JFP_IPTRAFFIC_CONF_H__
  13. #define __JFP_IPTRAFFIC_CONF_H__
  14. #include <string>
  15. #include <ostream>
  16. #include "data.h"
  17. #include "miniini.h"
  18. #include "strutil.h"
  19. //////////////////////////////////////////////////////////////////////
  20. // INI group parser for "us" records
  21. //
  22. // This is mostly "raw lines" but we need to throw out remarks and WS.
  23. //////////////////////////////////////////////////////////////////////
  24. struct INIusList: public MiniINIlines {
  25. void add(const std::string &in);
  26. };
  27. //////////////////////////////////////////////////////////////////////
  28. // INI group parser for "ignore" records
  29. //////////////////////////////////////////////////////////////////////
  30. struct INIconnList: public MiniINIgroup {
  31. ConnList vals;
  32. // Read records
  33. void add(const std::string &in);
  34. // Write records
  35. std::ostream &save(std::ostream &out) const;
  36. };
  37. //////////////////////////////////////////////////////////////////////
  38. // INI based Configuration container for IPtraffic
  39. //////////////////////////////////////////////////////////////////////
  40. struct Config: public MiniINI {
  41. INIusList us;
  42. INIconnList ignores;
  43. Config();
  44. };
  45. #endif