Tor  0.4.7.0-alpha-dev
unparseable.h
Go to the documentation of this file.
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)
50 
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) */
#define DIGEST256_LEN
Definition: digest_sizes.h:23
#define STATIC
Definition: testsupport.h:32
#define MOCK_DECL(rv, funcname, arglist)
Definition: testsupport.h:127
#define EXTERN(type, name)
Definition: testsupport.h:51
Integer definitions used throughout Tor.
STATIC void dump_desc_populate_fifo_from_directory(const char *dirname)
Definition: unparseable.c:426
STATIC smartlist_t * descs_dumped
Definition: unparseable.c:26
STATIC dumped_desc_t * dump_desc_populate_one_file(const char *dirname, const char *f)
Definition: unparseable.c:260
STATIC uint64_t len_descs_dumped
Definition: unparseable.c:28
void dump_desc_fifo_cleanup(void)
Definition: unparseable.c:239
void dump_desc(const char *desc, const char *type)
Definition: unparseable.c:496
void dump_desc_init(void)
Definition: unparseable.c:38