Add IF-M message subtype getter to IMC/IMV messages
authorMartin Willi <martin@revosec.ch>
Mon, 21 Jan 2013 16:01:53 +0000 (17:01 +0100)
committerMartin Willi <martin@revosec.ch>
Thu, 14 Feb 2013 16:18:24 +0000 (17:18 +0100)
src/libimcv/imc/imc_msg.c
src/libimcv/imc/imc_msg.h
src/libimcv/imv/imv_msg.c
src/libimcv/imv/imv_msg.h

index 050e63f..1fc3d3b 100644 (file)
@@ -91,6 +91,12 @@ METHOD(imc_msg_t, get_dst_id, TNC_UInt32,
        return this->dst_id;
 }
 
+METHOD(imc_msg_t, get_msg_type, pen_type_t,
+       private_imc_msg_t *this)
+{
+       return this->msg_type;
+}
+
 METHOD(imc_msg_t, send_, TNC_Result,
        private_imc_msg_t *this, bool excl)
 {
@@ -380,6 +386,7 @@ imc_msg_t *imc_msg_create(imc_agent_t *agent, imc_state_t *state,
                .public = {
                        .get_src_id = _get_src_id,
                        .get_dst_id = _get_dst_id,
+                       .get_msg_type = _get_msg_type,
                        .send = _send_,
                        .receive = _receive,
                        .add_attribute = _add_attribute,
@@ -454,4 +461,3 @@ imc_msg_t *imc_msg_create_from_long_data(imc_agent_t *agent, imc_state_t *state,
 
        return &this->public;
 }
-
index 6dd712e..9a4623a 100644 (file)
@@ -48,6 +48,13 @@ struct imc_msg_t {
        TNC_UInt32 (*get_dst_id)(imc_msg_t *this);
 
        /**
+        * Get the PA-TNC message type.
+        *
+        * @return                                      message type
+        */
+       pen_type_t (*get_msg_type)(imc_msg_t *this);
+
+       /**
         * Sends one or multiple PA-TNC messages
         *
         * @param excl                          set the excl message flag if supported
index 4ed19dd..496d0ee 100644 (file)
@@ -102,6 +102,12 @@ METHOD(imv_msg_t, set_msg_type, void,
        }
 }
 
+METHOD(imv_msg_t, get_msg_type, pen_type_t,
+       private_imv_msg_t *this)
+{
+       return this->msg_type;
+}
+
 METHOD(imv_msg_t, add_attribute, void,
        private_imv_msg_t *this, pa_tnc_attr_t *attr)
 {
@@ -352,6 +358,7 @@ imv_msg_t *imv_msg_create(imv_agent_t *agent, imv_state_t *state,
                        .get_src_id = _get_src_id,
                        .get_dst_id = _get_dst_id,
                        .set_msg_type = _set_msg_type,
+                       .get_msg_type = _get_msg_type,
                        .send = _send_,
                        .send_assessment = _send_assessment,
                        .receive = _receive,
index b639712..2a28101 100644 (file)
@@ -55,6 +55,13 @@ struct imv_msg_t {
        void (*set_msg_type)(imv_msg_t *this, pen_type_t msg_type);
 
        /**
+        * Get the type of a PA-TNC message.
+        *
+        * @return                                      message type
+        */
+       pen_type_t (*get_msg_type)(imv_msg_t *this);
+
+       /**
         * Sends one or multiple PA-TNC messages
         *
         * @param excl                          set the excl message flag if supported