defined a pb_tnc_message_t interface
[strongswan.git] / src / libcharon / plugins / tnccs_20 / messages / pb_pa_message.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 pb_pa_message pb_pa_message
18 * @{ @ingroup tnccs_20
19 */
20
21 #ifndef PB_PA_MESSAGE_H_
22 #define PB_PA_MESSAGE_H_
23
24 #include "pb_tnc_message.h"
25
26 typedef struct pb_pa_message_t pb_pa_message_t;
27
28 /**
29 * Classs representing the PB-PA message type.
30 */
31 struct pb_pa_message_t {
32
33 /**
34 * PB-TNC Message interface
35 */
36 pb_tnc_message_t pb_interface;
37
38 /**
39 * Get PA Message Vendor ID and Subtype
40 *
41 * @param subtype PA Subtype
42 * @return PA Message Vendor ID
43 */
44 u_int32_t (*get_vendor_id)(pb_pa_message_t *this, u_int32_t *subtype);
45
46 /**
47 * Get Posture Collector ID
48 *
49 * @return Posture Collector ID
50 */
51 u_int16_t (*get_collector_id)(pb_pa_message_t *this);
52
53 /**
54 * Get Posture Validator ID
55 *
56 * @return Posture Validator ID
57 */
58 u_int16_t (*get_validator_id)(pb_pa_message_t *this);
59
60 /**
61 * Get the PA Message Body
62 *
63 * @return PA Message Body
64 */
65 chunk_t (*get_body)(pb_pa_message_t *this);
66
67 /**
68 * Get the exclusive flag
69 *
70 * @return exclusive flag
71 */
72 bool (*get_exclusive_flag)(pb_pa_message_t *this);
73
74 /**
75 * Set the exclusive flag
76 *
77 * @param excl vexclusive flag
78 */
79 void (*set_exclusive_flag)(pb_pa_message_t *this, bool excl);
80 };
81
82 /**
83 * Create a PB-PA message from parameters
84 *
85 * @param vendor_id PA Message Vendor ID
86 * @param subtype PA Subtype
87 * @param collector_id Posture Collector ID
88 * @param validator_id Posture Validator ID
89 * @param msg_body PA Message Body
90 */
91 pb_tnc_message_t *pb_pa_message_create(u_int32_t vendor_id, u_int32_t subtype,
92 u_int16_t collector_id,
93 u_int16_t validator_id,
94 chunk_t msg_body);
95
96 /**
97 * Create an unprocessed PB-PA message from raw data
98 *
99 * @param data PB-PA message data
100 */
101 pb_tnc_message_t* pb_pa_message_create_from_data(chunk_t data);
102
103 #endif /** PB_PA_MESSAGE_H_ @}*/