[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] hs_service.c: repair doxygen comments



commit ca26ea03fcd3fbe1c9d0f10b751bed4c3a98719d
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Oct 16 11:26:20 2019 -0400

    hs_service.c: repair doxygen comments
---
 src/feature/hs/hs_service.c | 231 ++++++++++++++++++++++----------------------
 1 file changed, 116 insertions(+), 115 deletions(-)

diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c
index 18c38ebc0..15db5dd1d 100644
--- a/src/feature/hs/hs_service.c
+++ b/src/feature/hs/hs_service.c
@@ -67,7 +67,7 @@
 #include <unistd.h>
 #endif
 
-/* Helper macro. Iterate over every service in the global map. The var is the
+/** Helper macro. Iterate over every service in the global map. The var is the
  * name of the service pointer. */
 #define FOR_EACH_SERVICE_BEGIN(var)                          \
     STMT_BEGIN                                               \
@@ -76,7 +76,7 @@
       var = *var##_iter;
 #define FOR_EACH_SERVICE_END } STMT_END ;
 
-/* Helper macro. Iterate over both current and previous descriptor of a
+/** Helper macro. Iterate over both current and previous descriptor of a
  * service. The var is the name of the descriptor pointer. This macro skips
  * any descriptor object of the service that is NULL. */
 #define FOR_EACH_DESCRIPTOR_BEGIN(service, var)                  \
@@ -95,7 +95,7 @@ static const char dname_client_pubkeys[] = "authorized_clients";
 static const char fname_hostname[] = "hostname";
 static const char address_tld[] = "onion";
 
-/* Staging list of service object. When configuring service, we add them to
+/** Staging list of service object. When configuring service, we add them to
  * this list considered a staging area and they will get added to our global
  * map once the keys have been loaded. These two steps are separated because
  * loading keys requires that we are an actual running tor process. */
@@ -118,7 +118,7 @@ static int service_encode_descriptor(const hs_service_t *service,
                                      const ed25519_keypair_t *signing_kp,
                                      char **encoded_out);
 
-/* Helper: Function to compare two objects in the service map. Return 1 if the
+/** Helper: Function to compare two objects in the service map. Return 1 if the
  * two service have the same master public identity key. */
 static inline int
 hs_service_ht_eq(const hs_service_t *first, const hs_service_t *second)
@@ -130,7 +130,7 @@ hs_service_ht_eq(const hs_service_t *first, const hs_service_t *second)
                            &second->keys.identity_pk);
 }
 
-/* Helper: Function for the service hash table code below. The key used is the
+/** Helper: Function for the service hash table code below. The key used is the
  * master public identity key which is ultimately the onion address. */
 static inline unsigned int
 hs_service_ht_hash(const hs_service_t *service)
@@ -140,7 +140,7 @@ hs_service_ht_hash(const hs_service_t *service)
                                    sizeof(service->keys.identity_pk.pubkey));
 }
 
-/* This is _the_ global hash map of hidden services which indexed the service
+/** This is _the_ global hash map of hidden services which indexed the service
  * contained in it by master public identity key which is roughly the onion
  * address of the service. */
 static struct hs_service_ht *hs_service_map;
@@ -156,7 +156,7 @@ HT_GENERATE2(hs_service_ht, hs_service_t, hs_service_node,
              hs_service_ht_hash, hs_service_ht_eq,
              0.6, tor_reallocarray, tor_free_)
 
-/* Query the given service map with a public key and return a service object
+/** Query the given service map with a public key and return a service object
  * if found else NULL. It is also possible to set a directory path in the
  * search query. If pk is NULL, then it will be set to zero indicating the
  * hash table to compare the directory path instead. */
@@ -171,7 +171,7 @@ find_service(hs_service_ht *map, const ed25519_public_key_t *pk)
   return HT_FIND(hs_service_ht, map, &dummy_service);
 }
 
-/* Register the given service in the given map. If the service already exists
+/** Register the given service in the given map. If the service already exists
  * in the map, -1 is returned. On success, 0 is returned and the service
  * ownership has been transferred to the global map. */
 STATIC int
@@ -196,7 +196,7 @@ register_service(hs_service_ht *map, hs_service_t *service)
   return 0;
 }
 
-/* Remove a given service from the given map. If service is NULL or the
+/** Remove a given service from the given map. If service is NULL or the
  * service key is unset, return gracefully. */
 STATIC void
 remove_service(hs_service_ht *map, hs_service_t *service)
@@ -226,7 +226,7 @@ remove_service(hs_service_ht *map, hs_service_t *service)
   }
 }
 
-/* Set the default values for a service configuration object <b>c</b>. */
+/** Set the default values for a service configuration object <b>c</b>. */
 static void
 set_service_default_config(hs_service_config_t *c,
                            const or_options_t *options)
@@ -247,7 +247,7 @@ set_service_default_config(hs_service_config_t *c,
   c->intro_dos_burst_per_sec = HS_CONFIG_V3_DOS_DEFENSE_BURST_PER_SEC_DEFAULT;
 }
 
-/* From a service configuration object config, clear everything from it
+/** From a service configuration object config, clear everything from it
  * meaning free allocated pointers and reset the values. */
 STATIC void
 service_clear_config(hs_service_config_t *config)
@@ -269,7 +269,7 @@ service_clear_config(hs_service_config_t *config)
   memset(config, 0, sizeof(*config));
 }
 
