diff options
author | David Goulet <dgoulet@torproject.org> | 2016-05-31 14:51:30 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2016-11-04 10:29:26 -0400 |
commit | 8293356ad993e06c66e6b56534be91fb912c9b5a (patch) | |
tree | b7d5154e060674365df36be054b6112364f66432 /src/or/hs_common.h | |
parent | 8fe410e875343a4c134ddbe0db6da3d38865deee (diff) | |
download | tor-8293356ad993e06c66e6b56534be91fb912c9b5a.tar.gz tor-8293356ad993e06c66e6b56534be91fb912c9b5a.zip |
hs: Refactor rend_data_t for multi version support
In order to implement proposal 224, we need the data structure rend_data_t to
be able to accomodate versionning that is the current version of hidden
service (2) and the new version (3) and future version.
For that, we implement a series of accessors and a downcast function to get
the v2 data structure. rend_data_t becomes a top level generic place holder.
The entire rend_data_t API has been moved to hs_common.{c|h} in order to
seperate code that is shared from between HS versions and unshared code (in
rendcommon.c).
Closes #19024
Signed-off-by: David Goulet <dgoulet@torproject.org>
Signed-off-by: George Kadianakis <desnacked@riseup.net>
Diffstat (limited to 'src/or/hs_common.h')
-rw-r--r-- | src/or/hs_common.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/or/hs_common.h b/src/or/hs_common.h new file mode 100644 index 0000000000..e74fdc9f9e --- /dev/null +++ b/src/or/hs_common.h @@ -0,0 +1,34 @@ +/* Copyright (c) 2016, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +/** + * \file hs_common.h + * \brief Header file for hs_common.c. + **/ + +#ifndef TOR_HS_COMMON_H +#define TOR_HS_COMMON_H + +#include "or.h" + +/* Protocol version 2. Use this instead of hardcoding "2" in the code base, + * this adds a clearer semantic to the value when used. */ +#define HS_VERSION_TWO 2 + +void rend_data_free(rend_data_t *data); +rend_data_t *rend_data_dup(const rend_data_t *data); +rend_data_t *rend_data_client_create(const char *onion_address, + const char *desc_id, + const char *cookie, + rend_auth_type_t auth_type); +rend_data_t *rend_data_service_create(const char *onion_address, + const char *pk_digest, + const uint8_t *cookie, + rend_auth_type_t auth_type); +const char *rend_data_get_address(const rend_data_t *rend_data); +const char *rend_data_get_desc_id(const rend_data_t *rend_data, + uint8_t replica, size_t *len_out); +const uint8_t *rend_data_get_pk_digest(const rend_data_t *rend_data, + size_t *len_out); + +#endif /* TOR_HS_COMMON_H */ |