summaryrefslogtreecommitdiff
path: root/gnutls-helpers.h
blob: 1bf7a1d77cda6056ab5c1371fc26627ecb7d2d51 (plain)
  1. /* Author: Daniel Kahn Gillmor <dkg@fifthhorseman.net> */
  2. /* Date: Fri, 04 Apr 2008 19:31:16 -0400 */
  3. /* License: GPL v3 or later */
  4. #include <gnutls/gnutls.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <errno.h>
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #include <unistd.h>
  12. #include <stdarg.h>
  13. /* Functions to help dealing with GnuTLS for monkeysphere key
  14. translation projects: */
  15. /* set everything up, including logging levels. Return 0 on
  16. success */
  17. int init_gnutls();
  18. /* logging and output functions: */
  19. void err(const char* fmt, ...);
  20. void logfunc(int level, const char* string);
  21. /* basic datum manipulations: */
  22. void init_datum(gnutls_datum_t* d);
  23. void copy_datum(gnutls_datum_t* dest, const gnutls_datum_t* src);
  24. int compare_data(const gnutls_datum_t* a, const gnutls_datum_t* b);
  25. void free_datum(gnutls_datum_t* d);
  26. /* functions to get data into datum objects: */
  27. /* read the passed-in string, store in a single datum */
  28. int set_datum_string(gnutls_datum_t* d, const char* s);
  29. /* read the passed-in file descriptor until EOF, store in a single
  30. datum */
  31. int set_datum_fd(gnutls_datum_t* d, int fd);
  32. /* read the file indicated (by na1me) in the fname parameter. store
  33. its entire contents in a single datum. */
  34. int set_datum_file(gnutls_datum_t* d, const char* fname);