[hipl-commit] [tiny] Rev 3548: Removed functions pointer sets from host association database.

  • From: Tim Just <tim.just@xxxxxxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Mon, 22 Feb 2010 20:30:51 +0200

Committer: Tim Just <tim.just@xxxxxxxxxxxxxx>
Date: Mon Feb 22 19:30:02 2010 +0100
Revision: 3548
Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: tiny

Log:
  Removed functions pointer sets from host association database.
  
  The desired functions are called directly now.

Modified:
  M  hipd/close.c
  M  hipd/esp_prot_hipd_msg.c
  M  hipd/esp_prot_light_update.c
  M  hipd/hadb.c
  M  hipd/hadb.h
  M  hipd/hiprelay.c
  M  hipd/hiprelay.h
  M  hipd/init.c
  M  hipd/input.c
  M  hipd/maintenance.c
  M  hipd/nat.c
  M  hipd/oppdb.c
  M  hipd/output.c
  M  hipd/registration.c
  M  hipd/user_ipsec_hipd_msg.c
  M  lib/core/misc.c
  M  lib/core/state.h
  M  modules/update/hipd/update.c

=== modified file 'hipd/close.c'
--- hipd/close.c        2010-02-11 09:57:04 +0000
+++ hipd/close.c        2010-02-22 18:30:02 +0000
@@ -65,11 +65,11 @@
 
     HIP_IFE(!(close = hip_msg_alloc()), -ENOMEM);
 
-    entry->hadb_misc_func->hip_build_network_hdr(close,
-                                                 HIP_CLOSE,
-                                                 mask,
-                                                 &entry->hit_our,
-                                                 &entry->hit_peer);
+    hip_build_network_hdr(close,
+                          HIP_CLOSE,
+                          mask,
+                          &entry->hit_our,
+                          &entry->hit_peer);
 
     /********ECHO (SIGNED) **********/
 
@@ -88,8 +88,7 @@
              -EINVAL,
              "Could not create signature.\n");
 
