[hipl-commit] [trunk] Rev 4726: hipd: mark/remove some unused parameters.

  • From: Mircea Gherzan <mircea.gherzan@xxxxxxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Wed, 9 Jun 2010 02:10:25 +0300

Committer: Mircea Gherzan <mircea.gherzan@xxxxxxxxxxxxxx>
Date: 09/06/2010 at 02:10:25
Revision: 4726
Revision-id: mircea.gherzan@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  hipd: mark/remove some unused parameters.

Modified:
  M  hipd/cert.c
  M  hipd/cert.h
  M  hipd/close.c
  M  hipd/close.h
  M  hipd/cookie.c
  M  hipd/cookie.h
  M  hipd/esp_prot_hipd_msg.c
  M  hipd/esp_prot_hipd_msg.h
  M  hipd/esp_prot_light_update.c
  M  hipd/hadb.c
  M  hipd/hadb.h
  M  hipd/hidb.c
  M  hipd/hidb.h
  M  hipd/hip_socket.c
  M  hipd/output.c
  M  hipd/user.c

=== modified file 'hipd/cert.c'
--- hipd/cert.c 2010-05-22 12:37:40 +0000
+++ hipd/cert.c 2010-06-08 23:10:07 +0000
@@ -22,13 +22,11 @@
  *
  * @param msg points to the msg gotten from "client" that should
  *            contain HIP_PARAM_CERT_SPKI_INFO
- * @param db is the HIP_HASHTABLE to
- *           query for the hostid entry
  *
  * @return 0 if signature was created without errors, negative value
  *         is returned on errors
  */