-/* Helper function to return a human readable description of the given intro
+/** Helper function to return a human readable description of the given intro
  * point object.
  *
  * This function is not thread-safe. Each call to this invalidates the
@@ -301,7 +301,7 @@ describe_intro_point(const hs_service_intro_point_t *ip)
   return buf;
 }
 
-/* Return the lower bound of maximum INTRODUCE2 cells per circuit before we
+/** Return the lower bound of maximum INTRODUCE2 cells per circuit before we
  * rotate intro point (defined by a consensus parameter or the default
  * value). */
 static int32_t
@@ -314,7 +314,7 @@ get_intro_point_min_introduce2(void)
                                  0, INT32_MAX);
 }
 
-/* Return the upper bound of maximum INTRODUCE2 cells per circuit before we
+/** Return the upper bound of maximum INTRODUCE2 cells per circuit before we
  * rotate intro point (defined by a consensus parameter or the default
  * value). */
 static int32_t
@@ -327,8 +327,8 @@ get_intro_point_max_introduce2(void)
                                  0, INT32_MAX);
 }
 
-/* Return the minimum lifetime in seconds of an introduction point defined by a
- * consensus parameter or the default value. */
+/** Return the minimum lifetime in seconds of an introduction point defined by
+ * a consensus parameter or the default value. */
 static int32_t
 get_intro_point_min_lifetime(void)
 {
@@ -344,8 +344,8 @@ get_intro_point_min_lifetime(void)
                                  0, INT32_MAX);
 }
 
-/* Return the maximum lifetime in seconds of an introduction point defined by a
- * consensus parameter or the default value. */
+/** Return the maximum lifetime in seconds of an introduction point defined by
+ * a consensus parameter or the default value. */
 static int32_t
 get_intro_point_max_lifetime(void)
 {
@@ -361,7 +361,7 @@ get_intro_point_max_lifetime(void)
                                  0, INT32_MAX);
 }
 
-/* Return the number of extra introduction point defined by a consensus
+/** Return the number of extra introduction point defined by a consensus
  * parameter or the default value. */
 static int32_t
 get_intro_point_num_extra(void)
@@ -372,7 +372,7 @@ get_intro_point_num_extra(void)
                                  NUM_INTRO_POINTS_EXTRA, 0, 128);
 }
 
-/* Helper: Function that needs to return 1 for the HT for each loop which
+/** Helper: Function that needs to return 1 for the HT for each loop which
  * frees every service in an hash map. */
 static int
 ht_free_service_(struct hs_service_t *service, void *data)
@@ -384,7 +384,7 @@ ht_free_service_(struct hs_service_t *service, void *data)
   return 1;
 }
 
-/* Free every service that can be found in the global map. Once done, clear
+/** Free every service that can be found in the global map. Once done, clear
  * and free the global map. */
 static void
 service_free_all(void)
@@ -406,7 +406,7 @@ service_free_all(void)
   }
 }
 
-/* Free a given service intro point object. */
+/** Free a given service intro point object. */
 STATIC void
 service_intro_point_free_(hs_service_intro_point_t *ip)
 {
@@ -421,7 +421,7 @@ service_intro_point_free_(hs_service_intro_point_t *ip)
   tor_free(ip);
 }
 
-/* Helper: free an hs_service_intro_point_t object. This function is used by
+/** Helper: free an hs_service_intro_point_t object. This function is used by
  * digest256map_free() which requires a void * pointer. */
 static void
 service_intro_point_free_void(void *obj)
@@ -429,7 +429,7 @@ service_intro_point_free_void(void *obj)
   service_intro_point_free_(obj);
 }
 
-/* Return a newly allocated service intro point and fully initialized from the
+/** Return a newly allocated service intro point and fully initialized from the
  * given node_t node, if non NULL.
  *
  * If node is NULL, returns a hs_service_intro_point_t with an empty link
@@ -523,7 +523,7 @@ service_intro_point_add(digest256map_t *map, hs_service_intro_point_t *ip)
   tor_assert_nonfatal(!old_ip_entry);
 }
 
-/* For a given service, remove the intro point from that service's descriptors
+/** For a given service, remove the intro point from that service's descriptors
  * (check both current and next descriptor) */
 STATIC void
 service_intro_point_remove(const hs_service_t *service,
@@ -541,7 +541,7 @@ service_intro_point_remove(const hs_service_t *service,
   } FOR_EACH_DESCRIPTOR_END;
 }
 
-/* For a given service and authentication key, return the intro point or NULL
+/** For a given service and authentication key, return the intro point or NULL
  * if not found. This will check both descriptors in the service. */
 STATIC hs_service_intro_point_t *
 service_intro_point_find(const hs_service_t *service,
@@ -572,7 +572,7 @@ service_intro_point_find(const hs_service_t *service,
   return ip;
 }
 
-/* For a given service and intro point, return the descriptor for which the
+/** For a given service and intro point, return the descriptor for which the
  * intro point is assigned to. NULL is returned if not found. */
 STATIC hs_service_descriptor_t *
 service_desc_find_by_intro(const hs_service_t *service,
@@ -594,7 +594,7 @@ service_desc_find_by_intro(const hs_service_t *service,
   return descp;
 }
 
-/* From a circuit identifier, get all the possible objects associated with the
+/** From a circuit identifier, get all the possible objects associated with the
  * ident. If not NULL, service, ip or desc are set if the object can be found.
  * They are untouched if they can't be found.
  *
@@ -627,7 +627,7 @@ get_objects_from_ident(const hs_ident_circuit_t *ident,
   }
 }
 
-/* From a given intro point, return the first link specifier of type
+/** From a given intro point, return the first link specifier of type
  * encountered in the link specifier list. Return NULL if it can't be found.
  *
  * The caller does NOT have ownership of the object, the intro point does. */
@@ -650,7 +650,7 @@ get_link_spec_by_type(const hs_service_intro_point_t *ip, uint8_t type)
   return lnk_spec;
 }
 
-/* Given a service intro point, return the node_t associated to it. This can
+/** Given a service intro point, return the node_t associated to it. This can
  * return NULL if the given intro point has no legacy ID or if the node can't
  * be found in the consensus. */
 STATIC const node_t *
@@ -669,7 +669,7 @@ get_node_from_intro_point(const hs_service_intro_point_t *ip)
     (const char *) link_specifier_getconstarray_un_legacy_id(ls));
 }
 
