2 * Copyright (C) 2010 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 #include "pb_tnc_msg.h"
17 #include "ietf/pb_experimental_msg.h"
18 #include "ietf/pb_pa_msg.h"
19 #include "ietf/pb_error_msg.h"
20 #include "ietf/pb_language_preference_msg.h"
21 #include "ietf/pb_assessment_result_msg.h"
22 #include "ietf/pb_access_recommendation_msg.h"
23 #include "ietf/pb_remediation_parameters_msg.h"
24 #include "ietf/pb_reason_string_msg.h"
25 #include "tcg/pb_pdp_referral_msg.h"
29 ENUM(pb_tnc_msg_type_names
, PB_MSG_EXPERIMENTAL
, PB_MSG_REASON_STRING
,
32 "PB-Assessment-Result",
33 "PB-Access-Recommendation",
34 "PB-Remediation-Parameters",
36 "PB-Language-Preference",
40 ENUM(pb_tnc_tcg_msg_type_names
, PB_TCG_MSG_PDP_REFERRAL
, PB_TCG_MSG_PDP_REFERRAL
,
44 pb_tnc_msg_info_t pb_tnc_msg_infos
[] = {
45 { 12, FALSE
, FALSE
, TRUE_OR_FALSE
},
46 { 24, FALSE
, FALSE
, TRUE
},
47 { 16, TRUE
, TRUE
, TRUE
},
48 { 16, TRUE
, TRUE
, FALSE
},
49 { 20, FALSE
, TRUE
, FALSE
},
50 { 20, FALSE
, FALSE
, TRUE
},
51 { 12, FALSE
, FALSE
, FALSE
},
52 { 17, FALSE
, TRUE
, FALSE
},
55 pb_tnc_msg_info_t pb_tnc_tcg_msg_infos
[] = {
56 { 20, FALSE
, TRUE
, FALSE
},
62 pb_tnc_msg_t
* pb_tnc_msg_create_from_data(pen_type_t msg_type
, chunk_t value
)
64 if (msg_type
.vendor_id
== PEN_IETF
)
66 switch (msg_type
.type
)
69 return pb_pa_msg_create_from_data(value
);
71 return pb_error_msg_create_from_data(value
);
72 case PB_MSG_EXPERIMENTAL
:
73 return pb_experimental_msg_create_from_data(value
);
74 case PB_MSG_LANGUAGE_PREFERENCE
:
75 return pb_language_preference_msg_create_from_data(value
);
76 case PB_MSG_ASSESSMENT_RESULT
:
77 return pb_assessment_result_msg_create_from_data(value
);
78 case PB_MSG_ACCESS_RECOMMENDATION
:
79 return pb_access_recommendation_msg_create_from_data(value
);
80 case PB_MSG_REMEDIATION_PARAMETERS
:
81 return pb_remediation_parameters_msg_create_from_data(value
);
82 case PB_MSG_REASON_STRING
:
83 return pb_reason_string_msg_create_from_data(value
);
86 else if (msg_type
.vendor_id
== PEN_TCG
)
88 if (msg_type
.type
== PB_TCG_MSG_PDP_REFERRAL
)
90 return pb_pdp_referral_msg_create_from_data(value
);