term_cmd.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef TERM_CMD__H
  2. #define TERM_CMD__H
  3. /**
  4. * Copyright (C) 2011 Anders Sundman <anders@4zm.org>
  5. *
  6. * This file is part of mfterm.
  7. *
  8. * mfterm is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. * mfterm is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. * You should have received a copy of the GNU General Public License
  17. * along with mfterm. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. typedef int (*cmd_func_t)(char*);
  20. // Print help command
  21. int com_help(char* arg);
  22. // Exit mfterm command
  23. int com_quit(char* arg);
  24. // Load/Save tag file operations
  25. int com_load_tag(char* arg);
  26. int com_save_tag(char* arg);
  27. // Clear (zero) tag command
  28. int com_clear_tag(char* arg);
  29. // Read/Write tag NFC operations
  30. int com_read_tag(char* arg);
  31. int com_read_tag_unlocked(char* arg);
  32. int com_write_tag(char* arg);
  33. int com_write_tag_unlocked(char* arg);
  34. // Tag print commands
  35. int com_print(char* arg);
  36. int com_print_keys(char* arg);
  37. int com_print_ac(char* arg);
  38. // Tag set (value) command
  39. int com_set(char* arg);
  40. // Key operations
  41. int com_keys_load(char* arg);
  42. int com_keys_save(char* arg);
  43. int com_keys_clear(char* arg);
  44. int com_keys_set(char* arg);
  45. int com_keys_import(char* arg);
  46. int com_keys_print(char* arg);
  47. int com_keys_test(char* arg);
  48. // Dictionary operations
  49. int com_dict_load(char* arg);
  50. int com_dict_clear(char* arg);
  51. int com_dict_attack(char* arg);
  52. int com_dict_print(char* arg);
  53. // Specification operations
  54. int com_spec_load(char* arg);
  55. int com_spec_clear(char* arg);
  56. int com_spec_print(char* arg);
  57. // MAC operations
  58. int com_mac_key_get_set(char* arg);
  59. int com_mac_block_compute(char* arg);
  60. int com_mac_block_update(char* arg);
  61. int com_mac_validate(char* arg);
  62. typedef struct {
  63. char *name; // The command
  64. cmd_func_t func; // Function to call on command
  65. int fn_arg; // File name completion if > 0
  66. int document; // Show in documentation if > 0
  67. char *doc; // String documenting the command
  68. } command_t;
  69. extern command_t commands[];
  70. // Lookup a command by name. Return a ptr to the command function, or
  71. // NULL if the command isn't found.
  72. command_t* find_command(const char *name);
  73. // Any command starting with '.' - path spec
  74. int exec_path_command(const char *line);
  75. #endif