diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-02-14 23:23:53 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-02-14 23:23:53 -0500 |
commit | ac5ae794bd58aafcf0dddfaa09abd2184b11bbde (patch) | |
tree | d01293ef47c0b6a854984445de86f2d597fda066 /src/or/rendcommon.h | |
parent | c024ff86719c24958433974a86e982ddc5a982d4 (diff) | |
download | tor-ac5ae794bd58aafcf0dddfaa09abd2184b11bbde.tar.gz tor-ac5ae794bd58aafcf0dddfaa09abd2184b11bbde.zip |
tristate->enum in rendcommon functions
When we have more than two return values, we should really be using
an enum rather than "-2 means this, -1 means that, 0 means this, and
1 or more means a number."
Diffstat (limited to 'src/or/rendcommon.h')
-rw-r--r-- | src/or/rendcommon.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/or/rendcommon.h b/src/or/rendcommon.h index a955cfa327..07a47accfe 100644 --- a/src/or/rendcommon.h +++ b/src/or/rendcommon.h @@ -40,9 +40,17 @@ int rend_valid_service_id(const char *query); 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_v2_desc_as_client(const char *desc, +/** Return value from rend_cache_store_v2_desc_as_{dir,client}. */ +typedef enum { + RCS_NOTDIR = -2, /**< We're not a directory */ + RCS_BADDESC = -1, /**< This descriptor is no good. */ + RCS_OKAY = 0 /**< All worked as expected */ +} rend_cache_store_status_t; + +rend_cache_store_status_t rend_cache_store_v2_desc_as_dir(const char *desc); +rend_cache_store_status_t 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_encode_v2_descriptors(smartlist_t *descs_out, rend_service_descriptor_t *desc, time_t now, uint8_t period, rend_auth_type_t auth_type, |