c4c637d8f64f8e5f25df3312101e92c69a756711
[strongswan.git] / src / libcharon / plugins / tnccs_11 / messages / tnccs_msg.h
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 /**
17 * @defgroup tnccs_msg tnccs_msg
18 * @{ @ingroup tnccs_11
19 */
20
21 #ifndef TNCCS_MSG_H_
22 #define TNCCS_MSG_H_
23
24 typedef enum tnccs_msg_type_t tnccs_msg_type_t;
25 typedef struct tnccs_msg_t tnccs_msg_t;
26
27 #include <library.h>
28 #include <libxml/parser.h>
29
30 /**
31 * TNCC-TNCS messages as defined in section 2.8.5 of TCG TNC IF-TNCCS v1.2
32 */
33 enum tnccs_msg_type_t {
34 IMC_IMV_MSG = 0,
35 TNCCS_MSG_RECOMMENDATION = 1,
36 TNCCS_MSG_ERROR = 2,
37 TNCCS_MSG_PREFERRED_LANGUAGE = 3,
38 TNCCS_MSG_REASON_STRINGS = 4,
39 TNCCS_MSG_TNCS_CONTACT_INFO = 5,
40 TNCCS_MSG_ROOF = 5
41 };
42
43 /**
44 * enum name for tnccs_msg_type_t.
45 */
46 extern enum_name_t *tnccs_msg_type_names;
47
48 /**
49 * Generic interface for all TNCCS message types.
50 *
51 * To handle all messages in a generic way, this interface
52 * must be implemented by each message type.
53 */
54 struct tnccs_msg_t {
55
56 /**
57 * Get the TNCCS Message Type
58 *
59 * @return TNCCS Message Type
60 */
61 tnccs_msg_type_t (*get_type)(tnccs_msg_t *this);
62
63 /**
64 * Get the XML-encoded Message Node
65 *
66 * @return Message Node
67 */
68 xmlNodePtr (*get_node)(tnccs_msg_t *this);
69
70 /**
71 * Process the TNCCS Message
72 *
73 * @return return processing status
74 */
75 status_t (*process)(tnccs_msg_t *this);
76
77 /**
78 * Destroys a tnccs_msg_t object.
79 */
80 void (*destroy)(tnccs_msg_t *this);
81 };
82
83 /**
84 * Create an unprocessed TNCCS message
85 *
86 * Useful for the parser which wants a generic constructor for all
87 * tnccs_msg_t types.
88 *
89 * @param node TNCCS message node
90 */
91 tnccs_msg_t* tnccs_msg_create_from_node(xmlNodePtr node);
92
93 #endif /** TNCCS_MSG_H_ @}*/