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

[tor-commits] [tor/master] Add a HS_DESC CREATED control event



commit af3be650e3f8417da985efc4d26c676201c7e38b
Author: Donncha O'Cearbhaill <donncha@xxxxxxxxxx>
Date:   Tue Jul 21 17:03:23 2015 +0200

    Add a HS_DESC CREATED control event
    
    The HS_DESC CREATED event should be emmited when a new service descriptor
    is generated for a local rendevous service. This event is documented
    in the control spec.
    
    This commit resolves ticket #16291.
---
 src/or/control.c |   21 +++++++++++++++++++++
 src/or/control.h |    2 ++
 2 files changed, 23 insertions(+)

diff --git a/src/or/control.c b/src/or/control.c
index d237f8f..fb74d7d 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -6233,6 +6233,27 @@ get_desc_id_from_query(const rend_data_t *rend_data, const char *hsdir_fp)
   return desc_id;
 }
 
+/** 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.
+ */
+void
+control_event_hs_descriptor_created(const char *service_id,
+                                    const char *desc_id_base32)
+{
+  if (!service_id || !desc_id_base32) {
+    log_warn(LD_BUG, "Called with service_digest==%p, "
+             "desc_id_base32==%p", service_id, desc_id_base32);
+    return;
+  }
+
+  send_control_event(EVENT_HS_DESC,
+                     "650 HS_DESC CREATED %s UNKNOWN UNKNOWN %s\r\n",
+                     service_id,
+                     desc_id_base32);
+}
+
 /** send HS_DESC upload event.
  *
  * <b>service_id</b> is the descriptor onion address.
diff --git a/src/or/control.h b/src/or/control.h
index fdf7903..26f7f50 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -117,6 +117,8 @@ MOCK_DECL(const char *, node_describe_longname_by_id,(const char *id_digest));
 void control_event_hs_descriptor_requested(const rend_data_t *rend_query,
                                            const char *desc_id_base32,
                                            const char *hs_dir);
+void control_event_hs_descriptor_created(const char *service_id,
+                                         const char *desc_id_base32);
 void control_event_hs_descriptor_upload(const char *service_id,
                                         const char *desc_id_base32,
                                         const char *hs_dir);



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