unparseable.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Copyright (c) 2001 Matej Pfajfar.
  2. * Copyright (c) 2001-2004, Roger Dingledine.
  3. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  4. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. /**
  7. * \file unparseable.h
  8. * \brief Header file for unparseable.c.
  9. **/
  10. #ifndef TOR_UNPARSEABLE_H
  11. #define TOR_UNPARSEABLE_H
  12. #include "lib/cc/torint.h"
  13. MOCK_DECL(void,dump_desc,(const char *desc, const char *type));
  14. void dump_desc_fifo_cleanup(void);
  15. void dump_desc_init(void);
  16. #undef DEBUG_AREA_ALLOC
  17. #ifdef DEBUG_AREA_ALLOC
  18. #define DUMP_AREA(a,name) STMT_BEGIN \
  19. size_t alloc=0, used=0; \
  20. memarea_get_stats((a),&alloc,&used); \
  21. log_debug(LD_MM, "Area for %s has %lu allocated; using %lu.", \
  22. name, (unsigned long)alloc, (unsigned long)used); \
  23. STMT_END
  24. #else /* !(defined(DEBUG_AREA_ALLOC)) */
  25. #define DUMP_AREA(a,name) STMT_NIL
  26. #endif /* defined(DEBUG_AREA_ALLOC) */
  27. #ifdef UNPARSEABLE_PRIVATE
  28. /*
  29. * One entry in the list of dumped descriptors; filename dumped to, length,
  30. * SHA-256 and timestamp.
  31. */
  32. typedef struct {
  33. char *filename;
  34. size_t len;
  35. uint8_t digest_sha256[DIGEST256_LEN];
  36. time_t when;
  37. } dumped_desc_t;
  38. struct smartlist_t;
  39. EXTERN(uint64_t, len_descs_dumped)
  40. EXTERN(struct smartlist_t *, descs_dumped)
  41. MOCK_DECL(STATIC dumped_desc_t *, dump_desc_populate_one_file,
  42. (const char *dirname, const char *f));
  43. STATIC void dump_desc_populate_fifo_from_directory(const char *dirname);
  44. #endif
  45. #endif /* !defined(TOR_UNPARSEABLE_H) */