[hipl-commit] [trunk] Rev 3981: Moved hip_host_file_info_exists_lsi() from hadb.c to hostsfiles.c.

  • From: Miika Komu <miika@xxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Wed, 17 Mar 2010 15:11:35 +0200

Committer: Miika Komu <miika@xxxxxx>
Date: 17/03/2010 at 15:11:35
Revision: 3981
Revision-id: miika@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Moved hip_host_file_info_exists_lsi() from hadb.c to hostsfiles.c.
  Seemed like a better match for this function.

Modified:
  M  hipd/hadb.c
  M  lib/core/hostsfiles.c
  M  lib/core/hostsfiles.h

=== modified file 'hipd/hadb.c'
--- hipd/hadb.c 2010-03-17 12:28:35 +0000
+++ hipd/hadb.c 2010-03-17 13:11:49 +0000
@@ -49,6 +49,7 @@
 #include "lib/core/hip_udp.h"
 #include "lib/core/solve.h"
 #include "lib/core/keylen.h"
+#include "lib/core/hostsfiles.h"
 
 #define HIP_HADB_SIZE 53
 #define HIP_MAX_HAS 100
@@ -1957,29 +1958,6 @@
 
 #endif
 
-/**
- * check if the given LSI is in the hosts files
- *
- * @param lsi the LSI to be searched for
- * @return one if the LSI exists or zero otherwise
- *
- */
-static int hip_host_file_info_exists_lsi(hip_lsi_t *lsi)
-{
-    uint8_t hostname[HOST_NAME_MAX];
-    struct in6_addr mapped_lsi;
-
-    memset(hostname, 0, sizeof(hostname));
-
-    IPV4_TO_IPV6_MAP(lsi, &mapped_lsi);
-
-    return !(hip_for_each_hosts_file_line(HIPL_HOSTS_FILE,
-                                          
hip_map_first_id_to_hostname_from_hosts,
-                                          &mapped_lsi, hostname) &&
-             hip_for_each_hosts_file_line(HOSTS_FILE,
-                                          
hip_map_first_id_to_hostname_from_hosts,
-                                          &mapped_lsi, hostname));
-}
 
 /**
  * An iterator to find a matching remote LSI from HADB.

=== modified file 'lib/core/hostsfiles.c'
--- lib/core/hostsfiles.c       2010-03-10 17:44:36 +0000
+++ lib/core/hostsfiles.c       2010-03-17 13:11:49 +0000
@@ -598,3 +598,27 @@
 out_err:
     return err;
 }
+
+/**
+ * check if the given LSI is in the hosts files
+ *
+ * @param lsi the LSI to be searched for
+ * @return one if the LSI exists or zero otherwise
+ *
+ */
+int hip_host_file_info_exists_lsi(hip_lsi_t *lsi)
+{
+    uint8_t hostname[HOST_NAME_MAX];
+    struct in6_addr mapped_lsi;
+
+    memset(hostname, 0, sizeof(hostname));
+
+    IPV4_TO_IPV6_MAP(lsi, &mapped_lsi);
+
+    return !(hip_for_each_hosts_file_line(HIPL_HOSTS_FILE,
+                                          
hip_map_first_id_to_hostname_from_hosts,
+                                          &mapped_lsi, hostname) &&
+             hip_for_each_hosts_file_line(HOSTS_FILE,
+                                          
hip_map_first_id_to_hostname_from_hosts,
+                                          &mapped_lsi, hostname));
+}

=== modified file 'lib/core/hostsfiles.h'
--- lib/core/hostsfiles.h       2010-03-10 17:44:36 +0000
+++ lib/core/hostsfiles.h       2010-03-17 13:11:49 +0000
@@ -35,5 +35,6 @@
 int hip_get_random_hostname_id_from_hosts(char *filename,
                                           char *hostname,
                                           char *id_str);
+int hip_host_file_info_exists_lsi(hip_lsi_t *lsi);
 
 #endif /* HIP_LIB_CORE_HOSTSFILES_H */

Other related posts:

  • » [hipl-commit] [trunk] Rev 3981: Moved hip_host_file_info_exists_lsi() from hadb.c to hostsfiles.c. - Miika Komu