2 * Copyright (C) 2006 Mike McCauley
3 * Copyright (C) 2010 Andreas Steffen, 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
16 #include <imc/imc_manager.h>
21 #define TNC_IMVID_ANY 0xffff
24 * Called by the IMC to inform a TNCC about the set of message types the IMC
27 TNC_Result
TNC_TNCC_ReportMessageTypes(TNC_IMCID imc_id
,
28 TNC_MessageTypeList supported_types
,
29 TNC_UInt32 type_count
)
31 imc_manager_t
*imcs
= lib
->get(lib
, "imc-manager");
33 if (!imcs
->is_registered(imcs
, imc_id
))
35 DBG1(DBG_TNC
, "ignoring ReportMessageTypes() from unregistered IMC %u",
37 return TNC_RESULT_INVALID_PARAMETER
;
39 return imcs
->set_message_types(imcs
, imc_id
, supported_types
, type_count
);
43 * Called by the IMC to ask a TNCC to retry an Integrity Check Handshake
45 TNC_Result
TNC_TNCC_RequestHandshakeRetry(TNC_IMCID imc_id
,
46 TNC_ConnectionID connection_id
,
47 TNC_RetryReason reason
)
49 imc_manager_t
*imcs
= lib
->get(lib
, "imc-manager");
51 if (!imcs
->is_registered(imcs
, imc_id
))
53 DBG1(DBG_TNC
, "ignoring RequestHandshakeRetry() from unregistered IMC %u",
55 return TNC_RESULT_INVALID_PARAMETER
;
57 return charon
->tnccs
->request_handshake_retry(charon
->tnccs
, TRUE
, imc_id
,
58 connection_id
, reason
);
62 * Called by the IMC when an IMC-IMV message is to be sent
64 TNC_Result
TNC_TNCC_SendMessage(TNC_IMCID imc_id
,
65 TNC_ConnectionID connection_id
,
66 TNC_BufferReference msg
,
68 TNC_MessageType msg_type
)
70 imc_manager_t
*imcs
= lib
->get(lib
, "imc-manager");
72 if (!imcs
->is_registered(imcs
, imc_id
))
74 DBG1(DBG_TNC
, "ignoring SendMessage() from unregistered IMC %u",
76 return TNC_RESULT_INVALID_PARAMETER
;
78 return charon
->tnccs
->send_message(charon
->tnccs
, imc_id
, TNC_IMVID_ANY
,
79 connection_id
, msg
, msg_len
, msg_type
);
83 * Called by the IMC when it needs a function pointer
85 TNC_Result
TNC_TNCC_BindFunction(TNC_IMCID id
,
87 void **function_pointer
)
89 if (streq(function_name
, "TNC_TNCC_ReportMessageTypes"))
91 *function_pointer
= (void*)TNC_TNCC_ReportMessageTypes
;
93 else if (streq(function_name
, "TNC_TNCC_RequestHandshakeRetry"))
95 *function_pointer
= (void*)TNC_TNCC_RequestHandshakeRetry
;
97 else if (streq(function_name
, "TNC_TNCC_SendMessage"))
99 *function_pointer
= (void*)TNC_TNCC_SendMessage
;
103 return TNC_RESULT_INVALID_PARAMETER
;
105 return TNC_RESULT_SUCCESS
;