-/* Given a service intro point, return the extend_info_t for it. This can
+/** Given a service intro point, return the extend_info_t for it. This can
  * return NULL if the node can't be found for the intro point or the extend
  * info can't be created for the found node. If direct_conn is set, the extend
  * info is validated on if we can connect directly. */
@@ -698,7 +698,7 @@ get_extend_info_from_intro_point(const hs_service_intro_point_t *ip,
   return info;
 }
 
-/* Return the number of introduction points that are established for the
+/** Return the number of introduction points that are established for the
  * given descriptor. */
 static unsigned int
 count_desc_circuit_established(const hs_service_descriptor_t *desc)
@@ -715,7 +715,7 @@ count_desc_circuit_established(const hs_service_descriptor_t *desc)
   return count;
 }
 
-/* For a given service and descriptor of that service, close all active
+/** For a given service and descriptor of that service, close all active
  * directory connections. */
 static void
 close_directory_connections(const hs_service_t *service,
@@ -750,7 +750,7 @@ close_directory_connections(const hs_service_t *service,
   smartlist_free(dir_conns);
 }
 
-/* Close all rendezvous circuits for the given service. */
+/** Close all rendezvous circuits for the given service. */
 static void
 close_service_rp_circuits(hs_service_t *service)
 {
@@ -780,7 +780,7 @@ close_service_rp_circuits(hs_service_t *service)
   }
 }
 
-/* Close the circuit(s) for the given map of introduction points. */
+/** Close the circuit(s) for the given map of introduction points. */
 static void
 close_intro_circuits(hs_service_intropoints_t *intro_points)
 {
@@ -798,7 +798,7 @@ close_intro_circuits(hs_service_intropoints_t *intro_points)
   } DIGEST256MAP_FOREACH_END;
 }
 
-/* Close all introduction circuits for the given service. */
+/** Close all introduction circuits for the given service. */
 static void
 close_service_intro_circuits(hs_service_t *service)
 {
@@ -809,7 +809,7 @@ close_service_intro_circuits(hs_service_t *service)
   } FOR_EACH_DESCRIPTOR_END;
 }
 
-/* Close any circuits related to the given service. */
+/** Close any circuits related to the given service. */
 static void
 close_service_circuits(hs_service_t *service)
 {
@@ -825,7 +825,7 @@ close_service_circuits(hs_service_t *service)
   close_service_rp_circuits(service);
 }
 
-/* Move every ephemeral services from the src service map to the dst service
+/** Move every ephemeral services from the src service map to the dst service
  * map. It is possible that a service can't be register to the dst map which
  * won't stop the process of moving them all but will trigger a log warn. */
 static void
@@ -855,7 +855,7 @@ move_ephemeral_services(hs_service_ht *src, hs_service_ht *dst)
   }
 }
 
-/* Return a const string of the directory path escaped. If this is an
+/** Return a const string of the directory path escaped. If this is an
  * ephemeral service, it returns "[EPHEMERAL]". This can only be called from
  * the main thread because escaped() uses a static variable. */
 static const char *
@@ -889,7 +889,7 @@ move_hs_state(hs_service_t *src_service, hs_service_t *dst_service)
   src->replay_cache_rend_cookie = NULL; /* steal pointer reference */
 }
 
-/* Register services that are in the staging list. Once this function returns,
+/** Register services that are in the staging list. Once this function returns,
  * the global service map will be set with the right content and all non
  * surviving services will be cleaned up. */
 static void
@@ -957,7 +957,7 @@ register_all_services(void)
   hs_service_map_has_changed();
 }
 
-/* Write the onion address of a given service to the given filename fname_ in
+/** Write the onion address of a given service to the given filename fname_ in
  * the service directory. Return 0 on success else -1 on error. */
 STATIC int
 write_address_to_file(const hs_service_t *service, const char *fname_)
@@ -998,7 +998,7 @@ write_address_to_file(const hs_service_t *service, const char *fname_)
   return ret;
 }
 
-/* Load and/or generate private keys for the given service. On success, the
+/** Load and/or generate private keys for the given service. On success, the
  * hostname file will be written to disk along with the master private key iff
  * the service is not configured for offline keys. Return 0 on success else -1
  * on failure. */
@@ -1096,7 +1096,7 @@ client_filename_is_valid(const char *filename)
   return ret;
 }
 
-/* Parse an authorized client from a string. The format of a client string
+/** Parse an authorized client from a string. The format of a client string
  * looks like (see rend-spec-v3.txt):
  *
  *  <auth-type>:<key-type>:<base32-encoded-public-key>
@@ -1178,7 +1178,7 @@ parse_authorized_client(const char *client_key_str)
   return client;
 }
 
-/* Load all the client public keys for the given service. Return 0 on
+/** Load all the client public keys for the given service. Return 0 on
  * success else -1 on failure. */
 static int
 load_client_keys(hs_service_t *service)
