aboutsummaryrefslogtreecommitdiffstats
path: root/src/libimcv/pa_tnc/pa_tnc_msg.h
blob: 64d434ca812c13846ef90bd537e6ecc603d56e65 (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
103
104
/*
 * Copyright (C) 2011-2012 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 pa_tnc_msg pa_tnc_msg
 * @{ @ingroup libimcv
 */

#ifndef PA_TNC_MSG_H_
#define PA_TNC_MSG_H_

typedef struct pa_tnc_msg_t pa_tnc_msg_t;

#define PA_TNC_VERSION		0x01

#include "pa_tnc_attr.h"

#include <library.h>

/**
 * Interface for the RFC 5792 PA-TNC Posture Attribute protocol.
 *
 */
struct pa_tnc_msg_t {

	/**
	 * Get the encoding of the PA-TNC message
	 *
	 * @return					encoded PA-TNC message
	 */
	chunk_t (*get_encoding)(pa_tnc_msg_t *this);

	/**
	 * Add a PA-TNC attribute
	 *
	 * @param attr				PA-TNC attribute to be addedd
	 * @return					TRUE if attribute fit into message and was added
	 */
	bool (*add_attribute)(pa_tnc_msg_t *this, pa_tnc_attr_t* attr);

	/**
	 * Build the PA-TNC message
	 */
	void (*build)(pa_tnc_msg_t *this);

	/**
	 * Process the PA-TNC message
	 *
	 * @return					return processing status
	 */
	status_t (*process)(pa_tnc_msg_t *this);

	/**
	 * Process and remove all IETF standard error PA-TNC attributes
	 *
	 * @return					TRUE if at least one error attribute processed
	 */
	bool (*process_ietf_std_errors)(pa_tnc_msg_t *this);

	/**
	 * Enumerates over all PA-TNC attributes
	 *
	 * @return				return attribute enumerator
	 */
	enumerator_t* (*create_attribute_enumerator)(pa_tnc_msg_t *this);

	/**
	 * Enumerates over all parsing errors
	 *
	 * @return				return error enumerator
	 */
	enumerator_t* (*create_error_enumerator)(pa_tnc_msg_t *this);

	/**
	 * Destroys a pa_tnc_msg_t object.
	 */
	void (*destroy)(pa_tnc_msg_t *this);
};

/**
 * Create an empty PA-TNC message
 */
pa_tnc_msg_t* pa_tnc_msg_create(size_t max_msg_len);

/**
 * Create an unprocessed PA-TNC message from received data
 *
 * @param data					PA-TNC message data
 */
pa_tnc_msg_t* pa_tnc_msg_create_from_data(chunk_t data);

#endif /** PA_TNC_MSG_H_ @}*/