pr29.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* pr29.h --- Detect strings which are non-idempotent under NFKC.
  2. Copyright (C) 2004-2024 Simon Josefsson
  3. This file is part of GNU Libidn.
  4. GNU Libidn is free software: you can redistribute it and/or
  5. modify it under the terms of either:
  6. * the GNU Lesser General Public License as published by the Free
  7. Software Foundation; either version 3 of the License, or (at
  8. your option) any later version.
  9. or
  10. * the GNU General Public License as published by the Free
  11. Software Foundation; either version 2 of the License, or (at
  12. your option) any later version.
  13. or both in parallel, as here.
  14. GNU Libidn is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. General Public License for more details.
  18. You should have received copies of the GNU General Public License and
  19. the GNU Lesser General Public License along with this program. If
  20. not, see <https://www.gnu.org/licenses/>. */
  21. #ifndef PR29_H
  22. # define PR29_H
  23. /**
  24. * SECTION:pr29
  25. * @title: pr29.h
  26. * @short_description: PR29-related functions
  27. *
  28. * PR29-related functions.
  29. */
  30. # ifndef IDNAPI
  31. # define IDNAPI
  32. # endif
  33. # ifdef __cplusplus
  34. extern "C"
  35. {
  36. # endif
  37. /* Get size_t. */
  38. # include <stdlib.h>
  39. /* Get uint32_t. */
  40. # include <idn-int.h>
  41. /* Error codes. */
  42. typedef enum
  43. {
  44. PR29_SUCCESS = 0,
  45. PR29_PROBLEM = 1, /* String is a problem sequence. */
  46. PR29_STRINGPREP_ERROR = 2 /* Charset conversion failed (p29_8*). */
  47. } Pr29_rc;
  48. extern IDNAPI const char *pr29_strerror (Pr29_rc rc);
  49. extern IDNAPI int pr29_4 (const uint32_t * in, size_t len);
  50. extern IDNAPI int pr29_4z (const uint32_t * in);
  51. extern IDNAPI int pr29_8z (const char *in);
  52. # ifdef __cplusplus
  53. }
  54. # endif
  55. #endif /* PR29_H */