Completed implementation of PWG HCD attributes
[strongswan.git] / src / libimcv / pwg / pwg_attr.c
index 0301cc7..f40eb76 100644 (file)
 #include "pwg_attr.h"
 
 #include "generic/generic_attr_bool.h"
+#include "generic/generic_attr_chunk.h"
+#include "generic/generic_attr_string.h"
 #include "ietf/ietf_attr_port_filter.h"
-
+#include "pwg/pwg_attr_vendor_smi_code.h"
 
 ENUM_BEGIN(pwg_attr_names,     PWG_HCD_ATTRS_NATURAL_LANG,
                                                        PWG_HCD_VENDOR_SMI_CODE,
@@ -96,17 +98,22 @@ pa_tnc_attr_t* pwg_attr_create_from_data(u_int32_t type, size_t length, chunk_t
                case PWG_HCD_RESIDENT_APP_NAME:
                case PWG_HCD_RESIDENT_APP_PATCHES:
                case PWG_HCD_RESIDENT_APP_STRING_VERSION:
+                       return generic_attr_string_create_from_data(length, value,
+                                                                       pen_type_create(PEN_PWG, type));
+               case PWG_HCD_FIRMWARE_VERSION:
+               case PWG_HCD_RESIDENT_APP_VERSION:
+               case PWG_HCD_USER_APP_VERSION:
+                       return generic_attr_chunk_create_from_data(length, value, 16,
+                                                                       pen_type_create(PEN_PWG, type));
                case PWG_HCD_CERTIFICATION_STATE:
                case PWG_HCD_CONFIGURATION_STATE:
-                       return generic_attr_string_create_from_data(length, value,
+                       return generic_attr_chunk_create_from_data(length, value, 0,
                                                                        pen_type_create(PEN_PWG, type));
+               case PWG_HCD_VENDOR_SMI_CODE:
+                       return pwg_attr_vendor_smi_code_create_from_data(length, value);
                case PWG_HCD_FIREWALL_SETTING:
                        return ietf_attr_port_filter_create_from_data(length, value,
                                                                        pen_type_create(PEN_PWG, type));
-               case PWG_HCD_VENDOR_SMI_CODE:
-               case PWG_HCD_FIRMWARE_VERSION:
-               case PWG_HCD_RESIDENT_APP_VERSION:
-               case PWG_HCD_USER_APP_VERSION:
                default:
                        return NULL;
        }