X-Git-Url: http://www.project-moonshot.org/gitweb/?p=mech_eap.git;a=blobdiff_plain;f=libeap%2Ftests%2Fhwsim%2Ftnc%2Fhostap_imv.c;fp=libeap%2Ftests%2Fhwsim%2Ftnc%2Fhostap_imv.c;h=0f4f9c8994c5c5d1afcfcc52ee846bed7b9415a7;hp=0000000000000000000000000000000000000000;hb=f3746d009c6d7f50025af1f58a85e5fee9680be6;hpb=244f18d04aaf29e68495b5ffeb40ef5cca50942f diff --git a/libeap/tests/hwsim/tnc/hostap_imv.c b/libeap/tests/hwsim/tnc/hostap_imv.c new file mode 100644 index 0000000..0f4f9c8 --- /dev/null +++ b/libeap/tests/hwsim/tnc/hostap_imv.c @@ -0,0 +1,66 @@ +/* + * Minimal example IMV for TNC testing + * Copyright (c) 2014, Jouni Malinen + * + * This software may be distributed under the terms of the BSD license. + * See README for more details. + */ + +#include "includes.h" + +#include "common.h" +#include "common/tnc.h" + +static int initialized = 0; +static TNC_IMVID my_id = -1; + +TNC_Result TNC_IMV_Initialize( + /*in*/ TNC_IMVID imvID, + /*in*/ TNC_Version minVersion, + /*in*/ TNC_Version maxVersion, + /*out*/ TNC_Version *pOutActualVersion) +{ + if (initialized) + return TNC_RESULT_ALREADY_INITIALIZED; + + if (minVersion < TNC_IFIMV_VERSION_1 || + maxVersion > TNC_IFIMV_VERSION_1) + return TNC_RESULT_NO_COMMON_VERSION; + + if (!pOutActualVersion) + return TNC_RESULT_INVALID_PARAMETER; + *pOutActualVersion = TNC_IFIMV_VERSION_1; + + initialized = 1; + my_id = imvID; + + return TNC_RESULT_SUCCESS; +} + + +TNC_Result TNC_IMV_SolicitRecommendation( + /*in*/ TNC_IMVID imvID, + /*in*/ TNC_ConnectionID connectionID) +{ + if (!initialized) + return TNC_RESULT_NOT_INITIALIZED; + + if (imvID != my_id) + return TNC_RESULT_INVALID_PARAMETER; + + return TNC_RESULT_SUCCESS; +} + + +TNC_Result TNC_IMV_ProvideBindFunction( + /*in*/ TNC_IMVID imvID, + /*in*/ TNC_TNCS_BindFunctionPointer bindFunction) +{ + if (!initialized) + return TNC_RESULT_NOT_INITIALIZED; + + if (imvID != my_id) + return TNC_RESULT_INVALID_PARAMETER; + + return TNC_RESULT_SUCCESS; +}