aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats_scheduling.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ats/gnunet-service-ats_scheduling.c')
-rw-r--r--src/ats/gnunet-service-ats_scheduling.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c
index ca4e86ca4..825f00085 100644
--- a/src/ats/gnunet-service-ats_scheduling.c
+++ b/src/ats/gnunet-service-ats_scheduling.c
@@ -155,7 +155,7 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity *pe
155 const void *plugin_addr, size_t plugin_addr_len, 155 const void *plugin_addr, size_t plugin_addr_len,
156 struct GNUNET_SERVER_Client *session_client, 156 struct GNUNET_SERVER_Client *session_client,
157 uint32_t session_id, 157 uint32_t session_id,
158 const struct GNUNET_TRANSPORT_ATS_Information *atsi, 158 const struct GNUNET_ATS_Information *atsi,
159 uint32_t atsi_count, 159 uint32_t atsi_count,
160 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 160 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
161 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) 161 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
@@ -163,14 +163,14 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity *pe
163 struct SchedulingClient *sc; 163 struct SchedulingClient *sc;
164 struct AddressSuggestionMessage *msg; 164 struct AddressSuggestionMessage *msg;
165 size_t plugin_name_length = strlen (plugin_name) + 1; 165 size_t plugin_name_length = strlen (plugin_name) + 1;
166 size_t msize = sizeof (struct AddressSuggestionMessage) + atsi_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) 166 size_t msize = sizeof (struct AddressSuggestionMessage) + atsi_count * sizeof (struct GNUNET_ATS_Information)
167 + plugin_addr_len + plugin_name_length; 167 + plugin_addr_len + plugin_name_length;
168 char buf[msize]; 168 char buf[msize];
169 struct GNUNET_TRANSPORT_ATS_Information *atsp; 169 struct GNUNET_ATS_Information *atsp;
170 char *addrp; 170 char *addrp;
171 171
172 GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE); 172 GNUNET_assert (msize < GNUNET_SERVER_MAX_MESSAGE_SIZE);
173 GNUNET_assert (atsi_count < GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_TRANSPORT_ATS_Information)); 173 GNUNET_assert (atsi_count < GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information));
174 msg = (struct AddressSuggestionMessage*) buf; 174 msg = (struct AddressSuggestionMessage*) buf;
175 msg->header.size = htons (msize); 175 msg->header.size = htons (msize);
176 msg->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION); 176 msg->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION);
@@ -181,8 +181,8 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity *pe
181 /* session ID is set only if 'client' is the same... */ 181 /* session ID is set only if 'client' is the same... */
182 msg->bandwidth_out = bandwidth_out; 182 msg->bandwidth_out = bandwidth_out;
183 msg->bandwidth_in = bandwidth_in; 183 msg->bandwidth_in = bandwidth_in;
184 atsp = (struct GNUNET_TRANSPORT_ATS_Information* ) &msg[1]; 184 atsp = (struct GNUNET_ATS_Information* ) &msg[1];
185 memcpy (atsp, atsi, sizeof (struct GNUNET_TRANSPORT_ATS_Information) * atsi_count); 185 memcpy (atsp, atsi, sizeof (struct GNUNET_ATS_Information) * atsi_count);
186 addrp = (char*) &atsp[atsi_count]; 186 addrp = (char*) &atsp[atsi_count];
187 memcpy (addrp, plugin_addr, plugin_addr_len); 187 memcpy (addrp, plugin_addr, plugin_addr_len);
188 strcpy (&addrp[plugin_addr_len], plugin_name); 188 strcpy (&addrp[plugin_addr_len], plugin_name);
@@ -234,7 +234,7 @@ GAS_handle_address_update (void *cls, struct GNUNET_SERVER_Client *client,
234 234
235{ 235{
236 const struct AddressUpdateMessage * m; 236 const struct AddressUpdateMessage * m;
237 const struct GNUNET_TRANSPORT_ATS_Information *atsi; 237 const struct GNUNET_ATS_Information *atsi;
238 const char *address; 238 const char *address;
239 const char *plugin_name; 239 const char *plugin_name;
240 uint16_t address_length; 240 uint16_t address_length;
@@ -256,7 +256,7 @@ GAS_handle_address_update (void *cls, struct GNUNET_SERVER_Client *client,
256 ats_count = ntohl (m->ats_count); 256 ats_count = ntohl (m->ats_count);
257 address_length = ntohs (m->address_length); 257 address_length = ntohs (m->address_length);
258 plugin_name_length = ntohs (m->plugin_name_length); 258 plugin_name_length = ntohs (m->plugin_name_length);
259 atsi = (const struct GNUNET_TRANSPORT_ATS_Information*) &m[1]; 259 atsi = (const struct GNUNET_ATS_Information*) &m[1];
260 address = (const char*) &atsi[ats_count]; 260 address = (const char*) &atsi[ats_count];
261 if (plugin_name_length != 0) 261 if (plugin_name_length != 0)
262 plugin_name = &address[address_length]; 262 plugin_name = &address[address_length];
@@ -264,9 +264,9 @@ GAS_handle_address_update (void *cls, struct GNUNET_SERVER_Client *client,
264 plugin_name = ""; 264 plugin_name = "";
265 if ( (address_length + 265 if ( (address_length +
266 plugin_name_length + 266 plugin_name_length +
267 ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) + 267 ats_count * sizeof (struct GNUNET_ATS_Information) +
268 sizeof (struct AddressUpdateMessage) != ntohs (message->size)) || 268 sizeof (struct AddressUpdateMessage) != ntohs (message->size)) ||
269 (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_TRANSPORT_ATS_Information)) || 269 (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information)) ||
270 (plugin_name[plugin_name_length - 1] != '\0') ) 270 (plugin_name[plugin_name_length - 1] != '\0') )
271 { 271 {
272 GNUNET_break (0); 272 GNUNET_break (0);