1*7836SJohn.Forte@Sun.COM /* 2*7836SJohn.Forte@Sun.COM * Description 3*7836SJohn.Forte@Sun.COM * ImaLib.c - Implements a sample common IMA library 4*7836SJohn.Forte@Sun.COM * 5*7836SJohn.Forte@Sun.COM * License: 6*7836SJohn.Forte@Sun.COM * The contents of this file are subject to the SNIA Public License 7*7836SJohn.Forte@Sun.COM * Version 1.0(the "License"); you may not use this file except in 8*7836SJohn.Forte@Sun.COM * compliance with the License. You may obtain a copy of the License at 9*7836SJohn.Forte@Sun.COM * 10*7836SJohn.Forte@Sun.COM * /http://www.snia.org/English/Resources/Code/OpenSource.html 11*7836SJohn.Forte@Sun.COM * 12*7836SJohn.Forte@Sun.COM * Software distributed under the License is distributed on an "AS IS" 13*7836SJohn.Forte@Sun.COM * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 14*7836SJohn.Forte@Sun.COM * the License for the specific language governing rights and limitations 15*7836SJohn.Forte@Sun.COM * under the License. 16*7836SJohn.Forte@Sun.COM * 17*7836SJohn.Forte@Sun.COM * The Original Code is SNIA HBA API and IMA general header file 18*7836SJohn.Forte@Sun.COM * 19*7836SJohn.Forte@Sun.COM * The Initial Developer of the Original Code is: 20*7836SJohn.Forte@Sun.COM * Benjamin F. Kuo, Troika Networks, Inc. (benk@troikanetworks.com) 21*7836SJohn.Forte@Sun.COM * David Dillard VERITAS Software david.dillard@veritas.com 22*7836SJohn.Forte@Sun.COM * 23*7836SJohn.Forte@Sun.COM * Contributor(s): 24*7836SJohn.Forte@Sun.COM * Jeff Ding, Adaptec, Inc. (jding@corp.adaptec.com) 25*7836SJohn.Forte@Sun.COM * 26*7836SJohn.Forte@Sun.COM * Changes: 27*7836SJohn.Forte@Sun.COM * 09/24/2003 Initial Draft 28*7836SJohn.Forte@Sun.COM * (for other changes... see the CVS logs) 29*7836SJohn.Forte@Sun.COM * 30*7836SJohn.Forte@Sun.COM * 12/15/2003 corrected the defined parameter in IMA_SetPhbaIsnsDiscovery(). 31*7836SJohn.Forte@Sun.COM * lower case the computer name as iscsi name in IMA_GenerateNodeName(). 32*7836SJohn.Forte@Sun.COM * 33*7836SJohn.Forte@Sun.COM * 01/21/2005 Updated to support IMA 1.1.3. 34*7836SJohn.Forte@Sun.COM */ 35*7836SJohn.Forte@Sun.COM 36*7836SJohn.Forte@Sun.COM #ifdef WIN32 37*7836SJohn.Forte@Sun.COM #include <windows.h> 38*7836SJohn.Forte@Sun.COM #else 39*7836SJohn.Forte@Sun.COM #define _XOPEN_SOURCE /* glibc2 needs this */ 40*7836SJohn.Forte@Sun.COM #include <sys/sem.h> 41*7836SJohn.Forte@Sun.COM #include <dlfcn.h> 42*7836SJohn.Forte@Sun.COM #include <stdarg.h> 43*7836SJohn.Forte@Sun.COM #endif 44*7836SJohn.Forte@Sun.COM 45*7836SJohn.Forte@Sun.COM #include <string.h> 46*7836SJohn.Forte@Sun.COM #include <stdlib.h> 47*7836SJohn.Forte@Sun.COM // #include <sys/sem.h> 48*7836SJohn.Forte@Sun.COM // #include <unistd.h> 49*7836SJohn.Forte@Sun.COM #include <time.h> 50*7836SJohn.Forte@Sun.COM #include <stdio.h> 51*7836SJohn.Forte@Sun.COM #include <sys/types.h> 52*7836SJohn.Forte@Sun.COM // #include <sys/ipc.h> 53*7836SJohn.Forte@Sun.COM 54*7836SJohn.Forte@Sun.COM #include "ima.h" 55*7836SJohn.Forte@Sun.COM #include "ima-plugin.h" 56*7836SJohn.Forte@Sun.COM 57*7836SJohn.Forte@Sun.COM 58*7836SJohn.Forte@Sun.COM #define LIBRARY_PROPERTY_SUPPORTED_IMA_VERSION 1 59*7836SJohn.Forte@Sun.COM #define LIBRARY_PROPERTY_IMPLEMENTATION_VERSION L"1.0.2" 60*7836SJohn.Forte@Sun.COM #define LIBRARY_PROPERTY_VENDOR L"QLogic, Inc." 61*7836SJohn.Forte@Sun.COM #define DEFAULT_NODE_NAME_FORMAT "iqn.1986-03.com.sun.central.%s" 62*7836SJohn.Forte@Sun.COM 63*7836SJohn.Forte@Sun.COM /* Linux only */ 64*7836SJohn.Forte@Sun.COM #define LIBRARY_FILE_NAME L"libima.so" 65*7836SJohn.Forte@Sun.COM 66*7836SJohn.Forte@Sun.COM #define IMA_MAX_NUM_PLUGINS 32 67*7836SJohn.Forte@Sun.COM #define IMA_MAX_CALLBACK_PER_PLUGIN 64 68*7836SJohn.Forte@Sun.COM 69*7836SJohn.Forte@Sun.COM #define EUOS_ERROR IMA_ERROR_UNEXPECTED_OS_ERROR 70*7836SJohn.Forte@Sun.COM 71*7836SJohn.Forte@Sun.COM typedef struct ima_plugin_info { 72*7836SJohn.Forte@Sun.COM char PluginName[64]; 73*7836SJohn.Forte@Sun.COM char PluginPath[256]; 74*7836SJohn.Forte@Sun.COM #ifdef WIN32 75*7836SJohn.Forte@Sun.COM HINSTANCE hPlugin; /* Handle to a loaded DLL */ 76*7836SJohn.Forte@Sun.COM #else 77*7836SJohn.Forte@Sun.COM void* hPlugin; /* Handle to a loaded DLL */ 78*7836SJohn.Forte@Sun.COM #endif 79*7836SJohn.Forte@Sun.COM IMA_UINT32 ownerId; 80*7836SJohn.Forte@Sun.COM #ifdef WIN32 81*7836SJohn.Forte@Sun.COM HANDLE pluginMutex; 82*7836SJohn.Forte@Sun.COM #else 83*7836SJohn.Forte@Sun.COM int pluginMutex; 84*7836SJohn.Forte@Sun.COM #endif 85*7836SJohn.Forte@Sun.COM IMA_UINT number_of_vbcallbacks; 86*7836SJohn.Forte@Sun.COM IMA_OBJECT_VISIBILITY_FN vbcallback[IMA_MAX_CALLBACK_PER_PLUGIN]; 87*7836SJohn.Forte@Sun.COM IMA_UINT number_of_pccallbacks; 88*7836SJohn.Forte@Sun.COM IMA_OBJECT_PROPERTY_FN pccallback[IMA_MAX_CALLBACK_PER_PLUGIN]; 89*7836SJohn.Forte@Sun.COM } IMA_PLUGIN_INFO, *PIMA_PLUGIN_INFO; 90*7836SJohn.Forte@Sun.COM 91*7836SJohn.Forte@Sun.COM static IMA_PLUGIN_INFO plugintable[IMA_MAX_NUM_PLUGINS]; 92*7836SJohn.Forte@Sun.COM static int number_of_plugins = -1; 93*7836SJohn.Forte@Sun.COM static IMA_NODE_NAME sharedNodeName; 94*7836SJohn.Forte@Sun.COM static IMA_NODE_ALIAS sharedNodeAlias; 95*7836SJohn.Forte@Sun.COM 96*7836SJohn.Forte@Sun.COM #ifdef WIN32 97*7836SJohn.Forte@Sun.COM static HANDLE libMutex = NULL; 98*7836SJohn.Forte@Sun.COM #else 99*7836SJohn.Forte@Sun.COM static int libMutex = -1; 100*7836SJohn.Forte@Sun.COM #endif 101*7836SJohn.Forte@Sun.COM 102*7836SJohn.Forte@Sun.COM void InitLibrary(); 103*7836SJohn.Forte@Sun.COM void ExitLibrary(); 104*7836SJohn.Forte@Sun.COM 105*7836SJohn.Forte@Sun.COM static void libSwprintf(wchar_t *wcs, const wchar_t *lpszFormat, ...) { 106*7836SJohn.Forte@Sun.COM va_list args; 107*7836SJohn.Forte@Sun.COM va_start(args, lpszFormat); 108*7836SJohn.Forte@Sun.COM 109*7836SJohn.Forte@Sun.COM #ifdef WIN32 110*7836SJohn.Forte@Sun.COM vswprintf(wcs, lpszFormat, args); 111*7836SJohn.Forte@Sun.COM #else 112*7836SJohn.Forte@Sun.COM vswprintf(wcs, 255, lpszFormat, args); 113*7836SJohn.Forte@Sun.COM #endif 114*7836SJohn.Forte@Sun.COM va_end(args); 115*7836SJohn.Forte@Sun.COM } 116*7836SJohn.Forte@Sun.COM 117*7836SJohn.Forte@Sun.COM 118*7836SJohn.Forte@Sun.COM #ifdef WIN32 119*7836SJohn.Forte@Sun.COM /* Begin implementation */ 120*7836SJohn.Forte@Sun.COM BOOL APIENTRY DllMain(HANDLE hModule, 121*7836SJohn.Forte@Sun.COM DWORD ul_reason_for_call, 122*7836SJohn.Forte@Sun.COM LPVOID lpReserved) { 123*7836SJohn.Forte@Sun.COM switch (ul_reason_for_call) { 124*7836SJohn.Forte@Sun.COM 125*7836SJohn.Forte@Sun.COM case DLL_PROCESS_ATTACH: 126*7836SJohn.Forte@Sun.COM // InitLibrary(); 127*7836SJohn.Forte@Sun.COM break; 128*7836SJohn.Forte@Sun.COM case DLL_PROCESS_DETACH: 129*7836SJohn.Forte@Sun.COM ExitLibrary(); 130*7836SJohn.Forte@Sun.COM break; 131*7836SJohn.Forte@Sun.COM case DLL_THREAD_ATTACH: 132*7836SJohn.Forte@Sun.COM case DLL_THREAD_DETACH: 133*7836SJohn.Forte@Sun.COM break; 134*7836SJohn.Forte@Sun.COM } 135*7836SJohn.Forte@Sun.COM return (TRUE); 136*7836SJohn.Forte@Sun.COM } 137*7836SJohn.Forte@Sun.COM #elif defined(SOLARIS) 138*7836SJohn.Forte@Sun.COM 139*7836SJohn.Forte@Sun.COM void so_init(void); 140*7836SJohn.Forte@Sun.COM void so_fini(void); 141*7836SJohn.Forte@Sun.COM static int os_createmutex(int *semid); 142*7836SJohn.Forte@Sun.COM static void os_obtainmutex(int semid); 143*7836SJohn.Forte@Sun.COM static void os_releasemutex(int semid); 144*7836SJohn.Forte@Sun.COM static void os_destroymutex(int semid); 145*7836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisNodeProps(IMA_NODE_PROPERTIES *nodeProps); 146*7836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisSharedNodeName(IMA_NODE_NAME name); 147*7836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisSharedNodeAlias(IMA_NODE_ALIAS alias); 148*7836SJohn.Forte@Sun.COM static IMA_STATUS setSolarisSharedNodeName(const IMA_NODE_NAME name); 149*7836SJohn.Forte@Sun.COM static IMA_STATUS setSolarisSharedNodeAlias(const IMA_NODE_ALIAS alias); 150*7836SJohn.Forte@Sun.COM 151*7836SJohn.Forte@Sun.COM #pragma init(so_init) 152*7836SJohn.Forte@Sun.COM #pragma fini(so_fini) 153*7836SJohn.Forte@Sun.COM 154*7836SJohn.Forte@Sun.COM void so_init() { 155*7836SJohn.Forte@Sun.COM InitLibrary(); 156*7836SJohn.Forte@Sun.COM } 157*7836SJohn.Forte@Sun.COM void so_fini() { 158*7836SJohn.Forte@Sun.COM ExitLibrary(); 159*7836SJohn.Forte@Sun.COM } 160*7836SJohn.Forte@Sun.COM 161*7836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisNodeProps(IMA_NODE_PROPERTIES *nodeProps) { 162*7836SJohn.Forte@Sun.COM int ret; 163*7836SJohn.Forte@Sun.COM int i; 164*7836SJohn.Forte@Sun.COM IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; 165*7836SJohn.Forte@Sun.COM IMA_GetNodePropertiesFn PassFunc; 166*7836SJohn.Forte@Sun.COM IMA_OID nodeOid; 167*7836SJohn.Forte@Sun.COM 168*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 169*7836SJohn.Forte@Sun.COM InitLibrary(); 170*7836SJohn.Forte@Sun.COM 171*7836SJohn.Forte@Sun.COM /* 172*7836SJohn.Forte@Sun.COM * See if iscsiadm and ima plugin packages have been installed. 173*7836SJohn.Forte@Sun.COM */ 174*7836SJohn.Forte@Sun.COM ret = system("pkginfo SUNWima > /dev/null"); 175*7836SJohn.Forte@Sun.COM if (ret) { 176*7836SJohn.Forte@Sun.COM return (status); 177*7836SJohn.Forte@Sun.COM } 178*7836SJohn.Forte@Sun.COM 179*7836SJohn.Forte@Sun.COM ret = system("pkginfo SUNWiscsir > /dev/null"); 180*7836SJohn.Forte@Sun.COM if (ret) { 181*7836SJohn.Forte@Sun.COM return (status); 182*7836SJohn.Forte@Sun.COM } 183*7836SJohn.Forte@Sun.COM 184*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 185*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 186*7836SJohn.Forte@Sun.COM 187*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 188*7836SJohn.Forte@Sun.COM if (strstr(plugintable[i].PluginPath, 189*7836SJohn.Forte@Sun.COM "libsun_ima.so") == NULL) { 190*7836SJohn.Forte@Sun.COM continue; 191*7836SJohn.Forte@Sun.COM } 192*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 193*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 194*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 195*7836SJohn.Forte@Sun.COM PassFunc = 196*7836SJohn.Forte@Sun.COM (IMA_GetNodePropertiesFn) dlsym( 197*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 198*7836SJohn.Forte@Sun.COM "IMA_GetNodeProperties"); 199*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 200*7836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, nodeProps); 201*7836SJohn.Forte@Sun.COM } 202*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 203*7836SJohn.Forte@Sun.COM } 204*7836SJohn.Forte@Sun.COM break; 205*7836SJohn.Forte@Sun.COM } 206*7836SJohn.Forte@Sun.COM 207*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 208*7836SJohn.Forte@Sun.COM return (status); 209*7836SJohn.Forte@Sun.COM } 210*7836SJohn.Forte@Sun.COM 211*7836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisSharedNodeName(IMA_NODE_NAME name) { 212*7836SJohn.Forte@Sun.COM IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; 213*7836SJohn.Forte@Sun.COM IMA_NODE_PROPERTIES nodeProps; 214*7836SJohn.Forte@Sun.COM 215*7836SJohn.Forte@Sun.COM status = getSolarisNodeProps(&nodeProps); 216*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 217*7836SJohn.Forte@Sun.COM return (status); 218*7836SJohn.Forte@Sun.COM } 219*7836SJohn.Forte@Sun.COM bcopy(&nodeProps.name, name, sizeof (IMA_NODE_NAME)); 220*7836SJohn.Forte@Sun.COM return (status); 221*7836SJohn.Forte@Sun.COM } 222*7836SJohn.Forte@Sun.COM 223*7836SJohn.Forte@Sun.COM static IMA_STATUS getSolarisSharedNodeAlias(IMA_NODE_ALIAS alias) { 224*7836SJohn.Forte@Sun.COM IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; 225*7836SJohn.Forte@Sun.COM IMA_NODE_PROPERTIES nodeProps; 226*7836SJohn.Forte@Sun.COM 227*7836SJohn.Forte@Sun.COM status = getSolarisNodeProps(&nodeProps); 228*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 229*7836SJohn.Forte@Sun.COM return (status); 230*7836SJohn.Forte@Sun.COM } 231*7836SJohn.Forte@Sun.COM bcopy(&nodeProps.alias, alias, sizeof (IMA_NODE_ALIAS)); 232*7836SJohn.Forte@Sun.COM return (status); 233*7836SJohn.Forte@Sun.COM } 234*7836SJohn.Forte@Sun.COM 235*7836SJohn.Forte@Sun.COM static IMA_STATUS setSolarisSharedNodeName(const IMA_NODE_NAME name) { 236*7836SJohn.Forte@Sun.COM int ret; 237*7836SJohn.Forte@Sun.COM int i; 238*7836SJohn.Forte@Sun.COM IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; 239*7836SJohn.Forte@Sun.COM IMA_NODE_PROPERTIES nodeProps; 240*7836SJohn.Forte@Sun.COM IMA_SetNodeNameFn PassFunc; 241*7836SJohn.Forte@Sun.COM IMA_OID nodeOid; 242*7836SJohn.Forte@Sun.COM 243*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 244*7836SJohn.Forte@Sun.COM InitLibrary(); 245*7836SJohn.Forte@Sun.COM 246*7836SJohn.Forte@Sun.COM /* 247*7836SJohn.Forte@Sun.COM * See if iscsiadm and ima plugin packages have been installed. 248*7836SJohn.Forte@Sun.COM */ 249*7836SJohn.Forte@Sun.COM ret = system("pkginfo SUNWima > /dev/null"); 250*7836SJohn.Forte@Sun.COM if (ret) { 251*7836SJohn.Forte@Sun.COM return (status); 252*7836SJohn.Forte@Sun.COM } 253*7836SJohn.Forte@Sun.COM 254*7836SJohn.Forte@Sun.COM ret = system("pkginfo SUNWiscsir > /dev/null"); 255*7836SJohn.Forte@Sun.COM if (ret) { 256*7836SJohn.Forte@Sun.COM return (status); 257*7836SJohn.Forte@Sun.COM } 258*7836SJohn.Forte@Sun.COM 259*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 260*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 261*7836SJohn.Forte@Sun.COM 262*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 263*7836SJohn.Forte@Sun.COM if (strstr(plugintable[i].PluginPath, 264*7836SJohn.Forte@Sun.COM "libsun_ima.so") == NULL) { 265*7836SJohn.Forte@Sun.COM continue; 266*7836SJohn.Forte@Sun.COM } 267*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 268*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 269*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 270*7836SJohn.Forte@Sun.COM PassFunc = 271*7836SJohn.Forte@Sun.COM (IMA_SetNodeNameFn) dlsym(plugintable[i].hPlugin, 272*7836SJohn.Forte@Sun.COM "IMA_SetNodeName"); 273*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 274*7836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, name); 275*7836SJohn.Forte@Sun.COM } 276*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 277*7836SJohn.Forte@Sun.COM } 278*7836SJohn.Forte@Sun.COM break; 279*7836SJohn.Forte@Sun.COM } 280*7836SJohn.Forte@Sun.COM 281*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 282*7836SJohn.Forte@Sun.COM return (status); 283*7836SJohn.Forte@Sun.COM } 284*7836SJohn.Forte@Sun.COM 285*7836SJohn.Forte@Sun.COM static IMA_STATUS setSolarisSharedNodeAlias(const IMA_NODE_ALIAS alias) { 286*7836SJohn.Forte@Sun.COM int ret; 287*7836SJohn.Forte@Sun.COM int i; 288*7836SJohn.Forte@Sun.COM IMA_STATUS status = IMA_ERROR_UNKNOWN_ERROR; 289*7836SJohn.Forte@Sun.COM IMA_NODE_PROPERTIES nodeProps; 290*7836SJohn.Forte@Sun.COM IMA_SetNodeAliasFn PassFunc; 291*7836SJohn.Forte@Sun.COM IMA_OID nodeOid; 292*7836SJohn.Forte@Sun.COM 293*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 294*7836SJohn.Forte@Sun.COM InitLibrary(); 295*7836SJohn.Forte@Sun.COM 296*7836SJohn.Forte@Sun.COM /* 297*7836SJohn.Forte@Sun.COM * See if iscsiadm and ima plugin packages have been installed. 298*7836SJohn.Forte@Sun.COM */ 299*7836SJohn.Forte@Sun.COM ret = system("pkginfo SUNWima > /dev/null"); 300*7836SJohn.Forte@Sun.COM if (ret) { 301*7836SJohn.Forte@Sun.COM return (status); 302*7836SJohn.Forte@Sun.COM } 303*7836SJohn.Forte@Sun.COM 304*7836SJohn.Forte@Sun.COM ret = system("pkginfo SUNWiscsir > /dev/null"); 305*7836SJohn.Forte@Sun.COM if (ret) { 306*7836SJohn.Forte@Sun.COM return (status); 307*7836SJohn.Forte@Sun.COM } 308*7836SJohn.Forte@Sun.COM 309*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 310*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 311*7836SJohn.Forte@Sun.COM 312*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 313*7836SJohn.Forte@Sun.COM if (strstr(plugintable[i].PluginPath, 314*7836SJohn.Forte@Sun.COM "libsun_ima.so") == NULL) { 315*7836SJohn.Forte@Sun.COM continue; 316*7836SJohn.Forte@Sun.COM } 317*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 318*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 319*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 320*7836SJohn.Forte@Sun.COM PassFunc = 321*7836SJohn.Forte@Sun.COM (IMA_SetNodeAliasFn) dlsym(plugintable[i].hPlugin, 322*7836SJohn.Forte@Sun.COM "IMA_SetNodeAlias"); 323*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 324*7836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, alias); 325*7836SJohn.Forte@Sun.COM } 326*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 327*7836SJohn.Forte@Sun.COM } 328*7836SJohn.Forte@Sun.COM break; 329*7836SJohn.Forte@Sun.COM } 330*7836SJohn.Forte@Sun.COM 331*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 332*7836SJohn.Forte@Sun.COM return (status); 333*7836SJohn.Forte@Sun.COM } 334*7836SJohn.Forte@Sun.COM 335*7836SJohn.Forte@Sun.COM #else 336*7836SJohn.Forte@Sun.COM /* 337*7836SJohn.Forte@Sun.COM * add code in .init and .fini, 338*7836SJohn.Forte@Sun.COM * "__attribute__ ((constructor))" and "__attribute__ ((destructor))" 339*7836SJohn.Forte@Sun.COM * are used with gcc 340*7836SJohn.Forte@Sun.COM */ 341*7836SJohn.Forte@Sun.COM __attribute__ ((constructor)) void init() { 342*7836SJohn.Forte@Sun.COM InitLibrary(); 343*7836SJohn.Forte@Sun.COM } 344*7836SJohn.Forte@Sun.COM 345*7836SJohn.Forte@Sun.COM __attribute__ ((destructor)) void fini() { 346*7836SJohn.Forte@Sun.COM ExitLibrary(); 347*7836SJohn.Forte@Sun.COM } 348*7836SJohn.Forte@Sun.COM 349*7836SJohn.Forte@Sun.COM #endif 350*7836SJohn.Forte@Sun.COM 351*7836SJohn.Forte@Sun.COM 352*7836SJohn.Forte@Sun.COM #ifdef WIN32 353*7836SJohn.Forte@Sun.COM 354*7836SJohn.Forte@Sun.COM static BOOL os_createmutex(HANDLE Mutex) { 355*7836SJohn.Forte@Sun.COM Mutex = CreateMutex(NULL, FALSE, NULL); 356*7836SJohn.Forte@Sun.COM 357*7836SJohn.Forte@Sun.COM if (Mutex == NULL) { 358*7836SJohn.Forte@Sun.COM return (FALSE); 359*7836SJohn.Forte@Sun.COM } 360*7836SJohn.Forte@Sun.COM 361*7836SJohn.Forte@Sun.COM return (TRUE); 362*7836SJohn.Forte@Sun.COM } 363*7836SJohn.Forte@Sun.COM 364*7836SJohn.Forte@Sun.COM static void os_destroymutex(HANDLE Mutex) { 365*7836SJohn.Forte@Sun.COM if (Mutex != NULL) { 366*7836SJohn.Forte@Sun.COM CloseHandle(Mutex); 367*7836SJohn.Forte@Sun.COM } 368*7836SJohn.Forte@Sun.COM } 369*7836SJohn.Forte@Sun.COM 370*7836SJohn.Forte@Sun.COM 371*7836SJohn.Forte@Sun.COM static void os_obtainmutex(HANDLE Mutex) { 372*7836SJohn.Forte@Sun.COM WaitForSingleObject(Mutex, INFINITE); 373*7836SJohn.Forte@Sun.COM } 374*7836SJohn.Forte@Sun.COM 375*7836SJohn.Forte@Sun.COM static void os_releasemutex(HANDLE Mutex) { 376*7836SJohn.Forte@Sun.COM ReleaseMutex(Mutex); 377*7836SJohn.Forte@Sun.COM } 378*7836SJohn.Forte@Sun.COM 379*7836SJohn.Forte@Sun.COM #else 380*7836SJohn.Forte@Sun.COM #if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) 381*7836SJohn.Forte@Sun.COM /* <sys/sem.h> */ 382*7836SJohn.Forte@Sun.COM #else 383*7836SJohn.Forte@Sun.COM union semun { 384*7836SJohn.Forte@Sun.COM int val; /* value for SETVAL */ 385*7836SJohn.Forte@Sun.COM struct semid_ds *bf; /* buffer for IPC_STAT, IPC_SET */ 386*7836SJohn.Forte@Sun.COM unsigned short int *array; /* array for GETALL, SETALL */ 387*7836SJohn.Forte@Sun.COM struct seminfo *__buf; /* buffer for IPC_INFO */ 388*7836SJohn.Forte@Sun.COM }; 389*7836SJohn.Forte@Sun.COM #endif 390*7836SJohn.Forte@Sun.COM 391*7836SJohn.Forte@Sun.COM /* Create the semaphore. Return 1 if successful, 0 otherwise */ 392*7836SJohn.Forte@Sun.COM static int os_createmutex(int *semid) { 393*7836SJohn.Forte@Sun.COM int retVal; 394*7836SJohn.Forte@Sun.COM union semun sem_union; 395*7836SJohn.Forte@Sun.COM 396*7836SJohn.Forte@Sun.COM if (semid == NULL) { 397*7836SJohn.Forte@Sun.COM return (0); 398*7836SJohn.Forte@Sun.COM } 399*7836SJohn.Forte@Sun.COM 400*7836SJohn.Forte@Sun.COM retVal = semget(IPC_PRIVATE, 1, IPC_CREAT); 401*7836SJohn.Forte@Sun.COM if (retVal == -1) { 402*7836SJohn.Forte@Sun.COM return (0); 403*7836SJohn.Forte@Sun.COM } 404*7836SJohn.Forte@Sun.COM 405*7836SJohn.Forte@Sun.COM *semid = retVal; /* save key of created semaphore */ 406*7836SJohn.Forte@Sun.COM sem_union.val = 1; /* start semaphore off signaled */ 407*7836SJohn.Forte@Sun.COM retVal = semctl(*semid, 0, SETVAL, sem_union); 408*7836SJohn.Forte@Sun.COM if (retVal == -1) { 409*7836SJohn.Forte@Sun.COM return (0); 410*7836SJohn.Forte@Sun.COM } 411*7836SJohn.Forte@Sun.COM 412*7836SJohn.Forte@Sun.COM return (1); 413*7836SJohn.Forte@Sun.COM } 414*7836SJohn.Forte@Sun.COM 415*7836SJohn.Forte@Sun.COM static void os_obtainmutex(int semid) { 416*7836SJohn.Forte@Sun.COM int retVal; 417*7836SJohn.Forte@Sun.COM struct sembuf sem_b; 418*7836SJohn.Forte@Sun.COM 419*7836SJohn.Forte@Sun.COM sem_b.sem_num = 0; 420*7836SJohn.Forte@Sun.COM sem_b.sem_op = -1; 421*7836SJohn.Forte@Sun.COM sem_b.sem_flg = SEM_UNDO; 422*7836SJohn.Forte@Sun.COM retVal = semop(semid, &sem_b, 1); 423*7836SJohn.Forte@Sun.COM 424*7836SJohn.Forte@Sun.COM } 425*7836SJohn.Forte@Sun.COM 426*7836SJohn.Forte@Sun.COM static void os_releasemutex(int semid) { 427*7836SJohn.Forte@Sun.COM int retVal; 428*7836SJohn.Forte@Sun.COM struct sembuf sem_b; 429*7836SJohn.Forte@Sun.COM 430*7836SJohn.Forte@Sun.COM sem_b.sem_num = 0; 431*7836SJohn.Forte@Sun.COM sem_b.sem_op = 1; 432*7836SJohn.Forte@Sun.COM sem_b.sem_flg = SEM_UNDO; 433*7836SJohn.Forte@Sun.COM retVal = semop(semid, &sem_b, 1); 434*7836SJohn.Forte@Sun.COM 435*7836SJohn.Forte@Sun.COM } 436*7836SJohn.Forte@Sun.COM 437*7836SJohn.Forte@Sun.COM /* Destroy the SNMP semaphore. */ 438*7836SJohn.Forte@Sun.COM static void os_destroymutex(int semid) { 439*7836SJohn.Forte@Sun.COM int retVal; 440*7836SJohn.Forte@Sun.COM union semun sem_union; 441*7836SJohn.Forte@Sun.COM 442*7836SJohn.Forte@Sun.COM retVal = semctl(semid, 0, IPC_RMID, sem_union); 443*7836SJohn.Forte@Sun.COM 444*7836SJohn.Forte@Sun.COM } 445*7836SJohn.Forte@Sun.COM #endif 446*7836SJohn.Forte@Sun.COM 447*7836SJohn.Forte@Sun.COM 448*7836SJohn.Forte@Sun.COM void InitLibrary() { 449*7836SJohn.Forte@Sun.COM 450*7836SJohn.Forte@Sun.COM FILE *imaconf; 451*7836SJohn.Forte@Sun.COM char fullline[512]; /* Full line read in from IMA.conf */ 452*7836SJohn.Forte@Sun.COM char pluginname[64]; /* Read in from file IMA.conf */ 453*7836SJohn.Forte@Sun.COM char pluginpath[256]; /* Read in from file IMA.conf */ 454*7836SJohn.Forte@Sun.COM char imaConfFilePath[256]; 455*7836SJohn.Forte@Sun.COM char systemPath[256]; 456*7836SJohn.Forte@Sun.COM char *charPtr; 457*7836SJohn.Forte@Sun.COM IMA_UINT dwStrLength; 458*7836SJohn.Forte@Sun.COM 459*7836SJohn.Forte@Sun.COM IMA_UINT i = 0; 460*7836SJohn.Forte@Sun.COM 461*7836SJohn.Forte@Sun.COM if (number_of_plugins != -1) 462*7836SJohn.Forte@Sun.COM return; 463*7836SJohn.Forte@Sun.COM 464*7836SJohn.Forte@Sun.COM number_of_plugins = 0; 465*7836SJohn.Forte@Sun.COM 466*7836SJohn.Forte@Sun.COM if (os_createmutex(&libMutex) == 0) { 467*7836SJohn.Forte@Sun.COM return; 468*7836SJohn.Forte@Sun.COM } 469*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 470*7836SJohn.Forte@Sun.COM 471*7836SJohn.Forte@Sun.COM sharedNodeAlias[0] = 0; 472*7836SJohn.Forte@Sun.COM dwStrLength = 255; 473*7836SJohn.Forte@Sun.COM 474*7836SJohn.Forte@Sun.COM 475*7836SJohn.Forte@Sun.COM 476*7836SJohn.Forte@Sun.COM /* Open configuration file from known location */ 477*7836SJohn.Forte@Sun.COM #ifdef WIN32 478*7836SJohn.Forte@Sun.COM if (GetSystemDirectory(systemPath, sizeof (systemPath))) 479*7836SJohn.Forte@Sun.COM sprintf(imaConfFilePath, "%s\\drivers\\etc\\ima.conf", 480*7836SJohn.Forte@Sun.COM systemPath); 481*7836SJohn.Forte@Sun.COM else 482*7836SJohn.Forte@Sun.COM strcpy(imaConfFilePath, "ima.conf"); 483*7836SJohn.Forte@Sun.COM #else 484*7836SJohn.Forte@Sun.COM strcpy(imaConfFilePath, "/etc/ima.conf"); 485*7836SJohn.Forte@Sun.COM #endif 486*7836SJohn.Forte@Sun.COM 487*7836SJohn.Forte@Sun.COM if ((imaconf = fopen(imaConfFilePath, "r")) == NULL) { 488*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 489*7836SJohn.Forte@Sun.COM return; 490*7836SJohn.Forte@Sun.COM } 491*7836SJohn.Forte@Sun.COM /* Read in each line and load library */ 492*7836SJohn.Forte@Sun.COM while ((imaconf != NULL) && 493*7836SJohn.Forte@Sun.COM (fgets(fullline, sizeof (fullline), imaconf))) { 494*7836SJohn.Forte@Sun.COM if ((fullline[0] != '#') && (fullline[0] != '\n')) { 495*7836SJohn.Forte@Sun.COM /* Take out the '\n' */ 496*7836SJohn.Forte@Sun.COM if ((charPtr = (char *)strchr(fullline, '\n')) != NULL) 497*7836SJohn.Forte@Sun.COM *charPtr = '\0'; 498*7836SJohn.Forte@Sun.COM 499*7836SJohn.Forte@Sun.COM /* look for the first tab */ 500*7836SJohn.Forte@Sun.COM if ((charPtr = (char *)strchr(fullline, '\t')) == NULL) 501*7836SJohn.Forte@Sun.COM charPtr = (char *)strchr(fullline, ' '); 502*7836SJohn.Forte@Sun.COM 503*7836SJohn.Forte@Sun.COM /* Set Null termination for library name if found */ 504*7836SJohn.Forte@Sun.COM if (charPtr != NULL) { 505*7836SJohn.Forte@Sun.COM *charPtr++ = '\0'; 506*7836SJohn.Forte@Sun.COM /* 507*7836SJohn.Forte@Sun.COM * Skip spaces and tabs until 508*7836SJohn.Forte@Sun.COM * the next character found 509*7836SJohn.Forte@Sun.COM */ 510*7836SJohn.Forte@Sun.COM while ((*charPtr == ' ') || (*charPtr == '\t')) 511*7836SJohn.Forte@Sun.COM charPtr++; 512*7836SJohn.Forte@Sun.COM } 513*7836SJohn.Forte@Sun.COM else 514*7836SJohn.Forte@Sun.COM continue; /* May be invalid entry */ 515*7836SJohn.Forte@Sun.COM 516*7836SJohn.Forte@Sun.COM /* Copy library name and path */ 517*7836SJohn.Forte@Sun.COM strcpy(pluginname, fullline); 518*7836SJohn.Forte@Sun.COM strcpy(pluginpath, charPtr); 519*7836SJohn.Forte@Sun.COM 520*7836SJohn.Forte@Sun.COM /* 521*7836SJohn.Forte@Sun.COM * Continue to the next line if library name or 522*7836SJohn.Forte@Sun.COM * path is invalid 523*7836SJohn.Forte@Sun.COM */ 524*7836SJohn.Forte@Sun.COM if ((strlen(pluginname) == 0) || 525*7836SJohn.Forte@Sun.COM (strlen(pluginpath) == 0)) 526*7836SJohn.Forte@Sun.COM continue; 527*7836SJohn.Forte@Sun.COM 528*7836SJohn.Forte@Sun.COM #ifdef WIN32 529*7836SJohn.Forte@Sun.COM /* Load the DLL now */ 530*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin = LoadLibrary(pluginpath); 531*7836SJohn.Forte@Sun.COM #else 532*7836SJohn.Forte@Sun.COM /* Load the DLL now */ 533*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin = dlopen(pluginpath, RTLD_LAZY); 534*7836SJohn.Forte@Sun.COM #endif 535*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 536*7836SJohn.Forte@Sun.COM typedef int (*InitializeFn)(); 537*7836SJohn.Forte@Sun.COM InitializeFn PassFunc; 538*7836SJohn.Forte@Sun.COM IMA_STATUS status; 539*7836SJohn.Forte@Sun.COM 540*7836SJohn.Forte@Sun.COM memcpy((char *)&plugintable[i].PluginName, 541*7836SJohn.Forte@Sun.COM (char *)&pluginname, 64); 542*7836SJohn.Forte@Sun.COM memcpy((char *) 543*7836SJohn.Forte@Sun.COM &plugintable[i].PluginPath, 544*7836SJohn.Forte@Sun.COM (char *)&pluginpath, 256); 545*7836SJohn.Forte@Sun.COM plugintable[i].ownerId = i + 1; 546*7836SJohn.Forte@Sun.COM 547*7836SJohn.Forte@Sun.COM #ifdef WIN32 548*7836SJohn.Forte@Sun.COM PassFunc = (InitializeFn) 549*7836SJohn.Forte@Sun.COM GetProcAddress( 550*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, "Initialize"); 551*7836SJohn.Forte@Sun.COM #else 552*7836SJohn.Forte@Sun.COM PassFunc = (InitializeFn) 553*7836SJohn.Forte@Sun.COM dlsym( 554*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, "Initialize"); 555*7836SJohn.Forte@Sun.COM #endif 556*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 557*7836SJohn.Forte@Sun.COM status = 558*7836SJohn.Forte@Sun.COM PassFunc(plugintable[i].ownerId); 559*7836SJohn.Forte@Sun.COM } 560*7836SJohn.Forte@Sun.COM 561*7836SJohn.Forte@Sun.COM plugintable[i].number_of_vbcallbacks = 0; 562*7836SJohn.Forte@Sun.COM plugintable[i].number_of_pccallbacks = 0; 563*7836SJohn.Forte@Sun.COM os_createmutex(&(plugintable[i].pluginMutex)); 564*7836SJohn.Forte@Sun.COM i++; 565*7836SJohn.Forte@Sun.COM } 566*7836SJohn.Forte@Sun.COM } 567*7836SJohn.Forte@Sun.COM } 568*7836SJohn.Forte@Sun.COM number_of_plugins = i; 569*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 570*7836SJohn.Forte@Sun.COM } 571*7836SJohn.Forte@Sun.COM 572*7836SJohn.Forte@Sun.COM 573*7836SJohn.Forte@Sun.COM void ExitLibrary() { 574*7836SJohn.Forte@Sun.COM IMA_UINT j; 575*7836SJohn.Forte@Sun.COM IMA_UINT i; 576*7836SJohn.Forte@Sun.COM 577*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 578*7836SJohn.Forte@Sun.COM return; 579*7836SJohn.Forte@Sun.COM 580*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 581*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 582*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 583*7836SJohn.Forte@Sun.COM TerminateFn ExitPassFunc; 584*7836SJohn.Forte@Sun.COM 585*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 586*7836SJohn.Forte@Sun.COM for (j = 0; j < plugintable[i].number_of_vbcallbacks; 587*7836SJohn.Forte@Sun.COM j++) { 588*7836SJohn.Forte@Sun.COM #define IMA_DFOBC_STR "IMA_DeregisterForObjectVisibilityChangesFn" 589*7836SJohn.Forte@Sun.COM IMA_DeregisterForObjectVisibilityChangesFn 590*7836SJohn.Forte@Sun.COM PassFunc; 591*7836SJohn.Forte@Sun.COM #ifdef WIN32 592*7836SJohn.Forte@Sun.COM PassFunc = 593*7836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectVisibilityChangesFn) 594*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 595*7836SJohn.Forte@Sun.COM IMA_DFOBC_STR); 596*7836SJohn.Forte@Sun.COM #else 597*7836SJohn.Forte@Sun.COM PassFunc = 598*7836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectVisibilityChangesFn) 599*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 600*7836SJohn.Forte@Sun.COM IMA_DFOBC_STR); 601*7836SJohn.Forte@Sun.COM #endif 602*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 603*7836SJohn.Forte@Sun.COM PassFunc(plugintable[i].vbcallback[j]); 604*7836SJohn.Forte@Sun.COM } 605*7836SJohn.Forte@Sun.COM #undef IMA_DFOBC_STR 606*7836SJohn.Forte@Sun.COM } 607*7836SJohn.Forte@Sun.COM plugintable[i].number_of_vbcallbacks = 0; 608*7836SJohn.Forte@Sun.COM 609*7836SJohn.Forte@Sun.COM for (j = 0; j < plugintable[i].number_of_pccallbacks; 610*7836SJohn.Forte@Sun.COM j++) { 611*7836SJohn.Forte@Sun.COM IMA_DeregisterForObjectPropertyChangesFn 612*7836SJohn.Forte@Sun.COM PassFunc; 613*7836SJohn.Forte@Sun.COM #ifdef WIN32 614*7836SJohn.Forte@Sun.COM PassFunc = 615*7836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectPropertyChangesFn) 616*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 617*7836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectPropertyChangesFn"); 618*7836SJohn.Forte@Sun.COM #else 619*7836SJohn.Forte@Sun.COM PassFunc = 620*7836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectPropertyChangesFn) 621*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 622*7836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectPropertyChangesFn"); 623*7836SJohn.Forte@Sun.COM #endif 624*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 625*7836SJohn.Forte@Sun.COM PassFunc(plugintable[i].pccallback[j]); 626*7836SJohn.Forte@Sun.COM } 627*7836SJohn.Forte@Sun.COM } 628*7836SJohn.Forte@Sun.COM plugintable[i].number_of_pccallbacks = 0; 629*7836SJohn.Forte@Sun.COM 630*7836SJohn.Forte@Sun.COM #ifdef WIN32 631*7836SJohn.Forte@Sun.COM ExitPassFunc = 632*7836SJohn.Forte@Sun.COM (TerminateFn) GetProcAddress 633*7836SJohn.Forte@Sun.COM (plugintable[i].hPlugin, "Terminate"); 634*7836SJohn.Forte@Sun.COM #else 635*7836SJohn.Forte@Sun.COM ExitPassFunc = (TerminateFn) 636*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, "Terminate"); 637*7836SJohn.Forte@Sun.COM #endif 638*7836SJohn.Forte@Sun.COM if (ExitPassFunc != NULL) { 639*7836SJohn.Forte@Sun.COM ExitPassFunc(); 640*7836SJohn.Forte@Sun.COM } 641*7836SJohn.Forte@Sun.COM #ifdef WIN32 642*7836SJohn.Forte@Sun.COM /* Unload DLL from memory */ 643*7836SJohn.Forte@Sun.COM FreeLibrary(plugintable[i].hPlugin); 644*7836SJohn.Forte@Sun.COM #else 645*7836SJohn.Forte@Sun.COM /* Unload DLL from memory */ 646*7836SJohn.Forte@Sun.COM dlclose(plugintable[i].hPlugin); 647*7836SJohn.Forte@Sun.COM #endif 648*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 649*7836SJohn.Forte@Sun.COM os_destroymutex(plugintable[i].pluginMutex); 650*7836SJohn.Forte@Sun.COM } 651*7836SJohn.Forte@Sun.COM } 652*7836SJohn.Forte@Sun.COM number_of_plugins = -1; 653*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 654*7836SJohn.Forte@Sun.COM os_destroymutex(libMutex); 655*7836SJohn.Forte@Sun.COM } 656*7836SJohn.Forte@Sun.COM 657*7836SJohn.Forte@Sun.COM 658*7836SJohn.Forte@Sun.COM static void VisibilityCallback( 659*7836SJohn.Forte@Sun.COM IMA_BOOL becomingVisible, 660*7836SJohn.Forte@Sun.COM IMA_OID objectId) { 661*7836SJohn.Forte@Sun.COM IMA_UINT i, j; 662*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 663*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 664*7836SJohn.Forte@Sun.COM if ((plugintable[i].hPlugin != NULL) && 665*7836SJohn.Forte@Sun.COM (objectId.ownerId == plugintable[i].ownerId)) { 666*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 667*7836SJohn.Forte@Sun.COM for (j = 0; 668*7836SJohn.Forte@Sun.COM j < plugintable[i].number_of_vbcallbacks; 669*7836SJohn.Forte@Sun.COM j++) { 670*7836SJohn.Forte@Sun.COM (plugintable[i].vbcallback[j]) 671*7836SJohn.Forte@Sun.COM (becomingVisible, objectId); 672*7836SJohn.Forte@Sun.COM } 673*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 674*7836SJohn.Forte@Sun.COM } 675*7836SJohn.Forte@Sun.COM } 676*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 677*7836SJohn.Forte@Sun.COM 678*7836SJohn.Forte@Sun.COM } 679*7836SJohn.Forte@Sun.COM 680*7836SJohn.Forte@Sun.COM static void PropertyCallback( 681*7836SJohn.Forte@Sun.COM IMA_OID objectId) { 682*7836SJohn.Forte@Sun.COM IMA_UINT i, j; 683*7836SJohn.Forte@Sun.COM 684*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 685*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 686*7836SJohn.Forte@Sun.COM if ((plugintable[i].hPlugin != NULL) && 687*7836SJohn.Forte@Sun.COM (objectId.ownerId == plugintable[i].ownerId)) { 688*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 689*7836SJohn.Forte@Sun.COM for (j = 0; 690*7836SJohn.Forte@Sun.COM j < plugintable[i].number_of_pccallbacks; 691*7836SJohn.Forte@Sun.COM j++) { 692*7836SJohn.Forte@Sun.COM (plugintable[i].pccallback[j])(objectId); 693*7836SJohn.Forte@Sun.COM } 694*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 695*7836SJohn.Forte@Sun.COM } 696*7836SJohn.Forte@Sun.COM } 697*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 698*7836SJohn.Forte@Sun.COM } 699*7836SJohn.Forte@Sun.COM 700*7836SJohn.Forte@Sun.COM /* 701*7836SJohn.Forte@Sun.COM * Gets the date and time, in the form of an IMA_DATETIME, from the build 702*7836SJohn.Forte@Sun.COM * script when compiled. 703*7836SJohn.Forte@Sun.COM */ 704*7836SJohn.Forte@Sun.COM static void GetBuildTime(IMA_DATETIME* pdatetime) { 705*7836SJohn.Forte@Sun.COM 706*7836SJohn.Forte@Sun.COM #ifdef WIN32 707*7836SJohn.Forte@Sun.COM char *dayToken[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; 708*7836SJohn.Forte@Sun.COM char *monthToken[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", 709*7836SJohn.Forte@Sun.COM "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; 710*7836SJohn.Forte@Sun.COM char monthString[4]; 711*7836SJohn.Forte@Sun.COM char dayString[4]; 712*7836SJohn.Forte@Sun.COM int i; 713*7836SJohn.Forte@Sun.COM 714*7836SJohn.Forte@Sun.COM sscanf(__TIME__, "%u:%u:%u", &pdatetime->tm_hour, 715*7836SJohn.Forte@Sun.COM &pdatetime->tm_min, &pdatetime->tm_sec); 716*7836SJohn.Forte@Sun.COM sscanf(__DATE__, "%s %u %u", monthString, 717*7836SJohn.Forte@Sun.COM &pdatetime->tm_mday, &pdatetime->tm_year); 718*7836SJohn.Forte@Sun.COM sscanf(__TIMESTAMP__, "%s", dayString); 719*7836SJohn.Forte@Sun.COM 720*7836SJohn.Forte@Sun.COM pdatetime->tm_year -= 1900; 721*7836SJohn.Forte@Sun.COM pdatetime->tm_isdst = -1; 722*7836SJohn.Forte@Sun.COM 723*7836SJohn.Forte@Sun.COM pdatetime->tm_wday = 0; 724*7836SJohn.Forte@Sun.COM for (i = 0; i < 7; i++) { 725*7836SJohn.Forte@Sun.COM if (strcmp(dayToken[i], dayString) == 0) { 726*7836SJohn.Forte@Sun.COM pdatetime->tm_wday = i; 727*7836SJohn.Forte@Sun.COM break; 728*7836SJohn.Forte@Sun.COM } 729*7836SJohn.Forte@Sun.COM } 730*7836SJohn.Forte@Sun.COM 731*7836SJohn.Forte@Sun.COM pdatetime->tm_mon = 0; 732*7836SJohn.Forte@Sun.COM for (i = 0; i < 12; i++) { 733*7836SJohn.Forte@Sun.COM if (strcmp(monthToken[i], monthString) == 0) { 734*7836SJohn.Forte@Sun.COM pdatetime->tm_mon = i; 735*7836SJohn.Forte@Sun.COM break; 736*7836SJohn.Forte@Sun.COM } 737*7836SJohn.Forte@Sun.COM } 738*7836SJohn.Forte@Sun.COM 739*7836SJohn.Forte@Sun.COM #else 740*7836SJohn.Forte@Sun.COM #if defined(BUILD_DATE) 741*7836SJohn.Forte@Sun.COM if (strptime(BUILD_DATE, "%Y/%m/%d %T %Z", pdatetime) == NULL) { 742*7836SJohn.Forte@Sun.COM memset(pdatetime, 0, sizeof (IMA_DATETIME)); 743*7836SJohn.Forte@Sun.COM } 744*7836SJohn.Forte@Sun.COM #else 745*7836SJohn.Forte@Sun.COM memset(pdatetime, 0, sizeof (IMA_DATETIME)); 746*7836SJohn.Forte@Sun.COM #endif 747*7836SJohn.Forte@Sun.COM #endif 748*7836SJohn.Forte@Sun.COM 749*7836SJohn.Forte@Sun.COM } 750*7836SJohn.Forte@Sun.COM 751*7836SJohn.Forte@Sun.COM 752*7836SJohn.Forte@Sun.COM 753*7836SJohn.Forte@Sun.COM /* 754*7836SJohn.Forte@Sun.COM * Gets the properties of the IMA library that is being used. 755*7836SJohn.Forte@Sun.COM * 756*7836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_LIBRARY_PROPERTIES structure 757*7836SJohn.Forte@Sun.COM * allocated by the caller. On successful return this structure will 758*7836SJohn.Forte@Sun.COM * contain the properties of the IMA library. 759*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 760*7836SJohn.Forte@Sun.COM * an error occurred. 761*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the library properties were successfully 762*7836SJohn.Forte@Sun.COM * returned. 763*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or 764*7836SJohn.Forte@Sun.COM * specifies a memory area to which data cannot be written. 765*7836SJohn.Forte@Sun.COM */ 766*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLibraryProperties( 767*7836SJohn.Forte@Sun.COM IMA_LIBRARY_PROPERTIES *pProps) { 768*7836SJohn.Forte@Sun.COM 769*7836SJohn.Forte@Sun.COM char imaPath[256]; 770*7836SJohn.Forte@Sun.COM #ifdef WIN32 771*7836SJohn.Forte@Sun.COM HMODULE imaHandle; 772*7836SJohn.Forte@Sun.COM #endif 773*7836SJohn.Forte@Sun.COM 774*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 775*7836SJohn.Forte@Sun.COM InitLibrary(); 776*7836SJohn.Forte@Sun.COM 777*7836SJohn.Forte@Sun.COM if (pProps == NULL) 778*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 779*7836SJohn.Forte@Sun.COM 780*7836SJohn.Forte@Sun.COM // Fill in the library properties. 781*7836SJohn.Forte@Sun.COM GetBuildTime(&pProps->buildTime); 782*7836SJohn.Forte@Sun.COM pProps->supportedImaVersion = LIBRARY_PROPERTY_SUPPORTED_IMA_VERSION; 783*7836SJohn.Forte@Sun.COM libSwprintf(pProps->implementationVersion, L"%ls", 784*7836SJohn.Forte@Sun.COM LIBRARY_PROPERTY_IMPLEMENTATION_VERSION); 785*7836SJohn.Forte@Sun.COM libSwprintf(pProps->vendor, L"%ls", LIBRARY_PROPERTY_VENDOR); 786*7836SJohn.Forte@Sun.COM 787*7836SJohn.Forte@Sun.COM 788*7836SJohn.Forte@Sun.COM #ifdef WIN32 789*7836SJohn.Forte@Sun.COM imaHandle = GetModuleHandleA("ima"); 790*7836SJohn.Forte@Sun.COM imaPath[0] = 0; 791*7836SJohn.Forte@Sun.COM if (imaHandle != NULL) { 792*7836SJohn.Forte@Sun.COM GetModuleFileNameA(imaHandle, imaPath, 256); 793*7836SJohn.Forte@Sun.COM } 794*7836SJohn.Forte@Sun.COM MultiByteToWideChar(CP_ACP, 0, imaPath, -1, 795*7836SJohn.Forte@Sun.COM pProps->fileName, 256); 796*7836SJohn.Forte@Sun.COM #else 797*7836SJohn.Forte@Sun.COM libSwprintf(pProps->fileName, LIBRARY_FILE_NAME); 798*7836SJohn.Forte@Sun.COM 799*7836SJohn.Forte@Sun.COM // mbstowcs(pProps->fileName, imaPath, 256); 800*7836SJohn.Forte@Sun.COM #endif 801*7836SJohn.Forte@Sun.COM 802*7836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 803*7836SJohn.Forte@Sun.COM } 804*7836SJohn.Forte@Sun.COM 805*7836SJohn.Forte@Sun.COM 806*7836SJohn.Forte@Sun.COM /* 807*7836SJohn.Forte@Sun.COM * Gets a list of the object IDs of all currently loaded plugins. 808*7836SJohn.Forte@Sun.COM * 809*7836SJohn.Forte@Sun.COM * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST. 810*7836SJohn.Forte@Sun.COM * On successful return this will contain a pointer to an @ref 811*7836SJohn.Forte@Sun.COM * IMA_OID_LIST which contains the object IDs of all of the plugins 812*7836SJohn.Forte@Sun.COM * currently loaded by the library. 813*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful 814*7836SJohn.Forte@Sun.COM * or if an error occurred. 815*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the plugin ID list was successfully 816*7836SJohn.Forte@Sun.COM * returned. 817*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or 818*7836SJohn.Forte@Sun.COM * specifies a memory area to which data cannot be written. 819*7836SJohn.Forte@Sun.COM */ 820*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPluginOidList( 821*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 822*7836SJohn.Forte@Sun.COM IMA_UINT i; 823*7836SJohn.Forte@Sun.COM 824*7836SJohn.Forte@Sun.COM 825*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 826*7836SJohn.Forte@Sun.COM InitLibrary(); 827*7836SJohn.Forte@Sun.COM 828*7836SJohn.Forte@Sun.COM if (ppList == NULL) 829*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 830*7836SJohn.Forte@Sun.COM 831*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 832*7836SJohn.Forte@Sun.COM 833*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 834*7836SJohn.Forte@Sun.COM (number_of_plugins - 1) * sizeof (IMA_OID)); 835*7836SJohn.Forte@Sun.COM 836*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) 837*7836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 838*7836SJohn.Forte@Sun.COM 839*7836SJohn.Forte@Sun.COM (*ppList)->oidCount = number_of_plugins; 840*7836SJohn.Forte@Sun.COM 841*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 842*7836SJohn.Forte@Sun.COM 843*7836SJohn.Forte@Sun.COM (*ppList)->oids[i].objectType = IMA_OBJECT_TYPE_PLUGIN; 844*7836SJohn.Forte@Sun.COM (*ppList)->oids[i].ownerId = plugintable[i].ownerId; 845*7836SJohn.Forte@Sun.COM (*ppList)->oids[i].objectSequenceNumber = 0; 846*7836SJohn.Forte@Sun.COM 847*7836SJohn.Forte@Sun.COM } 848*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 849*7836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 850*7836SJohn.Forte@Sun.COM } 851*7836SJohn.Forte@Sun.COM 852*7836SJohn.Forte@Sun.COM 853*7836SJohn.Forte@Sun.COM 854*7836SJohn.Forte@Sun.COM 855*7836SJohn.Forte@Sun.COM /* 856*7836SJohn.Forte@Sun.COM * Gets the properties of the specified vendor plugin. 857*7836SJohn.Forte@Sun.COM * 858*7836SJohn.Forte@Sun.COM * @param pluginId The ID of the plugin whose properties are being retrieved. 859*7836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_PLUGIN_PROPERTIES structure 860*7836SJohn.Forte@Sun.COM * allocated by the caller. On successful return this will contain the 861*7836SJohn.Forte@Sun.COM * properties of the plugin specified by pluginId. 862*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 863*7836SJohn.Forte@Sun.COM * an error occurred. 864*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the plugin properties were successfully 865*7836SJohn.Forte@Sun.COM * returned. 866*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a pluginId does not 867*7836SJohn.Forte@Sun.COM * specify any valid object type. 868*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a pluginId does not 869*7836SJohn.Forte@Sun.COM * specify a plugin object. 870*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a pluginId refers to a 871*7836SJohn.Forte@Sun.COM * plugin, but not one that is currently loaded. 872*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or 873*7836SJohn.Forte@Sun.COM * specify a memory area to which data cannot be written. 874*7836SJohn.Forte@Sun.COM */ 875*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPluginProperties( 876*7836SJohn.Forte@Sun.COM IMA_OID pluginOid, 877*7836SJohn.Forte@Sun.COM IMA_PLUGIN_PROPERTIES *pProps) { 878*7836SJohn.Forte@Sun.COM IMA_GetPluginPropertiesFn PassFunc; 879*7836SJohn.Forte@Sun.COM IMA_UINT i; 880*7836SJohn.Forte@Sun.COM IMA_STATUS status; 881*7836SJohn.Forte@Sun.COM 882*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 883*7836SJohn.Forte@Sun.COM InitLibrary(); 884*7836SJohn.Forte@Sun.COM 885*7836SJohn.Forte@Sun.COM if (pProps == NULL) 886*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 887*7836SJohn.Forte@Sun.COM 888*7836SJohn.Forte@Sun.COM if ((pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) || 889*7836SJohn.Forte@Sun.COM (pluginOid.objectSequenceNumber != 0)) 890*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 891*7836SJohn.Forte@Sun.COM 892*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 893*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 894*7836SJohn.Forte@Sun.COM 895*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 896*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == pluginOid.ownerId) { 897*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 898*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 899*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 900*7836SJohn.Forte@Sun.COM #ifdef WIN32 901*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPluginPropertiesFn) 902*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 903*7836SJohn.Forte@Sun.COM "IMA_GetPluginProperties"); 904*7836SJohn.Forte@Sun.COM #else 905*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPluginPropertiesFn) 906*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 907*7836SJohn.Forte@Sun.COM "IMA_GetPluginProperties"); 908*7836SJohn.Forte@Sun.COM #endif 909*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 910*7836SJohn.Forte@Sun.COM status = PassFunc(pluginOid, pProps); 911*7836SJohn.Forte@Sun.COM } 912*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 913*7836SJohn.Forte@Sun.COM } 914*7836SJohn.Forte@Sun.COM 915*7836SJohn.Forte@Sun.COM break; 916*7836SJohn.Forte@Sun.COM } 917*7836SJohn.Forte@Sun.COM } 918*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 919*7836SJohn.Forte@Sun.COM return (status); 920*7836SJohn.Forte@Sun.COM 921*7836SJohn.Forte@Sun.COM } 922*7836SJohn.Forte@Sun.COM 923*7836SJohn.Forte@Sun.COM 924*7836SJohn.Forte@Sun.COM 925*7836SJohn.Forte@Sun.COM 926*7836SJohn.Forte@Sun.COM /* 927*7836SJohn.Forte@Sun.COM * Gets the object ID for the plugin associated with the specified object ID. 928*7836SJohn.Forte@Sun.COM * 929*7836SJohn.Forte@Sun.COM * @param objectId The object ID of an object that has been received from 930*7836SJohn.Forte@Sun.COM * a previous library call. 931*7836SJohn.Forte@Sun.COM * @param pPluginId A pointer to an @ref IMA_OID structure allocated by the 932*7836SJohn.Forte@Sun.COM * caller. On successful return this will contain the object ID of the 933*7836SJohn.Forte@Sun.COM * plugin associated with the object specified by @a objectId. This 934*7836SJohn.Forte@Sun.COM * can then be used to work with the plugin, e.g., to get the 935*7836SJohn.Forte@Sun.COM * properties of the plugin or the send the plugin an IOCtl. 936*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 937*7836SJohn.Forte@Sun.COM * an error occurred. 938*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the associated plugin ID was 939*7836SJohn.Forte@Sun.COM * successfully returned. 940*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pPluginId is NULL 941*7836SJohn.Forte@Sun.COM * or specifes a memory area to which data cannot be written. 942*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a objectId specifies 943*7836SJohn.Forte@Sun.COM * an object not owned by a plugin, but instead one that is owned by 944*7836SJohn.Forte@Sun.COM * the library. 945*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a objectId specifies 946*7836SJohn.Forte@Sun.COM * an object with an invalid type. 947*7836SJohn.Forte@Sun.COM */ 948*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetAssociatedPluginOid( 949*7836SJohn.Forte@Sun.COM IMA_OID objectId, 950*7836SJohn.Forte@Sun.COM IMA_OID *pPluginId) { 951*7836SJohn.Forte@Sun.COM IMA_UINT i; 952*7836SJohn.Forte@Sun.COM IMA_STATUS status; 953*7836SJohn.Forte@Sun.COM 954*7836SJohn.Forte@Sun.COM 955*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 956*7836SJohn.Forte@Sun.COM InitLibrary(); 957*7836SJohn.Forte@Sun.COM 958*7836SJohn.Forte@Sun.COM if (pPluginId == NULL || objectId.ownerId == RL_LIBRARY_SEQNUM) 959*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 960*7836SJohn.Forte@Sun.COM 961*7836SJohn.Forte@Sun.COM if (objectId.objectType != IMA_OBJECT_TYPE_UNKNOWN && 962*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_PLUGIN && 963*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_NODE && 964*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_LHBA && 965*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_PHBA && 966*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL && 967*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_PORTAL_GROUP && 968*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_LNP && 969*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_PNP && 970*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_TARGET && 971*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_LU && 972*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS && 973*7836SJohn.Forte@Sun.COM objectId.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) 974*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_OBJECT_TYPE); 975*7836SJohn.Forte@Sun.COM 976*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 977*7836SJohn.Forte@Sun.COM 978*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 979*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 980*7836SJohn.Forte@Sun.COM if (objectId.ownerId == plugintable[i].ownerId) { 981*7836SJohn.Forte@Sun.COM pPluginId->objectType = IMA_OBJECT_TYPE_PLUGIN; 982*7836SJohn.Forte@Sun.COM pPluginId->ownerId = plugintable[i].ownerId; 983*7836SJohn.Forte@Sun.COM pPluginId->objectSequenceNumber = 0; 984*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 985*7836SJohn.Forte@Sun.COM } 986*7836SJohn.Forte@Sun.COM 987*7836SJohn.Forte@Sun.COM } 988*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 989*7836SJohn.Forte@Sun.COM return (status); 990*7836SJohn.Forte@Sun.COM } 991*7836SJohn.Forte@Sun.COM 992*7836SJohn.Forte@Sun.COM 993*7836SJohn.Forte@Sun.COM 994*7836SJohn.Forte@Sun.COM 995*7836SJohn.Forte@Sun.COM /* 996*7836SJohn.Forte@Sun.COM * Gets the object ID of the shared node. 997*7836SJohn.Forte@Sun.COM * 998*7836SJohn.Forte@Sun.COM * @param pSharedNodeId A pointer to an @ref IMA_OID structure allocated by 999*7836SJohn.Forte@Sun.COM * the caller. On successful return it will contain the object ID of the 1000*7836SJohn.Forte@Sun.COM * shared node of the currently executing system is placed. 1001*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 1002*7836SJohn.Forte@Sun.COM * an error occurred. 1003*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the shared node ID has been successfully 1004*7836SJohn.Forte@Sun.COM * retrieved. 1005*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pSharedNodeId is NULL 1006*7836SJohn.Forte@Sun.COM * or specifies a memory area to which data cannot be written. 1007*7836SJohn.Forte@Sun.COM */ 1008*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetSharedNodeOid( 1009*7836SJohn.Forte@Sun.COM IMA_OID *pSharedNodeId) { 1010*7836SJohn.Forte@Sun.COM if (pSharedNodeId == NULL) 1011*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1012*7836SJohn.Forte@Sun.COM 1013*7836SJohn.Forte@Sun.COM pSharedNodeId->objectType = IMA_OBJECT_TYPE_NODE; 1014*7836SJohn.Forte@Sun.COM pSharedNodeId->ownerId = RL_LIBRARY_SEQNUM; 1015*7836SJohn.Forte@Sun.COM pSharedNodeId->objectSequenceNumber = RL_SHARED_NODE_SEQNUM; 1016*7836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 1017*7836SJohn.Forte@Sun.COM } 1018*7836SJohn.Forte@Sun.COM 1019*7836SJohn.Forte@Sun.COM 1020*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetObjectType( 1021*7836SJohn.Forte@Sun.COM IMA_OID oid, 1022*7836SJohn.Forte@Sun.COM IMA_OBJECT_TYPE *pObjectType) { 1023*7836SJohn.Forte@Sun.COM IMA_STATUS status; 1024*7836SJohn.Forte@Sun.COM IMA_UINT i; 1025*7836SJohn.Forte@Sun.COM 1026*7836SJohn.Forte@Sun.COM if (pObjectType == NULL) 1027*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1028*7836SJohn.Forte@Sun.COM 1029*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_UNKNOWN && 1030*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PLUGIN && 1031*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_NODE && 1032*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LHBA && 1033*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PHBA && 1034*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL && 1035*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PORTAL_GROUP && 1036*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LNP && 1037*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PNP && 1038*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_TARGET && 1039*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LU && 1040*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS && 1041*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) 1042*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_OBJECT_TYPE); 1043*7836SJohn.Forte@Sun.COM 1044*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1045*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 1046*7836SJohn.Forte@Sun.COM 1047*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1048*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 1049*7836SJohn.Forte@Sun.COM *pObjectType = oid.objectType; 1050*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 1051*7836SJohn.Forte@Sun.COM } 1052*7836SJohn.Forte@Sun.COM } 1053*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1054*7836SJohn.Forte@Sun.COM return (status); 1055*7836SJohn.Forte@Sun.COM } 1056*7836SJohn.Forte@Sun.COM 1057*7836SJohn.Forte@Sun.COM 1058*7836SJohn.Forte@Sun.COM 1059*7836SJohn.Forte@Sun.COM /* 1060*7836SJohn.Forte@Sun.COM * Gets the properties of the specified iSCSI node. 1061*7836SJohn.Forte@Sun.COM * @param nodeId The ID of the node to get the properties of. 1062*7836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_NODE_PROPERTIES structure 1063*7836SJohn.Forte@Sun.COM * which on successfully return 1064*7836SJohn.Forte@Sun.COM * will contain the properties of the specified node. 1065*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or 1066*7836SJohn.Forte@Sun.COM * if an error occurred. 1067*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the node properties have been 1068*7836SJohn.Forte@Sun.COM * successfully retrieved. 1069*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL 1070*7836SJohn.Forte@Sun.COM * or specifies a memory area to which data cannot be written. 1071*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does 1072*7836SJohn.Forte@Sun.COM * not specify any valid object type. 1073*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does 1074*7836SJohn.Forte@Sun.COM * not specify a node object. 1075*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not 1076*7836SJohn.Forte@Sun.COM * specify a node which is currently known to the system. 1077*7836SJohn.Forte@Sun.COM */ 1078*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetNodeProperties( 1079*7836SJohn.Forte@Sun.COM IMA_OID nodeOid, 1080*7836SJohn.Forte@Sun.COM IMA_NODE_PROPERTIES *pProps) { 1081*7836SJohn.Forte@Sun.COM IMA_GetNodePropertiesFn PassFunc; 1082*7836SJohn.Forte@Sun.COM IMA_UINT i; 1083*7836SJohn.Forte@Sun.COM IMA_STATUS status; 1084*7836SJohn.Forte@Sun.COM char fullline[512]; /* Full line read in from IMA.conf */ 1085*7836SJohn.Forte@Sun.COM char nodename[256]; 1086*7836SJohn.Forte@Sun.COM IMA_UINT dwStrLength; 1087*7836SJohn.Forte@Sun.COM 1088*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 1089*7836SJohn.Forte@Sun.COM InitLibrary(); 1090*7836SJohn.Forte@Sun.COM 1091*7836SJohn.Forte@Sun.COM if (pProps == NULL) 1092*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1093*7836SJohn.Forte@Sun.COM 1094*7836SJohn.Forte@Sun.COM if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE) 1095*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 1096*7836SJohn.Forte@Sun.COM 1097*7836SJohn.Forte@Sun.COM if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) && 1098*7836SJohn.Forte@Sun.COM (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) { 1099*7836SJohn.Forte@Sun.COM pProps->runningInInitiatorMode = IMA_TRUE; 1100*7836SJohn.Forte@Sun.COM pProps->runningInTargetMode = IMA_TRUE; 1101*7836SJohn.Forte@Sun.COM pProps->nameAndAliasSettable = IMA_TRUE; 1102*7836SJohn.Forte@Sun.COM 1103*7836SJohn.Forte@Sun.COM if (sharedNodeName[0] == 0) { 1104*7836SJohn.Forte@Sun.COM #if defined(_WINDOWS) 1105*7836SJohn.Forte@Sun.COM GetComputerName((char *)fullline, 1106*7836SJohn.Forte@Sun.COM (LPDWORD)&dwStrLength); 1107*7836SJohn.Forte@Sun.COM sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, fullline); 1108*7836SJohn.Forte@Sun.COM MultiByteToWideChar(CP_ACP, 0, nodename, -1, 1109*7836SJohn.Forte@Sun.COM sharedNodeName, 256); 1110*7836SJohn.Forte@Sun.COM #elif defined(SOLARIS) 1111*7836SJohn.Forte@Sun.COM 1112*7836SJohn.Forte@Sun.COM if (getSolarisSharedNodeName(sharedNodeName) != 1113*7836SJohn.Forte@Sun.COM IMA_STATUS_SUCCESS) { 1114*7836SJohn.Forte@Sun.COM gethostname((char *)fullline, &dwStrLength); 1115*7836SJohn.Forte@Sun.COM sprintf(nodename, 1116*7836SJohn.Forte@Sun.COM DEFAULT_NODE_NAME_FORMAT, fullline); 1117*7836SJohn.Forte@Sun.COM mbstowcs(sharedNodeName, nodename, 256); 1118*7836SJohn.Forte@Sun.COM } 1119*7836SJohn.Forte@Sun.COM #else 1120*7836SJohn.Forte@Sun.COM gethostname((char *)fullline, &dwStrLength); 1121*7836SJohn.Forte@Sun.COM sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, fullline); 1122*7836SJohn.Forte@Sun.COM mbstowcs(sharedNodeName, nodename, 256); 1123*7836SJohn.Forte@Sun.COM #endif 1124*7836SJohn.Forte@Sun.COM } 1125*7836SJohn.Forte@Sun.COM 1126*7836SJohn.Forte@Sun.COM if (sharedNodeName[0] != 0) { 1127*7836SJohn.Forte@Sun.COM libSwprintf(pProps->name, L"%ls", sharedNodeName); 1128*7836SJohn.Forte@Sun.COM pProps->nameValid = IMA_TRUE; 1129*7836SJohn.Forte@Sun.COM } 1130*7836SJohn.Forte@Sun.COM else 1131*7836SJohn.Forte@Sun.COM pProps->nameValid = IMA_FALSE; 1132*7836SJohn.Forte@Sun.COM 1133*7836SJohn.Forte@Sun.COM #if defined(SOLARIS) 1134*7836SJohn.Forte@Sun.COM if (sharedNodeAlias[0] == 0) { 1135*7836SJohn.Forte@Sun.COM getSolarisSharedNodeAlias(sharedNodeAlias); 1136*7836SJohn.Forte@Sun.COM } 1137*7836SJohn.Forte@Sun.COM #endif 1138*7836SJohn.Forte@Sun.COM 1139*7836SJohn.Forte@Sun.COM if (sharedNodeAlias[0] != 0) { 1140*7836SJohn.Forte@Sun.COM libSwprintf(pProps->alias, L"%ls", sharedNodeAlias); 1141*7836SJohn.Forte@Sun.COM pProps->aliasValid = IMA_TRUE; 1142*7836SJohn.Forte@Sun.COM } 1143*7836SJohn.Forte@Sun.COM else 1144*7836SJohn.Forte@Sun.COM pProps->aliasValid = IMA_FALSE; 1145*7836SJohn.Forte@Sun.COM 1146*7836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 1147*7836SJohn.Forte@Sun.COM } 1148*7836SJohn.Forte@Sun.COM 1149*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1150*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 1151*7836SJohn.Forte@Sun.COM 1152*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1153*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == nodeOid.ownerId) { 1154*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1155*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1156*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1157*7836SJohn.Forte@Sun.COM #ifdef WIN32 1158*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNodePropertiesFn) 1159*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1160*7836SJohn.Forte@Sun.COM "IMA_GetNodeProperties"); 1161*7836SJohn.Forte@Sun.COM #else 1162*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNodePropertiesFn) 1163*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1164*7836SJohn.Forte@Sun.COM "IMA_GetNodeProperties"); 1165*7836SJohn.Forte@Sun.COM #endif 1166*7836SJohn.Forte@Sun.COM 1167*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1168*7836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, pProps); 1169*7836SJohn.Forte@Sun.COM } 1170*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1171*7836SJohn.Forte@Sun.COM } 1172*7836SJohn.Forte@Sun.COM 1173*7836SJohn.Forte@Sun.COM break; 1174*7836SJohn.Forte@Sun.COM } 1175*7836SJohn.Forte@Sun.COM } 1176*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1177*7836SJohn.Forte@Sun.COM return (status); 1178*7836SJohn.Forte@Sun.COM 1179*7836SJohn.Forte@Sun.COM } 1180*7836SJohn.Forte@Sun.COM 1181*7836SJohn.Forte@Sun.COM 1182*7836SJohn.Forte@Sun.COM 1183*7836SJohn.Forte@Sun.COM 1184*7836SJohn.Forte@Sun.COM /* 1185*7836SJohn.Forte@Sun.COM * Sets the name of the specified node. 1186*7836SJohn.Forte@Sun.COM * 1187*7836SJohn.Forte@Sun.COM * @param nodeId The object ID of the node whose name is being set. 1188*7836SJohn.Forte@Sun.COM * @param newName The new name of the node. 1189*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 1190*7836SJohn.Forte@Sun.COM * an error occurred. 1191*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the node name was successfully changed. 1192*7836SJohn.Forte@Sun.COM * @retval IMA_STATUS_REBOOT_NECESSARY Returned if a reboot is necessary 1193*7836SJohn.Forte@Sun.COM * before the setting of the name actually takes affect. 1194*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a newname is NULL, or 1195*7836SJohn.Forte@Sun.COM * specifies a memory area to which data cannot be written, or has a 1196*7836SJohn.Forte@Sun.COM * length of 0. 1197*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does not 1198*7836SJohn.Forte@Sun.COM * specify any valid object type. 1199*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does not 1200*7836SJohn.Forte@Sun.COM * specify a node object. 1201*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not specify a 1202*7836SJohn.Forte@Sun.COM * node which is currently known to the system. 1203*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_NAME_TOO_LONG Returned if @a newName contains too many 1204*7836SJohn.Forte@Sun.COM * characters. 1205*7836SJohn.Forte@Sun.COM */ 1206*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetNodeName( 1207*7836SJohn.Forte@Sun.COM IMA_OID nodeOid, 1208*7836SJohn.Forte@Sun.COM const IMA_NODE_NAME newName) { 1209*7836SJohn.Forte@Sun.COM IMA_SetNodeNameFn PassFunc; 1210*7836SJohn.Forte@Sun.COM IMA_UINT i; 1211*7836SJohn.Forte@Sun.COM IMA_STATUS status; 1212*7836SJohn.Forte@Sun.COM 1213*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 1214*7836SJohn.Forte@Sun.COM InitLibrary(); 1215*7836SJohn.Forte@Sun.COM 1216*7836SJohn.Forte@Sun.COM if (newName == NULL || wcslen(newName) == 0) 1217*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1218*7836SJohn.Forte@Sun.COM 1219*7836SJohn.Forte@Sun.COM if (wcslen(newName) > IMA_NODE_NAME_LEN - 1) 1220*7836SJohn.Forte@Sun.COM return (IMA_ERROR_NAME_TOO_LONG); 1221*7836SJohn.Forte@Sun.COM 1222*7836SJohn.Forte@Sun.COM if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE) 1223*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 1224*7836SJohn.Forte@Sun.COM 1225*7836SJohn.Forte@Sun.COM if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) && 1226*7836SJohn.Forte@Sun.COM (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) { 1227*7836SJohn.Forte@Sun.COM #if defined(SOLARIS) 1228*7836SJohn.Forte@Sun.COM if (setSolarisSharedNodeName(newName) != IMA_STATUS_SUCCESS) { 1229*7836SJohn.Forte@Sun.COM return (IMA_ERROR_UNKNOWN_ERROR); 1230*7836SJohn.Forte@Sun.COM } 1231*7836SJohn.Forte@Sun.COM #endif 1232*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1233*7836SJohn.Forte@Sun.COM libSwprintf(sharedNodeName, L"%ls", newName); 1234*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1235*7836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 1236*7836SJohn.Forte@Sun.COM } 1237*7836SJohn.Forte@Sun.COM 1238*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1239*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 1240*7836SJohn.Forte@Sun.COM 1241*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1242*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == nodeOid.ownerId) { 1243*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1244*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1245*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1246*7836SJohn.Forte@Sun.COM #ifdef WIN32 1247*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetNodeNameFn) 1248*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1249*7836SJohn.Forte@Sun.COM "IMA_SetNodeName"); 1250*7836SJohn.Forte@Sun.COM #else 1251*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetNodeNameFn) 1252*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1253*7836SJohn.Forte@Sun.COM "IMA_SetNodeName"); 1254*7836SJohn.Forte@Sun.COM #endif 1255*7836SJohn.Forte@Sun.COM 1256*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1257*7836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, newName); 1258*7836SJohn.Forte@Sun.COM } 1259*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1260*7836SJohn.Forte@Sun.COM } 1261*7836SJohn.Forte@Sun.COM 1262*7836SJohn.Forte@Sun.COM break; 1263*7836SJohn.Forte@Sun.COM } 1264*7836SJohn.Forte@Sun.COM } 1265*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1266*7836SJohn.Forte@Sun.COM return (status); 1267*7836SJohn.Forte@Sun.COM 1268*7836SJohn.Forte@Sun.COM } 1269*7836SJohn.Forte@Sun.COM 1270*7836SJohn.Forte@Sun.COM 1271*7836SJohn.Forte@Sun.COM 1272*7836SJohn.Forte@Sun.COM 1273*7836SJohn.Forte@Sun.COM /* 1274*7836SJohn.Forte@Sun.COM * Generates an unique node name for the currently running system. 1275*7836SJohn.Forte@Sun.COM * 1276*7836SJohn.Forte@Sun.COM * @param generatedname On successful return contains the generated node 1277*7836SJohn.Forte@Sun.COM * name. 1278*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 1279*7836SJohn.Forte@Sun.COM * an error occurred. 1280*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a generatedname is NULL 1281*7836SJohn.Forte@Sun.COM * or specifies a memory area to which data cannot be written. 1282*7836SJohn.Forte@Sun.COM */ 1283*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GenerateNodeName( 1284*7836SJohn.Forte@Sun.COM IMA_NODE_NAME generatedname) { 1285*7836SJohn.Forte@Sun.COM char computername[256]; 1286*7836SJohn.Forte@Sun.COM char nodename[256]; 1287*7836SJohn.Forte@Sun.COM IMA_UINT dwStrLength; 1288*7836SJohn.Forte@Sun.COM #ifndef _WINDOWS 1289*7836SJohn.Forte@Sun.COM #ifndef SOLARIS 1290*7836SJohn.Forte@Sun.COM int i; 1291*7836SJohn.Forte@Sun.COM #endif 1292*7836SJohn.Forte@Sun.COM #endif 1293*7836SJohn.Forte@Sun.COM 1294*7836SJohn.Forte@Sun.COM dwStrLength = 255; 1295*7836SJohn.Forte@Sun.COM 1296*7836SJohn.Forte@Sun.COM if (generatedname == NULL) 1297*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1298*7836SJohn.Forte@Sun.COM 1299*7836SJohn.Forte@Sun.COM #if defined(_WINDOWS) 1300*7836SJohn.Forte@Sun.COM GetComputerName((char *)computername, (LPDWORD)&dwStrLength); 1301*7836SJohn.Forte@Sun.COM _strlwr(computername); 1302*7836SJohn.Forte@Sun.COM _snprintf(nodename, 256, DEFAULT_NODE_NAME_FORMAT, computername); 1303*7836SJohn.Forte@Sun.COM MultiByteToWideChar(CP_ACP, 0, nodename, -1, 1304*7836SJohn.Forte@Sun.COM generatedname, 256); 1305*7836SJohn.Forte@Sun.COM #elif defined(SOLARIS) 1306*7836SJohn.Forte@Sun.COM if (getSolarisSharedNodeName(generatedname) != IMA_STATUS_SUCCESS) { 1307*7836SJohn.Forte@Sun.COM gethostname(computername, &dwStrLength); 1308*7836SJohn.Forte@Sun.COM sprintf(nodename, DEFAULT_NODE_NAME_FORMAT, generatedname); 1309*7836SJohn.Forte@Sun.COM mbstowcs(generatedname, nodename, 256); 1310*7836SJohn.Forte@Sun.COM } 1311*7836SJohn.Forte@Sun.COM #else 1312*7836SJohn.Forte@Sun.COM gethostname((char *)computername, &dwStrLength); 1313*7836SJohn.Forte@Sun.COM i = 0; 1314*7836SJohn.Forte@Sun.COM while (computername[i] != '\0') { 1315*7836SJohn.Forte@Sun.COM computername[i] = tolower(computername[i]); 1316*7836SJohn.Forte@Sun.COM i++; 1317*7836SJohn.Forte@Sun.COM } 1318*7836SJohn.Forte@Sun.COM snprintf(nodename, 256, DEFAULT_NODE_NAME_FORMAT, computername); 1319*7836SJohn.Forte@Sun.COM mbstowcs(generatedname, nodename, 256); 1320*7836SJohn.Forte@Sun.COM #endif 1321*7836SJohn.Forte@Sun.COM 1322*7836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 1323*7836SJohn.Forte@Sun.COM } 1324*7836SJohn.Forte@Sun.COM 1325*7836SJohn.Forte@Sun.COM 1326*7836SJohn.Forte@Sun.COM /* 1327*7836SJohn.Forte@Sun.COM * Sets the alias of the specified node. 1328*7836SJohn.Forte@Sun.COM * 1329*7836SJohn.Forte@Sun.COM * @param nodeId The object ID of the node whose alias is being set. 1330*7836SJohn.Forte@Sun.COM * @param newAlias A pointer to a Unicode string which contains the new node 1331*7836SJohn.Forte@Sun.COM * alias.If this parameter is NULL then the current alias is deleted, in 1332*7836SJohn.Forte@Sun.COM * which case the specified node no longer has an alias. 1333*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 1334*7836SJohn.Forte@Sun.COM * an error occurred. 1335*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the node's alias has been successfully set. 1336*7836SJohn.Forte@Sun.COM * @retval IMA_STATUS_REBOOT_NECESSARY A reboot is necessary before 1337*7836SJohn.Forte@Sun.COM * the setting of the 1338*7836SJohn.Forte@Sun.COM * alias actually takes affect. 1339*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a nodeId does not 1340*7836SJohn.Forte@Sun.COM * specify any valid object type. 1341*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a nodeId does not 1342*7836SJohn.Forte@Sun.COM * specify a node object. 1343*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a nodeId does not specify 1344*7836SJohn.Forte@Sun.COM * a node which is currently known to the system. 1345*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_NAME_TOO_LONG Returned if @a newAlias contains too many 1346*7836SJohn.Forte@Sun.COM * characters. 1347*7836SJohn.Forte@Sun.COM */ 1348*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetNodeAlias( 1349*7836SJohn.Forte@Sun.COM IMA_OID nodeOid, 1350*7836SJohn.Forte@Sun.COM const IMA_NODE_ALIAS newAlias) { 1351*7836SJohn.Forte@Sun.COM IMA_SetNodeAliasFn PassFunc; 1352*7836SJohn.Forte@Sun.COM IMA_UINT i; 1353*7836SJohn.Forte@Sun.COM IMA_STATUS status; 1354*7836SJohn.Forte@Sun.COM 1355*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 1356*7836SJohn.Forte@Sun.COM InitLibrary(); 1357*7836SJohn.Forte@Sun.COM 1358*7836SJohn.Forte@Sun.COM if (newAlias == NULL) 1359*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1360*7836SJohn.Forte@Sun.COM 1361*7836SJohn.Forte@Sun.COM if (wcslen(newAlias) > IMA_NODE_ALIAS_LEN - 1) 1362*7836SJohn.Forte@Sun.COM return (IMA_ERROR_NAME_TOO_LONG); 1363*7836SJohn.Forte@Sun.COM 1364*7836SJohn.Forte@Sun.COM if (nodeOid.objectType != IMA_OBJECT_TYPE_NODE) 1365*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 1366*7836SJohn.Forte@Sun.COM 1367*7836SJohn.Forte@Sun.COM if ((nodeOid.ownerId == RL_LIBRARY_SEQNUM) && 1368*7836SJohn.Forte@Sun.COM (nodeOid.objectSequenceNumber == RL_SHARED_NODE_SEQNUM)) { 1369*7836SJohn.Forte@Sun.COM #if defined(SOLARIS) 1370*7836SJohn.Forte@Sun.COM if (setSolarisSharedNodeAlias(newAlias) != IMA_STATUS_SUCCESS) { 1371*7836SJohn.Forte@Sun.COM return (IMA_ERROR_UNKNOWN_ERROR); 1372*7836SJohn.Forte@Sun.COM } 1373*7836SJohn.Forte@Sun.COM #endif 1374*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1375*7836SJohn.Forte@Sun.COM if (wcslen(newAlias) > 0 && newAlias != NULL) 1376*7836SJohn.Forte@Sun.COM libSwprintf(sharedNodeAlias, L"%ls", newAlias); 1377*7836SJohn.Forte@Sun.COM else 1378*7836SJohn.Forte@Sun.COM libSwprintf(sharedNodeAlias, L"%ls", ""); 1379*7836SJohn.Forte@Sun.COM 1380*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1381*7836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 1382*7836SJohn.Forte@Sun.COM } 1383*7836SJohn.Forte@Sun.COM 1384*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1385*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 1386*7836SJohn.Forte@Sun.COM 1387*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1388*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == nodeOid.ownerId) { 1389*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1390*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1391*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1392*7836SJohn.Forte@Sun.COM #ifdef WIN32 1393*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetNodeAliasFn) 1394*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1395*7836SJohn.Forte@Sun.COM "IMA_SetNodeAlias"); 1396*7836SJohn.Forte@Sun.COM #else 1397*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetNodeAliasFn) 1398*7836SJohn.Forte@Sun.COM dlsym( 1399*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 1400*7836SJohn.Forte@Sun.COM "IMA_SetNodeAlias"); 1401*7836SJohn.Forte@Sun.COM #endif 1402*7836SJohn.Forte@Sun.COM 1403*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1404*7836SJohn.Forte@Sun.COM status = PassFunc(nodeOid, newAlias); 1405*7836SJohn.Forte@Sun.COM } 1406*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1407*7836SJohn.Forte@Sun.COM } 1408*7836SJohn.Forte@Sun.COM 1409*7836SJohn.Forte@Sun.COM break; 1410*7836SJohn.Forte@Sun.COM } 1411*7836SJohn.Forte@Sun.COM } 1412*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1413*7836SJohn.Forte@Sun.COM return (status); 1414*7836SJohn.Forte@Sun.COM } 1415*7836SJohn.Forte@Sun.COM 1416*7836SJohn.Forte@Sun.COM 1417*7836SJohn.Forte@Sun.COM 1418*7836SJohn.Forte@Sun.COM 1419*7836SJohn.Forte@Sun.COM /* 1420*7836SJohn.Forte@Sun.COM * Gets a list of the object IDs of all the logical HBAs in the system. 1421*7836SJohn.Forte@Sun.COM * 1422*7836SJohn.Forte@Sun.COM * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST structure. 1423*7836SJohn.Forte@Sun.COM * on successful return this will contain a pointer to an 1424*7836SJohn.Forte@Sun.COM * @ref IMA_OID_LIST which contains the object IDs of all of the 1425*7836SJohn.Forte@Sun.COM * LHBAs currently in the system. 1426*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 1427*7836SJohn.Forte@Sun.COM * an error occurred. 1428*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the LHBA ID list has been successfully 1429*7836SJohn.Forte@Sun.COM * returned. 1430*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or 1431*7836SJohn.Forte@Sun.COM * specifies a 1432*7836SJohn.Forte@Sun.COM * memory area to which data cannot be written. 1433*7836SJohn.Forte@Sun.COM */ 1434*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLhbaOidList( 1435*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 1436*7836SJohn.Forte@Sun.COM IMA_GetLhbaOidListFn PassFunc; 1437*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 1438*7836SJohn.Forte@Sun.COM 1439*7836SJohn.Forte@Sun.COM IMA_UINT i; 1440*7836SJohn.Forte@Sun.COM IMA_UINT j; 1441*7836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 1442*7836SJohn.Forte@Sun.COM IMA_STATUS status; 1443*7836SJohn.Forte@Sun.COM 1444*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 1445*7836SJohn.Forte@Sun.COM InitLibrary(); 1446*7836SJohn.Forte@Sun.COM 1447*7836SJohn.Forte@Sun.COM if (ppList == NULL) 1448*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1449*7836SJohn.Forte@Sun.COM 1450*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1451*7836SJohn.Forte@Sun.COM // Get total id count first 1452*7836SJohn.Forte@Sun.COM totalIdCount = 0; 1453*7836SJohn.Forte@Sun.COM 1454*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1455*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1456*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1457*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1458*7836SJohn.Forte@Sun.COM #ifdef WIN32 1459*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaOidListFn) 1460*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1461*7836SJohn.Forte@Sun.COM "IMA_GetLhbaOidList"); 1462*7836SJohn.Forte@Sun.COM #else 1463*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaOidListFn) 1464*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1465*7836SJohn.Forte@Sun.COM "IMA_GetLhbaOidList"); 1466*7836SJohn.Forte@Sun.COM #endif 1467*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1468*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 1469*7836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 1470*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 1471*7836SJohn.Forte@Sun.COM totalIdCount += ppOidList->oidCount; 1472*7836SJohn.Forte@Sun.COM #ifdef WIN32 1473*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 1474*7836SJohn.Forte@Sun.COM GetProcAddress( 1475*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 1476*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 1477*7836SJohn.Forte@Sun.COM #else 1478*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 1479*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1480*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 1481*7836SJohn.Forte@Sun.COM #endif 1482*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 1483*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 1484*7836SJohn.Forte@Sun.COM } 1485*7836SJohn.Forte@Sun.COM } 1486*7836SJohn.Forte@Sun.COM 1487*7836SJohn.Forte@Sun.COM } 1488*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1489*7836SJohn.Forte@Sun.COM } 1490*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 1491*7836SJohn.Forte@Sun.COM break; 1492*7836SJohn.Forte@Sun.COM } 1493*7836SJohn.Forte@Sun.COM } 1494*7836SJohn.Forte@Sun.COM 1495*7836SJohn.Forte@Sun.COM 1496*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 1497*7836SJohn.Forte@Sun.COM (totalIdCount - 1) * sizeof (IMA_OID)); 1498*7836SJohn.Forte@Sun.COM 1499*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 1500*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1501*7836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 1502*7836SJohn.Forte@Sun.COM } 1503*7836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 1504*7836SJohn.Forte@Sun.COM 1505*7836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 1506*7836SJohn.Forte@Sun.COM totalIdCount = 0; 1507*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 1508*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1509*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1510*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1511*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1512*7836SJohn.Forte@Sun.COM #ifdef WIN32 1513*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaOidListFn) 1514*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1515*7836SJohn.Forte@Sun.COM "IMA_GetLhbaOidList"); 1516*7836SJohn.Forte@Sun.COM #else 1517*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaOidListFn) 1518*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1519*7836SJohn.Forte@Sun.COM "IMA_GetLhbaOidList"); 1520*7836SJohn.Forte@Sun.COM #endif 1521*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1522*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 1523*7836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 1524*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 1525*7836SJohn.Forte@Sun.COM for (j = 0; 1526*7836SJohn.Forte@Sun.COM (j < ppOidList->oidCount) && 1527*7836SJohn.Forte@Sun.COM (totalIdCount < 1528*7836SJohn.Forte@Sun.COM (*ppList)->oidCount); 1529*7836SJohn.Forte@Sun.COM j++) { 1530*7836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 1531*7836SJohn.Forte@Sun.COM objectType 1532*7836SJohn.Forte@Sun.COM = ppOidList->oids[j]. 1533*7836SJohn.Forte@Sun.COM objectType; 1534*7836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 1535*7836SJohn.Forte@Sun.COM objectSequenceNumber = 1536*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 1537*7836SJohn.Forte@Sun.COM objectSequenceNumber; 1538*7836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 1539*7836SJohn.Forte@Sun.COM ownerId = 1540*7836SJohn.Forte@Sun.COM ppOidList->oids[j].ownerId; 1541*7836SJohn.Forte@Sun.COM totalIdCount++; 1542*7836SJohn.Forte@Sun.COM } 1543*7836SJohn.Forte@Sun.COM #ifdef WIN32 1544*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 1545*7836SJohn.Forte@Sun.COM GetProcAddress( 1546*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 1547*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 1548*7836SJohn.Forte@Sun.COM #else 1549*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 1550*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1551*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 1552*7836SJohn.Forte@Sun.COM #endif 1553*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 1554*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 1555*7836SJohn.Forte@Sun.COM } 1556*7836SJohn.Forte@Sun.COM } 1557*7836SJohn.Forte@Sun.COM } 1558*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1559*7836SJohn.Forte@Sun.COM } 1560*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 1561*7836SJohn.Forte@Sun.COM free(*ppList); 1562*7836SJohn.Forte@Sun.COM break; 1563*7836SJohn.Forte@Sun.COM } 1564*7836SJohn.Forte@Sun.COM 1565*7836SJohn.Forte@Sun.COM } 1566*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1567*7836SJohn.Forte@Sun.COM return (status); 1568*7836SJohn.Forte@Sun.COM } 1569*7836SJohn.Forte@Sun.COM 1570*7836SJohn.Forte@Sun.COM 1571*7836SJohn.Forte@Sun.COM 1572*7836SJohn.Forte@Sun.COM 1573*7836SJohn.Forte@Sun.COM /* 1574*7836SJohn.Forte@Sun.COM * Gets the properties of the specified logical HBA. 1575*7836SJohn.Forte@Sun.COM * 1576*7836SJohn.Forte@Sun.COM * @param lhbaId The object ID of the LHBA whose properties are being 1577*7836SJohn.Forte@Sun.COM * retrieved. 1578*7836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_LHBA_PROPERTIES structure. 1579*7836SJohn.Forte@Sun.COM * On successful 1580*7836SJohn.Forte@Sun.COM * return this will contain the properties of the LHBA specified by 1581*7836SJohn.Forte@Sun.COM * @a lhbaId. 1582*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 1583*7836SJohn.Forte@Sun.COM * an error occurred. 1584*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the properties of the specified LHBA 1585*7836SJohn.Forte@Sun.COM * have been successfully retrieved. 1586*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a pProps is NULL or 1587*7836SJohn.Forte@Sun.COM * specify a memory area to which data cannot be written. 1588*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if @a lhbaId does not 1589*7836SJohn.Forte@Sun.COM * specify any valid object type. 1590*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if @a lhbaId does not 1591*7836SJohn.Forte@Sun.COM * specify a LHBA. 1592*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a lhbaId does not 1593*7836SJohn.Forte@Sun.COM * specify a LHBA which is currently known to the system. 1594*7836SJohn.Forte@Sun.COM */ 1595*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLhbaProperties( 1596*7836SJohn.Forte@Sun.COM IMA_OID lhbaId, 1597*7836SJohn.Forte@Sun.COM IMA_LHBA_PROPERTIES *pProps) { 1598*7836SJohn.Forte@Sun.COM IMA_GetLhbaPropertiesFn PassFunc; 1599*7836SJohn.Forte@Sun.COM IMA_UINT i; 1600*7836SJohn.Forte@Sun.COM IMA_STATUS status; 1601*7836SJohn.Forte@Sun.COM 1602*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 1603*7836SJohn.Forte@Sun.COM InitLibrary(); 1604*7836SJohn.Forte@Sun.COM 1605*7836SJohn.Forte@Sun.COM if (pProps == NULL) 1606*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1607*7836SJohn.Forte@Sun.COM 1608*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA) 1609*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 1610*7836SJohn.Forte@Sun.COM 1611*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1612*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 1613*7836SJohn.Forte@Sun.COM 1614*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1615*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 1616*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1617*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1618*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1619*7836SJohn.Forte@Sun.COM #ifdef WIN32 1620*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaPropertiesFn) 1621*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1622*7836SJohn.Forte@Sun.COM "IMA_GetLhbaProperties"); 1623*7836SJohn.Forte@Sun.COM #else 1624*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLhbaPropertiesFn) 1625*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1626*7836SJohn.Forte@Sun.COM "IMA_GetLhbaProperties"); 1627*7836SJohn.Forte@Sun.COM #endif 1628*7836SJohn.Forte@Sun.COM 1629*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1630*7836SJohn.Forte@Sun.COM status = PassFunc(lhbaId, pProps); 1631*7836SJohn.Forte@Sun.COM } 1632*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1633*7836SJohn.Forte@Sun.COM } 1634*7836SJohn.Forte@Sun.COM 1635*7836SJohn.Forte@Sun.COM break; 1636*7836SJohn.Forte@Sun.COM } 1637*7836SJohn.Forte@Sun.COM } 1638*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1639*7836SJohn.Forte@Sun.COM return (status); 1640*7836SJohn.Forte@Sun.COM } 1641*7836SJohn.Forte@Sun.COM 1642*7836SJohn.Forte@Sun.COM 1643*7836SJohn.Forte@Sun.COM 1644*7836SJohn.Forte@Sun.COM 1645*7836SJohn.Forte@Sun.COM /* 1646*7836SJohn.Forte@Sun.COM * Gets a list of the object IDs of all the physical HBAs in the system. 1647*7836SJohn.Forte@Sun.COM * 1648*7836SJohn.Forte@Sun.COM * @param ppList A pointer to a pointer to an @ref IMA_OID_LIST structure. 1649*7836SJohn.Forte@Sun.COM * on successful return this will contain a pointer to an 1650*7836SJohn.Forte@Sun.COM * @ref IMA_OID_LIST which contains the object IDs of all of the 1651*7836SJohn.Forte@Sun.COM * PHBAs currently in the system. 1652*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation was successful or if 1653*7836SJohn.Forte@Sun.COM * an error occurred. 1654*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the PHBA ID list has been successfully 1655*7836SJohn.Forte@Sun.COM * returned. 1656*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or 1657*7836SJohn.Forte@Sun.COM * specify a memory area to which data cannot be written. 1658*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the properties of the specified PHBA 1659*7836SJohn.Forte@Sun.COM * have been successfully retrieved. 1660*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a phbaId does not 1661*7836SJohn.Forte@Sun.COM * specify a PHBA which is currently known to the system. 1662*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if @a ppList is NULL or 1663*7836SJohn.Forte@Sun.COM * specify a memory area to which data cannot be written. 1664*7836SJohn.Forte@Sun.COM */ 1665*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPhbaOidList( 1666*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 1667*7836SJohn.Forte@Sun.COM IMA_GetPhbaOidListFn PassFunc; 1668*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 1669*7836SJohn.Forte@Sun.COM 1670*7836SJohn.Forte@Sun.COM IMA_UINT i; 1671*7836SJohn.Forte@Sun.COM IMA_UINT j; 1672*7836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 1673*7836SJohn.Forte@Sun.COM IMA_STATUS status; 1674*7836SJohn.Forte@Sun.COM 1675*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 1676*7836SJohn.Forte@Sun.COM InitLibrary(); 1677*7836SJohn.Forte@Sun.COM 1678*7836SJohn.Forte@Sun.COM if (ppList == NULL) 1679*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1680*7836SJohn.Forte@Sun.COM 1681*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1682*7836SJohn.Forte@Sun.COM // Get total id count first 1683*7836SJohn.Forte@Sun.COM totalIdCount = 0; 1684*7836SJohn.Forte@Sun.COM 1685*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1686*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1687*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1688*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1689*7836SJohn.Forte@Sun.COM #ifdef WIN32 1690*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaOidListFn) 1691*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1692*7836SJohn.Forte@Sun.COM "IMA_GetPhbaOidList"); 1693*7836SJohn.Forte@Sun.COM #else 1694*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaOidListFn) 1695*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1696*7836SJohn.Forte@Sun.COM "IMA_GetPhbaOidList"); 1697*7836SJohn.Forte@Sun.COM #endif 1698*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1699*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 1700*7836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 1701*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 1702*7836SJohn.Forte@Sun.COM totalIdCount += ppOidList->oidCount; 1703*7836SJohn.Forte@Sun.COM #ifdef WIN32 1704*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 1705*7836SJohn.Forte@Sun.COM GetProcAddress( 1706*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 1707*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 1708*7836SJohn.Forte@Sun.COM #else 1709*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 1710*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1711*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 1712*7836SJohn.Forte@Sun.COM #endif 1713*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 1714*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 1715*7836SJohn.Forte@Sun.COM } 1716*7836SJohn.Forte@Sun.COM } 1717*7836SJohn.Forte@Sun.COM } 1718*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1719*7836SJohn.Forte@Sun.COM } 1720*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 1721*7836SJohn.Forte@Sun.COM break; 1722*7836SJohn.Forte@Sun.COM } 1723*7836SJohn.Forte@Sun.COM 1724*7836SJohn.Forte@Sun.COM } 1725*7836SJohn.Forte@Sun.COM 1726*7836SJohn.Forte@Sun.COM 1727*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 1728*7836SJohn.Forte@Sun.COM (totalIdCount - 1) * sizeof (IMA_OID)); 1729*7836SJohn.Forte@Sun.COM 1730*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 1731*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1732*7836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 1733*7836SJohn.Forte@Sun.COM } 1734*7836SJohn.Forte@Sun.COM 1735*7836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 1736*7836SJohn.Forte@Sun.COM 1737*7836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 1738*7836SJohn.Forte@Sun.COM totalIdCount = 0; 1739*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 1740*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1741*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1742*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1743*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1744*7836SJohn.Forte@Sun.COM #ifdef WIN32 1745*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaOidListFn) 1746*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1747*7836SJohn.Forte@Sun.COM "IMA_GetPhbaOidList"); 1748*7836SJohn.Forte@Sun.COM #else 1749*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaOidListFn) 1750*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1751*7836SJohn.Forte@Sun.COM "IMA_GetPhbaOidList"); 1752*7836SJohn.Forte@Sun.COM #endif 1753*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1754*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 1755*7836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 1756*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 1757*7836SJohn.Forte@Sun.COM for (j = 0; 1758*7836SJohn.Forte@Sun.COM (j < ppOidList->oidCount) && 1759*7836SJohn.Forte@Sun.COM (totalIdCount < 1760*7836SJohn.Forte@Sun.COM (*ppList)->oidCount); 1761*7836SJohn.Forte@Sun.COM j++) { 1762*7836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 1763*7836SJohn.Forte@Sun.COM objectType = 1764*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 1765*7836SJohn.Forte@Sun.COM objectType; 1766*7836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 1767*7836SJohn.Forte@Sun.COM objectSequenceNumber = 1768*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 1769*7836SJohn.Forte@Sun.COM objectSequenceNumber; 1770*7836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 1771*7836SJohn.Forte@Sun.COM ownerId = 1772*7836SJohn.Forte@Sun.COM ppOidList->oids[j].ownerId; 1773*7836SJohn.Forte@Sun.COM totalIdCount++; 1774*7836SJohn.Forte@Sun.COM } 1775*7836SJohn.Forte@Sun.COM #ifdef WIN32 1776*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 1777*7836SJohn.Forte@Sun.COM GetProcAddress 1778*7836SJohn.Forte@Sun.COM (plugintable[i].hPlugin, 1779*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 1780*7836SJohn.Forte@Sun.COM #else 1781*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 1782*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1783*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 1784*7836SJohn.Forte@Sun.COM #endif 1785*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 1786*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 1787*7836SJohn.Forte@Sun.COM } 1788*7836SJohn.Forte@Sun.COM } 1789*7836SJohn.Forte@Sun.COM } 1790*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1791*7836SJohn.Forte@Sun.COM } 1792*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 1793*7836SJohn.Forte@Sun.COM free(*ppList); 1794*7836SJohn.Forte@Sun.COM break; 1795*7836SJohn.Forte@Sun.COM } 1796*7836SJohn.Forte@Sun.COM } 1797*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1798*7836SJohn.Forte@Sun.COM return (status); 1799*7836SJohn.Forte@Sun.COM } 1800*7836SJohn.Forte@Sun.COM 1801*7836SJohn.Forte@Sun.COM 1802*7836SJohn.Forte@Sun.COM /* 1803*7836SJohn.Forte@Sun.COM * Gets the general properties of a physical HBA. 1804*7836SJohn.Forte@Sun.COM * 1805*7836SJohn.Forte@Sun.COM * @param phbaId The object ID of the PHBA whose 1806*7836SJohn.Forte@Sun.COM * properties are being queried. 1807*7836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref 1808*7836SJohn.Forte@Sun.COM * IMA_PHBA_PROPERTIES structure. On successful 1809*7836SJohn.Forte@Sun.COM * return this will contain the properties of 1810*7836SJohn.Forte@Sun.COM * the PHBA specified by @a phbaId. 1811*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the 1812*7836SJohn.Forte@Sun.COM * operation was successful or if an error 1813*7836SJohn.Forte@Sun.COM * occurred. 1814*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the properties 1815*7836SJohn.Forte@Sun.COM * of the specified PHBA have been 1816*7836SJohn.Forte@Sun.COM * successfully retrieved. 1817*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned 1818*7836SJohn.Forte@Sun.COM * if @a pProps is NULL or specifies a 1819*7836SJohn.Forte@Sun.COM * memory area to which data cannot be written. 1820*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned 1821*7836SJohn.Forte@Sun.COM * if @a phbaId does not specify any 1822*7836SJohn.Forte@Sun.COM * valid object type. 1823*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned 1824*7836SJohn.Forte@Sun.COM * if @a phbaId does not specify a 1825*7836SJohn.Forte@Sun.COM * PHBA. 1826*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned 1827*7836SJohn.Forte@Sun.COM * if @a phbaId does not specify a PHBA 1828*7836SJohn.Forte@Sun.COM * which is currently known to the system. 1829*7836SJohn.Forte@Sun.COM */ 1830*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPhbaProperties( 1831*7836SJohn.Forte@Sun.COM IMA_OID phbaId, 1832*7836SJohn.Forte@Sun.COM IMA_PHBA_PROPERTIES *pProps) { 1833*7836SJohn.Forte@Sun.COM IMA_GetPhbaPropertiesFn PassFunc; 1834*7836SJohn.Forte@Sun.COM IMA_UINT i; 1835*7836SJohn.Forte@Sun.COM IMA_STATUS status; 1836*7836SJohn.Forte@Sun.COM 1837*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 1838*7836SJohn.Forte@Sun.COM InitLibrary(); 1839*7836SJohn.Forte@Sun.COM 1840*7836SJohn.Forte@Sun.COM if (pProps == NULL) 1841*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1842*7836SJohn.Forte@Sun.COM 1843*7836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) 1844*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 1845*7836SJohn.Forte@Sun.COM 1846*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1847*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 1848*7836SJohn.Forte@Sun.COM 1849*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1850*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 1851*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1852*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1853*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1854*7836SJohn.Forte@Sun.COM #ifdef WIN32 1855*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaPropertiesFn) 1856*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1857*7836SJohn.Forte@Sun.COM "IMA_GetPhbaProperties"); 1858*7836SJohn.Forte@Sun.COM #else 1859*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaPropertiesFn) 1860*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1861*7836SJohn.Forte@Sun.COM "IMA_GetPhbaProperties"); 1862*7836SJohn.Forte@Sun.COM #endif 1863*7836SJohn.Forte@Sun.COM 1864*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1865*7836SJohn.Forte@Sun.COM status = PassFunc(phbaId, pProps); 1866*7836SJohn.Forte@Sun.COM } 1867*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1868*7836SJohn.Forte@Sun.COM } 1869*7836SJohn.Forte@Sun.COM 1870*7836SJohn.Forte@Sun.COM break; 1871*7836SJohn.Forte@Sun.COM } 1872*7836SJohn.Forte@Sun.COM } 1873*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1874*7836SJohn.Forte@Sun.COM return (status); 1875*7836SJohn.Forte@Sun.COM } 1876*7836SJohn.Forte@Sun.COM 1877*7836SJohn.Forte@Sun.COM /* 1878*7836SJohn.Forte@Sun.COM * Frees a previously allocated IMA_OID_LIST structure. 1879*7836SJohn.Forte@Sun.COM * 1880*7836SJohn.Forte@Sun.COM * @param pList A pointer to an @ref IMA_OID_LIST 1881*7836SJohn.Forte@Sun.COM * structure allocated by the 1882*7836SJohn.Forte@Sun.COM * library. On successful return the memory 1883*7836SJohn.Forte@Sun.COM * allocated by the list is freed. 1884*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation 1885*7836SJohn.Forte@Sun.COM * was successful or if an error occurred. 1886*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the specified object 1887*7836SJohn.Forte@Sun.COM * ID list was successfully freed. 1888*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned 1889*7836SJohn.Forte@Sun.COM * if @a pList is NULL or specifies a 1890*7836SJohn.Forte@Sun.COM * memory area from which data cannot be read. 1891*7836SJohn.Forte@Sun.COM */ 1892*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_FreeMemory( 1893*7836SJohn.Forte@Sun.COM void *pMemory) { 1894*7836SJohn.Forte@Sun.COM if (pMemory == NULL) 1895*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1896*7836SJohn.Forte@Sun.COM free(pMemory); 1897*7836SJohn.Forte@Sun.COM return (IMA_STATUS_SUCCESS); 1898*7836SJohn.Forte@Sun.COM } 1899*7836SJohn.Forte@Sun.COM 1900*7836SJohn.Forte@Sun.COM 1901*7836SJohn.Forte@Sun.COM 1902*7836SJohn.Forte@Sun.COM 1903*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetNonSharedNodeOidList( 1904*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 1905*7836SJohn.Forte@Sun.COM IMA_GetNonSharedNodeOidListFn PassFunc; 1906*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 1907*7836SJohn.Forte@Sun.COM 1908*7836SJohn.Forte@Sun.COM IMA_UINT i; 1909*7836SJohn.Forte@Sun.COM IMA_UINT j; 1910*7836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 1911*7836SJohn.Forte@Sun.COM IMA_STATUS status; 1912*7836SJohn.Forte@Sun.COM 1913*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 1914*7836SJohn.Forte@Sun.COM InitLibrary(); 1915*7836SJohn.Forte@Sun.COM 1916*7836SJohn.Forte@Sun.COM if (ppList == NULL) 1917*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 1918*7836SJohn.Forte@Sun.COM 1919*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 1920*7836SJohn.Forte@Sun.COM // Get total id count first 1921*7836SJohn.Forte@Sun.COM totalIdCount = 0; 1922*7836SJohn.Forte@Sun.COM 1923*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1924*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1925*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1926*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1927*7836SJohn.Forte@Sun.COM #ifdef WIN32 1928*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNonSharedNodeOidListFn) 1929*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1930*7836SJohn.Forte@Sun.COM "IMA_GetNonSharedNodeOidList"); 1931*7836SJohn.Forte@Sun.COM #else 1932*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNonSharedNodeOidListFn) 1933*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1934*7836SJohn.Forte@Sun.COM "IMA_GetNonSharedNodeOidList"); 1935*7836SJohn.Forte@Sun.COM #endif 1936*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1937*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 1938*7836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 1939*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 1940*7836SJohn.Forte@Sun.COM totalIdCount += ppOidList->oidCount; 1941*7836SJohn.Forte@Sun.COM #ifdef WIN32 1942*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 1943*7836SJohn.Forte@Sun.COM GetProcAddress( 1944*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 1945*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 1946*7836SJohn.Forte@Sun.COM #else 1947*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 1948*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1949*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 1950*7836SJohn.Forte@Sun.COM #endif 1951*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 1952*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 1953*7836SJohn.Forte@Sun.COM } 1954*7836SJohn.Forte@Sun.COM } 1955*7836SJohn.Forte@Sun.COM } 1956*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 1957*7836SJohn.Forte@Sun.COM } 1958*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 1959*7836SJohn.Forte@Sun.COM break; 1960*7836SJohn.Forte@Sun.COM } 1961*7836SJohn.Forte@Sun.COM 1962*7836SJohn.Forte@Sun.COM } 1963*7836SJohn.Forte@Sun.COM 1964*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 1965*7836SJohn.Forte@Sun.COM (totalIdCount - 1) * sizeof (IMA_OID)); 1966*7836SJohn.Forte@Sun.COM 1967*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 1968*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 1969*7836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 1970*7836SJohn.Forte@Sun.COM } 1971*7836SJohn.Forte@Sun.COM 1972*7836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 1973*7836SJohn.Forte@Sun.COM 1974*7836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 1975*7836SJohn.Forte@Sun.COM totalIdCount = 0; 1976*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 1977*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 1978*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 1979*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 1980*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 1981*7836SJohn.Forte@Sun.COM #ifdef WIN32 1982*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNonSharedNodeOidListFn) 1983*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 1984*7836SJohn.Forte@Sun.COM "IMA_GetNonSharedNodeOidList"); 1985*7836SJohn.Forte@Sun.COM #else 1986*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNonSharedNodeOidListFn) 1987*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 1988*7836SJohn.Forte@Sun.COM "IMA_GetNonSharedNodeOidList"); 1989*7836SJohn.Forte@Sun.COM #endif 1990*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 1991*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 1992*7836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 1993*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 1994*7836SJohn.Forte@Sun.COM for (j = 0; 1995*7836SJohn.Forte@Sun.COM (j < ppOidList->oidCount) && 1996*7836SJohn.Forte@Sun.COM (totalIdCount < ( 1997*7836SJohn.Forte@Sun.COM *ppList)->oidCount); 1998*7836SJohn.Forte@Sun.COM j++) { 1999*7836SJohn.Forte@Sun.COM (*ppList)->oids[ 2000*7836SJohn.Forte@Sun.COM totalIdCount].objectType = 2001*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 2002*7836SJohn.Forte@Sun.COM objectType; 2003*7836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 2004*7836SJohn.Forte@Sun.COM objectSequenceNumber = 2005*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 2006*7836SJohn.Forte@Sun.COM objectSequenceNumber; 2007*7836SJohn.Forte@Sun.COM (*ppList)->oids[ 2008*7836SJohn.Forte@Sun.COM totalIdCount]. 2009*7836SJohn.Forte@Sun.COM ownerId = 2010*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 2011*7836SJohn.Forte@Sun.COM ownerId; 2012*7836SJohn.Forte@Sun.COM totalIdCount++; 2013*7836SJohn.Forte@Sun.COM } 2014*7836SJohn.Forte@Sun.COM #ifdef WIN32 2015*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 2016*7836SJohn.Forte@Sun.COM GetProcAddress( 2017*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 2018*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 2019*7836SJohn.Forte@Sun.COM #else 2020*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 2021*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2022*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 2023*7836SJohn.Forte@Sun.COM #endif 2024*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 2025*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 2026*7836SJohn.Forte@Sun.COM } 2027*7836SJohn.Forte@Sun.COM } 2028*7836SJohn.Forte@Sun.COM } 2029*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2030*7836SJohn.Forte@Sun.COM } 2031*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 2032*7836SJohn.Forte@Sun.COM free(*ppList); 2033*7836SJohn.Forte@Sun.COM break; 2034*7836SJohn.Forte@Sun.COM } 2035*7836SJohn.Forte@Sun.COM } 2036*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2037*7836SJohn.Forte@Sun.COM return (status); 2038*7836SJohn.Forte@Sun.COM } 2039*7836SJohn.Forte@Sun.COM 2040*7836SJohn.Forte@Sun.COM 2041*7836SJohn.Forte@Sun.COM 2042*7836SJohn.Forte@Sun.COM /* 2043*7836SJohn.Forte@Sun.COM * Gets the first burst length properties of 2044*7836SJohn.Forte@Sun.COM * the specified logical HBA. 2045*7836SJohn.Forte@Sun.COM * 2046*7836SJohn.Forte@Sun.COM * @param lhbaId The object ID of the logical HBA 2047*7836SJohn.Forte@Sun.COM * to get the first burst length 2048*7836SJohn.Forte@Sun.COM * properties of. 2049*7836SJohn.Forte@Sun.COM * @param pProps A pointer to a min/max values 2050*7836SJohn.Forte@Sun.COM * structure. 2051*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation 2052*7836SJohn.Forte@Sun.COM * was successful or if an error 2053*7836SJohn.Forte@Sun.COM * occurred. 2054*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the first burst 2055*7836SJohn.Forte@Sun.COM * length properties have been 2056*7836SJohn.Forte@Sun.COM * successfully retrieved. 2057*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned 2058*7836SJohn.Forte@Sun.COM * if @a pProps is NULL or specifies a 2059*7836SJohn.Forte@Sun.COM * memory area to which data cannot be written. 2060*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned 2061*7836SJohn.Forte@Sun.COM * if @a lhbaId does not specify any 2062*7836SJohn.Forte@Sun.COM * valid object type. 2063*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned 2064*7836SJohn.Forte@Sun.COM * if @a lhbaId does not specify a LHBA. 2065*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned 2066*7836SJohn.Forte@Sun.COM * @a lhbaId does not specify a LHBA 2067*7836SJohn.Forte@Sun.COM * which is currently known to the system. 2068*7836SJohn.Forte@Sun.COM */ 2069*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetFirstBurstLengthProperties( 2070*7836SJohn.Forte@Sun.COM IMA_OID Oid, 2071*7836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 2072*7836SJohn.Forte@Sun.COM IMA_GetFirstBurstLengthPropertiesFn PassFunc; 2073*7836SJohn.Forte@Sun.COM IMA_UINT i; 2074*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2075*7836SJohn.Forte@Sun.COM 2076*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2077*7836SJohn.Forte@Sun.COM InitLibrary(); 2078*7836SJohn.Forte@Sun.COM 2079*7836SJohn.Forte@Sun.COM if (pProps == NULL) 2080*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 2081*7836SJohn.Forte@Sun.COM 2082*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 2083*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 2084*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2085*7836SJohn.Forte@Sun.COM 2086*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2087*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2088*7836SJohn.Forte@Sun.COM 2089*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2090*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 2091*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2092*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2093*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2094*7836SJohn.Forte@Sun.COM #ifdef WIN32 2095*7836SJohn.Forte@Sun.COM PassFunc = 2096*7836SJohn.Forte@Sun.COM (IMA_GetFirstBurstLengthPropertiesFn) 2097*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2098*7836SJohn.Forte@Sun.COM "IMA_GetFirstBurstLengthProperties"); 2099*7836SJohn.Forte@Sun.COM #else 2100*7836SJohn.Forte@Sun.COM PassFunc = 2101*7836SJohn.Forte@Sun.COM (IMA_GetFirstBurstLengthPropertiesFn) 2102*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2103*7836SJohn.Forte@Sun.COM "IMA_GetFirstBurstLengthProperties"); 2104*7836SJohn.Forte@Sun.COM #endif 2105*7836SJohn.Forte@Sun.COM 2106*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2107*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 2108*7836SJohn.Forte@Sun.COM } 2109*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2110*7836SJohn.Forte@Sun.COM } 2111*7836SJohn.Forte@Sun.COM 2112*7836SJohn.Forte@Sun.COM break; 2113*7836SJohn.Forte@Sun.COM } 2114*7836SJohn.Forte@Sun.COM } 2115*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2116*7836SJohn.Forte@Sun.COM return (status); 2117*7836SJohn.Forte@Sun.COM } 2118*7836SJohn.Forte@Sun.COM 2119*7836SJohn.Forte@Sun.COM /* 2120*7836SJohn.Forte@Sun.COM * Gets the max burst length properties of the 2121*7836SJohn.Forte@Sun.COM * specified logical HBA. 2122*7836SJohn.Forte@Sun.COM * 2123*7836SJohn.Forte@Sun.COM * @param lhbaId The object ID of the logical HBA to 2124*7836SJohn.Forte@Sun.COM * get the max burst length properties of. 2125*7836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_MIN_MAX_VALUE 2126*7836SJohn.Forte@Sun.COM * structure allocated by the 2127*7836SJohn.Forte@Sun.COM * caller. On successful return this structure 2128*7836SJohn.Forte@Sun.COM * will contain the max 2129*7836SJohn.Forte@Sun.COM * burst length properties of this LHBA. 2130*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation 2131*7836SJohn.Forte@Sun.COM * was successful or if an error occurred. 2132*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the max burst 2133*7836SJohn.Forte@Sun.COM * length properties have been 2134*7836SJohn.Forte@Sun.COM * successfully retrieved. 2135*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned 2136*7836SJohn.Forte@Sun.COM * if @a pProps is NULL or specifies a 2137*7836SJohn.Forte@Sun.COM * memory area to which data cannot be written. 2138*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned 2139*7836SJohn.Forte@Sun.COM * if @a lhbaId does not specify any 2140*7836SJohn.Forte@Sun.COM * valid object type. 2141*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned 2142*7836SJohn.Forte@Sun.COM * if @a lhbaId does not specify a HBA. 2143*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned 2144*7836SJohn.Forte@Sun.COM * if @a lhbaId does not specify a LHBA 2145*7836SJohn.Forte@Sun.COM * which is currently known to the system. 2146*7836SJohn.Forte@Sun.COM */ 2147*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetMaxBurstLengthProperties( 2148*7836SJohn.Forte@Sun.COM IMA_OID Oid, 2149*7836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 2150*7836SJohn.Forte@Sun.COM IMA_GetMaxBurstLengthPropertiesFn PassFunc; 2151*7836SJohn.Forte@Sun.COM IMA_UINT i; 2152*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2153*7836SJohn.Forte@Sun.COM 2154*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2155*7836SJohn.Forte@Sun.COM InitLibrary(); 2156*7836SJohn.Forte@Sun.COM 2157*7836SJohn.Forte@Sun.COM if (pProps == NULL) 2158*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 2159*7836SJohn.Forte@Sun.COM 2160*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 2161*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 2162*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2163*7836SJohn.Forte@Sun.COM 2164*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2165*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2166*7836SJohn.Forte@Sun.COM 2167*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2168*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 2169*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2170*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2171*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2172*7836SJohn.Forte@Sun.COM #ifdef WIN32 2173*7836SJohn.Forte@Sun.COM PassFunc = 2174*7836SJohn.Forte@Sun.COM (IMA_GetMaxBurstLengthPropertiesFn) 2175*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2176*7836SJohn.Forte@Sun.COM "IMA_GetMaxBurstLengthProperties"); 2177*7836SJohn.Forte@Sun.COM #else 2178*7836SJohn.Forte@Sun.COM PassFunc = 2179*7836SJohn.Forte@Sun.COM (IMA_GetMaxBurstLengthPropertiesFn) 2180*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2181*7836SJohn.Forte@Sun.COM "IMA_GetMaxBurstLengthProperties"); 2182*7836SJohn.Forte@Sun.COM #endif 2183*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2184*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 2185*7836SJohn.Forte@Sun.COM } 2186*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2187*7836SJohn.Forte@Sun.COM } 2188*7836SJohn.Forte@Sun.COM 2189*7836SJohn.Forte@Sun.COM break; 2190*7836SJohn.Forte@Sun.COM } 2191*7836SJohn.Forte@Sun.COM } 2192*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2193*7836SJohn.Forte@Sun.COM return (status); 2194*7836SJohn.Forte@Sun.COM } 2195*7836SJohn.Forte@Sun.COM 2196*7836SJohn.Forte@Sun.COM 2197*7836SJohn.Forte@Sun.COM /* 2198*7836SJohn.Forte@Sun.COM * Gets the maximum receive data segment length properties 2199*7836SJohn.Forte@Sun.COM * of the specified logical HBA. 2200*7836SJohn.Forte@Sun.COM * 2201*7836SJohn.Forte@Sun.COM * @param lhbaId The object ID of the logical HBA to 2202*7836SJohn.Forte@Sun.COM * get the max receive data 2203*7836SJohn.Forte@Sun.COM * segment length properties of. 2204*7836SJohn.Forte@Sun.COM * @param pProps A pointer to an @ref IMA_MIN_MAX_VALUE 2205*7836SJohn.Forte@Sun.COM * structure allocated by the caller. 2206*7836SJohn.Forte@Sun.COM * On successful return this structure will contain the max 2207*7836SJohn.Forte@Sun.COM * receive data segment length properties of this LHBA. 2208*7836SJohn.Forte@Sun.COM * @return An IMA_STATUS indicating if the operation 2209*7836SJohn.Forte@Sun.COM * was successful or if an error occurred. 2210*7836SJohn.Forte@Sun.COM * @retval IMA_SUCCESS Returned if the max receive 2211*7836SJohn.Forte@Sun.COM * data segment length properties 2212*7836SJohn.Forte@Sun.COM * have been successfully retrieved. 2213*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_PARAMETER Returned if 2214*7836SJohn.Forte@Sun.COM * @a pProps is NULL or specifies a 2215*7836SJohn.Forte@Sun.COM * memory area to which data cannot be written. 2216*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INVALID_OBJECT_TYPE Returned if 2217*7836SJohn.Forte@Sun.COM * @a lhbaId does not specify any 2218*7836SJohn.Forte@Sun.COM * valid object type. 2219*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_INCORRECT_OBJECT_TYPE Returned if 2220*7836SJohn.Forte@Sun.COM * a lhbaId does not specify a LHBA. 2221*7836SJohn.Forte@Sun.COM * @retval IMA_ERROR_OBJECT_NOT_FOUND Returned if @a 2222*7836SJohn.Forte@Sun.COM * lhbaId does not specify a LHBA 2223*7836SJohn.Forte@Sun.COM * which is currently known to the system. 2224*7836SJohn.Forte@Sun.COM */ 2225*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetMaxRecvDataSegmentLengthProperties( 2226*7836SJohn.Forte@Sun.COM IMA_OID Oid, 2227*7836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 2228*7836SJohn.Forte@Sun.COM IMA_GetMaxRecvDataSegmentLengthPropertiesFn PassFunc; 2229*7836SJohn.Forte@Sun.COM IMA_UINT i; 2230*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2231*7836SJohn.Forte@Sun.COM #define IMA_GMRDSLPFN IMA_GetMaxRecvDataSegmentLengthPropertiesFn 2232*7836SJohn.Forte@Sun.COM #define IMA_GMRDSLP "IMA_GetMaxRecvDataSegmentLengthProperties" 2233*7836SJohn.Forte@Sun.COM 2234*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2235*7836SJohn.Forte@Sun.COM InitLibrary(); 2236*7836SJohn.Forte@Sun.COM 2237*7836SJohn.Forte@Sun.COM if (pProps == NULL) 2238*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 2239*7836SJohn.Forte@Sun.COM 2240*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 2241*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 2242*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2243*7836SJohn.Forte@Sun.COM 2244*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2245*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2246*7836SJohn.Forte@Sun.COM 2247*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2248*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 2249*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2250*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2251*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2252*7836SJohn.Forte@Sun.COM #ifdef WIN32 2253*7836SJohn.Forte@Sun.COM PassFunc = 2254*7836SJohn.Forte@Sun.COM (IMA_GMRDSLPFN) 2255*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2256*7836SJohn.Forte@Sun.COM IMA_GMRDSLP); 2257*7836SJohn.Forte@Sun.COM #else 2258*7836SJohn.Forte@Sun.COM PassFunc = 2259*7836SJohn.Forte@Sun.COM (IMA_GMRDSLPFN) 2260*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2261*7836SJohn.Forte@Sun.COM IMA_GMRDSLP); 2262*7836SJohn.Forte@Sun.COM #endif 2263*7836SJohn.Forte@Sun.COM 2264*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2265*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 2266*7836SJohn.Forte@Sun.COM } 2267*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2268*7836SJohn.Forte@Sun.COM } 2269*7836SJohn.Forte@Sun.COM 2270*7836SJohn.Forte@Sun.COM break; 2271*7836SJohn.Forte@Sun.COM } 2272*7836SJohn.Forte@Sun.COM } 2273*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2274*7836SJohn.Forte@Sun.COM #undef IMA_GMRDSLPFN 2275*7836SJohn.Forte@Sun.COM #undef IMA_GMRDSLP 2276*7836SJohn.Forte@Sun.COM return (status); 2277*7836SJohn.Forte@Sun.COM } 2278*7836SJohn.Forte@Sun.COM 2279*7836SJohn.Forte@Sun.COM 2280*7836SJohn.Forte@Sun.COM 2281*7836SJohn.Forte@Sun.COM /* --------------------------------------------- */ 2282*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_PluginIOCtl( 2283*7836SJohn.Forte@Sun.COM IMA_OID pluginOid, 2284*7836SJohn.Forte@Sun.COM IMA_UINT command, 2285*7836SJohn.Forte@Sun.COM const void *pInputBuffer, 2286*7836SJohn.Forte@Sun.COM IMA_UINT inputBufferLength, 2287*7836SJohn.Forte@Sun.COM void *pOutputBuffer, 2288*7836SJohn.Forte@Sun.COM IMA_UINT *pOutputBufferLength) { 2289*7836SJohn.Forte@Sun.COM IMA_PluginIOCtlFn PassFunc; 2290*7836SJohn.Forte@Sun.COM IMA_UINT i; 2291*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2292*7836SJohn.Forte@Sun.COM 2293*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2294*7836SJohn.Forte@Sun.COM InitLibrary(); 2295*7836SJohn.Forte@Sun.COM 2296*7836SJohn.Forte@Sun.COM if (pInputBuffer == NULL || inputBufferLength == 0 || 2297*7836SJohn.Forte@Sun.COM pOutputBuffer == NULL || pOutputBufferLength == NULL || 2298*7836SJohn.Forte@Sun.COM *pOutputBufferLength == 0) 2299*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 2300*7836SJohn.Forte@Sun.COM 2301*7836SJohn.Forte@Sun.COM if (pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) 2302*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2303*7836SJohn.Forte@Sun.COM 2304*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2305*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2306*7836SJohn.Forte@Sun.COM 2307*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2308*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == pluginOid.ownerId) { 2309*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2310*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2311*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2312*7836SJohn.Forte@Sun.COM #ifdef WIN32 2313*7836SJohn.Forte@Sun.COM PassFunc = (IMA_PluginIOCtlFn) 2314*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2315*7836SJohn.Forte@Sun.COM "IMA_PluginIOCtl"); 2316*7836SJohn.Forte@Sun.COM #else 2317*7836SJohn.Forte@Sun.COM PassFunc = (IMA_PluginIOCtlFn) 2318*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2319*7836SJohn.Forte@Sun.COM "IMA_PluginIOCtl"); 2320*7836SJohn.Forte@Sun.COM #endif 2321*7836SJohn.Forte@Sun.COM 2322*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2323*7836SJohn.Forte@Sun.COM status = PassFunc( 2324*7836SJohn.Forte@Sun.COM pluginOid, command, 2325*7836SJohn.Forte@Sun.COM pInputBuffer, inputBufferLength, 2326*7836SJohn.Forte@Sun.COM pOutputBuffer, pOutputBufferLength); 2327*7836SJohn.Forte@Sun.COM } 2328*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2329*7836SJohn.Forte@Sun.COM } 2330*7836SJohn.Forte@Sun.COM 2331*7836SJohn.Forte@Sun.COM break; 2332*7836SJohn.Forte@Sun.COM } 2333*7836SJohn.Forte@Sun.COM } 2334*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2335*7836SJohn.Forte@Sun.COM return (status); 2336*7836SJohn.Forte@Sun.COM } 2337*7836SJohn.Forte@Sun.COM 2338*7836SJohn.Forte@Sun.COM 2339*7836SJohn.Forte@Sun.COM 2340*7836SJohn.Forte@Sun.COM 2341*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetNetworkPortalOidList( 2342*7836SJohn.Forte@Sun.COM IMA_OID lnpId, 2343*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 2344*7836SJohn.Forte@Sun.COM IMA_GetNetworkPortalOidListFn PassFunc; 2345*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 2346*7836SJohn.Forte@Sun.COM IMA_UINT i; 2347*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2348*7836SJohn.Forte@Sun.COM 2349*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2350*7836SJohn.Forte@Sun.COM InitLibrary(); 2351*7836SJohn.Forte@Sun.COM 2352*7836SJohn.Forte@Sun.COM if (ppList == NULL) 2353*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 2354*7836SJohn.Forte@Sun.COM 2355*7836SJohn.Forte@Sun.COM if (lnpId.objectType != IMA_OBJECT_TYPE_LNP) 2356*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2357*7836SJohn.Forte@Sun.COM 2358*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2359*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2360*7836SJohn.Forte@Sun.COM 2361*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2362*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lnpId.ownerId) { 2363*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2364*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2365*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2366*7836SJohn.Forte@Sun.COM #ifdef WIN32 2367*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNetworkPortalOidListFn) 2368*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2369*7836SJohn.Forte@Sun.COM "IMA_GetNetworkPortalOidList"); 2370*7836SJohn.Forte@Sun.COM #else 2371*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetNetworkPortalOidListFn) 2372*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2373*7836SJohn.Forte@Sun.COM "IMA_GetNetworkPortalOidList"); 2374*7836SJohn.Forte@Sun.COM #endif 2375*7836SJohn.Forte@Sun.COM 2376*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2377*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 2378*7836SJohn.Forte@Sun.COM IMA_UINT listSize; 2379*7836SJohn.Forte@Sun.COM listSize = sizeof (IMA_OID_LIST); 2380*7836SJohn.Forte@Sun.COM status = PassFunc(lnpId, &ppOidList); 2381*7836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 2382*7836SJohn.Forte@Sun.COM 2383*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*) 2384*7836SJohn.Forte@Sun.COM calloc(1, 2385*7836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST) 2386*7836SJohn.Forte@Sun.COM + (ppOidList-> 2387*7836SJohn.Forte@Sun.COM oidCount - 1)* 2388*7836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 2389*7836SJohn.Forte@Sun.COM 2390*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 2391*7836SJohn.Forte@Sun.COM return (EUOS_ERROR); 2392*7836SJohn.Forte@Sun.COM } 2393*7836SJohn.Forte@Sun.COM else 2394*7836SJohn.Forte@Sun.COM memcpy((*ppList), 2395*7836SJohn.Forte@Sun.COM ppOidList, 2396*7836SJohn.Forte@Sun.COM listSize 2397*7836SJohn.Forte@Sun.COM + (ppOidList-> 2398*7836SJohn.Forte@Sun.COM oidCount - 1)* 2399*7836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 2400*7836SJohn.Forte@Sun.COM #ifdef WIN32 2401*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 2402*7836SJohn.Forte@Sun.COM GetProcAddress( 2403*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 2404*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 2405*7836SJohn.Forte@Sun.COM #else 2406*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 2407*7836SJohn.Forte@Sun.COM dlsym( 2408*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 2409*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 2410*7836SJohn.Forte@Sun.COM #endif 2411*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 2412*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 2413*7836SJohn.Forte@Sun.COM } 2414*7836SJohn.Forte@Sun.COM } 2415*7836SJohn.Forte@Sun.COM } 2416*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2417*7836SJohn.Forte@Sun.COM } 2418*7836SJohn.Forte@Sun.COM 2419*7836SJohn.Forte@Sun.COM break; 2420*7836SJohn.Forte@Sun.COM } 2421*7836SJohn.Forte@Sun.COM } 2422*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2423*7836SJohn.Forte@Sun.COM return (status); 2424*7836SJohn.Forte@Sun.COM } 2425*7836SJohn.Forte@Sun.COM 2426*7836SJohn.Forte@Sun.COM 2427*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetFirstBurstLength( 2428*7836SJohn.Forte@Sun.COM IMA_OID lhbaId, 2429*7836SJohn.Forte@Sun.COM IMA_UINT firstBurstLength) { 2430*7836SJohn.Forte@Sun.COM IMA_SetFirstBurstLengthFn PassFunc; 2431*7836SJohn.Forte@Sun.COM IMA_UINT i; 2432*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2433*7836SJohn.Forte@Sun.COM 2434*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2435*7836SJohn.Forte@Sun.COM InitLibrary(); 2436*7836SJohn.Forte@Sun.COM 2437*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 2438*7836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 2439*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2440*7836SJohn.Forte@Sun.COM 2441*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2442*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2443*7836SJohn.Forte@Sun.COM 2444*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2445*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 2446*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2447*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2448*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2449*7836SJohn.Forte@Sun.COM #ifdef WIN32 2450*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetFirstBurstLengthFn) 2451*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2452*7836SJohn.Forte@Sun.COM "IMA_SetFirstBurstLength"); 2453*7836SJohn.Forte@Sun.COM #else 2454*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetFirstBurstLengthFn) 2455*7836SJohn.Forte@Sun.COM dlsym( 2456*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 2457*7836SJohn.Forte@Sun.COM "IMA_SetFirstBurstLength"); 2458*7836SJohn.Forte@Sun.COM #endif 2459*7836SJohn.Forte@Sun.COM 2460*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2461*7836SJohn.Forte@Sun.COM status = PassFunc( 2462*7836SJohn.Forte@Sun.COM lhbaId, firstBurstLength); 2463*7836SJohn.Forte@Sun.COM } 2464*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2465*7836SJohn.Forte@Sun.COM } 2466*7836SJohn.Forte@Sun.COM 2467*7836SJohn.Forte@Sun.COM break; 2468*7836SJohn.Forte@Sun.COM } 2469*7836SJohn.Forte@Sun.COM } 2470*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2471*7836SJohn.Forte@Sun.COM return (status); 2472*7836SJohn.Forte@Sun.COM } 2473*7836SJohn.Forte@Sun.COM 2474*7836SJohn.Forte@Sun.COM 2475*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetMaxBurstLength( 2476*7836SJohn.Forte@Sun.COM IMA_OID lhbaId, 2477*7836SJohn.Forte@Sun.COM IMA_UINT maxBurstLength) { 2478*7836SJohn.Forte@Sun.COM IMA_SetMaxBurstLengthFn PassFunc; 2479*7836SJohn.Forte@Sun.COM IMA_UINT i; 2480*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2481*7836SJohn.Forte@Sun.COM 2482*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2483*7836SJohn.Forte@Sun.COM InitLibrary(); 2484*7836SJohn.Forte@Sun.COM 2485*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 2486*7836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 2487*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2488*7836SJohn.Forte@Sun.COM 2489*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2490*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2491*7836SJohn.Forte@Sun.COM 2492*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2493*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 2494*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2495*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2496*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2497*7836SJohn.Forte@Sun.COM #ifdef WIN32 2498*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetMaxBurstLengthFn) 2499*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2500*7836SJohn.Forte@Sun.COM "IMA_SetMaxBurstLength"); 2501*7836SJohn.Forte@Sun.COM #else 2502*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetMaxBurstLengthFn) 2503*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2504*7836SJohn.Forte@Sun.COM "IMA_SetMaxBurstLength"); 2505*7836SJohn.Forte@Sun.COM #endif 2506*7836SJohn.Forte@Sun.COM 2507*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2508*7836SJohn.Forte@Sun.COM status = PassFunc( 2509*7836SJohn.Forte@Sun.COM lhbaId, maxBurstLength); 2510*7836SJohn.Forte@Sun.COM } 2511*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2512*7836SJohn.Forte@Sun.COM } 2513*7836SJohn.Forte@Sun.COM 2514*7836SJohn.Forte@Sun.COM break; 2515*7836SJohn.Forte@Sun.COM } 2516*7836SJohn.Forte@Sun.COM } 2517*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2518*7836SJohn.Forte@Sun.COM return (status); 2519*7836SJohn.Forte@Sun.COM } 2520*7836SJohn.Forte@Sun.COM 2521*7836SJohn.Forte@Sun.COM 2522*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetMaxRecvDataSegmentLength( 2523*7836SJohn.Forte@Sun.COM IMA_OID lhbaId, 2524*7836SJohn.Forte@Sun.COM IMA_UINT maxRecvDataSegmentLength) { 2525*7836SJohn.Forte@Sun.COM IMA_SetMaxRecvDataSegmentLengthFn PassFunc; 2526*7836SJohn.Forte@Sun.COM IMA_UINT i; 2527*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2528*7836SJohn.Forte@Sun.COM 2529*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2530*7836SJohn.Forte@Sun.COM InitLibrary(); 2531*7836SJohn.Forte@Sun.COM 2532*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 2533*7836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 2534*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2535*7836SJohn.Forte@Sun.COM 2536*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2537*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2538*7836SJohn.Forte@Sun.COM 2539*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2540*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 2541*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2542*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2543*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2544*7836SJohn.Forte@Sun.COM #ifdef WIN32 2545*7836SJohn.Forte@Sun.COM PassFunc = 2546*7836SJohn.Forte@Sun.COM (IMA_SetMaxRecvDataSegmentLengthFn) 2547*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2548*7836SJohn.Forte@Sun.COM "IMA_SetMaxRecvDataSegmentLength"); 2549*7836SJohn.Forte@Sun.COM #else 2550*7836SJohn.Forte@Sun.COM PassFunc = 2551*7836SJohn.Forte@Sun.COM (IMA_SetMaxRecvDataSegmentLengthFn) 2552*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2553*7836SJohn.Forte@Sun.COM "IMA_SetMaxRecvDataSegmentLength"); 2554*7836SJohn.Forte@Sun.COM #endif 2555*7836SJohn.Forte@Sun.COM 2556*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2557*7836SJohn.Forte@Sun.COM status = PassFunc( 2558*7836SJohn.Forte@Sun.COM lhbaId, 2559*7836SJohn.Forte@Sun.COM maxRecvDataSegmentLength); 2560*7836SJohn.Forte@Sun.COM } 2561*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2562*7836SJohn.Forte@Sun.COM } 2563*7836SJohn.Forte@Sun.COM 2564*7836SJohn.Forte@Sun.COM break; 2565*7836SJohn.Forte@Sun.COM } 2566*7836SJohn.Forte@Sun.COM } 2567*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2568*7836SJohn.Forte@Sun.COM return (status); 2569*7836SJohn.Forte@Sun.COM } 2570*7836SJohn.Forte@Sun.COM 2571*7836SJohn.Forte@Sun.COM 2572*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetMaxConnectionsProperties( 2573*7836SJohn.Forte@Sun.COM IMA_OID Oid, 2574*7836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 2575*7836SJohn.Forte@Sun.COM IMA_GetMaxConnectionsPropertiesFn PassFunc; 2576*7836SJohn.Forte@Sun.COM IMA_UINT i; 2577*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2578*7836SJohn.Forte@Sun.COM 2579*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2580*7836SJohn.Forte@Sun.COM InitLibrary(); 2581*7836SJohn.Forte@Sun.COM 2582*7836SJohn.Forte@Sun.COM if (pProps == NULL) 2583*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 2584*7836SJohn.Forte@Sun.COM 2585*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 2586*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 2587*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2588*7836SJohn.Forte@Sun.COM 2589*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2590*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2591*7836SJohn.Forte@Sun.COM 2592*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2593*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 2594*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2595*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2596*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2597*7836SJohn.Forte@Sun.COM #ifdef WIN32 2598*7836SJohn.Forte@Sun.COM PassFunc = 2599*7836SJohn.Forte@Sun.COM (IMA_GetMaxConnectionsPropertiesFn) 2600*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2601*7836SJohn.Forte@Sun.COM "IMA_GetMaxConnectionsProperties"); 2602*7836SJohn.Forte@Sun.COM #else 2603*7836SJohn.Forte@Sun.COM PassFunc = 2604*7836SJohn.Forte@Sun.COM (IMA_GetMaxConnectionsPropertiesFn) 2605*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2606*7836SJohn.Forte@Sun.COM "IMA_GetMaxConnectionsProperties"); 2607*7836SJohn.Forte@Sun.COM #endif 2608*7836SJohn.Forte@Sun.COM 2609*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2610*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 2611*7836SJohn.Forte@Sun.COM } 2612*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2613*7836SJohn.Forte@Sun.COM } 2614*7836SJohn.Forte@Sun.COM 2615*7836SJohn.Forte@Sun.COM break; 2616*7836SJohn.Forte@Sun.COM } 2617*7836SJohn.Forte@Sun.COM } 2618*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2619*7836SJohn.Forte@Sun.COM return (status); 2620*7836SJohn.Forte@Sun.COM } 2621*7836SJohn.Forte@Sun.COM 2622*7836SJohn.Forte@Sun.COM 2623*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetMaxConnections( 2624*7836SJohn.Forte@Sun.COM IMA_OID lhbaId, 2625*7836SJohn.Forte@Sun.COM IMA_UINT maxConnections) { 2626*7836SJohn.Forte@Sun.COM IMA_SetMaxConnectionsFn PassFunc; 2627*7836SJohn.Forte@Sun.COM IMA_UINT i; 2628*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2629*7836SJohn.Forte@Sun.COM 2630*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2631*7836SJohn.Forte@Sun.COM InitLibrary(); 2632*7836SJohn.Forte@Sun.COM 2633*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 2634*7836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 2635*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2636*7836SJohn.Forte@Sun.COM 2637*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2638*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2639*7836SJohn.Forte@Sun.COM 2640*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2641*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 2642*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2643*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2644*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2645*7836SJohn.Forte@Sun.COM #ifdef WIN32 2646*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetMaxConnectionsFn) 2647*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2648*7836SJohn.Forte@Sun.COM "IMA_SetMaxConnections"); 2649*7836SJohn.Forte@Sun.COM #else 2650*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetMaxConnectionsFn) 2651*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2652*7836SJohn.Forte@Sun.COM "IMA_SetMaxConnections"); 2653*7836SJohn.Forte@Sun.COM #endif 2654*7836SJohn.Forte@Sun.COM 2655*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2656*7836SJohn.Forte@Sun.COM status = PassFunc( 2657*7836SJohn.Forte@Sun.COM lhbaId, maxConnections); 2658*7836SJohn.Forte@Sun.COM } 2659*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2660*7836SJohn.Forte@Sun.COM } 2661*7836SJohn.Forte@Sun.COM 2662*7836SJohn.Forte@Sun.COM break; 2663*7836SJohn.Forte@Sun.COM } 2664*7836SJohn.Forte@Sun.COM } 2665*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2666*7836SJohn.Forte@Sun.COM return (status); 2667*7836SJohn.Forte@Sun.COM } 2668*7836SJohn.Forte@Sun.COM 2669*7836SJohn.Forte@Sun.COM 2670*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDefaultTime2RetainProperties( 2671*7836SJohn.Forte@Sun.COM IMA_OID lhbaId, 2672*7836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 2673*7836SJohn.Forte@Sun.COM IMA_GetDefaultTime2RetainPropertiesFn PassFunc; 2674*7836SJohn.Forte@Sun.COM IMA_UINT i; 2675*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2676*7836SJohn.Forte@Sun.COM 2677*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2678*7836SJohn.Forte@Sun.COM InitLibrary(); 2679*7836SJohn.Forte@Sun.COM 2680*7836SJohn.Forte@Sun.COM if (pProps == NULL) 2681*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 2682*7836SJohn.Forte@Sun.COM 2683*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 2684*7836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 2685*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2686*7836SJohn.Forte@Sun.COM 2687*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2688*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2689*7836SJohn.Forte@Sun.COM 2690*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2691*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 2692*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2693*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2694*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2695*7836SJohn.Forte@Sun.COM #ifdef WIN32 2696*7836SJohn.Forte@Sun.COM PassFunc = 2697*7836SJohn.Forte@Sun.COM (IMA_GetDefaultTime2RetainPropertiesFn) 2698*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2699*7836SJohn.Forte@Sun.COM "IMA_GetDefaultTime2RetainProperties"); 2700*7836SJohn.Forte@Sun.COM #else 2701*7836SJohn.Forte@Sun.COM PassFunc = 2702*7836SJohn.Forte@Sun.COM (IMA_GetDefaultTime2RetainPropertiesFn) 2703*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2704*7836SJohn.Forte@Sun.COM "IMA_GetDefaultTime2RetainProperties"); 2705*7836SJohn.Forte@Sun.COM #endif 2706*7836SJohn.Forte@Sun.COM 2707*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2708*7836SJohn.Forte@Sun.COM status = PassFunc(lhbaId, pProps); 2709*7836SJohn.Forte@Sun.COM } 2710*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2711*7836SJohn.Forte@Sun.COM } 2712*7836SJohn.Forte@Sun.COM 2713*7836SJohn.Forte@Sun.COM break; 2714*7836SJohn.Forte@Sun.COM } 2715*7836SJohn.Forte@Sun.COM } 2716*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2717*7836SJohn.Forte@Sun.COM return (status); 2718*7836SJohn.Forte@Sun.COM } 2719*7836SJohn.Forte@Sun.COM 2720*7836SJohn.Forte@Sun.COM 2721*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDefaultTime2Retain( 2722*7836SJohn.Forte@Sun.COM IMA_OID lhbaId, 2723*7836SJohn.Forte@Sun.COM IMA_UINT defaultTime2Retain) { 2724*7836SJohn.Forte@Sun.COM IMA_SetDefaultTime2RetainFn PassFunc; 2725*7836SJohn.Forte@Sun.COM IMA_UINT i; 2726*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2727*7836SJohn.Forte@Sun.COM 2728*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2729*7836SJohn.Forte@Sun.COM InitLibrary(); 2730*7836SJohn.Forte@Sun.COM 2731*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 2732*7836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 2733*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2734*7836SJohn.Forte@Sun.COM 2735*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2736*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2737*7836SJohn.Forte@Sun.COM 2738*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2739*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 2740*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2741*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2742*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2743*7836SJohn.Forte@Sun.COM #ifdef WIN32 2744*7836SJohn.Forte@Sun.COM PassFunc = 2745*7836SJohn.Forte@Sun.COM (IMA_SetDefaultTime2RetainFn) 2746*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2747*7836SJohn.Forte@Sun.COM "IMA_SetDefaultTime2Retain"); 2748*7836SJohn.Forte@Sun.COM #else 2749*7836SJohn.Forte@Sun.COM PassFunc = 2750*7836SJohn.Forte@Sun.COM (IMA_SetDefaultTime2RetainFn) 2751*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2752*7836SJohn.Forte@Sun.COM "IMA_SetDefaultTime2Retain"); 2753*7836SJohn.Forte@Sun.COM #endif 2754*7836SJohn.Forte@Sun.COM 2755*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2756*7836SJohn.Forte@Sun.COM status = PassFunc( 2757*7836SJohn.Forte@Sun.COM lhbaId, defaultTime2Retain); 2758*7836SJohn.Forte@Sun.COM } 2759*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2760*7836SJohn.Forte@Sun.COM } 2761*7836SJohn.Forte@Sun.COM 2762*7836SJohn.Forte@Sun.COM break; 2763*7836SJohn.Forte@Sun.COM } 2764*7836SJohn.Forte@Sun.COM } 2765*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2766*7836SJohn.Forte@Sun.COM return (status); 2767*7836SJohn.Forte@Sun.COM } 2768*7836SJohn.Forte@Sun.COM 2769*7836SJohn.Forte@Sun.COM 2770*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDefaultTime2WaitProperties( 2771*7836SJohn.Forte@Sun.COM IMA_OID lhbaId, 2772*7836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 2773*7836SJohn.Forte@Sun.COM IMA_GetDefaultTime2WaitPropertiesFn PassFunc; 2774*7836SJohn.Forte@Sun.COM IMA_UINT i; 2775*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2776*7836SJohn.Forte@Sun.COM 2777*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2778*7836SJohn.Forte@Sun.COM InitLibrary(); 2779*7836SJohn.Forte@Sun.COM 2780*7836SJohn.Forte@Sun.COM if (pProps == NULL) 2781*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 2782*7836SJohn.Forte@Sun.COM 2783*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 2784*7836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 2785*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2786*7836SJohn.Forte@Sun.COM 2787*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2788*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2789*7836SJohn.Forte@Sun.COM 2790*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2791*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 2792*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2793*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2794*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2795*7836SJohn.Forte@Sun.COM #ifdef WIN32 2796*7836SJohn.Forte@Sun.COM PassFunc = 2797*7836SJohn.Forte@Sun.COM (IMA_GetDefaultTime2WaitPropertiesFn) 2798*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2799*7836SJohn.Forte@Sun.COM "IMA_GetDefaultTime2WaitProperties"); 2800*7836SJohn.Forte@Sun.COM #else 2801*7836SJohn.Forte@Sun.COM PassFunc = 2802*7836SJohn.Forte@Sun.COM (IMA_GetDefaultTime2WaitPropertiesFn) 2803*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2804*7836SJohn.Forte@Sun.COM "IMA_GetDefaultTime2WaitProperties"); 2805*7836SJohn.Forte@Sun.COM #endif 2806*7836SJohn.Forte@Sun.COM 2807*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2808*7836SJohn.Forte@Sun.COM status = PassFunc(lhbaId, pProps); 2809*7836SJohn.Forte@Sun.COM } 2810*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2811*7836SJohn.Forte@Sun.COM } 2812*7836SJohn.Forte@Sun.COM 2813*7836SJohn.Forte@Sun.COM break; 2814*7836SJohn.Forte@Sun.COM } 2815*7836SJohn.Forte@Sun.COM } 2816*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2817*7836SJohn.Forte@Sun.COM return (status); 2818*7836SJohn.Forte@Sun.COM } 2819*7836SJohn.Forte@Sun.COM 2820*7836SJohn.Forte@Sun.COM 2821*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDefaultTime2Wait( 2822*7836SJohn.Forte@Sun.COM IMA_OID lhbaId, 2823*7836SJohn.Forte@Sun.COM IMA_UINT defaultTime2Wait) { 2824*7836SJohn.Forte@Sun.COM IMA_SetDefaultTime2WaitFn PassFunc; 2825*7836SJohn.Forte@Sun.COM IMA_UINT i; 2826*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2827*7836SJohn.Forte@Sun.COM 2828*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2829*7836SJohn.Forte@Sun.COM InitLibrary(); 2830*7836SJohn.Forte@Sun.COM 2831*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 2832*7836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 2833*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2834*7836SJohn.Forte@Sun.COM 2835*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2836*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2837*7836SJohn.Forte@Sun.COM 2838*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2839*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 2840*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2841*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2842*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2843*7836SJohn.Forte@Sun.COM #ifdef WIN32 2844*7836SJohn.Forte@Sun.COM PassFunc = 2845*7836SJohn.Forte@Sun.COM (IMA_SetDefaultTime2WaitFn) 2846*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2847*7836SJohn.Forte@Sun.COM "IMA_SetDefaultTime2Wait"); 2848*7836SJohn.Forte@Sun.COM #else 2849*7836SJohn.Forte@Sun.COM PassFunc = 2850*7836SJohn.Forte@Sun.COM (IMA_SetDefaultTime2WaitFn) 2851*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2852*7836SJohn.Forte@Sun.COM "IMA_SetDefaultTime2Wait"); 2853*7836SJohn.Forte@Sun.COM #endif 2854*7836SJohn.Forte@Sun.COM 2855*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2856*7836SJohn.Forte@Sun.COM status = PassFunc( 2857*7836SJohn.Forte@Sun.COM lhbaId, defaultTime2Wait); 2858*7836SJohn.Forte@Sun.COM } 2859*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2860*7836SJohn.Forte@Sun.COM } 2861*7836SJohn.Forte@Sun.COM 2862*7836SJohn.Forte@Sun.COM break; 2863*7836SJohn.Forte@Sun.COM } 2864*7836SJohn.Forte@Sun.COM } 2865*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2866*7836SJohn.Forte@Sun.COM return (status); 2867*7836SJohn.Forte@Sun.COM } 2868*7836SJohn.Forte@Sun.COM 2869*7836SJohn.Forte@Sun.COM 2870*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetMaxOutstandingR2TProperties( 2871*7836SJohn.Forte@Sun.COM IMA_OID Oid, 2872*7836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 2873*7836SJohn.Forte@Sun.COM IMA_GetMaxOutstandingR2TPropertiesFn PassFunc; 2874*7836SJohn.Forte@Sun.COM IMA_UINT i; 2875*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2876*7836SJohn.Forte@Sun.COM 2877*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2878*7836SJohn.Forte@Sun.COM InitLibrary(); 2879*7836SJohn.Forte@Sun.COM 2880*7836SJohn.Forte@Sun.COM if (pProps == NULL) 2881*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 2882*7836SJohn.Forte@Sun.COM 2883*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 2884*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 2885*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2886*7836SJohn.Forte@Sun.COM 2887*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2888*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2889*7836SJohn.Forte@Sun.COM 2890*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2891*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 2892*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2893*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2894*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2895*7836SJohn.Forte@Sun.COM #ifdef WIN32 2896*7836SJohn.Forte@Sun.COM PassFunc = 2897*7836SJohn.Forte@Sun.COM (IMA_GetMaxOutstandingR2TPropertiesFn) 2898*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2899*7836SJohn.Forte@Sun.COM "IMA_GetMaxOutstandingR2TProperties"); 2900*7836SJohn.Forte@Sun.COM #else 2901*7836SJohn.Forte@Sun.COM PassFunc = 2902*7836SJohn.Forte@Sun.COM (IMA_GetMaxOutstandingR2TPropertiesFn) 2903*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2904*7836SJohn.Forte@Sun.COM "IMA_GetMaxOutstandingR2TProperties"); 2905*7836SJohn.Forte@Sun.COM #endif 2906*7836SJohn.Forte@Sun.COM 2907*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2908*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 2909*7836SJohn.Forte@Sun.COM } 2910*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2911*7836SJohn.Forte@Sun.COM } 2912*7836SJohn.Forte@Sun.COM 2913*7836SJohn.Forte@Sun.COM break; 2914*7836SJohn.Forte@Sun.COM } 2915*7836SJohn.Forte@Sun.COM } 2916*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2917*7836SJohn.Forte@Sun.COM return (status); 2918*7836SJohn.Forte@Sun.COM } 2919*7836SJohn.Forte@Sun.COM 2920*7836SJohn.Forte@Sun.COM 2921*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetMaxOutstandingR2T( 2922*7836SJohn.Forte@Sun.COM IMA_OID lhbaId, 2923*7836SJohn.Forte@Sun.COM IMA_UINT maxOutstandingR2T) { 2924*7836SJohn.Forte@Sun.COM IMA_SetMaxOutstandingR2TFn PassFunc; 2925*7836SJohn.Forte@Sun.COM IMA_UINT i; 2926*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2927*7836SJohn.Forte@Sun.COM 2928*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2929*7836SJohn.Forte@Sun.COM InitLibrary(); 2930*7836SJohn.Forte@Sun.COM 2931*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA && 2932*7836SJohn.Forte@Sun.COM lhbaId.objectType != IMA_OBJECT_TYPE_TARGET) 2933*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2934*7836SJohn.Forte@Sun.COM 2935*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2936*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2937*7836SJohn.Forte@Sun.COM 2938*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2939*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 2940*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2941*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2942*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2943*7836SJohn.Forte@Sun.COM #ifdef WIN32 2944*7836SJohn.Forte@Sun.COM PassFunc = 2945*7836SJohn.Forte@Sun.COM (IMA_SetMaxOutstandingR2TFn) 2946*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2947*7836SJohn.Forte@Sun.COM "IMA_SetMaxOutstandingR2T"); 2948*7836SJohn.Forte@Sun.COM #else 2949*7836SJohn.Forte@Sun.COM PassFunc = 2950*7836SJohn.Forte@Sun.COM (IMA_SetMaxOutstandingR2TFn) 2951*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 2952*7836SJohn.Forte@Sun.COM "IMA_SetMaxOutstandingR2T"); 2953*7836SJohn.Forte@Sun.COM #endif 2954*7836SJohn.Forte@Sun.COM 2955*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 2956*7836SJohn.Forte@Sun.COM status = PassFunc( 2957*7836SJohn.Forte@Sun.COM lhbaId, maxOutstandingR2T); 2958*7836SJohn.Forte@Sun.COM } 2959*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 2960*7836SJohn.Forte@Sun.COM } 2961*7836SJohn.Forte@Sun.COM 2962*7836SJohn.Forte@Sun.COM break; 2963*7836SJohn.Forte@Sun.COM } 2964*7836SJohn.Forte@Sun.COM } 2965*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 2966*7836SJohn.Forte@Sun.COM return (status); 2967*7836SJohn.Forte@Sun.COM } 2968*7836SJohn.Forte@Sun.COM 2969*7836SJohn.Forte@Sun.COM 2970*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetErrorRecoveryLevelProperties( 2971*7836SJohn.Forte@Sun.COM IMA_OID Oid, 2972*7836SJohn.Forte@Sun.COM IMA_MIN_MAX_VALUE *pProps) { 2973*7836SJohn.Forte@Sun.COM IMA_GetMaxOutstandingR2TPropertiesFn PassFunc; 2974*7836SJohn.Forte@Sun.COM IMA_UINT i; 2975*7836SJohn.Forte@Sun.COM IMA_STATUS status; 2976*7836SJohn.Forte@Sun.COM 2977*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 2978*7836SJohn.Forte@Sun.COM InitLibrary(); 2979*7836SJohn.Forte@Sun.COM 2980*7836SJohn.Forte@Sun.COM if (pProps == NULL) 2981*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 2982*7836SJohn.Forte@Sun.COM 2983*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 2984*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 2985*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 2986*7836SJohn.Forte@Sun.COM 2987*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 2988*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 2989*7836SJohn.Forte@Sun.COM 2990*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 2991*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 2992*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 2993*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 2994*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 2995*7836SJohn.Forte@Sun.COM #ifdef WIN32 2996*7836SJohn.Forte@Sun.COM PassFunc = 2997*7836SJohn.Forte@Sun.COM (IMA_GetErrorRecoveryLevelPropertiesFn) 2998*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 2999*7836SJohn.Forte@Sun.COM "IMA_GetErrorRecoveryLevelProperties"); 3000*7836SJohn.Forte@Sun.COM #else 3001*7836SJohn.Forte@Sun.COM PassFunc = 3002*7836SJohn.Forte@Sun.COM (IMA_GetErrorRecoveryLevelPropertiesFn) 3003*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3004*7836SJohn.Forte@Sun.COM "IMA_GetErrorRecoveryLevelProperties"); 3005*7836SJohn.Forte@Sun.COM #endif 3006*7836SJohn.Forte@Sun.COM 3007*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3008*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 3009*7836SJohn.Forte@Sun.COM } 3010*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3011*7836SJohn.Forte@Sun.COM } 3012*7836SJohn.Forte@Sun.COM 3013*7836SJohn.Forte@Sun.COM break; 3014*7836SJohn.Forte@Sun.COM } 3015*7836SJohn.Forte@Sun.COM } 3016*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3017*7836SJohn.Forte@Sun.COM return (status); 3018*7836SJohn.Forte@Sun.COM } 3019*7836SJohn.Forte@Sun.COM 3020*7836SJohn.Forte@Sun.COM 3021*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetErrorRecoveryLevel( 3022*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3023*7836SJohn.Forte@Sun.COM IMA_UINT errorRecoveryLevel) { 3024*7836SJohn.Forte@Sun.COM IMA_SetErrorRecoveryLevelFn PassFunc; 3025*7836SJohn.Forte@Sun.COM IMA_UINT i; 3026*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3027*7836SJohn.Forte@Sun.COM 3028*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3029*7836SJohn.Forte@Sun.COM InitLibrary(); 3030*7836SJohn.Forte@Sun.COM 3031*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 3032*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 3033*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3034*7836SJohn.Forte@Sun.COM 3035*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3036*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3037*7836SJohn.Forte@Sun.COM 3038*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3039*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3040*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3041*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3042*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3043*7836SJohn.Forte@Sun.COM #ifdef WIN32 3044*7836SJohn.Forte@Sun.COM PassFunc = 3045*7836SJohn.Forte@Sun.COM (IMA_SetErrorRecoveryLevelFn) 3046*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3047*7836SJohn.Forte@Sun.COM "IMA_SetErrorRecoveryLevel"); 3048*7836SJohn.Forte@Sun.COM #else 3049*7836SJohn.Forte@Sun.COM PassFunc = 3050*7836SJohn.Forte@Sun.COM (IMA_SetErrorRecoveryLevelFn) 3051*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3052*7836SJohn.Forte@Sun.COM "IMA_SetErrorRecoveryLevel"); 3053*7836SJohn.Forte@Sun.COM #endif 3054*7836SJohn.Forte@Sun.COM 3055*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3056*7836SJohn.Forte@Sun.COM status = PassFunc( 3057*7836SJohn.Forte@Sun.COM Oid, errorRecoveryLevel); 3058*7836SJohn.Forte@Sun.COM } 3059*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3060*7836SJohn.Forte@Sun.COM } 3061*7836SJohn.Forte@Sun.COM 3062*7836SJohn.Forte@Sun.COM break; 3063*7836SJohn.Forte@Sun.COM } 3064*7836SJohn.Forte@Sun.COM } 3065*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3066*7836SJohn.Forte@Sun.COM return (status); 3067*7836SJohn.Forte@Sun.COM } 3068*7836SJohn.Forte@Sun.COM 3069*7836SJohn.Forte@Sun.COM 3070*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetInitialR2TProperties( 3071*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3072*7836SJohn.Forte@Sun.COM IMA_BOOL_VALUE *pProps) { 3073*7836SJohn.Forte@Sun.COM IMA_GetInitialR2TPropertiesFn PassFunc; 3074*7836SJohn.Forte@Sun.COM IMA_UINT i; 3075*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3076*7836SJohn.Forte@Sun.COM 3077*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3078*7836SJohn.Forte@Sun.COM InitLibrary(); 3079*7836SJohn.Forte@Sun.COM 3080*7836SJohn.Forte@Sun.COM if (pProps == NULL) 3081*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3082*7836SJohn.Forte@Sun.COM 3083*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 3084*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 3085*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3086*7836SJohn.Forte@Sun.COM 3087*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3088*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3089*7836SJohn.Forte@Sun.COM 3090*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3091*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3092*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3093*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3094*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3095*7836SJohn.Forte@Sun.COM #ifdef WIN32 3096*7836SJohn.Forte@Sun.COM PassFunc = 3097*7836SJohn.Forte@Sun.COM (IMA_GetInitialR2TPropertiesFn) 3098*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3099*7836SJohn.Forte@Sun.COM "IMA_GetInitialR2TProperties"); 3100*7836SJohn.Forte@Sun.COM #else 3101*7836SJohn.Forte@Sun.COM PassFunc = 3102*7836SJohn.Forte@Sun.COM (IMA_GetInitialR2TPropertiesFn) 3103*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3104*7836SJohn.Forte@Sun.COM "IMA_GetInitialR2TProperties"); 3105*7836SJohn.Forte@Sun.COM #endif 3106*7836SJohn.Forte@Sun.COM 3107*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3108*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 3109*7836SJohn.Forte@Sun.COM } 3110*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3111*7836SJohn.Forte@Sun.COM } 3112*7836SJohn.Forte@Sun.COM 3113*7836SJohn.Forte@Sun.COM break; 3114*7836SJohn.Forte@Sun.COM } 3115*7836SJohn.Forte@Sun.COM } 3116*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3117*7836SJohn.Forte@Sun.COM return (status); 3118*7836SJohn.Forte@Sun.COM } 3119*7836SJohn.Forte@Sun.COM 3120*7836SJohn.Forte@Sun.COM 3121*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetInitialR2T( 3122*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3123*7836SJohn.Forte@Sun.COM IMA_BOOL initialR2T) 3124*7836SJohn.Forte@Sun.COM { 3125*7836SJohn.Forte@Sun.COM IMA_SetInitialR2TFn PassFunc; 3126*7836SJohn.Forte@Sun.COM IMA_UINT i; 3127*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3128*7836SJohn.Forte@Sun.COM 3129*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3130*7836SJohn.Forte@Sun.COM InitLibrary(); 3131*7836SJohn.Forte@Sun.COM 3132*7836SJohn.Forte@Sun.COM if (initialR2T != IMA_TRUE && 3133*7836SJohn.Forte@Sun.COM initialR2T != IMA_FALSE) 3134*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3135*7836SJohn.Forte@Sun.COM 3136*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 3137*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 3138*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3139*7836SJohn.Forte@Sun.COM 3140*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3141*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3142*7836SJohn.Forte@Sun.COM 3143*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3144*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3145*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3146*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3147*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3148*7836SJohn.Forte@Sun.COM #ifdef WIN32 3149*7836SJohn.Forte@Sun.COM PassFunc = 3150*7836SJohn.Forte@Sun.COM (IMA_SetInitialR2TFn) GetProcAddress( 3151*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 3152*7836SJohn.Forte@Sun.COM "IMA_SetInitialR2T"); 3153*7836SJohn.Forte@Sun.COM #else 3154*7836SJohn.Forte@Sun.COM PassFunc = 3155*7836SJohn.Forte@Sun.COM (IMA_SetInitialR2TFn) 3156*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3157*7836SJohn.Forte@Sun.COM "IMA_SetInitialR2T"); 3158*7836SJohn.Forte@Sun.COM #endif 3159*7836SJohn.Forte@Sun.COM 3160*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3161*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, initialR2T); 3162*7836SJohn.Forte@Sun.COM } 3163*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3164*7836SJohn.Forte@Sun.COM } 3165*7836SJohn.Forte@Sun.COM 3166*7836SJohn.Forte@Sun.COM break; 3167*7836SJohn.Forte@Sun.COM } 3168*7836SJohn.Forte@Sun.COM } 3169*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3170*7836SJohn.Forte@Sun.COM return (status); 3171*7836SJohn.Forte@Sun.COM } 3172*7836SJohn.Forte@Sun.COM 3173*7836SJohn.Forte@Sun.COM 3174*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetImmediateDataProperties( 3175*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3176*7836SJohn.Forte@Sun.COM IMA_BOOL_VALUE *pProps) { 3177*7836SJohn.Forte@Sun.COM IMA_GetImmediateDataPropertiesFn PassFunc; 3178*7836SJohn.Forte@Sun.COM IMA_UINT i; 3179*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3180*7836SJohn.Forte@Sun.COM 3181*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3182*7836SJohn.Forte@Sun.COM InitLibrary(); 3183*7836SJohn.Forte@Sun.COM 3184*7836SJohn.Forte@Sun.COM if (pProps == NULL) 3185*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3186*7836SJohn.Forte@Sun.COM 3187*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 3188*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 3189*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3190*7836SJohn.Forte@Sun.COM 3191*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3192*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3193*7836SJohn.Forte@Sun.COM 3194*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3195*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3196*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3197*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3198*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3199*7836SJohn.Forte@Sun.COM #ifdef WIN32 3200*7836SJohn.Forte@Sun.COM PassFunc = 3201*7836SJohn.Forte@Sun.COM (IMA_GetImmediateDataPropertiesFn) 3202*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3203*7836SJohn.Forte@Sun.COM "IMA_GetImmediateDataProperties"); 3204*7836SJohn.Forte@Sun.COM #else 3205*7836SJohn.Forte@Sun.COM PassFunc = 3206*7836SJohn.Forte@Sun.COM (IMA_GetImmediateDataPropertiesFn) 3207*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3208*7836SJohn.Forte@Sun.COM "IMA_GetImmediateDataProperties"); 3209*7836SJohn.Forte@Sun.COM #endif 3210*7836SJohn.Forte@Sun.COM 3211*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3212*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 3213*7836SJohn.Forte@Sun.COM } 3214*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3215*7836SJohn.Forte@Sun.COM } 3216*7836SJohn.Forte@Sun.COM 3217*7836SJohn.Forte@Sun.COM break; 3218*7836SJohn.Forte@Sun.COM } 3219*7836SJohn.Forte@Sun.COM } 3220*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3221*7836SJohn.Forte@Sun.COM return (status); 3222*7836SJohn.Forte@Sun.COM } 3223*7836SJohn.Forte@Sun.COM 3224*7836SJohn.Forte@Sun.COM 3225*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetImmediateData( 3226*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3227*7836SJohn.Forte@Sun.COM IMA_BOOL immediateData) { 3228*7836SJohn.Forte@Sun.COM IMA_SetImmediateDataFn PassFunc; 3229*7836SJohn.Forte@Sun.COM IMA_UINT i; 3230*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3231*7836SJohn.Forte@Sun.COM 3232*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3233*7836SJohn.Forte@Sun.COM InitLibrary(); 3234*7836SJohn.Forte@Sun.COM 3235*7836SJohn.Forte@Sun.COM if (immediateData != IMA_TRUE && 3236*7836SJohn.Forte@Sun.COM immediateData != IMA_FALSE) 3237*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3238*7836SJohn.Forte@Sun.COM 3239*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 3240*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 3241*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3242*7836SJohn.Forte@Sun.COM 3243*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3244*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3245*7836SJohn.Forte@Sun.COM 3246*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3247*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3248*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3249*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3250*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3251*7836SJohn.Forte@Sun.COM #ifdef WIN32 3252*7836SJohn.Forte@Sun.COM PassFunc = 3253*7836SJohn.Forte@Sun.COM (IMA_SetImmediateDataFn) 3254*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3255*7836SJohn.Forte@Sun.COM "IMA_SetImmediateData"); 3256*7836SJohn.Forte@Sun.COM #else 3257*7836SJohn.Forte@Sun.COM PassFunc = 3258*7836SJohn.Forte@Sun.COM (IMA_SetImmediateDataFn) 3259*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3260*7836SJohn.Forte@Sun.COM "IMA_SetImmediateData"); 3261*7836SJohn.Forte@Sun.COM #endif 3262*7836SJohn.Forte@Sun.COM 3263*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3264*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, immediateData); 3265*7836SJohn.Forte@Sun.COM } 3266*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3267*7836SJohn.Forte@Sun.COM } 3268*7836SJohn.Forte@Sun.COM 3269*7836SJohn.Forte@Sun.COM break; 3270*7836SJohn.Forte@Sun.COM } 3271*7836SJohn.Forte@Sun.COM } 3272*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3273*7836SJohn.Forte@Sun.COM return (status); 3274*7836SJohn.Forte@Sun.COM } 3275*7836SJohn.Forte@Sun.COM 3276*7836SJohn.Forte@Sun.COM 3277*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDataPduInOrderProperties( 3278*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3279*7836SJohn.Forte@Sun.COM IMA_BOOL_VALUE *pProps) { 3280*7836SJohn.Forte@Sun.COM IMA_GetDataPduInOrderPropertiesFn PassFunc; 3281*7836SJohn.Forte@Sun.COM IMA_UINT i; 3282*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3283*7836SJohn.Forte@Sun.COM 3284*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3285*7836SJohn.Forte@Sun.COM InitLibrary(); 3286*7836SJohn.Forte@Sun.COM 3287*7836SJohn.Forte@Sun.COM if (pProps == NULL) 3288*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3289*7836SJohn.Forte@Sun.COM 3290*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 3291*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 3292*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3293*7836SJohn.Forte@Sun.COM 3294*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3295*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3296*7836SJohn.Forte@Sun.COM 3297*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3298*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3299*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3300*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3301*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3302*7836SJohn.Forte@Sun.COM #ifdef WIN32 3303*7836SJohn.Forte@Sun.COM PassFunc = 3304*7836SJohn.Forte@Sun.COM (IMA_GetDataPduInOrderPropertiesFn) 3305*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3306*7836SJohn.Forte@Sun.COM "IMA_GetDataPduInOrderProperties"); 3307*7836SJohn.Forte@Sun.COM #else 3308*7836SJohn.Forte@Sun.COM PassFunc = 3309*7836SJohn.Forte@Sun.COM (IMA_GetDataPduInOrderPropertiesFn) 3310*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3311*7836SJohn.Forte@Sun.COM "IMA_GetDataPduInOrderProperties"); 3312*7836SJohn.Forte@Sun.COM #endif 3313*7836SJohn.Forte@Sun.COM 3314*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3315*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 3316*7836SJohn.Forte@Sun.COM } 3317*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3318*7836SJohn.Forte@Sun.COM } 3319*7836SJohn.Forte@Sun.COM 3320*7836SJohn.Forte@Sun.COM break; 3321*7836SJohn.Forte@Sun.COM } 3322*7836SJohn.Forte@Sun.COM } 3323*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3324*7836SJohn.Forte@Sun.COM return (status); 3325*7836SJohn.Forte@Sun.COM } 3326*7836SJohn.Forte@Sun.COM 3327*7836SJohn.Forte@Sun.COM 3328*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDataPduInOrder( 3329*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3330*7836SJohn.Forte@Sun.COM IMA_BOOL dataPduInOrder) { 3331*7836SJohn.Forte@Sun.COM IMA_SetDataPduInOrderFn PassFunc; 3332*7836SJohn.Forte@Sun.COM IMA_UINT i; 3333*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3334*7836SJohn.Forte@Sun.COM 3335*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3336*7836SJohn.Forte@Sun.COM InitLibrary(); 3337*7836SJohn.Forte@Sun.COM 3338*7836SJohn.Forte@Sun.COM if (dataPduInOrder != IMA_TRUE && 3339*7836SJohn.Forte@Sun.COM dataPduInOrder != IMA_FALSE) 3340*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3341*7836SJohn.Forte@Sun.COM 3342*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 3343*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 3344*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3345*7836SJohn.Forte@Sun.COM 3346*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3347*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3348*7836SJohn.Forte@Sun.COM 3349*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3350*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3351*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3352*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3353*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3354*7836SJohn.Forte@Sun.COM #ifdef WIN32 3355*7836SJohn.Forte@Sun.COM PassFunc = 3356*7836SJohn.Forte@Sun.COM (IMA_SetDataPduInOrderFn) 3357*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3358*7836SJohn.Forte@Sun.COM "IMA_SetDataPduInOrder"); 3359*7836SJohn.Forte@Sun.COM #else 3360*7836SJohn.Forte@Sun.COM PassFunc = 3361*7836SJohn.Forte@Sun.COM (IMA_SetDataPduInOrderFn) 3362*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3363*7836SJohn.Forte@Sun.COM "IMA_SetDataPduInOrder"); 3364*7836SJohn.Forte@Sun.COM #endif 3365*7836SJohn.Forte@Sun.COM 3366*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3367*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, dataPduInOrder); 3368*7836SJohn.Forte@Sun.COM } 3369*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3370*7836SJohn.Forte@Sun.COM } 3371*7836SJohn.Forte@Sun.COM 3372*7836SJohn.Forte@Sun.COM break; 3373*7836SJohn.Forte@Sun.COM } 3374*7836SJohn.Forte@Sun.COM } 3375*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3376*7836SJohn.Forte@Sun.COM return (status); 3377*7836SJohn.Forte@Sun.COM } 3378*7836SJohn.Forte@Sun.COM 3379*7836SJohn.Forte@Sun.COM 3380*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDataSequenceInOrderProperties( 3381*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3382*7836SJohn.Forte@Sun.COM IMA_BOOL_VALUE *pProps) { 3383*7836SJohn.Forte@Sun.COM IMA_GetDataSequenceInOrderPropertiesFn PassFunc; 3384*7836SJohn.Forte@Sun.COM IMA_UINT i; 3385*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3386*7836SJohn.Forte@Sun.COM 3387*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3388*7836SJohn.Forte@Sun.COM InitLibrary(); 3389*7836SJohn.Forte@Sun.COM 3390*7836SJohn.Forte@Sun.COM if (pProps == NULL) 3391*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3392*7836SJohn.Forte@Sun.COM 3393*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 3394*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 3395*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3396*7836SJohn.Forte@Sun.COM 3397*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3398*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3399*7836SJohn.Forte@Sun.COM 3400*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3401*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3402*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3403*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3404*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3405*7836SJohn.Forte@Sun.COM #ifdef WIN32 3406*7836SJohn.Forte@Sun.COM PassFunc = 3407*7836SJohn.Forte@Sun.COM (IMA_GetDataSequenceInOrderPropertiesFn) 3408*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3409*7836SJohn.Forte@Sun.COM "IMA_GetDataSequenceInOrderProperties"); 3410*7836SJohn.Forte@Sun.COM #else 3411*7836SJohn.Forte@Sun.COM PassFunc = 3412*7836SJohn.Forte@Sun.COM (IMA_GetDataSequenceInOrderPropertiesFn) 3413*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3414*7836SJohn.Forte@Sun.COM "IMA_GetDataSequenceInOrderProperties"); 3415*7836SJohn.Forte@Sun.COM #endif 3416*7836SJohn.Forte@Sun.COM 3417*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3418*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, pProps); 3419*7836SJohn.Forte@Sun.COM } 3420*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3421*7836SJohn.Forte@Sun.COM } 3422*7836SJohn.Forte@Sun.COM 3423*7836SJohn.Forte@Sun.COM break; 3424*7836SJohn.Forte@Sun.COM } 3425*7836SJohn.Forte@Sun.COM } 3426*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3427*7836SJohn.Forte@Sun.COM return (status); 3428*7836SJohn.Forte@Sun.COM } 3429*7836SJohn.Forte@Sun.COM 3430*7836SJohn.Forte@Sun.COM 3431*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDataSequenceInOrder( 3432*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3433*7836SJohn.Forte@Sun.COM IMA_BOOL dataSequenceInOrder) { 3434*7836SJohn.Forte@Sun.COM IMA_SetDataSequenceInOrderFn PassFunc; 3435*7836SJohn.Forte@Sun.COM IMA_UINT i; 3436*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3437*7836SJohn.Forte@Sun.COM 3438*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3439*7836SJohn.Forte@Sun.COM InitLibrary(); 3440*7836SJohn.Forte@Sun.COM 3441*7836SJohn.Forte@Sun.COM if (dataSequenceInOrder != IMA_TRUE && 3442*7836SJohn.Forte@Sun.COM dataSequenceInOrder != IMA_FALSE) 3443*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3444*7836SJohn.Forte@Sun.COM 3445*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 3446*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 3447*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3448*7836SJohn.Forte@Sun.COM 3449*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3450*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3451*7836SJohn.Forte@Sun.COM 3452*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3453*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3454*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3455*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3456*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3457*7836SJohn.Forte@Sun.COM #ifdef WIN32 3458*7836SJohn.Forte@Sun.COM PassFunc = 3459*7836SJohn.Forte@Sun.COM (IMA_SetDataSequenceInOrderFn) 3460*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3461*7836SJohn.Forte@Sun.COM "IMA_SetDataSequenceInOrder"); 3462*7836SJohn.Forte@Sun.COM #else 3463*7836SJohn.Forte@Sun.COM PassFunc = 3464*7836SJohn.Forte@Sun.COM (IMA_SetDataSequenceInOrderFn) 3465*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3466*7836SJohn.Forte@Sun.COM "IMA_SetDataSequenceInOrder"); 3467*7836SJohn.Forte@Sun.COM #endif 3468*7836SJohn.Forte@Sun.COM 3469*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3470*7836SJohn.Forte@Sun.COM status = PassFunc( 3471*7836SJohn.Forte@Sun.COM Oid, dataSequenceInOrder); 3472*7836SJohn.Forte@Sun.COM } 3473*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3474*7836SJohn.Forte@Sun.COM } 3475*7836SJohn.Forte@Sun.COM 3476*7836SJohn.Forte@Sun.COM break; 3477*7836SJohn.Forte@Sun.COM } 3478*7836SJohn.Forte@Sun.COM } 3479*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3480*7836SJohn.Forte@Sun.COM return (status); 3481*7836SJohn.Forte@Sun.COM } 3482*7836SJohn.Forte@Sun.COM 3483*7836SJohn.Forte@Sun.COM 3484*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetStatisticsCollection( 3485*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3486*7836SJohn.Forte@Sun.COM IMA_BOOL enableStatisticsCollection) { 3487*7836SJohn.Forte@Sun.COM IMA_SetStatisticsCollectionFn PassFunc; 3488*7836SJohn.Forte@Sun.COM IMA_UINT i; 3489*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3490*7836SJohn.Forte@Sun.COM 3491*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3492*7836SJohn.Forte@Sun.COM InitLibrary(); 3493*7836SJohn.Forte@Sun.COM 3494*7836SJohn.Forte@Sun.COM if (enableStatisticsCollection != IMA_TRUE && 3495*7836SJohn.Forte@Sun.COM enableStatisticsCollection != IMA_FALSE) 3496*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3497*7836SJohn.Forte@Sun.COM 3498*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_PHBA && 3499*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 3500*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3501*7836SJohn.Forte@Sun.COM 3502*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3503*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3504*7836SJohn.Forte@Sun.COM 3505*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3506*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3507*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3508*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3509*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3510*7836SJohn.Forte@Sun.COM #ifdef WIN32 3511*7836SJohn.Forte@Sun.COM PassFunc = 3512*7836SJohn.Forte@Sun.COM (IMA_SetStatisticsCollectionFn) 3513*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3514*7836SJohn.Forte@Sun.COM "IMA_SetStatisticsCollection"); 3515*7836SJohn.Forte@Sun.COM #else 3516*7836SJohn.Forte@Sun.COM PassFunc = 3517*7836SJohn.Forte@Sun.COM (IMA_SetStatisticsCollectionFn) 3518*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3519*7836SJohn.Forte@Sun.COM "IMA_SetStatisticsCollection"); 3520*7836SJohn.Forte@Sun.COM #endif 3521*7836SJohn.Forte@Sun.COM 3522*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3523*7836SJohn.Forte@Sun.COM status = PassFunc( 3524*7836SJohn.Forte@Sun.COM Oid, enableStatisticsCollection); 3525*7836SJohn.Forte@Sun.COM } 3526*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3527*7836SJohn.Forte@Sun.COM } 3528*7836SJohn.Forte@Sun.COM 3529*7836SJohn.Forte@Sun.COM break; 3530*7836SJohn.Forte@Sun.COM } 3531*7836SJohn.Forte@Sun.COM } 3532*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3533*7836SJohn.Forte@Sun.COM return (status); 3534*7836SJohn.Forte@Sun.COM } 3535*7836SJohn.Forte@Sun.COM 3536*7836SJohn.Forte@Sun.COM 3537*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetNetworkPortStatus( 3538*7836SJohn.Forte@Sun.COM IMA_OID portOid, 3539*7836SJohn.Forte@Sun.COM IMA_NETWORK_PORT_STATUS *pStatus) { 3540*7836SJohn.Forte@Sun.COM IMA_GetNetworkPortStatusFn PassFunc; 3541*7836SJohn.Forte@Sun.COM IMA_UINT i; 3542*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3543*7836SJohn.Forte@Sun.COM 3544*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3545*7836SJohn.Forte@Sun.COM InitLibrary(); 3546*7836SJohn.Forte@Sun.COM 3547*7836SJohn.Forte@Sun.COM if (pStatus == NULL) 3548*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3549*7836SJohn.Forte@Sun.COM 3550*7836SJohn.Forte@Sun.COM if (portOid.objectType != IMA_OBJECT_TYPE_PNP && 3551*7836SJohn.Forte@Sun.COM portOid.objectType != IMA_OBJECT_TYPE_LNP) 3552*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3553*7836SJohn.Forte@Sun.COM 3554*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3555*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3556*7836SJohn.Forte@Sun.COM 3557*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3558*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == portOid.ownerId) { 3559*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3560*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3561*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3562*7836SJohn.Forte@Sun.COM #ifdef WIN32 3563*7836SJohn.Forte@Sun.COM PassFunc = 3564*7836SJohn.Forte@Sun.COM (IMA_GetNetworkPortStatusFn) 3565*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3566*7836SJohn.Forte@Sun.COM "IMA_GetNetworkPortStatus"); 3567*7836SJohn.Forte@Sun.COM #else 3568*7836SJohn.Forte@Sun.COM PassFunc = 3569*7836SJohn.Forte@Sun.COM (IMA_GetNetworkPortStatusFn) 3570*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3571*7836SJohn.Forte@Sun.COM "IMA_GetNetworkPortStatus"); 3572*7836SJohn.Forte@Sun.COM #endif 3573*7836SJohn.Forte@Sun.COM 3574*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3575*7836SJohn.Forte@Sun.COM status = PassFunc(portOid, pStatus); 3576*7836SJohn.Forte@Sun.COM } 3577*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3578*7836SJohn.Forte@Sun.COM } 3579*7836SJohn.Forte@Sun.COM 3580*7836SJohn.Forte@Sun.COM break; 3581*7836SJohn.Forte@Sun.COM } 3582*7836SJohn.Forte@Sun.COM } 3583*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3584*7836SJohn.Forte@Sun.COM return (status); 3585*7836SJohn.Forte@Sun.COM } 3586*7836SJohn.Forte@Sun.COM 3587*7836SJohn.Forte@Sun.COM 3588*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetTargetOidList( 3589*7836SJohn.Forte@Sun.COM IMA_OID Oid, 3590*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 3591*7836SJohn.Forte@Sun.COM IMA_GetTargetOidListFn PassFunc; 3592*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 3593*7836SJohn.Forte@Sun.COM IMA_UINT i; 3594*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3595*7836SJohn.Forte@Sun.COM 3596*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3597*7836SJohn.Forte@Sun.COM InitLibrary(); 3598*7836SJohn.Forte@Sun.COM 3599*7836SJohn.Forte@Sun.COM if (ppList == NULL) 3600*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3601*7836SJohn.Forte@Sun.COM 3602*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 3603*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_LNP) 3604*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3605*7836SJohn.Forte@Sun.COM 3606*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3607*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3608*7836SJohn.Forte@Sun.COM 3609*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3610*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 3611*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3612*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3613*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3614*7836SJohn.Forte@Sun.COM #ifdef WIN32 3615*7836SJohn.Forte@Sun.COM PassFunc = 3616*7836SJohn.Forte@Sun.COM (IMA_GetTargetOidListFn) 3617*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3618*7836SJohn.Forte@Sun.COM "IMA_GetTargetOidList"); 3619*7836SJohn.Forte@Sun.COM #else 3620*7836SJohn.Forte@Sun.COM PassFunc = 3621*7836SJohn.Forte@Sun.COM (IMA_GetTargetOidListFn) 3622*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3623*7836SJohn.Forte@Sun.COM "IMA_GetTargetOidList"); 3624*7836SJohn.Forte@Sun.COM #endif 3625*7836SJohn.Forte@Sun.COM 3626*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3627*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 3628*7836SJohn.Forte@Sun.COM IMA_UINT listSize; 3629*7836SJohn.Forte@Sun.COM listSize = sizeof (IMA_OID_LIST); 3630*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 3631*7836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 3632*7836SJohn.Forte@Sun.COM *ppList = 3633*7836SJohn.Forte@Sun.COM (IMA_OID_LIST*)calloc(1, 3634*7836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST) + 3635*7836SJohn.Forte@Sun.COM ((ppOidList->oidCount - 1)* 3636*7836SJohn.Forte@Sun.COM sizeof (IMA_OID))); 3637*7836SJohn.Forte@Sun.COM 3638*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 3639*7836SJohn.Forte@Sun.COM return (EUOS_ERROR); 3640*7836SJohn.Forte@Sun.COM } 3641*7836SJohn.Forte@Sun.COM else 3642*7836SJohn.Forte@Sun.COM memcpy((*ppList), 3643*7836SJohn.Forte@Sun.COM ppOidList, listSize 3644*7836SJohn.Forte@Sun.COM + (ppOidList-> 3645*7836SJohn.Forte@Sun.COM oidCount - 1)* 3646*7836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 3647*7836SJohn.Forte@Sun.COM #ifdef WIN32 3648*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 3649*7836SJohn.Forte@Sun.COM GetProcAddress( 3650*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 3651*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 3652*7836SJohn.Forte@Sun.COM #else 3653*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 3654*7836SJohn.Forte@Sun.COM dlsym( 3655*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 3656*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 3657*7836SJohn.Forte@Sun.COM #endif 3658*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 3659*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 3660*7836SJohn.Forte@Sun.COM } 3661*7836SJohn.Forte@Sun.COM } 3662*7836SJohn.Forte@Sun.COM } 3663*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3664*7836SJohn.Forte@Sun.COM } 3665*7836SJohn.Forte@Sun.COM 3666*7836SJohn.Forte@Sun.COM break; 3667*7836SJohn.Forte@Sun.COM } 3668*7836SJohn.Forte@Sun.COM } 3669*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3670*7836SJohn.Forte@Sun.COM return (status); 3671*7836SJohn.Forte@Sun.COM } 3672*7836SJohn.Forte@Sun.COM 3673*7836SJohn.Forte@Sun.COM 3674*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RemoveStaleData( 3675*7836SJohn.Forte@Sun.COM IMA_OID lhbaId) { 3676*7836SJohn.Forte@Sun.COM IMA_RemoveStaleDataFn PassFunc; 3677*7836SJohn.Forte@Sun.COM IMA_UINT i; 3678*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3679*7836SJohn.Forte@Sun.COM 3680*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3681*7836SJohn.Forte@Sun.COM InitLibrary(); 3682*7836SJohn.Forte@Sun.COM 3683*7836SJohn.Forte@Sun.COM if (lhbaId.objectType != IMA_OBJECT_TYPE_LHBA) 3684*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3685*7836SJohn.Forte@Sun.COM 3686*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3687*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3688*7836SJohn.Forte@Sun.COM 3689*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3690*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaId.ownerId) { 3691*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3692*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3693*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3694*7836SJohn.Forte@Sun.COM #ifdef WIN32 3695*7836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveStaleDataFn) 3696*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3697*7836SJohn.Forte@Sun.COM "IMA_RemoveStaleData"); 3698*7836SJohn.Forte@Sun.COM #else 3699*7836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveStaleDataFn) 3700*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3701*7836SJohn.Forte@Sun.COM "IMA_RemoveStaleData"); 3702*7836SJohn.Forte@Sun.COM #endif 3703*7836SJohn.Forte@Sun.COM 3704*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3705*7836SJohn.Forte@Sun.COM status = PassFunc(lhbaId); 3706*7836SJohn.Forte@Sun.COM } 3707*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3708*7836SJohn.Forte@Sun.COM } 3709*7836SJohn.Forte@Sun.COM 3710*7836SJohn.Forte@Sun.COM break; 3711*7836SJohn.Forte@Sun.COM } 3712*7836SJohn.Forte@Sun.COM } 3713*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3714*7836SJohn.Forte@Sun.COM return (status); 3715*7836SJohn.Forte@Sun.COM } 3716*7836SJohn.Forte@Sun.COM 3717*7836SJohn.Forte@Sun.COM 3718*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetIsnsDiscovery( 3719*7836SJohn.Forte@Sun.COM IMA_OID phbaId, 3720*7836SJohn.Forte@Sun.COM IMA_BOOL enableIsnsDiscovery, 3721*7836SJohn.Forte@Sun.COM IMA_ISNS_DISCOVERY_METHOD discoveryMethod, 3722*7836SJohn.Forte@Sun.COM const IMA_HOST_ID *iSnsHost) { 3723*7836SJohn.Forte@Sun.COM IMA_SetIsnsDiscoveryFn PassFunc; 3724*7836SJohn.Forte@Sun.COM IMA_UINT i; 3725*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3726*7836SJohn.Forte@Sun.COM 3727*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3728*7836SJohn.Forte@Sun.COM InitLibrary(); 3729*7836SJohn.Forte@Sun.COM 3730*7836SJohn.Forte@Sun.COM if (enableIsnsDiscovery != IMA_TRUE && 3731*7836SJohn.Forte@Sun.COM enableIsnsDiscovery != IMA_FALSE) 3732*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3733*7836SJohn.Forte@Sun.COM 3734*7836SJohn.Forte@Sun.COM if (enableIsnsDiscovery == IMA_TRUE && iSnsHost == NULL) 3735*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3736*7836SJohn.Forte@Sun.COM 3737*7836SJohn.Forte@Sun.COM if (discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_STATIC && 3738*7836SJohn.Forte@Sun.COM discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_DHCP && 3739*7836SJohn.Forte@Sun.COM discoveryMethod != IMA_ISNS_DISCOVERY_METHOD_SLP) 3740*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3741*7836SJohn.Forte@Sun.COM 3742*7836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && 3743*7836SJohn.Forte@Sun.COM phbaId.objectType != IMA_OBJECT_TYPE_LHBA) { 3744*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3745*7836SJohn.Forte@Sun.COM } 3746*7836SJohn.Forte@Sun.COM 3747*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3748*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3749*7836SJohn.Forte@Sun.COM 3750*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3751*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 3752*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3753*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3754*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3755*7836SJohn.Forte@Sun.COM #ifdef WIN32 3756*7836SJohn.Forte@Sun.COM PassFunc = 3757*7836SJohn.Forte@Sun.COM (IMA_SetIsnsDiscoveryFn) 3758*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3759*7836SJohn.Forte@Sun.COM "IMA_SetIsnsDiscovery"); 3760*7836SJohn.Forte@Sun.COM #else 3761*7836SJohn.Forte@Sun.COM PassFunc = 3762*7836SJohn.Forte@Sun.COM (IMA_SetIsnsDiscoveryFn) 3763*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3764*7836SJohn.Forte@Sun.COM "IMA_SetIsnsDiscovery"); 3765*7836SJohn.Forte@Sun.COM #endif 3766*7836SJohn.Forte@Sun.COM 3767*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3768*7836SJohn.Forte@Sun.COM status = PassFunc(phbaId, 3769*7836SJohn.Forte@Sun.COM enableIsnsDiscovery, 3770*7836SJohn.Forte@Sun.COM discoveryMethod, iSnsHost); 3771*7836SJohn.Forte@Sun.COM } 3772*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3773*7836SJohn.Forte@Sun.COM } 3774*7836SJohn.Forte@Sun.COM 3775*7836SJohn.Forte@Sun.COM break; 3776*7836SJohn.Forte@Sun.COM } 3777*7836SJohn.Forte@Sun.COM } 3778*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3779*7836SJohn.Forte@Sun.COM return (status); 3780*7836SJohn.Forte@Sun.COM } 3781*7836SJohn.Forte@Sun.COM 3782*7836SJohn.Forte@Sun.COM 3783*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetSlpDiscovery( 3784*7836SJohn.Forte@Sun.COM IMA_OID phbaId, 3785*7836SJohn.Forte@Sun.COM IMA_BOOL enableSlpDiscovery) { 3786*7836SJohn.Forte@Sun.COM IMA_SetSlpDiscoveryFn PassFunc; 3787*7836SJohn.Forte@Sun.COM IMA_UINT i; 3788*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3789*7836SJohn.Forte@Sun.COM 3790*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3791*7836SJohn.Forte@Sun.COM InitLibrary(); 3792*7836SJohn.Forte@Sun.COM 3793*7836SJohn.Forte@Sun.COM if (enableSlpDiscovery != IMA_TRUE && 3794*7836SJohn.Forte@Sun.COM enableSlpDiscovery != IMA_FALSE) 3795*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3796*7836SJohn.Forte@Sun.COM 3797*7836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && 3798*7836SJohn.Forte@Sun.COM phbaId.objectType != IMA_OBJECT_TYPE_LHBA) 3799*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3800*7836SJohn.Forte@Sun.COM 3801*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3802*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3803*7836SJohn.Forte@Sun.COM 3804*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3805*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 3806*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3807*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3808*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3809*7836SJohn.Forte@Sun.COM #ifdef WIN32 3810*7836SJohn.Forte@Sun.COM PassFunc = 3811*7836SJohn.Forte@Sun.COM (IMA_SetSlpDiscoveryFn) 3812*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3813*7836SJohn.Forte@Sun.COM "IMA_SetSlpDiscovery"); 3814*7836SJohn.Forte@Sun.COM #else 3815*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetSlpDiscoveryFn) 3816*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3817*7836SJohn.Forte@Sun.COM "IMA_SetSlpDiscovery"); 3818*7836SJohn.Forte@Sun.COM #endif 3819*7836SJohn.Forte@Sun.COM 3820*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3821*7836SJohn.Forte@Sun.COM status = PassFunc( 3822*7836SJohn.Forte@Sun.COM phbaId, 3823*7836SJohn.Forte@Sun.COM enableSlpDiscovery); 3824*7836SJohn.Forte@Sun.COM } 3825*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3826*7836SJohn.Forte@Sun.COM } 3827*7836SJohn.Forte@Sun.COM 3828*7836SJohn.Forte@Sun.COM break; 3829*7836SJohn.Forte@Sun.COM } 3830*7836SJohn.Forte@Sun.COM } 3831*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3832*7836SJohn.Forte@Sun.COM return (status); 3833*7836SJohn.Forte@Sun.COM } 3834*7836SJohn.Forte@Sun.COM 3835*7836SJohn.Forte@Sun.COM 3836*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetStaticDiscovery( 3837*7836SJohn.Forte@Sun.COM IMA_OID phbaId, 3838*7836SJohn.Forte@Sun.COM IMA_BOOL enableStaticDiscovery) { 3839*7836SJohn.Forte@Sun.COM IMA_SetStaticDiscoveryFn PassFunc; 3840*7836SJohn.Forte@Sun.COM IMA_UINT i; 3841*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3842*7836SJohn.Forte@Sun.COM 3843*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3844*7836SJohn.Forte@Sun.COM InitLibrary(); 3845*7836SJohn.Forte@Sun.COM 3846*7836SJohn.Forte@Sun.COM if (enableStaticDiscovery != IMA_TRUE && 3847*7836SJohn.Forte@Sun.COM enableStaticDiscovery != IMA_FALSE) 3848*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3849*7836SJohn.Forte@Sun.COM 3850*7836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && 3851*7836SJohn.Forte@Sun.COM phbaId.objectType != IMA_OBJECT_TYPE_LHBA) 3852*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3853*7836SJohn.Forte@Sun.COM 3854*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3855*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3856*7836SJohn.Forte@Sun.COM 3857*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3858*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 3859*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3860*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3861*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3862*7836SJohn.Forte@Sun.COM #ifdef WIN32 3863*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetStaticDiscoveryFn) 3864*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3865*7836SJohn.Forte@Sun.COM "IMA_SetStaticDiscovery"); 3866*7836SJohn.Forte@Sun.COM #else 3867*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetStaticDiscoveryFn) 3868*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3869*7836SJohn.Forte@Sun.COM "IMA_SetStaticDiscovery"); 3870*7836SJohn.Forte@Sun.COM #endif 3871*7836SJohn.Forte@Sun.COM 3872*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3873*7836SJohn.Forte@Sun.COM status = PassFunc( 3874*7836SJohn.Forte@Sun.COM phbaId, 3875*7836SJohn.Forte@Sun.COM enableStaticDiscovery); 3876*7836SJohn.Forte@Sun.COM } 3877*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 3878*7836SJohn.Forte@Sun.COM } 3879*7836SJohn.Forte@Sun.COM 3880*7836SJohn.Forte@Sun.COM break; 3881*7836SJohn.Forte@Sun.COM } 3882*7836SJohn.Forte@Sun.COM } 3883*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3884*7836SJohn.Forte@Sun.COM return (status); 3885*7836SJohn.Forte@Sun.COM } 3886*7836SJohn.Forte@Sun.COM 3887*7836SJohn.Forte@Sun.COM 3888*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetSendTargetsDiscovery( 3889*7836SJohn.Forte@Sun.COM IMA_OID phbaId, 3890*7836SJohn.Forte@Sun.COM IMA_BOOL enableSendTargetsDiscovery) { 3891*7836SJohn.Forte@Sun.COM IMA_SetSendTargetsDiscoveryFn PassFunc; 3892*7836SJohn.Forte@Sun.COM IMA_UINT i; 3893*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3894*7836SJohn.Forte@Sun.COM 3895*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3896*7836SJohn.Forte@Sun.COM InitLibrary(); 3897*7836SJohn.Forte@Sun.COM 3898*7836SJohn.Forte@Sun.COM if (enableSendTargetsDiscovery != IMA_TRUE && 3899*7836SJohn.Forte@Sun.COM enableSendTargetsDiscovery != IMA_FALSE) 3900*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 3901*7836SJohn.Forte@Sun.COM 3902*7836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA && 3903*7836SJohn.Forte@Sun.COM phbaId.objectType != IMA_OBJECT_TYPE_LHBA) { 3904*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 3905*7836SJohn.Forte@Sun.COM } 3906*7836SJohn.Forte@Sun.COM 3907*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3908*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3909*7836SJohn.Forte@Sun.COM 3910*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3911*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 3912*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3913*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3914*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3915*7836SJohn.Forte@Sun.COM #ifdef WIN32 3916*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetSendTargetsDiscoveryFn) 3917*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3918*7836SJohn.Forte@Sun.COM "IMA_SetSendTargetsDiscovery"); 3919*7836SJohn.Forte@Sun.COM #else 3920*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetSendTargetsDiscoveryFn) 3921*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3922*7836SJohn.Forte@Sun.COM "IMA_SetSendTargetsDiscovery"); 3923*7836SJohn.Forte@Sun.COM #endif 3924*7836SJohn.Forte@Sun.COM 3925*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3926*7836SJohn.Forte@Sun.COM status = PassFunc( 3927*7836SJohn.Forte@Sun.COM phbaId, 3928*7836SJohn.Forte@Sun.COM enableSendTargetsDiscovery); 3929*7836SJohn.Forte@Sun.COM } 3930*7836SJohn.Forte@Sun.COM os_releasemutex( 3931*7836SJohn.Forte@Sun.COM plugintable[i].pluginMutex); 3932*7836SJohn.Forte@Sun.COM } 3933*7836SJohn.Forte@Sun.COM 3934*7836SJohn.Forte@Sun.COM break; 3935*7836SJohn.Forte@Sun.COM } 3936*7836SJohn.Forte@Sun.COM } 3937*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 3938*7836SJohn.Forte@Sun.COM return (status); 3939*7836SJohn.Forte@Sun.COM } 3940*7836SJohn.Forte@Sun.COM 3941*7836SJohn.Forte@Sun.COM /* 3942*7836SJohn.Forte@Sun.COM * this forces plugins to rescan all iscsi targets on this 3943*7836SJohn.Forte@Sun.COM * ipaddress/port and return a 3944*7836SJohn.Forte@Sun.COM * list of discovered targets. 3945*7836SJohn.Forte@Sun.COM * ERROR/todo: 3946*7836SJohn.Forte@Sun.COM * according to IMA spec., pTargetOidList is allocated by 3947*7836SJohn.Forte@Sun.COM * the caller for library to return data, 3948*7836SJohn.Forte@Sun.COM * how does a caller know how much space it will be? 3949*7836SJohn.Forte@Sun.COM * pTargetOidList should be allocated by the library/plugin 3950*7836SJohn.Forte@Sun.COM * like IMA_GetLnpOidList 3951*7836SJohn.Forte@Sun.COM */ 3952*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_AddPhbaStaticDiscoveryTarget( 3953*7836SJohn.Forte@Sun.COM IMA_OID phbaOid, 3954*7836SJohn.Forte@Sun.COM const IMA_TARGET_ADDRESS targetAddress, 3955*7836SJohn.Forte@Sun.COM IMA_OID_LIST **pTargetOidList) { 3956*7836SJohn.Forte@Sun.COM IMA_AddPhbaStaticDiscoveryTargetFn PassFunc; 3957*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 3958*7836SJohn.Forte@Sun.COM IMA_UINT i; 3959*7836SJohn.Forte@Sun.COM IMA_STATUS status; 3960*7836SJohn.Forte@Sun.COM 3961*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 3962*7836SJohn.Forte@Sun.COM InitLibrary(); 3963*7836SJohn.Forte@Sun.COM 3964*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 3965*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 3966*7836SJohn.Forte@Sun.COM 3967*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 3968*7836SJohn.Forte@Sun.COM 3969*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaOid.ownerId) { 3970*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 3971*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 3972*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 3973*7836SJohn.Forte@Sun.COM #ifdef WIN32 3974*7836SJohn.Forte@Sun.COM PassFunc = 3975*7836SJohn.Forte@Sun.COM (IMA_AddPhbaStaticDiscoveryTargetFn) 3976*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 3977*7836SJohn.Forte@Sun.COM "IMA_AddPhbaStaticDiscoveryTarget"); 3978*7836SJohn.Forte@Sun.COM #else 3979*7836SJohn.Forte@Sun.COM PassFunc = 3980*7836SJohn.Forte@Sun.COM (IMA_AddPhbaStaticDiscoveryTargetFn) 3981*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 3982*7836SJohn.Forte@Sun.COM "IMA_AddPhbaStaticDiscoveryTarget"); 3983*7836SJohn.Forte@Sun.COM #endif 3984*7836SJohn.Forte@Sun.COM 3985*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 3986*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 3987*7836SJohn.Forte@Sun.COM IMA_UINT listSize; 3988*7836SJohn.Forte@Sun.COM listSize = 3989*7836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST); 3990*7836SJohn.Forte@Sun.COM status = PassFunc(phbaOid, 3991*7836SJohn.Forte@Sun.COM targetAddress, &ppOidList); 3992*7836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 3993*7836SJohn.Forte@Sun.COM 3994*7836SJohn.Forte@Sun.COM (*pTargetOidList) = 3995*7836SJohn.Forte@Sun.COM (IMA_OID_LIST*) 3996*7836SJohn.Forte@Sun.COM calloc(1, listSize + 3997*7836SJohn.Forte@Sun.COM (ppOidList->oidCount-1)* 3998*7836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 3999*7836SJohn.Forte@Sun.COM 4000*7836SJohn.Forte@Sun.COM if ((*pTargetOidList) == NULL) { 4001*7836SJohn.Forte@Sun.COM status = 4002*7836SJohn.Forte@Sun.COM EUOS_ERROR; 4003*7836SJohn.Forte@Sun.COM } 4004*7836SJohn.Forte@Sun.COM memcpy((*pTargetOidList), 4005*7836SJohn.Forte@Sun.COM ppOidList, 4006*7836SJohn.Forte@Sun.COM listSize + 4007*7836SJohn.Forte@Sun.COM (ppOidList->oidCount-1)* 4008*7836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 4009*7836SJohn.Forte@Sun.COM #ifdef WIN32 4010*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 4011*7836SJohn.Forte@Sun.COM GetProcAddress( 4012*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 4013*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 4014*7836SJohn.Forte@Sun.COM #else 4015*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 4016*7836SJohn.Forte@Sun.COM dlsym( 4017*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 4018*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 4019*7836SJohn.Forte@Sun.COM #endif 4020*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 4021*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 4022*7836SJohn.Forte@Sun.COM } 4023*7836SJohn.Forte@Sun.COM } 4024*7836SJohn.Forte@Sun.COM } 4025*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4026*7836SJohn.Forte@Sun.COM } 4027*7836SJohn.Forte@Sun.COM 4028*7836SJohn.Forte@Sun.COM break; 4029*7836SJohn.Forte@Sun.COM } 4030*7836SJohn.Forte@Sun.COM } 4031*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4032*7836SJohn.Forte@Sun.COM return (status); 4033*7836SJohn.Forte@Sun.COM } 4034*7836SJohn.Forte@Sun.COM 4035*7836SJohn.Forte@Sun.COM 4036*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RemovePhbaStaticDiscoveryTarget( 4037*7836SJohn.Forte@Sun.COM IMA_OID phbaOid, 4038*7836SJohn.Forte@Sun.COM IMA_OID targetOid) { 4039*7836SJohn.Forte@Sun.COM IMA_RemovePhbaStaticDiscoveryTargetFn PassFunc; 4040*7836SJohn.Forte@Sun.COM IMA_UINT i; 4041*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4042*7836SJohn.Forte@Sun.COM 4043*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4044*7836SJohn.Forte@Sun.COM InitLibrary(); 4045*7836SJohn.Forte@Sun.COM 4046*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4047*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4048*7836SJohn.Forte@Sun.COM 4049*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4050*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == targetOid.ownerId) { 4051*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4052*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4053*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4054*7836SJohn.Forte@Sun.COM #ifdef WIN32 4055*7836SJohn.Forte@Sun.COM PassFunc = 4056*7836SJohn.Forte@Sun.COM (IMA_RemovePhbaStaticDiscoveryTargetFn) 4057*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4058*7836SJohn.Forte@Sun.COM "IMA_RemovePhbaStaticDiscoveryTarget"); 4059*7836SJohn.Forte@Sun.COM #else 4060*7836SJohn.Forte@Sun.COM PassFunc = 4061*7836SJohn.Forte@Sun.COM (IMA_RemovePhbaStaticDiscoveryTargetFn) 4062*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4063*7836SJohn.Forte@Sun.COM "IMA_RemovePhbaStaticDiscoveryTarget"); 4064*7836SJohn.Forte@Sun.COM #endif 4065*7836SJohn.Forte@Sun.COM 4066*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4067*7836SJohn.Forte@Sun.COM status = PassFunc(phbaOid, targetOid); 4068*7836SJohn.Forte@Sun.COM } 4069*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4070*7836SJohn.Forte@Sun.COM } 4071*7836SJohn.Forte@Sun.COM 4072*7836SJohn.Forte@Sun.COM break; 4073*7836SJohn.Forte@Sun.COM } 4074*7836SJohn.Forte@Sun.COM } 4075*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4076*7836SJohn.Forte@Sun.COM return (status); 4077*7836SJohn.Forte@Sun.COM } 4078*7836SJohn.Forte@Sun.COM 4079*7836SJohn.Forte@Sun.COM 4080*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPnpOidList( 4081*7836SJohn.Forte@Sun.COM IMA_OID Oid, 4082*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 4083*7836SJohn.Forte@Sun.COM IMA_GetPnpOidListFn PassFunc; 4084*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 4085*7836SJohn.Forte@Sun.COM IMA_UINT i; 4086*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4087*7836SJohn.Forte@Sun.COM 4088*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4089*7836SJohn.Forte@Sun.COM InitLibrary(); 4090*7836SJohn.Forte@Sun.COM 4091*7836SJohn.Forte@Sun.COM if (ppList == NULL) 4092*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4093*7836SJohn.Forte@Sun.COM 4094*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_PHBA && 4095*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_LNP) 4096*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4097*7836SJohn.Forte@Sun.COM 4098*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4099*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4100*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4101*7836SJohn.Forte@Sun.COM 4102*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 4103*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4104*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4105*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4106*7836SJohn.Forte@Sun.COM #ifdef WIN32 4107*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpOidListFn) 4108*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4109*7836SJohn.Forte@Sun.COM "IMA_GetPnpOidList"); 4110*7836SJohn.Forte@Sun.COM #else 4111*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpOidListFn) 4112*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4113*7836SJohn.Forte@Sun.COM "IMA_GetPnpOidList"); 4114*7836SJohn.Forte@Sun.COM #endif 4115*7836SJohn.Forte@Sun.COM 4116*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4117*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 4118*7836SJohn.Forte@Sun.COM 4119*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 4120*7836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 4121*7836SJohn.Forte@Sun.COM IMA_UINT listSize; 4122*7836SJohn.Forte@Sun.COM listSize = 4123*7836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST); 4124*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*) 4125*7836SJohn.Forte@Sun.COM calloc(1, listSize + 4126*7836SJohn.Forte@Sun.COM (ppOidList->oidCount-1)* 4127*7836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 4128*7836SJohn.Forte@Sun.COM 4129*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 4130*7836SJohn.Forte@Sun.COM status = 4131*7836SJohn.Forte@Sun.COM EUOS_ERROR; 4132*7836SJohn.Forte@Sun.COM } 4133*7836SJohn.Forte@Sun.COM else 4134*7836SJohn.Forte@Sun.COM memcpy((*ppList), 4135*7836SJohn.Forte@Sun.COM ppOidList, 4136*7836SJohn.Forte@Sun.COM listSize + 4137*7836SJohn.Forte@Sun.COM (ppOidList-> 4138*7836SJohn.Forte@Sun.COM oidCount - 1)* 4139*7836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 4140*7836SJohn.Forte@Sun.COM #ifdef WIN32 4141*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 4142*7836SJohn.Forte@Sun.COM GetProcAddress( 4143*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 4144*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 4145*7836SJohn.Forte@Sun.COM #else 4146*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 4147*7836SJohn.Forte@Sun.COM dlsym( 4148*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 4149*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 4150*7836SJohn.Forte@Sun.COM #endif 4151*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 4152*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 4153*7836SJohn.Forte@Sun.COM } 4154*7836SJohn.Forte@Sun.COM } 4155*7836SJohn.Forte@Sun.COM } 4156*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4157*7836SJohn.Forte@Sun.COM } 4158*7836SJohn.Forte@Sun.COM 4159*7836SJohn.Forte@Sun.COM break; 4160*7836SJohn.Forte@Sun.COM } 4161*7836SJohn.Forte@Sun.COM } 4162*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4163*7836SJohn.Forte@Sun.COM return (status); 4164*7836SJohn.Forte@Sun.COM } 4165*7836SJohn.Forte@Sun.COM 4166*7836SJohn.Forte@Sun.COM 4167*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPhbaDownloadProperties( 4168*7836SJohn.Forte@Sun.COM IMA_OID phbaId, 4169*7836SJohn.Forte@Sun.COM IMA_PHBA_DOWNLOAD_PROPERTIES *pProps) { 4170*7836SJohn.Forte@Sun.COM IMA_GetPhbaDownloadPropertiesFn PassFunc; 4171*7836SJohn.Forte@Sun.COM IMA_UINT i; 4172*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4173*7836SJohn.Forte@Sun.COM 4174*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4175*7836SJohn.Forte@Sun.COM InitLibrary(); 4176*7836SJohn.Forte@Sun.COM 4177*7836SJohn.Forte@Sun.COM if (pProps == NULL) 4178*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4179*7836SJohn.Forte@Sun.COM 4180*7836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) 4181*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4182*7836SJohn.Forte@Sun.COM 4183*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4184*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4185*7836SJohn.Forte@Sun.COM 4186*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4187*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 4188*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4189*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4190*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4191*7836SJohn.Forte@Sun.COM #ifdef WIN32 4192*7836SJohn.Forte@Sun.COM PassFunc = 4193*7836SJohn.Forte@Sun.COM (IMA_GetPhbaDownloadPropertiesFn) 4194*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4195*7836SJohn.Forte@Sun.COM "IMA_GetPhbaDownloadProperties"); 4196*7836SJohn.Forte@Sun.COM #else 4197*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaDownloadPropertiesFn) 4198*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4199*7836SJohn.Forte@Sun.COM "IMA_GetPhbaDownloadProperties"); 4200*7836SJohn.Forte@Sun.COM #endif 4201*7836SJohn.Forte@Sun.COM 4202*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4203*7836SJohn.Forte@Sun.COM status = PassFunc(phbaId, pProps); 4204*7836SJohn.Forte@Sun.COM } 4205*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4206*7836SJohn.Forte@Sun.COM } 4207*7836SJohn.Forte@Sun.COM 4208*7836SJohn.Forte@Sun.COM break; 4209*7836SJohn.Forte@Sun.COM } 4210*7836SJohn.Forte@Sun.COM } 4211*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4212*7836SJohn.Forte@Sun.COM return (status); 4213*7836SJohn.Forte@Sun.COM } 4214*7836SJohn.Forte@Sun.COM 4215*7836SJohn.Forte@Sun.COM 4216*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_IsPhbaDownloadFile( 4217*7836SJohn.Forte@Sun.COM IMA_OID phbaId, 4218*7836SJohn.Forte@Sun.COM const IMA_WCHAR *pFileName, 4219*7836SJohn.Forte@Sun.COM IMA_PHBA_DOWNLOAD_IMAGE_PROPERTIES *pProps) { 4220*7836SJohn.Forte@Sun.COM IMA_IsPhbaDownloadFileFn PassFunc; 4221*7836SJohn.Forte@Sun.COM IMA_UINT i; 4222*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4223*7836SJohn.Forte@Sun.COM 4224*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4225*7836SJohn.Forte@Sun.COM InitLibrary(); 4226*7836SJohn.Forte@Sun.COM 4227*7836SJohn.Forte@Sun.COM if (pFileName == NULL || pProps == NULL) 4228*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4229*7836SJohn.Forte@Sun.COM 4230*7836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) 4231*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4232*7836SJohn.Forte@Sun.COM 4233*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4234*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4235*7836SJohn.Forte@Sun.COM 4236*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4237*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 4238*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4239*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4240*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4241*7836SJohn.Forte@Sun.COM #ifdef WIN32 4242*7836SJohn.Forte@Sun.COM PassFunc = (IMA_IsPhbaDownloadFileFn) 4243*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4244*7836SJohn.Forte@Sun.COM "IMA_IsPhbaDownloadFile"); 4245*7836SJohn.Forte@Sun.COM #else 4246*7836SJohn.Forte@Sun.COM PassFunc = (IMA_IsPhbaDownloadFileFn) 4247*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4248*7836SJohn.Forte@Sun.COM "IMA_IsPhbaDownloadFile"); 4249*7836SJohn.Forte@Sun.COM #endif 4250*7836SJohn.Forte@Sun.COM 4251*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4252*7836SJohn.Forte@Sun.COM status = PassFunc( 4253*7836SJohn.Forte@Sun.COM phbaId, pFileName, pProps); 4254*7836SJohn.Forte@Sun.COM } 4255*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4256*7836SJohn.Forte@Sun.COM } 4257*7836SJohn.Forte@Sun.COM 4258*7836SJohn.Forte@Sun.COM break; 4259*7836SJohn.Forte@Sun.COM } 4260*7836SJohn.Forte@Sun.COM } 4261*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4262*7836SJohn.Forte@Sun.COM return (status); 4263*7836SJohn.Forte@Sun.COM } 4264*7836SJohn.Forte@Sun.COM 4265*7836SJohn.Forte@Sun.COM 4266*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_PhbaDownload( 4267*7836SJohn.Forte@Sun.COM IMA_OID phbaId, 4268*7836SJohn.Forte@Sun.COM IMA_PHBA_DOWNLOAD_IMAGE_TYPE imageType, 4269*7836SJohn.Forte@Sun.COM const IMA_WCHAR *pFileName) { 4270*7836SJohn.Forte@Sun.COM IMA_PhbaDownloadFn PassFunc; 4271*7836SJohn.Forte@Sun.COM IMA_UINT i; 4272*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4273*7836SJohn.Forte@Sun.COM 4274*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4275*7836SJohn.Forte@Sun.COM InitLibrary(); 4276*7836SJohn.Forte@Sun.COM 4277*7836SJohn.Forte@Sun.COM if (phbaId.objectType != IMA_OBJECT_TYPE_PHBA) 4278*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4279*7836SJohn.Forte@Sun.COM 4280*7836SJohn.Forte@Sun.COM if (imageType != IMA_DOWNLOAD_IMAGE_TYPE_FIRMWARE && 4281*7836SJohn.Forte@Sun.COM imageType != IMA_DOWNLOAD_IMAGE_TYPE_OPTION_ROM && 4282*7836SJohn.Forte@Sun.COM imageType != IMA_DOWNLOAD_IMAGE_TYPE_ALL && 4283*7836SJohn.Forte@Sun.COM imageType != IMA_DOWNLOAD_IMAGE_TYPE_BOOTCODE) 4284*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4285*7836SJohn.Forte@Sun.COM 4286*7836SJohn.Forte@Sun.COM if (pFileName == NULL) 4287*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4288*7836SJohn.Forte@Sun.COM 4289*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4290*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4291*7836SJohn.Forte@Sun.COM 4292*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4293*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == phbaId.ownerId) { 4294*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4295*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4296*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4297*7836SJohn.Forte@Sun.COM #ifdef WIN32 4298*7836SJohn.Forte@Sun.COM PassFunc = (IMA_PhbaDownloadFn) 4299*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4300*7836SJohn.Forte@Sun.COM "IMA_PhbaDownload"); 4301*7836SJohn.Forte@Sun.COM #else 4302*7836SJohn.Forte@Sun.COM PassFunc = (IMA_PhbaDownloadFn) 4303*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4304*7836SJohn.Forte@Sun.COM "IMA_PhbaDownload"); 4305*7836SJohn.Forte@Sun.COM #endif 4306*7836SJohn.Forte@Sun.COM 4307*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4308*7836SJohn.Forte@Sun.COM status = PassFunc( 4309*7836SJohn.Forte@Sun.COM phbaId, imageType, pFileName); 4310*7836SJohn.Forte@Sun.COM } 4311*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4312*7836SJohn.Forte@Sun.COM } 4313*7836SJohn.Forte@Sun.COM 4314*7836SJohn.Forte@Sun.COM break; 4315*7836SJohn.Forte@Sun.COM } 4316*7836SJohn.Forte@Sun.COM } 4317*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4318*7836SJohn.Forte@Sun.COM return (status); 4319*7836SJohn.Forte@Sun.COM } 4320*7836SJohn.Forte@Sun.COM 4321*7836SJohn.Forte@Sun.COM 4322*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetNetworkPortalProperties( 4323*7836SJohn.Forte@Sun.COM IMA_OID networkPortalId, 4324*7836SJohn.Forte@Sun.COM IMA_NETWORK_PORTAL_PROPERTIES *pProps) { 4325*7836SJohn.Forte@Sun.COM IMA_GetNetworkPortalPropertiesFn PassFunc; 4326*7836SJohn.Forte@Sun.COM IMA_UINT i; 4327*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4328*7836SJohn.Forte@Sun.COM 4329*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4330*7836SJohn.Forte@Sun.COM InitLibrary(); 4331*7836SJohn.Forte@Sun.COM 4332*7836SJohn.Forte@Sun.COM if (pProps == NULL) 4333*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4334*7836SJohn.Forte@Sun.COM 4335*7836SJohn.Forte@Sun.COM if (networkPortalId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL) 4336*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4337*7836SJohn.Forte@Sun.COM 4338*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4339*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4340*7836SJohn.Forte@Sun.COM 4341*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4342*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == networkPortalId.ownerId) { 4343*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4344*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4345*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4346*7836SJohn.Forte@Sun.COM #ifdef WIN32 4347*7836SJohn.Forte@Sun.COM PassFunc = 4348*7836SJohn.Forte@Sun.COM (IMA_GetNetworkPortalPropertiesFn) 4349*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4350*7836SJohn.Forte@Sun.COM "IMA_GetNetworkPortalProperties"); 4351*7836SJohn.Forte@Sun.COM #else 4352*7836SJohn.Forte@Sun.COM PassFunc = 4353*7836SJohn.Forte@Sun.COM (IMA_GetNetworkPortalPropertiesFn) 4354*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4355*7836SJohn.Forte@Sun.COM "IMA_GetNetworkPortalProperties"); 4356*7836SJohn.Forte@Sun.COM #endif 4357*7836SJohn.Forte@Sun.COM 4358*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4359*7836SJohn.Forte@Sun.COM status = PassFunc( 4360*7836SJohn.Forte@Sun.COM networkPortalId, pProps); 4361*7836SJohn.Forte@Sun.COM } 4362*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4363*7836SJohn.Forte@Sun.COM } 4364*7836SJohn.Forte@Sun.COM 4365*7836SJohn.Forte@Sun.COM break; 4366*7836SJohn.Forte@Sun.COM } 4367*7836SJohn.Forte@Sun.COM } 4368*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4369*7836SJohn.Forte@Sun.COM return (status); 4370*7836SJohn.Forte@Sun.COM } 4371*7836SJohn.Forte@Sun.COM 4372*7836SJohn.Forte@Sun.COM 4373*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetNetworkPortalIpAddress( 4374*7836SJohn.Forte@Sun.COM IMA_OID networkPortalId, 4375*7836SJohn.Forte@Sun.COM const IMA_IP_ADDRESS NewIpAddress) { 4376*7836SJohn.Forte@Sun.COM IMA_SetNetworkPortalIpAddressFn PassFunc; 4377*7836SJohn.Forte@Sun.COM IMA_UINT i; 4378*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4379*7836SJohn.Forte@Sun.COM 4380*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4381*7836SJohn.Forte@Sun.COM InitLibrary(); 4382*7836SJohn.Forte@Sun.COM 4383*7836SJohn.Forte@Sun.COM if (networkPortalId.objectType != IMA_OBJECT_TYPE_NETWORK_PORTAL) 4384*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4385*7836SJohn.Forte@Sun.COM 4386*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4387*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4388*7836SJohn.Forte@Sun.COM 4389*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4390*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == networkPortalId.ownerId) { 4391*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4392*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4393*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4394*7836SJohn.Forte@Sun.COM #ifdef WIN32 4395*7836SJohn.Forte@Sun.COM PassFunc = 4396*7836SJohn.Forte@Sun.COM (IMA_SetNetworkPortalIpAddressFn) 4397*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4398*7836SJohn.Forte@Sun.COM "IMA_SetNetworkPortalIpAddress"); 4399*7836SJohn.Forte@Sun.COM #else 4400*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetNetworkPortalIpAddressFn) 4401*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4402*7836SJohn.Forte@Sun.COM "IMA_SetNetworkPortalIpAddress"); 4403*7836SJohn.Forte@Sun.COM #endif 4404*7836SJohn.Forte@Sun.COM 4405*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4406*7836SJohn.Forte@Sun.COM status = PassFunc( 4407*7836SJohn.Forte@Sun.COM networkPortalId, NewIpAddress); 4408*7836SJohn.Forte@Sun.COM } 4409*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4410*7836SJohn.Forte@Sun.COM } 4411*7836SJohn.Forte@Sun.COM 4412*7836SJohn.Forte@Sun.COM break; 4413*7836SJohn.Forte@Sun.COM } 4414*7836SJohn.Forte@Sun.COM } 4415*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4416*7836SJohn.Forte@Sun.COM return (status); 4417*7836SJohn.Forte@Sun.COM } 4418*7836SJohn.Forte@Sun.COM 4419*7836SJohn.Forte@Sun.COM 4420*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLnpOidList( 4421*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 4422*7836SJohn.Forte@Sun.COM IMA_GetLnpOidListFn PassFunc; 4423*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 4424*7836SJohn.Forte@Sun.COM 4425*7836SJohn.Forte@Sun.COM IMA_UINT i; 4426*7836SJohn.Forte@Sun.COM IMA_UINT j; 4427*7836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 4428*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4429*7836SJohn.Forte@Sun.COM 4430*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4431*7836SJohn.Forte@Sun.COM InitLibrary(); 4432*7836SJohn.Forte@Sun.COM 4433*7836SJohn.Forte@Sun.COM if (ppList == NULL) 4434*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4435*7836SJohn.Forte@Sun.COM 4436*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4437*7836SJohn.Forte@Sun.COM // Get total id count first 4438*7836SJohn.Forte@Sun.COM totalIdCount = 0; 4439*7836SJohn.Forte@Sun.COM 4440*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4441*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4442*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4443*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4444*7836SJohn.Forte@Sun.COM #ifdef WIN32 4445*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpOidListFn) 4446*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4447*7836SJohn.Forte@Sun.COM "IMA_GetLnpOidList"); 4448*7836SJohn.Forte@Sun.COM #else 4449*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpOidListFn) 4450*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4451*7836SJohn.Forte@Sun.COM "IMA_GetLnpOidList"); 4452*7836SJohn.Forte@Sun.COM #endif 4453*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4454*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 4455*7836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 4456*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 4457*7836SJohn.Forte@Sun.COM totalIdCount += ppOidList->oidCount; 4458*7836SJohn.Forte@Sun.COM #ifdef WIN32 4459*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 4460*7836SJohn.Forte@Sun.COM GetProcAddress( 4461*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 4462*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 4463*7836SJohn.Forte@Sun.COM #else 4464*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 4465*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4466*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 4467*7836SJohn.Forte@Sun.COM #endif 4468*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 4469*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 4470*7836SJohn.Forte@Sun.COM } 4471*7836SJohn.Forte@Sun.COM } 4472*7836SJohn.Forte@Sun.COM } 4473*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4474*7836SJohn.Forte@Sun.COM } 4475*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 4476*7836SJohn.Forte@Sun.COM break; 4477*7836SJohn.Forte@Sun.COM } 4478*7836SJohn.Forte@Sun.COM 4479*7836SJohn.Forte@Sun.COM } 4480*7836SJohn.Forte@Sun.COM 4481*7836SJohn.Forte@Sun.COM 4482*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, 4483*7836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST) + (totalIdCount - 1)* sizeof (IMA_OID)); 4484*7836SJohn.Forte@Sun.COM 4485*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 4486*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4487*7836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 4488*7836SJohn.Forte@Sun.COM } 4489*7836SJohn.Forte@Sun.COM 4490*7836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 4491*7836SJohn.Forte@Sun.COM 4492*7836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 4493*7836SJohn.Forte@Sun.COM totalIdCount = 0; 4494*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 4495*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4496*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4497*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4498*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4499*7836SJohn.Forte@Sun.COM #ifdef WIN32 4500*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpOidListFn) 4501*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4502*7836SJohn.Forte@Sun.COM "IMA_GetLnpOidList"); 4503*7836SJohn.Forte@Sun.COM #else 4504*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpOidListFn) 4505*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4506*7836SJohn.Forte@Sun.COM "IMA_GetLnpOidList"); 4507*7836SJohn.Forte@Sun.COM #endif 4508*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4509*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 4510*7836SJohn.Forte@Sun.COM status = PassFunc(&ppOidList); 4511*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 4512*7836SJohn.Forte@Sun.COM for (j = 0; (j < ppOidList->oidCount) && 4513*7836SJohn.Forte@Sun.COM (totalIdCount < 4514*7836SJohn.Forte@Sun.COM (*ppList)->oidCount); 4515*7836SJohn.Forte@Sun.COM j++) { 4516*7836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 4517*7836SJohn.Forte@Sun.COM objectType = 4518*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 4519*7836SJohn.Forte@Sun.COM objectType; 4520*7836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 4521*7836SJohn.Forte@Sun.COM objectSequenceNumber = 4522*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 4523*7836SJohn.Forte@Sun.COM objectSequenceNumber; 4524*7836SJohn.Forte@Sun.COM 4525*7836SJohn.Forte@Sun.COM (*ppList)->oids[totalIdCount]. 4526*7836SJohn.Forte@Sun.COM ownerId = 4527*7836SJohn.Forte@Sun.COM ppOidList->oids[j].ownerId; 4528*7836SJohn.Forte@Sun.COM totalIdCount++; 4529*7836SJohn.Forte@Sun.COM } 4530*7836SJohn.Forte@Sun.COM #ifdef WIN32 4531*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 4532*7836SJohn.Forte@Sun.COM GetProcAddress( 4533*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 4534*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 4535*7836SJohn.Forte@Sun.COM #else 4536*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 4537*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4538*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 4539*7836SJohn.Forte@Sun.COM #endif 4540*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 4541*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 4542*7836SJohn.Forte@Sun.COM } 4543*7836SJohn.Forte@Sun.COM } 4544*7836SJohn.Forte@Sun.COM } 4545*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4546*7836SJohn.Forte@Sun.COM } 4547*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 4548*7836SJohn.Forte@Sun.COM free(*ppList); 4549*7836SJohn.Forte@Sun.COM break; 4550*7836SJohn.Forte@Sun.COM } 4551*7836SJohn.Forte@Sun.COM 4552*7836SJohn.Forte@Sun.COM } 4553*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4554*7836SJohn.Forte@Sun.COM return (status); 4555*7836SJohn.Forte@Sun.COM } 4556*7836SJohn.Forte@Sun.COM 4557*7836SJohn.Forte@Sun.COM 4558*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLnpProperties( 4559*7836SJohn.Forte@Sun.COM IMA_OID lnpId, 4560*7836SJohn.Forte@Sun.COM IMA_LNP_PROPERTIES *pProps) { 4561*7836SJohn.Forte@Sun.COM IMA_GetLnpPropertiesFn PassFunc; 4562*7836SJohn.Forte@Sun.COM IMA_UINT i; 4563*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4564*7836SJohn.Forte@Sun.COM 4565*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4566*7836SJohn.Forte@Sun.COM InitLibrary(); 4567*7836SJohn.Forte@Sun.COM 4568*7836SJohn.Forte@Sun.COM if (pProps == NULL) 4569*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4570*7836SJohn.Forte@Sun.COM 4571*7836SJohn.Forte@Sun.COM if (lnpId.objectType != IMA_OBJECT_TYPE_LNP) 4572*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4573*7836SJohn.Forte@Sun.COM 4574*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4575*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4576*7836SJohn.Forte@Sun.COM 4577*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4578*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lnpId.ownerId) { 4579*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4580*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4581*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4582*7836SJohn.Forte@Sun.COM #ifdef WIN32 4583*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpPropertiesFn) 4584*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4585*7836SJohn.Forte@Sun.COM "IMA_GetLnpProperties"); 4586*7836SJohn.Forte@Sun.COM #else 4587*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLnpPropertiesFn) 4588*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4589*7836SJohn.Forte@Sun.COM "IMA_GetLnpProperties"); 4590*7836SJohn.Forte@Sun.COM #endif 4591*7836SJohn.Forte@Sun.COM 4592*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4593*7836SJohn.Forte@Sun.COM status = PassFunc(lnpId, pProps); 4594*7836SJohn.Forte@Sun.COM } 4595*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4596*7836SJohn.Forte@Sun.COM } 4597*7836SJohn.Forte@Sun.COM 4598*7836SJohn.Forte@Sun.COM break; 4599*7836SJohn.Forte@Sun.COM } 4600*7836SJohn.Forte@Sun.COM } 4601*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4602*7836SJohn.Forte@Sun.COM return (status); 4603*7836SJohn.Forte@Sun.COM } 4604*7836SJohn.Forte@Sun.COM 4605*7836SJohn.Forte@Sun.COM 4606*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPnpProperties( 4607*7836SJohn.Forte@Sun.COM IMA_OID pnpId, 4608*7836SJohn.Forte@Sun.COM IMA_PNP_PROPERTIES *pProps) { 4609*7836SJohn.Forte@Sun.COM IMA_GetPnpPropertiesFn PassFunc; 4610*7836SJohn.Forte@Sun.COM IMA_UINT i; 4611*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4612*7836SJohn.Forte@Sun.COM 4613*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4614*7836SJohn.Forte@Sun.COM InitLibrary(); 4615*7836SJohn.Forte@Sun.COM 4616*7836SJohn.Forte@Sun.COM if (pProps == NULL) 4617*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4618*7836SJohn.Forte@Sun.COM 4619*7836SJohn.Forte@Sun.COM if (pnpId.objectType != IMA_OBJECT_TYPE_PNP) 4620*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4621*7836SJohn.Forte@Sun.COM 4622*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4623*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4624*7836SJohn.Forte@Sun.COM 4625*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4626*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == pnpId.ownerId) { 4627*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4628*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4629*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4630*7836SJohn.Forte@Sun.COM #ifdef WIN32 4631*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpPropertiesFn) 4632*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4633*7836SJohn.Forte@Sun.COM "IMA_GetPnpProperties"); 4634*7836SJohn.Forte@Sun.COM #else 4635*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpPropertiesFn) 4636*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4637*7836SJohn.Forte@Sun.COM "IMA_GetPnpProperties"); 4638*7836SJohn.Forte@Sun.COM #endif 4639*7836SJohn.Forte@Sun.COM 4640*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4641*7836SJohn.Forte@Sun.COM status = PassFunc(pnpId, pProps); 4642*7836SJohn.Forte@Sun.COM } 4643*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4644*7836SJohn.Forte@Sun.COM } 4645*7836SJohn.Forte@Sun.COM 4646*7836SJohn.Forte@Sun.COM break; 4647*7836SJohn.Forte@Sun.COM } 4648*7836SJohn.Forte@Sun.COM } 4649*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4650*7836SJohn.Forte@Sun.COM return (status); 4651*7836SJohn.Forte@Sun.COM } 4652*7836SJohn.Forte@Sun.COM 4653*7836SJohn.Forte@Sun.COM 4654*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPnpStatistics( 4655*7836SJohn.Forte@Sun.COM IMA_OID pnpId, 4656*7836SJohn.Forte@Sun.COM IMA_PNP_STATISTICS *pStats) { 4657*7836SJohn.Forte@Sun.COM IMA_GetPnpStatisticsFn PassFunc; 4658*7836SJohn.Forte@Sun.COM IMA_UINT i; 4659*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4660*7836SJohn.Forte@Sun.COM 4661*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4662*7836SJohn.Forte@Sun.COM InitLibrary(); 4663*7836SJohn.Forte@Sun.COM 4664*7836SJohn.Forte@Sun.COM if (pStats == NULL) 4665*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4666*7836SJohn.Forte@Sun.COM 4667*7836SJohn.Forte@Sun.COM if (pnpId.objectType != IMA_OBJECT_TYPE_PNP) 4668*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4669*7836SJohn.Forte@Sun.COM 4670*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4671*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4672*7836SJohn.Forte@Sun.COM 4673*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4674*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == pnpId.ownerId) { 4675*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4676*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4677*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4678*7836SJohn.Forte@Sun.COM #ifdef WIN32 4679*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpStatisticsFn) 4680*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4681*7836SJohn.Forte@Sun.COM "IMA_GetPnpStatistics"); 4682*7836SJohn.Forte@Sun.COM #else 4683*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPnpStatisticsFn) 4684*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4685*7836SJohn.Forte@Sun.COM "IMA_GetPnpStatistics"); 4686*7836SJohn.Forte@Sun.COM #endif 4687*7836SJohn.Forte@Sun.COM 4688*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4689*7836SJohn.Forte@Sun.COM status = PassFunc(pnpId, pStats); 4690*7836SJohn.Forte@Sun.COM } 4691*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4692*7836SJohn.Forte@Sun.COM } 4693*7836SJohn.Forte@Sun.COM 4694*7836SJohn.Forte@Sun.COM break; 4695*7836SJohn.Forte@Sun.COM } 4696*7836SJohn.Forte@Sun.COM } 4697*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4698*7836SJohn.Forte@Sun.COM return (status); 4699*7836SJohn.Forte@Sun.COM } 4700*7836SJohn.Forte@Sun.COM 4701*7836SJohn.Forte@Sun.COM 4702*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetTargetProperties( 4703*7836SJohn.Forte@Sun.COM IMA_OID targetId, 4704*7836SJohn.Forte@Sun.COM IMA_TARGET_PROPERTIES *pProps) { 4705*7836SJohn.Forte@Sun.COM IMA_GetTargetPropertiesFn PassFunc; 4706*7836SJohn.Forte@Sun.COM IMA_UINT i; 4707*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4708*7836SJohn.Forte@Sun.COM 4709*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4710*7836SJohn.Forte@Sun.COM InitLibrary(); 4711*7836SJohn.Forte@Sun.COM 4712*7836SJohn.Forte@Sun.COM if (pProps == NULL) 4713*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4714*7836SJohn.Forte@Sun.COM 4715*7836SJohn.Forte@Sun.COM if (targetId.objectType != IMA_OBJECT_TYPE_TARGET) 4716*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4717*7836SJohn.Forte@Sun.COM 4718*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4719*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4720*7836SJohn.Forte@Sun.COM 4721*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4722*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == targetId.ownerId) { 4723*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4724*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4725*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4726*7836SJohn.Forte@Sun.COM #ifdef WIN32 4727*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetTargetPropertiesFn) 4728*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4729*7836SJohn.Forte@Sun.COM "IMA_GetTargetProperties"); 4730*7836SJohn.Forte@Sun.COM #else 4731*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetTargetPropertiesFn) 4732*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4733*7836SJohn.Forte@Sun.COM "IMA_GetTargetProperties"); 4734*7836SJohn.Forte@Sun.COM #endif 4735*7836SJohn.Forte@Sun.COM 4736*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4737*7836SJohn.Forte@Sun.COM status = PassFunc(targetId, pProps); 4738*7836SJohn.Forte@Sun.COM } 4739*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4740*7836SJohn.Forte@Sun.COM } 4741*7836SJohn.Forte@Sun.COM 4742*7836SJohn.Forte@Sun.COM break; 4743*7836SJohn.Forte@Sun.COM } 4744*7836SJohn.Forte@Sun.COM } 4745*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4746*7836SJohn.Forte@Sun.COM return (status); 4747*7836SJohn.Forte@Sun.COM } 4748*7836SJohn.Forte@Sun.COM 4749*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetSessionProperties( 4750*7836SJohn.Forte@Sun.COM IMA_OID sessionId, 4751*7836SJohn.Forte@Sun.COM IMA_SESSION_PROPERTIES *pProps) { 4752*7836SJohn.Forte@Sun.COM IMA_GetSessionPropertiesFn PassFunc; 4753*7836SJohn.Forte@Sun.COM IMA_UINT i; 4754*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4755*7836SJohn.Forte@Sun.COM 4756*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4757*7836SJohn.Forte@Sun.COM InitLibrary(); 4758*7836SJohn.Forte@Sun.COM 4759*7836SJohn.Forte@Sun.COM if (pProps == NULL) 4760*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4761*7836SJohn.Forte@Sun.COM 4762*7836SJohn.Forte@Sun.COM if (sessionId.objectType != IMA_OBJECT_TYPE_SESSION) 4763*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4764*7836SJohn.Forte@Sun.COM 4765*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4766*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4767*7836SJohn.Forte@Sun.COM 4768*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4769*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == sessionId.ownerId) { 4770*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4771*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4772*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4773*7836SJohn.Forte@Sun.COM #ifdef WIN32 4774*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionPropertiesFn) 4775*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4776*7836SJohn.Forte@Sun.COM "IMA_GetSessionProperties"); 4777*7836SJohn.Forte@Sun.COM #else 4778*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionPropertiesFn) 4779*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4780*7836SJohn.Forte@Sun.COM "IMA_GetSessionProperties"); 4781*7836SJohn.Forte@Sun.COM #endif 4782*7836SJohn.Forte@Sun.COM 4783*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4784*7836SJohn.Forte@Sun.COM status = PassFunc(sessionId, pProps); 4785*7836SJohn.Forte@Sun.COM } 4786*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4787*7836SJohn.Forte@Sun.COM } 4788*7836SJohn.Forte@Sun.COM 4789*7836SJohn.Forte@Sun.COM break; 4790*7836SJohn.Forte@Sun.COM } 4791*7836SJohn.Forte@Sun.COM } 4792*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4793*7836SJohn.Forte@Sun.COM return (status); 4794*7836SJohn.Forte@Sun.COM } 4795*7836SJohn.Forte@Sun.COM 4796*7836SJohn.Forte@Sun.COM 4797*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetConnectionProperties( 4798*7836SJohn.Forte@Sun.COM IMA_OID connectionId, 4799*7836SJohn.Forte@Sun.COM IMA_CONNECTION_PROPERTIES *pProps) { 4800*7836SJohn.Forte@Sun.COM IMA_GetConnectionPropertiesFn PassFunc; 4801*7836SJohn.Forte@Sun.COM IMA_UINT i; 4802*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4803*7836SJohn.Forte@Sun.COM 4804*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4805*7836SJohn.Forte@Sun.COM InitLibrary(); 4806*7836SJohn.Forte@Sun.COM 4807*7836SJohn.Forte@Sun.COM if (pProps == NULL) 4808*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4809*7836SJohn.Forte@Sun.COM 4810*7836SJohn.Forte@Sun.COM if (connectionId.objectType != IMA_OBJECT_TYPE_CONNECTION) 4811*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4812*7836SJohn.Forte@Sun.COM 4813*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4814*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4815*7836SJohn.Forte@Sun.COM 4816*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4817*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == connectionId.ownerId) { 4818*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4819*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4820*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4821*7836SJohn.Forte@Sun.COM #ifdef WIN32 4822*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionPropertiesFn) 4823*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4824*7836SJohn.Forte@Sun.COM "IMA_GetConnectionProperties"); 4825*7836SJohn.Forte@Sun.COM #else 4826*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionPropertiesFn) 4827*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4828*7836SJohn.Forte@Sun.COM "IMA_GetConnectionProperties"); 4829*7836SJohn.Forte@Sun.COM #endif 4830*7836SJohn.Forte@Sun.COM 4831*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4832*7836SJohn.Forte@Sun.COM status = PassFunc(connectionId, pProps); 4833*7836SJohn.Forte@Sun.COM } 4834*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4835*7836SJohn.Forte@Sun.COM } 4836*7836SJohn.Forte@Sun.COM 4837*7836SJohn.Forte@Sun.COM break; 4838*7836SJohn.Forte@Sun.COM } 4839*7836SJohn.Forte@Sun.COM } 4840*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4841*7836SJohn.Forte@Sun.COM return (status); 4842*7836SJohn.Forte@Sun.COM } 4843*7836SJohn.Forte@Sun.COM 4844*7836SJohn.Forte@Sun.COM 4845*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetTargetErrorStatistics( 4846*7836SJohn.Forte@Sun.COM IMA_OID targetId, 4847*7836SJohn.Forte@Sun.COM IMA_TARGET_ERROR_STATISTICS *pStats) { 4848*7836SJohn.Forte@Sun.COM IMA_GetTargetErrorStatisticsFn PassFunc; 4849*7836SJohn.Forte@Sun.COM IMA_UINT i; 4850*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4851*7836SJohn.Forte@Sun.COM 4852*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4853*7836SJohn.Forte@Sun.COM InitLibrary(); 4854*7836SJohn.Forte@Sun.COM 4855*7836SJohn.Forte@Sun.COM if (pStats == NULL) 4856*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4857*7836SJohn.Forte@Sun.COM 4858*7836SJohn.Forte@Sun.COM if (targetId.objectType != IMA_OBJECT_TYPE_TARGET) 4859*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4860*7836SJohn.Forte@Sun.COM 4861*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4862*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4863*7836SJohn.Forte@Sun.COM 4864*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4865*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == targetId.ownerId) { 4866*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4867*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4868*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4869*7836SJohn.Forte@Sun.COM #ifdef WIN32 4870*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetTargetErrorStatisticsFn) 4871*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4872*7836SJohn.Forte@Sun.COM "IMA_GetTargetErrorStatistics"); 4873*7836SJohn.Forte@Sun.COM #else 4874*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetTargetErrorStatisticsFn) 4875*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4876*7836SJohn.Forte@Sun.COM "IMA_GetTargetErrorStatistics"); 4877*7836SJohn.Forte@Sun.COM #endif 4878*7836SJohn.Forte@Sun.COM 4879*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4880*7836SJohn.Forte@Sun.COM status = PassFunc(targetId, pStats); 4881*7836SJohn.Forte@Sun.COM } 4882*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4883*7836SJohn.Forte@Sun.COM } 4884*7836SJohn.Forte@Sun.COM 4885*7836SJohn.Forte@Sun.COM break; 4886*7836SJohn.Forte@Sun.COM } 4887*7836SJohn.Forte@Sun.COM } 4888*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4889*7836SJohn.Forte@Sun.COM return (status); 4890*7836SJohn.Forte@Sun.COM } 4891*7836SJohn.Forte@Sun.COM 4892*7836SJohn.Forte@Sun.COM 4893*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLuOidList( 4894*7836SJohn.Forte@Sun.COM IMA_OID Oid, 4895*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 4896*7836SJohn.Forte@Sun.COM IMA_GetLuOidListFn PassFunc; 4897*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 4898*7836SJohn.Forte@Sun.COM IMA_UINT i; 4899*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4900*7836SJohn.Forte@Sun.COM 4901*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4902*7836SJohn.Forte@Sun.COM InitLibrary(); 4903*7836SJohn.Forte@Sun.COM 4904*7836SJohn.Forte@Sun.COM if (ppList == NULL) 4905*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4906*7836SJohn.Forte@Sun.COM 4907*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_LHBA && 4908*7836SJohn.Forte@Sun.COM Oid.objectType != IMA_OBJECT_TYPE_TARGET) 4909*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4910*7836SJohn.Forte@Sun.COM 4911*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4912*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 4913*7836SJohn.Forte@Sun.COM 4914*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 4915*7836SJohn.Forte@Sun.COM 4916*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 4917*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 4918*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 4919*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 4920*7836SJohn.Forte@Sun.COM #ifdef WIN32 4921*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuOidListFn) 4922*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 4923*7836SJohn.Forte@Sun.COM "IMA_GetLuOidList"); 4924*7836SJohn.Forte@Sun.COM #else 4925*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuOidListFn) 4926*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 4927*7836SJohn.Forte@Sun.COM "IMA_GetLuOidList"); 4928*7836SJohn.Forte@Sun.COM #endif 4929*7836SJohn.Forte@Sun.COM 4930*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 4931*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 4932*7836SJohn.Forte@Sun.COM 4933*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 4934*7836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 4935*7836SJohn.Forte@Sun.COM IMA_UINT listSize; 4936*7836SJohn.Forte@Sun.COM listSize = 4937*7836SJohn.Forte@Sun.COM sizeof (IMA_OID_LIST); 4938*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*) 4939*7836SJohn.Forte@Sun.COM calloc(1, listSize + 4940*7836SJohn.Forte@Sun.COM (ppOidList->oidCount - 1)* 4941*7836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 4942*7836SJohn.Forte@Sun.COM 4943*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 4944*7836SJohn.Forte@Sun.COM status = EUOS_ERROR; 4945*7836SJohn.Forte@Sun.COM } 4946*7836SJohn.Forte@Sun.COM else 4947*7836SJohn.Forte@Sun.COM memcpy((*ppList), 4948*7836SJohn.Forte@Sun.COM ppOidList, 4949*7836SJohn.Forte@Sun.COM listSize + 4950*7836SJohn.Forte@Sun.COM (ppOidList-> 4951*7836SJohn.Forte@Sun.COM oidCount - 1)* 4952*7836SJohn.Forte@Sun.COM sizeof (IMA_OID)); 4953*7836SJohn.Forte@Sun.COM #ifdef WIN32 4954*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 4955*7836SJohn.Forte@Sun.COM GetProcAddress( 4956*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 4957*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 4958*7836SJohn.Forte@Sun.COM #else 4959*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 4960*7836SJohn.Forte@Sun.COM dlsym( 4961*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 4962*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 4963*7836SJohn.Forte@Sun.COM #endif 4964*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 4965*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 4966*7836SJohn.Forte@Sun.COM } 4967*7836SJohn.Forte@Sun.COM } 4968*7836SJohn.Forte@Sun.COM } 4969*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 4970*7836SJohn.Forte@Sun.COM } 4971*7836SJohn.Forte@Sun.COM 4972*7836SJohn.Forte@Sun.COM break; 4973*7836SJohn.Forte@Sun.COM } 4974*7836SJohn.Forte@Sun.COM } 4975*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 4976*7836SJohn.Forte@Sun.COM return (status); 4977*7836SJohn.Forte@Sun.COM } 4978*7836SJohn.Forte@Sun.COM 4979*7836SJohn.Forte@Sun.COM 4980*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLuOid( 4981*7836SJohn.Forte@Sun.COM IMA_OID targetId, 4982*7836SJohn.Forte@Sun.COM IMA_UINT64 lun, 4983*7836SJohn.Forte@Sun.COM IMA_OID *pluId) { 4984*7836SJohn.Forte@Sun.COM IMA_GetLuOidFn PassFunc; 4985*7836SJohn.Forte@Sun.COM IMA_UINT i; 4986*7836SJohn.Forte@Sun.COM IMA_STATUS status; 4987*7836SJohn.Forte@Sun.COM 4988*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 4989*7836SJohn.Forte@Sun.COM InitLibrary(); 4990*7836SJohn.Forte@Sun.COM 4991*7836SJohn.Forte@Sun.COM if (pluId == NULL) 4992*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 4993*7836SJohn.Forte@Sun.COM 4994*7836SJohn.Forte@Sun.COM 4995*7836SJohn.Forte@Sun.COM if (targetId.objectType != IMA_OBJECT_TYPE_TARGET) 4996*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 4997*7836SJohn.Forte@Sun.COM 4998*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 4999*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5000*7836SJohn.Forte@Sun.COM 5001*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5002*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == targetId.ownerId) { 5003*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5004*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5005*7836SJohn.Forte@Sun.COM os_obtainmutex( 5006*7836SJohn.Forte@Sun.COM plugintable[i].pluginMutex); 5007*7836SJohn.Forte@Sun.COM #ifdef WIN32 5008*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuOidFn) 5009*7836SJohn.Forte@Sun.COM GetProcAddress( 5010*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 5011*7836SJohn.Forte@Sun.COM "IMA_GetLuOid"); 5012*7836SJohn.Forte@Sun.COM #else 5013*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuOidFn) 5014*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5015*7836SJohn.Forte@Sun.COM "IMA_GetLuOid"); 5016*7836SJohn.Forte@Sun.COM #endif 5017*7836SJohn.Forte@Sun.COM 5018*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5019*7836SJohn.Forte@Sun.COM status = 5020*7836SJohn.Forte@Sun.COM PassFunc(targetId, lun, pluId); 5021*7836SJohn.Forte@Sun.COM } 5022*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5023*7836SJohn.Forte@Sun.COM } 5024*7836SJohn.Forte@Sun.COM 5025*7836SJohn.Forte@Sun.COM break; 5026*7836SJohn.Forte@Sun.COM } 5027*7836SJohn.Forte@Sun.COM } 5028*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5029*7836SJohn.Forte@Sun.COM return (status); 5030*7836SJohn.Forte@Sun.COM } 5031*7836SJohn.Forte@Sun.COM 5032*7836SJohn.Forte@Sun.COM 5033*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetLuProperties( 5034*7836SJohn.Forte@Sun.COM IMA_OID luId, 5035*7836SJohn.Forte@Sun.COM IMA_LU_PROPERTIES *pProps) { 5036*7836SJohn.Forte@Sun.COM IMA_GetLuPropertiesFn PassFunc; 5037*7836SJohn.Forte@Sun.COM IMA_UINT i; 5038*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5039*7836SJohn.Forte@Sun.COM 5040*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5041*7836SJohn.Forte@Sun.COM InitLibrary(); 5042*7836SJohn.Forte@Sun.COM 5043*7836SJohn.Forte@Sun.COM if (pProps == NULL) 5044*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5045*7836SJohn.Forte@Sun.COM 5046*7836SJohn.Forte@Sun.COM if (luId.objectType != IMA_OBJECT_TYPE_LU) 5047*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5048*7836SJohn.Forte@Sun.COM 5049*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5050*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5051*7836SJohn.Forte@Sun.COM 5052*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5053*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == luId.ownerId) { 5054*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5055*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5056*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5057*7836SJohn.Forte@Sun.COM #ifdef WIN32 5058*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuPropertiesFn) 5059*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5060*7836SJohn.Forte@Sun.COM "IMA_GetLuProperties"); 5061*7836SJohn.Forte@Sun.COM #else 5062*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetLuPropertiesFn) 5063*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5064*7836SJohn.Forte@Sun.COM "IMA_GetLuProperties"); 5065*7836SJohn.Forte@Sun.COM #endif 5066*7836SJohn.Forte@Sun.COM 5067*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5068*7836SJohn.Forte@Sun.COM status = PassFunc(luId, pProps); 5069*7836SJohn.Forte@Sun.COM } 5070*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5071*7836SJohn.Forte@Sun.COM } 5072*7836SJohn.Forte@Sun.COM 5073*7836SJohn.Forte@Sun.COM break; 5074*7836SJohn.Forte@Sun.COM } 5075*7836SJohn.Forte@Sun.COM } 5076*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5077*7836SJohn.Forte@Sun.COM return (status); 5078*7836SJohn.Forte@Sun.COM } 5079*7836SJohn.Forte@Sun.COM 5080*7836SJohn.Forte@Sun.COM 5081*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetStatisticsProperties( 5082*7836SJohn.Forte@Sun.COM IMA_OID oid, 5083*7836SJohn.Forte@Sun.COM IMA_STATISTICS_PROPERTIES *pProps) { 5084*7836SJohn.Forte@Sun.COM IMA_GetStatisticsPropertiesFn PassFunc; 5085*7836SJohn.Forte@Sun.COM IMA_UINT i; 5086*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5087*7836SJohn.Forte@Sun.COM 5088*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5089*7836SJohn.Forte@Sun.COM InitLibrary(); 5090*7836SJohn.Forte@Sun.COM 5091*7836SJohn.Forte@Sun.COM if (pProps == NULL) 5092*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5093*7836SJohn.Forte@Sun.COM 5094*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_TARGET && 5095*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LU && 5096*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PNP) 5097*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5098*7836SJohn.Forte@Sun.COM 5099*7836SJohn.Forte@Sun.COM 5100*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5101*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5102*7836SJohn.Forte@Sun.COM 5103*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5104*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 5105*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5106*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5107*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5108*7836SJohn.Forte@Sun.COM #ifdef WIN32 5109*7836SJohn.Forte@Sun.COM PassFunc = 5110*7836SJohn.Forte@Sun.COM (IMA_GetStatisticsPropertiesFn) 5111*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5112*7836SJohn.Forte@Sun.COM "IMA_GetStatisticsProperties"); 5113*7836SJohn.Forte@Sun.COM #else 5114*7836SJohn.Forte@Sun.COM PassFunc = 5115*7836SJohn.Forte@Sun.COM (IMA_GetStatisticsPropertiesFn) 5116*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5117*7836SJohn.Forte@Sun.COM "IMA_GetStatisticsProperties"); 5118*7836SJohn.Forte@Sun.COM #endif 5119*7836SJohn.Forte@Sun.COM 5120*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5121*7836SJohn.Forte@Sun.COM status = PassFunc(oid, pProps); 5122*7836SJohn.Forte@Sun.COM } 5123*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5124*7836SJohn.Forte@Sun.COM } 5125*7836SJohn.Forte@Sun.COM 5126*7836SJohn.Forte@Sun.COM break; 5127*7836SJohn.Forte@Sun.COM } 5128*7836SJohn.Forte@Sun.COM } 5129*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5130*7836SJohn.Forte@Sun.COM return (status); 5131*7836SJohn.Forte@Sun.COM } 5132*7836SJohn.Forte@Sun.COM 5133*7836SJohn.Forte@Sun.COM 5134*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDeviceStatistics( 5135*7836SJohn.Forte@Sun.COM IMA_OID oid, 5136*7836SJohn.Forte@Sun.COM IMA_DEVICE_STATISTICS *pStats) { 5137*7836SJohn.Forte@Sun.COM IMA_GetDeviceStatisticsFn PassFunc; 5138*7836SJohn.Forte@Sun.COM IMA_UINT i; 5139*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5140*7836SJohn.Forte@Sun.COM 5141*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5142*7836SJohn.Forte@Sun.COM InitLibrary(); 5143*7836SJohn.Forte@Sun.COM 5144*7836SJohn.Forte@Sun.COM if (pStats == NULL) 5145*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5146*7836SJohn.Forte@Sun.COM 5147*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_LU && 5148*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_TARGET) 5149*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5150*7836SJohn.Forte@Sun.COM 5151*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5152*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5153*7836SJohn.Forte@Sun.COM 5154*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5155*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 5156*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5157*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5158*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5159*7836SJohn.Forte@Sun.COM #ifdef WIN32 5160*7836SJohn.Forte@Sun.COM PassFunc = 5161*7836SJohn.Forte@Sun.COM (IMA_GetDeviceStatisticsFn) 5162*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5163*7836SJohn.Forte@Sun.COM "IMA_GetDeviceStatistics"); 5164*7836SJohn.Forte@Sun.COM #else 5165*7836SJohn.Forte@Sun.COM PassFunc = 5166*7836SJohn.Forte@Sun.COM (IMA_GetDeviceStatisticsFn) 5167*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5168*7836SJohn.Forte@Sun.COM "IMA_GetDeviceStatistics"); 5169*7836SJohn.Forte@Sun.COM #endif 5170*7836SJohn.Forte@Sun.COM 5171*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5172*7836SJohn.Forte@Sun.COM status = PassFunc(oid, pStats); 5173*7836SJohn.Forte@Sun.COM } 5174*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5175*7836SJohn.Forte@Sun.COM } 5176*7836SJohn.Forte@Sun.COM 5177*7836SJohn.Forte@Sun.COM break; 5178*7836SJohn.Forte@Sun.COM } 5179*7836SJohn.Forte@Sun.COM } 5180*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5181*7836SJohn.Forte@Sun.COM return (status); 5182*7836SJohn.Forte@Sun.COM } 5183*7836SJohn.Forte@Sun.COM 5184*7836SJohn.Forte@Sun.COM 5185*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_LuInquiry( 5186*7836SJohn.Forte@Sun.COM IMA_OID deviceId, 5187*7836SJohn.Forte@Sun.COM IMA_BOOL evpd, 5188*7836SJohn.Forte@Sun.COM IMA_BOOL cmddt, 5189*7836SJohn.Forte@Sun.COM IMA_BYTE pageCode, 5190*7836SJohn.Forte@Sun.COM 5191*7836SJohn.Forte@Sun.COM IMA_BYTE *pOutputBuffer, 5192*7836SJohn.Forte@Sun.COM IMA_UINT *pOutputBufferLength, 5193*7836SJohn.Forte@Sun.COM 5194*7836SJohn.Forte@Sun.COM IMA_BYTE *pSenseBuffer, 5195*7836SJohn.Forte@Sun.COM IMA_UINT *pSenseBufferLength) { 5196*7836SJohn.Forte@Sun.COM IMA_LuInquiryFn PassFunc; 5197*7836SJohn.Forte@Sun.COM IMA_UINT i; 5198*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5199*7836SJohn.Forte@Sun.COM 5200*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5201*7836SJohn.Forte@Sun.COM InitLibrary(); 5202*7836SJohn.Forte@Sun.COM 5203*7836SJohn.Forte@Sun.COM if (pOutputBuffer == NULL || pOutputBufferLength == NULL || 5204*7836SJohn.Forte@Sun.COM *pOutputBufferLength == 0 || 5205*7836SJohn.Forte@Sun.COM pSenseBuffer == NULL || pSenseBufferLength == NULL || 5206*7836SJohn.Forte@Sun.COM *pSenseBufferLength == 0) 5207*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5208*7836SJohn.Forte@Sun.COM 5209*7836SJohn.Forte@Sun.COM if ((evpd != IMA_TRUE && evpd != IMA_FALSE) || 5210*7836SJohn.Forte@Sun.COM (cmddt != IMA_TRUE && cmddt != IMA_FALSE)) 5211*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5212*7836SJohn.Forte@Sun.COM 5213*7836SJohn.Forte@Sun.COM if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET && 5214*7836SJohn.Forte@Sun.COM deviceId.objectType != IMA_OBJECT_TYPE_LU) 5215*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5216*7836SJohn.Forte@Sun.COM 5217*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5218*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5219*7836SJohn.Forte@Sun.COM 5220*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5221*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == deviceId.ownerId) { 5222*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5223*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5224*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5225*7836SJohn.Forte@Sun.COM #ifdef WIN32 5226*7836SJohn.Forte@Sun.COM PassFunc = (IMA_LuInquiryFn) 5227*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5228*7836SJohn.Forte@Sun.COM "IMA_LuInquiry"); 5229*7836SJohn.Forte@Sun.COM #else 5230*7836SJohn.Forte@Sun.COM PassFunc = (IMA_LuInquiryFn) 5231*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5232*7836SJohn.Forte@Sun.COM "IMA_LuInquiry"); 5233*7836SJohn.Forte@Sun.COM #endif 5234*7836SJohn.Forte@Sun.COM 5235*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5236*7836SJohn.Forte@Sun.COM status = 5237*7836SJohn.Forte@Sun.COM PassFunc(deviceId, evpd, 5238*7836SJohn.Forte@Sun.COM cmddt, pageCode, 5239*7836SJohn.Forte@Sun.COM pOutputBuffer, pOutputBufferLength, 5240*7836SJohn.Forte@Sun.COM pSenseBuffer, pSenseBufferLength); 5241*7836SJohn.Forte@Sun.COM } 5242*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5243*7836SJohn.Forte@Sun.COM } 5244*7836SJohn.Forte@Sun.COM 5245*7836SJohn.Forte@Sun.COM break; 5246*7836SJohn.Forte@Sun.COM } 5247*7836SJohn.Forte@Sun.COM } 5248*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5249*7836SJohn.Forte@Sun.COM return (status); 5250*7836SJohn.Forte@Sun.COM } 5251*7836SJohn.Forte@Sun.COM 5252*7836SJohn.Forte@Sun.COM 5253*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_LuReadCapacity( 5254*7836SJohn.Forte@Sun.COM IMA_OID deviceId, 5255*7836SJohn.Forte@Sun.COM IMA_UINT cdbLength, 5256*7836SJohn.Forte@Sun.COM IMA_BYTE *pOutputBuffer, 5257*7836SJohn.Forte@Sun.COM IMA_UINT *pOutputBufferLength, 5258*7836SJohn.Forte@Sun.COM 5259*7836SJohn.Forte@Sun.COM IMA_BYTE *pSenseBuffer, 5260*7836SJohn.Forte@Sun.COM IMA_UINT *pSenseBufferLength) { 5261*7836SJohn.Forte@Sun.COM IMA_LuReadCapacityFn PassFunc; 5262*7836SJohn.Forte@Sun.COM IMA_UINT i; 5263*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5264*7836SJohn.Forte@Sun.COM 5265*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5266*7836SJohn.Forte@Sun.COM InitLibrary(); 5267*7836SJohn.Forte@Sun.COM 5268*7836SJohn.Forte@Sun.COM if (cdbLength != 10 && cdbLength != 16) 5269*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5270*7836SJohn.Forte@Sun.COM 5271*7836SJohn.Forte@Sun.COM if ((pOutputBuffer == NULL || pOutputBufferLength == NULL || 5272*7836SJohn.Forte@Sun.COM *pOutputBufferLength == 0) || 5273*7836SJohn.Forte@Sun.COM (pSenseBuffer == NULL && pSenseBufferLength != NULL && 5274*7836SJohn.Forte@Sun.COM *pSenseBufferLength != 0)) 5275*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5276*7836SJohn.Forte@Sun.COM 5277*7836SJohn.Forte@Sun.COM if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET && 5278*7836SJohn.Forte@Sun.COM deviceId.objectType != IMA_OBJECT_TYPE_LU) 5279*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5280*7836SJohn.Forte@Sun.COM 5281*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5282*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5283*7836SJohn.Forte@Sun.COM 5284*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5285*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == deviceId.ownerId) { 5286*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5287*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5288*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5289*7836SJohn.Forte@Sun.COM #ifdef WIN32 5290*7836SJohn.Forte@Sun.COM PassFunc = (IMA_LuReadCapacityFn) 5291*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5292*7836SJohn.Forte@Sun.COM "IMA_LuReadCapacity"); 5293*7836SJohn.Forte@Sun.COM #else 5294*7836SJohn.Forte@Sun.COM PassFunc = (IMA_LuReadCapacityFn) 5295*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5296*7836SJohn.Forte@Sun.COM "IMA_LuReadCapacity"); 5297*7836SJohn.Forte@Sun.COM #endif 5298*7836SJohn.Forte@Sun.COM 5299*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5300*7836SJohn.Forte@Sun.COM status = PassFunc(deviceId, cdbLength, 5301*7836SJohn.Forte@Sun.COM pOutputBuffer, pOutputBufferLength, 5302*7836SJohn.Forte@Sun.COM pSenseBuffer, pSenseBufferLength); 5303*7836SJohn.Forte@Sun.COM } 5304*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5305*7836SJohn.Forte@Sun.COM } 5306*7836SJohn.Forte@Sun.COM 5307*7836SJohn.Forte@Sun.COM break; 5308*7836SJohn.Forte@Sun.COM } 5309*7836SJohn.Forte@Sun.COM } 5310*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5311*7836SJohn.Forte@Sun.COM return (status); 5312*7836SJohn.Forte@Sun.COM } 5313*7836SJohn.Forte@Sun.COM 5314*7836SJohn.Forte@Sun.COM 5315*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_LuReportLuns( 5316*7836SJohn.Forte@Sun.COM IMA_OID deviceId, 5317*7836SJohn.Forte@Sun.COM IMA_BOOL sendToWellKnownLun, 5318*7836SJohn.Forte@Sun.COM IMA_BYTE selectReport, 5319*7836SJohn.Forte@Sun.COM 5320*7836SJohn.Forte@Sun.COM IMA_BYTE *pOutputBuffer, 5321*7836SJohn.Forte@Sun.COM IMA_UINT *pOutputBufferLength, 5322*7836SJohn.Forte@Sun.COM 5323*7836SJohn.Forte@Sun.COM IMA_BYTE *pSenseBuffer, 5324*7836SJohn.Forte@Sun.COM IMA_UINT *pSenseBufferLength) { 5325*7836SJohn.Forte@Sun.COM IMA_LuReportLunsFn PassFunc; 5326*7836SJohn.Forte@Sun.COM IMA_UINT i; 5327*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5328*7836SJohn.Forte@Sun.COM 5329*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5330*7836SJohn.Forte@Sun.COM InitLibrary(); 5331*7836SJohn.Forte@Sun.COM 5332*7836SJohn.Forte@Sun.COM if ((pOutputBuffer == NULL || pOutputBufferLength == NULL || 5333*7836SJohn.Forte@Sun.COM *pOutputBufferLength == 0) || 5334*7836SJohn.Forte@Sun.COM (pSenseBuffer == NULL && pSenseBufferLength != NULL && 5335*7836SJohn.Forte@Sun.COM *pSenseBufferLength != 0)) 5336*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5337*7836SJohn.Forte@Sun.COM 5338*7836SJohn.Forte@Sun.COM if (sendToWellKnownLun != IMA_TRUE && sendToWellKnownLun != IMA_FALSE) 5339*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5340*7836SJohn.Forte@Sun.COM 5341*7836SJohn.Forte@Sun.COM if (deviceId.objectType != IMA_OBJECT_TYPE_TARGET && 5342*7836SJohn.Forte@Sun.COM deviceId.objectType != IMA_OBJECT_TYPE_LU) 5343*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5344*7836SJohn.Forte@Sun.COM 5345*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5346*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5347*7836SJohn.Forte@Sun.COM 5348*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5349*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == deviceId.ownerId) { 5350*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5351*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5352*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5353*7836SJohn.Forte@Sun.COM #ifdef WIN32 5354*7836SJohn.Forte@Sun.COM PassFunc = (IMA_LuReportLunsFn) 5355*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5356*7836SJohn.Forte@Sun.COM "IMA_LuReportLuns"); 5357*7836SJohn.Forte@Sun.COM #else 5358*7836SJohn.Forte@Sun.COM PassFunc = (IMA_LuReportLunsFn) 5359*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5360*7836SJohn.Forte@Sun.COM "IMA_LuReportLuns"); 5361*7836SJohn.Forte@Sun.COM #endif 5362*7836SJohn.Forte@Sun.COM 5363*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5364*7836SJohn.Forte@Sun.COM status = PassFunc(deviceId, 5365*7836SJohn.Forte@Sun.COM sendToWellKnownLun, selectReport, 5366*7836SJohn.Forte@Sun.COM pOutputBuffer, pOutputBufferLength, 5367*7836SJohn.Forte@Sun.COM pSenseBuffer, pSenseBufferLength); 5368*7836SJohn.Forte@Sun.COM } 5369*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5370*7836SJohn.Forte@Sun.COM } 5371*7836SJohn.Forte@Sun.COM 5372*7836SJohn.Forte@Sun.COM break; 5373*7836SJohn.Forte@Sun.COM } 5374*7836SJohn.Forte@Sun.COM } 5375*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5376*7836SJohn.Forte@Sun.COM return (status); 5377*7836SJohn.Forte@Sun.COM } 5378*7836SJohn.Forte@Sun.COM 5379*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_ExposeLu( 5380*7836SJohn.Forte@Sun.COM IMA_OID luId) { 5381*7836SJohn.Forte@Sun.COM IMA_ExposeLuFn PassFunc; 5382*7836SJohn.Forte@Sun.COM IMA_UINT i; 5383*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5384*7836SJohn.Forte@Sun.COM 5385*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5386*7836SJohn.Forte@Sun.COM InitLibrary(); 5387*7836SJohn.Forte@Sun.COM 5388*7836SJohn.Forte@Sun.COM if (luId.objectType != IMA_OBJECT_TYPE_LU) 5389*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_OBJECT_TYPE); 5390*7836SJohn.Forte@Sun.COM 5391*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5392*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5393*7836SJohn.Forte@Sun.COM 5394*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5395*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == luId.ownerId) { 5396*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5397*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5398*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5399*7836SJohn.Forte@Sun.COM #ifdef WIN32 5400*7836SJohn.Forte@Sun.COM PassFunc = (IMA_ExposeLuFn) 5401*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5402*7836SJohn.Forte@Sun.COM "IMA_ExposeLu"); 5403*7836SJohn.Forte@Sun.COM 5404*7836SJohn.Forte@Sun.COM #else 5405*7836SJohn.Forte@Sun.COM PassFunc = (IMA_ExposeLuFn) 5406*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5407*7836SJohn.Forte@Sun.COM "IMA_ExposeLu"); 5408*7836SJohn.Forte@Sun.COM #endif 5409*7836SJohn.Forte@Sun.COM 5410*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5411*7836SJohn.Forte@Sun.COM status = PassFunc(luId); 5412*7836SJohn.Forte@Sun.COM } 5413*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5414*7836SJohn.Forte@Sun.COM } 5415*7836SJohn.Forte@Sun.COM 5416*7836SJohn.Forte@Sun.COM break; 5417*7836SJohn.Forte@Sun.COM } 5418*7836SJohn.Forte@Sun.COM } 5419*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5420*7836SJohn.Forte@Sun.COM return (status); 5421*7836SJohn.Forte@Sun.COM } 5422*7836SJohn.Forte@Sun.COM 5423*7836SJohn.Forte@Sun.COM 5424*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_UnexposeLu( 5425*7836SJohn.Forte@Sun.COM IMA_OID luId) { 5426*7836SJohn.Forte@Sun.COM IMA_UnexposeLuFn PassFunc; 5427*7836SJohn.Forte@Sun.COM IMA_UINT i; 5428*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5429*7836SJohn.Forte@Sun.COM 5430*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5431*7836SJohn.Forte@Sun.COM InitLibrary(); 5432*7836SJohn.Forte@Sun.COM 5433*7836SJohn.Forte@Sun.COM if (luId.objectType != IMA_OBJECT_TYPE_LU) 5434*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5435*7836SJohn.Forte@Sun.COM 5436*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5437*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5438*7836SJohn.Forte@Sun.COM 5439*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5440*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == luId.ownerId) { 5441*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5442*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5443*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5444*7836SJohn.Forte@Sun.COM #ifdef WIN32 5445*7836SJohn.Forte@Sun.COM PassFunc = (IMA_UnexposeLuFn) 5446*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5447*7836SJohn.Forte@Sun.COM "IMA_UnexposeLu"); 5448*7836SJohn.Forte@Sun.COM #else 5449*7836SJohn.Forte@Sun.COM PassFunc = (IMA_UnexposeLuFn) 5450*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5451*7836SJohn.Forte@Sun.COM "IMA_UnexposeLu"); 5452*7836SJohn.Forte@Sun.COM #endif 5453*7836SJohn.Forte@Sun.COM 5454*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5455*7836SJohn.Forte@Sun.COM status = PassFunc(luId); 5456*7836SJohn.Forte@Sun.COM } 5457*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5458*7836SJohn.Forte@Sun.COM } 5459*7836SJohn.Forte@Sun.COM 5460*7836SJohn.Forte@Sun.COM break; 5461*7836SJohn.Forte@Sun.COM } 5462*7836SJohn.Forte@Sun.COM } 5463*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5464*7836SJohn.Forte@Sun.COM return (status); 5465*7836SJohn.Forte@Sun.COM } 5466*7836SJohn.Forte@Sun.COM 5467*7836SJohn.Forte@Sun.COM 5468*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetPhbaStatus( 5469*7836SJohn.Forte@Sun.COM IMA_OID hbaId, 5470*7836SJohn.Forte@Sun.COM IMA_PHBA_STATUS *pStatus) { 5471*7836SJohn.Forte@Sun.COM IMA_GetPhbaStatusFn PassFunc; 5472*7836SJohn.Forte@Sun.COM IMA_UINT i; 5473*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5474*7836SJohn.Forte@Sun.COM 5475*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5476*7836SJohn.Forte@Sun.COM InitLibrary(); 5477*7836SJohn.Forte@Sun.COM 5478*7836SJohn.Forte@Sun.COM if (pStatus == NULL) 5479*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5480*7836SJohn.Forte@Sun.COM 5481*7836SJohn.Forte@Sun.COM if (hbaId.objectType != IMA_OBJECT_TYPE_PHBA) 5482*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5483*7836SJohn.Forte@Sun.COM 5484*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5485*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5486*7836SJohn.Forte@Sun.COM 5487*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5488*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == hbaId.ownerId) { 5489*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5490*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5491*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5492*7836SJohn.Forte@Sun.COM #ifdef WIN32 5493*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaStatusFn) 5494*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5495*7836SJohn.Forte@Sun.COM "IMA_GetPhbaStatus"); 5496*7836SJohn.Forte@Sun.COM #else 5497*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetPhbaStatusFn) 5498*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5499*7836SJohn.Forte@Sun.COM "IMA_GetPhbaStatus"); 5500*7836SJohn.Forte@Sun.COM #endif 5501*7836SJohn.Forte@Sun.COM 5502*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5503*7836SJohn.Forte@Sun.COM status = PassFunc(hbaId, pStatus); 5504*7836SJohn.Forte@Sun.COM } 5505*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5506*7836SJohn.Forte@Sun.COM } 5507*7836SJohn.Forte@Sun.COM 5508*7836SJohn.Forte@Sun.COM break; 5509*7836SJohn.Forte@Sun.COM } 5510*7836SJohn.Forte@Sun.COM } 5511*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5512*7836SJohn.Forte@Sun.COM return (status); 5513*7836SJohn.Forte@Sun.COM } 5514*7836SJohn.Forte@Sun.COM 5515*7836SJohn.Forte@Sun.COM 5516*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RegisterForObjectVisibilityChanges( 5517*7836SJohn.Forte@Sun.COM IMA_OBJECT_VISIBILITY_FN pClientFn) { 5518*7836SJohn.Forte@Sun.COM IMA_RegisterForObjectVisibilityChangesFn PassFunc; 5519*7836SJohn.Forte@Sun.COM IMA_UINT i; 5520*7836SJohn.Forte@Sun.COM IMA_UINT j; 5521*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5522*7836SJohn.Forte@Sun.COM 5523*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5524*7836SJohn.Forte@Sun.COM InitLibrary(); 5525*7836SJohn.Forte@Sun.COM 5526*7836SJohn.Forte@Sun.COM if (pClientFn == NULL) 5527*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5528*7836SJohn.Forte@Sun.COM 5529*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5530*7836SJohn.Forte@Sun.COM 5531*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 5532*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5533*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5534*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5535*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5536*7836SJohn.Forte@Sun.COM if (plugintable[i].number_of_vbcallbacks >= 5537*7836SJohn.Forte@Sun.COM IMA_MAX_CALLBACK_PER_PLUGIN) { 5538*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5539*7836SJohn.Forte@Sun.COM continue; 5540*7836SJohn.Forte@Sun.COM } 5541*7836SJohn.Forte@Sun.COM 5542*7836SJohn.Forte@Sun.COM /* check if registered already */ 5543*7836SJohn.Forte@Sun.COM for (j = 0; 5544*7836SJohn.Forte@Sun.COM j < plugintable[i].number_of_vbcallbacks; j++) { 5545*7836SJohn.Forte@Sun.COM if (plugintable[i].vbcallback[j] == pClientFn) { 5546*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 5547*7836SJohn.Forte@Sun.COM break; 5548*7836SJohn.Forte@Sun.COM } 5549*7836SJohn.Forte@Sun.COM } 5550*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 5551*7836SJohn.Forte@Sun.COM 5552*7836SJohn.Forte@Sun.COM #ifdef WIN32 5553*7836SJohn.Forte@Sun.COM PassFunc = 5554*7836SJohn.Forte@Sun.COM (IMA_RegisterForObjectVisibilityChangesFn) 5555*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5556*7836SJohn.Forte@Sun.COM "IMA_RegisterForObjectVisibilityChanges"); 5557*7836SJohn.Forte@Sun.COM #else 5558*7836SJohn.Forte@Sun.COM PassFunc = 5559*7836SJohn.Forte@Sun.COM (IMA_RegisterForObjectVisibilityChangesFn) 5560*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5561*7836SJohn.Forte@Sun.COM "IMA_RegisterForObjectVisibilityChanges"); 5562*7836SJohn.Forte@Sun.COM #endif 5563*7836SJohn.Forte@Sun.COM 5564*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5565*7836SJohn.Forte@Sun.COM status = PassFunc(VisibilityCallback); 5566*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 5567*7836SJohn.Forte@Sun.COM j = plugintable[i]. 5568*7836SJohn.Forte@Sun.COM number_of_vbcallbacks; 5569*7836SJohn.Forte@Sun.COM plugintable[i].vbcallback[j] = 5570*7836SJohn.Forte@Sun.COM pClientFn; 5571*7836SJohn.Forte@Sun.COM plugintable[i]. 5572*7836SJohn.Forte@Sun.COM number_of_vbcallbacks++; 5573*7836SJohn.Forte@Sun.COM } 5574*7836SJohn.Forte@Sun.COM 5575*7836SJohn.Forte@Sun.COM } 5576*7836SJohn.Forte@Sun.COM } 5577*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5578*7836SJohn.Forte@Sun.COM } 5579*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) 5580*7836SJohn.Forte@Sun.COM break; 5581*7836SJohn.Forte@Sun.COM 5582*7836SJohn.Forte@Sun.COM } 5583*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5584*7836SJohn.Forte@Sun.COM return (status); 5585*7836SJohn.Forte@Sun.COM 5586*7836SJohn.Forte@Sun.COM } 5587*7836SJohn.Forte@Sun.COM 5588*7836SJohn.Forte@Sun.COM 5589*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_DeregisterForObjectVisibilityChanges( 5590*7836SJohn.Forte@Sun.COM IMA_OBJECT_VISIBILITY_FN pClientFn) { 5591*7836SJohn.Forte@Sun.COM IMA_DeregisterForObjectVisibilityChangesFn PassFunc; 5592*7836SJohn.Forte@Sun.COM IMA_UINT i; 5593*7836SJohn.Forte@Sun.COM IMA_UINT j; 5594*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5595*7836SJohn.Forte@Sun.COM 5596*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5597*7836SJohn.Forte@Sun.COM InitLibrary(); 5598*7836SJohn.Forte@Sun.COM 5599*7836SJohn.Forte@Sun.COM if (pClientFn == NULL) 5600*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5601*7836SJohn.Forte@Sun.COM 5602*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5603*7836SJohn.Forte@Sun.COM 5604*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 5605*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5606*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5607*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5608*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5609*7836SJohn.Forte@Sun.COM /* check if deregistered already */ 5610*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 5611*7836SJohn.Forte@Sun.COM for (j = 0; 5612*7836SJohn.Forte@Sun.COM j < plugintable[i].number_of_vbcallbacks; j++) { 5613*7836SJohn.Forte@Sun.COM if (plugintable[i].vbcallback[j] == pClientFn) { 5614*7836SJohn.Forte@Sun.COM /* 5615*7836SJohn.Forte@Sun.COM * use IMA_ERROR_UNKNOWN_ERROR 5616*7836SJohn.Forte@Sun.COM * as a flag 5617*7836SJohn.Forte@Sun.COM */ 5618*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNKNOWN_ERROR; 5619*7836SJohn.Forte@Sun.COM break; 5620*7836SJohn.Forte@Sun.COM } 5621*7836SJohn.Forte@Sun.COM } 5622*7836SJohn.Forte@Sun.COM 5623*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 5624*7836SJohn.Forte@Sun.COM 5625*7836SJohn.Forte@Sun.COM #ifdef WIN32 5626*7836SJohn.Forte@Sun.COM PassFunc = 5627*7836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectVisibilityChangesFn) 5628*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5629*7836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectVisibilityChanges"); 5630*7836SJohn.Forte@Sun.COM #else 5631*7836SJohn.Forte@Sun.COM PassFunc = 5632*7836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectVisibilityChangesFn) 5633*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5634*7836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectVisibilityChanges"); 5635*7836SJohn.Forte@Sun.COM #endif 5636*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5637*7836SJohn.Forte@Sun.COM status = PassFunc(VisibilityCallback); 5638*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 5639*7836SJohn.Forte@Sun.COM /* 5640*7836SJohn.Forte@Sun.COM * where plugintable[i]. 5641*7836SJohn.Forte@Sun.COM * vbcallback[j] == pClientFn 5642*7836SJohn.Forte@Sun.COM */ 5643*7836SJohn.Forte@Sun.COM for (; j < 5644*7836SJohn.Forte@Sun.COM plugintable[i]. 5645*7836SJohn.Forte@Sun.COM number_of_vbcallbacks; 5646*7836SJohn.Forte@Sun.COM j++) { 5647*7836SJohn.Forte@Sun.COM plugintable[i]. 5648*7836SJohn.Forte@Sun.COM vbcallback[j] = 5649*7836SJohn.Forte@Sun.COM plugintable[i]. 5650*7836SJohn.Forte@Sun.COM vbcallback[j+1]; 5651*7836SJohn.Forte@Sun.COM 5652*7836SJohn.Forte@Sun.COM } 5653*7836SJohn.Forte@Sun.COM plugintable[i]. 5654*7836SJohn.Forte@Sun.COM number_of_vbcallbacks--; 5655*7836SJohn.Forte@Sun.COM } 5656*7836SJohn.Forte@Sun.COM } 5657*7836SJohn.Forte@Sun.COM } 5658*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5659*7836SJohn.Forte@Sun.COM } 5660*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) 5661*7836SJohn.Forte@Sun.COM break; 5662*7836SJohn.Forte@Sun.COM } 5663*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5664*7836SJohn.Forte@Sun.COM return (status); 5665*7836SJohn.Forte@Sun.COM 5666*7836SJohn.Forte@Sun.COM } 5667*7836SJohn.Forte@Sun.COM 5668*7836SJohn.Forte@Sun.COM 5669*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RegisterForObjectPropertyChanges( 5670*7836SJohn.Forte@Sun.COM IMA_OBJECT_PROPERTY_FN pClientFn) { 5671*7836SJohn.Forte@Sun.COM IMA_RegisterForObjectPropertyChangesFn PassFunc; 5672*7836SJohn.Forte@Sun.COM IMA_UINT i; 5673*7836SJohn.Forte@Sun.COM IMA_UINT j; 5674*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5675*7836SJohn.Forte@Sun.COM 5676*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5677*7836SJohn.Forte@Sun.COM InitLibrary(); 5678*7836SJohn.Forte@Sun.COM 5679*7836SJohn.Forte@Sun.COM if (pClientFn == NULL) 5680*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5681*7836SJohn.Forte@Sun.COM 5682*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5683*7836SJohn.Forte@Sun.COM 5684*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 5685*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5686*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5687*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5688*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5689*7836SJohn.Forte@Sun.COM if (plugintable[i].number_of_pccallbacks >= 5690*7836SJohn.Forte@Sun.COM IMA_MAX_CALLBACK_PER_PLUGIN) { 5691*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5692*7836SJohn.Forte@Sun.COM continue; 5693*7836SJohn.Forte@Sun.COM } 5694*7836SJohn.Forte@Sun.COM 5695*7836SJohn.Forte@Sun.COM /* check if registered already */ 5696*7836SJohn.Forte@Sun.COM for (j = 0; 5697*7836SJohn.Forte@Sun.COM j < plugintable[i].number_of_pccallbacks; 5698*7836SJohn.Forte@Sun.COM j++) { 5699*7836SJohn.Forte@Sun.COM if (plugintable[i].pccallback[j] == 5700*7836SJohn.Forte@Sun.COM pClientFn) { 5701*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 5702*7836SJohn.Forte@Sun.COM break; 5703*7836SJohn.Forte@Sun.COM } 5704*7836SJohn.Forte@Sun.COM } 5705*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 5706*7836SJohn.Forte@Sun.COM 5707*7836SJohn.Forte@Sun.COM #ifdef WIN32 5708*7836SJohn.Forte@Sun.COM PassFunc = 5709*7836SJohn.Forte@Sun.COM (IMA_RegisterForObjectPropertyChangesFn) 5710*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5711*7836SJohn.Forte@Sun.COM "IMA_RegisterForObjectPropertyChanges"); 5712*7836SJohn.Forte@Sun.COM #else 5713*7836SJohn.Forte@Sun.COM PassFunc = 5714*7836SJohn.Forte@Sun.COM (IMA_RegisterForObjectPropertyChangesFn) 5715*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5716*7836SJohn.Forte@Sun.COM "IMA_RegisterForObjectPropertyChanges"); 5717*7836SJohn.Forte@Sun.COM #endif 5718*7836SJohn.Forte@Sun.COM 5719*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5720*7836SJohn.Forte@Sun.COM status = PassFunc(PropertyCallback); 5721*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 5722*7836SJohn.Forte@Sun.COM j = plugintable[i]. 5723*7836SJohn.Forte@Sun.COM number_of_pccallbacks; 5724*7836SJohn.Forte@Sun.COM plugintable[i].pccallback[j] = 5725*7836SJohn.Forte@Sun.COM pClientFn; 5726*7836SJohn.Forte@Sun.COM plugintable[i]. 5727*7836SJohn.Forte@Sun.COM number_of_pccallbacks++; 5728*7836SJohn.Forte@Sun.COM } 5729*7836SJohn.Forte@Sun.COM 5730*7836SJohn.Forte@Sun.COM } 5731*7836SJohn.Forte@Sun.COM } 5732*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5733*7836SJohn.Forte@Sun.COM } 5734*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) 5735*7836SJohn.Forte@Sun.COM break; 5736*7836SJohn.Forte@Sun.COM 5737*7836SJohn.Forte@Sun.COM } 5738*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5739*7836SJohn.Forte@Sun.COM return (status); 5740*7836SJohn.Forte@Sun.COM 5741*7836SJohn.Forte@Sun.COM } 5742*7836SJohn.Forte@Sun.COM 5743*7836SJohn.Forte@Sun.COM 5744*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_DeregisterForObjectPropertyChanges( 5745*7836SJohn.Forte@Sun.COM IMA_OBJECT_PROPERTY_FN pClientFn) { 5746*7836SJohn.Forte@Sun.COM IMA_DeregisterForObjectPropertyChangesFn PassFunc; 5747*7836SJohn.Forte@Sun.COM IMA_UINT i; 5748*7836SJohn.Forte@Sun.COM IMA_UINT j; 5749*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5750*7836SJohn.Forte@Sun.COM 5751*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5752*7836SJohn.Forte@Sun.COM InitLibrary(); 5753*7836SJohn.Forte@Sun.COM 5754*7836SJohn.Forte@Sun.COM if (pClientFn == NULL) 5755*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5756*7836SJohn.Forte@Sun.COM 5757*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5758*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 5759*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5760*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5761*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5762*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5763*7836SJohn.Forte@Sun.COM /* check if deregistered already */ 5764*7836SJohn.Forte@Sun.COM status = IMA_STATUS_SUCCESS; 5765*7836SJohn.Forte@Sun.COM for (j = 0; 5766*7836SJohn.Forte@Sun.COM j < plugintable[i].number_of_pccallbacks; 5767*7836SJohn.Forte@Sun.COM j++) { 5768*7836SJohn.Forte@Sun.COM if (plugintable[i].pccallback[j] == 5769*7836SJohn.Forte@Sun.COM pClientFn) { 5770*7836SJohn.Forte@Sun.COM /* 5771*7836SJohn.Forte@Sun.COM * use IMA_ERROR_UNKNOWN_ERROR 5772*7836SJohn.Forte@Sun.COM * as a flag 5773*7836SJohn.Forte@Sun.COM */ 5774*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNKNOWN_ERROR; 5775*7836SJohn.Forte@Sun.COM break; 5776*7836SJohn.Forte@Sun.COM } 5777*7836SJohn.Forte@Sun.COM } 5778*7836SJohn.Forte@Sun.COM 5779*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 5780*7836SJohn.Forte@Sun.COM 5781*7836SJohn.Forte@Sun.COM #ifdef WIN32 5782*7836SJohn.Forte@Sun.COM PassFunc = 5783*7836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectPropertyChangesFn) 5784*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5785*7836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectPropertyChanges"); 5786*7836SJohn.Forte@Sun.COM 5787*7836SJohn.Forte@Sun.COM #else 5788*7836SJohn.Forte@Sun.COM PassFunc = 5789*7836SJohn.Forte@Sun.COM (IMA_DeregisterForObjectPropertyChangesFn) 5790*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5791*7836SJohn.Forte@Sun.COM "IMA_DeregisterForObjectPropertyChanges"); 5792*7836SJohn.Forte@Sun.COM #endif 5793*7836SJohn.Forte@Sun.COM 5794*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5795*7836SJohn.Forte@Sun.COM status = PassFunc(PropertyCallback); 5796*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 5797*7836SJohn.Forte@Sun.COM /* 5798*7836SJohn.Forte@Sun.COM * where plugintable[i].vbcallback[ 5799*7836SJohn.Forte@Sun.COM * j] == pClientFn 5800*7836SJohn.Forte@Sun.COM */ 5801*7836SJohn.Forte@Sun.COM for (; j < plugintable[i]. 5802*7836SJohn.Forte@Sun.COM number_of_pccallbacks; 5803*7836SJohn.Forte@Sun.COM j++) { 5804*7836SJohn.Forte@Sun.COM plugintable[i]. 5805*7836SJohn.Forte@Sun.COM pccallback[j] 5806*7836SJohn.Forte@Sun.COM = plugintable[i]. 5807*7836SJohn.Forte@Sun.COM pccallback[j+1]; 5808*7836SJohn.Forte@Sun.COM 5809*7836SJohn.Forte@Sun.COM } 5810*7836SJohn.Forte@Sun.COM plugintable[i]. 5811*7836SJohn.Forte@Sun.COM number_of_pccallbacks--; 5812*7836SJohn.Forte@Sun.COM } 5813*7836SJohn.Forte@Sun.COM 5814*7836SJohn.Forte@Sun.COM } 5815*7836SJohn.Forte@Sun.COM } 5816*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5817*7836SJohn.Forte@Sun.COM } 5818*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) 5819*7836SJohn.Forte@Sun.COM break; 5820*7836SJohn.Forte@Sun.COM 5821*7836SJohn.Forte@Sun.COM } 5822*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5823*7836SJohn.Forte@Sun.COM return (status); 5824*7836SJohn.Forte@Sun.COM 5825*7836SJohn.Forte@Sun.COM } 5826*7836SJohn.Forte@Sun.COM 5827*7836SJohn.Forte@Sun.COM 5828*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetIpProperties( 5829*7836SJohn.Forte@Sun.COM IMA_OID oid, 5830*7836SJohn.Forte@Sun.COM IMA_IP_PROPERTIES *pProps) { 5831*7836SJohn.Forte@Sun.COM IMA_GetIpPropertiesFn PassFunc; 5832*7836SJohn.Forte@Sun.COM IMA_UINT i; 5833*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5834*7836SJohn.Forte@Sun.COM 5835*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5836*7836SJohn.Forte@Sun.COM InitLibrary(); 5837*7836SJohn.Forte@Sun.COM 5838*7836SJohn.Forte@Sun.COM if (pProps == NULL) 5839*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5840*7836SJohn.Forte@Sun.COM 5841*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP) 5842*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5843*7836SJohn.Forte@Sun.COM 5844*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5845*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5846*7836SJohn.Forte@Sun.COM 5847*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5848*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 5849*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5850*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5851*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5852*7836SJohn.Forte@Sun.COM #ifdef WIN32 5853*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetIpPropertiesFn) 5854*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5855*7836SJohn.Forte@Sun.COM "IMA_GetIpProperties"); 5856*7836SJohn.Forte@Sun.COM #else 5857*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetIpPropertiesFn) 5858*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5859*7836SJohn.Forte@Sun.COM "IMA_GetIpProperties"); 5860*7836SJohn.Forte@Sun.COM #endif 5861*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5862*7836SJohn.Forte@Sun.COM status = PassFunc(oid, pProps); 5863*7836SJohn.Forte@Sun.COM } 5864*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5865*7836SJohn.Forte@Sun.COM } 5866*7836SJohn.Forte@Sun.COM 5867*7836SJohn.Forte@Sun.COM break; 5868*7836SJohn.Forte@Sun.COM } 5869*7836SJohn.Forte@Sun.COM } 5870*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5871*7836SJohn.Forte@Sun.COM return (status); 5872*7836SJohn.Forte@Sun.COM } 5873*7836SJohn.Forte@Sun.COM 5874*7836SJohn.Forte@Sun.COM 5875*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetIpConfigMethod( 5876*7836SJohn.Forte@Sun.COM IMA_OID oid, 5877*7836SJohn.Forte@Sun.COM IMA_BOOL enableDhcpIpConfiguration) { 5878*7836SJohn.Forte@Sun.COM IMA_SetIpConfigMethodFn PassFunc; 5879*7836SJohn.Forte@Sun.COM IMA_UINT i; 5880*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5881*7836SJohn.Forte@Sun.COM 5882*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5883*7836SJohn.Forte@Sun.COM InitLibrary(); 5884*7836SJohn.Forte@Sun.COM 5885*7836SJohn.Forte@Sun.COM if (enableDhcpIpConfiguration != IMA_TRUE && 5886*7836SJohn.Forte@Sun.COM enableDhcpIpConfiguration != IMA_FALSE) 5887*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5888*7836SJohn.Forte@Sun.COM 5889*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP) 5890*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5891*7836SJohn.Forte@Sun.COM 5892*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5893*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5894*7836SJohn.Forte@Sun.COM 5895*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5896*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 5897*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5898*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5899*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5900*7836SJohn.Forte@Sun.COM #ifdef WIN32 5901*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetIpConfigMethodFn) 5902*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5903*7836SJohn.Forte@Sun.COM "IMA_SetIpConfigMethod"); 5904*7836SJohn.Forte@Sun.COM #else 5905*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetIpConfigMethodFn) 5906*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5907*7836SJohn.Forte@Sun.COM "IMA_SetIpConfigMethod"); 5908*7836SJohn.Forte@Sun.COM #endif 5909*7836SJohn.Forte@Sun.COM 5910*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5911*7836SJohn.Forte@Sun.COM status = PassFunc(oid, 5912*7836SJohn.Forte@Sun.COM enableDhcpIpConfiguration); 5913*7836SJohn.Forte@Sun.COM } 5914*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5915*7836SJohn.Forte@Sun.COM } 5916*7836SJohn.Forte@Sun.COM 5917*7836SJohn.Forte@Sun.COM break; 5918*7836SJohn.Forte@Sun.COM } 5919*7836SJohn.Forte@Sun.COM } 5920*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5921*7836SJohn.Forte@Sun.COM return (status); 5922*7836SJohn.Forte@Sun.COM } 5923*7836SJohn.Forte@Sun.COM 5924*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetSubnetMask( 5925*7836SJohn.Forte@Sun.COM IMA_OID oid, 5926*7836SJohn.Forte@Sun.COM IMA_IP_ADDRESS subnetMask) { 5927*7836SJohn.Forte@Sun.COM IMA_SetSubnetMaskFn PassFunc; 5928*7836SJohn.Forte@Sun.COM IMA_UINT i; 5929*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5930*7836SJohn.Forte@Sun.COM 5931*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5932*7836SJohn.Forte@Sun.COM InitLibrary(); 5933*7836SJohn.Forte@Sun.COM 5934*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP) 5935*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5936*7836SJohn.Forte@Sun.COM 5937*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5938*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5939*7836SJohn.Forte@Sun.COM 5940*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5941*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 5942*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 5943*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 5944*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 5945*7836SJohn.Forte@Sun.COM #ifdef WIN32 5946*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetSubnetMaskFn) 5947*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 5948*7836SJohn.Forte@Sun.COM "IMA_SetSubnetMask"); 5949*7836SJohn.Forte@Sun.COM #else 5950*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetSubnetMaskFn) 5951*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 5952*7836SJohn.Forte@Sun.COM "IMA_SetSubnetMask"); 5953*7836SJohn.Forte@Sun.COM #endif 5954*7836SJohn.Forte@Sun.COM 5955*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 5956*7836SJohn.Forte@Sun.COM status = PassFunc(oid, subnetMask); 5957*7836SJohn.Forte@Sun.COM } 5958*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 5959*7836SJohn.Forte@Sun.COM } 5960*7836SJohn.Forte@Sun.COM 5961*7836SJohn.Forte@Sun.COM break; 5962*7836SJohn.Forte@Sun.COM } 5963*7836SJohn.Forte@Sun.COM } 5964*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 5965*7836SJohn.Forte@Sun.COM return (status); 5966*7836SJohn.Forte@Sun.COM } 5967*7836SJohn.Forte@Sun.COM 5968*7836SJohn.Forte@Sun.COM 5969*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDnsServerAddress( 5970*7836SJohn.Forte@Sun.COM IMA_OID oid, 5971*7836SJohn.Forte@Sun.COM const IMA_IP_ADDRESS *primaryDnsServerAddress, 5972*7836SJohn.Forte@Sun.COM const IMA_IP_ADDRESS *alternateDnsServerAddress) { 5973*7836SJohn.Forte@Sun.COM IMA_SetDnsServerAddressFn PassFunc; 5974*7836SJohn.Forte@Sun.COM IMA_UINT i; 5975*7836SJohn.Forte@Sun.COM IMA_STATUS status; 5976*7836SJohn.Forte@Sun.COM 5977*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 5978*7836SJohn.Forte@Sun.COM InitLibrary(); 5979*7836SJohn.Forte@Sun.COM 5980*7836SJohn.Forte@Sun.COM if (primaryDnsServerAddress == NULL && 5981*7836SJohn.Forte@Sun.COM alternateDnsServerAddress != NULL) 5982*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5983*7836SJohn.Forte@Sun.COM 5984*7836SJohn.Forte@Sun.COM if (primaryDnsServerAddress != NULL && 5985*7836SJohn.Forte@Sun.COM alternateDnsServerAddress != NULL && 5986*7836SJohn.Forte@Sun.COM memcmp(primaryDnsServerAddress->ipAddress, 5987*7836SJohn.Forte@Sun.COM alternateDnsServerAddress->ipAddress, 5988*7836SJohn.Forte@Sun.COM sizeof (primaryDnsServerAddress->ipAddress)) == 0) 5989*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 5990*7836SJohn.Forte@Sun.COM 5991*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP) 5992*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 5993*7836SJohn.Forte@Sun.COM 5994*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 5995*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 5996*7836SJohn.Forte@Sun.COM 5997*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 5998*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 5999*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6000*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6001*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6002*7836SJohn.Forte@Sun.COM #ifdef WIN32 6003*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetDnsServerAddressFn) 6004*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6005*7836SJohn.Forte@Sun.COM "IMA_SetDnsServerAddress"); 6006*7836SJohn.Forte@Sun.COM #else 6007*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetDnsServerAddressFn) 6008*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6009*7836SJohn.Forte@Sun.COM "IMA_SetDnsServerAddress"); 6010*7836SJohn.Forte@Sun.COM #endif 6011*7836SJohn.Forte@Sun.COM 6012*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6013*7836SJohn.Forte@Sun.COM status = PassFunc(oid, 6014*7836SJohn.Forte@Sun.COM primaryDnsServerAddress, 6015*7836SJohn.Forte@Sun.COM alternateDnsServerAddress); 6016*7836SJohn.Forte@Sun.COM } 6017*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6018*7836SJohn.Forte@Sun.COM } 6019*7836SJohn.Forte@Sun.COM 6020*7836SJohn.Forte@Sun.COM break; 6021*7836SJohn.Forte@Sun.COM } 6022*7836SJohn.Forte@Sun.COM } 6023*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6024*7836SJohn.Forte@Sun.COM return (status); 6025*7836SJohn.Forte@Sun.COM } 6026*7836SJohn.Forte@Sun.COM 6027*7836SJohn.Forte@Sun.COM 6028*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetDefaultGateway( 6029*7836SJohn.Forte@Sun.COM IMA_OID oid, 6030*7836SJohn.Forte@Sun.COM IMA_IP_ADDRESS defaultGateway) { 6031*7836SJohn.Forte@Sun.COM IMA_SetDefaultGatewayFn PassFunc; 6032*7836SJohn.Forte@Sun.COM IMA_UINT i; 6033*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6034*7836SJohn.Forte@Sun.COM 6035*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6036*7836SJohn.Forte@Sun.COM InitLibrary(); 6037*7836SJohn.Forte@Sun.COM 6038*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP) 6039*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6040*7836SJohn.Forte@Sun.COM 6041*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6042*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6043*7836SJohn.Forte@Sun.COM 6044*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6045*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 6046*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6047*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6048*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6049*7836SJohn.Forte@Sun.COM #ifdef WIN32 6050*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetDefaultGatewayFn) 6051*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6052*7836SJohn.Forte@Sun.COM "IMA_SetDefaultGateway"); 6053*7836SJohn.Forte@Sun.COM #else 6054*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetDefaultGatewayFn) 6055*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6056*7836SJohn.Forte@Sun.COM "IMA_SetDefaultGateway"); 6057*7836SJohn.Forte@Sun.COM #endif 6058*7836SJohn.Forte@Sun.COM 6059*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6060*7836SJohn.Forte@Sun.COM status = PassFunc(oid, defaultGateway); 6061*7836SJohn.Forte@Sun.COM } 6062*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6063*7836SJohn.Forte@Sun.COM } 6064*7836SJohn.Forte@Sun.COM 6065*7836SJohn.Forte@Sun.COM break; 6066*7836SJohn.Forte@Sun.COM } 6067*7836SJohn.Forte@Sun.COM } 6068*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6069*7836SJohn.Forte@Sun.COM return (status); 6070*7836SJohn.Forte@Sun.COM } 6071*7836SJohn.Forte@Sun.COM 6072*7836SJohn.Forte@Sun.COM 6073*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetSupportedAuthMethods( 6074*7836SJohn.Forte@Sun.COM IMA_OID lhbaOid, 6075*7836SJohn.Forte@Sun.COM IMA_BOOL getSettableMethods, 6076*7836SJohn.Forte@Sun.COM IMA_UINT *pMethodCount, 6077*7836SJohn.Forte@Sun.COM IMA_AUTHMETHOD *pMethodList) { 6078*7836SJohn.Forte@Sun.COM IMA_GetSupportedAuthMethodsFn PassFunc; 6079*7836SJohn.Forte@Sun.COM IMA_UINT i; 6080*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6081*7836SJohn.Forte@Sun.COM 6082*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6083*7836SJohn.Forte@Sun.COM InitLibrary(); 6084*7836SJohn.Forte@Sun.COM 6085*7836SJohn.Forte@Sun.COM if (pMethodCount == NULL) 6086*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6087*7836SJohn.Forte@Sun.COM 6088*7836SJohn.Forte@Sun.COM if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) 6089*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6090*7836SJohn.Forte@Sun.COM 6091*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6092*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6093*7836SJohn.Forte@Sun.COM 6094*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6095*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaOid.ownerId) { 6096*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6097*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6098*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6099*7836SJohn.Forte@Sun.COM #ifdef WIN32 6100*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSupportedAuthMethodsFn) 6101*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6102*7836SJohn.Forte@Sun.COM "IMA_GetSupportedAuthMethods"); 6103*7836SJohn.Forte@Sun.COM #else 6104*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSupportedAuthMethodsFn) 6105*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6106*7836SJohn.Forte@Sun.COM "IMA_GetSupportedAuthMethods"); 6107*7836SJohn.Forte@Sun.COM #endif 6108*7836SJohn.Forte@Sun.COM 6109*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6110*7836SJohn.Forte@Sun.COM status = PassFunc(lhbaOid, 6111*7836SJohn.Forte@Sun.COM getSettableMethods, 6112*7836SJohn.Forte@Sun.COM pMethodCount, pMethodList); 6113*7836SJohn.Forte@Sun.COM } 6114*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6115*7836SJohn.Forte@Sun.COM } 6116*7836SJohn.Forte@Sun.COM 6117*7836SJohn.Forte@Sun.COM break; 6118*7836SJohn.Forte@Sun.COM } 6119*7836SJohn.Forte@Sun.COM } 6120*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6121*7836SJohn.Forte@Sun.COM return (status); 6122*7836SJohn.Forte@Sun.COM } 6123*7836SJohn.Forte@Sun.COM 6124*7836SJohn.Forte@Sun.COM 6125*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetInUseInitiatorAuthMethods( 6126*7836SJohn.Forte@Sun.COM IMA_OID lhbaOid, 6127*7836SJohn.Forte@Sun.COM IMA_UINT *pMethodCount, 6128*7836SJohn.Forte@Sun.COM IMA_AUTHMETHOD *pMethodList) { 6129*7836SJohn.Forte@Sun.COM IMA_GetInUseInitiatorAuthMethodsFn PassFunc; 6130*7836SJohn.Forte@Sun.COM IMA_UINT i; 6131*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6132*7836SJohn.Forte@Sun.COM 6133*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6134*7836SJohn.Forte@Sun.COM InitLibrary(); 6135*7836SJohn.Forte@Sun.COM 6136*7836SJohn.Forte@Sun.COM if (pMethodCount == NULL) 6137*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6138*7836SJohn.Forte@Sun.COM 6139*7836SJohn.Forte@Sun.COM if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) 6140*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6141*7836SJohn.Forte@Sun.COM 6142*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6143*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6144*7836SJohn.Forte@Sun.COM 6145*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6146*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaOid.ownerId) { 6147*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6148*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6149*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6150*7836SJohn.Forte@Sun.COM #ifdef WIN32 6151*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetInUseInitiatorAuthMethodsFn) 6152*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6153*7836SJohn.Forte@Sun.COM "IMA_GetInUseInitiatorAuthMethods"); 6154*7836SJohn.Forte@Sun.COM #else 6155*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetInUseInitiatorAuthMethodsFn) 6156*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6157*7836SJohn.Forte@Sun.COM "IMA_GetInUseInitiatorAuthMethods"); 6158*7836SJohn.Forte@Sun.COM #endif 6159*7836SJohn.Forte@Sun.COM 6160*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6161*7836SJohn.Forte@Sun.COM status = PassFunc(lhbaOid, 6162*7836SJohn.Forte@Sun.COM pMethodCount, pMethodList); 6163*7836SJohn.Forte@Sun.COM } 6164*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6165*7836SJohn.Forte@Sun.COM } 6166*7836SJohn.Forte@Sun.COM 6167*7836SJohn.Forte@Sun.COM break; 6168*7836SJohn.Forte@Sun.COM } 6169*7836SJohn.Forte@Sun.COM } 6170*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6171*7836SJohn.Forte@Sun.COM return (status); 6172*7836SJohn.Forte@Sun.COM } 6173*7836SJohn.Forte@Sun.COM 6174*7836SJohn.Forte@Sun.COM 6175*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetInitiatorAuthParms( 6176*7836SJohn.Forte@Sun.COM IMA_OID lhbaOid, 6177*7836SJohn.Forte@Sun.COM IMA_AUTHMETHOD method, 6178*7836SJohn.Forte@Sun.COM IMA_INITIATOR_AUTHPARMS *pParms) { 6179*7836SJohn.Forte@Sun.COM IMA_GetInitiatorAuthParmsFn PassFunc; 6180*7836SJohn.Forte@Sun.COM IMA_UINT i; 6181*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6182*7836SJohn.Forte@Sun.COM 6183*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6184*7836SJohn.Forte@Sun.COM InitLibrary(); 6185*7836SJohn.Forte@Sun.COM 6186*7836SJohn.Forte@Sun.COM if (pParms == NULL) 6187*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6188*7836SJohn.Forte@Sun.COM 6189*7836SJohn.Forte@Sun.COM if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) 6190*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6191*7836SJohn.Forte@Sun.COM 6192*7836SJohn.Forte@Sun.COM if (method != IMA_AUTHMETHOD_NONE && 6193*7836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_CHAP && 6194*7836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SRP && 6195*7836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_KRB5 && 6196*7836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SPKM1 && 6197*7836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SPKM2) 6198*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6199*7836SJohn.Forte@Sun.COM 6200*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6201*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6202*7836SJohn.Forte@Sun.COM 6203*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6204*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaOid.ownerId) { 6205*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6206*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6207*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6208*7836SJohn.Forte@Sun.COM #ifdef WIN32 6209*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetInitiatorAuthParmsFn) 6210*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6211*7836SJohn.Forte@Sun.COM "IMA_GetInitiatorAuthParms"); 6212*7836SJohn.Forte@Sun.COM #else 6213*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetInitiatorAuthParmsFn) 6214*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6215*7836SJohn.Forte@Sun.COM "IMA_GetInitiatorAuthParms"); 6216*7836SJohn.Forte@Sun.COM #endif 6217*7836SJohn.Forte@Sun.COM 6218*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6219*7836SJohn.Forte@Sun.COM status = PassFunc(lhbaOid, 6220*7836SJohn.Forte@Sun.COM method, pParms); 6221*7836SJohn.Forte@Sun.COM } 6222*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6223*7836SJohn.Forte@Sun.COM } 6224*7836SJohn.Forte@Sun.COM 6225*7836SJohn.Forte@Sun.COM break; 6226*7836SJohn.Forte@Sun.COM } 6227*7836SJohn.Forte@Sun.COM } 6228*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6229*7836SJohn.Forte@Sun.COM return (status); 6230*7836SJohn.Forte@Sun.COM } 6231*7836SJohn.Forte@Sun.COM 6232*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetInitiatorAuthMethods( 6233*7836SJohn.Forte@Sun.COM IMA_OID lhbaOid, 6234*7836SJohn.Forte@Sun.COM IMA_UINT methodCount, 6235*7836SJohn.Forte@Sun.COM const IMA_AUTHMETHOD *pMethodList) { 6236*7836SJohn.Forte@Sun.COM IMA_SetInitiatorAuthMethodsFn PassFunc; 6237*7836SJohn.Forte@Sun.COM IMA_UINT i; 6238*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6239*7836SJohn.Forte@Sun.COM 6240*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6241*7836SJohn.Forte@Sun.COM InitLibrary(); 6242*7836SJohn.Forte@Sun.COM 6243*7836SJohn.Forte@Sun.COM if (methodCount == 0 || pMethodList == NULL) 6244*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6245*7836SJohn.Forte@Sun.COM 6246*7836SJohn.Forte@Sun.COM if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) 6247*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6248*7836SJohn.Forte@Sun.COM 6249*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6250*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6251*7836SJohn.Forte@Sun.COM 6252*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6253*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaOid.ownerId) { 6254*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6255*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6256*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6257*7836SJohn.Forte@Sun.COM #ifdef WIN32 6258*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetInitiatorAuthMethodsFn) 6259*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6260*7836SJohn.Forte@Sun.COM "IMA_SetInitiatorAuthMethods"); 6261*7836SJohn.Forte@Sun.COM #else 6262*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetInitiatorAuthMethodsFn) 6263*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6264*7836SJohn.Forte@Sun.COM "IMA_SetInitiatorAuthMethods"); 6265*7836SJohn.Forte@Sun.COM #endif 6266*7836SJohn.Forte@Sun.COM 6267*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6268*7836SJohn.Forte@Sun.COM status = PassFunc(lhbaOid, 6269*7836SJohn.Forte@Sun.COM methodCount, pMethodList); 6270*7836SJohn.Forte@Sun.COM } 6271*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6272*7836SJohn.Forte@Sun.COM } 6273*7836SJohn.Forte@Sun.COM 6274*7836SJohn.Forte@Sun.COM break; 6275*7836SJohn.Forte@Sun.COM } 6276*7836SJohn.Forte@Sun.COM } 6277*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6278*7836SJohn.Forte@Sun.COM return (status); 6279*7836SJohn.Forte@Sun.COM } 6280*7836SJohn.Forte@Sun.COM 6281*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_SetInitiatorAuthParms( 6282*7836SJohn.Forte@Sun.COM IMA_OID lhbaOid, 6283*7836SJohn.Forte@Sun.COM IMA_AUTHMETHOD method, 6284*7836SJohn.Forte@Sun.COM const IMA_INITIATOR_AUTHPARMS *pParms) { 6285*7836SJohn.Forte@Sun.COM 6286*7836SJohn.Forte@Sun.COM IMA_SetInitiatorAuthParmsFn PassFunc; 6287*7836SJohn.Forte@Sun.COM IMA_UINT i; 6288*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6289*7836SJohn.Forte@Sun.COM 6290*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6291*7836SJohn.Forte@Sun.COM InitLibrary(); 6292*7836SJohn.Forte@Sun.COM 6293*7836SJohn.Forte@Sun.COM if (pParms == NULL) 6294*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6295*7836SJohn.Forte@Sun.COM 6296*7836SJohn.Forte@Sun.COM if (method != IMA_AUTHMETHOD_NONE && 6297*7836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_CHAP && 6298*7836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SRP && 6299*7836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_KRB5 && 6300*7836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SPKM1 && 6301*7836SJohn.Forte@Sun.COM method != IMA_AUTHMETHOD_SPKM2) 6302*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6303*7836SJohn.Forte@Sun.COM 6304*7836SJohn.Forte@Sun.COM if (lhbaOid.objectType != IMA_OBJECT_TYPE_LHBA) 6305*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6306*7836SJohn.Forte@Sun.COM 6307*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6308*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6309*7836SJohn.Forte@Sun.COM 6310*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6311*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == lhbaOid.ownerId) { 6312*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6313*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6314*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6315*7836SJohn.Forte@Sun.COM #ifdef WIN32 6316*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetInitiatorAuthParmsFn) 6317*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6318*7836SJohn.Forte@Sun.COM "IMA_SetInitiatorAuthParms"); 6319*7836SJohn.Forte@Sun.COM #else 6320*7836SJohn.Forte@Sun.COM PassFunc = (IMA_SetInitiatorAuthParmsFn) 6321*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6322*7836SJohn.Forte@Sun.COM "IMA_SetInitiatorAuthParms"); 6323*7836SJohn.Forte@Sun.COM #endif 6324*7836SJohn.Forte@Sun.COM 6325*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6326*7836SJohn.Forte@Sun.COM status = 6327*7836SJohn.Forte@Sun.COM PassFunc( 6328*7836SJohn.Forte@Sun.COM lhbaOid, method, pParms); 6329*7836SJohn.Forte@Sun.COM } 6330*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6331*7836SJohn.Forte@Sun.COM } 6332*7836SJohn.Forte@Sun.COM 6333*7836SJohn.Forte@Sun.COM break; 6334*7836SJohn.Forte@Sun.COM } 6335*7836SJohn.Forte@Sun.COM } 6336*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6337*7836SJohn.Forte@Sun.COM return (status); 6338*7836SJohn.Forte@Sun.COM } 6339*7836SJohn.Forte@Sun.COM 6340*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetOidList( 6341*7836SJohn.Forte@Sun.COM IMA_OID oid, 6342*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 6343*7836SJohn.Forte@Sun.COM IMA_GetStaticDiscoveryTargetOidListFn PassFunc; 6344*7836SJohn.Forte@Sun.COM IMA_UINT i; 6345*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6346*7836SJohn.Forte@Sun.COM 6347*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6348*7836SJohn.Forte@Sun.COM InitLibrary(); 6349*7836SJohn.Forte@Sun.COM 6350*7836SJohn.Forte@Sun.COM if (ppList == NULL) 6351*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6352*7836SJohn.Forte@Sun.COM 6353*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_LHBA && 6354*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PNP) 6355*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6356*7836SJohn.Forte@Sun.COM 6357*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6358*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6359*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6360*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 6361*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6362*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6363*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6364*7836SJohn.Forte@Sun.COM #ifdef WIN32 6365*7836SJohn.Forte@Sun.COM PassFunc = 6366*7836SJohn.Forte@Sun.COM (IMA_GetStaticDiscoveryTargetOidListFn) 6367*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6368*7836SJohn.Forte@Sun.COM "IMA_GetStaticDiscoveryTargetOidList"); 6369*7836SJohn.Forte@Sun.COM #else 6370*7836SJohn.Forte@Sun.COM PassFunc = 6371*7836SJohn.Forte@Sun.COM (IMA_GetStaticDiscoveryTargetOidListFn) 6372*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6373*7836SJohn.Forte@Sun.COM "IMA_GetStaticDiscoveryTargetOidList"); 6374*7836SJohn.Forte@Sun.COM #endif 6375*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6376*7836SJohn.Forte@Sun.COM status = PassFunc(oid, ppList); 6377*7836SJohn.Forte@Sun.COM } 6378*7836SJohn.Forte@Sun.COM 6379*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6380*7836SJohn.Forte@Sun.COM } 6381*7836SJohn.Forte@Sun.COM 6382*7836SJohn.Forte@Sun.COM break; 6383*7836SJohn.Forte@Sun.COM } 6384*7836SJohn.Forte@Sun.COM } 6385*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6386*7836SJohn.Forte@Sun.COM return (status); 6387*7836SJohn.Forte@Sun.COM } 6388*7836SJohn.Forte@Sun.COM 6389*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDiscoveryProperties( 6390*7836SJohn.Forte@Sun.COM IMA_OID oid, 6391*7836SJohn.Forte@Sun.COM IMA_DISCOVERY_PROPERTIES *pProps) { 6392*7836SJohn.Forte@Sun.COM IMA_GetDiscoveryPropertiesFn PassFunc; 6393*7836SJohn.Forte@Sun.COM IMA_UINT i; 6394*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6395*7836SJohn.Forte@Sun.COM 6396*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6397*7836SJohn.Forte@Sun.COM InitLibrary(); 6398*7836SJohn.Forte@Sun.COM 6399*7836SJohn.Forte@Sun.COM if (pProps == NULL) 6400*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6401*7836SJohn.Forte@Sun.COM 6402*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PHBA && 6403*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LHBA) 6404*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6405*7836SJohn.Forte@Sun.COM 6406*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6407*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6408*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6409*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 6410*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6411*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6412*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6413*7836SJohn.Forte@Sun.COM #ifdef WIN32 6414*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryPropertiesFn) 6415*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6416*7836SJohn.Forte@Sun.COM "IMA_GetDiscoveryProperties"); 6417*7836SJohn.Forte@Sun.COM #else 6418*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryPropertiesFn) 6419*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6420*7836SJohn.Forte@Sun.COM "IMA_GetDiscoveryProperties"); 6421*7836SJohn.Forte@Sun.COM #endif 6422*7836SJohn.Forte@Sun.COM 6423*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6424*7836SJohn.Forte@Sun.COM status = PassFunc(oid, pProps); 6425*7836SJohn.Forte@Sun.COM } 6426*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6427*7836SJohn.Forte@Sun.COM } 6428*7836SJohn.Forte@Sun.COM 6429*7836SJohn.Forte@Sun.COM break; 6430*7836SJohn.Forte@Sun.COM } 6431*7836SJohn.Forte@Sun.COM } 6432*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6433*7836SJohn.Forte@Sun.COM return (status); 6434*7836SJohn.Forte@Sun.COM } 6435*7836SJohn.Forte@Sun.COM 6436*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_AddDiscoveryAddress( 6437*7836SJohn.Forte@Sun.COM IMA_OID oid, 6438*7836SJohn.Forte@Sun.COM const IMA_TARGET_ADDRESS discoveryAddress, 6439*7836SJohn.Forte@Sun.COM IMA_OID *pDiscoveryAddressOid) { 6440*7836SJohn.Forte@Sun.COM IMA_AddDiscoveryAddressFn PassFunc; 6441*7836SJohn.Forte@Sun.COM IMA_UINT i; 6442*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6443*7836SJohn.Forte@Sun.COM 6444*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6445*7836SJohn.Forte@Sun.COM InitLibrary(); 6446*7836SJohn.Forte@Sun.COM 6447*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_LHBA && 6448*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PNP) 6449*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6450*7836SJohn.Forte@Sun.COM 6451*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6452*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6453*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6454*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 6455*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6456*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6457*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6458*7836SJohn.Forte@Sun.COM #ifdef WIN32 6459*7836SJohn.Forte@Sun.COM PassFunc = (IMA_AddDiscoveryAddressFn) 6460*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6461*7836SJohn.Forte@Sun.COM "IMA_AddDiscoveryAddress"); 6462*7836SJohn.Forte@Sun.COM #else 6463*7836SJohn.Forte@Sun.COM PassFunc = (IMA_AddDiscoveryAddressFn) 6464*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6465*7836SJohn.Forte@Sun.COM "IMA_AddDiscoveryAddress"); 6466*7836SJohn.Forte@Sun.COM #endif 6467*7836SJohn.Forte@Sun.COM 6468*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6469*7836SJohn.Forte@Sun.COM status = PassFunc(oid, 6470*7836SJohn.Forte@Sun.COM discoveryAddress, 6471*7836SJohn.Forte@Sun.COM pDiscoveryAddressOid); 6472*7836SJohn.Forte@Sun.COM } 6473*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6474*7836SJohn.Forte@Sun.COM } 6475*7836SJohn.Forte@Sun.COM 6476*7836SJohn.Forte@Sun.COM break; 6477*7836SJohn.Forte@Sun.COM } 6478*7836SJohn.Forte@Sun.COM } 6479*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6480*7836SJohn.Forte@Sun.COM return (status); 6481*7836SJohn.Forte@Sun.COM } 6482*7836SJohn.Forte@Sun.COM 6483*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_AddStaticDiscoveryTarget( 6484*7836SJohn.Forte@Sun.COM IMA_OID oid, 6485*7836SJohn.Forte@Sun.COM const IMA_STATIC_DISCOVERY_TARGET staticDiscoveryTarget, 6486*7836SJohn.Forte@Sun.COM IMA_OID *pStaticDiscoveryTargetOid) { 6487*7836SJohn.Forte@Sun.COM IMA_AddStaticDiscoveryTargetFn PassFunc; 6488*7836SJohn.Forte@Sun.COM IMA_UINT i; 6489*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6490*7836SJohn.Forte@Sun.COM 6491*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6492*7836SJohn.Forte@Sun.COM InitLibrary(); 6493*7836SJohn.Forte@Sun.COM 6494*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_LHBA && 6495*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PNP) 6496*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6497*7836SJohn.Forte@Sun.COM 6498*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6499*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6500*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6501*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 6502*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6503*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6504*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6505*7836SJohn.Forte@Sun.COM #ifdef WIN32 6506*7836SJohn.Forte@Sun.COM PassFunc = (IMA_AddStaticDiscoveryTargetFn) 6507*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6508*7836SJohn.Forte@Sun.COM "IMA_AddStaticDiscoveryTarget"); 6509*7836SJohn.Forte@Sun.COM 6510*7836SJohn.Forte@Sun.COM #else 6511*7836SJohn.Forte@Sun.COM PassFunc = (IMA_AddStaticDiscoveryTargetFn) 6512*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6513*7836SJohn.Forte@Sun.COM "IMA_AddStaticDiscoveryTarget"); 6514*7836SJohn.Forte@Sun.COM #endif 6515*7836SJohn.Forte@Sun.COM 6516*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6517*7836SJohn.Forte@Sun.COM status = PassFunc(oid, 6518*7836SJohn.Forte@Sun.COM staticDiscoveryTarget, 6519*7836SJohn.Forte@Sun.COM pStaticDiscoveryTargetOid); 6520*7836SJohn.Forte@Sun.COM } 6521*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6522*7836SJohn.Forte@Sun.COM } 6523*7836SJohn.Forte@Sun.COM 6524*7836SJohn.Forte@Sun.COM break; 6525*7836SJohn.Forte@Sun.COM } 6526*7836SJohn.Forte@Sun.COM } 6527*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6528*7836SJohn.Forte@Sun.COM return (status); 6529*7836SJohn.Forte@Sun.COM } 6530*7836SJohn.Forte@Sun.COM 6531*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_CommitHbaParameters(IMA_OID oid, 6532*7836SJohn.Forte@Sun.COM IMA_COMMIT_LEVEL commitLevel) 6533*7836SJohn.Forte@Sun.COM { 6534*7836SJohn.Forte@Sun.COM IMA_CommitHbaParametersFn PassFunc; 6535*7836SJohn.Forte@Sun.COM IMA_UINT i; 6536*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6537*7836SJohn.Forte@Sun.COM 6538*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6539*7836SJohn.Forte@Sun.COM InitLibrary(); 6540*7836SJohn.Forte@Sun.COM 6541*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_LHBA && 6542*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_PHBA) 6543*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6544*7836SJohn.Forte@Sun.COM 6545*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6546*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6547*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6548*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 6549*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6550*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6551*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6552*7836SJohn.Forte@Sun.COM #ifdef WIN32 6553*7836SJohn.Forte@Sun.COM PassFunc = (IMA_CommitHbaParametersFn) 6554*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6555*7836SJohn.Forte@Sun.COM "IMA_CommitHbaParameters"); 6556*7836SJohn.Forte@Sun.COM #else 6557*7836SJohn.Forte@Sun.COM PassFunc = (IMA_CommitHbaParametersFn) 6558*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6559*7836SJohn.Forte@Sun.COM "IMA_CommitHbaParameters"); 6560*7836SJohn.Forte@Sun.COM #endif 6561*7836SJohn.Forte@Sun.COM 6562*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6563*7836SJohn.Forte@Sun.COM status = PassFunc(oid, commitLevel); 6564*7836SJohn.Forte@Sun.COM } 6565*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6566*7836SJohn.Forte@Sun.COM } 6567*7836SJohn.Forte@Sun.COM 6568*7836SJohn.Forte@Sun.COM break; 6569*7836SJohn.Forte@Sun.COM } 6570*7836SJohn.Forte@Sun.COM } 6571*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6572*7836SJohn.Forte@Sun.COM return (status); 6573*7836SJohn.Forte@Sun.COM } 6574*7836SJohn.Forte@Sun.COM 6575*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RemoveStaticDiscoveryTarget( 6576*7836SJohn.Forte@Sun.COM IMA_OID oid) { 6577*7836SJohn.Forte@Sun.COM IMA_RemoveStaticDiscoveryTargetFn PassFunc; 6578*7836SJohn.Forte@Sun.COM IMA_UINT i; 6579*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6580*7836SJohn.Forte@Sun.COM 6581*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6582*7836SJohn.Forte@Sun.COM InitLibrary(); 6583*7836SJohn.Forte@Sun.COM 6584*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) 6585*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6586*7836SJohn.Forte@Sun.COM 6587*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6588*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6589*7836SJohn.Forte@Sun.COM 6590*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6591*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 6592*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6593*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6594*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6595*7836SJohn.Forte@Sun.COM #ifdef WIN32 6596*7836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveStaticDiscoveryTargetFn) 6597*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6598*7836SJohn.Forte@Sun.COM "IMA_RemoveStaticDiscoveryTarget"); 6599*7836SJohn.Forte@Sun.COM #else 6600*7836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveStaticDiscoveryTargetFn) 6601*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6602*7836SJohn.Forte@Sun.COM "IMA_RemoveStaticDiscoveryTarget"); 6603*7836SJohn.Forte@Sun.COM #endif 6604*7836SJohn.Forte@Sun.COM 6605*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6606*7836SJohn.Forte@Sun.COM status = PassFunc(oid); 6607*7836SJohn.Forte@Sun.COM } 6608*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6609*7836SJohn.Forte@Sun.COM } 6610*7836SJohn.Forte@Sun.COM 6611*7836SJohn.Forte@Sun.COM break; 6612*7836SJohn.Forte@Sun.COM } 6613*7836SJohn.Forte@Sun.COM } 6614*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6615*7836SJohn.Forte@Sun.COM return (status); 6616*7836SJohn.Forte@Sun.COM } 6617*7836SJohn.Forte@Sun.COM 6618*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetStaticDiscoveryTargetProperties( 6619*7836SJohn.Forte@Sun.COM IMA_OID staticDiscoveryTargetOid, 6620*7836SJohn.Forte@Sun.COM IMA_STATIC_DISCOVERY_TARGET_PROPERTIES *pProps) { 6621*7836SJohn.Forte@Sun.COM IMA_GetStaticDiscoveryTargetPropertiesFn PassFunc; 6622*7836SJohn.Forte@Sun.COM IMA_UINT i; 6623*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6624*7836SJohn.Forte@Sun.COM 6625*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6626*7836SJohn.Forte@Sun.COM InitLibrary(); 6627*7836SJohn.Forte@Sun.COM 6628*7836SJohn.Forte@Sun.COM if (pProps == NULL) 6629*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6630*7836SJohn.Forte@Sun.COM 6631*7836SJohn.Forte@Sun.COM if (staticDiscoveryTargetOid.objectType != 6632*7836SJohn.Forte@Sun.COM IMA_OBJECT_TYPE_STATIC_DISCOVERY_TARGET) 6633*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6634*7836SJohn.Forte@Sun.COM 6635*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6636*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6637*7836SJohn.Forte@Sun.COM 6638*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6639*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == 6640*7836SJohn.Forte@Sun.COM staticDiscoveryTargetOid.ownerId) { 6641*7836SJohn.Forte@Sun.COM 6642*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6643*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6644*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6645*7836SJohn.Forte@Sun.COM #ifdef WIN32 6646*7836SJohn.Forte@Sun.COM PassFunc = 6647*7836SJohn.Forte@Sun.COM (IMA_GetStaticDiscoveryTargetPropertiesFn) 6648*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6649*7836SJohn.Forte@Sun.COM "IMA_GetStaticDiscoveryTargetProperties"); 6650*7836SJohn.Forte@Sun.COM #else 6651*7836SJohn.Forte@Sun.COM PassFunc = 6652*7836SJohn.Forte@Sun.COM (IMA_GetStaticDiscoveryTargetPropertiesFn) 6653*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6654*7836SJohn.Forte@Sun.COM "IMA_GetStaticDiscoveryTargetProperties"); 6655*7836SJohn.Forte@Sun.COM #endif 6656*7836SJohn.Forte@Sun.COM 6657*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6658*7836SJohn.Forte@Sun.COM status = PassFunc( 6659*7836SJohn.Forte@Sun.COM staticDiscoveryTargetOid, pProps); 6660*7836SJohn.Forte@Sun.COM } 6661*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6662*7836SJohn.Forte@Sun.COM } 6663*7836SJohn.Forte@Sun.COM 6664*7836SJohn.Forte@Sun.COM break; 6665*7836SJohn.Forte@Sun.COM } 6666*7836SJohn.Forte@Sun.COM } 6667*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6668*7836SJohn.Forte@Sun.COM return (status); 6669*7836SJohn.Forte@Sun.COM } 6670*7836SJohn.Forte@Sun.COM 6671*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDiscoveryAddressOidList( 6672*7836SJohn.Forte@Sun.COM IMA_OID Oid, 6673*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 6674*7836SJohn.Forte@Sun.COM 6675*7836SJohn.Forte@Sun.COM IMA_GetDiscoveryAddressOidListFn PassFunc; 6676*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 6677*7836SJohn.Forte@Sun.COM 6678*7836SJohn.Forte@Sun.COM IMA_UINT i; 6679*7836SJohn.Forte@Sun.COM IMA_UINT j; 6680*7836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 6681*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6682*7836SJohn.Forte@Sun.COM 6683*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6684*7836SJohn.Forte@Sun.COM InitLibrary(); 6685*7836SJohn.Forte@Sun.COM 6686*7836SJohn.Forte@Sun.COM if (ppList == NULL) 6687*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6688*7836SJohn.Forte@Sun.COM 6689*7836SJohn.Forte@Sun.COM if ((Oid.objectType != IMA_OBJECT_TYPE_LHBA) && 6690*7836SJohn.Forte@Sun.COM (Oid.objectType != IMA_OBJECT_TYPE_PNP)) { 6691*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6692*7836SJohn.Forte@Sun.COM } 6693*7836SJohn.Forte@Sun.COM 6694*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6695*7836SJohn.Forte@Sun.COM // Get total id count first 6696*7836SJohn.Forte@Sun.COM totalIdCount = 0; 6697*7836SJohn.Forte@Sun.COM 6698*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6699*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6700*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 6701*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6702*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6703*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6704*7836SJohn.Forte@Sun.COM #ifdef WIN32 6705*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryAddressOidListFn) 6706*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6707*7836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressOidList"); 6708*7836SJohn.Forte@Sun.COM #else 6709*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryAddressOidListFn) 6710*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6711*7836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressOidList"); 6712*7836SJohn.Forte@Sun.COM #endif 6713*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6714*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 6715*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 6716*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 6717*7836SJohn.Forte@Sun.COM totalIdCount += 6718*7836SJohn.Forte@Sun.COM ppOidList->oidCount; 6719*7836SJohn.Forte@Sun.COM #ifdef WIN32 6720*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 6721*7836SJohn.Forte@Sun.COM GetProcAddress( 6722*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 6723*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 6724*7836SJohn.Forte@Sun.COM #else 6725*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 6726*7836SJohn.Forte@Sun.COM dlsym( 6727*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 6728*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 6729*7836SJohn.Forte@Sun.COM #endif 6730*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 6731*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 6732*7836SJohn.Forte@Sun.COM } 6733*7836SJohn.Forte@Sun.COM } 6734*7836SJohn.Forte@Sun.COM } 6735*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6736*7836SJohn.Forte@Sun.COM } 6737*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 6738*7836SJohn.Forte@Sun.COM break; 6739*7836SJohn.Forte@Sun.COM } 6740*7836SJohn.Forte@Sun.COM } 6741*7836SJohn.Forte@Sun.COM } 6742*7836SJohn.Forte@Sun.COM 6743*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 6744*7836SJohn.Forte@Sun.COM (totalIdCount - 1)* sizeof (IMA_OID)); 6745*7836SJohn.Forte@Sun.COM 6746*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 6747*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6748*7836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 6749*7836SJohn.Forte@Sun.COM } 6750*7836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 6751*7836SJohn.Forte@Sun.COM 6752*7836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 6753*7836SJohn.Forte@Sun.COM totalIdCount = 0; 6754*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6755*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6756*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 6757*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6758*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6759*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6760*7836SJohn.Forte@Sun.COM #ifdef WIN32 6761*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryAddressOidListFn) 6762*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6763*7836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressOidList"); 6764*7836SJohn.Forte@Sun.COM #else 6765*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetDiscoveryAddressOidListFn) 6766*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6767*7836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressOidList"); 6768*7836SJohn.Forte@Sun.COM #endif 6769*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6770*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 6771*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 6772*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 6773*7836SJohn.Forte@Sun.COM for (j = 0; 6774*7836SJohn.Forte@Sun.COM (j < ppOidList->oidCount) && 6775*7836SJohn.Forte@Sun.COM (totalIdCount < 6776*7836SJohn.Forte@Sun.COM (*ppList)->oidCount); 6777*7836SJohn.Forte@Sun.COM j++) { 6778*7836SJohn.Forte@Sun.COM #define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber 6779*7836SJohn.Forte@Sun.COM (*ppList)->oids 6780*7836SJohn.Forte@Sun.COM [totalIdCount]. 6781*7836SJohn.Forte@Sun.COM objectType = 6782*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 6783*7836SJohn.Forte@Sun.COM objectType; 6784*7836SJohn.Forte@Sun.COM (*ppList)->oids[ 6785*7836SJohn.Forte@Sun.COM totalIdCount]. 6786*7836SJohn.Forte@Sun.COM objectSequenceNumber 6787*7836SJohn.Forte@Sun.COM = OBJ_SEQ_NUM; 6788*7836SJohn.Forte@Sun.COM (*ppList)->oids[ 6789*7836SJohn.Forte@Sun.COM totalIdCount]. 6790*7836SJohn.Forte@Sun.COM ownerId = 6791*7836SJohn.Forte@Sun.COM ppOidList-> 6792*7836SJohn.Forte@Sun.COM oids[j].ownerId; 6793*7836SJohn.Forte@Sun.COM totalIdCount++; 6794*7836SJohn.Forte@Sun.COM #undef OBJ_SEQ_NUM 6795*7836SJohn.Forte@Sun.COM } 6796*7836SJohn.Forte@Sun.COM #ifdef WIN32 6797*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 6798*7836SJohn.Forte@Sun.COM GetProcAddress( 6799*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 6800*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 6801*7836SJohn.Forte@Sun.COM #else 6802*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 6803*7836SJohn.Forte@Sun.COM dlsym( 6804*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 6805*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 6806*7836SJohn.Forte@Sun.COM #endif 6807*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 6808*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 6809*7836SJohn.Forte@Sun.COM } 6810*7836SJohn.Forte@Sun.COM } 6811*7836SJohn.Forte@Sun.COM } 6812*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6813*7836SJohn.Forte@Sun.COM } 6814*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 6815*7836SJohn.Forte@Sun.COM free(*ppList); 6816*7836SJohn.Forte@Sun.COM break; 6817*7836SJohn.Forte@Sun.COM } 6818*7836SJohn.Forte@Sun.COM } 6819*7836SJohn.Forte@Sun.COM } 6820*7836SJohn.Forte@Sun.COM 6821*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6822*7836SJohn.Forte@Sun.COM return (status); 6823*7836SJohn.Forte@Sun.COM 6824*7836SJohn.Forte@Sun.COM } 6825*7836SJohn.Forte@Sun.COM 6826*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetSessionOidList( 6827*7836SJohn.Forte@Sun.COM IMA_OID Oid, 6828*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 6829*7836SJohn.Forte@Sun.COM 6830*7836SJohn.Forte@Sun.COM IMA_GetSessionOidListFn PassFunc; 6831*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 6832*7836SJohn.Forte@Sun.COM 6833*7836SJohn.Forte@Sun.COM IMA_UINT i; 6834*7836SJohn.Forte@Sun.COM IMA_UINT j; 6835*7836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 6836*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6837*7836SJohn.Forte@Sun.COM 6838*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6839*7836SJohn.Forte@Sun.COM InitLibrary(); 6840*7836SJohn.Forte@Sun.COM 6841*7836SJohn.Forte@Sun.COM if (ppList == NULL) 6842*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 6843*7836SJohn.Forte@Sun.COM 6844*7836SJohn.Forte@Sun.COM if ((Oid.objectType != IMA_OBJECT_TYPE_LHBA) && 6845*7836SJohn.Forte@Sun.COM (Oid.objectType != IMA_OBJECT_TYPE_TARGET)) { 6846*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 6847*7836SJohn.Forte@Sun.COM } 6848*7836SJohn.Forte@Sun.COM 6849*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 6850*7836SJohn.Forte@Sun.COM // Get total id count first 6851*7836SJohn.Forte@Sun.COM totalIdCount = 0; 6852*7836SJohn.Forte@Sun.COM 6853*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6854*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6855*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 6856*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6857*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6858*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6859*7836SJohn.Forte@Sun.COM #ifdef WIN32 6860*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionOidListFn) 6861*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6862*7836SJohn.Forte@Sun.COM "IMA_GetSessionOidList"); 6863*7836SJohn.Forte@Sun.COM #else 6864*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionOidListFn) 6865*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6866*7836SJohn.Forte@Sun.COM "IMA_GetSessionOidList"); 6867*7836SJohn.Forte@Sun.COM #endif 6868*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6869*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 6870*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 6871*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 6872*7836SJohn.Forte@Sun.COM totalIdCount += 6873*7836SJohn.Forte@Sun.COM ppOidList->oidCount; 6874*7836SJohn.Forte@Sun.COM #ifdef WIN32 6875*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 6876*7836SJohn.Forte@Sun.COM GetProcAddress( 6877*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 6878*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 6879*7836SJohn.Forte@Sun.COM #else 6880*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 6881*7836SJohn.Forte@Sun.COM dlsym( 6882*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 6883*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 6884*7836SJohn.Forte@Sun.COM #endif 6885*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 6886*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 6887*7836SJohn.Forte@Sun.COM } 6888*7836SJohn.Forte@Sun.COM } 6889*7836SJohn.Forte@Sun.COM 6890*7836SJohn.Forte@Sun.COM } 6891*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6892*7836SJohn.Forte@Sun.COM } 6893*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 6894*7836SJohn.Forte@Sun.COM break; 6895*7836SJohn.Forte@Sun.COM } 6896*7836SJohn.Forte@Sun.COM } 6897*7836SJohn.Forte@Sun.COM } 6898*7836SJohn.Forte@Sun.COM 6899*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) + 6900*7836SJohn.Forte@Sun.COM (totalIdCount - 1)* sizeof (IMA_OID)); 6901*7836SJohn.Forte@Sun.COM 6902*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 6903*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6904*7836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 6905*7836SJohn.Forte@Sun.COM } 6906*7836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 6907*7836SJohn.Forte@Sun.COM 6908*7836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 6909*7836SJohn.Forte@Sun.COM totalIdCount = 0; 6910*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 6911*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 6912*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 6913*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 6914*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 6915*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 6916*7836SJohn.Forte@Sun.COM #ifdef WIN32 6917*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionOidListFn) 6918*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 6919*7836SJohn.Forte@Sun.COM "IMA_GetSessionOidList"); 6920*7836SJohn.Forte@Sun.COM #else 6921*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetSessionOidListFn) 6922*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 6923*7836SJohn.Forte@Sun.COM "IMA_GetSessionOidList"); 6924*7836SJohn.Forte@Sun.COM #endif 6925*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 6926*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 6927*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 6928*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 6929*7836SJohn.Forte@Sun.COM for (j = 0; 6930*7836SJohn.Forte@Sun.COM (j < ppOidList->oidCount) && 6931*7836SJohn.Forte@Sun.COM (totalIdCount < 6932*7836SJohn.Forte@Sun.COM (*ppList)->oidCount); 6933*7836SJohn.Forte@Sun.COM j++) { 6934*7836SJohn.Forte@Sun.COM 6935*7836SJohn.Forte@Sun.COM #define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber 6936*7836SJohn.Forte@Sun.COM (*ppList)->oids[ 6937*7836SJohn.Forte@Sun.COM totalIdCount]. 6938*7836SJohn.Forte@Sun.COM objectType = 6939*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 6940*7836SJohn.Forte@Sun.COM objectType; 6941*7836SJohn.Forte@Sun.COM (*ppList)->oids[ 6942*7836SJohn.Forte@Sun.COM totalIdCount]. 6943*7836SJohn.Forte@Sun.COM objectSequenceNumber 6944*7836SJohn.Forte@Sun.COM = OBJ_SEQ_NUM; 6945*7836SJohn.Forte@Sun.COM (*ppList)->oids[ 6946*7836SJohn.Forte@Sun.COM totalIdCount]. 6947*7836SJohn.Forte@Sun.COM ownerId = 6948*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 6949*7836SJohn.Forte@Sun.COM ownerId; 6950*7836SJohn.Forte@Sun.COM totalIdCount++; 6951*7836SJohn.Forte@Sun.COM #undef OBJ_SEQ_NUM 6952*7836SJohn.Forte@Sun.COM } 6953*7836SJohn.Forte@Sun.COM #ifdef WIN32 6954*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 6955*7836SJohn.Forte@Sun.COM GetProcAddress( 6956*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 6957*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 6958*7836SJohn.Forte@Sun.COM #else 6959*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 6960*7836SJohn.Forte@Sun.COM dlsym( 6961*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 6962*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 6963*7836SJohn.Forte@Sun.COM #endif 6964*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 6965*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 6966*7836SJohn.Forte@Sun.COM } 6967*7836SJohn.Forte@Sun.COM } 6968*7836SJohn.Forte@Sun.COM } 6969*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 6970*7836SJohn.Forte@Sun.COM } 6971*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 6972*7836SJohn.Forte@Sun.COM free(*ppList); 6973*7836SJohn.Forte@Sun.COM break; 6974*7836SJohn.Forte@Sun.COM } 6975*7836SJohn.Forte@Sun.COM } 6976*7836SJohn.Forte@Sun.COM } 6977*7836SJohn.Forte@Sun.COM 6978*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 6979*7836SJohn.Forte@Sun.COM return (status); 6980*7836SJohn.Forte@Sun.COM 6981*7836SJohn.Forte@Sun.COM } 6982*7836SJohn.Forte@Sun.COM 6983*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetConnectionOidList( 6984*7836SJohn.Forte@Sun.COM IMA_OID Oid, 6985*7836SJohn.Forte@Sun.COM IMA_OID_LIST **ppList) { 6986*7836SJohn.Forte@Sun.COM 6987*7836SJohn.Forte@Sun.COM IMA_GetSessionOidListFn PassFunc; 6988*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 6989*7836SJohn.Forte@Sun.COM 6990*7836SJohn.Forte@Sun.COM IMA_UINT i; 6991*7836SJohn.Forte@Sun.COM IMA_UINT j; 6992*7836SJohn.Forte@Sun.COM IMA_UINT totalIdCount; 6993*7836SJohn.Forte@Sun.COM IMA_STATUS status; 6994*7836SJohn.Forte@Sun.COM 6995*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 6996*7836SJohn.Forte@Sun.COM InitLibrary(); 6997*7836SJohn.Forte@Sun.COM 6998*7836SJohn.Forte@Sun.COM if (ppList == NULL) 6999*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 7000*7836SJohn.Forte@Sun.COM 7001*7836SJohn.Forte@Sun.COM if (Oid.objectType != IMA_OBJECT_TYPE_SESSION) { 7002*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 7003*7836SJohn.Forte@Sun.COM } 7004*7836SJohn.Forte@Sun.COM 7005*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 7006*7836SJohn.Forte@Sun.COM // Get total id count first 7007*7836SJohn.Forte@Sun.COM totalIdCount = 0; 7008*7836SJohn.Forte@Sun.COM 7009*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 7010*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 7011*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 7012*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 7013*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 7014*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 7015*7836SJohn.Forte@Sun.COM #ifdef WIN32 7016*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionOidListFn) 7017*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 7018*7836SJohn.Forte@Sun.COM "IMA_GetConnectionOidList"); 7019*7836SJohn.Forte@Sun.COM #else 7020*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionOidListFn) 7021*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 7022*7836SJohn.Forte@Sun.COM "IMA_GetConnectionOidList"); 7023*7836SJohn.Forte@Sun.COM #endif 7024*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 7025*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 7026*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 7027*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 7028*7836SJohn.Forte@Sun.COM totalIdCount += 7029*7836SJohn.Forte@Sun.COM ppOidList->oidCount; 7030*7836SJohn.Forte@Sun.COM #ifdef WIN32 7031*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 7032*7836SJohn.Forte@Sun.COM GetProcAddress( 7033*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7034*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 7035*7836SJohn.Forte@Sun.COM #else 7036*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 7037*7836SJohn.Forte@Sun.COM dlsym( 7038*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7039*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 7040*7836SJohn.Forte@Sun.COM #endif 7041*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 7042*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 7043*7836SJohn.Forte@Sun.COM } 7044*7836SJohn.Forte@Sun.COM } 7045*7836SJohn.Forte@Sun.COM 7046*7836SJohn.Forte@Sun.COM } 7047*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 7048*7836SJohn.Forte@Sun.COM } 7049*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 7050*7836SJohn.Forte@Sun.COM break; 7051*7836SJohn.Forte@Sun.COM } 7052*7836SJohn.Forte@Sun.COM } 7053*7836SJohn.Forte@Sun.COM } 7054*7836SJohn.Forte@Sun.COM 7055*7836SJohn.Forte@Sun.COM 7056*7836SJohn.Forte@Sun.COM *ppList = (IMA_OID_LIST*)calloc(1, sizeof (IMA_OID_LIST) 7057*7836SJohn.Forte@Sun.COM + (totalIdCount - 1)* sizeof (IMA_OID)); 7058*7836SJohn.Forte@Sun.COM 7059*7836SJohn.Forte@Sun.COM if ((*ppList) == NULL) { 7060*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 7061*7836SJohn.Forte@Sun.COM return (IMA_ERROR_UNEXPECTED_OS_ERROR); 7062*7836SJohn.Forte@Sun.COM } 7063*7836SJohn.Forte@Sun.COM (*ppList)->oidCount = totalIdCount; 7064*7836SJohn.Forte@Sun.COM 7065*7836SJohn.Forte@Sun.COM // 2nd pass to copy the id lists 7066*7836SJohn.Forte@Sun.COM totalIdCount = 0; 7067*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 7068*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 7069*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == Oid.ownerId) { 7070*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 7071*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 7072*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 7073*7836SJohn.Forte@Sun.COM #ifdef WIN32 7074*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionOidListFn) 7075*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 7076*7836SJohn.Forte@Sun.COM "IMA_GetConnectionOidList"); 7077*7836SJohn.Forte@Sun.COM #else 7078*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetConnectionOidListFn) 7079*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 7080*7836SJohn.Forte@Sun.COM "IMA_GetConnectionOidList"); 7081*7836SJohn.Forte@Sun.COM #endif 7082*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 7083*7836SJohn.Forte@Sun.COM IMA_OID_LIST *ppOidList; 7084*7836SJohn.Forte@Sun.COM status = PassFunc(Oid, &ppOidList); 7085*7836SJohn.Forte@Sun.COM if (status == IMA_STATUS_SUCCESS) { 7086*7836SJohn.Forte@Sun.COM for (j = 0; ( 7087*7836SJohn.Forte@Sun.COM j < ppOidList->oidCount) && 7088*7836SJohn.Forte@Sun.COM (totalIdCount < 7089*7836SJohn.Forte@Sun.COM (*ppList)->oidCount); 7090*7836SJohn.Forte@Sun.COM j++) { 7091*7836SJohn.Forte@Sun.COM #define OBJ_SEQ_NUM ppOidList->oids[j].objectSequenceNumber 7092*7836SJohn.Forte@Sun.COM (*ppList)-> 7093*7836SJohn.Forte@Sun.COM oids[totalIdCount]. 7094*7836SJohn.Forte@Sun.COM objectType = 7095*7836SJohn.Forte@Sun.COM ppOidList-> 7096*7836SJohn.Forte@Sun.COM oids[j].objectType; 7097*7836SJohn.Forte@Sun.COM (*ppList)-> 7098*7836SJohn.Forte@Sun.COM oids[totalIdCount]. 7099*7836SJohn.Forte@Sun.COM objectSequenceNumber 7100*7836SJohn.Forte@Sun.COM = OBJ_SEQ_NUM; 7101*7836SJohn.Forte@Sun.COM (*ppList)-> 7102*7836SJohn.Forte@Sun.COM oids[totalIdCount]. 7103*7836SJohn.Forte@Sun.COM ownerId = 7104*7836SJohn.Forte@Sun.COM ppOidList->oids[j]. 7105*7836SJohn.Forte@Sun.COM ownerId; 7106*7836SJohn.Forte@Sun.COM totalIdCount++; 7107*7836SJohn.Forte@Sun.COM #undef OBJ_SEQ_NUM 7108*7836SJohn.Forte@Sun.COM } 7109*7836SJohn.Forte@Sun.COM #ifdef WIN32 7110*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 7111*7836SJohn.Forte@Sun.COM GetProcAddress( 7112*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7113*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 7114*7836SJohn.Forte@Sun.COM #else 7115*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 7116*7836SJohn.Forte@Sun.COM dlsym( 7117*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7118*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 7119*7836SJohn.Forte@Sun.COM #endif 7120*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 7121*7836SJohn.Forte@Sun.COM FreeFunc(ppOidList); 7122*7836SJohn.Forte@Sun.COM } 7123*7836SJohn.Forte@Sun.COM } 7124*7836SJohn.Forte@Sun.COM } 7125*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 7126*7836SJohn.Forte@Sun.COM } 7127*7836SJohn.Forte@Sun.COM if (status != IMA_STATUS_SUCCESS) { 7128*7836SJohn.Forte@Sun.COM free(*ppList); 7129*7836SJohn.Forte@Sun.COM break; 7130*7836SJohn.Forte@Sun.COM } 7131*7836SJohn.Forte@Sun.COM } 7132*7836SJohn.Forte@Sun.COM } 7133*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 7134*7836SJohn.Forte@Sun.COM return (status); 7135*7836SJohn.Forte@Sun.COM 7136*7836SJohn.Forte@Sun.COM } 7137*7836SJohn.Forte@Sun.COM 7138*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_RemoveDiscoveryAddress( 7139*7836SJohn.Forte@Sun.COM IMA_OID discoveryAddressOid) { 7140*7836SJohn.Forte@Sun.COM 7141*7836SJohn.Forte@Sun.COM IMA_RemoveDiscoveryAddressFn PassFunc; 7142*7836SJohn.Forte@Sun.COM IMA_UINT i; 7143*7836SJohn.Forte@Sun.COM IMA_STATUS status; 7144*7836SJohn.Forte@Sun.COM 7145*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 7146*7836SJohn.Forte@Sun.COM InitLibrary(); 7147*7836SJohn.Forte@Sun.COM 7148*7836SJohn.Forte@Sun.COM if (discoveryAddressOid.objectType != 7149*7836SJohn.Forte@Sun.COM IMA_OBJECT_TYPE_DISCOVERY_ADDRESS) { 7150*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 7151*7836SJohn.Forte@Sun.COM } 7152*7836SJohn.Forte@Sun.COM 7153*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 7154*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 7155*7836SJohn.Forte@Sun.COM 7156*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 7157*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == discoveryAddressOid.ownerId) { 7158*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 7159*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 7160*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 7161*7836SJohn.Forte@Sun.COM #ifdef WIN32 7162*7836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveDiscoveryAddressFn) 7163*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 7164*7836SJohn.Forte@Sun.COM "IMA_RemoveDiscoveryAddress"); 7165*7836SJohn.Forte@Sun.COM #else 7166*7836SJohn.Forte@Sun.COM PassFunc = (IMA_RemoveDiscoveryAddressFn) 7167*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 7168*7836SJohn.Forte@Sun.COM "IMA_RemoveDiscoveryAddress"); 7169*7836SJohn.Forte@Sun.COM #endif 7170*7836SJohn.Forte@Sun.COM 7171*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 7172*7836SJohn.Forte@Sun.COM status = PassFunc(discoveryAddressOid); 7173*7836SJohn.Forte@Sun.COM } 7174*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 7175*7836SJohn.Forte@Sun.COM } 7176*7836SJohn.Forte@Sun.COM 7177*7836SJohn.Forte@Sun.COM break; 7178*7836SJohn.Forte@Sun.COM } 7179*7836SJohn.Forte@Sun.COM } 7180*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 7181*7836SJohn.Forte@Sun.COM return (status); 7182*7836SJohn.Forte@Sun.COM } 7183*7836SJohn.Forte@Sun.COM 7184*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetIpsecProperties( 7185*7836SJohn.Forte@Sun.COM IMA_OID oid, 7186*7836SJohn.Forte@Sun.COM IMA_IPSEC_PROPERTIES *pProps) { 7187*7836SJohn.Forte@Sun.COM IMA_GetIpsecPropertiesFn PassFunc; 7188*7836SJohn.Forte@Sun.COM IMA_UINT i; 7189*7836SJohn.Forte@Sun.COM IMA_STATUS status; 7190*7836SJohn.Forte@Sun.COM 7191*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 7192*7836SJohn.Forte@Sun.COM InitLibrary(); 7193*7836SJohn.Forte@Sun.COM 7194*7836SJohn.Forte@Sun.COM if (pProps == NULL) 7195*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 7196*7836SJohn.Forte@Sun.COM 7197*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_PNP && 7198*7836SJohn.Forte@Sun.COM oid.objectType != IMA_OBJECT_TYPE_LHBA) { 7199*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 7200*7836SJohn.Forte@Sun.COM } 7201*7836SJohn.Forte@Sun.COM 7202*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 7203*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 7204*7836SJohn.Forte@Sun.COM 7205*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 7206*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 7207*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 7208*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 7209*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 7210*7836SJohn.Forte@Sun.COM #ifdef WIN32 7211*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetIpsecPropertiesFn) 7212*7836SJohn.Forte@Sun.COM GetProcAddress(plugintable[i].hPlugin, 7213*7836SJohn.Forte@Sun.COM "IMA_GetIpsecProperties"); 7214*7836SJohn.Forte@Sun.COM #else 7215*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetIpsecPropertiesFn) 7216*7836SJohn.Forte@Sun.COM dlsym(plugintable[i].hPlugin, 7217*7836SJohn.Forte@Sun.COM "IMA_GetIpsecProperties"); 7218*7836SJohn.Forte@Sun.COM #endif 7219*7836SJohn.Forte@Sun.COM 7220*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 7221*7836SJohn.Forte@Sun.COM status = PassFunc(oid, pProps); 7222*7836SJohn.Forte@Sun.COM } 7223*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 7224*7836SJohn.Forte@Sun.COM } 7225*7836SJohn.Forte@Sun.COM 7226*7836SJohn.Forte@Sun.COM break; 7227*7836SJohn.Forte@Sun.COM } 7228*7836SJohn.Forte@Sun.COM } 7229*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 7230*7836SJohn.Forte@Sun.COM return (status); 7231*7836SJohn.Forte@Sun.COM } 7232*7836SJohn.Forte@Sun.COM 7233*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetAddressKeys( 7234*7836SJohn.Forte@Sun.COM IMA_OID targetOid, 7235*7836SJohn.Forte@Sun.COM IMA_ADDRESS_KEYS **ppKeys) { 7236*7836SJohn.Forte@Sun.COM IMA_GetAddressKeysFn PassFunc; 7237*7836SJohn.Forte@Sun.COM IMA_FreeMemoryFn FreeFunc; 7238*7836SJohn.Forte@Sun.COM 7239*7836SJohn.Forte@Sun.COM IMA_STATUS status; 7240*7836SJohn.Forte@Sun.COM IMA_UINT i; 7241*7836SJohn.Forte@Sun.COM 7242*7836SJohn.Forte@Sun.COM 7243*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 7244*7836SJohn.Forte@Sun.COM InitLibrary(); 7245*7836SJohn.Forte@Sun.COM 7246*7836SJohn.Forte@Sun.COM if (ppKeys == NULL) 7247*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 7248*7836SJohn.Forte@Sun.COM 7249*7836SJohn.Forte@Sun.COM if (targetOid.objectType != IMA_OBJECT_TYPE_TARGET) 7250*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 7251*7836SJohn.Forte@Sun.COM 7252*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 7253*7836SJohn.Forte@Sun.COM 7254*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 7255*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 7256*7836SJohn.Forte@Sun.COM 7257*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == targetOid.ownerId) { 7258*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 7259*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 7260*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 7261*7836SJohn.Forte@Sun.COM #ifdef WIN32 7262*7836SJohn.Forte@Sun.COM PassFunc = 7263*7836SJohn.Forte@Sun.COM (IMA_GetAddressKeysFn) GetProcAddress( 7264*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7265*7836SJohn.Forte@Sun.COM "IMA_GetAddressKeys"); 7266*7836SJohn.Forte@Sun.COM #else 7267*7836SJohn.Forte@Sun.COM PassFunc = (IMA_GetAddressKeysFn) dlsym( 7268*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7269*7836SJohn.Forte@Sun.COM "IMA_GetAddressKeys"); 7270*7836SJohn.Forte@Sun.COM #endif 7271*7836SJohn.Forte@Sun.COM 7272*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 7273*7836SJohn.Forte@Sun.COM IMA_ADDRESS_KEYS *ppKeysList; 7274*7836SJohn.Forte@Sun.COM IMA_UINT addrSize; 7275*7836SJohn.Forte@Sun.COM addrSize = sizeof (IMA_ADDRESS_KEYS); 7276*7836SJohn.Forte@Sun.COM status = 7277*7836SJohn.Forte@Sun.COM PassFunc(targetOid, &ppKeysList); 7278*7836SJohn.Forte@Sun.COM if (IMA_SUCCESS(status)) { 7279*7836SJohn.Forte@Sun.COM 7280*7836SJohn.Forte@Sun.COM *ppKeys = 7281*7836SJohn.Forte@Sun.COM (IMA_ADDRESS_KEYS*)calloc(1, 7282*7836SJohn.Forte@Sun.COM addrSize + 7283*7836SJohn.Forte@Sun.COM (ppKeysList->addressKeyCount 7284*7836SJohn.Forte@Sun.COM - 1) * addrSize); 7285*7836SJohn.Forte@Sun.COM if ((*ppKeys) == NULL) { 7286*7836SJohn.Forte@Sun.COM status = EUOS_ERROR; 7287*7836SJohn.Forte@Sun.COM } else { 7288*7836SJohn.Forte@Sun.COM memcpy((*ppKeys), 7289*7836SJohn.Forte@Sun.COM ppKeysList, 7290*7836SJohn.Forte@Sun.COM addrSize + 7291*7836SJohn.Forte@Sun.COM (ppKeysList-> 7292*7836SJohn.Forte@Sun.COM addressKeyCount-1)* 7293*7836SJohn.Forte@Sun.COM addrSize); 7294*7836SJohn.Forte@Sun.COM 7295*7836SJohn.Forte@Sun.COM } 7296*7836SJohn.Forte@Sun.COM #ifdef WIN32 7297*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 7298*7836SJohn.Forte@Sun.COM GetProcAddress( 7299*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7300*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 7301*7836SJohn.Forte@Sun.COM #else 7302*7836SJohn.Forte@Sun.COM FreeFunc = (IMA_FreeMemoryFn) 7303*7836SJohn.Forte@Sun.COM dlsym( 7304*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7305*7836SJohn.Forte@Sun.COM "IMA_FreeMemory"); 7306*7836SJohn.Forte@Sun.COM #endif 7307*7836SJohn.Forte@Sun.COM if (FreeFunc != NULL) { 7308*7836SJohn.Forte@Sun.COM FreeFunc(ppKeysList); 7309*7836SJohn.Forte@Sun.COM } 7310*7836SJohn.Forte@Sun.COM } 7311*7836SJohn.Forte@Sun.COM } 7312*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 7313*7836SJohn.Forte@Sun.COM } 7314*7836SJohn.Forte@Sun.COM 7315*7836SJohn.Forte@Sun.COM break; 7316*7836SJohn.Forte@Sun.COM } 7317*7836SJohn.Forte@Sun.COM } 7318*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 7319*7836SJohn.Forte@Sun.COM return (status); 7320*7836SJohn.Forte@Sun.COM } 7321*7836SJohn.Forte@Sun.COM 7322*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS IMA_GetDiscoveryAddressProperties( 7323*7836SJohn.Forte@Sun.COM IMA_OID oid, 7324*7836SJohn.Forte@Sun.COM IMA_DISCOVERY_ADDRESS_PROPERTIES *pProps) { 7325*7836SJohn.Forte@Sun.COM 7326*7836SJohn.Forte@Sun.COM IMA_GetDiscoveryAddressPropertiesFn PassFunc; 7327*7836SJohn.Forte@Sun.COM IMA_UINT i; 7328*7836SJohn.Forte@Sun.COM IMA_STATUS status; 7329*7836SJohn.Forte@Sun.COM 7330*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 7331*7836SJohn.Forte@Sun.COM InitLibrary(); 7332*7836SJohn.Forte@Sun.COM 7333*7836SJohn.Forte@Sun.COM if (pProps == NULL) 7334*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 7335*7836SJohn.Forte@Sun.COM 7336*7836SJohn.Forte@Sun.COM if (oid.objectType != IMA_OBJECT_TYPE_DISCOVERY_ADDRESS) 7337*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INCORRECT_OBJECT_TYPE); 7338*7836SJohn.Forte@Sun.COM 7339*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 7340*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 7341*7836SJohn.Forte@Sun.COM 7342*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 7343*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == oid.ownerId) { 7344*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 7345*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 7346*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 7347*7836SJohn.Forte@Sun.COM #ifdef WIN32 7348*7836SJohn.Forte@Sun.COM PassFunc = 7349*7836SJohn.Forte@Sun.COM (IMA_GetDiscoveryAddressPropertiesFn) 7350*7836SJohn.Forte@Sun.COM GetProcAddress( 7351*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7352*7836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressProperties"); 7353*7836SJohn.Forte@Sun.COM #else 7354*7836SJohn.Forte@Sun.COM PassFunc = 7355*7836SJohn.Forte@Sun.COM (IMA_GetDiscoveryAddressPropertiesFn) dlsym( 7356*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7357*7836SJohn.Forte@Sun.COM "IMA_GetDiscoveryAddressProperties"); 7358*7836SJohn.Forte@Sun.COM #endif 7359*7836SJohn.Forte@Sun.COM 7360*7836SJohn.Forte@Sun.COM if (PassFunc != NULL) { 7361*7836SJohn.Forte@Sun.COM status = PassFunc(oid, pProps); 7362*7836SJohn.Forte@Sun.COM } 7363*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 7364*7836SJohn.Forte@Sun.COM } 7365*7836SJohn.Forte@Sun.COM 7366*7836SJohn.Forte@Sun.COM break; 7367*7836SJohn.Forte@Sun.COM } 7368*7836SJohn.Forte@Sun.COM } 7369*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 7370*7836SJohn.Forte@Sun.COM return (status); 7371*7836SJohn.Forte@Sun.COM } 7372*7836SJohn.Forte@Sun.COM 7373*7836SJohn.Forte@Sun.COM IMA_API IMA_STATUS QIMA_SetUpdateInterval( 7374*7836SJohn.Forte@Sun.COM IMA_OID pluginOid, time_t interval) { 7375*7836SJohn.Forte@Sun.COM QIMA_SetUpdateIntervalFn updFunc; 7376*7836SJohn.Forte@Sun.COM IMA_UINT i; 7377*7836SJohn.Forte@Sun.COM IMA_STATUS status; 7378*7836SJohn.Forte@Sun.COM 7379*7836SJohn.Forte@Sun.COM if (number_of_plugins == -1) 7380*7836SJohn.Forte@Sun.COM InitLibrary(); 7381*7836SJohn.Forte@Sun.COM 7382*7836SJohn.Forte@Sun.COM if (interval <= 1) 7383*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 7384*7836SJohn.Forte@Sun.COM 7385*7836SJohn.Forte@Sun.COM if ((pluginOid.objectType != IMA_OBJECT_TYPE_PLUGIN) || 7386*7836SJohn.Forte@Sun.COM (pluginOid.objectSequenceNumber != 0)) 7387*7836SJohn.Forte@Sun.COM return (IMA_ERROR_INVALID_PARAMETER); 7388*7836SJohn.Forte@Sun.COM 7389*7836SJohn.Forte@Sun.COM os_obtainmutex(libMutex); 7390*7836SJohn.Forte@Sun.COM status = IMA_ERROR_OBJECT_NOT_FOUND; 7391*7836SJohn.Forte@Sun.COM 7392*7836SJohn.Forte@Sun.COM for (i = 0; i < number_of_plugins; i++) { 7393*7836SJohn.Forte@Sun.COM if (plugintable[i].ownerId == pluginOid.ownerId) { 7394*7836SJohn.Forte@Sun.COM status = IMA_ERROR_UNEXPECTED_OS_ERROR; 7395*7836SJohn.Forte@Sun.COM if (plugintable[i].hPlugin != NULL) { 7396*7836SJohn.Forte@Sun.COM os_obtainmutex(plugintable[i].pluginMutex); 7397*7836SJohn.Forte@Sun.COM #ifdef WIN32 7398*7836SJohn.Forte@Sun.COM updFunc = (QIMA_SetUpdateIntervalFn) 7399*7836SJohn.Forte@Sun.COM GetProcAddress( 7400*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7401*7836SJohn.Forte@Sun.COM "QIMA_SetUpdateInterval"); 7402*7836SJohn.Forte@Sun.COM #else 7403*7836SJohn.Forte@Sun.COM updFunc = (QIMA_SetUpdateIntervalFn) dlsym( 7404*7836SJohn.Forte@Sun.COM plugintable[i].hPlugin, 7405*7836SJohn.Forte@Sun.COM "QIMA_SetUpdateInterval"); 7406*7836SJohn.Forte@Sun.COM #endif 7407*7836SJohn.Forte@Sun.COM 7408*7836SJohn.Forte@Sun.COM if (updFunc != NULL) { 7409*7836SJohn.Forte@Sun.COM status = updFunc(pluginOid, interval); 7410*7836SJohn.Forte@Sun.COM } 7411*7836SJohn.Forte@Sun.COM os_releasemutex(plugintable[i].pluginMutex); 7412*7836SJohn.Forte@Sun.COM } 7413*7836SJohn.Forte@Sun.COM 7414*7836SJohn.Forte@Sun.COM break; 7415*7836SJohn.Forte@Sun.COM } 7416*7836SJohn.Forte@Sun.COM } 7417*7836SJohn.Forte@Sun.COM os_releasemutex(libMutex); 7418*7836SJohn.Forte@Sun.COM return (status); 7419*7836SJohn.Forte@Sun.COM 7420*7836SJohn.Forte@Sun.COM } 7421