Implemented IF-M segmentation
[strongswan.git] / src / libimcv / pa_tnc / pa_tnc_attr_manager.h
1 /*
2 * Copyright (C) 2011-2014 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 pa_tnc_attr_manager pa_tnc_attr_manager
18 * @{ @ingroup pa_tnc
19 */
20
21 #ifndef PA_TNC_ATTR_MANAGER_H_
22 #define PA_TNC_ATTR_MANAGER_H_
23
24 typedef struct pa_tnc_attr_manager_t pa_tnc_attr_manager_t;
25
26 #include "pa_tnc_attr.h"
27
28 #include <library.h>
29 #include <bio/bio_reader.h>
30
31 typedef pa_tnc_attr_t* (*pa_tnc_attr_create_t)(u_int32_t type, chunk_t value);
32
33 /**
34 * Manages PA-TNC attributes for arbitrary PENs
35 */
36 struct pa_tnc_attr_manager_t {
37
38 /**
39 * Add vendor-specific attribute names and creation method
40 *
41 * @param vendor_id Private Enterprise Number (PEN)
42 * @param attr_create Vendor-specific attribute create method
43 * @param attr_names Vendor-specific attribute names
44 */
45 void (*add_vendor)(pa_tnc_attr_manager_t *this, pen_t vendor_id,
46 pa_tnc_attr_create_t attr_create,
47 enum_name_t *attr_names);
48
49 /**
50 * Remove vendor-specific attribute names and creation method
51 *
52 * @param vendor_id Private Enterprise Number (PEN)
53 */
54 void (*remove_vendor)(pa_tnc_attr_manager_t *this, pen_t vendor_id);
55
56 /*
57 * Return the PA-TNC attribute names for a given vendor ID
58 *
59 * @param vendor_id Private Enterprise Number (PEN)
60 * @return PA-TNC attribute names if found, NULL else
61 */
62 enum_name_t* (*get_names)(pa_tnc_attr_manager_t *this, pen_t vendor_id);
63
64 /**
65 * Create and pre-parse a PA-TNC attribute object from data
66 *
67 * @param reader PA-TNC attribute as encoded data
68 * @param offset Offset in bytes where an error has been found
69 * @param msg_info Message info added to an error attribute
70 * @param error Error attribute if an error occurred
71 * @return PA-TNC attribute object if supported, NULL else
72 */
73 pa_tnc_attr_t* (*create)(pa_tnc_attr_manager_t *this, bio_reader_t *reader,
74 uint32_t *offset, chunk_t msg_info,
75 pa_tnc_attr_t **error);
76
77 /**
78 * Destroys a pa_tnc_attr_manager_t object.
79 */
80 void (*destroy)(pa_tnc_attr_manager_t *this);
81 };
82
83 /**
84 * Create a PA-TNC attribute manager
85 */
86 pa_tnc_attr_manager_t* pa_tnc_attr_manager_create(void);
87
88 #endif /** PA_TNC_ATTR_MANAGER_H_ @}*/