@@ -1281,6 +1281,7 @@ load_client_keys(hs_service_t *service)
   return ret;
 }
 
+/** Release all storage held in <b>client</b>. */
 STATIC void
 service_authorized_client_free_(hs_service_authorized_client_t *client)
 {
@@ -1291,7 +1292,7 @@ service_authorized_client_free_(hs_service_authorized_client_t *client)
   tor_free(client);
 }
 
-/* Free a given service descriptor object and all key material is wiped. */
+/** Free a given service descriptor object and all key material is wiped. */
 STATIC void
 service_descriptor_free_(hs_service_descriptor_t *desc)
 {
@@ -1312,7 +1313,7 @@ service_descriptor_free_(hs_service_descriptor_t *desc)
   tor_free(desc);
 }
 
-/* Return a newly allocated service descriptor object. */
+/** Return a newly allocated service descriptor object. */
 STATIC hs_service_descriptor_t *
 service_descriptor_new(void)
 {
@@ -1325,7 +1326,7 @@ service_descriptor_new(void)
   return sdesc;
 }
 
-/* Allocate and return a deep copy of client. */
+/** Allocate and return a deep copy of client. */
 static hs_service_authorized_client_t *
 service_authorized_client_dup(const hs_service_authorized_client_t *client)
 {
@@ -1343,7 +1344,7 @@ service_authorized_client_dup(const hs_service_authorized_client_t *client)
   return client_dup;
 }
 
-/* If two authorized clients are equal, return 0. If the first one should come
+/** If two authorized clients are equal, return 0. If the first one should come
  * before the second, return less than zero. If the first should come after
  * the second, return greater than zero. */
 static int
@@ -1360,7 +1361,7 @@ service_authorized_client_cmp(const hs_service_authorized_client_t *client1,
                     CURVE25519_PUBKEY_LEN);
 }
 
-/* Helper for sorting authorized clients. */
+/** Helper for sorting authorized clients. */
 static int
 compare_service_authorzized_client_(const void **_a, const void **_b)
 {
@@ -1368,7 +1369,7 @@ compare_service_authorzized_client_(const void **_a, const void **_b)
   return service_authorized_client_cmp(a, b);
 }
 
-/* If the list of hs_service_authorized_client_t's is different between
+/** If the list of hs_service_authorized_client_t's is different between
  * src and dst, return 1. Otherwise, return 0. */
 STATIC int
 service_authorized_client_config_equal(const hs_service_config_t *config1,
@@ -1429,7 +1430,7 @@ service_authorized_client_config_equal(const hs_service_config_t *config1,
   return ret;
 }
 
-/* Move descriptor(s) from the src service to the dst service and modify their
+/** Move descriptor(s) from the src service to the dst service and modify their
  * content if necessary. We do this during SIGHUP when we re-create our
  * hidden services. */
 static void
@@ -1488,7 +1489,7 @@ move_descriptors(hs_service_t *src, hs_service_t *dst)
   service_descriptor_free(dst->desc_next);
 }
 
-/* From the given service, remove all expired failing intro points for each
+/** From the given service, remove all expired failing intro points for each
  * descriptor. */
 static void
 remove_expired_failing_intro(hs_service_t *service, time_t now)
@@ -1507,7 +1508,7 @@ remove_expired_failing_intro(hs_service_t *service, time_t now)
   } FOR_EACH_DESCRIPTOR_END;
 }
 
-/* For the given descriptor desc, put all node_t object found from its failing
+/** For the given descriptor desc, put all node_t object found from its failing
  * intro point list and put them in the given node_list. */
 static void
 setup_intro_point_exclude_list(const hs_service_descriptor_t *desc,
@@ -1525,7 +1526,7 @@ setup_intro_point_exclude_list(const hs_service_descriptor_t *desc,
   } DIGESTMAP_FOREACH_END;
 }
 
-/* For the given failing intro point ip, we add its time of failure to the
+/** For the given failing intro point ip, we add its time of failure to the
  * failed map and index it by identity digest (legacy ID) in the descriptor
  * desc failed id map. */
 static void
@@ -1549,7 +1550,7 @@ remember_failing_intro_point(const hs_service_intro_point_t *ip,
   tor_free(prev_ptr);
 }
 
-/* Using a given descriptor signing keypair signing_kp, a service intro point
+/** Using a given descriptor signing keypair signing_kp, a service intro point
  * object ip and the time now, setup the content of an already allocated
  * descriptor intro desc_ip.
  *
@@ -1638,7 +1639,7 @@ setup_desc_intro_point(const ed25519_keypair_t *signing_kp,
   return ret;
 }
 
-/* Using the given descriptor from the given service, build the descriptor
+/** Using the given descriptor from the given service, build the descriptor
  * intro point list so we can then encode the descriptor for publication. This
  * function does not pick intro points, they have to be in the descriptor
  * current map. Cryptographic material (keys) must be initialized in the
@@ -1678,7 +1679,7 @@ build_desc_intro_points(const hs_service_t *service,
   } DIGEST256MAP_FOREACH_END;
 }
 
-/* Build the descriptor signing key certificate. */
+/** Build the descriptor signing key certificate. */
 static void
 build_desc_signing_key_cert(hs_service_descriptor_t *desc, time_t now)
 {
@@ -1704,7 +1705,7 @@ build_desc_signing_key_cert(hs_service_descriptor_t *desc, time_t now)
   tor_assert_nonfatal(plaintext->signing_key_cert);
 }
 
