]> git.ipfire.org Git - people/ms/strongswan.git/blob - src/libcharon/plugins/tnccs_11/messages/tnccs_msg.h
88d6f07aada6032ddfd3fa7d34da4617864bf0da
[people/ms/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 <collections/linked_list.h>
29 #include <libxml/parser.h>
30
31 /**
32 * TNCC-TNCS messages as defined in section 2.8.5 of TCG TNC IF-TNCCS v1.2
33 */
34 enum tnccs_msg_type_t {
35 IMC_IMV_MSG = 0,
36 TNCCS_MSG_RECOMMENDATION = 1,
37 TNCCS_MSG_ERROR = 2,
38 TNCCS_MSG_PREFERRED_LANGUAGE = 3,
39 TNCCS_MSG_REASON_STRINGS = 4,
40 TNCCS_MSG_TNCS_CONTACT_INFO = 5,
41 TNCCS_MSG_ROOF = 5
42 };
43
44 /**
45 * enum name for tnccs_msg_type_t.
46 */
47 extern enum_name_t *tnccs_msg_type_names;
48
49 /**
50 * Generic interface for all TNCCS message types.
51 *
52 * To handle all messages in a generic way, this interface
53 * must be implemented by each message type.
54 */
55 struct tnccs_msg_t {
56
57 /**
58 * Get the TNCCS Message Type
59 *
60 * @return TNCCS Message Type
61 */
62 tnccs_msg_type_t (*get_type)(tnccs_msg_t *this);
63
64 /**
65 * Get the XML-encoded Message Node
66 *
67 * @return Message Node
68 */
69 xmlNodePtr (*get_node)(tnccs_msg_t *this);
70
71 /**
72 * Process the TNCCS Message
73 *
74 * @return return processing status
75 */
76 status_t (*process)(tnccs_msg_t *this);
77
78 /**
79 * Get a new reference to the message.
80 *
81 * @return this, with an increased refcount
82 */
83 tnccs_msg_t* (*get_ref)(tnccs_msg_t *this);
84
85 /**
86 * Destroys a tnccs_msg_t object.
87 */
88 void (*destroy)(tnccs_msg_t *this);
89 };
90
91 /**
92 * Create a pre-processed TNCCS message
93 *
94 * Useful for the parser which wants a generic constructor for all
95 * tnccs_msg_t types.
96 *
97 * @param node TNCCS message node
98 * @param errors linked list of TNCCS error messages
99 */
100 tnccs_msg_t* tnccs_msg_create_from_node(xmlNodePtr node, linked_list_t *errors);
101
102 #endif /** TNCCS_MSG_H_ @}*/