diff options
author | David Goulet <dgoulet@torproject.org> | 2017-11-10 09:08:05 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-05 19:39:46 -0500 |
commit | 242ddc85c874cafdc3513725f9357028b72eb9f8 (patch) | |
tree | ebf67983a128acb237c84b63b3efccb33b999cf1 /src/or/control.c | |
parent | 4633a93ca841c36e9c36ae31bc6745c47f85767e (diff) | |
download | tor-242ddc85c874cafdc3513725f9357028b72eb9f8.tar.gz tor-242ddc85c874cafdc3513725f9357028b72eb9f8.zip |
control: Refactor HS_DESC events functions to not be v2 specific
This is a naming refactor mostly _except_ for a the events' function that take
a rend_data_t which will require much more refactoring.
No behavior change at this commit, cleanup and renaming stuff to not be only
v2 specific.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 63 |
1 files changed, 23 insertions, 40 deletions
diff --git a/src/or/control.c b/src/or/control.c index d9102894e5..9a8d1f3021 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -7177,25 +7177,21 @@ rend_hsaddress_str_or_unknown(const char *onion_address) * <b>desc_id_base32</b> is the ID of requested hs descriptor. */ void -control_event_hs_descriptor_requested(const rend_data_t *rend_query, +control_event_hs_descriptor_requested(const char *onion_address, + rend_auth_type_t auth_type, const char *id_digest, - const char *desc_id_base32) + const char *desc_id) { - if (!id_digest || !rend_query || !desc_id_base32) { - log_warn(LD_BUG, "Called with rend_query==%p, " - "id_digest==%p, desc_id_base32==%p", - rend_query, id_digest, desc_id_base32); + if (BUG(!id_digest || !desc_id)) { return; } send_control_event(EVENT_HS_DESC, "650 HS_DESC REQUESTED %s %s %s %s\r\n", - rend_hsaddress_str_or_unknown( - rend_data_get_address(rend_query)), - rend_auth_type_to_string( - TO_REND_DATA_V2(rend_query)->auth_type), + rend_hsaddress_str_or_unknown(onion_address), + rend_auth_type_to_string(auth_type), node_describe_longname_by_id(id_digest), - desc_id_base32); + desc_id); } /** For an HS descriptor query <b>rend_data</b>, using the @@ -7244,52 +7240,45 @@ get_desc_id_from_query(const rend_data_t *rend_data, const char *hsdir_fp) /** send HS_DESC CREATED event when a local service generates a descriptor. * - * <b>service_id</b> is the descriptor onion address. - * <b>desc_id_base32</b> is the descriptor ID. + * <b>onion_address</b> is service address. + * <b>desc_id</b> is the descriptor ID. * <b>replica</b> is the the descriptor replica number. */ void -control_event_hs_descriptor_created(const char *service_id, - const char *desc_id_base32, +control_event_hs_descriptor_created(const char *onion_address, + const char *desc_id, int replica) { - if (!service_id || !desc_id_base32) { - log_warn(LD_BUG, "Called with service_digest==%p, " - "desc_id_base32==%p", service_id, desc_id_base32); + if (BUG(!onion_address || !desc_id)) { return; } send_control_event(EVENT_HS_DESC, "650 HS_DESC CREATED %s UNKNOWN UNKNOWN %s " "REPLICA=%d\r\n", - service_id, - desc_id_base32, - replica); + onion_address, desc_id, replica); } /** send HS_DESC upload event. * - * <b>service_id</b> is the descriptor onion address. + * <b>onion_address</b> is service address. * <b>hs_dir</b> is the description of contacting hs directory. - * <b>desc_id_base32</b> is the ID of requested hs descriptor. + * <b>desc_id</b> is the ID of requested hs descriptor. */ void -control_event_hs_descriptor_upload(const char *service_id, +control_event_hs_descriptor_upload(const char *onion_address, const char *id_digest, - const char *desc_id_base32) + const char *desc_id) { - if (!service_id || !id_digest || !desc_id_base32) { - log_warn(LD_BUG, "Called with service_digest==%p, " - "desc_id_base32==%p, id_digest==%p", service_id, - desc_id_base32, id_digest); + if (BUG(!onion_address || !id_digest || !desc_id)) { return; } send_control_event(EVENT_HS_DESC, "650 HS_DESC UPLOAD %s UNKNOWN %s %s\r\n", - service_id, + onion_address, node_describe_longname_by_id(id_digest), - desc_id_base32); + desc_id); } /** send HS_DESC event after got response from hs directory. @@ -7362,9 +7351,7 @@ control_event_hs_descriptor_upload_end(const char *action, { char *reason_field = NULL; - if (!action || !id_digest) { - log_warn(LD_BUG, "Called with action==%p, id_digest==%p", action, - id_digest); + if (BUG(!action || !id_digest)) { return; } @@ -7408,9 +7395,7 @@ void control_event_hs_descriptor_uploaded(const char *id_digest, const char *onion_address) { - if (!id_digest) { - log_warn(LD_BUG, "Called with id_digest==%p", - id_digest); + if (BUG(!id_digest)) { return; } @@ -7484,9 +7469,7 @@ control_event_hs_descriptor_upload_failed(const char *id_digest, const char *onion_address, const char *reason) { - if (!id_digest) { - log_warn(LD_BUG, "Called with id_digest==%p", - id_digest); + if (BUG(!id_digest)) { return; } control_event_hs_descriptor_upload_end("FAILED", onion_address, |