-int hip_cert_spki_sign(struct hip_common *msg, HIP_HASHTABLE *db)
+int hip_cert_spki_sign(struct hip_common *msg)
 {
     int err                      = 0, sig_len = 0, algo = 0, t = 0;
     struct hip_cert_spki_info *p_cert;
@@ -650,11 +648,10 @@
  * Function that creates the certificate and sends it to back to the client.
  *
  * @param msg is a pointer to the msg containing a x509v3 cert in cert 
parameter
- * @param db is the HIP_HASHTABLE to query for the hostid entry
  *
  * @return 0 on success negative otherwise.
  */
-int hip_cert_x509v3_handle_request_to_sign(struct hip_common *msg,  
HIP_HASHTABLE *db)
+int hip_cert_x509v3_handle_request_to_sign(struct hip_common *msg)
 {
     int err = 0, i = 0, nid = 0, ret = 0, secs = 0, algo = 0;
     CONF *conf;

=== modified file 'hipd/cert.h'
--- hipd/cert.h 2010-04-22 10:12:54 +0000
+++ hipd/cert.h 2010-06-08 23:10:07 +0000
@@ -36,11 +36,11 @@
 #include "lib/core/hashtable.h"
 
 /** SPKI */
-int hip_cert_spki_sign(struct hip_common *, HIP_HASHTABLE *);
+int hip_cert_spki_sign(struct hip_common *);
 int hip_cert_spki_verify(struct hip_common *);
 
 /** x509v3 */
-int hip_cert_x509v3_handle_request_to_sign(struct hip_common *, HIP_HASHTABLE 
*);
+int hip_cert_x509v3_handle_request_to_sign(struct hip_common *);
 int hip_cert_x509v3_handle_request_to_verify(struct hip_common *);
 
 /** utilitary functions */

=== modified file 'hipd/close.c'
--- hipd/close.c        2010-05-20 16:14:34 +0000
+++ hipd/close.c        2010-06-08 23:10:07 +0000
@@ -14,6 +14,7 @@
 
 #include "config.h"
 #include "close.h"
+#include "lib/core/common_defines.h"
 #include "lib/core/hip_udp.h"
 #include "lib/core/performance.h"
 
@@ -205,8 +206,8 @@
  *
  * @return zero on success, non-negative on error.
  */
-int hip_close_check_packet(const uint8_t packet_type,
-                           const uint32_t ha_state,
+int hip_close_check_packet(UNUSED const uint8_t packet_type,
+                           UNUSED const uint32_t ha_state,
                            struct hip_packet_context *ctx)
 {
     int err = 0;
@@ -261,8 +262,8 @@
  *
  * @return zero on success, non-negative on error.
  */
-int hip_close_create_response(const uint8_t packet_type,
-                              const uint32_t ha_state,
+int hip_close_create_response(UNUSED const uint8_t packet_type,
+                              UNUSED const uint32_t ha_state,
                               struct hip_packet_context *ctx)
 {
     int err = 0, echo_len;
@@ -320,8 +321,8 @@
  *
  * @return zero on success, non-negative on error.
  */
-int hip_close_send_response(const uint8_t packet_type,
-                            const uint32_t ha_state,
+int hip_close_send_response(UNUSED const uint8_t packet_type,
+                            UNUSED const uint32_t ha_state,
                             struct hip_packet_context *ctx)
 {
     int err = 0;
@@ -386,8 +387,8 @@
  *
  * @return zero on success, non-negative on error.
  */
-int hip_close_ack_check_packet(const uint8_t packet_type,
-                               const uint32_t ha_state,
+int hip_close_ack_check_packet(UNUSED const uint8_t packet_type,
+                               UNUSED const uint32_t ha_state,
                                struct hip_packet_context *ctx)
 {
     int err = 0;
@@ -458,8 +459,8 @@
  *
  * @return zero on success, non-negative on error.
  */
-int hip_close_ack_handle_packet(const uint8_t packet_type,
-                                const uint32_t ha_state,
+int hip_close_ack_handle_packet(UNUSED const uint8_t packet_type,
+                                UNUSED const uint32_t ha_state,
                                 struct hip_packet_context *ctx)
 {
     int err = 0;
@@ -496,10 +497,9 @@
  * tear down a host association after close procedure
  *
  * @param ha the corresponding host association
- * @param notused not used
  * @return zero on success or negative on error
  */
-int hip_purge_closing_ha(hip_ha_t *ha, void *notused)
+int hip_purge_closing_ha(hip_ha_t *ha, UNUSED void *opaque)
 {
     int err = 0;
 

=== modified file 'hipd/close.h'
--- hipd/close.h        2010-04-23 15:10:44 +0000
+++ hipd/close.h        2010-06-08 23:10:07 +0000
@@ -35,6 +35,6 @@
 int hip_close_ack_handle_packet(const uint8_t packet_type,
                                 const uint32_t ha_state,
                                 struct hip_packet_context *ctx);
-int hip_purge_closing_ha(hip_ha_t *ha, void *notused);
+int hip_purge_closing_ha(hip_ha_t *ha, void *opaque);
 
 #endif /* HIP_HIPD_CLOSE_H */

=== modified file 'hipd/cookie.c'
--- hipd/cookie.c       2010-06-08 22:18:46 +0000
+++ hipd/cookie.c       2010-06-08 23:10:07 +0000
@@ -15,6 +15,7 @@
 
 #include "config.h"
 #include "cookie.h"
+#include "lib/core/common_defines.h"
 #include "lib/core/solve.h"
 
 #define HIP_PUZZLE_MAX_LIFETIME 60 /* in seconds */
@@ -25,10 +26,9 @@
 /**
  * query for current puzzle difficulty
  *
- * @param not_used not used
  * @return the puzzle difficulty
  */
-static int hip_get_cookie_difficulty(hip_hit_t *not_used)
+static int hip_get_cookie_difficulty(void)
 {
     /* Note: we could return a higher value if we detect DoS */
     return hip_cookie_difficulty;
@@ -37,11 +37,10 @@
 /**
  * set puzzle difficulty
  *
- * @param not_used not used
  * @param k the new puzzle difficulty
  * @return the k value on success or negative on error
  */
-static int hip_set_cookie_difficulty(hip_hit_t *not_used, int k)
+static int hip_set_cookie_difficulty(int k)
 {
     if (k > HIP_PUZZLE_MAX_K || k < 1) {
         HIP_ERROR("Bad cookie value (%d), min=%d, max=%d\n",
@@ -71,7 +70,7 @@
     /* obtain the hit */
     dst_hit = hip_get_param_contents(msg, HIP_PARAM_HIT);
 
-    diff = hip_get_cookie_difficulty(NULL);
+    diff = hip_get_cookie_difficulty();
 
     hip_build_param_contents(msg, &diff, HIP_PARAM_INT, sizeof(diff));
 
@@ -98,7 +97,7 @@
     HIP_IFEL(!(newVal = hip_get_param_contents(msg, HIP_PARAM_INT)),
              -1, "No difficulty set\n");
 
-    HIP_IFEL(hip_set_cookie_difficulty(NULL, *newVal), -1,
+    HIP_IFEL(hip_set_cookie_difficulty(*newVal), -1,
              "Setting difficulty failed\n");
  out_err:
     return err;
@@ -108,25 +107,23 @@
 /**
  * increase cookie difficulty by one
  *
- * @param not_used not used
  * @return the new cookie difficulty
  */
-int hip_inc_cookie_difficulty(hip_hit_t *not_used)
+int hip_inc_cookie_difficulty(void)
 {
-    int k = hip_get_cookie_difficulty(NULL) + 1;
-    return hip_set_cookie_difficulty(NULL, k);
+    int k = hip_get_cookie_difficulty() + 1;
+    return hip_set_cookie_difficulty(k);
 }
 
 /**
  * decrease cookie difficulty by one
  *
- * @param not_used not used
  * @return the new cookie difficulty
  */
-int hip_dec_cookie_difficulty(hip_hit_t *not_used)
+int hip_dec_cookie_difficulty()
 {
-    int k = hip_get_cookie_difficulty(NULL) - 1;
-    return hip_set_cookie_difficulty(NULL, k);
+    int k = hip_get_cookie_difficulty() - 1;
+    return hip_set_cookie_difficulty(k);
 }
 
 /**
@@ -134,12 +131,10 @@
  *
  * @param ip_i Initiator's IPv6 address
  * @param ip_r Responder's IPv6 address
- * @param hit_i Initiators HIT
  *
  * @return 0 <= x < HIP_R1TABLESIZE
  */
-static int hip_calc_cookie_idx(struct in6_addr *ip_i, struct in6_addr *ip_r,
-                               struct in6_addr *hit_i)
+static int hip_calc_cookie_idx(struct in6_addr *ip_i, struct in6_addr *ip_r)
 {
     register uint32_t base = 0;
     int i;
@@ -164,15 +159,13 @@
  * @param ip_i Initiator's IPv6
  * @param ip_r Responder's IPv6
  * @param our_hit Our HIT
- * @param peer_hit The peer's HIT
  *
  * @note Comments for the if 0 code are inlined below.
  *
  * Returns NULL if error.
  */
 struct hip_common *hip_get_r1(struct in6_addr *ip_i, struct in6_addr *ip_r,
-                              struct in6_addr *our_hit,
-                              struct in6_addr *peer_hit)
+                              struct in6_addr *our_hit)
 {
     struct hip_common *err          = NULL, *r1 = NULL;
     struct hip_r1entry *hip_r1table = NULL;
@@ -185,7 +178,7 @@
              NULL, "Unknown HIT\n");
 
     hip_r1table = hid->r1;
-    idx = hip_calc_cookie_idx(ip_i, ip_r, peer_hit);
+    idx = hip_calc_cookie_idx(ip_i, ip_r);
     HIP_DEBUG("Calculated index: %d\n", idx);
 
     /* Create a copy of the found entry */
@@ -238,7 +231,7 @@
     for (i = 0; i < HIP_R1TABLESIZE; i++) {
         int cookie_k;
 
-        cookie_k      = hip_get_cookie_difficulty(NULL);
+        cookie_k      = hip_get_cookie_difficulty();
 
         r1table[i].r1 = hip_create_r1(hit, sign, privkey, pubkey,
                                       cookie_k);
@@ -311,7 +304,7 @@
                    HIP_DB_LOCAL_HID, &hdr->hitr, HIP_ANY_ALGO,
                    -1)),
              -1, "Requested source HIT not (any more) available.\n");
-    result = &hid->r1[hip_calc_cookie_idx(ip_i, ip_r, &hdr->hits)];
+    result = &hid->r1[hip_calc_cookie_idx(ip_i, ip_r)];
 
     puzzle = hip_get_param(result->r1, HIP_PARAM_PUZZLE);
     HIP_IFEL(!puzzle, -1, "Internal error: could not find the cookie\n");
@@ -358,11 +351,10 @@
  * recreate R1 packets corresponding to one HI
  *
  * @param entry the host id entry
- * @param new_hash unused
  * @return zero on success or negative on error
  */
 static int hip_recreate_r1s_for_entry_move(struct hip_host_id_entry *entry,
-                                           void *new_hash)
+                                           UNUSED void *opaque)
 {
     int err = 0;
 

=== modified file 'hipd/cookie.h'
--- hipd/cookie.h       2010-06-01 15:11:14 +0000
+++ hipd/cookie.h       2010-06-08 23:10:07 +0000
@@ -24,7 +24,6 @@
 #define HIP_R1TABLESIZE         3 /* precreate only this many R1s */
 struct hip_common *hip_get_r1(struct in6_addr *ip_i,
                               struct in6_addr *ip_r,
-                              struct in6_addr *src_hit,
                               struct in6_addr *peer_hit);
 struct hip_r1entry *hip_init_r1(void);
 void hip_uninit_r1(struct hip_r1entry *);
@@ -36,8 +35,8 @@
                      struct hip_host_id *pubkey);
 int hip_verify_cookie(in6_addr_t *ip_i, in6_addr_t *ip_r,  hip_common_t *hdr,
                       struct hip_solution *cookie);
-int hip_inc_cookie_difficulty(hip_hit_t *not_used);
-int hip_dec_cookie_difficulty(hip_hit_t *not_used);
+int hip_inc_cookie_difficulty(void);
+int hip_dec_cookie_difficulty(void);
 int hip_get_puzzle_difficulty_msg(struct hip_common *msg);
 int hip_set_puzzle_difficulty_msg(struct hip_common *msg);
 

=== modified file 'hipd/esp_prot_hipd_msg.c'
--- hipd/esp_prot_hipd_msg.c    2010-06-08 22:10:30 +0000
+++ hipd/esp_prot_hipd_msg.c    2010-06-08 23:10:07 +0000
@@ -921,8 +921,7 @@
      *
      * @note contains anchors -> update inbound SA
      * @note response has to contain corresponding ACK and ESP_INFO */
-    HIP_IFEL(esp_prot_update_handle_anchor(recv_update, entry,
-                                           src_ip, dst_ip, &spi),
+    HIP_IFEL(esp_prot_update_handle_anchor(recv_update, entry, &spi),
              -1, "failed to handle anchor in UPDATE msg\n");
     HIP_DEBUG("successfully processed anchors in ANCHOR-UPDATE\n");
 
@@ -1046,15 +1045,11 @@
  *
  * @param recv_update   the received hip update
  * @param entry         hip association for the connection
- * @param src_ip        src ip address
- * @param dst_ip        dst ip address
  * @param spi           the ipsec spi number
  * @return              0 on success, -1 in case of an error
  */
 int esp_prot_update_handle_anchor(const hip_common_t *recv_update,
                                   hip_ha_t *entry,
-                                  const in6_addr_t *src_ip,
-                                  const in6_addr_t *dst_ip,
                                   uint32_t *spi)
 {
     struct esp_prot_anchor *prot_anchor = NULL;

=== modified file 'hipd/esp_prot_hipd_msg.h'
--- hipd/esp_prot_hipd_msg.h    2010-03-31 15:04:18 +0000
+++ hipd/esp_prot_hipd_msg.h    2010-06-08 23:10:07 +0000
@@ -45,8 +45,6 @@
 int esp_prot_update_add_anchor(hip_common_t *update, hip_ha_t *entry);
 int esp_prot_update_handle_anchor(const hip_common_t *recv_update,
                                   hip_ha_t *entry,
-                                  const in6_addr_t *src_ip,
-                                  const in6_addr_t *dst_ip,
                                   uint32_t *spi);
 
 #endif /*HIP_HIPD_ESP_PROT_HIPD_MSG_H*/

=== modified file 'hipd/esp_prot_light_update.c'
--- hipd/esp_prot_light_update.c        2010-06-08 22:10:30 +0000
+++ hipd/esp_prot_light_update.c        2010-06-08 23:10:07 +0000
@@ -16,6 +16,7 @@
 #include "esp_prot_anchordb.h"
 #include "hipd.h"
 #include "lib/core/builder.h"
+#include "lib/core/common_defines.h"
 #include "lib/core/hip_udp.h"
 
 /**
@@ -181,8 +182,8 @@
  * @param ctx         the context
  * @return            0 in case of succcess, -1 otherwise
  */
-int esp_prot_handle_light_update(const uint8_t packet_type,
-                                 const uint32_t ha_state,
+int esp_prot_handle_light_update(UNUSED const uint8_t packet_type,
+                                 UNUSED const uint32_t ha_state,
                                  struct hip_packet_context *ctx)
 {
     struct hip_seq *seq = NULL;
@@ -227,8 +228,6 @@
         /********** ANCHOR ***********/
         HIP_IFEL(esp_prot_update_handle_anchor(ctx->input_msg,
                                                ctx->hadb_entry,
-                                               ctx->src_addr,
-                                               ctx->dst_addr,
                                                &spi),
                  -1, "failed to handle anchors\n");
 

=== modified file 'hipd/hadb.c'
--- hipd/hadb.c 2010-06-08 22:10:30 +0000
+++ hipd/hadb.c 2010-06-08 23:10:07 +0000
@@ -413,7 +413,7 @@
         HIP_DEBUG_LSI("    Peer lsi   ", &entry->lsi_peer);
     } else {
         HIP_DEBUG("hip_hadb_create_state\n");
-        entry                             = hip_hadb_create_state(0);
+        entry = hip_hadb_create_state();
         HIP_IFEL(!entry, -1, "Unable to create a new entry");
 
         entry->peer_addr_list_to_be_added =
@@ -656,10 +656,9 @@
 /**
  * Allocate and initialize a new HA structure.
  *
- * @param  gfpmask a mask passed directly to malloc().
  * @return NULL if memory allocation failed, otherwise the HA.
  */
-hip_ha_t *hip_hadb_create_state(int gfpmask)
+hip_ha_t *hip_hadb_create_state(void)
 {
     hip_ha_t *entry = NULL;
 
@@ -842,12 +841,10 @@
  * store a remote host identifier to a host association
  *
  * @param entry the host association
- * @param msg unused
  * @param peer the remote host identifier
  * @return zero on success and negative on error
  */
 int hip_init_peer(hip_ha_t *entry,
-                  struct hip_common *msg,
                   struct hip_host_id *peer)
 {
     int err = 0;

=== modified file 'hipd/hadb.h'
--- hipd/hadb.h 2010-06-01 15:11:17 +0000
+++ hipd/hadb.h 2010-06-08 23:10:07 +0000
@@ -60,8 +60,7 @@
 /* insert/create/delete */
 int hip_hadb_insert_state(hip_ha_t *ha);
 void hip_delete_security_associations_and_sp(struct hip_hadb_state *ha);
-int hip_init_peer(hip_ha_t *entry, struct hip_common *msg,
-                  struct hip_host_id *peer);
+int hip_init_peer(hip_ha_t *entry, struct hip_host_id *peer);
 int hip_init_us(hip_ha_t *entry, hip_hit_t *hit_our);
 
 
@@ -92,7 +91,7 @@
 
 /* Utilities */
 
-hip_ha_t *hip_hadb_create_state(int gfpmask);
+hip_ha_t *hip_hadb_create_state(void);
 
 int hip_for_each_ha(int(func) (hip_ha_t * entry, void *opaq), void *opaque);
 

=== modified file 'hipd/hidb.c'
--- hipd/hidb.c 2010-05-31 09:44:40 +0000
+++ hipd/hidb.c 2010-06-08 23:10:07 +0000
@@ -81,10 +81,8 @@
 
 /**
  * initialize host identity database
- *
- * @param db A double pointer to a HIP_HASHTABLE. Caller deallocates.
  */
-void hip_init_hostid_db(HIP_HASHTABLE **db)
+void hip_init_hostid_db(void)
 {
     hip_local_hostid_db = hip_ht_init(hip_hidb_hash, hip_hidb_match);
 }

=== modified file 'hipd/hidb.h'
--- hipd/hidb.h 2010-04-23 15:10:44 +0000
+++ hipd/hidb.h 2010-06-08 23:10:07 +0000
@@ -81,7 +81,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_HASHTABLE **db);
+void hip_init_hostid_db(void);
 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);

=== modified file 'hipd/hip_socket.c'
--- hipd/hip_socket.c   2010-06-01 15:11:22 +0000
+++ hipd/hip_socket.c   2010-06-08 23:10:07 +0000
@@ -13,6 +13,7 @@
 #include "hipd.h"
 #include "input.h"
 #include "pkt_handling.h"
+#include "lib/core/common_defines.h"
 
 struct socketfd {
     uint16_t priority;
@@ -122,7 +123,7 @@
     return err;
 }
 
-static int hip_handle_nl_ipsec_sock(struct hip_packet_context *ctx)
+static int hip_handle_nl_ipsec_sock(UNUSED struct hip_packet_context *ctx)
 {
     HIP_DEBUG("netlink receive\n");
     if (hip_netlink_receive(&hip_nl_ipsec,
@@ -134,7 +135,7 @@
     return 0;
 }
 
-static int hip_handle_nl_route_sock(struct hip_packet_context *ctx)
+static int hip_handle_nl_route_sock(UNUSED struct hip_packet_context *ctx)
 {
     HIP_DEBUG("netlink route receive\n");
     if (hip_netlink_receive(&hip_nl_route,

=== modified file 'hipd/output.c'
--- hipd/output.c       2010-06-08 22:10:30 +0000
+++ hipd/output.c       2010-06-08 23:10:07 +0000
@@ -802,7 +802,7 @@
     }
 
     HIP_IFEL(!(r1pkt = hip_get_r1(r1_dst_addr, ctx->dst_addr,
-                                  &ctx->input_msg->hitr, 
&ctx->input_msg->hits)),
+                                  &ctx->input_msg->hitr)),
              -ENOENT, "No precreated R1\n");
 
     if (&ctx->input_msg->hits) {

=== modified file 'hipd/user.c'
--- hipd/user.c 2010-06-01 15:12:02 +0000
+++ hipd/user.c 2010-06-08 23:10:07 +0000
@@ -279,11 +279,11 @@
         break;
     case HIP_MSG_CONF_PUZZLE_INC:
         dst_hit = hip_get_param_contents(msg, HIP_PARAM_HIT);
-        hip_inc_cookie_difficulty(dst_hit);
+        hip_inc_cookie_difficulty();
         break;
     case HIP_MSG_CONF_PUZZLE_DEC:
         dst_hit = hip_get_param_contents(msg, HIP_PARAM_HIT);
-        hip_dec_cookie_difficulty(dst_hit);
+        hip_dec_cookie_difficulty();
         break;
     case HIP_MSG_CERT_SPKI_VERIFY:
     {
@@ -296,7 +296,7 @@
     case HIP_MSG_CERT_SPKI_SIGN:
     {
         HIP_DEBUG("Got an request to sign SPKI cert sequence\n");
-        reti = hip_cert_spki_sign(msg, hip_local_hostid_db);
+        reti = hip_cert_spki_sign(msg);
         HIP_IFEL(reti, -1, "Signing SPKI cert returned an error\n");
         HIP_DEBUG("SPKI cert signed sending it back to requester\n");
     }
@@ -304,8 +304,7 @@
     case HIP_MSG_CERT_X509V3_SIGN:
     {
         HIP_DEBUG("Got an request to sign X509v3 cert\n");
-        reti = hip_cert_x509v3_handle_request_to_sign(msg,
-                                                      hip_local_hostid_db);
+        reti = hip_cert_x509v3_handle_request_to_sign(msg);
         HIP_IFEL(reti, -1, "Signing of x509v3 cert returned an error\n");
         HIP_DEBUG("X509v3 cert signed sending it back to requester\n");
     }

Other related posts:

  • » [hipl-commit] [trunk] Rev 4726: hipd: mark/remove some unused parameters. - Mircea Gherzan