-/* Populate the descriptor encrypted section from the given service object.
+/** Populate the descriptor encrypted section from the given service object.
  * This will generate a valid list of introduction points that can be used
  * after for circuit creation. Return 0 on success else -1 on error. */
 static int
@@ -1817,7 +1818,7 @@ build_service_desc_superencrypted(const hs_service_t *service,
   return 0;
 }
 
-/* Populate the descriptor plaintext section from the given service object.
+/** Populate the descriptor plaintext section from the given service object.
  * The caller must make sure that the keys in the descriptors are valid that
  * is are non-zero. This can't fail. */
 static void
@@ -1868,7 +1869,7 @@ generate_ope_cipher_for_desc(const hs_service_descriptor_t *hs_desc)
   return crypto_ope_new(key);
 }
 
-/* For the given service and descriptor object, create the key material which
+/** For the given service and descriptor object, create the key material which
  * is the blinded keypair, the descriptor signing keypair, the ephemeral
  * keypair, and the descriptor cookie. Return 0 on success else -1 on error
  * where the generated keys MUST be ignored. */
@@ -1930,7 +1931,7 @@ build_service_desc_keys(const hs_service_t *service,
   return ret;
 }
 
-/* Given a service and the current time, build a descriptor for the service.
+/** Given a service and the current time, build a descriptor for the service.
  * This function does not pick introduction point, this needs to be done by
  * the update function. On success, desc_out will point to the newly allocated
  * descriptor object.
@@ -1987,7 +1988,7 @@ build_service_descriptor(hs_service_t *service, uint64_t time_period_num,
   service_descriptor_free(desc);
 }
 
-/* Build both descriptors for the given service that has just booted up.
+/** Build both descriptors for the given service that has just booted up.
  * Because it's a special case, it deserves its special function ;). */
 static void
 build_descriptors_for_new_service(hs_service_t *service, time_t now)
@@ -2037,7 +2038,7 @@ build_descriptors_for_new_service(hs_service_t *service, time_t now)
            safe_str_client(service->onion_address));
 }
 
-/* Build descriptors for each service if needed. There are conditions to build
+/** Build descriptors for each service if needed. There are conditions to build
  * a descriptor which are details in the function. */
 STATIC void
 build_all_descriptors(time_t now)
@@ -2070,7 +2071,7 @@ build_all_descriptors(time_t now)
   } FOR_EACH_DESCRIPTOR_END;
 }
 
-/* Randomly pick a node to become an introduction point but not present in the
+/** Randomly pick a node to become an introduction point but not present in the
  * given exclude_nodes list. The chosen node is put in the exclude list
  * regardless of success or not because in case of failure, the node is simply
  * unsusable from that point on.
@@ -2131,7 +2132,7 @@ pick_intro_point(unsigned int direct_conn, smartlist_t *exclude_nodes)
   return NULL;
 }
 
-/* For a given descriptor from the given service, pick any needed intro points
+/** For a given descriptor from the given service, pick any needed intro points
  * and update the current map with those newly picked intro points. Return the
  * number node that might have been added to the descriptor current map. */
 static unsigned int
@@ -2255,7 +2256,7 @@ service_desc_schedule_upload(hs_service_descriptor_t *desc,
   }
 }
 
-/* Pick missing intro points for this descriptor if needed. */
+/** Pick missing intro points for this descriptor if needed. */
 static void
 update_service_descriptor_intro_points(hs_service_t *service,
                           hs_service_descriptor_t *desc, time_t now)
@@ -2296,7 +2297,7 @@ update_service_descriptor_intro_points(hs_service_t *service,
   }
 }
 
-/* Update descriptor intro points for each service if needed. We do this as
+/** Update descriptor intro points for each service if needed. We do this as
  * part of the periodic event because we need to establish intro point circuits
  * before we publish descriptors. */
 STATIC void
@@ -2311,7 +2312,7 @@ update_all_descriptors_intro_points(time_t now)
   } FOR_EACH_SERVICE_END;
 }
 
-/* Return true iff the given intro point has expired that is it has been used
+/** Return true iff the given intro point has expired that is it has been used
  * for too long or we've reached our max seen INTRODUCE2 cell. */
 STATIC int
 intro_point_should_expire(const hs_service_intro_point_t *ip,
@@ -2333,7 +2334,7 @@ intro_point_should_expire(const hs_service_intro_point_t *ip,
   return 1;
 }
 
-/* Return true iff we should remove the intro point ip from its service.
+/** Return true iff we should remove the intro point ip from its service.
  *
  * We remove an intro point from the service descriptor list if one of
  * these criteria is met:
@@ -2395,7 +2396,7 @@ should_remove_intro_point(hs_service_intro_point_t *ip, time_t now)
   return ret;
 }
 
-/* Go over the given set of intro points for each service and remove any
+/** Go over the given set of intro points for each service and remove any
  * invalid ones.
  *
  * If an intro point is removed, the circuit (if any) is immediately close.
@@ -2458,7 +2459,7 @@ cleanup_intro_points(hs_service_t *service, time_t now)
   smartlist_free(ips_to_free);
 }
 
-/* Set the next rotation time of the descriptors for the given service for the
+/** Set the next rotation time of the descriptors for the given service for the
  * time now. */
 static void
 set_rotation_time(hs_service_t *service)
@@ -2477,7 +2478,7 @@ set_rotation_time(hs_service_t *service)
   }
 }
 
-/* Return true iff the service should rotate its descriptor. The time now is
+/** Return true iff the service should rotate its descriptor. The time now is
  * only used to fetch the live consensus and if none can be found, this
  * returns false. */
 static unsigned int
