1/* 2 * Copyright (c) 2001-2014 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24/* 25 * Modification History 26 * 27 * November 1, 2001 Dieter Siegmund (dieter@apple.com) 28 * - created 29 */ 30 31#ifndef _EAP8021X_EAPCLIENTMODULE_H 32#define _EAP8021X_EAPCLIENTMODULE_H 33 34#include <stdint.h> 35 36#include <EAP8021X/EAP.h> 37#include <EAP8021X/EAPClientPlugin.h> 38 39typedef struct EAPClientModule_s EAPClientModule, *EAPClientModuleRef; 40 41enum { 42 kEAPClientModuleStatusOK = 0, 43 kEAPClientModuleStatusInvalidType = 1, 44 kEAPClientModuleStatusTypeAlreadyLoaded = 2, 45 kEAPClientModuleStatusAllocationFailed = 3, 46 kEAPClientModuleStatusPluginInvalidVersion = 4, 47 kEAPClientModuleStatusPluginIncomplete = 5, 48}; 49typedef uint32_t EAPClientModuleStatus; 50 51EAPClientModuleRef 52EAPClientModuleLookup(EAPType type); 53 54EAPType 55EAPClientModuleDefaultType(void); 56 57EAPClientModuleStatus 58EAPClientModuleAddBuiltinModule(EAPClientPluginFuncIntrospect * func); 59 60/* 61 * Function: EAPClientModulePluginIntrospect 62 * Returns: 63 * Given a function name, returns the corresponding function pointer 64 * by calling the plugin's "introspect" function, if supplied. 65 * The caller needs to know the prototype for the function i.e. 66 * what arguments to pass, and the return value. 67 * A module may or may not supply its introspect function for this 68 * purpose. 69 */ 70EAPClientPluginFuncRef 71EAPClientModulePluginIntrospect(EAPClientModuleRef module, 72 EAPClientPluginFuncName); 73 74 75EAPType 76EAPClientModulePluginEAPType(EAPClientModuleRef module); 77 78const char * 79EAPClientModulePluginEAPName(EAPClientModuleRef module); 80 81/* 82 * EAPClientModulePlugin* 83 * Functions to call the individual plug-in, given an EAPClientModule. 84 * Note: 85 * These check for a NULL function pointer before calling the 86 * corresponding function. 87 */ 88 89EAPClientStatus 90EAPClientModulePluginInit(EAPClientModuleRef module, 91 EAPClientPluginDataRef plugin, 92 CFArrayRef * required_props, 93 int * error); 94 95void 96EAPClientModulePluginFree(EAPClientModuleRef module, 97 EAPClientPluginDataRef plugin); 98 99void 100EAPClientModulePluginFreePacket(EAPClientModuleRef module, 101 EAPClientPluginDataRef plugin, 102 EAPPacketRef pkt_p); 103EAPClientState 104EAPClientModulePluginProcess(EAPClientModuleRef module, 105 EAPClientPluginDataRef plugin, 106 const EAPPacketRef in_pkt, 107 EAPPacketRef * out_pkt_p, 108 EAPClientStatus * status, 109 EAPClientDomainSpecificError * error); 110 111const char * 112EAPClientModulePluginFailureString(EAPClientModuleRef module, 113 EAPClientPluginDataRef plugin); 114 115void * 116EAPClientModulePluginSessionKey(EAPClientModuleRef module, 117 EAPClientPluginDataRef plugin, 118 int * key_length); 119 120void * 121EAPClientModulePluginServerKey(EAPClientModuleRef module, 122 EAPClientPluginDataRef plugin, 123 int * key_length); 124 125int 126EAPClientModulePluginMasterSessionKeyCopyBytes(EAPClientModuleRef module, 127 EAPClientPluginDataRef plugin, 128 uint8_t * msk, int msk_size); 129 130CFArrayRef 131EAPClientModulePluginRequireProperties(EAPClientModuleRef module, 132 EAPClientPluginDataRef plugin); 133 134CFDictionaryRef 135EAPClientModulePluginPublishProperties(EAPClientModuleRef module, 136 EAPClientPluginDataRef plugin); 137 138bool 139EAPClientModulePluginPacketDump(EAPClientModuleRef module, 140 FILE * out_f, const EAPPacketRef packet); 141 142CFStringRef 143EAPClientModulePluginUserName(EAPClientModuleRef module, 144 CFDictionaryRef properties); 145 146CFStringRef 147EAPClientModulePluginCopyIdentity(EAPClientModuleRef module, 148 EAPClientPluginDataRef plugin); 149 150CFStringRef 151EAPClientModulePluginCopyPacketDescription(EAPClientModuleRef module, 152 const EAPPacketRef packet, 153 bool * is_valid); 154 155#endif /* _EAP8021X_EAPCLIENTMODULE_H */ 156