blob: 88d6f07aada6032ddfd3fa7d34da4617864bf0da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*
* Copyright (C) 2010 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup tnccs_msg tnccs_msg
* @{ @ingroup tnccs_11
*/
#ifndef TNCCS_MSG_H_
#define TNCCS_MSG_H_
typedef enum tnccs_msg_type_t tnccs_msg_type_t;
typedef struct tnccs_msg_t tnccs_msg_t;
#include <library.h>
#include <collections/linked_list.h>
#include <libxml/parser.h>
/**
* TNCC-TNCS messages as defined in section 2.8.5 of TCG TNC IF-TNCCS v1.2
*/
enum tnccs_msg_type_t {
IMC_IMV_MSG = 0,
TNCCS_MSG_RECOMMENDATION = 1,
TNCCS_MSG_ERROR = 2,
TNCCS_MSG_PREFERRED_LANGUAGE = 3,
TNCCS_MSG_REASON_STRINGS = 4,
TNCCS_MSG_TNCS_CONTACT_INFO = 5,
TNCCS_MSG_ROOF = 5
};
/**
* enum name for tnccs_msg_type_t.
*/
extern enum_name_t *tnccs_msg_type_names;
/**
* Generic interface for all TNCCS message types.
*
* To handle all messages in a generic way, this interface
* must be implemented by each message type.
*/
struct tnccs_msg_t {
/**
* Get the TNCCS Message Type
*
* @return TNCCS Message Type
*/
tnccs_msg_type_t (*get_type)(tnccs_msg_t *this);
/**
* Get the XML-encoded Message Node
*
* @return Message Node
*/
xmlNodePtr (*get_node)(tnccs_msg_t *this);
/**
* Process the TNCCS Message
*
* @return return processing status
*/
status_t (*process)(tnccs_msg_t *this);
/**
* Get a new reference to the message.
*
* @return this, with an increased refcount
*/
tnccs_msg_t* (*get_ref)(tnccs_msg_t *this);
/**
* Destroys a tnccs_msg_t object.
*/
void (*destroy)(tnccs_msg_t *this);
};
/**
* Create a pre-processed TNCCS message
*
* Useful for the parser which wants a generic constructor for all
* tnccs_msg_t types.
*
* @param node TNCCS message node
* @param errors linked list of TNCCS error messages
*/
tnccs_msg_t* tnccs_msg_create_from_node(xmlNodePtr node, linked_list_t *errors);
#endif /** TNCCS_MSG_H_ @}*/
|