[hipl-dev] [Branch ~hipl-core/hipl/mobility-fixes] Rev 5176: moved hip_get_locator_addr_item_count to update module

  • From: noreply@xxxxxxxxxxxxx
  • To: HIPL core team <hipl-dev@xxxxxxxxxxxxx>
  • Date: Fri, 19 Nov 2010 17:39:30 -0000

------------------------------------------------------------
revno: 5176
committer: Rene Hummen <rene.hummen@xxxxxxxxxxxxxxxxx>
branch nick: mobility-fixes
timestamp: Fri 2010-11-19 18:37:09 +0100
message:
  moved hip_get_locator_addr_item_count to update module
  
  after further modularization (already done in ipsec_esp branch) the
  dependency in hipd/input.c can be resolved.
modified:
  hipd/input.c
  lib/core/builder.c
  lib/core/builder.h
  modules/update/hipd/update.c
  modules/update/hipd/update.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 'hipd/input.c'
--- hipd/input.c        2010-10-22 10:41:25 +0000
+++ hipd/input.c        2010-11-19 17:37:09 +0000
@@ -69,6 +69,7 @@
 #include "lib/core/state.h"
 #include "lib/core/transform.h"
 #include "lib/tool/xfrmapi.h"
+#include "modules/update/hipd/update.h"
 #include "config.h"
 #include "cookie.h"
 #include "dh.h"

=== modified file 'lib/core/builder.c'
--- lib/core/builder.c  2010-11-19 17:28:54 +0000
+++ lib/core/builder.c  2010-11-19 17:37:09 +0000
@@ -3865,61 +3865,6 @@
 }
 
 /**
- * Retrieve the amount the locators inside a LOCATOR parameter.
- * Type 1 and 2 parameters are supported.
- *
- * @param locator a LOCATOR parameter
- * @return the amount 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;
-    uint8_t type;
-
-    while (address_pointer <
-          ((const char *) locator) + hip_get_param_contents_len(locator)) {
-        type = ((const struct hip_locator_info_addr_item *)
-               address_pointer)->locator_type;
-
-        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;
-        } else {
-            address_pointer += sizeof(struct hip_locator_info_addr_item);
-        }
-    }
-    return amount;
-}
-
-/**
- * retrieve a IP address from a locator item structure
- *
- * @param item      a pointer to the item
- * @return a pointer to the IP address
- */
-struct in6_addr *hip_get_locator_item_address(void *item)
-{
-    struct hip_locator_info_addr_item *temp;
-
-
-    temp = (struct hip_locator_info_addr_item *) item;
-    if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI) {
-        return &temp->address;
-    } else if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
-        return &temp->address;
-    } else {
-        return &((struct hip_locator_info_addr_item2 *) temp)->address;
-    }
-}
-
-/**
  * Build a @c RELAY_TO parameter to the HIP packet @c msg.
  *
  * @param msg  a pointer to a HIP packet common header

=== modified file 'lib/core/builder.h'
--- lib/core/builder.h  2010-11-19 17:28:54 +0000
+++ lib/core/builder.h  2010-11-19 17:37:09 +0000
@@ -185,7 +185,6 @@
 struct hip_dh_public_value
         *hip_dh_select_key(struct hip_diffie_hellman *);
 uint8_t hip_get_host_id_algo(const struct hip_host_id *);
-int hip_get_locator_addr_item_count(const struct hip_locator *);
 int hip_get_lifetime_value(time_t seconds, uint8_t *lifetime);
 int hip_get_lifetime_seconds(uint8_t lifetime, time_t *seconds);
 int hip_check_network_msg_len(const struct hip_common *msg);
@@ -282,7 +281,6 @@
 int hip_build_param_nat_port(hip_common_t *msg,
                              const in_port_t port,
                              hip_tlv_type_t hipparam);
-struct in6_addr *hip_get_locator_item_address(void *item);
 int hip_build_digest(const int type, const void *in, int in_len, void *out);
 
 int hip_build_param_hmac(struct hip_common *msg,

=== modified file 'modules/update/hipd/update.c'
--- modules/update/hipd/update.c        2010-11-19 17:28:54 +0000
+++ modules/update/hipd/update.c        2010-11-19 17:37:09 +0000
@@ -654,6 +654,61 @@
 }
 
 /**
+ * retrieve a IP address from a locator item structure
+ *
+ * @param item      a pointer to the item
+ * @return a pointer to the IP address
+ */
+static struct in6_addr *hip_get_locator_item_address(void *item)
+{
+    struct hip_locator_info_addr_item *temp;
+
+
+    temp = (struct hip_locator_info_addr_item *) item;
+    if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI) {
+        return &temp->address;
+    } else if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
+        return &temp->address;
+    } else {
+        return &((struct hip_locator_info_addr_item2 *) temp)->address;
+    }
+}
+
+/**
+ * Retrieve the amount the locators inside a LOCATOR parameter.
+ * Type 1 and 2 parameters are supported.
+ *
+ * @param locator a LOCATOR parameter
+ * @return the amount 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;
+    uint8_t type;
+
+    while (address_pointer <
+          ((const char *) locator) + hip_get_param_contents_len(locator)) {
+        type = ((const struct hip_locator_info_addr_item *)
+               address_pointer)->locator_type;
+
+        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;
+        } else {
+            address_pointer += sizeof(struct hip_locator_info_addr_item);
+        }
+    }
+    return amount;
+}
+
+/**
  * process a LOCATOR paramter
  *
  * @param ha the related host association

=== modified file 'modules/update/hipd/update.h'
--- modules/update/hipd/update.h        2010-11-19 15:09:43 +0000
+++ modules/update/hipd/update.h        2010-11-19 17:37:09 +0000
@@ -45,6 +45,8 @@
 #define HIP_UPDATE_ESP_ANCHOR           3
 #define HIP_UPDATE_ESP_ANCHOR_ACK       4
 
+int hip_get_locator_addr_item_count(const struct hip_locator *locator);
+
 int hip_create_locators(hip_common_t *locator_msg,
                         struct hip_locator_info_addr_item **locators);
 

Other related posts: