[hipl-commit] [trunk] Rev 3859: Splitting misc.c into multiple files continued (bug id 1139). Added

  • From: Miika Komu <miika@xxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Tue, 9 Mar 2010 00:21:40 +0200

Committer: Miika Komu <miika@xxxxxx>
Date: Tue Mar 09 00:21:34 2010 +0200
Revision: 3859
Revision-id: miika@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Splitting misc.c into multiple files continued (bug id 1139). Added
  hip_udp.c and hip_udp.h.

Modified:
  A  lib/core/hip_udp.c
  A  lib/core/hip_udp.h
  M  Makefile.am
  M  firewall/conntrack.c
  M  firewall/firewall.c
  M  hipd/bos.c
  M  hipd/close.c
  M  hipd/esp_prot_hipd_msg.c
  M  hipd/esp_prot_light_update.c
  M  hipd/hadb.c
  M  hipd/hiprelay.c
  M  hipd/init.c
  M  hipd/input.c
  M  hipd/maintenance.c
  M  hipd/nat.h
  M  hipd/netdev.c
  M  hipd/output.c
  M  hipd/update.c
  M  hipd/user.c
  M  lib/core/message.c
  M  lib/core/misc.c
  M  lib/core/misc.h
  M  lib/tool/xfrmapi.c

=== modified file 'Makefile.am'
--- Makefile.am 2010-03-08 22:07:59 +0000
+++ Makefile.am 2010-03-08 22:21:34 +0000
@@ -255,6 +255,7 @@
                                  lib/core/filemanip.c \
                                  lib/core/hashchain.c \
                                  lib/core/hostid.c \
+                                 lib/core/hip_udp.c \
                                  lib/core/sqlitedbapi.c \
                                  lib/core/hashchain_store.c \
                                  lib/core/hip_statistics.c \

=== modified file 'firewall/conntrack.c'
--- firewall/conntrack.c        2010-03-08 22:07:59 +0000
+++ firewall/conntrack.c        2010-03-08 22:21:34 +0000
@@ -31,6 +31,7 @@
 #include "datapkt.h"
 #include "lib/core/misc.h"
 #include "lib/core/hostid.h"
+#include "lib/core/hip_udp.h"
 #include "hipd/hadb.h"
 #include "lib/tool/pk.h"
 #include "firewalldb.h"

=== modified file 'firewall/firewall.c'
--- firewall/firewall.c 2010-03-08 21:42:08 +0000
+++ firewall/firewall.c 2010-03-08 22:21:34 +0000
@@ -43,6 +43,7 @@
 #include "cache_port.h" /* required by opptcp */
 #include "lsi.h" /* LSI */
 #include "lib/core/hip_capability.h" /* Priviledge Separation */
+#include "lib/core/hip_udp.h"
 #include "user_ipsec_api.h" /* Userspace IPsec */
 #include "esp_prot_conntrack.h" /* ESP Tokens */
 #include "esp_prot_api.h" /* ESP Tokens */

=== modified file 'hipd/bos.c'
--- hipd/bos.c  2010-03-08 22:07:59 +0000
+++ hipd/bos.c  2010-03-08 22:21:34 +0000
@@ -3,6 +3,7 @@
 
 #include "bos.h"
 #include "lib/core/hostid.h"
