Implemented get|set_action_flag() methods
authorAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 11 Jun 2013 19:01:57 +0000 (21:01 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 21 Jun 2013 21:25:24 +0000 (23:25 +0200)
src/libimcv/plugins/imv_scanner/imv_scanner_agent.c
src/libimcv/plugins/imv_scanner/imv_scanner_state.c
src/libimcv/plugins/imv_scanner/imv_scanner_state.h

index 977d657..0415f52 100644 (file)
@@ -193,10 +193,8 @@ static TNC_Result receive_msg(private_imv_scanner_agent_t *this,
                        u_int16_t port;
                        bool blocked, compliant = TRUE;
 
-
+                       state->set_action_flags(state, IMV_SCANNER_ATTR_PORT_FILTER);
                        scanner_state = (imv_scanner_state_t*)state;
-                       scanner_state->set_received(scanner_state,
-                                                                               IMV_SCANNER_ATTR_PORT_FILTER);
                        attr_port_filter = (ietf_attr_port_filter_t*)attr;
 
                        enumerator = attr_port_filter->create_port_enumerator(attr_port_filter);
index eeecd41..83a5e58 100644 (file)
@@ -61,6 +61,11 @@ struct private_imv_scanner_state_t {
        u_int32_t max_msg_len;
 
        /**
+        * Flags set for completed actions
+        */
+       u_int32_t action_flags;
+
+       /**
         * Access Requestor ID Type
         */
        u_int32_t ar_id_type;
@@ -91,11 +96,6 @@ struct private_imv_scanner_state_t {
        imv_scanner_handshake_state_t handshake_state;
 
        /**
-        * Flags set for received attributes
-        */
-       u_int received_flags;
-
-       /**
         * List with ports that should be closed
         */
         linked_list_t *violating_ports;
@@ -192,6 +192,18 @@ METHOD(imv_state_t, get_max_msg_len, u_int32_t,
        return this->max_msg_len;
 }
 
+METHOD(imv_state_t, set_action_flags, void,
+       private_imv_scanner_state_t *this, u_int32_t flags)
+{
+       this->action_flags |= flags;
+}
+
+METHOD(imv_state_t, get_action_flags, u_int32_t,
+       private_imv_scanner_state_t *this)
+{
+       return this->action_flags;
+}
+
 METHOD(imv_state_t, set_ar_id, void,
        private_imv_scanner_state_t *this, u_int32_t id_type, chunk_t id_value)
 {
@@ -322,19 +334,6 @@ METHOD(imv_scanner_state_t, get_handshake_state, imv_scanner_handshake_state_t,
        return this->handshake_state;
 }
 
-METHOD(imv_scanner_state_t, set_received, void,
-       private_imv_scanner_state_t *this, u_int flags)
-{
-       this->received_flags |= flags;
-}
-
-METHOD(imv_scanner_state_t, get_received, u_int,
-       private_imv_scanner_state_t *this)
-{
-       return this->received_flags;
-}
-
-
 METHOD(imv_scanner_state_t, add_violating_port, void,
        private_imv_scanner_state_t *this, char *port)
 {
@@ -357,6 +356,8 @@ imv_state_t *imv_scanner_state_create(TNC_ConnectionID connection_id)
                                .set_flags = _set_flags,
                                .set_max_msg_len = _set_max_msg_len,
                                .get_max_msg_len = _get_max_msg_len,
+                               .set_action_flags = _set_action_flags,
+                               .get_action_flags = _get_action_flags,
                                .set_ar_id = _set_ar_id,
                                .get_ar_id = _get_ar_id,
                                .set_session = _set_session,
@@ -371,8 +372,6 @@ imv_state_t *imv_scanner_state_create(TNC_ConnectionID connection_id)
                        },
                        .set_handshake_state = _set_handshake_state,
                        .get_handshake_state = _get_handshake_state,
-                       .set_received = _set_received,
-                       .get_received = _get_received,
                        .add_violating_port = _add_violating_port,
                },
                .state = TNC_CONNECTION_STATE_CREATE,
index 0543338..634448d 100644 (file)
@@ -65,20 +65,6 @@ struct imv_scanner_state_t {
        imv_scanner_handshake_state_t (*get_handshake_state)(imv_scanner_state_t *this);
 
        /**
-        * Set flags for received attributes
-        *
-        * @param flags                 Flags to be set
-        */
-       void (*set_received)(imv_scanner_state_t *this, u_int flags);
-
-       /**
-        * Get flags set for received attributes
-        *
-        * @return                              Flags set for received attributes
-        */
-       u_int (*get_received)(imv_scanner_state_t *this);
-
-       /**
         * add a violating TCP or UDP port
         */
        void (*add_violating_port)(imv_scanner_state_t *this, char *port);