← Back to team overview

hipl-core team mailing list archive

[Branch ~hipl-core/hipl/trunk] Rev 4891: Drop pointless void* casts from hip_get_param*() functions - hipd directory.

 

------------------------------------------------------------
revno: 4891
committer: Diego Biurrun <diego@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-08-18 18:30:31 +0200
message:
  Drop pointless void* casts from hip_get_param*() functions - hipd directory.
  
  The functions return void*, so there is no need to cast their return value.
modified:
  hipd/esp_prot_anchordb.c
  hipd/esp_prot_hipd_msg.c
  hipd/hiprelay.c
  hipd/input.c
  hipd/user.c
  hipd/user_ipsec_hipd_msg.c


--
lp:hipl
https://code.launchpad.net/~hipl-core/hipl/trunk

Your team HIPL core team is subscribed to branch lp:hipl.
To unsubscribe from this branch go to https://code.launchpad.net/~hipl-core/hipl/trunk/+edit-subscription
=== modified file 'hipd/esp_prot_anchordb.c'
--- hipd/esp_prot_anchordb.c	2010-07-07 16:42:17 +0000
+++ hipd/esp_prot_anchordb.c	2010-08-18 16:30:31 +0000
@@ -125,7 +125,7 @@
 
         /*** set up anchor_db.num_anchors and anchor_db.anchor_lengths ***/
         // get first int value
-        HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_param(msg, HIP_PARAM_UINT)),
+        HIP_IFEL(!(param = hip_get_param(msg, HIP_PARAM_UINT)),
                  -1, "parameter missing in user-message from fw\n");
 
         // don't set up anything for UNUSED transform
@@ -156,14 +156,14 @@
                            malloc(anchor_db.anchor_lengths[esp_transforms[i]])),
                          -1, "failed to allocate memory\n");
 
-                anchor = (unsigned char *) hip_get_param_contents_direct(param);
+                anchor = hip_get_param_contents_direct(param);
                 memcpy(anchor_db.anchors[esp_transforms[i]][j], anchor,
                        anchor_db.anchor_lengths[esp_transforms[i]]);
                 HIP_HEXDUMP("adding anchor: ", anchor_db.anchors[esp_transforms[i]][j],
                             anchor_db.anchor_lengths[esp_transforms[i]]);
 
