[hipl-commit] [trunk] Rev 3577: Doxygen for firewall/firewall_control.c

  • From: Miika Komu <miika@xxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Tue, 9 Feb 2010 23:20:05 +0200

Committer: Miika Komu <miika@xxxxxx>
Date: Tue Feb 09 23:20:18 2010 +0200
Revision: 3577
Revision-id: miika@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Doxygen for firewall/firewall_control.c

Modified:
  D  firewall/firewall_control.c.doxyme
  M  firewall/firewall.c
  M  firewall/firewall.h
  M  firewall/firewall_control.c
  M  firewall/firewall_control.h
  M  firewall/proxy.c
  M  firewall/proxy.h

=== modified file 'firewall/firewall.c'
--- firewall/firewall.c 2010-02-09 20:52:23 +0000
+++ firewall/firewall.c 2010-02-09 21:20:18 +0000
@@ -167,6 +167,32 @@
 /*----------------INIT FUNCTIONS------------------*/
 
 /**
+ * Initialize ESP relay extensions
+ *
+ * @return zero on success, non-zero on error
+ *
+ **/
+int hip_fw_init_esp_relay(void)
+{
+       int err = 0;
+
+       esp_relay = 1;
+       filter_traffic = 1;
+
+       return err;
+}
+
+/**
+ * uninitialize ESP relay extensions
+ *
+ **/
+void hip_fw_uninit_esp_relay(void)
+{
+
+       esp_relay = 0;
+}
+
+/**
  * Initialize sava client packet capture rules
  * 
  * @return zero on success, non-zero on error
@@ -2666,7 +2692,7 @@
 
                        }
 
-                       err = handle_msg(msg);
+                       err = hip_handle_msg(msg);
                        if (err < 0){
                                HIP_ERROR("Error handling message\n");
                                continue;

=== modified file 'firewall/firewall.h'
--- firewall/firewall.h 2010-01-19 09:28:42 +0000
+++ firewall/firewall.h 2010-02-09 21:20:18 +0000
@@ -23,6 +23,8 @@
 extern int hip_fw_sock;
 extern int hip_fw_async_sock;
 
+int hip_fw_init_esp_relay(void);
+void hip_fw_uninit_esp_relay(void);
 int hip_fw_init_opptcp(void);
 int hip_fw_uninit_opptcp(void);
 int hip_fw_init_proxy(void);

=== modified file 'firewall/firewall_control.c'
--- firewall/firewall_control.c 2010-02-08 21:28:25 +0000
+++ firewall/firewall_control.c 2010-02-09 21:20:18 +0000
@@ -1,8 +1,16 @@
-/*
- * Firewall control
- *
- */
-
+/**
+ * @file firewall/firewall_control.c
+ *
+ * Distributed under <a href="http://www.gnu.org/licenses/gpl.txt";>GNU/GPL</a>
+ *
+ * Firewall communication interface with hipd. Firewall can send messages
+ * asynchronously (recommended) or synchronously (not recommended because
+ * other messages may intervene). 
+ *
+ * @brief Firewall communication interface with hipd
+ *
+ * @author Miika Komu <miika@xxxxxx>
+ **/
 #ifdef HAVE_CONFIG_H
   #include "config.h"
 #endif /* HAVE_CONFIG_H */
@@ -16,25 +24,14 @@
 #include "sysopp.h"
 #include "sava_api.h"
 
-// TODO move to relay implementation, this file should only distribute msg to 
extension
-static int hip_fw_init_esp_relay(void)
-{
-       int err = 0;
-
-       esp_relay = 1;
-       filter_traffic = 1;
-
-       return err;
-}
-
-// TODO move to sava implementation, this file should only distribute msg to 
extension
-static void hip_fw_uninit_esp_relay(void)
-{
-
-       esp_relay = 0;
-}
-
-static int handle_bex_state_update(struct hip_common * msg)
+/**
+ * Change the state of hadb state cache in the firewall
+ *
+ * @param msg the message containing hadb cache information
+ *
+ * @return zero on success, non-zero on error
+ */
+static int hip_handle_bex_state_update(struct hip_common * msg)
 {
        struct in6_addr *src_hit = NULL, *dst_hit = NULL;
        struct hip_tlv_common *param = NULL;
@@ -69,13 +66,13 @@
        return err;
 }
 
