- parser succesfully parses sa payload
[strongswan.git] / Source / charon / payloads / payload.c
index dad260f..cf7a75b 100644 (file)
 
 #include "payload.h"
 
 
 #include "payload.h"
 
-
-
-
-
-
-
-
+#include "ike_header.h"
+#include "sa_payload.h"
 
 
 
 
 
 
@@ -58,6 +53,31 @@ mapping_t payload_type_t_mappings[] = {
        {CONFIGURATION, "CONFIGURATION"},
        {EXTENSIBLE_AUTHENTICATION, "EXTENSIBLE_AUTHENTICATION"},
        {HEADER, "HEADER"},
        {CONFIGURATION, "CONFIGURATION"},
        {EXTENSIBLE_AUTHENTICATION, "EXTENSIBLE_AUTHENTICATION"},
        {HEADER, "HEADER"},
+       {PROPOSAL_SUBSTRUCTURE, "PROPOSAL_SUBSTRUCTURE"},
+       {TRANSFORM_SUBSTRUCTURE, "TRANSFORM_SUBSTRUCTURE"},
+       {TRANSFORM_ATTRIBUTE, "TRANSFORM_ATTRIBUTE"},
        {MAPPING_END, NULL}
 };
 
        {MAPPING_END, NULL}
 };
 
+/*
+ * see header
+ */
+payload_t *payload_create(payload_type_t type)
+{
+       switch (type)
+       {
+               case HEADER:
+                       return (payload_t*)ike_header_create();
+               case SECURITY_ASSOCIATION:
+                       return (payload_t*)sa_payload_create();
+               case PROPOSAL_SUBSTRUCTURE:
+                       return (payload_t*)proposal_substructure_create();
+               case TRANSFORM_SUBSTRUCTURE:
+                       return (payload_t*)transform_substructure_create();
+               case TRANSFORM_ATTRIBUTE:
+                       return (payload_t*)transform_attribute_create();
+               default:
+                       return NULL;
+       }
+}
+