[or-cvs] [tor/master 06/40] Create rendcommon.h

nickm at torproject.org nickm at torproject.org
Fri Jul 30 01:56:56 UTC 2010


Author: Sebastian Hahn <sebastian at torproject.org>
Date: Wed, 21 Jul 2010 17:52:54 +0200
Subject: Create rendcommon.h
Commit: 31e81439e164aa1d098bae3914b6013ed2c3569a

---
 src/or/circuitlist.c     |    1 +
 src/or/circuituse.c      |    1 +
 src/or/connection.c      |    1 +
 src/or/connection_edge.c |    1 +
 src/or/directory.c       |    1 +
 src/or/main.c            |    1 +
 src/or/or.h              |   48 ----------------------------------
 src/or/relay.c           |    1 +
 src/or/rendclient.c      |    1 +
 src/or/rendcommon.c      |    1 +
 src/or/rendcommon.h      |   64 ++++++++++++++++++++++++++++++++++++++++++++++
 src/or/rendservice.c     |    1 +
 src/or/routerlist.c      |    1 +
 src/or/routerparse.c     |    1 +
 src/test/test.c          |    1 +
 15 files changed, 77 insertions(+), 48 deletions(-)
 create mode 100644 src/or/rendcommon.h

diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index cc33fcb..2de5b4e 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -10,6 +10,7 @@
  **/
 
 #include "or.h"
+#include "rendcommon.h"
 #include "routerlist.h"
 #include "ht.h"
 
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 753ae7b..c76cbd4 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -10,6 +10,7 @@
  **/
 
 #include "or.h"
+#include "rendcommon.h"
 #include "router.h"
 #include "routerlist.h"
 
diff --git a/src/or/connection.c b/src/or/connection.c
index c0e4f38..2a3cdab 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -13,6 +13,7 @@
 #include "or.h"
 #include "dnsserv.h"
 #include "geoip.h"
