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