61055ec744d2d651e3d84a899805a7be08038a43
[strongswan.git] / src / libimcv / pts / components / pts_component_manager.h
1 /*
2 * Copyright (C) 2011 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 pts_component_manager pts_component_manager
18 * @{ @ingroup pts
19 */
20
21 #ifndef PTS_COMPONENT_MANAGER_H_
22 #define PTS_COMPONENT_MANAGER_H_
23
24 typedef struct pts_component_manager_t pts_component_manager_t;
25
26 #include "pts/pts_database.h"
27 #include "pts/components/pts_component.h"
28 #include "pts/components/pts_comp_func_name.h"
29
30 #include <library.h>
31 #include <pen/pen.h>
32
33 typedef pts_component_t* (*pts_component_create_t)(u_int32_t depth,
34 pts_database_t *pts_db);
35
36 /**
37 * Manages PTS Functional Components
38 */
39 struct pts_component_manager_t {
40
41 /**
42 * Add vendor-specific functional component names
43 *
44 * @param vendor_id Private Enterprise Number (PEN)
45 * @param comp_func_names Vendor-specific Component Functional names
46 * @param qualifier_type_size Vendor-specific Qualifier Type size
47 * @param qualifier_flag_names Vendor-specific Qualifier Flag names
48 * @param qualifier_type_names Vendor-specific Qualifier Type names
49 */
50 void (*add_vendor)(pts_component_manager_t *this, pen_t vendor_id,
51 enum_name_t *comp_func_names,
52 int qualifier_type_size,
53 char *qualifier_flag_names,
54 enum_name_t *qualifier_type_names);
55
56 /**
57 * Add vendor-specific functional component
58 *
59 * @param vendor_id Private Enterprise Number (PEN)
60 * @param names Component Functional Name
61 * @param create Functional Component creation method
62 */
63 void (*add_component)(pts_component_manager_t *this, pen_t vendor_id,
64 u_int32_t name, pts_component_create_t create);
65
66 /**
67 * Remove vendor-specific components and associated namespace
68 *
69 * @param vendor_id Private Enterprise Number (PEN)
70 */
71 void (*remove_vendor)(pts_component_manager_t *this, pen_t vendor_id);
72
73 /**
74 * Return the Functional Component names for a given vendor ID
75 *
76 * @param vendor_id Private Enterprise Number (PEN)
77 * @return Comp. Func. names if found, NULL else
78 */
79 enum_name_t* (*get_comp_func_names)(pts_component_manager_t *this,
80 pen_t vendor_id);
81
82 /**
83 * Return the Functional Component Qualifier Type names for a given vendor ID
84 *
85 * @param vendor_id Private Enterprise Number (PEN)
86 * @return Qualifier Type names if found, NULL else
87 */
88 enum_name_t* (*get_qualifier_type_names)(pts_component_manager_t *this,
89 pen_t vendor_id);
90
91 /**
92 * Return the Qualifier Type and Flags
93 *
94 * @param name Component Functional Name
95 * @param flags Qualifier Flags as a string in a char buffer
96 * @return Qualifier Type
97 */
98 u_int8_t (*get_qualifier)(pts_component_manager_t *this,
99 pts_comp_func_name_t *name, char *flags);
100
101 /**
102 * Create a PTS Component object from a Functional Component Name object
103 *
104 * @param name Component Functional Name
105 * @param depth Sub-component Depth
106 * @param pts_db PTS measurement database
107 * @return Component object if supported, NULL else
108 */
109 pts_component_t* (*create)(pts_component_manager_t *this,
110 pts_comp_func_name_t *name, u_int32_t depth,
111 pts_database_t *pts_db);
112
113 /**
114 * Destroys a pts_component_manager_t object.
115 */
116 void (*destroy)(pts_component_manager_t *this);
117 };
118
119 /**
120 * Create a PA-TNC attribute manager
121 */
122 pts_component_manager_t* pts_component_manager_create(void);
123
124 #endif /** PTS_COMPONENT_MANAGER_H_ @}*/