diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-25 16:21:08 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-25 16:21:08 +0000 |
commit | 59a1974b48463e363442bd4e8f81741ee86d4123 (patch) | |
tree | 0ff840b29d0075a99b72344b911de0fc0b7893cd /src/core | |
parent | 0b426b77cec77e80f10611614caf0689db2014b8 (diff) | |
download | gnunet-59a1974b48463e363442bd4e8f81741ee86d4123.tar.gz gnunet-59a1974b48463e363442bd4e8f81741ee86d4123.zip |
-preparatory steps for transport API change
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 45 | ||||
-rw-r--r-- | src/core/gnunet-service-core_kx.h | 9 | ||||
-rw-r--r-- | src/core/gnunet-service-core_neighbours.c | 7 |
3 files changed, 52 insertions, 9 deletions
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index f2d3e0492..6a71099ae 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -1608,6 +1608,41 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, | |||
1608 | 1608 | ||
1609 | 1609 | ||
1610 | /** | 1610 | /** |
1611 | * Obtain the array of message handlers provided by KX. | ||
1612 | * | ||
1613 | * @return NULL-entry terminated array of handlers | ||
1614 | */ | ||
1615 | const struct GNUNET_MQ_MessageHandler * | ||
1616 | GSC_KX_get_handlers (void) | ||
1617 | { | ||
1618 | #if 0 | ||
1619 | GNUNET_MQ_hd_fixed_size (ephemeral_key, | ||
1620 | GNUNET_MESSAGE_TYPE_CORE_EPHEMERAL_KEY, | ||
1621 | struct EphemeralKeyMessage); | ||
1622 | GNUNET_MQ_hd_fixed_size (ping, | ||
1623 | PING, | ||
1624 | struct PingMessage); | ||
1625 | GNUNET_MQ_hd_fixed_size (pong, | ||
1626 | PING, | ||
1627 | struct PongMessage); | ||
1628 | GNUNET_MQ_hd_var_size (encrypted, | ||
1629 | PING, | ||
1630 | struct ping); | ||
1631 | #endif | ||
1632 | static struct GNUNET_MQ_MessageHandler handlers[] = { | ||
1633 | #if 0 | ||
1634 | make_ephemeral_key_handler (), | ||
1635 | make_ping_handler (), | ||
1636 | make_pong_handler (), | ||
1637 | make_encrypted_handler (), | ||
1638 | #endif | ||
1639 | GNUNET_MQ_handler_end() | ||
1640 | }; | ||
1641 | return handlers; | ||
1642 | } | ||
1643 | |||
1644 | |||
1645 | /** | ||
1611 | * Deliver P2P message to interested clients. | 1646 | * Deliver P2P message to interested clients. |
1612 | * Invokes send twice, once for clients that want the full message, and once | 1647 | * Invokes send twice, once for clients that want the full message, and once |
1613 | * for clients that only want the header | 1648 | * for clients that only want the header |
@@ -1641,10 +1676,12 @@ deliver_message (void *cls, | |||
1641 | GSC_SESSIONS_confirm_typemap (dmc->peer, m); | 1676 | GSC_SESSIONS_confirm_typemap (dmc->peer, m); |
1642 | return GNUNET_OK; | 1677 | return GNUNET_OK; |
1643 | default: | 1678 | default: |
1644 | GSC_CLIENTS_deliver_message (dmc->peer, m, | 1679 | GSC_CLIENTS_deliver_message (dmc->peer, |
1680 | m, | ||
1645 | ntohs (m->size), | 1681 | ntohs (m->size), |
1646 | GNUNET_CORE_OPTION_SEND_FULL_INBOUND); | 1682 | GNUNET_CORE_OPTION_SEND_FULL_INBOUND); |
1647 | GSC_CLIENTS_deliver_message (dmc->peer, m, | 1683 | GSC_CLIENTS_deliver_message (dmc->peer, |
1684 | m, | ||
1648 | sizeof (struct GNUNET_MessageHeader), | 1685 | sizeof (struct GNUNET_MessageHeader), |
1649 | GNUNET_CORE_OPTION_SEND_HDR_INBOUND); | 1686 | GNUNET_CORE_OPTION_SEND_HDR_INBOUND); |
1650 | } | 1687 | } |
@@ -1686,8 +1723,8 @@ sign_ephemeral_key () | |||
1686 | current_ekm.origin_identity = GSC_my_identity; | 1723 | current_ekm.origin_identity = GSC_my_identity; |
1687 | GNUNET_assert (GNUNET_OK == | 1724 | GNUNET_assert (GNUNET_OK == |
1688 | GNUNET_CRYPTO_eddsa_sign (my_private_key, | 1725 | GNUNET_CRYPTO_eddsa_sign (my_private_key, |
1689 | ¤t_ekm.purpose, | 1726 | ¤t_ekm.purpose, |
1690 | ¤t_ekm.signature)); | 1727 | ¤t_ekm.signature)); |
1691 | } | 1728 | } |
1692 | 1729 | ||
1693 | 1730 | ||
diff --git a/src/core/gnunet-service-core_kx.h b/src/core/gnunet-service-core_kx.h index 343015de5..7649315ce 100644 --- a/src/core/gnunet-service-core_kx.h +++ b/src/core/gnunet-service-core_kx.h | |||
@@ -37,6 +37,15 @@ struct GSC_KeyExchangeInfo; | |||
37 | 37 | ||
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Obtain the array of message handlers provided by KX. | ||
41 | * | ||
42 | * @return NULL-entry terminated array of handlers | ||
43 | */ | ||
44 | const struct GNUNET_MQ_MessageHandler * | ||
45 | GSC_KX_get_handlers (void); | ||
46 | |||
47 | |||
48 | /** | ||
40 | * We received a EPHEMERAL_KEY message. Validate and update | 49 | * We received a EPHEMERAL_KEY message. Validate and update |
41 | * our key material and status. | 50 | * our key material and status. |
42 | * | 51 | * |
diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c index e241d829f..7af49a3b3 100644 --- a/src/core/gnunet-service-core_neighbours.c +++ b/src/core/gnunet-service-core_neighbours.c | |||
@@ -479,9 +479,6 @@ handle_transport_receive (void *cls, | |||
479 | case GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE: | 479 | case GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE: |
480 | GSC_KX_handle_encrypted_message (n->kxinfo, message); | 480 | GSC_KX_handle_encrypted_message (n->kxinfo, message); |
481 | break; | 481 | break; |
482 | case GNUNET_MESSAGE_TYPE_DUMMY: | ||
483 | /* Dummy messages for testing / benchmarking, just discard */ | ||
484 | break; | ||
485 | default: | 482 | default: |
486 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 483 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
487 | _("Unsupported message of type %u (%u bytes) received from peer `%s'\n"), | 484 | _("Unsupported message of type %u (%u bytes) received from peer `%s'\n"), |
@@ -523,8 +520,8 @@ GSC_NEIGHBOURS_transmit (const struct GNUNET_PeerIdentity *target, | |||
523 | me->deadline = GNUNET_TIME_relative_to_absolute (timeout); | 520 | me->deadline = GNUNET_TIME_relative_to_absolute (timeout); |
524 | me->size = msize; | 521 | me->size = msize; |
525 | GNUNET_memcpy (&me[1], | 522 | GNUNET_memcpy (&me[1], |
526 | msg, | 523 | msg, |
527 | msize); | 524 | msize); |
528 | GNUNET_CONTAINER_DLL_insert_tail (n->message_head, | 525 | GNUNET_CONTAINER_DLL_insert_tail (n->message_head, |
529 | n->message_tail, | 526 | n->message_tail, |
530 | me); | 527 | me); |