command_options.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #ifndef __COMMAND_OPTIONS_H
  15. #define __COMMAND_OPTIONS_H
  16. namespace isc {
  17. namespace perfdhcp {
  18. /// \brief Command Options
  19. ///
  20. /// This class is responsible for parsing the command-line and storing the
  21. /// specified options.
  22. ///
  23. class CommandOptions {
  24. public:
  25. /// \brief Default Constructor
  26. ///
  27. /// Set values to defaults.
  28. CommandOptions() {
  29. reset();
  30. }
  31. /// \brief Reset to defaults
  32. ///
  33. /// Resets the CommandOptions object to default values.
  34. void reset();
  35. /// \brief Parse command line
  36. ///
  37. /// Parses the command line and stores the selected options.
  38. ///
  39. /// \param argc Argument count passed to main().
  40. /// \param argv Argument value array passed to main().
  41. void parse(int argc, char* const argv[]);
  42. /// \brief Returns IP version
  43. ///
  44. /// \return IP version to be used
  45. uint8_t getIpVersion() const { return ipversion_; }
  46. /// \brief Print usage
  47. ///
  48. /// Prints perfdhcp usage
  49. void usage(void);
  50. private:
  51. uint8_t ipversion_;
  52. };
  53. } // namespace perfdhcp
  54. } // namespace isc
  55. #endif // __COMMAND_OPTIONS_H