diff --git a/src/libimcv/imc/imc_msg.c b/src/libimcv/imc/imc_msg.c index 250f5c708..a03bbc398 100644 --- a/src/libimcv/imc/imc_msg.c +++ b/src/libimcv/imc/imc_msg.c @@ -347,6 +347,16 @@ METHOD(imc_msg_t, create_attribute_enumerator, enumerator_t*, return this->pa_msg->create_attribute_enumerator(this->pa_msg); } +METHOD(imc_msg_t, get_encoding, chunk_t, + private_imc_msg_t *this) +{ + if (this->pa_msg) + { + return this->pa_msg->get_encoding(this->pa_msg); + } + return chunk_empty; +} + METHOD(imc_msg_t, destroy, void, private_imc_msg_t *this) { @@ -374,6 +384,7 @@ imc_msg_t *imc_msg_create(imc_agent_t *agent, imc_state_t *state, .receive = _receive, .add_attribute = _add_attribute, .create_attribute_enumerator = _create_attribute_enumerator, + .get_encoding = _get_encoding, .destroy = _destroy, }, .connection_id = connection_id, @@ -444,6 +455,7 @@ imc_msg_t *imc_msg_create_from_long_data(imc_agent_t *agent, imc_state_t *state, .receive = _receive, .add_attribute = _add_attribute, .create_attribute_enumerator = _create_attribute_enumerator, + .get_encoding = _get_encoding, .destroy = _destroy, }, .connection_id = connection_id, diff --git a/src/libimcv/imc/imc_msg.h b/src/libimcv/imc/imc_msg.h index 7c7d75a9b..6dd712e84 100644 --- a/src/libimcv/imc/imc_msg.h +++ b/src/libimcv/imc/imc_msg.h @@ -77,6 +77,13 @@ struct imc_msg_t { */ enumerator_t* (*create_attribute_enumerator)(imc_msg_t *this); + /** + * Get the encoding of the IMC message. + * + * @return message encoding, internal data + */ + chunk_t (*get_encoding)(imc_msg_t *this); + /** * Destroys a imc_msg_t object. */ diff --git a/src/libimcv/imv/imv_msg.c b/src/libimcv/imv/imv_msg.c index 9ec297bfc..5555f95b9 100644 --- a/src/libimcv/imv/imv_msg.c +++ b/src/libimcv/imv/imv_msg.c @@ -323,6 +323,16 @@ METHOD(imv_msg_t, create_attribute_enumerator, enumerator_t*, return this->pa_msg->create_attribute_enumerator(this->pa_msg); } +METHOD(imv_msg_t, get_encoding, chunk_t, + private_imv_msg_t *this) +{ + if (this->pa_msg) + { + return this->pa_msg->get_encoding(this->pa_msg); + } + return chunk_empty; +} + METHOD(imv_msg_t, destroy, void, private_imv_msg_t *this) { @@ -353,6 +363,7 @@ imv_msg_t *imv_msg_create(imv_agent_t *agent, imv_state_t *state, .add_attribute = _add_attribute, .delete_attributes = _delete_attributes, .create_attribute_enumerator = _create_attribute_enumerator, + .get_encoding = _get_encoding, .destroy = _destroy, }, .connection_id = connection_id, @@ -426,6 +437,7 @@ imv_msg_t *imv_msg_create_from_long_data(imv_agent_t *agent, imv_state_t *state, .add_attribute = _add_attribute, .delete_attributes = _delete_attributes, .create_attribute_enumerator = _create_attribute_enumerator, + .get_encoding = _get_encoding, .destroy = _destroy, }, .connection_id = connection_id, diff --git a/src/libimcv/imv/imv_msg.h b/src/libimcv/imv/imv_msg.h index 4c39150f6..92347934f 100644 --- a/src/libimcv/imv/imv_msg.h +++ b/src/libimcv/imv/imv_msg.h @@ -97,6 +97,13 @@ struct imv_msg_t { */ enumerator_t* (*create_attribute_enumerator)(imv_msg_t *this); + /** + * Get the full encoding of an IMV message. + * + * @return message encoding, internal data + */ + chunk_t (*get_encoding)(imv_msg_t *this); + /** * Destroys a imv_msg_t object. */