@@ -2529,7 +2530,7 @@ should_rotate_descriptors(hs_service_t *service, time_t now)
   return 1;
 }
 
-/* Rotate the service descriptors of the given service. The current descriptor
+/** Rotate the service descriptors of the given service. The current descriptor
  * will be freed, the next one put in as the current and finally the next
  * descriptor pointer is NULLified. */
 static void
@@ -2551,7 +2552,7 @@ rotate_service_descriptors(hs_service_t *service)
   set_rotation_time(service);
 }
 
-/* Rotate descriptors for each service if needed. A non existing current
+/** Rotate descriptors for each service if needed. A non existing current
  * descriptor will trigger a descriptor build for the next time period. */
 STATIC void
 rotate_all_descriptors(time_t now)
@@ -2580,7 +2581,7 @@ rotate_all_descriptors(time_t now)
   } FOR_EACH_SERVICE_END;
 }
 
-/* Scheduled event run from the main loop. Make sure all our services are up
+/** Scheduled event run from the main loop. Make sure all our services are up
  * to date and ready for the other scheduled events. This includes looking at
  * the introduction points status and descriptor rotation time. */
 STATIC void
@@ -2615,7 +2616,7 @@ run_housekeeping_event(time_t now)
   } FOR_EACH_SERVICE_END;
 }
 
-/* Scheduled event run from the main loop. Make sure all descriptors are up to
+/** Scheduled event run from the main loop. Make sure all descriptors are up to
  * date. Once this returns, each service descriptor needs to be considered for
  * new introduction circuits and then for upload. */
 static void
@@ -2692,7 +2693,7 @@ launch_intro_point_circuits(hs_service_t *service)
   } FOR_EACH_DESCRIPTOR_END;
 }
 
-/* Don't try to build more than this many circuits before giving up for a
+/** Don't try to build more than this many circuits before giving up for a
  * while. Dynamically calculated based on the configured number of intro
  * points for the given service and how many descriptor exists. The default
  * use case of 3 introduction points and two descriptors will allow 28
@@ -2708,7 +2709,7 @@ get_max_intro_circ_per_period(const hs_service_t *service)
   tor_assert(service->config.num_intro_points <=
              HS_CONFIG_V3_MAX_INTRO_POINTS);
 
-/* For a testing network, allow to do it for the maximum amount so circuit
+/** For a testing network, allow to do it for the maximum amount so circuit
  * creation and rotation and so on can actually be tested without limit. */
 #define MAX_INTRO_POINT_CIRCUIT_RETRIES_TESTING -1
   if (get_options()->TestingTorNetwork) {
@@ -2737,7 +2738,7 @@ get_max_intro_circ_per_period(const hs_service_t *service)
   return (count * multiplier);
 }
 
-/* For the given service, return 1 if the service is allowed to launch more
+/** For the given service, return 1 if the service is allowed to launch more
  * introduction circuits else 0 if the maximum has been reached for the retry
  * period of INTRO_CIRC_RETRY_PERIOD. */
 STATIC int
@@ -2783,7 +2784,7 @@ can_service_launch_intro_circuit(hs_service_t *service, time_t now)
   return 1;
 }
 
-/* Scheduled event run from the main loop. Make sure we have all the circuits
+/** Scheduled event run from the main loop. Make sure we have all the circuits
  * we need for each service. */
 static void
 run_build_circuit_event(time_t now)
@@ -2813,7 +2814,7 @@ run_build_circuit_event(time_t now)
   } FOR_EACH_SERVICE_END;
 }
 
-/* Encode and sign the service descriptor desc and upload it to the given
+/** Encode and sign the service descriptor desc and upload it to the given
  * hidden service directory.  This does nothing if PublishHidServDescriptors
  * is false. */
 static void
@@ -2949,7 +2950,7 @@ set_descriptor_revision_counter(hs_service_descriptor_t *hs_desc, time_t now,
   hs_desc->desc->plaintext_data.revision_counter = rev_counter;
 }
 
-/* Encode and sign the service descriptor desc and upload it to the
+/** Encode and sign the service descriptor desc and upload it to the
  * responsible hidden service directories. If for_next_period is true, the set
  * of directories are selected using the next hsdir_index. This does nothing
  * if PublishHidServDescriptors is false. */
@@ -3046,7 +3047,7 @@ service_desc_hsdirs_changed(const hs_service_t *service,
   return should_reupload;
 }
 
-/* Return 1 if the given descriptor from the given service can be uploaded
+/** Return 1 if the given descriptor from the given service can be uploaded
  * else return 0 if it can not. */
 static int
 should_service_upload_descriptor(const hs_service_t *service,
@@ -3103,7 +3104,7 @@ should_service_upload_descriptor(const hs_service_t *service,
   return 0;
 }
 
-/* Refresh the given service descriptor meaning this will update every mutable
+/** Refresh the given service descriptor meaning this will update every mutable
  * field that needs to be updated before we upload.
  *
  * This should ONLY be called before uploading a descriptor. It assumes that
@@ -3134,7 +3135,7 @@ refresh_service_descriptor(const hs_service_t *service,
   set_descriptor_revision_counter(desc, now, service->desc_current == desc);
 }
 
-/* Scheduled event run from the main loop. Try to upload the descriptor for
+/** Scheduled event run from the main loop. Try to upload the descriptor for
  * each service. */
 STATIC void
 run_upload_descriptor_event(time_t now)
@@ -3183,7 +3184,7 @@ run_upload_descriptor_event(time_t now)
   consider_republishing_hs_descriptors = 0;
 }
 