-/** distributes a userspace message to the respective extension by packet type
+/**
+ * distribute a message from hipd to the respective extension handler
  *
  * @param      msg pointer to the received user message
- * @param
  * @return     0 on success, else -1
  */
-int handle_msg(struct hip_common * msg)
+int hip_handle_msg(struct hip_common * msg)
 {
        int type, err = 0;
        struct hip_common *msg_out = NULL;
@@ -92,8 +89,8 @@
                break;
        case SO_HIP_FW_BEX_DONE:
        case SO_HIP_FW_UPDATE_DB:
-               if(hip_lsi_support)
-                 handle_bex_state_update(msg);
+               if (hip_lsi_support)
+                       hip_handle_bex_state_update(msg);
                break;
        case SO_HIP_IPSEC_ADD_SA:
                HIP_DEBUG("Received add sa request from hipd\n");
@@ -211,34 +208,3 @@
        return err;
 }
 
-// TODO move to proxy implementation, this file should only distribute msg to 
extension
-#ifdef CONFIG_HIP_HIPPROXY
-int request_hipproxy_status(void)
-{
-        struct hip_common *msg = NULL;
-        int err = 0;
-        HIP_DEBUG("Sending hipproxy msg to hipd.\n");
-        HIP_IFEL(!(msg = HIP_MALLOC(HIP_MAX_PACKET, 0)), -1, "alloc\n");
-        hip_msg_init(msg);
-        HIP_IFEL(hip_build_user_hdr(msg,
-                SO_HIP_HIPPROXY_STATUS_REQUEST, 0),
-                -1, "Build hdr failed\n");
-
-        //n = hip_sendto(msg, &hip_firewall_addr);
-
-        //n = sendto(hip_fw_sock, msg, hip_get_msg_total_len(msg),
-        //             0,(struct sockaddr *)dst, sizeof(struct sockaddr_in6));
-
-        HIP_IFEL(hip_send_recv_daemon_info(msg, 1, hip_fw_sock), -1,
-                "HIP_HIPPROXY_STATUS_REQUEST: Sendto HIPD failed.\n");
-       HIP_DEBUG("HIP_HIPPROXY_STATUS_REQUEST: Sendto hipd ok.\n");
-
-out_err:
-       if(msg)
-               free(msg);
-        return err;
-}
-#endif /* CONFIG_HIP_HIPPROXY */
-
-
-

