2 * Copyright (C) 2010 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup tnccs_manager tnccs_manager
21 #ifndef TNCCS_MANAGER_H_
22 #define TNCCS_MANAGER_H_
26 typedef struct tnccs_manager_t tnccs_manager_t
;
29 * The TNCCS manager manages all TNCCS implementations and creates instances.
31 * A plugin registers its implemented TNCCS protocol with the manager by
32 * providing type and a constructor function. The manager then creates
33 * TNCCS protocol instances via the provided constructor.
35 struct tnccs_manager_t
{
38 * Register a TNCCS protocol implementation.
40 * @param type TNCCS protocol type
41 * @param constructor constructor, returns a TNCCS protocol implementation
43 void (*add_method
)(tnccs_manager_t
*this, tnccs_type_t type
,
44 tnccs_constructor_t constructor
);
47 * Unregister a TNCCS protocol implementation using it's constructor.
49 * @param constructor constructor function to remove, as added in add_method
51 void (*remove_method
)(tnccs_manager_t
*this, tnccs_constructor_t constructor
);
54 * Create a new TNCCS protocol instance.
56 * @param type type of the TNCCS protocol
57 * @param is_server TRUE if TNC Server, FALSE if TNC Client
58 * @return TNCCS protocol instance, NULL if no constructor found
60 tnccs_t
* (*create_instance
)(tnccs_manager_t
*this, tnccs_type_t type
,
64 * Create a TNCCS connection and assign a unique connection ID
66 * @param tnccs TNCCS connection instance
67 * @param send_message callback function adding a message to a TNCCS batch
68 * @return assigned connection ID
70 TNC_ConnectionID (*create_connection
)(tnccs_manager_t
*this, tnccs_t
*tnccs
,
71 tnccs_send_message_t send_message
);
74 * Remove a TNCCS connection using its connection ID.
76 * @param id connection ID of the connection to be removed
78 void (*remove_connection
)(tnccs_manager_t
*this, TNC_ConnectionID id
);
81 * Add an IMC/IMV message to the batch of a given connection ID.
83 * @param id target connection ID
84 * @param message message to be added
85 * @param message_len message length
86 * @param message_type message type
89 TNC_Result (*send_message
)(tnccs_manager_t
*this,
91 TNC_BufferReference message
,
92 TNC_UInt32 message_len
,
93 TNC_MessageType message_type
);
96 * Destroy a tnccs_manager instance.
98 void (*destroy
)(tnccs_manager_t
*this);
102 * Create a tnccs_manager instance.
104 tnccs_manager_t
*tnccs_manager_create();
106 #endif /** TNCCS_MANAGER_H_ @}*/