-/* Called when the introduction point circuit is done building and ready to be
+/** Called when the introduction point circuit is done building and ready to be
  * used. */
 static void
 service_intro_circ_has_opened(origin_circuit_t *circ)
@@ -3241,7 +3242,7 @@ service_intro_circ_has_opened(origin_circuit_t *circ)
   return;
 }
 
-/* Called when a rendezvous circuit is done building and ready to be used. */
+/** Called when a rendezvous circuit is done building and ready to be used. */
 static void
 service_rendezvous_circ_has_opened(origin_circuit_t *circ)
 {
@@ -3282,7 +3283,7 @@ service_rendezvous_circ_has_opened(origin_circuit_t *circ)
   return;
 }
 
-/* We've been expecting an INTRO_ESTABLISHED cell on this circuit and it just
+/** We've been expecting an INTRO_ESTABLISHED cell on this circuit and it just
  * arrived. Handle the INTRO_ESTABLISHED cell arriving on the given
  * introduction circuit. Return 0 on success else a negative value. */
 static int
@@ -3340,7 +3341,7 @@ service_handle_intro_established(origin_circuit_t *circ,
   return -1;
 }
 
-/* We just received an INTRODUCE2 cell on the established introduction circuit
+/** We just received an INTRODUCE2 cell on the established introduction circuit
  * circ. Handle the cell and return 0 on success else a negative value. */
 static int
 service_handle_introduce2(origin_circuit_t *circ, const uint8_t *payload,
@@ -3388,7 +3389,7 @@ service_handle_introduce2(origin_circuit_t *circ, const uint8_t *payload,
   return -1;
 }
 
-/* Add to list every filename used by service. This is used by the sandbox
+/** Add to list every filename used by service. This is used by the sandbox
  * subsystem. */
 static void
 service_add_fnames_to_list(const hs_service_t *service, smartlist_t *list)
@@ -3410,7 +3411,7 @@ service_add_fnames_to_list(const hs_service_t *service, smartlist_t *list)
   smartlist_add(list, hs_path_from_filename(s_dir, fname));
 }
 
-/* Return true iff the given service identity key is present on disk. */
+/** Return true iff the given service identity key is present on disk. */
 static int
 service_key_on_disk(const char *directory_path)
 {
@@ -3434,7 +3435,7 @@ service_key_on_disk(const char *directory_path)
   return ret;
 }
 
-/* This is a proxy function before actually calling hs_desc_encode_descriptor
+/** This is a proxy function before actually calling hs_desc_encode_descriptor
  * because we need some preprocessing here */
 static int
 service_encode_descriptor(const hs_service_t *service,
@@ -3465,7 +3466,7 @@ service_encode_descriptor(const hs_service_t *service,
 /* Public API */
 /* ========== */
 
-/* This is called everytime the service map (v2 or v3) changes that is if an
+/** This is called everytime the service map (v2 or v3) changes that is if an
  * element is added or removed. */
 void
 hs_service_map_has_changed(void)
@@ -3476,7 +3477,7 @@ hs_service_map_has_changed(void)
   rescan_periodic_events(get_options());
 }
 
-/* Upload an encoded descriptor in encoded_desc of the given version. This
+/** Upload an encoded descriptor in encoded_desc of the given version. This
  * descriptor is for the service identity_pk and blinded_pk used to setup the
  * directory connection identifier. It is uploaded to the directory hsdir_rs
  * routerstatus_t object.
@@ -3524,7 +3525,7 @@ hs_service_upload_desc_to_dir(const char *encoded_desc,
   directory_request_free(dir_req);
 }
 
-/* Add the ephemeral service using the secret key sk and ports. Both max
+/** Add the ephemeral service using the secret key sk and ports. Both max
  * streams parameter will be set in the newly created service.
  *
  * Ownership of sk and ports is passed to this routine.  Regardless of
@@ -3604,7 +3605,7 @@ hs_service_add_ephemeral(ed25519_secret_key_t *sk, smartlist_t *ports,
   return ret;
 }
 
-/* For the given onion address, delete the ephemeral service. Return 0 on
+/** For the given onion address, delete the ephemeral service. Return 0 on
  * success else -1 on error. */
 int
 hs_service_del_ephemeral(const char *address)
@@ -3654,7 +3655,7 @@ hs_service_del_ephemeral(const char *address)
   return -1;
 }
 
-/* Using the ed25519 public key pk, find a service for that key and return the
+/** Using the ed25519 public key pk, find a service for that key and return the
  * current encoded descriptor as a newly allocated string or NULL if not
  * found. This is used by the control port subsystem. */
 char *
@@ -3680,7 +3681,7 @@ hs_service_lookup_current_desc(const ed25519_public_key_t *pk)
   return NULL;
 }
 
-/* Return the number of service we have configured and usable. */
+/** Return the number of service we have configured and usable. */
 MOCK_IMPL(unsigned int,
 hs_service_get_num_services,(void))
 {
@@ -3690,7 +3691,7 @@ hs_service_get_num_services,(void))
   return HT_SIZE(hs_service_map);
 }
 
-/* Called once an introduction circuit is closed. If the circuit doesn't have
+/** Called once an introduction circuit is closed. If the circuit doesn't have
  * a v3 identifier, it is ignored. */
 void
 hs_service_intro_circ_has_closed(origin_circuit_t *circ)
@@ -3732,7 +3733,7 @@ hs_service_intro_circ_has_closed(origin_circuit_t *circ)
   return;
 }
 