=== removed file 'firewall/firewall_control.c.doxyme'
--- firewall/firewall_control.c.doxyme  2009-12-12 10:44:54 +0000
+++ firewall/firewall_control.c.doxyme  1970-01-01 00:00:00 +0000
@@ -1,62 +0,0 @@
-/**
- * @file firewall/firewall_control.c
- *
- * <LICENSE TEMLPATE LINE - LEAVE THIS LINE INTACT>
- *
- * Write description of source file here for dOxygen. Be as precise as 
possible.
- * Please also note how and by which parts of the code this file should be 
used.
- *
- * @brief Write a short summary
- *
- * @author <Put all existing author information here>
- * @author another Author another@xxxxxxxxxx
- **/
-
-
-
- ///  Single line comment for dOxygen.
-
-/**
- * my_great_function
- *
- * Write description of function here.
- * The function should follow these comments.
- * 
- * Document the use of each function variable and indicate if this
- * argument is used to return information to the calling context. Use
- * [out] for outut parameters (This is very important). Align the 
- * descriptions to improve readability.
- *
- *  @note: put important usage informations to notes. 
- *
- *  @param      firstArg     Description of first function argument.
- *  @param[out] secondArg    Description of second function argument.
- *  @param      thirdArg     Description of third function argument.
- *  @return Description of returned value.
- **/
-
-int my_great_function(int firstArg, char** secondArg, int thirdArg){
-    .....
-
-/// Now it's your turn.
-
-
-
-
-/**
- * handle_msg 
- *
- *
- * @param autogen.sh
- * @return 
- **/
-
-
-/**
- * request_hipproxy_status 
- *
- *
- * @param void
- * @return 
- **/
-

=== modified file 'firewall/firewall_control.h'
--- firewall/firewall_control.h 2010-01-19 09:28:42 +0000
+++ firewall/firewall_control.h 2010-02-09 21:20:18 +0000
@@ -8,11 +8,7 @@
 #include "lib/core/builder.h"
 #include "lib/core/protodefs.h"
 
-int handle_msg(struct hip_common * msg);
-
-#ifdef CONFIG_HIP_HIPPROXY
-int request_hipproxy_status(void);
-#endif
+int hip_handle_msg(struct hip_common * msg);
 
 #if 0
 int request_savah_status(int mode);

=== modified file 'firewall/proxy.c'
--- firewall/proxy.c    2010-02-08 14:07:02 +0000
+++ firewall/proxy.c    2010-02-09 21:20:18 +0000
@@ -15,6 +15,39 @@
 int hip_proxy_raw_sock_icmp_inbound = 0;
 const char hip_proxy_supported_proto[] = { IPPROTO_TCP, IPPROTO_ICMP, 
IPPROTO_UDP };
 
+/**
+ *
+ *
+ * @return zero on success, non-zero on error
+ */
+#ifdef CONFIG_HIP_HIPPROXY
+int request_hipproxy_status(void)
+{
+        struct hip_common *msg = NULL;
+        int err = 0;
+        HIP_DEBUG("Sending hipproxy msg to hipd.\n");
+        HIP_IFEL(!(msg = HIP_MALLOC(HIP_MAX_PACKET, 0)), -1, "alloc\n");
+        hip_msg_init(msg);
+        HIP_IFEL(hip_build_user_hdr(msg,
+                SO_HIP_HIPPROXY_STATUS_REQUEST, 0),
+                -1, "Build hdr failed\n");
+
+        //n = hip_sendto(msg, &hip_firewall_addr);
+
+        //n = sendto(hip_fw_sock, msg, hip_get_msg_total_len(msg),
+        //             0,(struct sockaddr *)dst, sizeof(struct sockaddr_in6));
+
+        HIP_IFEL(hip_send_recv_daemon_info(msg, 1, hip_fw_sock), -1,
+                "HIP_HIPPROXY_STATUS_REQUEST: Sendto HIPD failed.\n");
+       HIP_DEBUG("HIP_HIPPROXY_STATUS_REQUEST: Sendto hipd ok.\n");
+
+out_err:
+       if(msg)
+               free(msg);
+        return err;
+}
+#endif /* CONFIG_HIP_HIPPROXY */
+
 int hip_proxy_request_peer_hit_from_hipd(const struct in6_addr *peer_ip,
                                         const struct in6_addr *local_hit)
 {

=== modified file 'firewall/proxy.h'
--- firewall/proxy.h    2010-01-06 22:18:26 +0000
+++ firewall/proxy.h    2010-02-09 21:20:18 +0000
@@ -6,6 +6,10 @@
 #include "firewall.h"
 #include "proxydb.h"
 
+#ifdef CONFIG_HIP_HIPPROXY
+int request_hipproxy_status(void);
+#endif
+
 int init_proxy(void);
 int uninit_proxy(void);
 int hip_fw_proxy_set_peer_hit(hip_common_t *msg);

Other related posts:

  • » [hipl-commit] [trunk] Rev 3577: Doxygen for firewall/firewall_control.c - Miika Komu