Add getters for the raw encoding in IMV/IMC messages

This commit is contained in:
Martin Willi
2012-11-30 15:49:07 +01:00
parent 2a433075e2
commit a6722e5653
4 changed files with 38 additions and 0 deletions
+12
View File
@@ -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,
+7
View File
@@ -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.
*/
+12
View File
@@ -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,
+7
View File
@@ -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.
*/