From: Martin Willi Date: Tue, 2 Nov 2010 13:30:45 +0000 (+0100) Subject: Support removal of payloads from messages X-Git-Tag: 4.5.1~314 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e6c6a4d304254cbba32af778a2edd34a16e83d23;p=thirdparty%2Fstrongswan.git Support removal of payloads from messages --- diff --git a/src/libcharon/encoding/message.c b/src/libcharon/encoding/message.c index b69a9f30c8..1b79b21951 100644 --- a/src/libcharon/encoding/message.c +++ b/src/libcharon/encoding/message.c @@ -737,6 +737,12 @@ METHOD(message_t, create_payload_enumerator, enumerator_t*, return this->payloads->create_enumerator(this->payloads); } +METHOD(message_t, remove_payload_at, void, + private_message_t *this, enumerator_t *enumerator) +{ + this->payloads->remove_at(this->payloads, enumerator); +} + METHOD(message_t, get_payload, payload_t*, private_message_t *this, payload_type_t type) { @@ -1466,6 +1472,7 @@ message_t *message_create_from_packet(packet_t *packet) .set_destination = _set_destination, .get_destination = _get_destination, .create_payload_enumerator = _create_payload_enumerator, + .remove_payload_at = _remove_payload_at, .get_payload = _get_payload, .get_notify = _get_notify, .parse_header = _parse_header, diff --git a/src/libcharon/encoding/message.h b/src/libcharon/encoding/message.h index 86c39ad7e3..899ced24a0 100644 --- a/src/libcharon/encoding/message.h +++ b/src/libcharon/encoding/message.h @@ -286,6 +286,13 @@ struct message_t { */ enumerator_t * (*create_payload_enumerator) (message_t *this); + /** + * Remove the payload at the current enumerator position. + * + * @param enumerator enumerator created by create_payload_enumerator() + */ + void (*remove_payload_at)(message_t *this, enumerator_t *enumerator); + /** * Find a payload of a specific type. *