[hipl-commit] [trunk] Rev 4268: Move hip_query_ip_hit_mapping() below the CONFIG_HIP_OPPORTUNISTIC #ifdef.

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Tue, 13 Apr 2010 19:43:55 +0300

Committer: Diego Biurrun <diego@xxxxxxxxxx>
Date: 13/04/2010 at 19:43:55
Revision: 4268
Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Move hip_query_ip_hit_mapping() below the CONFIG_HIP_OPPORTUNISTIC #ifdef.
  
  In the header file it is declared conditional to that definition.

Modified:
  M  hipd/accessor.c

=== modified file 'hipd/accessor.c'
--- hipd/accessor.c     2010-04-13 15:52:03 +0000
+++ hipd/accessor.c     2010-04-13 16:42:57 +0000
@@ -193,64 +193,6 @@
 out_err:
     return err;
 }
-#endif /* CONFIG_HIP_OPPORTUNISTIC */
-
-#ifdef CONFIG_HIP_I3
-/**
- * turn hi3 support on or off
- *
- * @param msg a message with type HIP_MSG_SET_HI3_ON or HIP_MSG_SET_HI3_OFF
- */
-void hip_set_hi3_status(struct hip_common *msg)
-{
-    struct sockaddr_in6 sock_addr;
-    int retry, type, n;
-
-    type = hip_get_msg_type(msg);
-
-    _HIP_DEBUG("type=%d\n", type);
-
-    bzero(&sock_addr, sizeof(sock_addr));
-    sock_addr.sin6_family = AF_INET6;
-    sock_addr.sin6_port   = htons(HIP_FIREWALL_PORT);
-    sock_addr.sin6_addr   = in6addr_loopback;
-
-    for (retry = 0; retry < 3; retry++) {
-        n = hip_sendto_user(msg, (struct sockaddr *) &sock_addr);
-        if (n <= 0) {
-            HIP_ERROR("hipconf hi3 failed (round %d)\n", retry);
-            HIP_DEBUG("Sleeping few seconds to wait for fw\n");
-            sleep(2);
-        } else {
-            HIP_DEBUG("hipconf hi3 ok (sent %d bytes)\n", n);
-            break;
-        }
-    }
-
-    if (type == HIP_MSG_SET_HI3_ON) {
-        hip_i3_init();
-        hip_use_hi3        = 1;
-        hip_locator_status = HIP_MSG_SET_LOCATOR_ON;
-    } else {
-        hip_locator_status = HIP_MSG_SET_LOCATOR_OFF;
-        hip_hi3_clean();
-        hip_use_hi3        = 0;
-    }
-
-    HIP_DEBUG("hi3 set %s\n",
-              (hip_use_hi3 ? "on" : "off"));
-}
-
-/**
- * query if Hi3 is enabled or not
- *
- * @return 1 if it is enabled or 0 otherwise
- */
-int hip_get_hi3_status(void)
-{
-    return hip_use_hi3;
-}
-#endif /* CONFIG_HIP_I3 */
 
 /**
  * Query if a pseudo HIT is stored in the host association
@@ -292,6 +234,64 @@
 out_err:
     return err;
 }
+#endif /* CONFIG_HIP_OPPORTUNISTIC */
+
+#ifdef CONFIG_HIP_I3
+/**
+ * turn hi3 support on or off
+ *
+ * @param msg a message with type HIP_MSG_SET_HI3_ON or HIP_MSG_SET_HI3_OFF
+ */
+void hip_set_hi3_status(struct hip_common *msg)
+{
+    struct sockaddr_in6 sock_addr;
+    int retry, type, n;
+
+    type = hip_get_msg_type(msg);
+
+    _HIP_DEBUG("type=%d\n", type);
+
+    bzero(&sock_addr, sizeof(sock_addr));
+    sock_addr.sin6_family = AF_INET6;
+    sock_addr.sin6_port   = htons(HIP_FIREWALL_PORT);
+    sock_addr.sin6_addr   = in6addr_loopback;
+
+    for (retry = 0; retry < 3; retry++) {
+        n = hip_sendto_user(msg, (struct sockaddr *) &sock_addr);
+        if (n <= 0) {
+            HIP_ERROR("hipconf hi3 failed (round %d)\n", retry);
+            HIP_DEBUG("Sleeping few seconds to wait for fw\n");
+            sleep(2);
+        } else {
+            HIP_DEBUG("hipconf hi3 ok (sent %d bytes)\n", n);
+            break;
+        }
+    }
+
+    if (type == HIP_MSG_SET_HI3_ON) {
+        hip_i3_init();
+        hip_use_hi3        = 1;
+        hip_locator_status = HIP_MSG_SET_LOCATOR_ON;
+    } else {
+        hip_locator_status = HIP_MSG_SET_LOCATOR_OFF;
+        hip_hi3_clean();
+        hip_use_hi3        = 0;
+    }
+
+    HIP_DEBUG("hi3 set %s\n",
+              (hip_use_hi3 ? "on" : "off"));
+}
+
+/**
+ * query if Hi3 is enabled or not
+ *
+ * @return 1 if it is enabled or 0 otherwise
+ */
+int hip_get_hi3_status(void)
+{
+    return hip_use_hi3;
+}
+#endif /* CONFIG_HIP_I3 */
 
 /**
  * Query status of client-side HIP proxy

Other related posts:

  • » [hipl-commit] [trunk] Rev 4268: Move hip_query_ip_hit_mapping() below the CONFIG_HIP_OPPORTUNISTIC #ifdef. - Diego Biurrun