lib.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2009 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef GRUB_LIB_HEADER
  19. #define GRUB_LIB_HEADER 1
  20. #include <grub/types.h>
  21. #include <grub/file.h>
  22. #include <grub/err.h>
  23. #include <grub/term.h>
  24. /* The type of a completion item. */
  25. enum grub_completion_type
  26. {
  27. GRUB_COMPLETION_TYPE_COMMAND,
  28. GRUB_COMPLETION_TYPE_DEVICE,
  29. GRUB_COMPLETION_TYPE_PARTITION,
  30. GRUB_COMPLETION_TYPE_FILE,
  31. GRUB_COMPLETION_TYPE_ARGUMENT
  32. };
  33. typedef enum grub_completion_type grub_completion_type_t;
  34. /* Defined in `completion.c'. */
  35. char *grub_complete (char *buf, int *restore,
  36. void (*hook) (const char *item,
  37. grub_completion_type_t type,
  38. int count));
  39. /* Defined in `misc.c'. */
  40. void grub_wait_after_message (void);
  41. grub_err_t grub_print_device_info (const char *name);
  42. /* Defined in `print_ucs4.c'. */
  43. void grub_print_ucs4 (const grub_uint32_t * str,
  44. const grub_uint32_t * last_position,
  45. struct grub_term_output *term);
  46. /* Defined in `md5_password.c'. */
  47. /* If CHECK is true, check a password for correctness. Returns 0
  48. if password was correct, and a value != 0 for error, similarly
  49. to strcmp.
  50. If CHECK is false, crypt KEY and save the result in CRYPTED.
  51. CRYPTED must have a salt. */
  52. int grub_md5_password (const char *key, char *crypted, int check);
  53. /* For convenience. */
  54. #define grub_check_md5_password(key,crypted) \
  55. grub_md5_password((key), (crypted), 1)
  56. #define grub_make_md5_password(key,crypted) \
  57. grub_md5_password((key), (crypted), 0)
  58. /* Defined in `getline.c'. */
  59. char *grub_getline (grub_file_t file);
  60. #define GRUB_DEFAULT_HISTORY_SIZE 50
  61. /* Defined in `history.c'. */
  62. grub_err_t grub_history_init (int newsize);
  63. grub_uint32_t *grub_history_get (int pos);
  64. void grub_history_set (int pos, grub_uint32_t *s, grub_size_t len);
  65. void grub_history_add (grub_uint32_t *s, grub_size_t len);
  66. void grub_history_replace (int pos, grub_uint32_t *s, grub_size_t len);
  67. int grub_history_used (void);
  68. /* Defined in `crc.c'. */
  69. grub_uint32_t grub_getcrc32 (grub_uint32_t crc, void *buf, int size);
  70. /* Defined in `hexdump.c'. */
  71. void hexdump (unsigned long bse,char* buf,int len);
  72. /* Defined in `autolist.c'. */
  73. struct grub_autolist
  74. {
  75. struct grub_autolist *next;
  76. char *name;
  77. char *value;
  78. };
  79. typedef struct grub_autolist *grub_autolist_t;
  80. grub_autolist_t grub_autolist_load (const char *name);
  81. extern grub_autolist_t grub_autolist_font;
  82. #endif