aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/encoding/payloads/id_payload.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/charon/encoding/payloads/id_payload.h')
-rw-r--r--Source/charon/encoding/payloads/id_payload.h82
1 files changed, 27 insertions, 55 deletions
diff --git a/Source/charon/encoding/payloads/id_payload.h b/Source/charon/encoding/payloads/id_payload.h
index 416c1c4b5..7348f2668 100644
--- a/Source/charon/encoding/payloads/id_payload.h
+++ b/Source/charon/encoding/payloads/id_payload.h
@@ -25,6 +25,7 @@
#define _ID_PAYLOAD_H_
#include <types.h>
+#include <utils/identification.h>
#include <encoding/payloads/payload.h>
/**
@@ -35,61 +36,6 @@
#define ID_PAYLOAD_HEADER_LENGTH 8
-typedef enum id_type_t id_type_t;
-
-/**
- * ID Types of a ID payload.
- *
- * @ingroup payloads
- */
-enum id_type_t {
- /**
- * ID data is a single four (4) octet IPv4 address.
- */
- ID_IPV4_ADDR = 1,
-
- /**
- * ID data is a fully-qualified domain name string.
- * An example of a ID_FQDN is, "example.com".
- * The string MUST not contain any terminators (e.g., NULL, CR, etc.).
- */
- ID_FQDN = 2,
-
- /**
- * ID data is a fully-qualified RFC822 email address string, An example of
- * a ID_RFC822_ADDR is, "jsmith@example.com". The string MUST
- * not contain any terminators.
- */
- ID_RFC822_ADDR = 3,
-
- /**
- * ID data is a single sixteen (16) octet IPv6 address.
- */
- ID_IPV6_ADDR = 5,
-
- /**
- * ID data is the binary DER encoding of an ASN.1 X.500 Distinguished Name
- * [X.501].
- */
- ID_DER_ASN1_DN = 9,
-
- /**
- * ID data is the binary DER encoding of an ASN.1 X.500 GeneralName
- * [X.509].
- */
- ID_DER_ASN1_GN = 10,
-
- /**
- * ID data is an opaque octet stream which may be used to pass vendor-
- * specific information necessary to do certain proprietary
- * types of identification.
- */
- ID_KEY_ID = 11
-};
-
-extern mapping_t id_type_m[];
-
-
typedef struct id_payload_t id_payload_t;
/**
@@ -144,6 +90,18 @@ struct id_payload_t {
chunk_t (*get_data) (id_payload_t *this);
/**
+ * @brief Creates an identification object of this id payload.
+ *
+ * Returned object has to get destroyed by the caller.
+ *
+ * @param this calling id_payload_t object
+ * @return
+ * - identification_t object
+ * - NULL if ID type not supported
+ */
+ identification_t *(*get_identification) (id_payload_t *this);
+
+ /**
* @brief Get the type of ID payload (IDi or IDr).
*
* @param this calling id_payload_t object
@@ -186,5 +144,19 @@ struct id_payload_t {
*/
id_payload_t *id_payload_create(bool is_initiator);
+/**
+ * @brief Creates an id_payload_t from an existing identification_t object.
+ *
+ * @param is_initiator
+ * - TRUE if this payload is of type IDi
+ * - FALSE if this payload is of type IDr
+ * @param identification identification_t object
+ * @return created id_payload_t object
+ *
+ * @ingroup payloads
+ */
+id_payload_t *id_payload_create_from_identification(bool is_initiator,identification_t *identification);
+
+
#endif //_ID_PAYLOAD_H_