-    HIP_IFEL(entry->hadb_xmit_func->
-             hip_send_pkt(NULL, &entry->peer_addr,
+    HIP_IFEL(hip_send_pkt(NULL, &entry->peer_addr,
                           (entry->nat_mode ? hip_get_local_nat_udp_port() : 0),
                           entry->peer_udp_port, close, entry, 0),
              -ECOMM, "Sending CLOSE message failed.\n");
@@ -205,9 +204,11 @@
              -1, "No echo request under signature.\n");
     echo_len = hip_get_param_contents_len(request);
 
-    entry->hadb_misc_func->hip_build_network_hdr(close_ack, HIP_CLOSE_ACK,
-                                                 mask, &entry->hit_our,
-                                                 &entry->hit_peer);
+    hip_build_network_hdr(close_ack,
+                          HIP_CLOSE_ACK,
+                          mask,
+                          &entry->hit_our,
+                          &entry->hit_peer);
 
     HIP_IFEL(hip_build_param_echo(close_ack, request + 1,
                                   echo_len, 1, 0), -1,
@@ -222,8 +223,7 @@
     HIP_IFEL(entry->sign(entry->our_priv_key, close_ack), -EINVAL,
              "Could not create signature.\n");
 
-    HIP_IFEL(entry->hadb_xmit_func->
-             hip_send_pkt(NULL, &entry->peer_addr, 
hip_get_local_nat_udp_port(),
+    HIP_IFEL(hip_send_pkt(NULL, &entry->peer_addr, 
hip_get_local_nat_udp_port(),
                           entry->peer_udp_port,
                           close_ack, entry, 0),
              -ECOMM, "Sending CLOSE ACK message failed.\n");
@@ -294,7 +294,7 @@
     switch (state) {
     case HIP_STATE_ESTABLISHED:
     case HIP_STATE_CLOSING:
-        err = entry->hadb_handle_func->hip_handle_close(close, entry);
+        err = hip_handle_close(close, entry);
         break;
     default:
         HIP_ERROR("Internal state (%d) is incorrect\n", state);
@@ -407,7 +407,7 @@
     switch (state) {
     case HIP_STATE_CLOSING:
     case HIP_STATE_CLOSED:
-        err = entry->hadb_handle_func->hip_handle_close_ack(close_ack, entry);
+        err = hip_handle_close_ack(close_ack, entry);
         break;
     default:
         HIP_ERROR("Internal state (%d) is incorrect\n", state);

=== modified file 'hipd/esp_prot_hipd_msg.c'
--- hipd/esp_prot_hipd_msg.c    2010-02-17 14:11:29 +0000
+++ hipd/esp_prot_hipd_msg.c    2010-02-22 18:30:02 +0000
@@ -49,11 +49,11 @@
 
     HIP_IFEL(!(resp_update = hip_msg_alloc()), -ENOMEM, "out of memory\n");
 
-    entry->hadb_misc_func->hip_build_network_hdr(resp_update,
-                                                 HIP_UPDATE,
-                                                 mask,
-                                                 &recv_update->hitr,
-                                                 &recv_update->hits);
+    hip_build_network_hdr(resp_update,
+                          HIP_UPDATE,
+                          mask,
+                          &recv_update->hitr,
+                          &recv_update->hits);
 
     /* Add ESP_INFO */
     HIP_IFEL(hip_build_param_esp_info(resp_update,
@@ -77,11 +77,13 @@
     HIP_IFEL(entry->sign(entry->our_priv_key, resp_update), -EINVAL,
              "Could not sign UPDATE. Failing\n");
 
-    HIP_IFEL(entry->hadb_xmit_func->hip_send_pkt(src_ip,
-                                                 dst_ip,
-                                                 (entry->nat_mode ? 
hip_get_local_nat_udp_port() : 0),
-                                                 entry->peer_udp_port,
-                                                 resp_update, entry, 0),
+    HIP_IFEL(hip_send_pkt(src_ip,
+                          dst_ip,
+                          (entry->nat_mode ? hip_get_local_nat_udp_port() : 0),
+                          entry->peer_udp_port,
+                          resp_update,
+                          entry,
+                          0),
              -1,
              "failed to send ANCHOR-UPDATE\n");
 
@@ -925,18 +927,18 @@
         entry->update_state = 0;
 
         // notify sadb about next anchor
-        HIP_IFEL(entry->hadb_ipsec_func->hip_add_sa(dst_ip,
-                                                    src_ip,
-                                                    &entry->hit_our,
-                                                    &entry->hit_peer,
-                                                    entry->spi_outbound_new,
-                                                    entry->esp_transform,
-                                                    &entry->esp_out,
-                                                    &entry->auth_out,
-                                                    0,
-                                                    HIP_SPI_DIRECTION_OUT,
-                                                    1,
-                                                    entry),
+        HIP_IFEL(hip_add_sa(dst_ip,
+                            src_ip,
+                            &entry->hit_our,
+                            &entry->hit_peer,
+                            entry->spi_outbound_new,
+                            entry->esp_transform,
+                            &entry->esp_out,
+                            &entry->auth_out,
+                            0,
+                            HIP_SPI_DIRECTION_OUT,
+                            1,
+                            entry),
                  -1,
                  "failed to notify sadb about next anchor\n");
     } else {

=== modified file 'hipd/esp_prot_light_update.c'
--- hipd/esp_prot_light_update.c        2010-02-17 14:11:29 +0000
+++ hipd/esp_prot_light_update.c        2010-02-22 18:30:02 +0000
@@ -38,9 +38,11 @@
     HIP_IFEL(!(light_ack = hip_msg_alloc()), -ENOMEM,
              "failed to allocate memory\n");
 
-    entry->hadb_misc_func->hip_build_network_hdr(light_ack, HIP_LUPDATE,
-                                                 mask, &entry->hit_our,
-                                                 &entry->hit_peer);
+    hip_build_network_hdr(light_ack,
+                          HIP_LUPDATE,
+                          mask,
+                          &entry->hit_our,
+                          &entry->hit_peer);
 
     /* Add ESP_INFO */
     HIP_IFEL(hip_build_param_esp_info(light_ack, entry->current_keymat_index,
@@ -54,10 +56,13 @@
     HIP_IFEL(hip_build_param_hmac_contents(light_ack, &entry->hip_hmac_out), 
-1,
              "Building of HMAC failed\n");
 
-    HIP_IFEL(entry->hadb_xmit_func->hip_send_pkt(src_addr, dst_addr,
-                                                 (entry->nat_mode ? 
hip_get_local_nat_udp_port() : 0),
-                                                 entry->peer_udp_port,
-                                                 light_ack, entry, 0),
+    HIP_IFEL(hip_send_pkt(src_addr,
+                          dst_addr,
+                          (entry->nat_mode ? hip_get_local_nat_udp_port() : 0),
+                          entry->peer_udp_port,
+                          light_ack,
+                          entry,
+                          0),
              -1,
              "failed to send ANCHOR-UPDATE\n");
 
@@ -91,8 +96,11 @@
     HIP_IFEL(!(light_update = hip_msg_alloc()), -ENOMEM,
              "failed to allocate memory\n");
 
-    entry->hadb_misc_func->hip_build_network_hdr(light_update, HIP_LUPDATE,
-                                                 mask, &entry->hit_our, 
&entry->hit_peer);
+    hip_build_network_hdr(light_update,
+                          HIP_LUPDATE,
+                          mask,
+                          &entry->hit_our,
+                          &entry->hit_peer);
 
     /********************* add SEQ *********************/
 
@@ -142,13 +150,13 @@
     /* send the packet with retransmission enabled */
     entry->light_update_retrans = 1;
 
-    HIP_IFEL(entry->hadb_xmit_func->hip_send_pkt(&entry->our_addr,
-                                                 &entry->peer_addr,
-                                                 (entry->nat_mode ? 
hip_get_local_nat_udp_port() : 0),
-                                                 entry->peer_udp_port,
-                                                 light_update,
-                                                 entry,
-                                                 entry->light_update_retrans),
+    HIP_IFEL(hip_send_pkt(&entry->our_addr,
+                          &entry->peer_addr,
+                          (entry->nat_mode ? hip_get_local_nat_udp_port() : 0),
+                          entry->peer_udp_port,
+                          light_update,
+                          entry,
+                          entry->light_update_retrans),
              -1,
              "failed to send light anchor update\n");
 
@@ -229,18 +237,18 @@
         entry->light_update_retrans = 0;
 
         // notify sadb about next anchor
-        HIP_IFEL(entry->hadb_ipsec_func->hip_add_sa(dst_addr,
-                                                    src_addr,
-                                                    &entry->hit_our,
-                                                    &entry->hit_peer,
-                                                    entry->spi_outbound_new,
-                                                    entry->esp_transform,
-                                                    &entry->esp_out,
-                                                    &entry->auth_out,
-                                                    0,
-                                                    HIP_SPI_DIRECTION_OUT,
-                                                    1,
-                                                    entry),
+        HIP_IFEL(hip_add_sa(dst_addr,
+                            src_addr,
+                            &entry->hit_our,
+                            &entry->hit_peer,
+                            entry->spi_outbound_new,
+                            entry->esp_transform,
+                            &entry->esp_out,
+                            &entry->auth_out,
+                            0,
+                            HIP_SPI_DIRECTION_OUT,
+                            1,
+                            entry),
                  -1,
                  "failed to notify sadb about next anchor\n");
     } else {

=== modified file 'hipd/hadb.c'
--- hipd/hadb.c 2010-02-18 14:18:07 +0000
+++ hipd/hadb.c 2010-02-22 18:30:02 +0000
@@ -30,23 +30,6 @@
     uint8_t         peer_hostname[HIP_HOST_ID_HOSTNAME_LEN_MAX];
 };
 
-/* default set of miscellaneous function pointers. This has to be in the global
- * scope. */
-
-/** A transmission function set for sending raw HIP packets. */
-hip_xmit_func_set_t default_xmit_func_set;
-/** A transmission function set for NAT traversal. */
-hip_xmit_func_set_t nat_xmit_func_set;
-
-/* added by Tao Wan, 24 Jan, 2008, For IPsec (user_space/kernel) */
-hip_ipsec_func_set_t default_ipsec_func_set;
-
-static hip_misc_func_set_t default_misc_func_set;
-static hip_input_filter_func_set_t default_input_filter_func_set;
-static hip_output_filter_func_set_t default_output_filter_func_set;
-static hip_rcv_func_set_t default_rcv_func_set;
-static hip_handle_func_set_t default_handle_func_set;
-
 /**
  * The hash function of the hashtable. Calculates a hash from parameter host
  * assosiation HITs (hit_our and hit_peer).
@@ -386,18 +369,7 @@
     if (entry) {
         // hip_hadb_dump_spis_out_old(entry);
         HIP_DEBUG_LSI("    Peer lsi   ", &entry->lsi_peer);
-
-#if 0 /* Required for OpenDHT code of Pardeep?  */
-        /* Check if LSIs are different */
-        if (peer_lsi) {
-            HIP_IFEL(hip_lsi_are_equal(&entry->lsi_peer, peer_lsi) ||
-                     peer_lsi->s_addr == 0, 0,
-                     "Ignoring new mapping, old one exists\n");
-        }
-#endif
-    }
-
-    if (!entry) {
+    } else {
         HIP_DEBUG("hip_hadb_create_state\n");
         entry                             = hip_hadb_create_state(0);
         HIP_IFEL(!entry, -1, "Unable to create a new entry");
@@ -443,15 +415,6 @@
         entry->nat_mode       = hip_nat_status;
         entry->peer_udp_port  = hip_get_peer_nat_udp_port();
         entry->local_udp_port = hip_get_local_nat_udp_port();
-        entry->hadb_xmit_func = &nat_xmit_func_set;
-    } else {
-        /* NAT mode is not reset here due to "shotgun" support.
-         * Hipd may get multiple locator mappings of which some can be
-         * IPv4 and others IPv6. If NAT mode is on and the last
-         * added address is IPv6, we don't want to reset NAT mode.
-         * Note that send_udp() function can shortcut to send_raw()
-         * when it gets an IPv6 address. */
-        entry->hadb_xmit_func = &default_xmit_func_set;
     }
 
     if (hip_hidb_hit_is_our(peer_hit)) {
@@ -470,9 +433,8 @@
 
     /* @todo: unlock ha when we have threads */
 
-    HIP_IFEL(default_ipsec_func_set.hip_setup_hit_sp_pair(peer_hit, local_hit,
-                                                          local_addr, 
peer_addr, 0, 1, 0),
-             -1, "Error in setting the SPs\n");
+    HIP_IFEL(hip_setup_hit_sp_pair(peer_hit, local_hit, local_addr, peer_addr, 
0, 1, 0),
+            -1, "Error in setting the SPs\n");
 
 out_err:
     return err;
@@ -604,55 +566,6 @@
 }
 
 /**
- * Sets function pointer set for an hadb record. Pointer values will not be
- * copied!
- *
- * @param entry        pointer to the hadb record.
- * @param new_func_set pointer to the new function set.
- * @return             0 if everything was stored successfully, otherwise < 0.
- */
-static int hip_hadb_set_misc_function_set(hip_ha_t *entry,
-                                          hip_misc_func_set_t *new_func_set)
-{
-    /** @todo add check whether all function pointers are set. */
-    if (entry) {
-        entry->hadb_misc_func = new_func_set;
-        return 0;
-    }
-    return -1;
-}
-
-int hip_hadb_set_xmit_function_set(hip_ha_t *entry,
-                                   hip_xmit_func_set_t *new_func_set)
-{
-    if (entry) {
-        entry->hadb_xmit_func = new_func_set;
-        return 0;
-    }
-    return -1;
-}
-
-static int hip_hadb_set_input_filter_function_set(hip_ha_t *entry,
-                                                  hip_input_filter_func_set_t 
*new_func_set)
-{
-    if (entry) {
-        entry->hadb_input_filter_func = new_func_set;
-        return 0;
-    }
-    return -1;
-}
-
-static int hip_hadb_set_output_filter_function_set(hip_ha_t *entry,
-                                                   
hip_output_filter_func_set_t *new_func_set)
-{
-    if (entry) {
-        entry->hadb_output_filter_func = new_func_set;
-        return 0;
-    }
-    return -1;
-}
-
-/**
  * Inits a Host Association after memory allocation.
  *
  * @param  entry pointer to a host association
@@ -677,34 +590,6 @@
     entry->hastate       = HIP_HASTATE_INVALID;
     entry->purge_timeout = HIP_HA_PURGE_TIMEOUT;
 
-    /* Function pointer sets which define HIP behavior in respect to the
-     * hadb_entry. */
-    HIP_IFEL(hip_hadb_set_rcv_function_set(entry, &default_rcv_func_set),
-             -1, "Can't set new function pointer set.\n");
-    HIP_IFEL(hip_hadb_set_handle_function_set(entry,
-                                              &default_handle_func_set),
-             -1, "Can't set new function pointer set.\n");
-    /*HIP_IFEL(hip_hadb_set_update_function_set(entry,
-     *                                        &default_update_func_set),
-     *       -1, "Can't set new function pointer set\n");*/
-
-    HIP_IFEL(hip_hadb_set_misc_function_set(entry, &default_misc_func_set),
-             -1, "Can't set new function pointer set.\n");
-
-    /* Set the xmit function set as function set for sending raw HIP. */
-    HIP_IFEL(hip_hadb_set_xmit_function_set(entry, &default_xmit_func_set),
-             -1, "Can't set new function pointer set.\n");
-
-    HIP_IFEL(hip_hadb_set_input_filter_function_set(
-                 entry, &default_input_filter_func_set), -1,
-             "Can't set new input filter function pointer set.\n");
-    HIP_IFEL(hip_hadb_set_output_filter_function_set(
-                 entry, &default_output_filter_func_set), -1,
-             "Can't set new output filter function pointer set.\n");
-
-    /* added by Tao Wan, on 24, Jan, 2008 */
-    entry->hadb_ipsec_func = &default_ipsec_func_set;
-
     //initialize the peer hostname
     memset(entry->peer_hostname, '\0', HIP_HOST_ID_HOSTNAME_LEN_MAX);
 
@@ -1127,206 +1012,13 @@
 
 void hip_init_hadb(void)
 {
-    /** @todo Check for errors. */
-
     /* The next line initializes the hash table for host associations. Note
      * that we are using callback wrappers IMPLEMENT_LHASH_HASH_FN and
      * IMPLEMENT_LHASH_COMP_FN defined in the beginning of this file. These
      * provide automagic variable casts, so that all elements stored in the
      * hash table are cast to hip_ha_t. Lauri 09.10.2007 16:58. */
-
-    hadb_hit                                   = 
hip_ht_init(LHASH_HASH_FN(hip_ha),
-                                                             
LHASH_COMP_FN(hip_ha));
-
-    /* initialize default function pointer sets for receiving messages*/
-    default_rcv_func_set.hip_receive_i1        = hip_receive_i1;
-    default_rcv_func_set.hip_receive_r1        = hip_receive_r1;
-    default_rcv_func_set.hip_receive_i2        = hip_receive_i2;
-    default_rcv_func_set.hip_receive_r2        = hip_receive_r2;
-    /* TODO Need hook for modularization */
-    default_rcv_func_set.hip_receive_update    = hip_receive_update;
-    default_rcv_func_set.hip_receive_notify    = hip_receive_notify;
-    default_rcv_func_set.hip_receive_bos       = hip_receive_bos;
-    default_rcv_func_set.hip_receive_close     = hip_receive_close;
-    default_rcv_func_set.hip_receive_close_ack = hip_receive_close_ack;
-
-    /* initialize alternative function pointer sets for receiving messages*/
-    /* insert your alternative function sets here!*/
-
-    /* initialize default function pointer sets for handling messages*/
-    default_handle_func_set.hip_handle_i1        = hip_handle_i1;
-    default_handle_func_set.hip_handle_r1        = hip_handle_r1;
-    default_handle_func_set.hip_handle_i2        = hip_handle_i2;
-    default_handle_func_set.hip_handle_r2        = hip_handle_r2;
-    default_handle_func_set.hip_handle_bos       = hip_handle_bos;
-    default_handle_func_set.hip_handle_close     = hip_handle_close;
-    default_handle_func_set.hip_handle_close_ack = hip_handle_close_ack;
-
-    /* initialize alternative function pointer sets for handling messages*/
-    /* insert your alternative function sets here!*/
-
-    /* initialize default function pointer sets for misc functions*/
-    default_misc_func_set.hip_solve_puzzle            = hip_solve_puzzle;
-    default_misc_func_set.hip_produce_keying_material = 
hip_produce_keying_material;
-    default_misc_func_set.hip_create_i2               = hip_create_i2;
-    default_misc_func_set.hip_create_r2               = hip_create_r2;
-    default_misc_func_set.hip_build_network_hdr       = hip_build_network_hdr;
-
-    /* initialize alternative function pointer sets for misc functions*/
-    /* insert your alternative function sets here!*/
-
-    /* initialize default function pointer sets for update functions*/
-    /*default_update_func_set.hip_handle_update_plain_locator  = 
hip_handle_update_plain_locator_old;
-     * default_update_func_set.hip_handle_update_addr_verify   = 
hip_handle_update_addr_verify_old;
-     * default_update_func_set.hip_update_handle_ack           = 
hip_update_handle_ack_old;
-     * default_update_func_set.hip_handle_update_established   = 
hip_handle_update_established_old;
-     * default_update_func_set.hip_handle_update_rekeying      = 
hip_handle_update_rekeying_old;
-     * default_update_func_set.hip_update_send_addr_verify     = 
hip_update_send_addr_verify_deprecated;
-     * default_update_func_set.hip_update_send_echo            = 
hip_update_send_echo_old;*/
-
-    /* xmit function set */
-#ifdef CONFIG_HIP_I3
-    if (hip_get_hi3_status()) {
-        default_xmit_func_set.hip_send_pkt = hip_send_i3;
-    } else
-#endif
-    {
-        default_xmit_func_set.hip_send_pkt = hip_send_pkt;
-    }
-
-
-    nat_xmit_func_set.hip_send_pkt = hip_send_pkt;
-
-    /* filter function sets */
-    /* Compiler warning: assignment from incompatible pointer type.
-     * Please fix this, if you know what is the correct value.
-     * -Lauri 25.09.2007 15:11. */
-    /* Wirtz 27/11/09 pointers are completely incomp. ( 1param to 4 params )
-     *  uncommented, please fix or remove completely */
-    // default_input_filter_func_set.hip_input_filter = hip_agent_filter;
-    // default_output_filter_func_set.hip_output_filter = hip_agent_filter;
-
-    /* Tao Wan and Miika komu added, 24 Jan, 2008 for IPsec (userspace / 
kernel part)
-     *
-     * copy in user_ipsec_hipd_msg.c */
-    if (hip_use_userspace_ipsec) {
-        default_ipsec_func_set.hip_add_sa                        = 
hip_userspace_ipsec_add_sa;
-        default_ipsec_func_set.hip_delete_sa                     = 
hip_userspace_ipsec_delete_sa;
-        default_ipsec_func_set.hip_setup_hit_sp_pair             = 
hip_userspace_ipsec_setup_hit_sp_pair;
-        default_ipsec_func_set.hip_delete_hit_sp_pair            = 
hip_userspace_ipsec_delete_hit_sp_pair;
-        default_ipsec_func_set.hip_flush_all_policy              = 
hip_userspace_ipsec_flush_all_policy;
-        default_ipsec_func_set.hip_flush_all_sa                  = 
hip_userspace_ipsec_flush_all_sa;
-        default_ipsec_func_set.hip_acquire_spi                   = 
hip_acquire_spi;
-        default_ipsec_func_set.hip_delete_default_prefix_sp_pair = 
hip_userspace_ipsec_delete_default_prefix_sp_pair;
-        default_ipsec_func_set.hip_setup_default_sp_prefix_pair  = 
hip_userspace_ipsec_setup_default_sp_prefix_pair;
-    } else {
-        default_ipsec_func_set.hip_add_sa                        = hip_add_sa;
-        default_ipsec_func_set.hip_delete_sa                     = 
hip_delete_sa;
-        default_ipsec_func_set.hip_setup_hit_sp_pair             = 
hip_setup_hit_sp_pair;
-        default_ipsec_func_set.hip_delete_hit_sp_pair            = 
hip_delete_hit_sp_pair;
-        default_ipsec_func_set.hip_flush_all_policy              = 
hip_flush_all_policy;
-        default_ipsec_func_set.hip_flush_all_sa                  = 
hip_flush_all_sa;
-        default_ipsec_func_set.hip_acquire_spi                   = 
hip_acquire_spi;
-        default_ipsec_func_set.hip_delete_default_prefix_sp_pair = 
hip_delete_default_prefix_sp_pair;
-        default_ipsec_func_set.hip_setup_default_sp_prefix_pair  = 
hip_setup_default_sp_prefix_pair;
-    }
-}
-
-hip_xmit_func_set_t *hip_get_xmit_default_func_set(void)
-{
-    return &default_xmit_func_set;
-}
-
-hip_misc_func_set_t *hip_get_misc_default_func_set(void)
-{
-    return &default_misc_func_set;
-}
-
-hip_input_filter_func_set_t *hip_get_input_filter_default_func_set(void)
-{
-    return &default_input_filter_func_set;
-}
-
-hip_output_filter_func_set_t *hip_get_output_filter_default_func_set(void)
-{
-    return &default_output_filter_func_set;
-}
-
-hip_rcv_func_set_t *hip_get_rcv_default_func_set(void)
-{
-    return &default_rcv_func_set;
-}
-
-hip_handle_func_set_t *hip_get_handle_default_func_set(void)
-{
-    return &default_handle_func_set;
-}
-
-/**
- * Sets function pointer set for an hadb record. Pointer values will not be
- * copied!
- *
- * @param entry         a pointer to the hadb record
- * @param new_func_set  a pointer to the new function set
- * @return              0 if everything was stored successfully, otherwise < 0.
- */
-int hip_hadb_set_rcv_function_set(hip_ha_t *entry,
-                                  hip_rcv_func_set_t *new_func_set)
-{
-    /** @todo add check whether all function pointers are set */
-    if (entry) {
-        entry->hadb_rcv_func = new_func_set;
-        return 0;
-    }
-    return -1;
-}
-
-/**
- * Sets function pointer set for an hadb record. Pointer values will not be
- * copied!
- *
- * @param entry        a pointer to the hadb record.
- * @param new_func_set a pointer to the new function set.
- * @return             0 if everything was stored successfully, otherwise < 0.
- */
-int hip_hadb_set_handle_function_set(hip_ha_t *entry,
-                                     hip_handle_func_set_t *new_func_set)
-{
-    /** @todo add check whether all function pointers are set. */
-    if (entry) {
-        entry->hadb_handle_func = new_func_set;
-        return 0;
-    }
-    return -1;
-}
-
-/* @todo Are these functions needed? */
-#if 0
-hip_update_func_set_t *hip_get_update_default_func_set()
-{
-    return &default_update_func_set;
-}
-
-/**
- * Sets function pointer set for an hadb record. Pointer values will not be
- * copied!
- *
- * @param entry        a pointer to the hadb record.
- * @param new_func_set a pointer to the new function set.
- * @return             0 if everything was stored successfully, otherwise < 0.
- */
-int hip_hadb_set_update_function_set(hip_ha_t *entry,
-                                     hip_update_func_set_t *new_func_set)
-{
-    /** @todo add check whether all function pointers are set */
-    if (entry) {
-        entry->hadb_update_func = new_func_set;
-        return 0;
-    }
-    //HIP_ERROR("Func pointer set malformed. Func pointer set NOT appied.");
-    return -1;
-}
-#endif /* 0 */
+    hadb_hit = hip_ht_init(LHASH_HASH_FN(hip_ha), LHASH_COMP_FN(hip_ha));
+}
 
 /* NOTE! When modifying this function, remember that some control values may
  * not be allowed to co-exist. Therefore the logical OR might not be enough
@@ -1885,10 +1577,8 @@
     int prev_spi_in  = ha->spi_inbound_current;
 
     // Delete previous security policies
-    ha->hadb_ipsec_func->hip_delete_hit_sp_pair(&ha->hit_our, &ha->hit_peer,
-                                                IPPROTO_ESP, 1);
-    ha->hadb_ipsec_func->hip_delete_hit_sp_pair(&ha->hit_peer, &ha->hit_our,
-                                                IPPROTO_ESP, 1);
+    hip_delete_hit_sp_pair(&ha->hit_our, &ha->hit_peer, IPPROTO_ESP, 1);
+    hip_delete_hit_sp_pair(&ha->hit_peer, &ha->hit_our, IPPROTO_ESP, 1);
 
     // Delete the previous SAs
     HIP_DEBUG("Previous SPI out =0x%x\n", prev_spi_out);
@@ -1897,10 +1587,16 @@
     HIP_DEBUG_IN6ADDR("Our current active addr", &ha->our_addr);
     HIP_DEBUG_IN6ADDR("Peer's current active addr", &ha->peer_addr);
 
-    default_ipsec_func_set.hip_delete_sa(prev_spi_out, &ha->peer_addr,
-                                         &ha->our_addr, HIP_SPI_DIRECTION_OUT, 
ha);
-    default_ipsec_func_set.hip_delete_sa(prev_spi_in, &ha->our_addr,
-                                         &ha->peer_addr, HIP_SPI_DIRECTION_IN, 
ha);
+    hip_delete_sa(prev_spi_out,
+                  &ha->peer_addr,
+                  &ha->our_addr,
+                  HIP_SPI_DIRECTION_OUT,
+                  ha);
+    hip_delete_sa(prev_spi_in,
+                  &ha->our_addr,
+                  &ha->peer_addr,
+                  HIP_SPI_DIRECTION_IN,
+                  ha);
 
     return;
 };
@@ -1916,18 +1612,31 @@
     hip_delete_security_associations_and_sp(ha);
 
     // Create a new security policy
-    HIP_IFEL(ha->hadb_ipsec_func->hip_setup_hit_sp_pair(&ha->hit_peer,
-                                                        &ha->hit_our, 
dst_addr, src_addr, IPPROTO_ESP, 1, 0),
-             -1, "Setting up SP pair failed\n");
+    HIP_IFEL(hip_setup_hit_sp_pair(&ha->hit_peer,
+                                   &ha->hit_our,
+                                   dst_addr,
+                                   src_addr,
+                                   IPPROTO_ESP,
+                                   1,
+                                   0),
+            -1, "Setting up SP pair failed\n");
 
     // Create a new inbound SA
     HIP_DEBUG("Creating a new inbound SA, SPI=0x%x\n", new_spi_in);
 
-    HIP_IFEL(ha->hadb_ipsec_func->hip_add_sa(dst_addr, src_addr,
-                                             &ha->hit_peer, &ha->hit_our, 
new_spi_in, ha->esp_transform,
-                                             &ha->esp_in, &ha->auth_in, 1, 
HIP_SPI_DIRECTION_IN, 0,
-                                             ha), -1,
-             "Error while changing inbound security association\n");
+    HIP_IFEL(hip_add_sa(dst_addr,
+                        src_addr,
+                        &ha->hit_peer,
+                        &ha->hit_our,
+                        new_spi_in,
+                        ha->esp_transform,
+                        &ha->esp_in,
+                        &ha->auth_in,
+                        1,
+                        HIP_SPI_DIRECTION_IN,
+                        0,
+                        ha),
+             -1, "Error while changing inbound security association\n");
 
     HIP_DEBUG("New inbound SA created with SPI=0x%x\n", new_spi_in);
 
@@ -1939,11 +1648,19 @@
     HIP_DEBUG("Creating a new outbound SA, SPI=0x%x\n", new_spi_out);
     ha->local_udp_port = ha->nat_mode ? hip_get_local_nat_udp_port() : 0;
 
-    HIP_IFEL(ha->hadb_ipsec_func->hip_add_sa(src_addr, dst_addr,
-                                             &ha->hit_our, &ha->hit_peer, 
new_spi_out, ha->esp_transform,
-                                             &ha->esp_out, &ha->auth_out, 1, 
HIP_SPI_DIRECTION_OUT, 0,
-                                             ha), -1,
-             "Error while changing outbound security association\n");
+    HIP_IFEL(hip_add_sa(src_addr,
+                        dst_addr,
+                        &ha->hit_our,
+                        &ha->hit_peer,
+                        new_spi_out,
+                        ha->esp_transform,
+                        &ha->esp_out,
+                        &ha->auth_out,
+                        1,
+                        HIP_SPI_DIRECTION_OUT,
+                        0,
+                        ha),
+             -1, "Error while changing outbound security association\n");
 
     HIP_DEBUG("New outbound SA created with SPI=0x%x\n", new_spi_out);
 

=== modified file 'hipd/hadb.h'
--- hipd/hadb.h 2010-02-18 14:18:07 +0000
+++ hipd/hadb.h 2010-02-22 18:30:02 +0000
@@ -93,41 +93,12 @@
 
 hip_ha_t *hip_hadb_create_state(int gfpmask);
 
-#if 0
-typedef struct hip_peer_addr_opaque {
-    struct in6_addr              addr;
-    struct hip_peer_addr_opaque *next;
-} hip_peer_addr_opaque_t;         /* Structure to record peer addresses */
-
-typedef struct hip_peer_entry_opaque {
-    unsigned int                  count;
-    struct hip_host_id *          host_id;
-    hip_hit_t                     hit;
-    hip_peer_addr_opaque_t *      addr_list;
-    struct hip_peer_entry_opaque *next;
-} hip_peer_entry_opaque_t;         /* Structure to record kernel peer entry */
-
-typedef struct hip_peer_opaque {
-    unsigned int                  count;
-    struct hip_peer_entry_opaque *head;
-    struct hip_peer_entry_opaque *end;
-} hip_peer_opaque_t;         /* Structure to record kernel peer list */
-#endif
-
 int hip_for_each_ha(int(func) (hip_ha_t * entry, void *opaq), void *opaque);
 
 /* next 2 functions are not called from outside but make sense and are
  * 'proposed' in libhipcore/state.h
  */
 
-int hip_hadb_set_rcv_function_set(hip_ha_t *entry,
-                                  hip_rcv_func_set_t *new_func_set);
-int hip_hadb_set_handle_function_set(hip_ha_t *entry,
-                                     hip_handle_func_set_t *new_func_set);
-
-int hip_hadb_set_xmit_function_set(hip_ha_t *entry,
-                                   hip_xmit_func_set_t *new_func_set);
-
 void hip_hadb_set_local_controls(hip_ha_t *entry, hip_controls_t mask);
 void hip_hadb_set_peer_controls(hip_ha_t *entry, hip_controls_t mask);
 void hip_hadb_cancel_local_controls(hip_ha_t *entry, hip_controls_t mask);
@@ -149,7 +120,4 @@
                                               in6_addr_t *src_addr,
                                               in6_addr_t *dst_addr);
 
-hip_rcv_func_set_t *hip_get_rcv_default_func_set(void);
-hip_handle_func_set_t *hip_get_handle_default_func_set(void);
-
 #endif /* HIP_HIPD_HADB_H */

=== modified file 'hipd/hiprelay.c'
--- hipd/hiprelay.c     2010-02-12 15:40:01 +0000
+++ hipd/hiprelay.c     2010-02-22 18:30:02 +0000
@@ -409,10 +409,9 @@
                                const uint8_t lifetime,
                                const in6_addr_t *hit_r, const hip_hit_t *ip_r,
                                const in_port_t port,
-                               const hip_crypto_key_t *hmac,
-                               const hip_xmit_func_t func)
+                               const hip_crypto_key_t *hmac)
 {
-    if (hit_r == NULL || ip_r == NULL || hmac == NULL || func == NULL) {
+    if (hit_r == NULL || ip_r == NULL || hmac == NULL) {
         return NULL;
     }
 
@@ -427,7 +426,6 @@
     memcpy(&(rec->ip_r), ip_r, sizeof(*ip_r));
     rec->udp_port_r = port;
     memcpy(&(rec->hmac_relay), hmac, sizeof(*hmac));
-    rec->send_fn    = func;
     hip_relrec_set_lifetime(rec, lifetime);
     rec->created    = time(NULL);
 
@@ -729,7 +727,7 @@
                               rec->udp_port_r, msg_to_be_relayed, NULL, 0),
                  -ECOMM, "Relaying the packet failed.\n");
     } else {
-        HIP_IFEL(rec->send_fn(NULL, &(rec->ip_r), hip_get_local_nat_udp_port(),
+        HIP_IFEL(hip_send_pkt(NULL, &(rec->ip_r), hip_get_local_nat_udp_port(),
                               rec->udp_port_r, msg_to_be_relayed, NULL, 0),
                  -ECOMM, "Relaying the packet failed.\n");
     }

=== modified file 'hipd/hiprelay.h'
--- hipd/hiprelay.h     2010-02-17 13:08:39 +0000
+++ hipd/hiprelay.h     2010-02-22 18:30:02 +0000
@@ -120,8 +120,6 @@
     in_port_t        udp_port_r;
     /** Integrity key established while registration occurred. */
     hip_crypto_key_t hmac_relay;
-    /** Function pointer to send function (raw or udp). */
-    hip_xmit_func_t  send_fn;
 } hip_relrec_t;
 
 /**
@@ -323,8 +321,7 @@
                                const uint8_t lifetime,
                                const in6_addr_t *hit_r, const hip_hit_t *ip_r,
                                const in_port_t port,
-                               const hip_crypto_key_t *hmac,
-                               const hip_xmit_func_t func);
+                               const hip_crypto_key_t *hmac);
 
 /**
  * Deletes all entries of @c type from the relay record hashtable and frees the

=== modified file 'hipd/init.c'
--- hipd/init.c 2010-02-17 15:59:39 +0000
+++ hipd/init.c 2010-02-22 18:30:02 +0000
@@ -556,13 +556,13 @@
     HIP_DEBUG("hip_icmp_sock = %d\n", hip_icmp_sock);
 
     if (flush_ipsec) {
-        default_ipsec_func_set.hip_flush_all_sa();
-        default_ipsec_func_set.hip_flush_all_policy();
+        hip_flush_all_sa();
+        hip_flush_all_policy();
     }
 
     HIP_DEBUG("Setting SP\n");
-    default_ipsec_func_set.hip_delete_default_prefix_sp_pair();
-    HIP_IFE(default_ipsec_func_set.hip_setup_default_sp_prefix_pair(), -1);
+    hip_delete_default_prefix_sp_pair();
+    HIP_IFE(hip_setup_default_sp_prefix_pair(), -1);
 
     HIP_DEBUG("Setting iface %s\n", HIP_HIT_DEV);
     set_up_device(HIP_HIT_DEV, 0);
@@ -628,11 +628,13 @@
         nsupdate(1);
     }
 
-       /* Initialize modules */
-       HIP_INFO("Initializing modules.\n");
-       for (i = 0; i < num_modules_hipd; i++) {
-               HIP_IFEL(hipd_init_functions[i](), -1, "Module initialization 
failed.\n");
-       }
+    /* Initialize modules */
+    HIP_INFO("Initializing modules.\n");
+    for (i = 0; i < num_modules_hipd; i++) {
+            HIP_IFEL(hipd_init_functions[i](),
+                     -1,
+                     "Module initialization failed.\n");
+    }
 
 out_err:
     return err;
@@ -857,7 +859,7 @@
     struct hip_common *msg = NULL;
     HIP_ERROR("Signal: %d\n", signal);
 
-    default_ipsec_func_set.hip_delete_default_prefix_sp_pair();
+    hip_delete_default_prefix_sp_pair();
     /* Close SAs with all peers */
     // hip_send_close(NULL);
 

=== modified file 'hipd/input.c'
--- hipd/input.c        2010-02-22 17:37:48 +0000
+++ hipd/input.c        2010-02-22 18:30:02 +0000
@@ -570,17 +570,6 @@
         entry = hip_oppdb_get_hadb_entry_i1_r1(msg, src_addr,
                                                dst_addr,
                                                msg_info);
-    } else {
-        /* Ugly bug fix for "conntest-client hostname tcp 12345"
-         * where hostname maps to HIT and IP in hosts files.
-         * Why the heck the receive function points here to
-         * receive_opp_r1 even though we have a regular entry? */
-
-        /* What is the point of having receive function pointer anyways?
-         * Not to mention a SET of them... */
-        if (entry) {
-            entry->hadb_rcv_func->hip_receive_r1 = hip_receive_r1;
-        }
     }
 #endif
 
@@ -610,7 +599,7 @@
 #endif
         /* No state. */
         HIP_DEBUG("Received HIP_I1 message\n");
-        err = (hip_get_rcv_default_func_set())->hip_receive_i1(&ctx);
+        err = hip_receive_i1(&ctx);
 #ifdef CONFIG_HIP_PERFORMANCE
         HIP_DEBUG("Stop and write PERF_I1\n");
         hip_perf_stop_benchmark(perf_set, PERF_I1);
@@ -645,9 +634,7 @@
 #endif
         /* State. */
         HIP_IFEL(!entry, -1, "No entry when receiving R1\n");
-        HIP_IFCS(entry, err = entry->hadb_rcv_func->
-                              hip_receive_r1(msg, src_addr, dst_addr, entry,
-                                             msg_info));
+        HIP_IFCS(entry, err = hip_receive_r1(msg, src_addr, dst_addr, entry, 
msg_info));
 #ifdef CONFIG_HIP_PERFORMANCE
         HIP_DEBUG("Stop and write PERF_R1\n");
         hip_perf_stop_benchmark(perf_set, PERF_R1);
@@ -660,9 +647,7 @@
         HIP_DEBUG("Start PERF_R2\n");
         hip_perf_start_benchmark(perf_set, PERF_R2);
 #endif
-        HIP_IFCS(entry, err = entry->hadb_rcv_func->
-                              hip_receive_r2(msg, src_addr, dst_addr, entry,
-                                             msg_info));
+        HIP_IFCS(entry, err = hip_receive_r2(msg, src_addr, dst_addr, entry, 
msg_info));
 #ifdef CONFIG_HIP_PERFORMANCE
         HIP_DEBUG("Stop and write PERF_R2\n");
         hip_perf_stop_benchmark(perf_set, PERF_R2);
@@ -672,18 +657,15 @@
 
     case HIP_UPDATE:
         HIP_DEBUG_HIT("received an UPDATE:  ", src_addr );
-        HIP_IFCS(entry, err = entry->hadb_rcv_func->hip_receive_update(&ctx));
+        HIP_IFCS(entry, err = hip_receive_update(&ctx));
         break;
 
     case HIP_NOTIFY:
-        HIP_IFCS(entry, err = entry->hadb_rcv_func->
-                              hip_receive_notify(msg, src_addr, dst_addr, 
entry));
+        HIP_IFCS(entry, err = hip_receive_notify(msg, src_addr, dst_addr, 
entry));
         break;
 
     case HIP_BOS:
-        err = (hip_get_rcv_default_func_set())->
-              hip_receive_bos(msg, src_addr, dst_addr, entry,
-                              msg_info);
+        err = hip_receive_bos(msg, src_addr, dst_addr, entry, msg_info);
 
         /*In case of BOS the msg->hitr is null, therefore it is replaced
          * with our own HIT, so that the beet state can also be
@@ -700,8 +682,7 @@
         HIP_DEBUG("Start PERF_HANDLE_CLOSE\n");
         hip_perf_start_benchmark(perf_set, PERF_HANDLE_CLOSE);
 #endif
-        HIP_IFCS(entry, err = entry->hadb_rcv_func->
-                              hip_receive_close(msg, entry));
+        HIP_IFCS(entry, err = hip_receive_close(msg, entry));
 #ifdef CONFIG_HIP_PERFORMANCE
         HIP_DEBUG("Stop and write PERF_HANDLE_CLOSE");
         hip_perf_stop_benchmark(perf_set, PERF_HANDLE_CLOSE);
@@ -714,8 +695,7 @@
         HIP_DEBUG("Start PERF_HANDLE_CLOSE_ACK\n");
         hip_perf_start_benchmark(perf_set, PERF_HANDLE_CLOSE_ACK);
 #endif
-        HIP_IFCS(entry, err = entry->hadb_rcv_func->
-                              hip_receive_close_ack(msg, entry));
+        HIP_IFCS(entry, err = hip_receive_close_ack(msg, entry));
 #ifdef CONFIG_HIP_PERFORMANCE
         HIP_DEBUG("Stop and write PERF_HANDLE_CLOSE_ACK\n");
         hip_perf_stop_benchmark(perf_set, PERF_HANDLE_CLOSE_ACK);
@@ -860,11 +840,7 @@
 
     HIP_DEBUG("Build normal I2.\n");
     /* create I2 */
-    entry->hadb_misc_func->hip_build_network_hdr(i2,
-                                                 HIP_I2,
-                                                 mask,
-                                                 &(ctx->input->hitr),
-                                                 &(ctx->input->hits));
+    hip_build_network_hdr(i2, HIP_I2, mask, &(ctx->input->hitr), 
&(ctx->input->hits));
 
     /********** ESP_INFO **********/
     /* SPI is set below */
@@ -1057,10 +1033,10 @@
     /* XXX: -EAGAIN */
     HIP_DEBUG("set up inbound IPsec SA, SPI=0x%x (host)\n", spi_in);
 
-    HIP_IFEL(entry->hadb_ipsec_func->hip_setup_hit_sp_pair(&ctx->input->hits,
-                                                           &ctx->input->hitr,
-                                                           r1_saddr, r1_daddr,
-                                                           IPPROTO_ESP, 1, 1),
+    HIP_IFEL(hip_setup_hit_sp_pair(&ctx->input->hits,
+                                   &ctx->input->hitr,
+                                   r1_saddr, r1_daddr,
+                                   IPPROTO_ESP, 1, 1),
              -1,
              "Setting up SP pair failed\n");
 
@@ -1131,8 +1107,7 @@
     HIP_IFE(hip_hadb_get_peer_addr(entry, &daddr), -1);
 
     /* R1 packet source port becomes the I2 packet destination port. */
-    err = entry->hadb_xmit_func->
-          hip_send_pkt(r1_daddr, &daddr,
+    err = hip_send_pkt(r1_daddr, &daddr,
                        (entry->nat_mode ? hip_get_local_nat_udp_port() : 0),
                        r1_info->src_port, i2, entry, 1);
     HIP_IFEL(err < 0, -ECOMM, "Sending I2 packet failed.\n");
@@ -1257,7 +1232,7 @@
         if (entry->nat_mode == HIP_NAT_MODE_NONE) {
             entry->nat_mode = HIP_NAT_MODE_PLAIN_UDP;
         }
-        hip_hadb_set_xmit_function_set(entry, &nat_xmit_func_set);
+        //hip_hadb_set_xmit_function_set(entry, &nat_xmit_func_set);
         HIP_UNLOCK_HA(entry);
     }
 
@@ -1292,9 +1267,7 @@
 
         HIP_IFEL(!(pz = hip_get_param(r1, HIP_PARAM_PUZZLE)), -EINVAL,
                  "Malformed R1 packet. PUZZLE parameter missing\n");
-        HIP_IFEL((solved_puzzle =
-                      entry->hadb_misc_func->hip_solve_puzzle(
-                          pz, r1, HIP_SOLVE_PUZZLE)) == 0,
+        HIP_IFEL((solved_puzzle = hip_solve_puzzle(pz, r1, HIP_SOLVE_PUZZLE)) 
== 0,
                  -EINVAL, "Solving of puzzle failed\n");
         I                      = pz->I;
         entry->puzzle_solution = solved_puzzle;
@@ -1308,12 +1281,12 @@
     ctx->dh_shared_key = NULL;
     /* note: we could skip keying material generation in the case
      * of a retransmission but then we'd had to fill ctx->hmac etc */
-    HIP_IFEL(entry->hadb_misc_func->hip_produce_keying_material(r1,
-                                                                ctx,
-                                                                I,
-                                                                solved_puzzle,
-                                                                &dhpv),
-             -EINVAL, "Could not produce keying material\n");
+    HIP_IFEL(hip_produce_keying_material(r1,
+                                         ctx,
+                                         I,
+                                         solved_puzzle,
+                                         &dhpv),
+            -EINVAL, "Could not produce keying material\n");
 
     /* Everything ok, save host id to HA */
     HIP_IFE(hip_get_param_host_id_di_type_len(
@@ -1332,9 +1305,13 @@
      * because we must create an REG_REQUEST parameter based on the data
      * of the REG_INFO parameter. */
 
-    err = entry->hadb_misc_func->
-          hip_create_i2(ctx, solved_puzzle, r1_saddr, r1_daddr, entry,
-                        r1_info, dhpv);
+    err = hip_create_i2(ctx,
+                        solved_puzzle,
+                        r1_saddr,
+                        r1_daddr,
+                        entry,
+                        r1_info,
+                        dhpv);
 
     HIP_IFEL(err < 0, -1, "Creation of I2 failed\n");
 
@@ -1425,8 +1402,7 @@
     case HIP_STATE_CLOSING:
     case HIP_STATE_CLOSED:
         /* E1. The normal case. Process, send I2, goto E2. */
-        err = entry->hadb_handle_func->
-              hip_handle_r1(r1, r1_saddr, r1_daddr, entry, r1_info);
+        err = hip_handle_r1(r1, r1_saddr, r1_daddr, entry, r1_info);
         HIP_LOCK_HA(entry);
         if (err < 0) {
             HIP_ERROR("Handling of R1 failed\n");
@@ -1484,11 +1460,7 @@
 
     /* Just swap the addresses to use the I2's destination HIT as the R2's
      * source HIT. */
-    entry->hadb_misc_func->hip_build_network_hdr(r2,
-                                                 HIP_R2,
-                                                 mask,
-                                                 &entry->hit_our,
-                                                 &entry->hit_peer);
+    hip_build_network_hdr(r2, HIP_R2, mask, &entry->hit_our, &entry->hit_peer);
 
     HIP_DUMP_MSG(r2);
 
@@ -1573,12 +1545,12 @@
 
 #endif
 
-    err = entry->hadb_ipsec_func->hip_add_sa(i2_daddr, i2_saddr,
-                                             &ctx->input->hitr, 
&ctx->input->hits,
-                                             entry->spi_outbound_current,
-                                             entry->esp_transform,
-                                             &ctx->esp_out, &ctx->auth_out,
-                                             1, HIP_SPI_DIRECTION_OUT, 0, 
entry);
+    err = hip_add_sa(i2_daddr, i2_saddr,
+                     &ctx->input->hitr, &ctx->input->hits,
+                     entry->spi_outbound_current,
+                     entry->esp_transform,
+                     &ctx->esp_out, &ctx->auth_out,
+                     1, HIP_SPI_DIRECTION_OUT, 0, entry);
     if (err) {
         HIP_ERROR("Failed to setup outbound SA with SPI = %d.\n",
                   entry->spi_outbound_current);
@@ -1593,9 +1565,13 @@
     HIP_DEBUG("Set up outbound IPsec SA, SPI=0x%x\n", entry->spi_outbound_new);
 // end move
 
-    err = entry->hadb_xmit_func->hip_send_pkt(i2_daddr, i2_saddr,
-                                              (entry->nat_mode ? 
hip_get_local_nat_udp_port() : 0),
-                                              entry->peer_udp_port, r2, entry, 
1);
+    err = hip_send_pkt(i2_daddr,
+                       i2_saddr,
+                       (entry->nat_mode ? hip_get_local_nat_udp_port() : 0),
+                       entry->peer_udp_port,
+                       r2,
+                       entry,
+                       1);
 
     if (err == 1) {
         err = 0;
@@ -1994,10 +1970,10 @@
         }
         ctx->hadb_entry->local_udp_port = ctx->msg_info->dst_port;
         ctx->hadb_entry->peer_udp_port  = ctx->msg_info->src_port;
-        HIP_DEBUG("ctx->hadb_entry->hadb_xmit_func: %p.\n", 
ctx->hadb_entry->hadb_xmit_func);
         HIP_DEBUG("Setting send func to UDP for entry %p from I2 info.\n",
                   ctx->hadb_entry);
-        hip_hadb_set_xmit_function_set(ctx->hadb_entry, &nat_xmit_func_set);
+        /* @todo Is this function set needed ? */
+        //hip_hadb_set_xmit_function_set(ctx->hadb_entry, &nat_xmit_func_set);
     }
 
     ctx->hadb_entry->hip_transform = hip_tfm;
@@ -2073,18 +2049,18 @@
     /************************************************/
 
     /* Set up IPsec associations */
-    err = ctx->hadb_entry->hadb_ipsec_func->hip_add_sa(ctx->src_addr,
-                                                       ctx->dst_addr,
-                                                       &i2_context.input->hits,
-                                                       &i2_context.input->hitr,
-                                                       spi_in,
-                                                       esp_tfm,
-                                                       &i2_context.esp_in,
-                                                       &i2_context.auth_in,
-                                                       retransmission,
-                                                       HIP_SPI_DIRECTION_IN,
-                                                       0,
-                                                       ctx->hadb_entry);
+    err = hip_add_sa(ctx->src_addr,
+                     ctx->dst_addr,
+                     &i2_context.input->hits,
+                     &i2_context.input->hitr,
+                     spi_in,
+                     esp_tfm,
+                     &i2_context.esp_in,
+                     &i2_context.auth_in,
+                     retransmission,
+                     HIP_SPI_DIRECTION_IN,
+                     0,
+                     ctx->hadb_entry);
 
     /* Remove the IPsec associations if there was an error when creating
      * them.
@@ -2459,33 +2435,33 @@
     // moved from hip_create_i2
     HIP_DEBUG_HIT("hit our", &entry->hit_our);
     HIP_DEBUG_HIT("hit peer", &entry->hit_peer);
-    HIP_IFEL(entry->hadb_ipsec_func->hip_add_sa(r2_saddr,
-                                                r2_daddr,
-                                                &ctx->input->hits,
-                                                &ctx->input->hitr,
-                                                spi_in,
-                                                tfm,
-                                                &entry->esp_in,
-                                                &entry->auth_in,
-                                                0,
-                                                HIP_SPI_DIRECTION_IN,
-                                                0,
-                                                entry),
+    HIP_IFEL(hip_add_sa(r2_saddr,
+                        r2_daddr,
+                        &ctx->input->hits,
+                        &ctx->input->hitr,
+                        spi_in,
+                        tfm,
+                        &entry->esp_in,
+                        &entry->auth_in,
+                        0,
+                        HIP_SPI_DIRECTION_IN,
+                        0,
+                        entry),
             -1,
             "Failed to setup IPsec SPD/SA entries, peer:src\n");
 
-    err = entry->hadb_ipsec_func->hip_add_sa(r2_daddr,
-                                             r2_saddr,
-                                             &ctx->input->hitr,
-                                             &ctx->input->hits,
-                                             spi_recvd,
-                                             tfm,
-                                             &ctx->esp_out,
-                                             &ctx->auth_out,
-                                             0,
-                                             HIP_SPI_DIRECTION_OUT,
-                                             0,
-                                             entry);
+    err = hip_add_sa(r2_daddr,
+                     r2_saddr,
+                     &ctx->input->hitr,
+                     &ctx->input->hits,
+                     spi_recvd,
+                     tfm,
+                     &ctx->esp_out,
+                     &ctx->auth_out,
+                     0,
+                     HIP_SPI_DIRECTION_OUT,
+                     0,
+                     entry);
 
         if (err) {
             /** @todo Remove inbound IPsec SA. */
@@ -2792,20 +2768,18 @@
 
     switch (state) {
     case HIP_STATE_NONE:
-        err = ((hip_handle_func_set_t *) hip_get_handle_default_func_set())
-              ->hip_handle_i1(ctx->msg, ctx->src_addr, ctx->dst_addr, 
ctx->hadb_entry, ctx->msg_info);
+        err = hip_handle_i1(ctx->msg, ctx->src_addr, ctx->dst_addr, 
ctx->hadb_entry, ctx->msg_info);
         break;
     case HIP_STATE_I1_SENT:
         if (src_hit_is_our ||         /* loopback */
             hip_hit_is_bigger(&(ctx->hadb_entry)->hit_our,
                               &(ctx->hadb_entry)->hit_peer))
         {
-            err = ((hip_handle_func_set_t *)
-                   hip_get_handle_default_func_set())->hip_handle_i1(ctx->msg,
-                                                                     
ctx->src_addr,
-                                                                     
ctx->dst_addr,
-                                                                     
ctx->hadb_entry,
-                                                                     
ctx->msg_info);
+            err = hip_handle_i1(ctx->msg,
+                                ctx->src_addr,
+                                ctx->dst_addr,
+                                ctx->hadb_entry,
+                                ctx->msg_info);
         }
         break;
     case HIP_STATE_UNASSOCIATED:
@@ -2814,8 +2788,7 @@
     case HIP_STATE_ESTABLISHED:
     case HIP_STATE_CLOSED:
     case HIP_STATE_CLOSING:
-        err = ((hip_handle_func_set_t *) hip_get_handle_default_func_set())
-              ->hip_handle_i1(ctx->msg, ctx->src_addr, ctx->dst_addr, 
ctx->hadb_entry, ctx->msg_info);
+        err = hip_handle_i1(ctx->msg, ctx->src_addr, ctx->dst_addr, 
ctx->hadb_entry, ctx->msg_info);
         break;
     default:
         /* should not happen */
@@ -2872,11 +2845,7 @@
     switch (state) {
     case HIP_STATE_I2_SENT:
         /* The usual case. */
-        err = entry->hadb_handle_func->hip_handle_r2(hip_common,
-                                                     r2_saddr,
-                                                     r2_daddr,
-                                                     entry,
-                                                     r2_info);
+        err = hip_handle_r2(hip_common, r2_saddr, r2_daddr, entry, r2_info);
         if (err) {
             HIP_ERROR("hip_handle_r2 failed (err=%d)\n", err);
             goto out_err;
@@ -2885,11 +2854,7 @@
 
     case HIP_STATE_ESTABLISHED:
         if (entry->is_loopback) {
-            err = entry->hadb_handle_func->hip_handle_r2(hip_common,
-                                                         r2_saddr,
-                                                         r2_daddr,
-                                                         entry,
-                                                         r2_info);
+            err = hip_handle_r2(hip_common, r2_saddr, r2_daddr, entry, 
r2_info);
         }
         break;
     case HIP_STATE_R2_SENT:
@@ -3039,7 +3004,6 @@
                  * hip_common. */
                 memset(&i1, 0, sizeof(i1));
 
-                entry->hadb_misc_func->
                 hip_build_network_hdr(&i1,
                                       response,
                                       entry->local_controls,
@@ -3053,8 +3017,7 @@
 
                 /* This I1 packet must be send only once, which
                  * is why we use NULL entry for sending. */
-                err = entry->hadb_xmit_func->
-                      hip_send_pkt(&entry->our_addr, &responder_ip,
+                err = hip_send_pkt(&entry->our_addr, &responder_ip,
                                    (entry->nat_mode ? 
hip_get_local_nat_udp_port() : 0),
                                    port,
                                    &i1, NULL, 0);
@@ -3163,11 +3126,7 @@
     case HIP_STATE_I1_SENT:
     case HIP_STATE_I2_SENT:
         /* Possibly no state created yet */
-        err = (hip_get_handle_default_func_set())->hip_handle_bos(bos,
-                                                                  bos_saddr,
-                                                                  bos_daddr,
-                                                                  entry,
-                                                                  bos_info);
+        err = hip_handle_bos(bos, bos_saddr, bos_daddr, entry, bos_info);
         break;
     case HIP_STATE_R2_SENT:
     case HIP_STATE_ESTABLISHED:

=== modified file 'hipd/maintenance.c'
--- hipd/maintenance.c  2010-02-17 16:39:54 +0000
+++ hipd/maintenance.c  2010-02-22 18:30:02 +0000
@@ -77,8 +77,7 @@
                       entry->state, entry->retrans_state, entry->update_state, 
entry->retrans_state);
 
             /* @todo: verify that this works over slow ADSL line */
-            err = entry->hadb_xmit_func->
-                  hip_send_pkt(&entry->hip_msg_retrans.saddr,
+            err = hip_send_pkt(&entry->hip_msg_retrans.saddr,
                                &entry->hip_msg_retrans.daddr,
                                (entry->nat_mode ? hip_get_local_nat_udp_port() 
: 0),
                                entry->peer_udp_port,

=== modified file 'hipd/nat.c'
--- hipd/nat.c  2010-02-17 15:59:39 +0000
+++ hipd/nat.c  2010-02-22 18:30:02 +0000
@@ -154,8 +154,6 @@
         goto out_err;
     }
 
-
-    entry->hadb_misc_func->
     hip_build_network_hdr(msg, HIP_NOTIFY,
                           0, &entry->hit_our,
                           &entry->hit_peer);
@@ -168,7 +166,6 @@
      * choose to use other than hip_get_nat_udp_port() as source port, but we 
must use hip_get_nat_udp_port()
      * as destination port. However, because it is recommended to use
      * hip_get_nat_udp_port() as source port also, we choose to do so here. */
-    entry->hadb_xmit_func->
     hip_send_pkt(&entry->our_addr, &entry->peer_addr,
                  entry->local_udp_port, entry->peer_udp_port, msg,
                  entry, 0);
@@ -253,29 +250,28 @@
  */
 int hip_user_nat_mode(int nat_mode)
 {
-    int err = 0, nat;
+    int err = 0;
     HIP_DEBUG("hip_user_nat_mode() invoked. mode: %d\n", nat_mode);
 #if HIP_UDP_PORT_RANDOMIZING
     hip_nat_randomize_nat_ports();
 #endif
 
-    nat = nat_mode;
-    switch (nat) {
+    switch (nat_mode) {
     case SO_HIP_SET_NAT_PLAIN_UDP:
-        nat = HIP_NAT_MODE_PLAIN_UDP;
+        nat_mode = HIP_NAT_MODE_PLAIN_UDP;
         break;
     case SO_HIP_SET_NAT_NONE:
-        nat = HIP_NAT_MODE_NONE;
+        nat_mode = HIP_NAT_MODE_NONE;
         break;
     default:
         err = -1;
         HIP_IFEL(1, -1, "Unknown nat mode %d\n", nat_mode);
     }
-    HIP_IFEL(hip_for_each_ha(hip_ha_set_nat_mode, (void *) &nat), 0,
+    HIP_IFEL(hip_for_each_ha(hip_ha_set_nat_mode, (void *) &nat_mode), 0,
              "Error from for_each_ha().\n");
-    //set the nat mode for the host
-    hip_nat_status = nat;
 
+    /* set the NAT mode for the host */
+    hip_nat_status = nat_mode;
 
     HIP_DEBUG("hip_user_nat_mode() end. mode: %d\n", hip_nat_status);
 
@@ -309,7 +305,7 @@
 {
     int err = 0;
     if (entry && mode != HIP_NAT_MODE_NONE) {
-        hip_hadb_set_xmit_function_set(entry, &nat_xmit_func_set);
+        //hip_hadb_set_xmit_function_set(entry, &nat_xmit_func_set);
         entry->nat_mode = *((hip_transform_suite_t *) mode);
         HIP_DEBUG("NAT status of host association %p: %d\n",
                   entry, entry->nat_mode);

=== modified file 'hipd/oppdb.c'
--- hipd/oppdb.c        2010-02-17 16:39:54 +0000
+++ hipd/oppdb.c        2010-02-22 18:30:02 +0000
@@ -47,11 +47,6 @@
                                const struct in6_addr *ip_peer,
                                const struct in6_addr *ip_our,
                                const struct sockaddr_in6 *caller);
-static int hip_receive_opp_r1(struct hip_common *msg,
-                              struct in6_addr *src_addr,
-                              struct in6_addr *dst_addr,
-                              hip_ha_t *opp_entry,
-                              hip_portpair_t *msg_info);
 static int hip_force_opptcp_fallback(hip_opp_block_t *entry, void *ips);
 
 static unsigned long hip_oppdb_hash_hit(const void *ptr)
@@ -216,6 +211,7 @@
     return err;
 }
 
+#if 0
 static int hip_oppdb_unblock_group(hip_opp_block_t *entry, void *ptr)
 {
     hip_opp_info_t *opp_info = (hip_opp_info_t *) ptr;
@@ -233,6 +229,7 @@
 out_err:
     return err;
 }
+#endif
 
 static hip_opp_block_t *hip_create_opp_block_entry(void)
 {
@@ -364,6 +361,8 @@
     return entry;
 }
 
+
+#if 0
 static int hip_receive_opp_r1(struct hip_common *msg,
                               struct in6_addr *src_addr,
                               struct in6_addr *dst_addr,
@@ -428,21 +427,18 @@
     ipv6_addr_copy(&opp_info.peer_addr, src_addr);
     hip_for_each_opp(hip_oppdb_unblock_group, &opp_info);
 
-
     /* why is the receive entry still pointing to hip_receive_opp_r1 ? */
-    entry->hadb_rcv_func->hip_receive_r1 = hip_receive_r1;
+    /* @todo is this function set needed? */
+    //entry->hadb_rcv_func->hip_receive_r1 = hip_receive_r1;
     HIP_IFCS(entry,
-             (err = entry->hadb_rcv_func->hip_receive_r1(msg,
-                                                         src_addr,
-                                                         dst_addr,
-                                                         entry,
-                                                         msg_info)));
+             (err = hip_receive_r1(msg, src_addr, dst_addr, entry, msg_info)));
     hip_del_peer_info_entry(opp_entry);
 
 out_err:
 
     return err;
 }
+#endif
 
 hip_ha_t *hip_opp_add_map(const struct in6_addr *dst_ip,
                           const struct in6_addr *hit_our,
@@ -486,7 +482,8 @@
              "Did not find entry\n");
 
     /* Override the receiving function */
-    ha->hadb_rcv_func->hip_receive_r1 = hip_receive_opp_r1;
+    /* @todo is this function set needed? */
+    //ha->hadb_rcv_func->hip_receive_r1 = hip_receive_opp_r1;
 
     HIP_IFEL(hip_oppdb_add_entry(&opp_hit, hit_our, dst_ip, &src_ip,
                                  caller), -1, "Add db failed\n");
@@ -615,7 +612,8 @@
              "Did not find entry\n");
 
     /* Override the receiving function */
-    ha->hadb_rcv_func->hip_receive_r1 = hip_receive_opp_r1;
+    /* @todo is this function set needed? */
+    //ha->hadb_rcv_func->hip_receive_r1 = hip_receive_opp_r1;
 
     //entry = hip_oppdb_find_byhits(&phit, src);
     //HIP_ASSERT(!entry);

=== modified file 'hipd/output.c'
--- hipd/output.c       2010-02-17 16:39:54 +0000
+++ hipd/output.c       2010-02-22 18:30:02 +0000
@@ -361,13 +361,7 @@
 #endif // CONFIG_HIP_OPPORTUNISTIC
 
     HIP_DEBUG_HIT("BEFORE sending", peer_addr);
-    err = entry->hadb_xmit_func-> hip_send_pkt(local_addr,
-                                               peer_addr,
-                                               src_port,
-                                               dst_port,
-                                               i1,
-                                               entry,
-                                               1);
+    err = hip_send_pkt(local_addr, peer_addr, src_port, dst_port, i1, entry, 
1);
 
     HIP_DEBUG("err after sending: %d.\n", err);
 
@@ -443,11 +437,7 @@
 
     i1 = hip_msg_alloc();
 
-    entry->hadb_misc_func-> hip_build_network_hdr(i1,
-                                                  HIP_I1,
-                                                  mask,
-                                                  &entry->hit_our,
-                                                  dst_hit);
+    hip_build_network_hdr(i1, HIP_I1, mask, &entry->hit_our, dst_hit);
 
     /* Calculate the HIP header length */
     hip_calc_hdr_len(i1);

=== modified file 'hipd/registration.c'
--- hipd/registration.c 2010-02-17 15:59:39 +0000
+++ hipd/registration.c 2010-02-22 18:30:02 +0000
@@ -910,8 +910,7 @@
                     type, granted_lifetime, &(entry->hit_peer),
                     &(entry->peer_addr),
                     entry->peer_udp_port,
-                    &(entry->hip_hmac_in),
-                    entry->hadb_xmit_func->hip_send_pkt);
+                    &(entry->hip_hmac_in));
 
                 hip_relht_put(new_record);
 

=== modified file 'hipd/user_ipsec_hipd_msg.c'
--- hipd/user_ipsec_hipd_msg.c  2010-02-17 14:11:29 +0000
+++ hipd/user_ipsec_hipd_msg.c  2010-02-22 18:30:02 +0000
@@ -43,9 +43,9 @@
      * -> firewall might already be closed when user-message arrives */
     if (hip_use_userspace_ipsec) {
         HIP_DEBUG("flushing all ipsec policies in the kernel...\n");
-        default_ipsec_func_set.hip_flush_all_policy();
+        hip_flush_all_policy();
         HIP_DEBUG("flushing all ipsec SAs in the kernel...\n");
-        default_ipsec_func_set.hip_flush_all_sa();
+        hip_flush_all_sa();
     }
 
 #if 0 /* see bug id 816 */
@@ -53,42 +53,9 @@
       // This removes HA from HADB as well as it removes mapping
       // BUG
     HIP_IFEL(hip_send_close(NULL, 0), -1, "failed to close all connections");
+out_err:
 #endif
 
-    /* reset the ipsec function set
-     *
-     * copied from hadb.c */
-    if (hip_use_userspace_ipsec) {
-        HIP_DEBUG("reseting ipsec function set to userspace api\n");
-
-        default_ipsec_func_set.hip_add_sa                        = 
hip_userspace_ipsec_add_sa;
-        default_ipsec_func_set.hip_delete_sa                     = 
hip_userspace_ipsec_delete_sa;
-        default_ipsec_func_set.hip_setup_hit_sp_pair             = 
hip_userspace_ipsec_setup_hit_sp_pair;
-        default_ipsec_func_set.hip_delete_hit_sp_pair            = 
hip_userspace_ipsec_delete_hit_sp_pair;
-        default_ipsec_func_set.hip_flush_all_policy              = 
hip_userspace_ipsec_flush_all_policy;
-        default_ipsec_func_set.hip_flush_all_sa                  = 
hip_userspace_ipsec_flush_all_sa;
-        default_ipsec_func_set.hip_acquire_spi                   = 
hip_acquire_spi;
-        default_ipsec_func_set.hip_delete_default_prefix_sp_pair = 
hip_userspace_ipsec_delete_default_prefix_sp_pair;
-        default_ipsec_func_set.hip_setup_default_sp_prefix_pair  = 
hip_userspace_ipsec_setup_default_sp_prefix_pair;
-    } else {
-        HIP_DEBUG("reseting ipsec function set to kernel-mode api\n");
-
-        default_ipsec_func_set.hip_add_sa                        = hip_add_sa;
-        default_ipsec_func_set.hip_delete_sa                     = 
hip_delete_sa;
-        default_ipsec_func_set.hip_setup_hit_sp_pair             = 
hip_setup_hit_sp_pair;
-        default_ipsec_func_set.hip_delete_hit_sp_pair            = 
hip_delete_hit_sp_pair;
-        default_ipsec_func_set.hip_flush_all_policy              = 
hip_flush_all_policy;
-        default_ipsec_func_set.hip_flush_all_sa                  = 
hip_flush_all_sa;
-        default_ipsec_func_set.hip_acquire_spi                   = 
hip_acquire_spi;
-        default_ipsec_func_set.hip_delete_default_prefix_sp_pair = 
hip_delete_default_prefix_sp_pair;
-        default_ipsec_func_set.hip_setup_default_sp_prefix_pair  = 
hip_setup_default_sp_prefix_pair;
-
-        // re-enable triggering of the BEX by the kernel
-        HIP_IFEL(default_ipsec_func_set.hip_setup_default_sp_prefix_pair(), -1,
-                 "failed to set up default sp prefix pair\n");
-    }
-
-out_err:
     return err;
 }
 

=== modified file 'lib/core/misc.c'
--- lib/core/misc.c     2010-02-18 14:58:39 +0000
+++ lib/core/misc.c     2010-02-22 18:30:02 +0000
@@ -1933,9 +1933,9 @@
         tmp.opaque[0] = tmp.opaque[1] = 0;
         tmp.I         = *digist & 0x40; //truncate I to 8 byte length
 
-        HIP_IFEL((solution = entry->hadb_misc_func->hip_solve_puzzle(
-                      &tmp, in, HIP_SOLVE_PUZZLE)) == 0,
-                 -EINVAL, "Solving of puzzle failed\n");
+        HIP_IFEL((solution = hip_solve_puzzle(&tmp, in, HIP_SOLVE_PUZZLE)) == 
0,
+                 -EINVAL,
+                 "Solving of puzzle failed\n");
 
         HIP_IFEL(hip_build_param_challenge_response(out, pz, ntoh64(solution)) 
< 0,
                  -1,

=== modified file 'lib/core/state.h'
--- lib/core/state.h    2010-02-22 17:37:48 +0000
+++ lib/core/state.h    2010-02-22 18:30:02 +0000
@@ -96,16 +96,6 @@
     HIP_HASTATE_VALID   = 3
 } hip_hastate_t;
 
-/** A typedefinition for a functionpointer to a transmitfunction introduced in
- *  @c hip_xmit_func_set_t. */
-typedef int (*hip_xmit_func_t)(const struct in6_addr *,
-                               const struct in6_addr *,
-                               const in_port_t,
-                               const in_port_t,
-                               struct hip_common *,
-                               hip_ha_t *,
-                               const int);
-
 /**
  * A data structure for storing the source and destination ports of an incoming
  * packet.
@@ -425,34 +415,6 @@
     HIP_HASHTABLE *                            peer_addr_list_to_be_added;
     /** For storing retransmission related data. */
     hip_msg_retrans_t                          hip_msg_retrans;
-    /** Receive function set.
-     *  @note Do not modify this value directly. Use
-     *  hip_hadb_set_rcv_function_set() instead. */
-    hip_rcv_func_set_t *                       hadb_rcv_func;
-    /** Handle function set.
-     *  @note Do not modify this value directly. Use
-     *  hip_hadb_set_handle_function_set() instead. */
-    hip_handle_func_set_t *                    hadb_handle_func;
-    /** Miscellaneous function set.
-     *  @note Do not modify this value directly. Use
-     *  hip_hadb_set_handle_function_set() instead. */
-    hip_misc_func_set_t *                      hadb_misc_func;
-    /** Transmission function set.
-     *  @note Do not modify this value directly. Use
-     *  hip_hadb_set_handle_function_set() instead. */
-    hip_xmit_func_set_t *                      hadb_xmit_func;
-    /** IPsec function set.
-     *  @note Do not modify this value directly. Use
-     *  hip_ipsec_set_handle_function_set() instead. */
-    hip_ipsec_func_set_t *                     hadb_ipsec_func;
-    /** Input filter function set. Input filter used in the GUI agent.
-     *  @note Do not modify this value directly. Use
-     *  hip_hadb_set_input_filter_function_set() instead. */
-    hip_input_filter_func_set_t *              hadb_input_filter_func;
-    /** Output filter function set. Output filter used in the GUI agent.
-     *  @note Do not modify this value directly. Use
-     *  hip_hadb_set_output_filter_function_set() instead. */
-    hip_output_filter_func_set_t *             hadb_output_filter_func;
     /** peer hostname */
     uint8_t                                    
peer_hostname[HIP_HOST_ID_HOSTNAME_LEN_MAX];
     /** Counters of heartbeats (ICMPv6s) */
@@ -483,9 +445,9 @@
     int outbound_sa_count;
     int inbound_sa_count;
 
-    int            spi_inbound_current;
-    int            spi_outbound_current;
-    int            spi_outbound_new;
+    int spi_inbound_current;
+    int spi_outbound_current;
+    int spi_outbound_new;
 
     // Has struct hip_peer_addr_list_item s
     HIP_HASHTABLE *peer_addresses_old;
@@ -524,207 +486,4 @@
     in_port_t       peer_port;
 };
 
-/** @addtogroup hadb_func
- * @{
- */
-struct hip_hadb_rcv_func_set {
-    int (*hip_receive_i1)(struct hip_packet_context *ctx);
-
-    int (*hip_receive_r1)(struct hip_common *,
-                          struct in6_addr *,
-                          struct in6_addr *,
-                          hip_ha_t *,
-                          hip_portpair_t *);
-
-    /* as there is possibly no state established when i2
-     * messages are received, the hip_handle_i2 function pointer
-     * is not executed during the establishment of a new connection*/
-    int (*hip_receive_i2)(struct hip_packet_context *ctx);
-
-    int (*hip_receive_r2)(struct hip_common *,
-                          struct in6_addr *,
-                          struct in6_addr *,
-                          hip_ha_t *,
-                          hip_portpair_t *);
-
-    int (*hip_receive_update)(struct hip_packet_context *ctx);
-
-    int (*hip_receive_notify)(const struct hip_common *,
-                              const struct in6_addr *,
-                              const struct in6_addr *,
-                              hip_ha_t *);
-
-    int (*hip_receive_bos)(struct hip_common *,
-                           struct in6_addr *,
-                           struct in6_addr *,
-                           hip_ha_t *,
-                           hip_portpair_t *);
-
-    int (*hip_receive_close)(struct hip_common *,
-                             hip_ha_t *);
-
-    int (*hip_receive_close_ack)(struct hip_common *,
-                                 hip_ha_t *);
-};
-
-struct hip_hadb_handle_func_set {
-    int (*hip_handle_i1)(struct hip_common *r1,
-                         struct in6_addr *r1_saddr,
-                         struct in6_addr *r1_daddr,
-                         hip_ha_t *entry,
-                         hip_portpair_t *);
-
-    int (*hip_handle_r1)(struct hip_common *r1,
-                         struct in6_addr *r1_saddr,
-                         struct in6_addr *r1_daddr,
-                         hip_ha_t *entry,
-                         hip_portpair_t *);
-
-    /* as there is possibly no state established when i2
-     * messages are received, the hip_handle_i2 function pointer
-     * is not executed during the establishment of a new connection*/
-    int (*hip_handle_i2)(struct hip_packet_context *ctx);
-
-    int (*hip_handle_r2)(struct hip_common *r2,
-                         struct in6_addr *r2_saddr,
-                         struct in6_addr *r2_daddr,
-                         hip_ha_t *ha,
-                         hip_portpair_t *r2_info);
-    int (*hip_handle_bos)(struct hip_common *bos,
-                          struct in6_addr *r2_saddr,
-                          struct in6_addr *r2_daddr,
-                          hip_ha_t *ha,
-                          hip_portpair_t *);
-    int (*hip_handle_close)(struct hip_common *close,
-                            hip_ha_t *entry);
-    int (*hip_handle_close_ack)(struct hip_common *close_ack,
-                                hip_ha_t *entry);
-};
-
-/*
- * struct hip_hadb_update_func_set{
- *      int (*hip_handle_update_plain_locator)(hip_ha_t *entry,
- *                                             struct hip_common *msg,
- *                                             struct in6_addr *src_ip,
- *                                             struct in6_addr *dst_ip,
- *                                             struct hip_esp_info *esp_info,
- *                                             struct hip_seq *seq);
- *
- *      int (*hip_handle_update_addr_verify)(hip_ha_t *entry,
- *                                           struct hip_common *msg,
- *                                           struct in6_addr *src_ip,
- *                                           struct in6_addr *dst_ip);
- *
- *      void (*hip_update_handle_ack)(hip_ha_t *entry,
- *                                    struct hip_ack *ack,
- *                                    int have_nes);
- *
- *      int (*hip_handle_update_established)(hip_ha_t *entry,
- *                                           struct hip_common *msg,
- *                                           struct in6_addr *src_ip,
- *                                           struct in6_addr *dst_ip,
- *                                           hip_portpair_t *);
- *      int (*hip_handle_update_rekeying)(hip_ha_t *entry,
- *                                        struct hip_common *msg,
- *                                        struct in6_addr *src_ip);
- *
- *      int (*hip_update_send_addr_verify)(hip_ha_t *entry,
- *                                         struct hip_common *msg,
- *                                         struct in6_addr *src_ip,
- *                                         uint32_t spi);
- *
- *      int (*hip_update_send_echo)(hip_ha_t *entry,
- *                                  uint32_t spi_out,
- *                                  struct hip_peer_addr_list_item *addr);
- * };*/
-
-struct hip_hadb_misc_func_set {
-    uint64_t (*hip_solve_puzzle)(void *puzzle,
-                                 struct hip_common *hdr,
-                                 int mode);
-    int      (*hip_produce_keying_material)(struct hip_common *msg,
-                                            struct hip_context *ctx,
-                                            uint64_t I,
-                                            uint64_t J,
-                                            struct hip_dh_public_value **);
-    int (*hip_create_i2)(struct hip_context *ctx, uint64_t solved_puzzle,
-                         struct in6_addr *r1_saddr,
-                         struct in6_addr *r1_daddr,
-                         hip_ha_t *entry,
-                         hip_portpair_t *,
-                         struct hip_dh_public_value *);
-    int (*hip_create_r2)(struct hip_context *ctx,
-                         struct in6_addr *i2_saddr,
-                         struct in6_addr *i2_daddr,
-                         hip_ha_t *entry,
-                         hip_portpair_t *,
-//add by santtu for the relay address and port
-                         struct in6_addr *,
-                         const in_port_t
-//end add
-                         );
-    void (*hip_build_network_hdr)(struct hip_common *msg, uint8_t type_hdr,
-                                  uint16_t control,
-                                  const struct in6_addr *hit_sender,
-                                  const struct in6_addr *hit_receiver);
-};
-
-/** A data structure containing function pointers to functions used for sending
- *  data on wire. */
-struct hip_hadb_xmit_func_set {
-    /** A function pointer for sending packet on wire. */
-    int (*hip_send_pkt)(const struct in6_addr *local_addr,
-                        const struct in6_addr *peer_addr,
-                        const in_port_t src_port, const in_port_t dst_port,
-                        struct hip_common *msg, hip_ha_t *entry,
-                        const int retransmit);
-};
-
-struct hip_ipsec_func_set {
-    /** A function pointer for userspace/kernelspace ipsec */
-    uint32_t (*hip_add_sa)(const struct in6_addr *saddr,
-                           const struct in6_addr *daddr,
-                           const struct in6_addr *src_hit,
-                           const struct in6_addr *dst_hit,
-                           const uint32_t spi,
-                           const int ealg,
-                           const struct hip_crypto_key *enckey,
-                           const struct hip_crypto_key *authkey,
-                           const int already_acquired,
-                           const int direction,
-                           const int update,
-                           hip_ha_t *entry);
-    void (*hip_delete_sa)(const uint32_t spi,
-                          const struct in6_addr *not_used,
-                          const struct in6_addr *dst_addr,
-                          const int direction,
-                          hip_ha_t *entry);
-    int (*hip_flush_all_sa)(void);
-    int (*hip_setup_hit_sp_pair)(const hip_hit_t *src_hit,
-                                 const hip_hit_t *dst_hit,
-                                 const struct in6_addr *src_addr,
-                                 const struct in6_addr *dst_addr,
-                                 u8 proto,
-                                 int use_full_prefix,
-                                 int update);
-    void (*hip_delete_hit_sp_pair)(const hip_hit_t *src_hit,
-                                   const hip_hit_t *dst_hit,
-                                   const uint8_t proto,
-                                   const int use_full_prefix);
-    int (*hip_flush_all_policy)(void);
-    uint32_t (*hip_acquire_spi)(hip_hit_t *srchit, hip_hit_t *dsthit);
-    void (*hip_delete_default_prefix_sp_pair)(void);
-    int (*hip_setup_default_sp_prefix_pair)(void);
-};
-
-struct hip_hadb_input_filter_func_set {
-    int (*hip_input_filter)(struct hip_common *msg);
-};
-
-struct hip_hadb_output_filter_func_set {
-    int (*hip_output_filter)(struct hip_common *msg);
-};
-
-/* @} */
-
 #endif /* HIP_LIB_CORE_STATE_H */

=== modified file 'modules/update/hipd/update.c'
--- modules/update/hipd/update.c        2010-02-22 16:17:11 +0000
+++ modules/update/hipd/update.c        2010-02-22 18:30:02 +0000
@@ -77,9 +77,11 @@
         HIP_DEBUG("UPDATE without locators\n");
     }
 
-    ha->hadb_misc_func->hip_build_network_hdr(update_packet_to_send, 
HIP_UPDATE,
-                                              mask, &ha->hit_our,
-                                              &ha->hit_peer);
+    hip_build_network_hdr(update_packet_to_send,
+                          HIP_UPDATE,
+                          mask,
+                          &ha->hit_our,
+                          &ha->hit_peer);
 
     // Add ESP_INFO
     if (type == HIP_UPDATE_LOCATOR || type == HIP_UPDATE_ECHO_REQUEST) {
@@ -231,8 +233,8 @@
 
     // TODO: set the local address unverified for that dst_hit();
 
-    err = ha->hadb_xmit_func->
-          hip_send_pkt(src_addr, dst_addr,
+    err = hip_send_pkt(src_addr,
+                       dst_addr,
                        (ha->nat_mode ? hip_get_local_nat_udp_port() : 0),
                        ha->peer_udp_port, update_packet_to_send, ha, 1);

Other related posts:

  • » [hipl-commit] [tiny] Rev 3548: Removed functions pointer sets from host association database. - Tim Just