diff options
Diffstat (limited to 'src/ats/ats_api_scheduling.c')
-rw-r--r-- | src/ats/ats_api_scheduling.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index 53a21f996..4855efadb 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c | |||
@@ -317,7 +317,7 @@ process_ats_message (void *cls, | |||
317 | { | 317 | { |
318 | struct GNUNET_ATS_SchedulingHandle *sh = cls; | 318 | struct GNUNET_ATS_SchedulingHandle *sh = cls; |
319 | const struct AddressSuggestionMessage *m; | 319 | const struct AddressSuggestionMessage *m; |
320 | const struct GNUNET_TRANSPORT_ATS_Information *atsi; | 320 | const struct GNUNET_ATS_Information *atsi; |
321 | const char *address; | 321 | const char *address; |
322 | const char *plugin_name; | 322 | const char *plugin_name; |
323 | uint16_t address_length; | 323 | uint16_t address_length; |
@@ -345,15 +345,15 @@ process_ats_message (void *cls, | |||
345 | m = (const struct AddressSuggestionMessage*) msg; | 345 | m = (const struct AddressSuggestionMessage*) msg; |
346 | ats_count = ntohl (m->ats_count); | 346 | ats_count = ntohl (m->ats_count); |
347 | address_length = ntohs (m->address_length); | 347 | address_length = ntohs (m->address_length); |
348 | atsi = (const struct GNUNET_TRANSPORT_ATS_Information*) &m[1]; | 348 | atsi = (const struct GNUNET_ATS_Information*) &m[1]; |
349 | address = (const char*) &atsi[ats_count]; | 349 | address = (const char*) &atsi[ats_count]; |
350 | plugin_name = &address[address_length]; | 350 | plugin_name = &address[address_length]; |
351 | plugin_name_length = ntohs (m->plugin_name_length); | 351 | plugin_name_length = ntohs (m->plugin_name_length); |
352 | if ( (address_length + | 352 | if ( (address_length + |
353 | plugin_name_length + | 353 | plugin_name_length + |
354 | ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) + | 354 | ats_count * sizeof (struct GNUNET_ATS_Information) + |
355 | sizeof (struct AddressSuggestionMessage) != ntohs (msg->size)) || | 355 | sizeof (struct AddressSuggestionMessage) != ntohs (msg->size)) || |
356 | (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_TRANSPORT_ATS_Information)) || | 356 | (ats_count > GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information)) || |
357 | (plugin_name[plugin_name_length - 1] != '\0') ) | 357 | (plugin_name[plugin_name_length - 1] != '\0') ) |
358 | { | 358 | { |
359 | GNUNET_break (0); | 359 | GNUNET_break (0); |
@@ -525,23 +525,23 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh, | |||
525 | const char *plugin_name, | 525 | const char *plugin_name, |
526 | const void *plugin_addr, size_t plugin_addr_len, | 526 | const void *plugin_addr, size_t plugin_addr_len, |
527 | struct Session *session, | 527 | struct Session *session, |
528 | const struct GNUNET_TRANSPORT_ATS_Information *ats, | 528 | const struct GNUNET_ATS_Information *ats, |
529 | uint32_t ats_count) | 529 | uint32_t ats_count) |
530 | { | 530 | { |
531 | struct PendingMessage *p; | 531 | struct PendingMessage *p; |
532 | struct AddressUpdateMessage *m; | 532 | struct AddressUpdateMessage *m; |
533 | struct GNUNET_TRANSPORT_ATS_Information *am; | 533 | struct GNUNET_ATS_Information *am; |
534 | char *pm; | 534 | char *pm; |
535 | size_t namelen; | 535 | size_t namelen; |
536 | size_t msize; | 536 | size_t msize; |
537 | 537 | ||
538 | namelen = (plugin_name == NULL) ? 0 : strlen (plugin_name) + 1; | 538 | namelen = (plugin_name == NULL) ? 0 : strlen (plugin_name) + 1; |
539 | msize = sizeof (struct AddressUpdateMessage) + plugin_addr_len + | 539 | msize = sizeof (struct AddressUpdateMessage) + plugin_addr_len + |
540 | ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information) + namelen; | 540 | ats_count * sizeof (struct GNUNET_ATS_Information) + namelen; |
541 | if ( (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || | 541 | if ( (msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || |
542 | (plugin_addr_len >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || | 542 | (plugin_addr_len >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || |
543 | (namelen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || | 543 | (namelen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || |
544 | (ats_count >= GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_TRANSPORT_ATS_Information)) ) | 544 | (ats_count >= GNUNET_SERVER_MAX_MESSAGE_SIZE / sizeof (struct GNUNET_ATS_Information)) ) |
545 | { | 545 | { |
546 | GNUNET_break (0); | 546 | GNUNET_break (0); |
547 | return; | 547 | return; |
@@ -557,8 +557,8 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh, | |||
557 | m->address_length = htons (plugin_addr_len); | 557 | m->address_length = htons (plugin_addr_len); |
558 | m->plugin_name_length = htons (namelen); | 558 | m->plugin_name_length = htons (namelen); |
559 | m->session_id = htonl (get_session_id (sh, session)); | 559 | m->session_id = htonl (get_session_id (sh, session)); |
560 | am = (struct GNUNET_TRANSPORT_ATS_Information*) &m[1]; | 560 | am = (struct GNUNET_ATS_Information*) &m[1]; |
561 | memcpy (am, ats, ats_count * sizeof (struct GNUNET_TRANSPORT_ATS_Information)); | 561 | memcpy (am, ats, ats_count * sizeof (struct GNUNET_ATS_Information)); |
562 | pm = (char *) &am[ats_count]; | 562 | pm = (char *) &am[ats_count]; |
563 | memcpy (pm, plugin_addr, plugin_addr_len); | 563 | memcpy (pm, plugin_addr, plugin_addr_len); |
564 | memcpy (&pm[plugin_addr_len], plugin_name, namelen); | 564 | memcpy (&pm[plugin_addr_len], plugin_name, namelen); |