de0e118ad13c3179d18490e236d04d4013e8fcd6
[strongswan.git] / src / libcharon / plugins / tnccs_20 / messages / pb_tnc_message.c
1 /*
2 * Copyright (C) 2010 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
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>.
9 *
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
13 * for more details.
14 */
15
16 #include "pb_tnc_message.h"
17 #include "pb_pa_message.h"
18 #include "pb_error_message.h"
19 #include "pb_language_preference_message.h"
20 #include "pb_assessment_result_message.h"
21 #include "pb_access_recommendation_message.h"
22 #include "pb_reason_string_message.h"
23
24 #include <library.h>
25
26 /**
27 * See header
28 */
29 pb_tnc_message_t* pb_tnc_message_create(pb_tnc_msg_type_t type, chunk_t value)
30 {
31 switch (type)
32 {
33 case PB_MSG_PA:
34 return pb_pa_message_create_from_data(value);
35 case PB_MSG_ERROR:
36 return pb_error_message_create_from_data(value);
37 case PB_MSG_EXPERIMENTAL:
38 return NULL;
39 case PB_MSG_LANGUAGE_PREFERENCE:
40 return pb_language_preference_message_create_from_data(value);
41 case PB_MSG_ASSESSMENT_RESULT:
42 return pb_assessment_result_message_create_from_data(value);
43 case PB_MSG_ACCESS_RECOMMENDATION:
44 return pb_access_recommendation_message_create_from_data(value);
45 case PB_MSG_REMEDIATION_PARAMETERS:
46 return NULL;
47 case PB_MSG_REASON_STRING:
48 return pb_reason_string_message_create_from_data(value);
49 }
50 return NULL;
51 }