-/* Given conn, a rendezvous edge connection acting as an exit stream, look up
+/** Given conn, a rendezvous edge connection acting as an exit stream, look up
  * the hidden service for the circuit circ, and look up the port and address
  * based on the connection port. Assign the actual connection address.
  *
@@ -3830,7 +3831,7 @@ hs_service_exports_circuit_id(const ed25519_public_key_t *pk)
   return service->config.circuit_id_protocol;
 }
 
-/* Add to file_list every filename used by a configured hidden service, and to
+/** Add to file_list every filename used by a configured hidden service, and to
  * dir_list every directory path used by a configured hidden service. This is
  * used by the sandbox subsystem to whitelist those. */
 void
@@ -3855,7 +3856,7 @@ hs_service_lists_fnames_for_sandbox(smartlist_t *file_list,
   } FOR_EACH_DESCRIPTOR_END;
 }
 
-/* Called when our internal view of the directory has changed. We might have
+/** Called when our internal view of the directory has changed. We might have
  * received a new batch of descriptors which might affect the shape of the
  * HSDir hash ring. Signal that we should reexamine the hash ring and
  * re-upload our HS descriptors if needed. */
@@ -3872,7 +3873,7 @@ hs_service_dir_info_changed(void)
   }
 }
 
-/* Called when we get an INTRODUCE2 cell on the circ. Respond to the cell and
+/** Called when we get an INTRODUCE2 cell on the circ. Respond to the cell and
  * launch a circuit to the rendezvous point. */
 int
 hs_service_receive_introduce2(origin_circuit_t *circ, const uint8_t *payload,
@@ -3903,7 +3904,7 @@ hs_service_receive_introduce2(origin_circuit_t *circ, const uint8_t *payload,
   return ret;
 }
 
-/* Called when we get an INTRO_ESTABLISHED cell. Mark the circuit as an
+/** Called when we get an INTRO_ESTABLISHED cell. Mark the circuit as an
  * established introduction point. Return 0 on success else a negative value
  * and the circuit is closed. */
 int
@@ -3940,7 +3941,7 @@ hs_service_receive_intro_established(origin_circuit_t *circ,
   return -1;
 }
 
-/* Called when any kind of hidden service circuit is done building thus
+/** Called when any kind of hidden service circuit is done building thus
  * opened. This is the entry point from the circuit subsystem. */
 void
 hs_service_circuit_has_opened(origin_circuit_t *circ)
@@ -3969,7 +3970,7 @@ hs_service_circuit_has_opened(origin_circuit_t *circ)
   }
 }
 
-/* Return the service version by looking at the key in the service directory.
+/** Return the service version by looking at the key in the service directory.
  * If the key is not found or unrecognized, -1 is returned. Else, the service
  * version is returned. */
 int
@@ -3999,7 +4000,7 @@ hs_service_get_version_from_key(const hs_service_t *service)
   return version;
 }
 
-/* Load and/or generate keys for all onion services including the client
+/** Load and/or generate keys for all onion services including the client
  * authorization if any. Return 0 on success, -1 on failure. */
 int
 hs_service_load_all_keys(void)
@@ -4035,7 +4036,7 @@ hs_service_load_all_keys(void)
   return -1;
 }
 
-/* Put all service object in the given service list. After this, the caller
+/** Put all service object in the given service list. After this, the caller
  * looses ownership of every elements in the list and responsible to free the
  * list pointer. */
 void
@@ -4052,7 +4053,7 @@ hs_service_stage_services(const smartlist_t *service_list)
   smartlist_add_all(hs_service_staging_list, service_list);
 }
 
-/* Allocate and initilize a service object. The service configuration will
+/** Allocate and initilize a service object. The service configuration will
  * contain the default values. Return the newly allocated object pointer. This
  * function can't fail. */
 hs_service_t *
@@ -4070,7 +4071,7 @@ hs_service_new(const or_options_t *options)
   return service;
 }
 
-/* Free the given <b>service</b> object and all its content. This function
+/** Free the given <b>service</b> object and all its content. This function
  * also takes care of wiping service keys from memory. It is safe to pass a
  * NULL pointer. */
 void
@@ -4099,7 +4100,7 @@ hs_service_free_(hs_service_t *service)
   tor_free(service);
 }
 
-/* Periodic callback. Entry point from the main loop to the HS service
+/** Periodic callback. Entry point from the main loop to the HS service
  * subsystem. This is call every second. This is skipped if tor can't build a
  * circuit or the network is disabled. */
 void
@@ -4122,7 +4123,7 @@ hs_service_run_scheduled_events(time_t now)
   run_upload_descriptor_event(now);
 }
 
-/* Initialize the service HS subsystem. */
+/** Initialize the service HS subsystem. */
 void
 hs_service_init(void)
 {
@@ -4139,7 +4140,7 @@ hs_service_init(void)
   hs_service_staging_list = smartlist_new();
 }
 
-/* Release all global storage of the hidden service subsystem. */
+/** Release all global storage of the hidden service subsystem. */
 void
 hs_service_free_all(void)
 {
@@ -4149,14 +4150,14 @@ hs_service_free_all(void)
 
 #ifdef TOR_UNIT_TESTS
 
-/* Return the global service map size. Only used by unit test. */
+/** Return the global service map size. Only used by unit test. */
 STATIC unsigned int
 get_hs_service_map_size(void)
 {
   return HT_SIZE(hs_service_map);
 }
 
-/* Return the staging list size. Only used by unit test. */
+/** Return the staging list size. Only used by unit test. */
 STATIC int
 get_hs_service_staging_list_size(void)
 {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits