Added substructure enumerators to sa_payload, proposal_substructure
authorMartin Willi <martin@revosec.ch>
Thu, 25 Nov 2010 09:55:08 +0000 (10:55 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 5 Jan 2011 15:45:52 +0000 (16:45 +0100)
src/libcharon/encoding/payloads/proposal_substructure.c
src/libcharon/encoding/payloads/proposal_substructure.h
src/libcharon/encoding/payloads/sa_payload.c
src/libcharon/encoding/payloads/sa_payload.h

index 7d73bec..f39c3b0 100644 (file)
@@ -342,6 +342,12 @@ METHOD(proposal_substructure_t, get_proposal, proposal_t*,
        return proposal;
 }
 
+METHOD(proposal_substructure_t, create_substructure_enumerator, enumerator_t*,
+       private_proposal_substructure_t *this)
+{
+       return this->transforms->create_enumerator(this->transforms);
+}
+
 METHOD2(payload_t, proposal_substructure_t, destroy, void,
        private_proposal_substructure_t *this)
 {
@@ -375,6 +381,7 @@ proposal_substructure_t *proposal_substructure_create()
                        .get_protocol_id = _get_protocol_id,
                        .set_is_last_proposal = _set_is_last_proposal,
                        .get_proposal = _get_proposal,
+                       .create_substructure_enumerator = _create_substructure_enumerator,
                        .set_spi = _set_spi,
                        .get_spi = _get_spi,
                        .destroy = _destroy,
index 2e8d417..d0ba1fd 100644 (file)
@@ -111,6 +111,13 @@ struct proposal_substructure_t {
        proposal_t * (*get_proposal) (proposal_substructure_t *this);
 
        /**
+        * Create an enumerator over transform substructures.
+        *
+        * @return                      enumerator over transform_substructure_t
+        */
+       enumerator_t* (*create_substructure_enumerator)(proposal_substructure_t *this);
+
+       /**
         * Destroys an proposal_substructure_t object.
         */
        void (*destroy) (proposal_substructure_t *this);
index 8667e7a..db20d05 100644 (file)
@@ -262,6 +262,12 @@ METHOD(sa_payload_t, get_proposals, linked_list_t*,
        return list;
 }
 
+METHOD(sa_payload_t, create_substructure_enumerator, enumerator_t*,
+       private_sa_payload_t *this)
+{
+       return this->proposals->create_enumerator(this->proposals);
+}
+
 METHOD2(payload_t, sa_payload_t, destroy, void,
        private_sa_payload_t *this)
 {
@@ -290,6 +296,7 @@ sa_payload_t *sa_payload_create()
                        },
                        .add_proposal = _add_proposal,
                        .get_proposals = _get_proposals,
+                       .create_substructure_enumerator = _create_substructure_enumerator,
                        .destroy = _destroy,
                },
                .next_payload = NO_PAYLOAD,
index 801a707..cc8c481 100644 (file)
@@ -61,6 +61,13 @@ struct sa_payload_t {
        void (*add_proposal) (sa_payload_t *this, proposal_t *proposal);
 
        /**
+        * Create an enumerator over all proposal substructures.
+        *
+        * @return                                      enumerator over proposal_substructure_t
+        */
+       enumerator_t* (*create_substructure_enumerator)(sa_payload_t *this);
+
+       /**
         * Destroys an sa_payload_t object.
         */
        void (*destroy) (sa_payload_t *this);