Browse Source

hs: Rename rend_service_add_ephemeral_status_t

Move it to hs_common.h and rename it "hs_service_add_ephemeral_status_t". It
will be shared between v2 and v3 services.

Part of #20699

Signed-off-by: David Goulet <dgoulet@torproject.org>
David Goulet 6 years ago
parent
commit
5d180309ea
4 changed files with 16 additions and 14 deletions
  1. 2 2
      src/or/control.c
  2. 11 0
      src/or/hs_common.h
  3. 2 2
      src/or/rendservice.c
  4. 1 10
      src/or/rendservice.h

+ 2 - 2
src/or/control.c

@@ -4433,13 +4433,13 @@ handle_control_hspost(control_connection_t *conn,
  * On success (RSAE_OKAY), the address_out points to a newly allocated string
  * containing the onion address without the .onion part. On error, address_out
  * is untouched. */
-static rend_service_add_ephemeral_status_t
+static hs_service_add_ephemeral_status_t
 add_onion_helper_add_service(int hs_version, void *pk, smartlist_t *port_cfgs,
                              int max_streams, int max_streams_close_circuit,
                              int auth_type, smartlist_t *auth_clients,
                              char **address_out)
 {
-  rend_service_add_ephemeral_status_t ret;
+  hs_service_add_ephemeral_status_t ret;
 
   tor_assert(pk);
   tor_assert(port_cfgs);

+ 11 - 0
src/or/hs_common.h

@@ -130,6 +130,17 @@ typedef enum {
   HS_AUTH_KEY_TYPE_ED25519 = 2,
 } hs_auth_key_type_t;
 
+/* Return value when adding an ephemeral service through the ADD_ONION
+ * control port command. Both v2 and v3 share these. */
+typedef enum {
+  RSAE_BADAUTH     = -5, /**< Invalid auth_type/auth_clients */
+  RSAE_BADVIRTPORT = -4, /**< Invalid VIRTPORT/TARGET(s) */
+  RSAE_ADDREXISTS  = -3, /**< Onion address collision */
+  RSAE_BADPRIVKEY  = -2, /**< Invalid public key */
+  RSAE_INTERNAL    = -1, /**< Internal error */
+  RSAE_OKAY        = 0   /**< Service added as expected */
+} hs_service_add_ephemeral_status_t;
+
 /* Represents the mapping from a virtual port of a rendezvous service to a
  * real port on some IP. */
 typedef struct rend_service_port_config_t {

+ 2 - 2
src/or/rendservice.c

@@ -847,9 +847,9 @@ rend_config_service(const config_line_t *line_,
  * after calling this routine, and may assume that correct cleanup has
  * been done on failure.
  *
- * Return an appropriate rend_service_add_ephemeral_status_t.
+ * Return an appropriate hs_service_add_ephemeral_status_t.
  */
-rend_service_add_ephemeral_status_t
+hs_service_add_ephemeral_status_t
 rend_service_add_ephemeral(crypto_pk_t *pk,
                            smartlist_t *ports,
                            int max_streams_per_circuit,

+ 1 - 10
src/or/rendservice.h

@@ -187,16 +187,7 @@ void rend_service_port_config_free(rend_service_port_config_t *p);
 
 void rend_authorized_client_free(rend_authorized_client_t *client);
 
-/** Return value from rend_service_add_ephemeral. */
-typedef enum {
-  RSAE_BADAUTH = -5, /**< Invalid auth_type/auth_clients */
-  RSAE_BADVIRTPORT = -4, /**< Invalid VIRTPORT/TARGET(s) */
-  RSAE_ADDREXISTS = -3, /**< Onion address collision */
-  RSAE_BADPRIVKEY = -2, /**< Invalid public key */
-  RSAE_INTERNAL = -1, /**< Internal error */
-  RSAE_OKAY = 0 /**< Service added as expected */
-} rend_service_add_ephemeral_status_t;
-rend_service_add_ephemeral_status_t rend_service_add_ephemeral(crypto_pk_t *pk,
+hs_service_add_ephemeral_status_t rend_service_add_ephemeral(crypto_pk_t *pk,
                                smartlist_t *ports,
                                int max_streams_per_circuit,
                                int max_streams_close_circuit,