40c3d0a22d561d348837a21d37cbcba951487f03
[strongswan.git] / src / libcharon / tnc / tnccs / tnccs_manager.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 tnccs_manager tnccs_manager
18 * @{ @ingroup tnccs
19 */
20
21 #ifndef TNCCS_MANAGER_H_
22 #define TNCCS_MANAGER_H_
23
24 #include "tnccs.h"
25 #include "tncif.h"
26
27 typedef struct tnccs_manager_t tnccs_manager_t;
28
29 /**
30 * The TNCCS manager manages all TNCCS implementations and creates instances.
31 *
32 * A plugin registers its implemented TNCCS protocol with the manager by
33 * providing type and a constructor function. The manager then creates
34 * TNCCS protocol instances via the provided constructor.
35 */
36 struct tnccs_manager_t {
37
38 /**
39 * Register a TNCCS protocol implementation.
40 *
41 * @param type TNCCS protocol type
42 * @param constructor constructor, returns a TNCCS protocol implementation
43 */
44 void (*add_method)(tnccs_manager_t *this, tnccs_type_t type,
45 tnccs_constructor_t constructor);
46
47 /**
48 * Unregister a TNCCS protocol implementation using it's constructor.
49 *
50 * @param constructor constructor function to remove, as added in add_method
51 */
52 void (*remove_method)(tnccs_manager_t *this, tnccs_constructor_t constructor);
53
54 /**
55 * Create a new TNCCS protocol instance.
56 *
57 * @param type type of the TNCCS protocol
58 * @param is_server TRUE if TNC Server, FALSE if TNC Client
59 * @return TNCCS protocol instance, NULL if no constructor found
60 */
61 tnccs_t* (*create_instance)(tnccs_manager_t *this, tnccs_type_t type,
62 bool is_server);
63
64 /**
65 * Create a TNCCS connection and assign a unique connection ID
66 *
67 * @param tnccs TNCCS connection instance
68 * @result assigned connection ID
69 */
70 TNC_ConnectionID (*create_connection)(tnccs_manager_t *this, tnccs_t *tnccs);
71
72 /**
73 * Remove a TNCCS connection using its connection ID.
74 *
75 * @param id connection ID of the connection to be removed
76 */
77 void (*remove_connection)(tnccs_manager_t *this, TNC_ConnectionID id);
78
79 /**
80 * Destroy a tnccs_manager instance.
81 */
82 void (*destroy)(tnccs_manager_t *this);
83 };
84
85 /**
86 * Create a tnccs_manager instance.
87 */
88 tnccs_manager_t *tnccs_manager_create();
89
90 #endif /** TNCCS_MANAGER_H_ @}*/