+#include "lib/core/hip_udp.h"
 
 /**
  * hip_create_signature - Calculate SHA1 hash over the data and sign it.

=== modified file 'hipd/close.c'
--- hipd/close.c        2010-02-17 17:38:08 +0000
+++ hipd/close.c        2010-03-08 22:21:34 +0000
@@ -12,6 +12,7 @@
 #ifdef CONFIG_HIP_PERFORMANCE
 #include "lib/performance/performance.h"
 #endif
+#include "lib/core/hip_udp.h"
 
 
 static int hip_xmit_close(hip_ha_t *entry, void *opaque)

=== modified file 'hipd/esp_prot_hipd_msg.c'
--- hipd/esp_prot_hipd_msg.c    2010-02-17 17:38:08 +0000
+++ hipd/esp_prot_hipd_msg.c    2010-03-08 22:21:34 +0000
@@ -20,6 +20,7 @@
 #include "esp_prot_light_update.h"
 #include "lib/core/esp_prot_common.h"
 #include "lib/core/builder.h"
+#include "lib/core/hip_udp.h"
 #include "hipd.h"
 
 /**

=== modified file 'hipd/esp_prot_light_update.c'
--- hipd/esp_prot_light_update.c        2010-02-17 17:38:08 +0000
+++ hipd/esp_prot_light_update.c        2010-03-08 22:21:34 +0000
@@ -18,6 +18,7 @@
 #include "esp_prot_light_update.h"
 #include "esp_prot_anchordb.h"
 #include "lib/core/builder.h"
+#include "lib/core/hip_udp.h"
 
 /**
  * sends an ack for a received HHL-based update message

=== modified file 'hipd/hadb.c'
--- hipd/hadb.c 2010-03-08 22:07:59 +0000
+++ hipd/hadb.c 2010-03-08 22:21:34 +0000
@@ -13,6 +13,7 @@
 #include "lib/core/list.h"
 #include "lib/core/hostsfiles.h"
 #include "lib/core/hostid.h"
+#include "lib/core/hip_udp.h"
 
 #define HIP_HADB_SIZE 53
 #define HIP_MAX_HAS 100

=== modified file 'hipd/hiprelay.c'
--- hipd/hiprelay.c     2010-03-03 13:16:18 +0000
+++ hipd/hiprelay.c     2010-03-08 22:21:34 +0000
@@ -22,6 +22,7 @@
 #endif /* HAVE_CONFIG_H */
 
 #include "hiprelay.h"
+#include "lib/core/hip_udp.h"
 
 /** HIP relay config file default content. If the file @c HIP_RELAY_CONFIG_FILE
  *  cannot be opened for reading, we write a new config file from scratch using

=== modified file 'hipd/init.c'
--- hipd/init.c 2010-03-08 22:07:59 +0000
+++ hipd/init.c 2010-03-08 22:21:34 +0000
@@ -26,6 +26,7 @@
 #include "lib/tool/nlink.h"
 #include "oppdb.h"
 #include "lib/dht/libhipdht.h"
+#include "lib/core/hip_udp.h"
 
 #ifdef CONFIG_HIP_AGENT
 #include "hipd.h"

=== modified file 'hipd/input.c'
--- hipd/input.c        2010-03-07 16:11:10 +0000
+++ hipd/input.c        2010-03-08 22:21:34 +0000
@@ -28,6 +28,7 @@
 #include "keymat.h"
 #include "lib/core/crypto.h"
 #include "lib/core/builder.h"
+#include "lib/core/hip_udp.h"
 #include "dh.h"
 #include "lib/core/misc.h"
 #include "hidb.h"

=== modified file 'hipd/maintenance.c'
--- hipd/maintenance.c  2010-03-07 11:20:52 +0000
+++ hipd/maintenance.c  2010-03-08 22:21:34 +0000
@@ -21,6 +21,7 @@
 #include "update.h"
 #include "heartbeat.h"
 #include "hipd.h"
+#include "lib/core/hip_udp.h"
 
 #define FORCE_EXIT_COUNTER_START                5
 

=== modified file 'hipd/nat.h'
--- hipd/nat.h  2010-02-17 17:38:08 +0000
+++ hipd/nat.h  2010-03-08 22:21:34 +0000
@@ -27,8 +27,6 @@
  *  @todo Change this value. */
 #define HIP_NAT_KEEP_ALIVE_INTERVAL 20
 /** Port number for NAT traversal of hip control packets. */
-#define HIP_NAT_UDP_PORT 10500
-#define HIP_NAT_TURN_PORT 10500
 
 /** For setting socket to listen for beet-udp packets. */
 #define HIP_UDP_ENCAP 100

=== modified file 'hipd/netdev.c'
--- hipd/netdev.c       2010-03-08 17:29:23 +0000
+++ hipd/netdev.c       2010-03-08 22:21:34 +0000
@@ -36,6 +36,7 @@
 #include "lib/tool/lutil.h"
 #include "lib/conf/hipconf.h"
 #include "lib/core/hostsfiles.h"
