commands.hpp 550 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef COMMANDS_HPP
  2. #define COMMANDS_HPP
  3. #include <cstring>
  4. #include <cctype>
  5. #define COMMANDLEN 10
  6. #define sizeofarr(a) (sizeof(a) / sizeof(a[0]))
  7. typedef enum {
  8. CMD_HELP,
  9. CMD_CONNECT,
  10. CMD_DISCONNECT,
  11. CMD_PUT,
  12. CMD_REMOVE,
  13. CMD_GET,
  14. CMD_STATUS,
  15. CMD_SETUP,
  16. CMD_LOG,
  17. CMD_UNKNOWN
  18. } COMMANDID;
  19. typedef struct {
  20. COMMANDID cmd;
  21. const char *name;
  22. const char *desc;
  23. } CMD;
  24. extern CMD commands[];
  25. COMMANDID getCmdIdFromString(const char *str);
  26. const char *getCmdStringFromId(COMMANDID id);
  27. // TODO
  28. void printCmds(void);
  29. #endif