diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-21 13:31:13 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-03-21 13:31:13 +0000 |
commit | 2d31c529e63e8a76d05fe5733b02802b101af9e1 (patch) | |
tree | cf2ebe4eacf4c72dea84c1986d5bc645eb5b692d /src/core | |
parent | ca2c35b387a67eed4d5242a0da9533be26ed0bb2 (diff) | |
download | gnunet-2d31c529e63e8a76d05fe5733b02802b101af9e1.tar.gz gnunet-2d31c529e63e8a76d05fe5733b02802b101af9e1.zip |
ats related changes in core
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.h | 15 | ||||
-rw-r--r-- | src/core/core_api.c | 33 | ||||
-rw-r--r-- | src/core/core_api_is_connected.c | 10 | ||||
-rw-r--r-- | src/core/core_api_iterate_peers.c | 9 | ||||
-rw-r--r-- | src/core/gnunet-service-core_clients.c | 35 | ||||
-rw-r--r-- | src/core/gnunet-service-core_clients.h | 2 | ||||
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 20 | ||||
-rw-r--r-- | src/core/gnunet-service-core_kx.h | 4 | ||||
-rw-r--r-- | src/core/gnunet-service-core_neighbours.c | 6 | ||||
-rw-r--r-- | src/core/gnunet-service-core_sessions.c | 2 |
10 files changed, 29 insertions, 107 deletions
diff --git a/src/core/core.h b/src/core/core.h index 9b1802fbc..d518a9308 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
@@ -111,11 +111,6 @@ struct ConnectNotifyMessage | |||
111 | struct GNUNET_MessageHeader header; | 111 | struct GNUNET_MessageHeader header; |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Number of ATS key-value pairs that follow this struct | ||
115 | */ | ||
116 | uint32_t ats_count GNUNET_PACKED; | ||
117 | |||
118 | /** | ||
119 | * Identity of the connecting peer. | 114 | * Identity of the connecting peer. |
120 | */ | 115 | */ |
121 | struct GNUNET_PeerIdentity peer; | 116 | struct GNUNET_PeerIdentity peer; |
@@ -211,20 +206,10 @@ struct NotifyTrafficMessage | |||
211 | struct GNUNET_MessageHeader header; | 206 | struct GNUNET_MessageHeader header; |
212 | 207 | ||
213 | /** | 208 | /** |
214 | * Number of ATS key-value pairs that follow this struct | ||
215 | * (excluding the 0-terminator). | ||
216 | */ | ||
217 | uint32_t ats_count GNUNET_PACKED; | ||
218 | |||
219 | /** | ||
220 | * Identity of the receiver or sender. | 209 | * Identity of the receiver or sender. |
221 | */ | 210 | */ |
222 | struct GNUNET_PeerIdentity peer; | 211 | struct GNUNET_PeerIdentity peer; |
223 | 212 | ||
224 | /* Followed by ATS information blocks: | ||
225 | * struct GNUNET_ATS_Information ats[ats_count] | ||
226 | */ | ||
227 | |||
228 | /* Followed by payload (message or just header), variable size */ | 213 | /* Followed by payload (message or just header), variable size */ |
229 | }; | 214 | }; |
230 | 215 | ||
diff --git a/src/core/core_api.c b/src/core/core_api.c index 2b1291d08..511c7ee99 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -739,7 +739,6 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
739 | const struct GNUNET_MessageHeader *em; | 739 | const struct GNUNET_MessageHeader *em; |
740 | const struct SendMessageReady *smr; | 740 | const struct SendMessageReady *smr; |
741 | const struct GNUNET_CORE_MessageHandler *mh; | 741 | const struct GNUNET_CORE_MessageHandler *mh; |
742 | const struct GNUNET_ATS_Information *ats; | ||
743 | GNUNET_CORE_StartupCallback init; | 742 | GNUNET_CORE_StartupCallback init; |
744 | struct PeerRecord *pr; | 743 | struct PeerRecord *pr; |
745 | struct GNUNET_CORE_TransmitHandle *th; | 744 | struct GNUNET_CORE_TransmitHandle *th; |
@@ -747,8 +746,6 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
747 | int trigger; | 746 | int trigger; |
748 | uint16_t msize; | 747 | uint16_t msize; |
749 | uint16_t et; | 748 | uint16_t et; |
750 | uint32_t ats_count; | ||
751 | |||
752 | if (NULL == msg) | 749 | if (NULL == msg) |
753 | { | 750 | { |
754 | LOG (GNUNET_ERROR_TYPE_INFO, | 751 | LOG (GNUNET_ERROR_TYPE_INFO, |
@@ -813,10 +810,8 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
813 | return; | 810 | return; |
814 | } | 811 | } |
815 | cnm = (const struct ConnectNotifyMessage *) msg; | 812 | cnm = (const struct ConnectNotifyMessage *) msg; |
816 | ats_count = ntohl (cnm->ats_count); | ||
817 | if (msize != | 813 | if (msize != |
818 | sizeof (struct ConnectNotifyMessage) + | 814 | sizeof (struct ConnectNotifyMessage)) |
819 | ats_count * sizeof (struct GNUNET_ATS_Information)) | ||
820 | { | 815 | { |
821 | GNUNET_break (0); | 816 | GNUNET_break (0); |
822 | reconnect_later (h); | 817 | reconnect_later (h); |
@@ -845,9 +840,8 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
845 | GNUNET_CONTAINER_multihashmap_put (h->peers, | 840 | GNUNET_CONTAINER_multihashmap_put (h->peers, |
846 | &cnm->peer.hashPubKey, pr, | 841 | &cnm->peer.hashPubKey, pr, |
847 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); | 842 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)); |
848 | ats = (const struct GNUNET_ATS_Information *) &cnm[1]; | ||
849 | if (NULL != h->connects) | 843 | if (NULL != h->connects) |
850 | h->connects (h->cls, &cnm->peer, ats, ats_count); | 844 | h->connects (h->cls, &cnm->peer, NULL, 0); |
851 | break; | 845 | break; |
852 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT: | 846 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_DISCONNECT: |
853 | if (msize != sizeof (struct DisconnectNotifyMessage)) | 847 | if (msize != sizeof (struct DisconnectNotifyMessage)) |
@@ -888,25 +882,21 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
888 | return; | 882 | return; |
889 | } | 883 | } |
890 | ntm = (const struct NotifyTrafficMessage *) msg; | 884 | ntm = (const struct NotifyTrafficMessage *) msg; |
891 | ats_count = ntohl (ntm->ats_count); | ||
892 | if ((msize < | 885 | if ((msize < |
893 | sizeof (struct NotifyTrafficMessage) + | 886 | sizeof (struct NotifyTrafficMessage) + |
894 | ats_count * sizeof (struct GNUNET_ATS_Information) + | ||
895 | sizeof (struct GNUNET_MessageHeader)) ) | 887 | sizeof (struct GNUNET_MessageHeader)) ) |
896 | { | 888 | { |
897 | GNUNET_break (0); | 889 | GNUNET_break (0); |
898 | reconnect_later (h); | 890 | reconnect_later (h); |
899 | return; | 891 | return; |
900 | } | 892 | } |
901 | ats = (const struct GNUNET_ATS_Information*) &ntm[1]; | 893 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; |
902 | em = (const struct GNUNET_MessageHeader *) &ats[ats_count]; | ||
903 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 894 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
904 | "Received message of type %u and size %u from peer `%4s'\n", | 895 | "Received message of type %u and size %u from peer `%4s'\n", |
905 | ntohs (em->type), ntohs (em->size), GNUNET_i2s (&ntm->peer)); | 896 | ntohs (em->type), ntohs (em->size), GNUNET_i2s (&ntm->peer)); |
906 | if ((GNUNET_NO == h->inbound_hdr_only) && | 897 | if ((GNUNET_NO == h->inbound_hdr_only) && |
907 | (msize != | 898 | (msize != |
908 | ntohs (em->size) + sizeof (struct NotifyTrafficMessage) + | 899 | ntohs (em->size) + sizeof (struct NotifyTrafficMessage))) |
909 | +ats_count * sizeof (struct GNUNET_ATS_Information))) | ||
910 | { | 900 | { |
911 | GNUNET_break (0); | 901 | GNUNET_break (0); |
912 | reconnect_later (h); | 902 | reconnect_later (h); |
@@ -934,15 +924,14 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
934 | return; | 924 | return; |
935 | } | 925 | } |
936 | if (GNUNET_OK != | 926 | if (GNUNET_OK != |
937 | h->handlers[hpos].callback (h->cls, &ntm->peer, em, ats, | 927 | h->handlers[hpos].callback (h->cls, &ntm->peer, em, NULL,0)) |
938 | ats_count)) | ||
939 | { | 928 | { |
940 | /* error in processing, do not process other messages! */ | 929 | /* error in processing, do not process other messages! */ |
941 | break; | 930 | break; |
942 | } | 931 | } |
943 | } | 932 | } |
944 | if (NULL != h->inbound_notify) | 933 | if (NULL != h->inbound_notify) |
945 | h->inbound_notify (h->cls, &ntm->peer, em, ats, ats_count); | 934 | h->inbound_notify (h->cls, &ntm->peer, em, NULL, 0); |
946 | break; | 935 | break; |
947 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND: | 936 | case GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND: |
948 | if (msize < sizeof (struct NotifyTrafficMessage)) | 937 | if (msize < sizeof (struct NotifyTrafficMessage)) |
@@ -952,25 +941,21 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
952 | return; | 941 | return; |
953 | } | 942 | } |
954 | ntm = (const struct NotifyTrafficMessage *) msg; | 943 | ntm = (const struct NotifyTrafficMessage *) msg; |
955 | ats_count = ntohl (ntm->ats_count); | ||
956 | if ((msize < | 944 | if ((msize < |
957 | sizeof (struct NotifyTrafficMessage) + | 945 | sizeof (struct NotifyTrafficMessage) + |
958 | ats_count * sizeof (struct GNUNET_ATS_Information) + | ||
959 | sizeof (struct GNUNET_MessageHeader)) ) | 946 | sizeof (struct GNUNET_MessageHeader)) ) |
960 | { | 947 | { |
961 | GNUNET_break (0); | 948 | GNUNET_break (0); |
962 | reconnect_later (h); | 949 | reconnect_later (h); |
963 | return; | 950 | return; |
964 | } | 951 | } |
965 | ats = (const struct GNUNET_ATS_Information*) &ntm[1]; | 952 | em = (const struct GNUNET_MessageHeader *) &ntm[1]; |
966 | em = (const struct GNUNET_MessageHeader *) &ats[ats_count]; | ||
967 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 953 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
968 | "Received notification about transmission to `%s'.\n", | 954 | "Received notification about transmission to `%s'.\n", |
969 | GNUNET_i2s (&ntm->peer)); | 955 | GNUNET_i2s (&ntm->peer)); |
970 | if ((GNUNET_NO == h->outbound_hdr_only) && | 956 | if ((GNUNET_NO == h->outbound_hdr_only) && |
971 | (msize != | 957 | (msize != |
972 | ntohs (em->size) + sizeof (struct NotifyTrafficMessage) + | 958 | ntohs (em->size) + sizeof (struct NotifyTrafficMessage))) |
973 | ats_count * sizeof (struct GNUNET_ATS_Information))) | ||
974 | { | 959 | { |
975 | GNUNET_break (0); | 960 | GNUNET_break (0); |
976 | reconnect_later (h); | 961 | reconnect_later (h); |
@@ -981,7 +966,7 @@ main_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
981 | GNUNET_break (0); | 966 | GNUNET_break (0); |
982 | break; | 967 | break; |
983 | } | 968 | } |
984 | h->outbound_notify (h->cls, &ntm->peer, em, ats, ats_count); | 969 | h->outbound_notify (h->cls, &ntm->peer, em, NULL, 0); |
985 | break; | 970 | break; |
986 | case GNUNET_MESSAGE_TYPE_CORE_SEND_READY: | 971 | case GNUNET_MESSAGE_TYPE_CORE_SEND_READY: |
987 | if (msize != sizeof (struct SendMessageReady)) | 972 | if (msize != sizeof (struct SendMessageReady)) |
diff --git a/src/core/core_api_is_connected.c b/src/core/core_api_is_connected.c index 2e01b3691..10af88f5c 100644 --- a/src/core/core_api_is_connected.c +++ b/src/core/core_api_is_connected.c | |||
@@ -78,7 +78,6 @@ receive_connect_info (void *cls, const struct GNUNET_MessageHeader *msg) | |||
78 | { | 78 | { |
79 | struct GNUNET_CORE_ConnectTestHandle *cth = cls; | 79 | struct GNUNET_CORE_ConnectTestHandle *cth = cls; |
80 | const struct ConnectNotifyMessage *connect_message; | 80 | const struct ConnectNotifyMessage *connect_message; |
81 | uint32_t ats_count; | ||
82 | uint16_t msize; | 81 | uint16_t msize; |
83 | 82 | ||
84 | if (NULL == msg) | 83 | if (NULL == msg) |
@@ -107,10 +106,7 @@ receive_connect_info (void *cls, const struct GNUNET_MessageHeader *msg) | |||
107 | return; | 106 | return; |
108 | } | 107 | } |
109 | connect_message = (const struct ConnectNotifyMessage *) msg; | 108 | connect_message = (const struct ConnectNotifyMessage *) msg; |
110 | ats_count = ntohl (connect_message->ats_count); | 109 | if (msize != sizeof (struct ConnectNotifyMessage)) |
111 | if (msize != | ||
112 | sizeof (struct ConnectNotifyMessage) + | ||
113 | ats_count * sizeof (struct GNUNET_ATS_Information)) | ||
114 | { | 110 | { |
115 | GNUNET_break (0); | 111 | GNUNET_break (0); |
116 | cth->peer_cb (cth->cb_cls, NULL, NULL, 0); | 112 | cth->peer_cb (cth->cb_cls, NULL, NULL, 0); |
@@ -118,9 +114,7 @@ receive_connect_info (void *cls, const struct GNUNET_MessageHeader *msg) | |||
118 | return; | 114 | return; |
119 | } | 115 | } |
120 | /* Normal case */ | 116 | /* Normal case */ |
121 | cth->peer_cb (cth->cb_cls, &connect_message->peer, | 117 | cth->peer_cb (cth->cb_cls, &connect_message->peer, NULL, 0); |
122 | (const struct GNUNET_ATS_Information *) | ||
123 | &connect_message[1], ats_count); | ||
124 | GNUNET_CLIENT_receive (cth->client, &receive_connect_info, | 118 | GNUNET_CLIENT_receive (cth->client, &receive_connect_info, |
125 | cth, GNUNET_TIME_UNIT_FOREVER_REL); | 119 | cth, GNUNET_TIME_UNIT_FOREVER_REL); |
126 | } | 120 | } |
diff --git a/src/core/core_api_iterate_peers.c b/src/core/core_api_iterate_peers.c index 7db948618..4cb73dc21 100644 --- a/src/core/core_api_iterate_peers.c +++ b/src/core/core_api_iterate_peers.c | |||
@@ -70,7 +70,6 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg) | |||
70 | { | 70 | { |
71 | struct GNUNET_CORE_RequestContext *request_context = cls; | 71 | struct GNUNET_CORE_RequestContext *request_context = cls; |
72 | const struct ConnectNotifyMessage *connect_message; | 72 | const struct ConnectNotifyMessage *connect_message; |
73 | uint32_t ats_count; | ||
74 | uint16_t msize; | 73 | uint16_t msize; |
75 | 74 | ||
76 | /* Handle last message or error case, disconnect and clean up */ | 75 | /* Handle last message or error case, disconnect and clean up */ |
@@ -98,10 +97,7 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg) | |||
98 | return; | 97 | return; |
99 | } | 98 | } |
100 | connect_message = (const struct ConnectNotifyMessage *) msg; | 99 | connect_message = (const struct ConnectNotifyMessage *) msg; |
101 | ats_count = ntohl (connect_message->ats_count); | 100 | if (msize != sizeof (struct ConnectNotifyMessage)) |
102 | if (msize != | ||
103 | sizeof (struct ConnectNotifyMessage) + | ||
104 | ats_count * sizeof (struct GNUNET_ATS_Information)) | ||
105 | { | 101 | { |
106 | GNUNET_break (0); | 102 | GNUNET_break (0); |
107 | if (request_context->peer_cb != NULL) | 103 | if (request_context->peer_cb != NULL) |
@@ -113,8 +109,7 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg) | |||
113 | /* Normal case */ | 109 | /* Normal case */ |
114 | if (request_context->peer_cb != NULL) | 110 | if (request_context->peer_cb != NULL) |
115 | request_context->peer_cb (request_context->cb_cls, &connect_message->peer, | 111 | request_context->peer_cb (request_context->cb_cls, &connect_message->peer, |
116 | (const struct GNUNET_ATS_Information *) | 112 | NULL , 0); |
117 | &connect_message[1], ats_count); | ||
118 | GNUNET_CLIENT_receive (request_context->client, &receive_info, | 113 | GNUNET_CLIENT_receive (request_context->client, &receive_info, |
119 | request_context, GNUNET_TIME_UNIT_FOREVER_REL); | 114 | request_context, GNUNET_TIME_UNIT_FOREVER_REL); |
120 | } | 115 | } |
diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c index 1d299dae8..9ad23ed0b 100644 --- a/src/core/gnunet-service-core_clients.c +++ b/src/core/gnunet-service-core_clients.c | |||
@@ -525,16 +525,16 @@ client_tokenizer_callback (void *cls, void *client, | |||
525 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 525 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
526 | "Delivering message of type %u to myself\n", | 526 | "Delivering message of type %u to myself\n", |
527 | ntohs (message->type)); | 527 | ntohs (message->type)); |
528 | GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message, | 528 | GSC_CLIENTS_deliver_message (&GSC_my_identity, message, |
529 | ntohs (message->size), | 529 | ntohs (message->size), |
530 | GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND); | 530 | GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND); |
531 | GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message, | 531 | GSC_CLIENTS_deliver_message (&GSC_my_identity, message, |
532 | sizeof (struct GNUNET_MessageHeader), | 532 | sizeof (struct GNUNET_MessageHeader), |
533 | GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); | 533 | GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); |
534 | GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message, | 534 | GSC_CLIENTS_deliver_message (&GSC_my_identity, message, |
535 | ntohs (message->size), | 535 | ntohs (message->size), |
536 | GNUNET_CORE_OPTION_SEND_FULL_INBOUND); | 536 | GNUNET_CORE_OPTION_SEND_FULL_INBOUND); |
537 | GSC_CLIENTS_deliver_message (&GSC_my_identity, NULL, 0, message, | 537 | GSC_CLIENTS_deliver_message (&GSC_my_identity, message, |
538 | sizeof (struct GNUNET_MessageHeader), | 538 | sizeof (struct GNUNET_MessageHeader), |
539 | GNUNET_CORE_OPTION_SEND_HDR_INBOUND); | 539 | GNUNET_CORE_OPTION_SEND_HDR_INBOUND); |
540 | } | 540 | } |
@@ -543,10 +543,10 @@ client_tokenizer_callback (void *cls, void *client, | |||
543 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 543 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
544 | "Delivering message of type %u to %s\n", ntohs (message->type), | 544 | "Delivering message of type %u to %s\n", ntohs (message->type), |
545 | GNUNET_i2s (&car->target)); | 545 | GNUNET_i2s (&car->target)); |
546 | GSC_CLIENTS_deliver_message (&car->target, NULL, 0, message, | 546 | GSC_CLIENTS_deliver_message (&car->target, message, |
547 | ntohs (message->size), | 547 | ntohs (message->size), |
548 | GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND); | 548 | GNUNET_CORE_OPTION_SEND_FULL_OUTBOUND); |
549 | GSC_CLIENTS_deliver_message (&car->target, NULL, 0, message, | 549 | GSC_CLIENTS_deliver_message (&car->target, message, |
550 | sizeof (struct GNUNET_MessageHeader), | 550 | sizeof (struct GNUNET_MessageHeader), |
551 | GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); | 551 | GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); |
552 | GSC_SESSIONS_transmit (car, message, tc->cork); | 552 | GSC_SESSIONS_transmit (car, message, tc->cork); |
@@ -697,7 +697,6 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
697 | struct ConnectNotifyMessage *cnm; | 697 | struct ConnectNotifyMessage *cnm; |
698 | size_t size; | 698 | size_t size; |
699 | char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1] GNUNET_ALIGN; | 699 | char buf[GNUNET_SERVER_MAX_MESSAGE_SIZE - 1] GNUNET_ALIGN; |
700 | struct GNUNET_ATS_Information *a; | ||
701 | struct DisconnectNotifyMessage dcm; | 700 | struct DisconnectNotifyMessage dcm; |
702 | int old_match; | 701 | int old_match; |
703 | int new_match; | 702 | int new_match; |
@@ -722,9 +721,7 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
722 | &neighbour->hashPubKey, | 721 | &neighbour->hashPubKey, |
723 | NULL, | 722 | NULL, |
724 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 723 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
725 | size = | 724 | size = sizeof (struct ConnectNotifyMessage); |
726 | sizeof (struct ConnectNotifyMessage) + | ||
727 | (atsi_count) * sizeof (struct GNUNET_ATS_Information); | ||
728 | if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 725 | if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
729 | { | 726 | { |
730 | GNUNET_break (0); | 727 | GNUNET_break (0); |
@@ -735,9 +732,6 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client, | |||
735 | cnm = (struct ConnectNotifyMessage *) buf; | 732 | cnm = (struct ConnectNotifyMessage *) buf; |
736 | cnm->header.size = htons (size); | 733 | cnm->header.size = htons (size); |
737 | cnm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); | 734 | cnm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); |
738 | cnm->ats_count = htonl (atsi_count); | ||
739 | a = (struct GNUNET_ATS_Information *) &cnm[1]; | ||
740 | memcpy (a, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count); | ||
741 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n", | 735 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message to client.\n", |
742 | "NOTIFY_CONNECT"); | 736 | "NOTIFY_CONNECT"); |
743 | cnm->peer = *neighbour; | 737 | cnm->peer = *neighbour; |
@@ -804,24 +798,18 @@ GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity | |||
804 | */ | 798 | */ |
805 | void | 799 | void |
806 | GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, | 800 | GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, |
807 | const struct GNUNET_ATS_Information *atsi, | ||
808 | unsigned int atsi_count, | ||
809 | const struct GNUNET_MessageHeader *msg, | 801 | const struct GNUNET_MessageHeader *msg, |
810 | uint16_t msize, | 802 | uint16_t msize, |
811 | uint32_t options) | 803 | uint32_t options) |
812 | { | 804 | { |
813 | size_t size = | 805 | size_t size = msize + sizeof (struct NotifyTrafficMessage); |
814 | msize + sizeof (struct NotifyTrafficMessage) + | ||
815 | atsi_count * sizeof (struct GNUNET_ATS_Information); | ||
816 | char buf[size] GNUNET_ALIGN; | 806 | char buf[size] GNUNET_ALIGN; |
817 | struct NotifyTrafficMessage *ntm; | 807 | struct NotifyTrafficMessage *ntm; |
818 | struct GNUNET_ATS_Information *a; | ||
819 | 808 | ||
820 | if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 809 | if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
821 | { | 810 | { |
822 | GNUNET_break (0); | 811 | GNUNET_break (0); |
823 | /* recovery strategy: throw performance data away... */ | 812 | /* recovery strategy: throw performance data away... */ |
824 | atsi_count = 0; | ||
825 | size = msize + sizeof (struct NotifyTrafficMessage); | 813 | size = msize + sizeof (struct NotifyTrafficMessage); |
826 | } | 814 | } |
827 | if (! ( (0 != (all_client_options & options)) || | 815 | if (! ( (0 != (all_client_options & options)) || |
@@ -837,11 +825,8 @@ GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, | |||
837 | ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND); | 825 | ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_INBOUND); |
838 | else | 826 | else |
839 | ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND); | 827 | ntm->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND); |
840 | ntm->ats_count = htonl (atsi_count); | ||
841 | ntm->peer = *sender; | 828 | ntm->peer = *sender; |
842 | a = (struct GNUNET_ATS_Information*) &ntm[1]; | 829 | memcpy (&ntm[1], msg, msize); |
843 | memcpy (a, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count); | ||
844 | memcpy (&a[atsi_count], msg, msize); | ||
845 | send_to_all_clients (sender, &ntm->header, GNUNET_YES, options, | 830 | send_to_all_clients (sender, &ntm->header, GNUNET_YES, options, |
846 | ntohs (msg->type)); | 831 | ntohs (msg->type)); |
847 | } | 832 | } |
diff --git a/src/core/gnunet-service-core_clients.h b/src/core/gnunet-service-core_clients.h index 8ece1ce1d..d3f9e6e8e 100644 --- a/src/core/gnunet-service-core_clients.h +++ b/src/core/gnunet-service-core_clients.h | |||
@@ -102,8 +102,6 @@ GSC_CLIENTS_notify_clients_about_neighbour (const struct GNUNET_PeerIdentity | |||
102 | */ | 102 | */ |
103 | void | 103 | void |
104 | GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, | 104 | GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender, |
105 | const struct GNUNET_ATS_Information *atsi, | ||
106 | unsigned int atsi_count, | ||
107 | const struct GNUNET_MessageHeader *msg, | 105 | const struct GNUNET_MessageHeader *msg, |
108 | uint16_t msize, | 106 | uint16_t msize, |
109 | uint32_t options); | 107 | uint32_t options); |
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index 2d0d01015..545cccaa6 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -1251,11 +1251,6 @@ struct DeliverMessageContext | |||
1251 | { | 1251 | { |
1252 | 1252 | ||
1253 | /** | 1253 | /** |
1254 | * Performance information for the connection. | ||
1255 | */ | ||
1256 | const struct GNUNET_ATS_Information *atsi; | ||
1257 | |||
1258 | /** | ||
1259 | * Key exchange context. | 1254 | * Key exchange context. |
1260 | */ | 1255 | */ |
1261 | struct GSC_KeyExchangeInfo *kx; | 1256 | struct GSC_KeyExchangeInfo *kx; |
@@ -1264,11 +1259,6 @@ struct DeliverMessageContext | |||
1264 | * Sender of the message. | 1259 | * Sender of the message. |
1265 | */ | 1260 | */ |
1266 | const struct GNUNET_PeerIdentity *peer; | 1261 | const struct GNUNET_PeerIdentity *peer; |
1267 | |||
1268 | /** | ||
1269 | * Number of entries in 'atsi' array. | ||
1270 | */ | ||
1271 | uint32_t atsi_count; | ||
1272 | }; | 1262 | }; |
1273 | 1263 | ||
1274 | 1264 | ||
@@ -1283,9 +1273,7 @@ struct DeliverMessageContext | |||
1283 | */ | 1273 | */ |
1284 | void | 1274 | void |
1285 | GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, | 1275 | GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, |
1286 | const struct GNUNET_MessageHeader *msg, | 1276 | const struct GNUNET_MessageHeader *msg) |
1287 | const struct GNUNET_ATS_Information *atsi, | ||
1288 | uint32_t atsi_count) | ||
1289 | { | 1277 | { |
1290 | const struct EncryptedMessage *m; | 1278 | const struct EncryptedMessage *m; |
1291 | struct EncryptedMessage *pt; /* plaintext */ | 1279 | struct EncryptedMessage *pt; /* plaintext */ |
@@ -1425,9 +1413,7 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, | |||
1425 | GNUNET_STATISTICS_update (GSC_stats, | 1413 | GNUNET_STATISTICS_update (GSC_stats, |
1426 | gettext_noop ("# bytes of payload decrypted"), | 1414 | gettext_noop ("# bytes of payload decrypted"), |
1427 | size - sizeof (struct EncryptedMessage), GNUNET_NO); | 1415 | size - sizeof (struct EncryptedMessage), GNUNET_NO); |
1428 | dmc.atsi = atsi; | ||
1429 | dmc.kx = kx; | 1416 | dmc.kx = kx; |
1430 | dmc.atsi_count = atsi_count; | ||
1431 | dmc.peer = &kx->peer; | 1417 | dmc.peer = &kx->peer; |
1432 | if (GNUNET_OK != | 1418 | if (GNUNET_OK != |
1433 | GNUNET_SERVER_mst_receive (mst, &dmc, | 1419 | GNUNET_SERVER_mst_receive (mst, &dmc, |
@@ -1467,10 +1453,10 @@ deliver_message (void *cls, void *client, const struct GNUNET_MessageHeader *m) | |||
1467 | GSC_SESSIONS_set_typemap (dmc->peer, m); | 1453 | GSC_SESSIONS_set_typemap (dmc->peer, m); |
1468 | return GNUNET_OK; | 1454 | return GNUNET_OK; |
1469 | default: | 1455 | default: |
1470 | GSC_CLIENTS_deliver_message (dmc->peer, dmc->atsi, dmc->atsi_count, m, | 1456 | GSC_CLIENTS_deliver_message (dmc->peer, m, |
1471 | ntohs (m->size), | 1457 | ntohs (m->size), |
1472 | GNUNET_CORE_OPTION_SEND_FULL_INBOUND); | 1458 | GNUNET_CORE_OPTION_SEND_FULL_INBOUND); |
1473 | GSC_CLIENTS_deliver_message (dmc->peer, dmc->atsi, dmc->atsi_count, m, | 1459 | GSC_CLIENTS_deliver_message (dmc->peer, m, |
1474 | sizeof (struct GNUNET_MessageHeader), | 1460 | sizeof (struct GNUNET_MessageHeader), |
1475 | GNUNET_CORE_OPTION_SEND_HDR_INBOUND); | 1461 | GNUNET_CORE_OPTION_SEND_HDR_INBOUND); |
1476 | } | 1462 | } |
diff --git a/src/core/gnunet-service-core_kx.h b/src/core/gnunet-service-core_kx.h index 6e6d30d8d..5d4d638b5 100644 --- a/src/core/gnunet-service-core_kx.h +++ b/src/core/gnunet-service-core_kx.h | |||
@@ -94,9 +94,7 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, | |||
94 | */ | 94 | */ |
95 | void | 95 | void |
96 | GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, | 96 | GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, |
97 | const struct GNUNET_MessageHeader *msg, | 97 | const struct GNUNET_MessageHeader *msg); |
98 | const struct GNUNET_ATS_Information *atsi, | ||
99 | uint32_t atsi_count); | ||
100 | 98 | ||
101 | 99 | ||
102 | /** | 100 | /** |
diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c index 38edf8e1a..b4c1370da 100644 --- a/src/core/gnunet-service-core_neighbours.c +++ b/src/core/gnunet-service-core_neighbours.c | |||
@@ -373,9 +373,7 @@ handle_transport_notify_disconnect (void *cls, | |||
373 | */ | 373 | */ |
374 | static void | 374 | static void |
375 | handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | 375 | handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer, |
376 | const struct GNUNET_MessageHeader *message, | 376 | const struct GNUNET_MessageHeader *message) |
377 | const struct GNUNET_ATS_Information *atsi, | ||
378 | uint32_t atsi_count) | ||
379 | { | 377 | { |
380 | struct Neighbour *n; | 378 | struct Neighbour *n; |
381 | uint16_t type; | 379 | uint16_t type; |
@@ -408,7 +406,7 @@ handle_transport_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
408 | GSC_KX_handle_pong (n->kxinfo, message); | 406 | GSC_KX_handle_pong (n->kxinfo, message); |
409 | break; | 407 | break; |
410 | case GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE: | 408 | case GNUNET_MESSAGE_TYPE_CORE_ENCRYPTED_MESSAGE: |
411 | GSC_KX_handle_encrypted_message (n->kxinfo, message, atsi, atsi_count); | 409 | GSC_KX_handle_encrypted_message (n->kxinfo, message); |
412 | break; | 410 | break; |
413 | case GNUNET_MESSAGE_TYPE_DUMMY: | 411 | case GNUNET_MESSAGE_TYPE_DUMMY: |
414 | /* Dummy messages for testing / benchmarking, just discard */ | 412 | /* Dummy messages for testing / benchmarking, just discard */ |
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index 7316f4b25..bf27d5600 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c | |||
@@ -662,8 +662,6 @@ queue_connect_message (void *cls, const struct GNUNET_HashCode * key, void *valu | |||
662 | /* FIXME: code duplication with clients... */ | 662 | /* FIXME: code duplication with clients... */ |
663 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); | 663 | cnm.header.size = htons (sizeof (struct ConnectNotifyMessage)); |
664 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); | 664 | cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT); |
665 | // FIXME: full ats... | ||
666 | cnm.ats_count = htonl (0); | ||
667 | cnm.peer = session->peer; | 665 | cnm.peer = session->peer; |
668 | GNUNET_SERVER_transmit_context_append_message (tc, &cnm.header); | 666 | GNUNET_SERVER_transmit_context_append_message (tc, &cnm.header); |
669 | return GNUNET_OK; | 667 | return GNUNET_OK; |