+#include "lib/core/hip_udp.h"
 #include "hipd.h"
 
 /**

=== modified file 'hipd/output.c'
--- hipd/output.c       2010-03-05 08:47:53 +0000
+++ hipd/output.c       2010-03-08 22:21:34 +0000
@@ -29,6 +29,8 @@
 #include "i3/i3_client/i3_client_id.h"
 #endif
 
+#include "lib/core/hip_udp.h"
+
 enum number_dh_keys_t { ONE, TWO };
 
 enum number_dh_keys_t number_dh_keys = TWO;

=== modified file 'hipd/update.c'
--- hipd/update.c       2010-03-05 08:58:19 +0000
+++ hipd/update.c       2010-03-08 22:21:34 +0000
@@ -20,6 +20,7 @@
 #include "update.h"
 
 #include "lib/core/protodefs.h"
+#include "lib/core/hip_udp.h"
 #include "netdev.h"
 #include "lib/core/builder.h"
 #include "update_legacy.h"

=== modified file 'hipd/user.c'
--- hipd/user.c 2010-03-08 22:07:59 +0000
+++ hipd/user.c 2010-03-08 22:21:34 +0000
@@ -24,6 +24,7 @@
 #include "esp_prot_anchordb.h"
 #include "lib/dht/libhipdht.h"
 #include "lib/core/hostid.h"
+#include "lib/core/hip_udp.h"
 #include "hipd.h"
 
 int hip_sendto_user(const struct hip_common *msg, const struct sockaddr *dst)

=== added file 'lib/core/hip_udp.c'
--- lib/core/hip_udp.c  1970-01-01 00:00:00 +0000
+++ lib/core/hip_udp.c  2010-03-08 22:21:34 +0000
@@ -0,0 +1,67 @@
+/**
+ * @file
+ *
+ * Distributed under <a href="http://www.gnu.org/licenses/gpl2.txt";>GNU/GPL</a>
+ *
+ * @brief UDP-related functions
+ *
+ * @author Miika Komu <miika@xxxxxx>
+ */
+
+#include "hip_udp.h"
+#include "debug.h"
+
+/** Port numbers for NAT traversal of hip control packets. */
+in_port_t hip_local_nat_udp_port = HIP_NAT_UDP_PORT;
+in_port_t hip_peer_nat_udp_port  = HIP_NAT_UDP_PORT;
+
+
+/**
+ * Retrieve the default local UDP port
+ *
+ * @return the default local UDP port
+ */
+in_port_t hip_get_local_nat_udp_port()
+{
+    return hip_local_nat_udp_port;
+}
+
+/**
+ * Retrieve the default remote UDP port
+ *
+ * @return the default remote UDP port
+ */
+in_port_t hip_get_peer_nat_udp_port()
+{
+    return hip_peer_nat_udp_port;
+}
+
+/**
+ * set the default local UDP port
+ *
+ * @param port the port to set as the default local UDP port
+ * @return zero
+ */
+int hip_set_local_nat_udp_port(in_port_t port)
+{
+    int err = 0;
+    HIP_DEBUG("set local nat udp port %d\n", port);
+    hip_local_nat_udp_port = port;
+
+    return err;
+}
+
+/**
+ * set the default remote UDP port
+ *
+ * @param port the port to set as the default remote UDP port
+ * @return zero
+ */
+int hip_set_peer_nat_udp_port(in_port_t port)
+{
+    int err = 0;
+
+    HIP_DEBUG("set peer nat udp port %d\n", port);
+    hip_peer_nat_udp_port = port;
+    return err;
+}

=== added file 'lib/core/hip_udp.h'
--- lib/core/hip_udp.h  1970-01-01 00:00:00 +0000
+++ lib/core/hip_udp.h  2010-03-08 22:21:34 +0000
@@ -0,0 +1,29 @@
+#ifndef HIP_LIB_CORE_HIP_UDP_H
+#define HIP_LIB_CORE_HIP_UDP_H
+
+#include <netinet/in.h>
+
+#define HIP_NAT_UDP_PORT 10500
+#define HIP_NAT_TURN_PORT 10500
+
+/**
+ * Get HIP local NAT UDP port.
+ */
+in_port_t hip_get_local_nat_udp_port(void);
+
+/**
+ * Get HIP peer NAT UDP port.
+ */
+in_port_t hip_get_peer_nat_udp_port(void);
+
+/**
+ * Set HIP local NAT UDP port.
+ */
+int hip_set_local_nat_udp_port(in_port_t port);
+
+/**
+ * Set HIP peer NAT UDP port.
+ */
+int hip_set_peer_nat_udp_port(in_port_t port);
+
+#endif /* HIP_LIB_CORE_HIP_UDP_H */

