Reuse generic constructor in IMV/IMC message
authorMartin Willi <martin@revosec.ch>
Mon, 19 Nov 2012 15:18:50 +0000 (16:18 +0100)
committerMartin Willi <martin@revosec.ch>
Fri, 30 Nov 2012 14:49:12 +0000 (15:49 +0100)
src/libimcv/imc/imc_msg.c
src/libimcv/imv/imv_msg.c

index a03bbc3..050e63f 100644 (file)
@@ -447,26 +447,10 @@ imc_msg_t *imc_msg_create_from_long_data(imc_agent_t *agent, imc_state_t *state,
 {
        private_imc_msg_t *this;
 
-       INIT(this,
-               .public = {
-                       .get_src_id = _get_src_id,
-                       .get_dst_id = _get_dst_id,
-                       .send = _send_,
-                       .receive = _receive,
-                       .add_attribute = _add_attribute,
-                       .create_attribute_enumerator = _create_attribute_enumerator,
-                       .get_encoding = _get_encoding,
-                       .destroy = _destroy,
-               },
-               .connection_id = connection_id,
-               .src_id = src_id,
-               .dst_id = dst_id,
-               .msg_type = pen_type_create(msg_vid, msg_subtype),
-               .attr_list = linked_list_create(),
-               .pa_msg = pa_tnc_msg_create_from_data(msg),
-               .agent = agent,
-               .state = state,
-       );
+       this = (private_imc_msg_t*)imc_msg_create(agent, state,
+                                                                               connection_id, src_id, dst_id,
+                                                                               pen_type_create(msg_vid, msg_subtype));
+       this->pa_msg = pa_tnc_msg_create_from_data(msg);
 
        return &this->public;
 }
index 5555f95..81209ce 100644 (file)
@@ -426,30 +426,10 @@ imv_msg_t *imv_msg_create_from_long_data(imv_agent_t *agent, imv_state_t *state,
 {
        private_imv_msg_t *this;
 
-       INIT(this,
-               .public = {
-                       .get_src_id = _get_src_id,
-                       .get_dst_id = _get_dst_id,
-                       .set_msg_type = _set_msg_type,
-                       .send = _send_,
-                       .send_assessment = _send_assessment,
-                       .receive = _receive,
-                       .add_attribute = _add_attribute,
-                       .delete_attributes = _delete_attributes,
-                       .create_attribute_enumerator = _create_attribute_enumerator,
-                       .get_encoding = _get_encoding,
-                       .destroy = _destroy,
-               },
-               .connection_id = connection_id,
-               .src_id = src_id,
-               .dst_id = dst_id,
-               .msg_type = pen_type_create(msg_vid, msg_subtype),
-               .attr_list = linked_list_create(),
-               .pa_msg = pa_tnc_msg_create_from_data(msg),
-               .agent = agent,
-               .state = state,
-       );
+       this = (private_imv_msg_t*)imv_msg_create(agent, state,
+                                                                               connection_id, src_id, dst_id,
+                                                                               pen_type_create(msg_vid, msg_subtype));
+       this->pa_msg = pa_tnc_msg_create_from_data(msg);
 
        return &this->public;
 }
-