------------------------------------------------------------ revno: 5183 committer: Rene Hummen <rene.hummen@xxxxxxxxxxxxxxxxx> branch nick: mobility-fixes timestamp: Tue 2010-11-23 15:38:13 +0100 message: fixed alignment, spelling and incorporated feedback from mailinglist modified: modules/update/Makefile.am modules/update/hipd/update.c modules/update/hipd/update.h modules/update/hipd/update_builder.c modules/update/hipd/update_builder.h -- lp:~hipl-core/hipl/mobility-fixes https://code.launchpad.net/~hipl-core/hipl/mobility-fixes Your team HIPL core team is subscribed to branch lp:~hipl-core/hipl/mobility-fixes. To unsubscribe from this branch go to https://code.launchpad.net/~hipl-core/hipl/mobility-fixes/+edit-subscription
=== modified file 'modules/update/Makefile.am' --- modules/update/Makefile.am 2010-11-19 17:07:10 +0000 +++ modules/update/Makefile.am 2010-11-23 14:38:13 +0000 @@ -1,7 +1,7 @@ lib_LTLIBRARIES += modules/update/hipd/libhipupdate.la modules_update_hipd_libhipupdate_la_SOURCES = modules/update/hipd/update.c \ - modules/update/hipd/update_legacy.c \ - modules/update/hipd/update_builder.c + modules/update/hipd/update_builder.c \ + modules/update/hipd/update_legacy.c hipd_hipd_LDADD += modules/update/hipd/libhipupdate.la === modified file 'modules/update/hipd/update.c' --- modules/update/hipd/update.c 2010-11-22 14:03:57 +0000 +++ modules/update/hipd/update.c 2010-11-23 14:38:13 +0000 @@ -622,18 +622,19 @@ } /** - * Retreive a @c LOCATOR ADDRESS ITEM@c from a list. + * Retrieve a locator address item from a list. * * @param item_list a pointer to the first item in the list * @param idx the index of the item in the list * @return the locator addres item */ -static union hip_locator_info_addr *hip_get_locator_item(void *item_list, int idx) +static union hip_locator_info_addr *hip_get_locator_item(void *item_list, + int idx) { int i = 0; struct hip_locator_info_addr_item *temp; char *result; - result = (char *) item_list; + result = item_list; for (i = 0; i <= idx - 1; i++) { @@ -670,16 +671,16 @@ } /** - * Retrieve the amount the locators inside a LOCATOR parameter. + * Retrieve the number of locators inside a LOCATOR parameter. * Type 1 and 2 parameters are supported. * * @param locator a LOCATOR parameter - * @return the amount of locators + * @return the number of locators */ int hip_get_locator_addr_item_count(const struct hip_locator *locator) { const char *address_pointer = (const char *) (locator + 1); - int amount = 0; + int loc_count = 0; uint8_t type; while (address_pointer < @@ -689,18 +690,17 @@ if (type == HIP_LOCATOR_LOCATOR_TYPE_UDP) { address_pointer += sizeof(struct hip_locator_info_addr_item2); - amount += 1; - } else if (type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI) { - address_pointer += sizeof(struct hip_locator_info_addr_item); - amount += 1; - } else if (type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) { - address_pointer += sizeof(struct hip_locator_info_addr_item); - amount += 1; + loc_count += 1; + } else if (type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI + || type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) { + + address_pointer += sizeof(struct hip_locator_info_addr_item); + loc_count += 1; } else { address_pointer += sizeof(struct hip_locator_info_addr_item); } } - return amount; + return loc_count; } /** === modified file 'modules/update/hipd/update.h' --- modules/update/hipd/update.h 2010-11-22 14:51:50 +0000 +++ modules/update/hipd/update.h 2010-11-23 14:38:13 +0000 @@ -66,7 +66,7 @@ uint8_t traffic_type; uint8_t locator_type; uint8_t locator_length; - uint8_t reserved; /**< last bit is P (prefered) */ + uint8_t reserved; /**< last bit is P (preferred) */ uint32_t lifetime; struct in6_addr address; } __attribute__ ((packed)); @@ -78,7 +78,7 @@ uint8_t traffic_type; uint8_t locator_type; uint8_t locator_length; - uint8_t reserved; /* last bit is P (prefered) */ + uint8_t reserved; /* last bit is P (preferred) */ uint32_t lifetime; uint16_t port; uint8_t transport_protocol; === modified file 'modules/update/hipd/update_builder.c' --- modules/update/hipd/update_builder.c 2010-11-22 14:03:57 +0000 +++ modules/update/hipd/update_builder.c 2010-11-23 14:38:13 +0000 @@ -92,7 +92,7 @@ { int err = 0; struct hip_locator *locator_info = NULL; - int addrs_len = addr_count * (sizeof(struct hip_locator_info_addr_item)); + int addrs_len = addr_count * sizeof(struct hip_locator_info_addr_item); HIP_IFE(!(locator_info = malloc(sizeof(struct hip_locator) + addrs_len)), -1); === modified file 'modules/update/hipd/update_builder.h' --- modules/update/hipd/update_builder.h 2010-11-22 14:51:50 +0000 +++ modules/update/hipd/update_builder.h 2010-11-23 14:38:13 +0000 @@ -32,12 +32,14 @@ * @author Rene Hummen */ +#ifndef MODULES_UPDATE_HIPD_UPDATE_BUILDER_H +#define MODULES_UPDATE_HIPD_UPDATE_BUILDER_H + +#include <stdint.h> + #include "lib/core/protodefs.h" #include "update.h" -#ifndef MODULES_UPDATE_HIPD_UPDATE_BUILDER_H -#define MODULES_UPDATE_HIPD_UPDATE_BUILDER_H - int hip_build_param_seq(struct hip_common *msg, uint32_t update_id); int hip_build_param_ack(struct hip_common *msg, uint32_t peer_update_id); int hip_build_param_locator(struct hip_common *msg,