[hipl-commit] [trunk] Rev 4386: Remove hip_db_struct_t typedef for HIP_HASHTABLE.

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Wed, 21 Apr 2010 18:21:00 +0300

Committer: Diego Biurrun <diego@xxxxxxxxxx>
Date: 21/04/2010 at 18:21:00
Revision: 4386
Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Remove hip_db_struct_t typedef for HIP_HASHTABLE.
  
  The typedef is a double indirection, HIP_HASHTABLE is already a typedef.
  Removing it makes the code less of an indirection maze.

Modified:
  M  hipd/hidb.c
  M  hipd/hidb.h

=== modified file 'hipd/hidb.c'
--- hipd/hidb.c 2010-04-16 18:50:27 +0000
+++ hipd/hidb.c 2010-04-21 15:18:19 +0000
@@ -26,7 +26,7 @@
 
 static char *lsi_addresses[] = {"1.0.0.1", "1.0.0.2", "1.0.0.3", "1.0.0.4"};
 
-static int hip_add_host_id(hip_db_struct_t *db,
+static int hip_add_host_id(HIP_HASHTABLE *db,
                            const struct hip_lhi *lhi,
                            hip_lsi_t *lsi,
                            const struct hip_host_id_priv *host_id,
@@ -34,8 +34,8 @@
                            int (*remove)(struct hip_host_id_entry *, void 
**arg),
                            void *arg);
 static struct hip_host_id *hip_get_public_key(const struct hip_host_id_priv 
*hid);
-static int hip_hidb_add_lsi(hip_db_struct_t *db, struct hip_host_id_entry 
*id_entry);
-static struct hip_host_id_entry *hip_hidb_get_entry_by_lsi(hip_db_struct_t *db,
+static int hip_hidb_add_lsi(HIP_HASHTABLE *db, struct hip_host_id_entry 
*id_entry);
+static struct hip_host_id_entry *hip_hidb_get_entry_by_lsi(HIP_HASHTABLE *db,
                                                            const struct 
in_addr *lsi);
 
 
@@ -82,9 +82,9 @@
 /**
  * initialize host identity database
  *
- * @param db A double pointer to a hip_db_struct_t. Caller deallocates.
+ * @param db A double pointer to a HIP_HASHTABLE. Caller deallocates.
  */
-void hip_init_hostid_db(hip_db_struct_t **db)
+void hip_init_hostid_db(HIP_HASHTABLE **db)
 {
     hip_local_hostid_db = hip_ht_init(hip_hidb_hash, hip_hidb_match);
 }
@@ -97,7 +97,7 @@
  * @param lhi the HIT to be deleted from the database.
  * @return    zero on success, otherwise negative.
  */
-static int hip_del_host_id(hip_db_struct_t *db, struct hip_lhi *lhi)
+static int hip_del_host_id(HIP_HASHTABLE *db, struct hip_lhi *lhi)
 {
     int err                      = -ENOENT;
     struct hip_host_id_entry *id = NULL;
@@ -151,7 +151,7 @@
  *
  * @param db database structure to delete.
  */
-static void hip_uninit_hostid_db(hip_db_struct_t *db)
+static void hip_uninit_hostid_db(HIP_HASHTABLE *db)
 {
     hip_list_t *curr, *iter;
     struct hip_host_id_entry *tmp;
@@ -185,7 +185,7 @@
  * @param anon -1 if you don't care, 1 if anon, 0 if public
  * @return     NULL, if failed or non-NULL if succeeded.
  */
-struct hip_host_id_entry *hip_get_hostid_entry_by_lhi_and_algo(hip_db_struct_t 
*db,
+struct hip_host_id_entry *hip_get_hostid_entry_by_lhi_and_algo(HIP_HASHTABLE 
*db,
                                                                const struct 
in6_addr *hit,
                                                                int algo,
                                                                int anon)
@@ -283,7 +283,7 @@
  * @param arg     argument passed for the handlers
  * @return        0 on success, otherwise an negative error value is returned.
  */
-static int hip_add_host_id(hip_db_struct_t *db,
+static int hip_add_host_id(HIP_HASHTABLE *db,
                            const struct hip_lhi *lhi,
                            hip_lsi_t *lsi,
                            const struct hip_host_id_priv *host_id,
@@ -616,7 +616,7 @@
  * @param id_entry contains an entry to the db, will contain an unsigned lsi
  * @return zero on success, or negative error value on failure.
  */
-static int hip_hidb_add_lsi(hip_db_struct_t *db, struct hip_host_id_entry 
*id_entry)
+static int hip_hidb_add_lsi(HIP_HASHTABLE *db, struct hip_host_id_entry 
*id_entry)
 {
     struct hip_host_id_entry *id_entry_aux;
     hip_list_t *item;
@@ -707,7 +707,7 @@
  * @param lsi the local LSI to be matched
  * @return the local host identifier structure
  */
-static struct hip_host_id_entry *hip_hidb_get_entry_by_lsi(hip_db_struct_t *db,
+static struct hip_host_id_entry *hip_hidb_get_entry_by_lsi(HIP_HASHTABLE *db,
                                                            const struct 
in_addr *lsi)
 {
     struct hip_host_id_entry *id_entry;
@@ -769,7 +769,7 @@
  * @param key a pointer to the private key (caller should not deallocate)
  * @return zero on success or negative on error
  */
-int hip_get_host_id_and_priv_key(hip_db_struct_t *db, struct in6_addr *hit,
+int hip_get_host_id_and_priv_key(HIP_HASHTABLE *db, struct in6_addr *hit,
                                  int algo, struct hip_host_id **host_id, void 
**key)
 {
     int err                         = 0, host_id_len;

=== modified file 'hipd/hidb.h'
--- hipd/hidb.h 2010-04-13 11:33:54 +0000
+++ hipd/hidb.h 2010-04-21 15:18:19 +0000
@@ -36,8 +36,6 @@
 #define HIP_WRITE_UNLOCK_DB(db)
 #endif
 
-typedef  HIP_HASHTABLE hip_db_struct_t;
-
 #define HIP_MAX_COOKIE_INFO 10
 /* for debugging with in6_ntop */
 #define INET6_ADDRSTRLEN 46
@@ -53,13 +51,13 @@
 #define HIP_DB_LOCAL_HID   (hip_local_hostid_db)
 
 /* ... and not this! */
-extern hip_db_struct_t *hip_local_hostid_db;
+extern HIP_HASHTABLE *hip_local_hostid_db;
 
-struct hip_host_id_entry *hip_get_hostid_entry_by_lhi_and_algo(hip_db_struct_t 
*db,
+struct hip_host_id_entry *hip_get_hostid_entry_by_lhi_and_algo(HIP_HASHTABLE 
*db,
                                                                const struct 
in6_addr *hit,
                                                                int algo, int 
anon);
 int hip_get_any_localhost_hit(struct in6_addr *target, int algo, int anon);
-int hip_get_host_id_and_priv_key(hip_db_struct_t *db, struct in6_addr *hit,
+int hip_get_host_id_and_priv_key(HIP_HASHTABLE *db, struct in6_addr *hit,
                                  int algo, struct hip_host_id **host_id, void 
**key);
 int hip_hit_is_our(struct in6_addr *hit);
 
@@ -81,7 +79,7 @@
 
 unsigned long hip_hidb_hash(const void *ptr);
 int hip_hidb_match(const void *ptr1, const void *ptr2);
-void hip_init_hostid_db(hip_db_struct_t **db);
+void hip_init_hostid_db(HIP_HASHTABLE **db);
 int hip_for_all_hi(int (*func)(struct hip_host_id_entry *entry, void *opaq), 
void *opaque);
 int hip_get_default_hit(struct in6_addr *hit);
 int hip_get_default_hit_msg(struct hip_common *msg);

Other related posts:

  • » [hipl-commit] [trunk] Rev 4386: Remove hip_db_struct_t typedef for HIP_HASHTABLE. - Diego Biurrun