]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add rendcache.{c|h}
authorDavid Goulet <dgoulet@ev0ke.net>
Thu, 18 Jun 2015 15:00:10 +0000 (11:00 -0400)
committerDavid Goulet <dgoulet@ev0ke.net>
Thu, 18 Jun 2015 16:56:24 +0000 (12:56 -0400)
For now, rend_cache_entry_t has been moved from or.h to rendcache.h and
those files have been added to the build system.

In the next commit, these will contain hidden service descriptor cache ABI
and API for both client and directory side. The goal is to consolidate the
descriptor caches in one location to ease development, maintenance, review
and improve documentation for each cache behavior and algorithm.

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
src/or/include.am
src/or/or.h
src/or/rendcache.c [new file with mode: 0644]
src/or/rendcache.h [new file with mode: 0644]
src/or/rendclient.h
src/or/rendcommon.h

index 6bbf78871c6177b3a47317c63605f08f82134129..af3336547fedbd498d9c411ab05615c937e55ded 100644 (file)
@@ -66,6 +66,7 @@ LIBTOR_A_SOURCES = \
        src/or/policies.c                               \
        src/or/reasons.c                                \
        src/or/relay.c                                  \
+       src/or/rendcache.c                              \
        src/or/rendclient.c                             \
        src/or/rendcommon.c                             \
        src/or/rendmid.c                                \
@@ -174,6 +175,7 @@ ORHEADERS = \
        src/or/policies.h                               \
        src/or/reasons.h                                \
        src/or/relay.h                                  \
+       src/or/rendcache.h                              \
        src/or/rendclient.h                             \
        src/or/rendcommon.h                             \
        src/or/rendmid.h                                \
index 9e7b7534fb990c34eab3e44e58856797ed758ece..d3a476ecf95900768e5998eafa1a2a5247ebedd2 100644 (file)
@@ -4970,15 +4970,6 @@ typedef struct rend_service_descriptor_t {
   smartlist_t *successful_uploads;
 } rend_service_descriptor_t;
 
-/** A cached rendezvous descriptor. */
-typedef struct rend_cache_entry_t {
-  size_t len; /**< Length of <b>desc</b> */
-  time_t last_served; /**< When did we last write this one to somebody?
-                       * (HSDir only) */
-  char *desc; /**< Service descriptor */
-  rend_service_descriptor_t *parsed; /**< Parsed value of 'desc' */
-} rend_cache_entry_t;
-
 /********************************* routerlist.c ***************************/
 
 /** Represents information about a single trusted or fallback directory
diff --git a/src/or/rendcache.c b/src/or/rendcache.c
new file mode 100644 (file)
index 0000000..758d7e6
--- /dev/null
@@ -0,0 +1,9 @@
+/* Copyright (c) 2015, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file rendcache.c
+ * \brief Hidden service desriptor cache.
+ **/
+
+#include "rendcache.h"
diff --git a/src/or/rendcache.h b/src/or/rendcache.h
new file mode 100644 (file)
index 0000000..1b78436
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copyright (c) 2015, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file rendcache.h
+ * \brief Header file for rendcache.c
+ **/
+
+#ifndef TOR_RENDCACHE_H
+#define TOR_RENDCACHE_H
+
+#include "or.h"
+
+/** A cached rendezvous descriptor. */
+typedef struct rend_cache_entry_t {
+  size_t len; /**< Length of <b>desc</b> */
+  time_t last_served; /**< When did we last write this one to somebody?
+                       * (HSDir only) */
+  char *desc; /**< Service descriptor */
+  rend_service_descriptor_t *parsed; /**< Parsed value of 'desc' */
+} rend_cache_entry_t;
+
+#endif /* TOR_RENDCACHE_H */
index 6118924e1d169450c60a7d1bdbbe0db49d0a18fc..439f42875bf3452f793dd9566b46b6e312f4d21b 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef TOR_RENDCLIENT_H
 #define TOR_RENDCLIENT_H
 
+#include "rendcache.h"
+
 void rend_client_purge_state(void);
 
 void rend_client_introcirc_has_opened(origin_circuit_t *circ);
index 0ed7adc71042c2fadad8a4c9426313ebcb40333a..c6f2b8eac97edf66307cada3b8fc64dd1aac566b 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef TOR_RENDCOMMON_H
 #define TOR_RENDCOMMON_H
 
+#include "rendcache.h"
+
 /** Free all storage associated with <b>data</b> */
 static INLINE void
 rend_data_free(rend_data_t *data)