-                HIP_IFEL(!(param = (struct hip_tlv_common *) hip_get_next_param(
-                               msg, param)), -1, "parameter missing in user-message from fw\n");
+                HIP_IFEL(!(param = hip_get_next_param(msg, param)),
+                         -1, "parameter missing in user-message from fw\n");
                 anchor_db.hash_item_length[esp_transforms[i]] = *(int *)
                                                                 hip_get_param_contents_direct(param);
                 HIP_DEBUG("adding hash_item_length: %i\n",

=== modified file 'hipd/esp_prot_hipd_msg.c'
--- hipd/esp_prot_hipd_msg.c	2010-08-17 17:23:18 +0000
+++ hipd/esp_prot_hipd_msg.c	2010-08-18 16:30:31 +0000
@@ -77,7 +77,7 @@
     uint16_t mask             = 0;
     int err                   = 0;
 
-    HIP_IFEL(!(seq = (struct hip_seq *) hip_get_param(recv_update, HIP_PARAM_SEQ)),
+    HIP_IFEL(!(seq = hip_get_param(recv_update, HIP_PARAM_SEQ)),
              -1,
              "SEQ not found\n");
 
@@ -175,16 +175,16 @@
     struct hip_tlv_common *param = NULL;
     int err                      = 0, i;
 
-    param = (struct hip_tlv_common *) hip_get_param(msg, HIP_PARAM_INT);
+    param = hip_get_param(msg, HIP_PARAM_INT);
     esp_prot_active = *((int *) hip_get_param_contents_direct(param));
     HIP_DEBUG("esp_prot_active: %i\n", esp_prot_active);
 
     // process message and store the preferred transforms
-    param = (struct hip_tlv_common *) hip_get_next_param(msg, param);
+    param = hip_get_next_param(msg, param);
     esp_prot_num_transforms = *((int *) hip_get_param_contents_direct(param));
     HIP_DEBUG("esp protection num_transforms: %i\n", esp_prot_num_transforms);
 
-    param = (struct hip_tlv_common *) hip_get_next_param(msg, param);
+    param = hip_get_next_param(msg, param);
     esp_prot_num_parallel_hchains = *((long *) hip_get_param_contents_direct(param));
     HIP_DEBUG("esp_prot_num_parallel_hchains: %i\n", esp_prot_num_parallel_hchains);
 
@@ -246,11 +246,11 @@
     memset(cmp_val, 0, MAX_HASH_LENGTH);
 
     param     = hip_get_param(msg, HIP_PARAM_HIT);
-    local_hit = (hip_hit_t *) hip_get_param_contents_direct(param);
+    local_hit = hip_get_param_contents_direct(param);
     HIP_DEBUG_HIT("src_hit", local_hit);
 
     param     = hip_get_next_param(msg, param);
-    peer_hit  = (hip_hit_t *) hip_get_param_contents_direct(param);
+    peer_hit  = hip_get_param_contents_direct(param);
     HIP_DEBUG_HIT("dst_hit", peer_hit);
 
     // get matching entry from hadb for HITs provided above
@@ -283,7 +283,7 @@
     // process all update anchors now
     param                   = hip_get_param(msg, HIP_PARAM_HCHAIN_ANCHOR);
     for (i = 0; i < num_parallel_hchains; i++) {
-        esp_prot_anchor = (unsigned char *) hip_get_param_contents_direct(param);
+        esp_prot_anchor = hip_get_param_contents_direct(param);
         HIP_HEXDUMP("anchor: ", esp_prot_anchor, hash_length);
 
         // make sure that the update-anchor is not set yet
@@ -306,7 +306,7 @@
     if (root_length > 0) {
         param = hip_get_param(msg, HIP_PARAM_ROOT);
         for (i = 0; i < num_parallel_hchains; i++) {
-            root[i] = (unsigned char *) hip_get_param_contents_direct(param);
+            root[i] = hip_get_param_contents_direct(param);
             memcpy(&entry->esp_root[i][0], root[i], root_length);
 
             HIP_HEXDUMP("root: ", &entry->esp_root[i][0], root_length);
@@ -333,11 +333,11 @@
             HIP_DEBUG("branch_length: %i\n", branch_length[i]);
 
             param            = hip_get_next_param(msg, param);
-            secret[i]        = (unsigned char *) hip_get_param_contents_direct(param);
+            secret[i]        = hip_get_param_contents_direct(param);
             HIP_HEXDUMP("secret: ", secret[i], secret_length[i]);
 
             param            = hip_get_next_param(msg, param);
-            branch_nodes[i]  = (unsigned char *) hip_get_param_contents_direct(param);
+            branch_nodes[i]  = hip_get_param_contents_direct(param);
             HIP_HEXDUMP("branch_nodes: ", branch_nodes[i], branch_length[i]);
         }
     }
@@ -382,11 +382,11 @@
     int err                        = 0;
 
     param                = hip_get_param(msg, HIP_PARAM_HIT);
-    local_hit            = (hip_hit_t *) hip_get_param_contents_direct(param);
+    local_hit            = hip_get_param_contents_direct(param);
     HIP_DEBUG_HIT("src_hit", local_hit);
 
     param                = hip_get_next_param(msg, param);
-    peer_hit             = (hip_hit_t *) hip_get_param_contents_direct(param);
+    peer_hit             = hip_get_param_contents_direct(param);
     HIP_DEBUG_HIT("dst_hit", peer_hit);
 
     param                = hip_get_param(msg, HIP_PARAM_INT);
@@ -419,7 +419,7 @@
     // only handle outbound direction here
     if (direction == HIP_SPI_DIRECTION_OUT) {
         for (i = 0; i < num_parallel_hchains; i++) {
-            esp_prot_anchor = (unsigned char *) hip_get_param_contents_direct(param);
+            esp_prot_anchor = hip_get_param_contents_direct(param);
             HIP_HEXDUMP("anchor: ", esp_prot_anchor, hash_length);
 
             // make sure that the update-anchor is set
@@ -915,9 +915,9 @@
 
     HIP_ASSERT(recv_update != NULL);
 
-    seq = (struct hip_seq *) hip_get_param(recv_update, HIP_PARAM_SEQ);
-    ack = (struct hip_ack *) hip_get_param(recv_update, HIP_PARAM_ACK);
-    esp_info = (struct hip_esp_info *) hip_get_param(recv_update, HIP_PARAM_ESP_INFO);
+    seq      = hip_get_param(recv_update, HIP_PARAM_SEQ);
+    ack      = hip_get_param(recv_update, HIP_PARAM_ACK);
+    esp_info = hip_get_param(recv_update, HIP_PARAM_ESP_INFO);
 
     if (seq && !ack && !esp_info) {
         return ESP_PROT_FIRST_UPDATE_PACKET;
@@ -1028,7 +1028,7 @@
          * @note we can distinguish the 1. and 2. UPDATE message by
          *       looking at the presence of SEQ param in the packet
          *       to be sent */
-        seq = (struct hip_seq *) hip_get_param(update, HIP_PARAM_SEQ);
+        seq = hip_get_param(update, HIP_PARAM_SEQ);
 
         if (seq) {
             // we need to know the hash_length for this transform

=== modified file 'hipd/hiprelay.c'
--- hipd/hiprelay.c	2010-08-17 17:23:18 +0000
+++ hipd/hiprelay.c	2010-08-18 16:30:31 +0000
@@ -1109,7 +1109,7 @@
     HIP_DEBUG("handle_relay_to: Matching relay record found:Full-Relay.\n");
 
     //check if there is a relay_to parameter
-    relay_to = (struct hip_relay_to *) hip_get_param(ctx->input_msg, HIP_PARAM_RELAY_TO);
+    relay_to = hip_get_param(ctx->input_msg, HIP_PARAM_RELAY_TO);
     HIP_IFEL(!relay_to, 0, "No relay_to  found\n");
 
     // check msg type
@@ -1305,7 +1305,7 @@
     // check if the relay has been registered
 
     //check if there is a relay_to parameter
-    relay_to = (struct hip_relay_to *) hip_get_param(ctx->input_msg, HIP_PARAM_RELAY_TO);
+    relay_to = hip_get_param(ctx->input_msg, HIP_PARAM_RELAY_TO);
     HIP_IFEL(!relay_to, 0, "No relay_to  found\n");
 
     // check msg type

=== modified file 'hipd/input.c'
--- hipd/input.c	2010-07-16 17:49:20 +0000
+++ hipd/input.c	2010-08-18 16:30:31 +0000
@@ -327,8 +327,7 @@
 
     memset(dh_shared_key, 0, dh_shared_len);
 
-    HIP_IFEL(!(dhf = (struct hip_diffie_hellman *) hip_get_param(
-                   ctx->input_msg, HIP_PARAM_DIFFIE_HELLMAN)),
+    HIP_IFEL(!(dhf = hip_get_param(ctx->input_msg, HIP_PARAM_DIFFIE_HELLMAN)),
              -ENOENT,  "No Diffie-Hellman parameter found.\n");
 
     /* If the message has two DH keys, select (the stronger, usually) one. */
@@ -857,7 +856,7 @@
     }
 
     /***** LOCATOR PARAMETER ******/
-    locator = (struct hip_locator *) hip_get_param(ctx->input_msg, HIP_PARAM_LOCATOR);
+    locator = hip_get_param(ctx->input_msg, HIP_PARAM_LOCATOR);
     if (locator) {
         err = handle_locator(locator,
                              ctx->hadb_entry);
@@ -1149,7 +1148,7 @@
              "failed to handle esp prot anchor\n");
 
     /***** LOCATOR PARAMETER *****/
-    locator = (struct hip_locator *) hip_get_param(ctx->input_msg, HIP_PARAM_LOCATOR);
+    locator = hip_get_param(ctx->input_msg, HIP_PARAM_LOCATOR);
     if (locator) {
         HIP_DEBUG("Locator parameter support in BEX is not implemented!\n");
     }
@@ -1880,7 +1879,7 @@
     ctx->hadb_entry->spi_outbound_new = spi_out;
 
     /***** LOCATOR PARAMETER *****/
-    locator = (struct hip_locator *) hip_get_param(ctx->input_msg, HIP_PARAM_LOCATOR);
+    locator = hip_get_param(ctx->input_msg, HIP_PARAM_LOCATOR);
     if (locator) {
         HIP_DEBUG("Locator parameter support in BEX is not implemented!\n");
     }

=== modified file 'hipd/user.c'
--- hipd/user.c	2010-08-17 17:23:18 +0000
+++ hipd/user.c	2010-08-18 16:30:31 +0000
@@ -814,10 +814,10 @@
         while ((param = hip_get_next_param(msg, param))) {
             if (hip_get_param_type(param) == HIP_PARAM_HIT) {
                 if (!dst_hit) {
-                    dst_hit = (struct in6_addr *) hip_get_param_contents_direct(param);
+                    dst_hit = hip_get_param_contents_direct(param);
                     HIP_DEBUG_HIT("dst_hit", dst_hit);
                 } else {
-                    src_hit = (struct in6_addr *) hip_get_param_contents_direct(param);
+                    src_hit = hip_get_param_contents_direct(param);
                     HIP_DEBUG_HIT("src_hit", src_hit);
                 }
             }

=== modified file 'hipd/user_ipsec_hipd_msg.c'
--- hipd/user_ipsec_hipd_msg.c	2010-07-29 09:12:24 +0000
+++ hipd/user_ipsec_hipd_msg.c	2010-08-18 16:30:31 +0000
@@ -60,7 +60,7 @@
     int err                      = 0, activate = 0;
 
     // process message and store anchor elements in the db
-    param    = (struct hip_tlv_common *) hip_get_param(msg, HIP_PARAM_INT);
+    param    = hip_get_param(msg, HIP_PARAM_INT);
     activate = *((int *) hip_get_param_contents_direct(param));
 
     // set global variable