+#include "rendcommon.h"
 #include "router.h"
 
 static connection_t *connection_create_listener(
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 8c63d51..ee271ec 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -11,6 +11,7 @@
 
 #include "or.h"
 #include "dnsserv.h"
+#include "rendcommon.h"
 #include "router.h"
 #include "routerlist.h"
 
diff --git a/src/or/directory.c b/src/or/directory.c
index 1e31169..d81a3db 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -5,6 +5,7 @@
 
 #include "or.h"
 #include "geoip.h"
+#include "rendcommon.h"
 #include "router.h"
 #include "routerlist.h"
 
diff --git a/src/or/main.c b/src/or/main.c
index 271d6fe..12f1c9e 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -14,6 +14,7 @@
 #include "or.h"
 #include "dnsserv.h"
 #include "geoip.h"
+#include "rendcommon.h"
 #include "router.h"
 #include "routerlist.h"
 #ifdef USE_DMALLOC
diff --git a/src/or/or.h b/src/or/or.h
index e9fd5b1..d1c15e2 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -4679,26 +4679,6 @@ typedef struct rend_service_descriptor_t {
   smartlist_t *successful_uploads;
 } rend_service_descriptor_t;
 
-/** Free all storage associated with <b>data</b> */
-static INLINE void
-rend_data_free(rend_data_t *data)
-{
-  tor_free(data);
-}
-
-int rend_cmp_service_ids(const char *one, const char *two);
-
-void rend_process_relay_cell(circuit_t *circ, const crypt_path_t *layer_hint,
-                             int command, size_t length, const char *payload);
-
-void rend_service_descriptor_free(rend_service_descriptor_t *desc);
-rend_service_descriptor_t *rend_parse_service_descriptor(const char *str,
-                                                         size_t len);
-int rend_get_service_id(crypto_pk_env_t *pk, char *out);
-void rend_encoded_v2_service_descriptor_free(
-                               rend_encoded_v2_service_descriptor_t *desc);
-void rend_intro_point_free(rend_intro_point_t *intro);
-
 /** A cached rendezvous descriptor. */
 typedef struct rend_cache_entry_t {
   size_t len; /**< Length of <b>desc</b> */
@@ -4707,34 +4687,6 @@ typedef struct rend_cache_entry_t {
   rend_service_descriptor_t *parsed; /**< Parsed value of 'desc' */
 } rend_cache_entry_t;
 
-void rend_cache_init(void);
-void rend_cache_clean(void);
-void rend_cache_clean_v2_descs_as_dir(void);
-void rend_cache_free_all(void);
-int rend_valid_service_id(const char *query);
-int rend_cache_lookup_desc(const char *query, int version, const char **desc,
-                           size_t *desc_len);
-int rend_cache_lookup_entry(const char *query, int version,
-                            rend_cache_entry_t **entry_out);
-int rend_cache_lookup_v2_desc_as_dir(const char *query, const char **desc);
-int rend_cache_store(const char *desc, size_t desc_len, int published);
-int rend_cache_store_v2_desc_as_client(const char *desc,
-                                       const rend_data_t *rend_query);
-int rend_cache_store_v2_desc_as_dir(const char *desc);
-int rend_cache_size(void);
-int rend_encode_v2_descriptors(smartlist_t *descs_out,
-                               rend_service_descriptor_t *desc, time_t now,
-                               uint8_t period, rend_auth_type_t auth_type,
-                               crypto_pk_env_t *client_key,
-                               smartlist_t *client_cookies);
-int rend_compute_v2_desc_id(char *desc_id_out, const char *service_id,
-                            const char *descriptor_cookie,
-                            time_t now, uint8_t replica);
-int rend_id_is_in_interval(const char *a, const char *b, const char *c);
-void rend_get_descriptor_id_bytes(char *descriptor_id_out,
-                                  const char *service_id,
-                                  const char *secret_id_part);
-
 /********************************* rendservice.c ***************************/
 
 int num_rend_services(void);
diff --git a/src/or/relay.c b/src/or/relay.c
index d227bdf..2b0a7d3 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -14,6 +14,7 @@
 #include "or.h"
 #include "geoip.h"
 #include "mempool.h"
+#include "rendcommon.h"
 #include "routerlist.h"
 
 static int relay_crypt(circuit_t *circ, cell_t *cell,
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 0a9f483..880182f 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -8,6 +8,7 @@
  **/
 
 #include "or.h"
+#include "rendcommon.h"
 #include "routerlist.h"
 
 /** Called when we've established a circuit to an introduction point:
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 4af0415..891973d 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -9,6 +9,7 @@
  **/
 
 #include "or.h"
+#include "rendcommon.h"
 #include "routerlist.h"
 
 /** Return 0 if one and two are the same service ids, else -1 or 1 */
diff --git a/src/or/rendcommon.h b/src/or/rendcommon.h
new file mode 100644
index 0000000..5d60c22
--- /dev/null
+++ b/src/or/rendcommon.h
@@ -0,0 +1,64 @@
+/* Copyright (c) 2001 Matej Pfajfar.
+ * Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2010, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file rendcommon.h
+ * \brief Header file for common rend functions
+ **/
+
+#ifndef _TOR_RENDCOMMON_H
+#define _TOR_RENDCOMMON_H
+
+/** Free all storage associated with <b>data</b> */
+static INLINE void
+rend_data_free(rend_data_t *data)
+{
+  tor_free(data);
+}
+
+int rend_cmp_service_ids(const char *one, const char *two);
+
+void rend_process_relay_cell(circuit_t *circ, const crypt_path_t *layer_hint,
+                             int command, size_t length, const char *payload);
+
+void rend_service_descriptor_free(rend_service_descriptor_t *desc);
+rend_service_descriptor_t *rend_parse_service_descriptor(const char *str,
+                                                         size_t len);
+int rend_get_service_id(crypto_pk_env_t *pk, char *out);
+void rend_encoded_v2_service_descriptor_free(
+                               rend_encoded_v2_service_descriptor_t *desc);
+void rend_intro_point_free(rend_intro_point_t *intro);
+
+void rend_cache_init(void);
+void rend_cache_clean(void);
+void rend_cache_clean_v2_descs_as_dir(void);
+void rend_cache_free_all(void);
+int rend_valid_service_id(const char *query);
+int rend_cache_lookup_desc(const char *query, int version, const char **desc,
+                           size_t *desc_len);
+int rend_cache_lookup_entry(const char *query, int version,
+                            rend_cache_entry_t **entry_out);
+int rend_cache_lookup_v2_desc_as_dir(const char *query, const char **desc);
+int rend_cache_store(const char *desc, size_t desc_len, int published);
+int rend_cache_store_v2_desc_as_client(const char *desc,
+                                       const rend_data_t *rend_query);
+int rend_cache_store_v2_desc_as_dir(const char *desc);
+int rend_cache_size(void);
+int rend_encode_v2_descriptors(smartlist_t *descs_out,
+                               rend_service_descriptor_t *desc, time_t now,
+                               uint8_t period, rend_auth_type_t auth_type,
+                               crypto_pk_env_t *client_key,
+                               smartlist_t *client_cookies);
+int rend_compute_v2_desc_id(char *desc_id_out, const char *service_id,
+                            const char *descriptor_cookie,
+                            time_t now, uint8_t replica);
+int rend_id_is_in_interval(const char *a, const char *b, const char *c);
+void rend_get_descriptor_id_bytes(char *descriptor_id_out,
+                                  const char *service_id,
+                                  const char *secret_id_part);
+
+#endif
+
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index c7dc3c9..ce37a47 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -8,6 +8,7 @@
  **/
 
 #include "or.h"
+#include "rendcommon.h"
 #include "router.h"
 #include "routerlist.h"
 
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index b4803e9..02480af 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -13,6 +13,7 @@
 
 #include "or.h"
 #include "geoip.h"
+#include "rendcommon.h"
 #include "router.h"
 #include "routerlist.h"
 
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 760f876..1a770c8 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -10,6 +10,7 @@
  **/
 
 #include "or.h"
+#include "rendcommon.h"
 #include "router.h"
 #include "routerlist.h"
 #include "memarea.h"
diff --git a/src/test/test.c b/src/test/test.c
index b8b26b3..6cf9ea0 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -44,6 +44,7 @@ double fabs(double x);
 
 #include "or.h"
 #include "geoip.h"
+#include "rendcommon.h"
 #include "test.h"
 #include "torgzip.h"
 #include "mempool.h"
-- 
1.7.1




More information about the tor-commits mailing list