=== modified file 'lib/core/message.c'
--- lib/core/message.c  2010-03-07 09:03:06 +0000
+++ lib/core/message.c  2010-03-08 22:21:34 +0000
@@ -68,6 +68,7 @@
 #define _BSD_SOURCE
 
 #include "message.h"
+#include "hip_udp.h"
 
 /**
  * Finds out how much data is coming from a socket

=== modified file 'lib/core/misc.c'
--- lib/core/misc.c     2010-03-08 22:07:59 +0000
+++ lib/core/misc.c     2010-03-08 22:21:34 +0000
@@ -20,11 +20,6 @@
 #include "misc.h"
 #include "prefix.h"
 
-/** Port numbers for NAT traversal of hip control packets. */
-in_port_t hip_local_nat_udp_port = HIP_NAT_UDP_PORT;
-in_port_t hip_peer_nat_udp_port  = HIP_NAT_UDP_PORT;
-
-
 /**
  * convert a binary HIT into a string
  *
@@ -1288,56 +1283,6 @@
 }
 
 
-/**
- * Retrieve the default local UDP port
- *
- * @return the default local UDP port
- */
-in_port_t hip_get_local_nat_udp_port()
-{
-    return hip_local_nat_udp_port;
-}
-
-/**
- * Retrieve the default remote UDP port
- *
- * @return the default remote UDP port
- */
-in_port_t hip_get_peer_nat_udp_port()
-{
-    return hip_peer_nat_udp_port;
-}
-
-/**
- * set the default local UDP port
- *
- * @param port the port to set as the default local UDP port
- * @return zero
- */
-int hip_set_local_nat_udp_port(in_port_t port)
-{
-    int err = 0;
-    HIP_DEBUG("set local nat udp port %d\n", port);
-    hip_local_nat_udp_port = port;
-
-    return err;
-}
-
-/**
- * set the default remote UDP port
- *
- * @param port the port to set as the default remote UDP port
- * @return zero
- */
-int hip_set_peer_nat_udp_port(in_port_t port)
-{
-    int err = 0;
-
-    HIP_DEBUG("set peer nat udp port %d\n", port);
-    hip_peer_nat_udp_port = port;
-    return err;
-}
-
 
 /**
  * verify if a given IPv6 address or IPv6 mapped IPv4 address

=== modified file 'lib/core/misc.h'
--- lib/core/misc.h     2010-03-08 22:07:59 +0000
+++ lib/core/misc.h     2010-03-08 22:21:34 +0000
@@ -183,27 +183,6 @@
                                int payload,
                                struct hip_common *msg);
 
-
-/**
- * Get HIP local NAT UDP port.
- */
-in_port_t hip_get_local_nat_udp_port(void);
-
-/**
- * Get HIP peer NAT UDP port.
- */
-in_port_t hip_get_peer_nat_udp_port(void);
-
-/**
- * Set HIP local NAT UDP port.
- */
-int hip_set_local_nat_udp_port(in_port_t port);
-
-/**
- * Set HIP peer NAT UDP port.
- */
-int hip_set_peer_nat_udp_port(in_port_t port);
-
 /**
  * Check if the given address is loopback.
  */

=== modified file 'lib/tool/xfrmapi.c'
--- lib/tool/xfrmapi.c  2010-03-05 08:47:53 +0000
+++ lib/tool/xfrmapi.c  2010-03-08 22:21:34 +0000
@@ -21,6 +21,7 @@
 #endif /* HAVE_CONFIG_H */
 
 #include "lib/tool/nlink.h"
+#include "lib/core/hip_udp.h"
 
 #include "xfrmapi.h"

Other related posts:

  • » [hipl-commit] [trunk] Rev 3859: Splitting misc.c into multiple files continued (bug id 1139). Added - Miika Komu