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