Added IKEv1 ID payload <-> traffic selector conversion functions
[strongswan.git] / src / libcharon / encoding / payloads / id_payload.h
index 8ae90d2..bc69200 100644 (file)
@@ -28,6 +28,7 @@ typedef struct id_payload_t id_payload_t;
 #include <library.h>
 #include <utils/identification.h>
 #include <encoding/payloads/payload.h>
+#include <selectors/traffic_selector.h>
 
 /**
  * Object representing an IKEv1 or an IKEv2 ID payload.
@@ -47,6 +48,13 @@ struct id_payload_t {
        identification_t *(*get_identification) (id_payload_t *this);
 
        /**
+        * Creates a traffic selector form a ID_ADDR_SUBNET/RANGE identity.
+        *
+        * @return                              traffic selector, NULL on failure
+        */
+       traffic_selector_t* (*get_ts)(id_payload_t *this);
+
+       /**
         * Destroys an id_payload_t object.
         */
        void (*destroy) (id_payload_t *this);
@@ -70,4 +78,12 @@ id_payload_t *id_payload_create(payload_type_t payload_type);
 id_payload_t *id_payload_create_from_identification(payload_type_t type,
                                                                                                        identification_t *id);
 
+/**
+ * Create an IKEv1 ID_ADDR_SUBNET/RANGE identity from a traffic selector.
+ *
+ * @param ts           traffic selector
+ * @return                     ID_V1 id_paylad_t object.
+ */
+id_payload_t *id_payload_create_from_ts(traffic_selector_t *ts);
+
 #endif /** ID_PAYLOAD_H_ @}*/