[hipl-commit] [trunk] Rev 4724: hipd: remove forward declarations in cookie code.

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

Committer: Mircea Gherzan <mircea.gherzan@xxxxxxxxxxxxxx>
Date: 09/06/2010 at 01:19:11
Revision: 4724
Revision-id: mircea.gherzan@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  hipd: remove forward declarations in cookie code.

Modified:
  M  hipd/cookie.c

=== modified file 'hipd/cookie.c'
--- hipd/cookie.c       2010-06-01 15:11:14 +0000
+++ hipd/cookie.c       2010-06-08 22:18:46 +0000
@@ -22,9 +22,36 @@
 
 int hip_cookie_difficulty = HIP_DEFAULT_COOKIE_K;
 
-/* forwards */
-static int hip_get_cookie_difficulty(hip_hit_t *not_used);
-static int hip_set_cookie_difficulty(hip_hit_t *not_used, int k);
+/**
+ * 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)
+{
+    /* Note: we could return a higher value if we detect DoS */
+    return hip_cookie_difficulty;
+}
+
+/**
+ * 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)
+{
+    if (k > HIP_PUZZLE_MAX_K || k < 1) {
+        HIP_ERROR("Bad cookie value (%d), min=%d, max=%d\n",
+                  k, 1, HIP_PUZZLE_MAX_K);
+        return -1;
+    }
+    hip_cookie_difficulty = k;
+    HIP_DEBUG("HIP cookie value set to %d\n", k);
+    return k;
+}
 
 /**
  * get the puzzle difficulty and return result (for hipconf)
@@ -77,36 +104,6 @@
     return err;
 }
 
-/**
- * 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)
-{
-    /* Note: we could return a higher value if we detect DoS */
-    return hip_cookie_difficulty;
-}
-
-/**
- * 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)
-{
-    if (k > HIP_PUZZLE_MAX_K || k < 1) {
-        HIP_ERROR("Bad cookie value (%d), min=%d, max=%d\n",
-                  k, 1, HIP_PUZZLE_MAX_K);
-        return -1;
-    }
-    hip_cookie_difficulty = k;
-    HIP_DEBUG("HIP cookie value set to %d\n", k);
-    return k;
-}
 
 /**
  * increase cookie difficulty by one

Other related posts:

  • » [hipl-commit] [trunk] Rev 4724: hipd: remove forward declarations in cookie code. - Mircea Gherzan