diff options
Diffstat (limited to 'src/social/social_api.c')
-rw-r--r-- | src/social/social_api.c | 77 |
1 files changed, 55 insertions, 22 deletions
diff --git a/src/social/social_api.c b/src/social/social_api.c index 23a977beb..a49f1160d 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c | |||
@@ -455,7 +455,8 @@ host_recv_notice_place_leave_method (void *cls, | |||
455 | const char *method_name) | 455 | const char *method_name) |
456 | { | 456 | { |
457 | struct GNUNET_SOCIAL_Host *hst = cls; | 457 | struct GNUNET_SOCIAL_Host *hst = cls; |
458 | if (NULL == nym) | 458 | if (0 == memcmp (&(struct GNUNET_CRYPTO_EcdsaPublicKey) {}, |
459 | &nym->pub_key, sizeof (nym->pub_key))) | ||
459 | return; | 460 | return; |
460 | 461 | ||
461 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 462 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -464,6 +465,12 @@ host_recv_notice_place_leave_method (void *cls, | |||
464 | 465 | ||
465 | hst->notice_place_leave_nym = (struct GNUNET_SOCIAL_Nym *) nym; | 466 | hst->notice_place_leave_nym = (struct GNUNET_SOCIAL_Nym *) nym; |
466 | hst->notice_place_leave_env = GNUNET_ENV_environment_create (); | 467 | hst->notice_place_leave_env = GNUNET_ENV_environment_create (); |
468 | |||
469 | char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&hst->notice_place_leave_nym->pub_key); | ||
470 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
471 | "_notice_place_leave: got method from nym %s (%s).\n", | ||
472 | GNUNET_h2s (&hst->notice_place_leave_nym->pub_key_hash), str); | ||
473 | GNUNET_break (0); | ||
467 | } | 474 | } |
468 | 475 | ||
469 | 476 | ||
@@ -506,6 +513,11 @@ host_recv_notice_place_leave_eom (void *cls, | |||
506 | if (NULL == hst->notice_place_leave_env) | 513 | if (NULL == hst->notice_place_leave_env) |
507 | return; | 514 | return; |
508 | 515 | ||
516 | char *str = GNUNET_CRYPTO_ecdsa_public_key_to_string (&hst->notice_place_leave_nym->pub_key); | ||
517 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
518 | "_notice_place_leave: got EOM from nym %s (%s).\n", | ||
519 | GNUNET_h2s (&hst->notice_place_leave_nym->pub_key_hash), str); | ||
520 | |||
509 | if (GNUNET_YES != cancelled) | 521 | if (GNUNET_YES != cancelled) |
510 | { | 522 | { |
511 | if (NULL != hst->farewell_cb) | 523 | if (NULL != hst->farewell_cb) |
@@ -658,10 +670,12 @@ slicer_message (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *slave_key, | |||
658 | GNUNET_assert (message_id == slicer->message_id); | 670 | GNUNET_assert (message_id == slicer->message_id); |
659 | } | 671 | } |
660 | 672 | ||
673 | char *nym_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (slave_key); | ||
661 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 674 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
662 | "Slicer received message of type %u and size %u, " | 675 | "Slicer received message of type %u and size %u, " |
663 | "with ID %" PRIu64 " and method %s\n", | 676 | "with ID %" PRIu64 " and method %s from %s\n", |
664 | ptype, ntohs (msg->size), message_id, slicer->method_name); | 677 | ptype, ntohs (msg->size), message_id, slicer->method_name, nym_str); |
678 | GNUNET_free (nym_str); | ||
665 | 679 | ||
666 | slicer->msg = msg; | 680 | slicer->msg = msg; |
667 | 681 | ||
@@ -1661,8 +1675,8 @@ GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *hst, | |||
1661 | * | 1675 | * |
1662 | * @param nym | 1676 | * @param nym |
1663 | * Pseudonym to map to a cryptographic identifier. | 1677 | * Pseudonym to map to a cryptographic identifier. |
1664 | * @param[out] nym_key | 1678 | * |
1665 | * Set to the public key of the nym. | 1679 | * @return Public key of nym. |
1666 | */ | 1680 | */ |
1667 | const struct GNUNET_CRYPTO_EcdsaPublicKey * | 1681 | const struct GNUNET_CRYPTO_EcdsaPublicKey * |
1668 | GNUNET_SOCIAL_nym_get_key (const struct GNUNET_SOCIAL_Nym *nym) | 1682 | GNUNET_SOCIAL_nym_get_key (const struct GNUNET_SOCIAL_Nym *nym) |
@@ -1672,6 +1686,21 @@ GNUNET_SOCIAL_nym_get_key (const struct GNUNET_SOCIAL_Nym *nym) | |||
1672 | 1686 | ||
1673 | 1687 | ||
1674 | /** | 1688 | /** |
1689 | * Get the hash of the public key of a @a nym. | ||
1690 | * | ||
1691 | * @param nym | ||
1692 | * Pseudonym to map to a cryptographic identifier. | ||
1693 | * | ||
1694 | * @return Hash of the public key of nym. | ||
1695 | */ | ||
1696 | const struct GNUNET_HashCode * | ||
1697 | GNUNET_SOCIAL_nym_get_key_hash (const struct GNUNET_SOCIAL_Nym *nym) | ||
1698 | { | ||
1699 | return &nym->pub_key_hash; | ||
1700 | } | ||
1701 | |||
1702 | |||
1703 | /** | ||
1675 | * Obtain the private-public key pair of the hosted place. | 1704 | * Obtain the private-public key pair of the hosted place. |
1676 | * | 1705 | * |
1677 | * The public part is suitable for storing in GNS within a PLACE record, | 1706 | * The public part is suitable for storing in GNS within a PLACE record, |
@@ -1689,13 +1718,6 @@ GNUNET_SOCIAL_host_get_place_key (struct GNUNET_SOCIAL_Host *hst) | |||
1689 | } | 1718 | } |
1690 | 1719 | ||
1691 | 1720 | ||
1692 | static void | ||
1693 | namestore_result_host_advertise (void *cls, int32_t success, const char *emsg) | ||
1694 | { | ||
1695 | |||
1696 | } | ||
1697 | |||
1698 | |||
1699 | /** | 1721 | /** |
1700 | * Connected to core service. | 1722 | * Connected to core service. |
1701 | */ | 1723 | */ |
@@ -1710,13 +1732,23 @@ core_connected_cb (void *cls, const struct GNUNET_PeerIdentity *my_identity) | |||
1710 | /** | 1732 | /** |
1711 | * Advertise the place in the GNS zone of the @e ego of the @a host. | 1733 | * Advertise the place in the GNS zone of the @e ego of the @a host. |
1712 | * | 1734 | * |
1713 | * @param hst Host of the place. | 1735 | * @param hst |
1714 | * @param name The name for the PLACE record to put in the zone. | 1736 | * Host of the place. |
1715 | * @param peer_count Number of elements in the @a peers array. | 1737 | * @param name |
1716 | * @param peers List of peers in the PLACE record that can be used to send join | 1738 | * The name for the PLACE record to put in the zone. |
1717 | * requests to. | 1739 | * @param peer_count |
1718 | * @param expiration_time Expiration time of the record, use 0 to remove the record. | 1740 | * Number of elements in the @a peers array. |
1719 | * @param password Password used to encrypt the record. | 1741 | * @param peers |
1742 | * List of peers to put in the PLACE record to advertise | ||
1743 | * as entry points to the place in addition to the origin. | ||
1744 | * @param expiration_time | ||
1745 | * Expiration time of the record, use 0 to remove the record. | ||
1746 | * @param password | ||
1747 | * Password used to encrypt the record. | ||
1748 | * @param result_cb | ||
1749 | * Function called with the result of the operation. | ||
1750 | * @param result_cls | ||
1751 | * Closure for @a result_cb | ||
1720 | */ | 1752 | */ |
1721 | void | 1753 | void |
1722 | GNUNET_SOCIAL_host_advertise (struct GNUNET_SOCIAL_Host *hst, | 1754 | GNUNET_SOCIAL_host_advertise (struct GNUNET_SOCIAL_Host *hst, |
@@ -1724,7 +1756,9 @@ GNUNET_SOCIAL_host_advertise (struct GNUNET_SOCIAL_Host *hst, | |||
1724 | size_t peer_count, | 1756 | size_t peer_count, |
1725 | const struct GNUNET_PeerIdentity *peers, | 1757 | const struct GNUNET_PeerIdentity *peers, |
1726 | struct GNUNET_TIME_Relative expiration_time, | 1758 | struct GNUNET_TIME_Relative expiration_time, |
1727 | const char *password) | 1759 | const char *password, |
1760 | GNUNET_NAMESTORE_ContinuationWithStatus result_cb, | ||
1761 | void *result_cls) | ||
1728 | { | 1762 | { |
1729 | struct GNUNET_SOCIAL_Place *plc = &hst->plc; | 1763 | struct GNUNET_SOCIAL_Place *plc = &hst->plc; |
1730 | if (NULL == namestore) | 1764 | if (NULL == namestore) |
@@ -1748,8 +1782,7 @@ GNUNET_SOCIAL_host_advertise (struct GNUNET_SOCIAL_Host *hst, | |||
1748 | rd.data = rec; | 1782 | rd.data = rec; |
1749 | 1783 | ||
1750 | GNUNET_NAMESTORE_records_store (namestore, &hst->plc.ego_key, | 1784 | GNUNET_NAMESTORE_records_store (namestore, &hst->plc.ego_key, |
1751 | name, 1, &rd, namestore_result_host_advertise, | 1785 | name, 1, &rd, result_cb, result_cls); |
1752 | hst); | ||
1753 | } | 1786 | } |
1754 | 1787 | ||
1755 | 1788 | ||